google_displayvideo1/
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    /// Create, see, edit, and permanently delete your Display & Video 360 entities and reports
17    DisplayVideo,
18
19    /// Create, see, and edit Display & Video 360 Campaign entities and see billing invoices
20    DisplayVideoMediaplanning,
21
22    /// Private Service: https://www.googleapis.com/auth/display-video-user-management
23    DisplayVideoUserManagement,
24
25    /// View and manage your reports in DoubleClick Bid Manager
26    Doubleclickbidmanager,
27}
28
29impl AsRef<str> for Scope {
30    fn as_ref(&self) -> &str {
31        match *self {
32            Scope::DisplayVideo => "https://www.googleapis.com/auth/display-video",
33            Scope::DisplayVideoMediaplanning => {
34                "https://www.googleapis.com/auth/display-video-mediaplanning"
35            }
36            Scope::DisplayVideoUserManagement => {
37                "https://www.googleapis.com/auth/display-video-user-management"
38            }
39            Scope::Doubleclickbidmanager => "https://www.googleapis.com/auth/doubleclickbidmanager",
40        }
41    }
42}
43
44#[allow(clippy::derivable_impls)]
45impl Default for Scope {
46    fn default() -> Scope {
47        Scope::DisplayVideo
48    }
49}
50
51// ########
52// HUB ###
53// ######
54
55/// Central instance to access all DisplayVideo related resource activities
56///
57/// # Examples
58///
59/// Instantiate a new hub
60///
61/// ```test_harness,no_run
62/// extern crate hyper;
63/// extern crate hyper_rustls;
64/// extern crate google_displayvideo1 as displayvideo1;
65/// use displayvideo1::{Result, Error};
66/// # async fn dox() {
67/// use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
68///
69/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
70/// // `client_secret`, among other things.
71/// let secret: yup_oauth2::ApplicationSecret = Default::default();
72/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
73/// // unless you replace  `None` with the desired Flow.
74/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
75/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
76/// // retrieve them from storage.
77/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
78///     secret,
79///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
80/// ).build().await.unwrap();
81///
82/// let client = hyper_util::client::legacy::Client::builder(
83///     hyper_util::rt::TokioExecutor::new()
84/// )
85/// .build(
86///     hyper_rustls::HttpsConnectorBuilder::new()
87///         .with_native_roots()
88///         .unwrap()
89///         .https_or_http()
90///         .enable_http1()
91///         .build()
92/// );
93/// let mut hub = DisplayVideo::new(client, auth);
94/// // You can configure optional parameters by calling the respective setters at will, and
95/// // execute the final call using `doit()`.
96/// // Values shown here are possibly random and not representative !
97/// let result = hub.advertisers().campaigns_targeting_types_assigned_targeting_options_list(-51, -12, "targetingType")
98///              .page_token("dolor")
99///              .page_size(-17)
100///              .order_by("ipsum")
101///              .filter("invidunt")
102///              .doit().await;
103///
104/// match result {
105///     Err(e) => match e {
106///         // The Error enum provides details about what exactly happened.
107///         // You can also just use its `Debug`, `Display` or `Error` traits
108///          Error::HttpError(_)
109///         |Error::Io(_)
110///         |Error::MissingAPIKey
111///         |Error::MissingToken(_)
112///         |Error::Cancelled
113///         |Error::UploadSizeLimitExceeded(_, _)
114///         |Error::Failure(_)
115///         |Error::BadRequest(_)
116///         |Error::FieldClash(_)
117///         |Error::JsonDecodeError(_, _) => println!("{}", e),
118///     },
119///     Ok(res) => println!("Success: {:?}", res),
120/// }
121/// # }
122/// ```
123#[derive(Clone)]
124pub struct DisplayVideo<C> {
125    pub client: common::Client<C>,
126    pub auth: Box<dyn common::GetToken>,
127    _user_agent: String,
128    _base_url: String,
129    _root_url: String,
130}
131
132impl<C> common::Hub for DisplayVideo<C> {}
133
134impl<'a, C> DisplayVideo<C> {
135    pub fn new<A: 'static + common::GetToken>(
136        client: common::Client<C>,
137        auth: A,
138    ) -> DisplayVideo<C> {
139        DisplayVideo {
140            client,
141            auth: Box::new(auth),
142            _user_agent: "google-api-rust-client/6.0.0".to_string(),
143            _base_url: "https://displayvideo.googleapis.com/".to_string(),
144            _root_url: "https://displayvideo.googleapis.com/".to_string(),
145        }
146    }
147
148    pub fn advertisers(&'a self) -> AdvertiserMethods<'a, C> {
149        AdvertiserMethods { hub: self }
150    }
151    pub fn combined_audiences(&'a self) -> CombinedAudienceMethods<'a, C> {
152        CombinedAudienceMethods { hub: self }
153    }
154    pub fn custom_bidding_algorithms(&'a self) -> CustomBiddingAlgorithmMethods<'a, C> {
155        CustomBiddingAlgorithmMethods { hub: self }
156    }
157    pub fn custom_lists(&'a self) -> CustomListMethods<'a, C> {
158        CustomListMethods { hub: self }
159    }
160    pub fn first_and_third_party_audiences(&'a self) -> FirstAndThirdPartyAudienceMethods<'a, C> {
161        FirstAndThirdPartyAudienceMethods { hub: self }
162    }
163    pub fn floodlight_groups(&'a self) -> FloodlightGroupMethods<'a, C> {
164        FloodlightGroupMethods { hub: self }
165    }
166    pub fn google_audiences(&'a self) -> GoogleAudienceMethods<'a, C> {
167        GoogleAudienceMethods { hub: self }
168    }
169    pub fn guaranteed_orders(&'a self) -> GuaranteedOrderMethods<'a, C> {
170        GuaranteedOrderMethods { hub: self }
171    }
172    pub fn inventory_source_groups(&'a self) -> InventorySourceGroupMethods<'a, C> {
173        InventorySourceGroupMethods { hub: self }
174    }
175    pub fn inventory_sources(&'a self) -> InventorySourceMethods<'a, C> {
176        InventorySourceMethods { hub: self }
177    }
178    pub fn media(&'a self) -> MediaMethods<'a, C> {
179        MediaMethods { hub: self }
180    }
181    pub fn partners(&'a self) -> PartnerMethods<'a, C> {
182        PartnerMethods { hub: self }
183    }
184    pub fn sdfdownloadtasks(&'a self) -> SdfdownloadtaskMethods<'a, C> {
185        SdfdownloadtaskMethods { hub: self }
186    }
187    pub fn targeting_types(&'a self) -> TargetingTypeMethods<'a, C> {
188        TargetingTypeMethods { hub: self }
189    }
190    pub fn users(&'a self) -> UserMethods<'a, C> {
191        UserMethods { hub: self }
192    }
193
194    /// Set the user-agent header field to use in all requests to the server.
195    /// It defaults to `google-api-rust-client/6.0.0`.
196    ///
197    /// Returns the previously set user-agent.
198    pub fn user_agent(&mut self, agent_name: String) -> String {
199        std::mem::replace(&mut self._user_agent, agent_name)
200    }
201
202    /// Set the base url to use in all requests to the server.
203    /// It defaults to `https://displayvideo.googleapis.com/`.
204    ///
205    /// Returns the previously set base url.
206    pub fn base_url(&mut self, new_base_url: String) -> String {
207        std::mem::replace(&mut self._base_url, new_base_url)
208    }
209
210    /// Set the root url to use in all requests to the server.
211    /// It defaults to `https://displayvideo.googleapis.com/`.
212    ///
213    /// Returns the previously set root url.
214    pub fn root_url(&mut self, new_root_url: String) -> String {
215        std::mem::replace(&mut self._root_url, new_root_url)
216    }
217}
218
219// ############
220// SCHEMAS ###
221// ##########
222/// Request message for ManualTriggerService.ActivateManualTrigger.
223///
224/// # Activities
225///
226/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
227/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
228///
229/// * [manual triggers activate advertisers](AdvertiserManualTriggerActivateCall) (request)
230#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
231#[serde_with::serde_as]
232#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
233pub struct ActivateManualTriggerRequest {
234    _never_set: Option<bool>,
235}
236
237impl common::RequestValue for ActivateManualTriggerRequest {}
238
239/// Configuration for custom Active View video viewability metrics.
240///
241/// This type is not used in any activity, and only used as *part* of another schema.
242///
243#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
244#[serde_with::serde_as]
245#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
246pub struct ActiveViewVideoViewabilityMetricConfig {
247    /// Required. The display name of the custom metric.
248    #[serde(rename = "displayName")]
249    pub display_name: Option<String>,
250    /// The minimum visible video duration required (in seconds) in order for an impression to be recorded. You must specify minimum_duration, minimum_quartile or both. If both are specified, an impression meets the metric criteria if either requirement is met (whichever happens first).
251    #[serde(rename = "minimumDuration")]
252    pub minimum_duration: Option<String>,
253    /// The minimum visible video duration required, based on the video quartiles, in order for an impression to be recorded. You must specify minimum_duration, minimum_quartile or both. If both are specified, an impression meets the metric criteria if either requirement is met (whichever happens first).
254    #[serde(rename = "minimumQuartile")]
255    pub minimum_quartile: Option<String>,
256    /// Required. The minimum percentage of the video ad's pixels visible on the screen in order for an impression to be recorded.
257    #[serde(rename = "minimumViewability")]
258    pub minimum_viewability: Option<String>,
259    /// Required. The minimum percentage of the video ad's volume required in order for an impression to be recorded.
260    #[serde(rename = "minimumVolume")]
261    pub minimum_volume: Option<String>,
262}
263
264impl common::Part for ActiveViewVideoViewabilityMetricConfig {}
265
266/// Details of Adloox settings.
267///
268/// This type is not used in any activity, and only used as *part* of another schema.
269///
270#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
271#[serde_with::serde_as]
272#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
273pub struct Adloox {
274    /// Adloox's brand safety settings.
275    #[serde(rename = "excludedAdlooxCategories")]
276    pub excluded_adloox_categories: Option<Vec<String>>,
277}
278
279impl common::Part for Adloox {}
280
281/// A single advertiser in Display & Video 360 (DV360).
282///
283/// # Activities
284///
285/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
286/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
287///
288/// * [assets upload advertisers](AdvertiserAssetUploadCall) (none)
289/// * [campaigns targeting types assigned targeting options get advertisers](AdvertiserCampaignTargetingTypeAssignedTargetingOptionGetCall) (none)
290/// * [campaigns targeting types assigned targeting options list advertisers](AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall) (none)
291/// * [campaigns bulk list campaign assigned targeting options advertisers](AdvertiserCampaignBulkListCampaignAssignedTargetingOptionCall) (none)
292/// * [campaigns create advertisers](AdvertiserCampaignCreateCall) (none)
293/// * [campaigns delete advertisers](AdvertiserCampaignDeleteCall) (none)
294/// * [campaigns get advertisers](AdvertiserCampaignGetCall) (none)
295/// * [campaigns list advertisers](AdvertiserCampaignListCall) (none)
296/// * [campaigns patch advertisers](AdvertiserCampaignPatchCall) (none)
297/// * [channels sites bulk edit advertisers](AdvertiserChannelSiteBulkEditCall) (none)
298/// * [channels sites create advertisers](AdvertiserChannelSiteCreateCall) (none)
299/// * [channels sites delete advertisers](AdvertiserChannelSiteDeleteCall) (none)
300/// * [channels sites list advertisers](AdvertiserChannelSiteListCall) (none)
301/// * [channels sites replace advertisers](AdvertiserChannelSiteReplaceCall) (none)
302/// * [channels create advertisers](AdvertiserChannelCreateCall) (none)
303/// * [channels get advertisers](AdvertiserChannelGetCall) (none)
304/// * [channels list advertisers](AdvertiserChannelListCall) (none)
305/// * [channels patch advertisers](AdvertiserChannelPatchCall) (none)
306/// * [creatives create advertisers](AdvertiserCreativeCreateCall) (none)
307/// * [creatives delete advertisers](AdvertiserCreativeDeleteCall) (none)
308/// * [creatives get advertisers](AdvertiserCreativeGetCall) (none)
309/// * [creatives list advertisers](AdvertiserCreativeListCall) (none)
310/// * [creatives patch advertisers](AdvertiserCreativePatchCall) (none)
311/// * [insertion orders targeting types assigned targeting options get advertisers](AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionGetCall) (none)
312/// * [insertion orders targeting types assigned targeting options list advertisers](AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall) (none)
313/// * [insertion orders bulk list insertion order assigned targeting options advertisers](AdvertiserInsertionOrderBulkListInsertionOrderAssignedTargetingOptionCall) (none)
314/// * [insertion orders create advertisers](AdvertiserInsertionOrderCreateCall) (none)
315/// * [insertion orders delete advertisers](AdvertiserInsertionOrderDeleteCall) (none)
316/// * [insertion orders get advertisers](AdvertiserInsertionOrderGetCall) (none)
317/// * [insertion orders list advertisers](AdvertiserInsertionOrderListCall) (none)
318/// * [insertion orders patch advertisers](AdvertiserInsertionOrderPatchCall) (none)
319/// * [invoices list advertisers](AdvertiserInvoiceListCall) (none)
320/// * [invoices lookup invoice currency advertisers](AdvertiserInvoiceLookupInvoiceCurrencyCall) (none)
321/// * [line items targeting types assigned targeting options create advertisers](AdvertiserLineItemTargetingTypeAssignedTargetingOptionCreateCall) (none)
322/// * [line items targeting types assigned targeting options delete advertisers](AdvertiserLineItemTargetingTypeAssignedTargetingOptionDeleteCall) (none)
323/// * [line items targeting types assigned targeting options get advertisers](AdvertiserLineItemTargetingTypeAssignedTargetingOptionGetCall) (none)
324/// * [line items targeting types assigned targeting options list advertisers](AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall) (none)
325/// * [line items bulk edit line item assigned targeting options advertisers](AdvertiserLineItemBulkEditLineItemAssignedTargetingOptionCall) (none)
326/// * [line items bulk list line item assigned targeting options advertisers](AdvertiserLineItemBulkListLineItemAssignedTargetingOptionCall) (none)
327/// * [line items create advertisers](AdvertiserLineItemCreateCall) (none)
328/// * [line items delete advertisers](AdvertiserLineItemDeleteCall) (none)
329/// * [line items generate default advertisers](AdvertiserLineItemGenerateDefaultCall) (none)
330/// * [line items get advertisers](AdvertiserLineItemGetCall) (none)
331/// * [line items list advertisers](AdvertiserLineItemListCall) (none)
332/// * [line items patch advertisers](AdvertiserLineItemPatchCall) (none)
333/// * [location lists assigned locations bulk edit advertisers](AdvertiserLocationListAssignedLocationBulkEditCall) (none)
334/// * [location lists assigned locations create advertisers](AdvertiserLocationListAssignedLocationCreateCall) (none)
335/// * [location lists assigned locations delete advertisers](AdvertiserLocationListAssignedLocationDeleteCall) (none)
336/// * [location lists assigned locations list advertisers](AdvertiserLocationListAssignedLocationListCall) (none)
337/// * [location lists create advertisers](AdvertiserLocationListCreateCall) (none)
338/// * [location lists get advertisers](AdvertiserLocationListGetCall) (none)
339/// * [location lists list advertisers](AdvertiserLocationListListCall) (none)
340/// * [location lists patch advertisers](AdvertiserLocationListPatchCall) (none)
341/// * [manual triggers activate advertisers](AdvertiserManualTriggerActivateCall) (none)
342/// * [manual triggers create advertisers](AdvertiserManualTriggerCreateCall) (none)
343/// * [manual triggers deactivate advertisers](AdvertiserManualTriggerDeactivateCall) (none)
344/// * [manual triggers get advertisers](AdvertiserManualTriggerGetCall) (none)
345/// * [manual triggers list advertisers](AdvertiserManualTriggerListCall) (none)
346/// * [manual triggers patch advertisers](AdvertiserManualTriggerPatchCall) (none)
347/// * [negative keyword lists negative keywords bulk edit advertisers](AdvertiserNegativeKeywordListNegativeKeywordBulkEditCall) (none)
348/// * [negative keyword lists negative keywords create advertisers](AdvertiserNegativeKeywordListNegativeKeywordCreateCall) (none)
349/// * [negative keyword lists negative keywords delete advertisers](AdvertiserNegativeKeywordListNegativeKeywordDeleteCall) (none)
350/// * [negative keyword lists negative keywords list advertisers](AdvertiserNegativeKeywordListNegativeKeywordListCall) (none)
351/// * [negative keyword lists negative keywords replace advertisers](AdvertiserNegativeKeywordListNegativeKeywordReplaceCall) (none)
352/// * [negative keyword lists create advertisers](AdvertiserNegativeKeywordListCreateCall) (none)
353/// * [negative keyword lists delete advertisers](AdvertiserNegativeKeywordListDeleteCall) (none)
354/// * [negative keyword lists get advertisers](AdvertiserNegativeKeywordListGetCall) (none)
355/// * [negative keyword lists list advertisers](AdvertiserNegativeKeywordListListCall) (none)
356/// * [negative keyword lists patch advertisers](AdvertiserNegativeKeywordListPatchCall) (none)
357/// * [targeting types assigned targeting options create advertisers](AdvertiserTargetingTypeAssignedTargetingOptionCreateCall) (none)
358/// * [targeting types assigned targeting options delete advertisers](AdvertiserTargetingTypeAssignedTargetingOptionDeleteCall) (none)
359/// * [targeting types assigned targeting options get advertisers](AdvertiserTargetingTypeAssignedTargetingOptionGetCall) (none)
360/// * [targeting types assigned targeting options list advertisers](AdvertiserTargetingTypeAssignedTargetingOptionListCall) (none)
361/// * [audit advertisers](AdvertiserAuditCall) (none)
362/// * [bulk edit advertiser assigned targeting options advertisers](AdvertiserBulkEditAdvertiserAssignedTargetingOptionCall) (none)
363/// * [bulk list advertiser assigned targeting options advertisers](AdvertiserBulkListAdvertiserAssignedTargetingOptionCall) (none)
364/// * [create advertisers](AdvertiserCreateCall) (request|response)
365/// * [delete advertisers](AdvertiserDeleteCall) (none)
366/// * [get advertisers](AdvertiserGetCall) (response)
367/// * [list advertisers](AdvertiserListCall) (none)
368/// * [patch advertisers](AdvertiserPatchCall) (request|response)
369#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
370#[serde_with::serde_as]
371#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
372pub struct Advertiser {
373    /// Required. Immutable. Ad server related settings of the advertiser.
374    #[serde(rename = "adServerConfig")]
375    pub ad_server_config: Option<AdvertiserAdServerConfig>,
376    /// Output only. The unique ID of the advertiser. Assigned by the system.
377    #[serde(rename = "advertiserId")]
378    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
379    pub advertiser_id: Option<i64>,
380    /// Required. Creative related settings of the advertiser.
381    #[serde(rename = "creativeConfig")]
382    pub creative_config: Option<AdvertiserCreativeConfig>,
383    /// Settings that control how advertiser data may be accessed.
384    #[serde(rename = "dataAccessConfig")]
385    pub data_access_config: Option<AdvertiserDataAccessConfig>,
386    /// Required. The display name of the advertiser. Must be UTF-8 encoded with a maximum size of 240 bytes.
387    #[serde(rename = "displayName")]
388    pub display_name: Option<String>,
389    /// Required. Controls whether or not insertion orders and line items of the advertiser can spend their budgets and bid on inventory. * Accepted values are `ENTITY_STATUS_ACTIVE`, `ENTITY_STATUS_PAUSED` and `ENTITY_STATUS_SCHEDULED_FOR_DELETION`. * If set to `ENTITY_STATUS_SCHEDULED_FOR_DELETION`, the advertiser will be deleted 30 days from when it was first scheduled for deletion.
390    #[serde(rename = "entityStatus")]
391    pub entity_status: Option<String>,
392    /// Required. General settings of the advertiser.
393    #[serde(rename = "generalConfig")]
394    pub general_config: Option<AdvertiserGeneralConfig>,
395    /// Integration details of the advertiser. Only integrationCode is currently applicable to advertiser. Other fields of IntegrationDetails are not supported and will be ignored if provided.
396    #[serde(rename = "integrationDetails")]
397    pub integration_details: Option<IntegrationDetails>,
398    /// Output only. The resource name of the advertiser.
399    pub name: Option<String>,
400    /// Required. Immutable. The unique ID of the partner that the advertiser belongs to.
401    #[serde(rename = "partnerId")]
402    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
403    pub partner_id: Option<i64>,
404    /// Whether integration with Mediaocean (Prisma) is enabled. By enabling this, you agree to the following: On behalf of my company, I authorize Mediaocean (Prisma) to send budget segment plans to Google, and I authorize Google to send corresponding reporting and invoices from DV360 to Mediaocean for the purposes of budget planning, billing, and reconciliation for this advertiser.
405    #[serde(rename = "prismaEnabled")]
406    pub prisma_enabled: Option<bool>,
407    /// Targeting settings related to ad serving of the advertiser.
408    #[serde(rename = "servingConfig")]
409    pub serving_config: Option<AdvertiserTargetingConfig>,
410    /// Output only. The timestamp when the advertiser was last updated. Assigned by the system.
411    #[serde(rename = "updateTime")]
412    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
413}
414
415impl common::RequestValue for Advertiser {}
416impl common::Resource for Advertiser {}
417impl common::ResponseResult for Advertiser {}
418
419/// Ad server related settings of an advertiser.
420///
421/// This type is not used in any activity, and only used as *part* of another schema.
422///
423#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
424#[serde_with::serde_as]
425#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
426pub struct AdvertiserAdServerConfig {
427    /// The configuration for advertisers that use both Campaign Manager 360 (CM360) and third-party ad servers.
428    #[serde(rename = "cmHybridConfig")]
429    pub cm_hybrid_config: Option<CmHybridConfig>,
430    /// The configuration for advertisers that use third-party ad servers only.
431    #[serde(rename = "thirdPartyOnlyConfig")]
432    pub third_party_only_config: Option<ThirdPartyOnlyConfig>,
433}
434
435impl common::Part for AdvertiserAdServerConfig {}
436
437/// Creatives related settings of an advertiser.
438///
439/// This type is not used in any activity, and only used as *part* of another schema.
440///
441#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
442#[serde_with::serde_as]
443#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
444pub struct AdvertiserCreativeConfig {
445    /// Whether or not the advertiser is enabled for dynamic creatives.
446    #[serde(rename = "dynamicCreativeEnabled")]
447    pub dynamic_creative_enabled: Option<bool>,
448    /// An ID for configuring campaign monitoring provided by Integral Ad Service (IAS). The DV360 system will append an IAS "Campaign Monitor" tag containing this ID to the creative tag.
449    #[serde(rename = "iasClientId")]
450    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
451    pub ias_client_id: Option<i64>,
452    /// Whether or not to disable Google’s About this Ad feature that adds badging (to identify the content as an ad) and transparency information (on interaction with About this Ad) to your ads for Online Behavioral Advertising (OBA) and regulatory requirements. About this Ad gives users greater control over the ads they see and helps you explain why they’re seeing your ad. [Learn more](https://developers.google.com//support.google.com/displayvideo/answer/14315795). If you choose to set this field to `true`, note that ads served through Display & Video 360 must comply to the following: * Be Online Behavioral Advertising (OBA) compliant, as per your contract with Google Marketing Platform. * In the European Economic Area (EEA), include transparency information and a mechanism for users to report illegal content in ads. If using an alternative ad badging, transparency, and reporting solution, you must ensure it includes the required transparency information and illegal content flagging mechanism and that you notify Google of any illegal content reports using the appropriate [form](https://developers.google.com//support.google.com/legal/troubleshooter/1114905?sjid=6787484030557261960-EU#ts=2981967%2C2982031%2C12980091).
453    #[serde(rename = "obaComplianceDisabled")]
454    pub oba_compliance_disabled: Option<bool>,
455    /// By setting this field to `true`, you, on behalf of your company, authorize Google to use video creatives associated with this Display & Video 360 advertiser to provide reporting and features related to the advertiser's television campaigns. Applicable only when the advertiser has a CM360 hybrid ad server configuration.
456    #[serde(rename = "videoCreativeDataSharingAuthorized")]
457    pub video_creative_data_sharing_authorized: Option<bool>,
458}
459
460impl common::Part for AdvertiserCreativeConfig {}
461
462/// Settings that control how advertiser related data may be accessed.
463///
464/// This type is not used in any activity, and only used as *part* of another schema.
465///
466#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
467#[serde_with::serde_as]
468#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
469pub struct AdvertiserDataAccessConfig {
470    /// Structured Data Files (SDF) settings for the advertiser. If not specified, the SDF settings of the parent partner are used.
471    #[serde(rename = "sdfConfig")]
472    pub sdf_config: Option<AdvertiserSdfConfig>,
473}
474
475impl common::Part for AdvertiserDataAccessConfig {}
476
477/// General settings of an advertiser.
478///
479/// This type is not used in any activity, and only used as *part* of another schema.
480///
481#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
482#[serde_with::serde_as]
483#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
484pub struct AdvertiserGeneralConfig {
485    /// Required. Immutable. Advertiser's currency in ISO 4217 format. Accepted codes and the currencies they represent are: Currency Code : Currency Name * `ARS` : Argentine Peso * `AUD` : Australian Dollar * `BRL` : Brazilian Real * `CAD` : Canadian Dollar * `CHF` : Swiss Franc * `CLP` : Chilean Peso * `CNY` : Chinese Yuan * `COP` : Colombian Peso * `CZK` : Czech Koruna * `DKK` : Danish Krone * `EGP` : Egyption Pound * `EUR` : Euro * `GBP` : British Pound * `HKD` : Hong Kong Dollar * `HUF` : Hungarian Forint * `IDR` : Indonesian Rupiah * `ILS` : Israeli Shekel * `INR` : Indian Rupee * `JPY` : Japanese Yen * `KRW` : South Korean Won * `MXN` : Mexican Pesos * `MYR` : Malaysian Ringgit * `NGN` : Nigerian Naira * `NOK` : Norwegian Krone * `NZD` : New Zealand Dollar * `PEN` : Peruvian Nuevo Sol * `PLN` : Polish Zloty * `RON` : New Romanian Leu * `RUB` : Russian Ruble * `SEK` : Swedish Krona * `TRY` : Turkish Lira * `TWD` : New Taiwan Dollar * `USD` : US Dollar * `ZAR` : South African Rand
486    #[serde(rename = "currencyCode")]
487    pub currency_code: Option<String>,
488    /// Required. The domain URL of the advertiser's primary website. The system will send this information to publishers that require website URL to associate a campaign with an advertiser. Provide a URL with no path or query string, beginning with `http:` or `https:`. For example, http://www.example.com
489    #[serde(rename = "domainUrl")]
490    pub domain_url: Option<String>,
491    /// Output only. The standard TZ database name of the advertiser's time zone. For example, `America/New_York`. See more at: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones For CM360 hybrid advertisers, the time zone is the same as that of the associated CM360 account; for third-party only advertisers, the time zone is the same as that of the parent partner.
492    #[serde(rename = "timeZone")]
493    pub time_zone: Option<String>,
494}
495
496impl common::Part for AdvertiserGeneralConfig {}
497
498/// Structured Data Files (SDF) settings of an advertiser.
499///
500/// This type is not used in any activity, and only used as *part* of another schema.
501///
502#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
503#[serde_with::serde_as]
504#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
505pub struct AdvertiserSdfConfig {
506    /// Whether or not this advertiser overrides the SDF configuration of its parent partner. By default, an advertiser inherits the SDF configuration from the parent partner. To override the partner configuration, set this field to `true` and provide the new configuration in sdfConfig.
507    #[serde(rename = "overridePartnerSdfConfig")]
508    pub override_partner_sdf_config: Option<bool>,
509    /// The SDF configuration for the advertiser. * Required when overridePartnerSdfConfig is `true`. * Output only when overridePartnerSdfConfig is `false`.
510    #[serde(rename = "sdfConfig")]
511    pub sdf_config: Option<SdfConfig>,
512}
513
514impl common::Part for AdvertiserSdfConfig {}
515
516/// Targeting settings related to ad serving of an advertiser.
517///
518/// This type is not used in any activity, and only used as *part* of another schema.
519///
520#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
521#[serde_with::serde_as]
522#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
523pub struct AdvertiserTargetingConfig {
524    /// Whether or not connected TV devices are exempt from viewability targeting for all video line items under the advertiser.
525    #[serde(rename = "exemptTvFromViewabilityTargeting")]
526    pub exempt_tv_from_viewability_targeting: Option<bool>,
527}
528
529impl common::Part for AdvertiserTargetingConfig {}
530
531/// Represents a targetable age range. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_AGE_RANGE`.
532///
533/// This type is not used in any activity, and only used as *part* of another schema.
534///
535#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
536#[serde_with::serde_as]
537#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
538pub struct AgeRangeAssignedTargetingOptionDetails {
539    /// Required. The age range of an audience. We only support targeting a continuous age range of an audience. Thus, the age range represented in this field can be 1) targeted solely, or, 2) part of a larger continuous age range. The reach of a continuous age range targeting can be expanded by also targeting an audience of an unknown age.
540    #[serde(rename = "ageRange")]
541    pub age_range: Option<String>,
542    /// Required. The targeting_option_id of a TargetingOption of type `TARGETING_TYPE_AGE_RANGE`.
543    #[serde(rename = "targetingOptionId")]
544    pub targeting_option_id: Option<String>,
545}
546
547impl common::Part for AgeRangeAssignedTargetingOptionDetails {}
548
549/// Represents a targetable age range. This will be populated in the age_range_details field when targeting_type is `TARGETING_TYPE_AGE_RANGE`.
550///
551/// This type is not used in any activity, and only used as *part* of another schema.
552///
553#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
554#[serde_with::serde_as]
555#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
556pub struct AgeRangeTargetingOptionDetails {
557    /// Output only. The age range of an audience.
558    #[serde(rename = "ageRange")]
559    pub age_range: Option<String>,
560}
561
562impl common::Part for AgeRangeTargetingOptionDetails {}
563
564/// Details for assigned app targeting option. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_APP`.
565///
566/// This type is not used in any activity, and only used as *part* of another schema.
567///
568#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
569#[serde_with::serde_as]
570#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
571pub struct AppAssignedTargetingOptionDetails {
572    /// Required. The ID of the app. Android's Play store app uses bundle ID, for example `com.google.android.gm`. Apple's App store app ID uses 9 digit string, for example `422689480`.
573    #[serde(rename = "appId")]
574    pub app_id: Option<String>,
575    /// Indicates the platform of the targeted app. If this field is not specified, the app platform will be assumed to be mobile (i.e., Android or iOS), and we will derive the appropriate mobile platform from the app ID.
576    #[serde(rename = "appPlatform")]
577    pub app_platform: Option<String>,
578    /// Output only. The display name of the app.
579    #[serde(rename = "displayName")]
580    pub display_name: Option<String>,
581    /// Indicates if this option is being negatively targeted.
582    pub negative: Option<bool>,
583}
584
585impl common::Part for AppAssignedTargetingOptionDetails {}
586
587/// Details for assigned app category targeting option. This will be populated in the app_category_details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_APP_CATEGORY`.
588///
589/// This type is not used in any activity, and only used as *part* of another schema.
590///
591#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
592#[serde_with::serde_as]
593#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
594pub struct AppCategoryAssignedTargetingOptionDetails {
595    /// Output only. The display name of the app category.
596    #[serde(rename = "displayName")]
597    pub display_name: Option<String>,
598    /// Indicates if this option is being negatively targeted.
599    pub negative: Option<bool>,
600    /// Required. The targeting_option_id field when targeting_type is `TARGETING_TYPE_APP_CATEGORY`.
601    #[serde(rename = "targetingOptionId")]
602    pub targeting_option_id: Option<String>,
603}
604
605impl common::Part for AppCategoryAssignedTargetingOptionDetails {}
606
607/// Represents a targetable collection of apps. A collection lets you target dynamic groups of related apps that are maintained by the platform, for example `All Apps/Google Play/Games`. This will be populated in the app_category_details field when targeting_type is `TARGETING_TYPE_APP_CATEGORY`.
608///
609/// This type is not used in any activity, and only used as *part* of another schema.
610///
611#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
612#[serde_with::serde_as]
613#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
614pub struct AppCategoryTargetingOptionDetails {
615    /// Output only. The name of the app collection.
616    #[serde(rename = "displayName")]
617    pub display_name: Option<String>,
618}
619
620impl common::Part for AppCategoryTargetingOptionDetails {}
621
622/// A single asset.
623///
624/// This type is not used in any activity, and only used as *part* of another schema.
625///
626#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
627#[serde_with::serde_as]
628#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
629pub struct Asset {
630    /// The asset content. For uploaded assets, the content is the serving path.
631    pub content: Option<String>,
632    /// Media ID of the uploaded asset. This is a unique identifier for the asset. This ID can be passed to other API calls, e.g. CreateCreative to associate the asset with a creative. The Media ID space updated on **April 5, 2023**. Update media IDs cached before **April 5, 2023** by retrieving the new media ID from associated creative resources or re-uploading the asset.
633    #[serde(rename = "mediaId")]
634    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
635    pub media_id: Option<i64>,
636}
637
638impl common::Part for Asset {}
639
640/// Asset association for the creative.
641///
642/// This type is not used in any activity, and only used as *part* of another schema.
643///
644#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
645#[serde_with::serde_as]
646#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
647pub struct AssetAssociation {
648    /// The associated asset.
649    pub asset: Option<Asset>,
650    /// The role of this asset for the creative.
651    pub role: Option<String>,
652}
653
654impl common::Part for AssetAssociation {}
655
656/// An assignment between a targetable inventory source and an inventory source group.
657///
658/// # Activities
659///
660/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
661/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
662///
663/// * [assigned inventory sources create inventory source groups](InventorySourceGroupAssignedInventorySourceCreateCall) (request|response)
664#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
665#[serde_with::serde_as]
666#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
667pub struct AssignedInventorySource {
668    /// Output only. The unique ID of the assigned inventory source. The ID is only unique within a given inventory source group. It may be reused in other contexts.
669    #[serde(rename = "assignedInventorySourceId")]
670    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
671    pub assigned_inventory_source_id: Option<i64>,
672    /// Required. The ID of the inventory source entity being targeted.
673    #[serde(rename = "inventorySourceId")]
674    pub inventory_source_id: Option<String>,
675    /// Output only. The resource name of the assigned inventory source.
676    pub name: Option<String>,
677}
678
679impl common::RequestValue for AssignedInventorySource {}
680impl common::ResponseResult for AssignedInventorySource {}
681
682/// An assignment between a location list and a relevant targeting option.
683///
684/// # Activities
685///
686/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
687/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
688///
689/// * [location lists assigned locations create advertisers](AdvertiserLocationListAssignedLocationCreateCall) (request|response)
690#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
691#[serde_with::serde_as]
692#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
693pub struct AssignedLocation {
694    /// Output only. The unique ID of the assigned location. The ID is only unique within a location list. It may be reused in other contexts.
695    #[serde(rename = "assignedLocationId")]
696    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
697    pub assigned_location_id: Option<i64>,
698    /// Output only. The resource name of the assigned location.
699    pub name: Option<String>,
700    /// Required. The ID of the targeting option assigned to the location list.
701    #[serde(rename = "targetingOptionId")]
702    pub targeting_option_id: Option<String>,
703}
704
705impl common::RequestValue for AssignedLocation {}
706impl common::ResponseResult for AssignedLocation {}
707
708/// A single assigned targeting option, which defines the state of a targeting option for an entity with targeting settings.
709///
710/// # Activities
711///
712/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
713/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
714///
715/// * [campaigns targeting types assigned targeting options get advertisers](AdvertiserCampaignTargetingTypeAssignedTargetingOptionGetCall) (response)
716/// * [insertion orders targeting types assigned targeting options get advertisers](AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionGetCall) (response)
717/// * [line items targeting types assigned targeting options create advertisers](AdvertiserLineItemTargetingTypeAssignedTargetingOptionCreateCall) (request|response)
718/// * [line items targeting types assigned targeting options get advertisers](AdvertiserLineItemTargetingTypeAssignedTargetingOptionGetCall) (response)
719/// * [targeting types assigned targeting options create advertisers](AdvertiserTargetingTypeAssignedTargetingOptionCreateCall) (request|response)
720/// * [targeting types assigned targeting options get advertisers](AdvertiserTargetingTypeAssignedTargetingOptionGetCall) (response)
721/// * [targeting types assigned targeting options create partners](PartnerTargetingTypeAssignedTargetingOptionCreateCall) (request|response)
722/// * [targeting types assigned targeting options get partners](PartnerTargetingTypeAssignedTargetingOptionGetCall) (response)
723#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
724#[serde_with::serde_as]
725#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
726pub struct AssignedTargetingOption {
727    /// Age range details. This field will be populated when the targeting_type is `TARGETING_TYPE_AGE_RANGE`.
728    #[serde(rename = "ageRangeDetails")]
729    pub age_range_details: Option<AgeRangeAssignedTargetingOptionDetails>,
730    /// App category details. This field will be populated when the targeting_type is `TARGETING_TYPE_APP_CATEGORY`.
731    #[serde(rename = "appCategoryDetails")]
732    pub app_category_details: Option<AppCategoryAssignedTargetingOptionDetails>,
733    /// App details. This field will be populated when the targeting_type is `TARGETING_TYPE_APP`.
734    #[serde(rename = "appDetails")]
735    pub app_details: Option<AppAssignedTargetingOptionDetails>,
736    /// Output only. The unique ID of the assigned targeting option. The ID is only unique within a given resource and targeting type. It may be reused in other contexts.
737    #[serde(rename = "assignedTargetingOptionId")]
738    pub assigned_targeting_option_id: Option<String>,
739    /// Audience targeting details. This field will be populated when the targeting_type is `TARGETING_TYPE_AUDIENCE_GROUP`. You can only target one audience group option per resource.
740    #[serde(rename = "audienceGroupDetails")]
741    pub audience_group_details: Option<AudienceGroupAssignedTargetingOptionDetails>,
742    /// Audio content type details. This field will be populated when the targeting_type is `TARGETING_TYPE_AUDIO_CONTENT_TYPE`.
743    #[serde(rename = "audioContentTypeDetails")]
744    pub audio_content_type_details: Option<AudioContentTypeAssignedTargetingOptionDetails>,
745    /// Authorized seller status details. This field will be populated when the targeting_type is `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS`. You can only target one authorized seller status option per resource. If a resource doesn't have an authorized seller status option, all authorized sellers indicated as DIRECT or RESELLER in the ads.txt file are targeted by default.
746    #[serde(rename = "authorizedSellerStatusDetails")]
747    pub authorized_seller_status_details:
748        Option<AuthorizedSellerStatusAssignedTargetingOptionDetails>,
749    /// Browser details. This field will be populated when the targeting_type is `TARGETING_TYPE_BROWSER`.
750    #[serde(rename = "browserDetails")]
751    pub browser_details: Option<BrowserAssignedTargetingOptionDetails>,
752    /// Business chain details. This field will be populated when the targeting_type is `TARGETING_TYPE_BUSINESS_CHAIN`.
753    #[serde(rename = "businessChainDetails")]
754    pub business_chain_details: Option<BusinessChainAssignedTargetingOptionDetails>,
755    /// Carrier and ISP details. This field will be populated when the targeting_type is `TARGETING_TYPE_CARRIER_AND_ISP`.
756    #[serde(rename = "carrierAndIspDetails")]
757    pub carrier_and_isp_details: Option<CarrierAndIspAssignedTargetingOptionDetails>,
758    /// Category details. This field will be populated when the targeting_type is `TARGETING_TYPE_CATEGORY`. Targeting a category will also target its subcategories. If a category is excluded from targeting and a subcategory is included, the exclusion will take precedence.
759    #[serde(rename = "categoryDetails")]
760    pub category_details: Option<CategoryAssignedTargetingOptionDetails>,
761    /// Channel details. This field will be populated when the targeting_type is `TARGETING_TYPE_CHANNEL`.
762    #[serde(rename = "channelDetails")]
763    pub channel_details: Option<ChannelAssignedTargetingOptionDetails>,
764    /// Content duration details. This field will be populated when the targeting_type is `TARGETING_TYPE_CONTENT_DURATION`.
765    #[serde(rename = "contentDurationDetails")]
766    pub content_duration_details: Option<ContentDurationAssignedTargetingOptionDetails>,
767    /// Content genre details. This field will be populated when the targeting_type is `TARGETING_TYPE_CONTENT_GENRE`.
768    #[serde(rename = "contentGenreDetails")]
769    pub content_genre_details: Option<ContentGenreAssignedTargetingOptionDetails>,
770    /// Content instream position details. This field will be populated when the targeting_type is `TARGETING_TYPE_CONTENT_INSTREAM_POSITION`.
771    #[serde(rename = "contentInstreamPositionDetails")]
772    pub content_instream_position_details:
773        Option<ContentInstreamPositionAssignedTargetingOptionDetails>,
774    /// Content outstream position details. This field will be populated when the targeting_type is `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION`.
775    #[serde(rename = "contentOutstreamPositionDetails")]
776    pub content_outstream_position_details:
777        Option<ContentOutstreamPositionAssignedTargetingOptionDetails>,
778    /// Content duration details. This field will be populated when the TargetingType is `TARGETING_TYPE_CONTENT_STREAM_TYPE`.
779    #[serde(rename = "contentStreamTypeDetails")]
780    pub content_stream_type_details: Option<ContentStreamTypeAssignedTargetingOptionDetails>,
781    /// Day and time details. This field will be populated when the targeting_type is `TARGETING_TYPE_DAY_AND_TIME`.
782    #[serde(rename = "dayAndTimeDetails")]
783    pub day_and_time_details: Option<DayAndTimeAssignedTargetingOptionDetails>,
784    /// Device make and model details. This field will be populated when the targeting_type is `TARGETING_TYPE_DEVICE_MAKE_MODEL`.
785    #[serde(rename = "deviceMakeModelDetails")]
786    pub device_make_model_details: Option<DeviceMakeModelAssignedTargetingOptionDetails>,
787    /// Device Type details. This field will be populated when the targeting_type is `TARGETING_TYPE_DEVICE_TYPE`.
788    #[serde(rename = "deviceTypeDetails")]
789    pub device_type_details: Option<DeviceTypeAssignedTargetingOptionDetails>,
790    /// Digital content label details. This field will be populated when the targeting_type is `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION`. Digital content labels are targeting exclusions. Advertiser level digital content label exclusions, if set, are always applied in serving (even though they aren't visible in resource settings). Resource settings can exclude content labels in addition to advertiser exclusions, but can't override them. A line item won't serve if all the digital content labels are excluded.
791    #[serde(rename = "digitalContentLabelExclusionDetails")]
792    pub digital_content_label_exclusion_details:
793        Option<DigitalContentLabelAssignedTargetingOptionDetails>,
794    /// Environment details. This field will be populated when the targeting_type is `TARGETING_TYPE_ENVIRONMENT`.
795    #[serde(rename = "environmentDetails")]
796    pub environment_details: Option<EnvironmentAssignedTargetingOptionDetails>,
797    /// Exchange details. This field will be populated when the targeting_type is `TARGETING_TYPE_EXCHANGE`.
798    #[serde(rename = "exchangeDetails")]
799    pub exchange_details: Option<ExchangeAssignedTargetingOptionDetails>,
800    /// Gender details. This field will be populated when the targeting_type is `TARGETING_TYPE_GENDER`.
801    #[serde(rename = "genderDetails")]
802    pub gender_details: Option<GenderAssignedTargetingOptionDetails>,
803    /// Geographic region details. This field will be populated when the targeting_type is `TARGETING_TYPE_GEO_REGION`.
804    #[serde(rename = "geoRegionDetails")]
805    pub geo_region_details: Option<GeoRegionAssignedTargetingOptionDetails>,
806    /// Household income details. This field will be populated when the targeting_type is `TARGETING_TYPE_HOUSEHOLD_INCOME`.
807    #[serde(rename = "householdIncomeDetails")]
808    pub household_income_details: Option<HouseholdIncomeAssignedTargetingOptionDetails>,
809    /// Output only. The inheritance status of the assigned targeting option.
810    pub inheritance: Option<String>,
811    /// Inventory source details. This field will be populated when the targeting_type is `TARGETING_TYPE_INVENTORY_SOURCE`.
812    #[serde(rename = "inventorySourceDetails")]
813    pub inventory_source_details: Option<InventorySourceAssignedTargetingOptionDetails>,
814    /// Inventory source group details. This field will be populated when the targeting_type is `TARGETING_TYPE_INVENTORY_SOURCE_GROUP`.
815    #[serde(rename = "inventorySourceGroupDetails")]
816    pub inventory_source_group_details: Option<InventorySourceGroupAssignedTargetingOptionDetails>,
817    /// Keyword details. This field will be populated when the targeting_type is `TARGETING_TYPE_KEYWORD`. A maximum of 5000 direct negative keywords can be assigned to a resource. No limit on number of positive keywords that can be assigned.
818    #[serde(rename = "keywordDetails")]
819    pub keyword_details: Option<KeywordAssignedTargetingOptionDetails>,
820    /// Language details. This field will be populated when the targeting_type is `TARGETING_TYPE_LANGUAGE`.
821    #[serde(rename = "languageDetails")]
822    pub language_details: Option<LanguageAssignedTargetingOptionDetails>,
823    /// Output only. The resource name for this assigned targeting option.
824    pub name: Option<String>,
825    /// Native content position details. This field will be populated when the targeting_type is `TARGETING_TYPE_NATIVE_CONTENT_POSITION`.
826    #[serde(rename = "nativeContentPositionDetails")]
827    pub native_content_position_details:
828        Option<NativeContentPositionAssignedTargetingOptionDetails>,
829    /// Keyword details. This field will be populated when the targeting_type is `TARGETING_TYPE_NEGATIVE_KEYWORD_LIST`. A maximum of 4 negative keyword lists can be assigned to a resource.
830    #[serde(rename = "negativeKeywordListDetails")]
831    pub negative_keyword_list_details: Option<NegativeKeywordListAssignedTargetingOptionDetails>,
832    /// Open Measurement enabled inventory details. This field will be populated when the targeting_type is `TARGETING_TYPE_OMID`.
833    #[serde(rename = "omidDetails")]
834    pub omid_details: Option<OmidAssignedTargetingOptionDetails>,
835    /// On screen position details. This field will be populated when the targeting_type is `TARGETING_TYPE_ON_SCREEN_POSITION`.
836    #[serde(rename = "onScreenPositionDetails")]
837    pub on_screen_position_details: Option<OnScreenPositionAssignedTargetingOptionDetails>,
838    /// Operating system details. This field will be populated when the targeting_type is `TARGETING_TYPE_OPERATING_SYSTEM`.
839    #[serde(rename = "operatingSystemDetails")]
840    pub operating_system_details: Option<OperatingSystemAssignedTargetingOptionDetails>,
841    /// Parental status details. This field will be populated when the targeting_type is `TARGETING_TYPE_PARENTAL_STATUS`.
842    #[serde(rename = "parentalStatusDetails")]
843    pub parental_status_details: Option<ParentalStatusAssignedTargetingOptionDetails>,
844    /// POI details. This field will be populated when the targeting_type is `TARGETING_TYPE_POI`.
845    #[serde(rename = "poiDetails")]
846    pub poi_details: Option<PoiAssignedTargetingOptionDetails>,
847    /// Proximity location list details. This field will be populated when the targeting_type is `TARGETING_TYPE_PROXIMITY_LOCATION_LIST`.
848    #[serde(rename = "proximityLocationListDetails")]
849    pub proximity_location_list_details:
850        Option<ProximityLocationListAssignedTargetingOptionDetails>,
851    /// Regional location list details. This field will be populated when the targeting_type is `TARGETING_TYPE_REGIONAL_LOCATION_LIST`.
852    #[serde(rename = "regionalLocationListDetails")]
853    pub regional_location_list_details: Option<RegionalLocationListAssignedTargetingOptionDetails>,
854    /// Sensitive category details. This field will be populated when the targeting_type is `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION`. Sensitive categories are targeting exclusions. Advertiser level sensitive category exclusions, if set, are always applied in serving (even though they aren't visible in resource settings). Resource settings can exclude sensitive categories in addition to advertiser exclusions, but can't override them.
855    #[serde(rename = "sensitiveCategoryExclusionDetails")]
856    pub sensitive_category_exclusion_details:
857        Option<SensitiveCategoryAssignedTargetingOptionDetails>,
858    /// Sub-exchange details. This field will be populated when the targeting_type is `TARGETING_TYPE_SUB_EXCHANGE`.
859    #[serde(rename = "subExchangeDetails")]
860    pub sub_exchange_details: Option<SubExchangeAssignedTargetingOptionDetails>,
861    /// Output only. Identifies the type of this assigned targeting option.
862    #[serde(rename = "targetingType")]
863    pub targeting_type: Option<String>,
864    /// Third party verification details. This field will be populated when the targeting_type is `TARGETING_TYPE_THIRD_PARTY_VERIFIER`.
865    #[serde(rename = "thirdPartyVerifierDetails")]
866    pub third_party_verifier_details: Option<ThirdPartyVerifierAssignedTargetingOptionDetails>,
867    /// URL details. This field will be populated when the targeting_type is `TARGETING_TYPE_URL`.
868    #[serde(rename = "urlDetails")]
869    pub url_details: Option<UrlAssignedTargetingOptionDetails>,
870    /// User rewarded content details. This field will be populated when the targeting_type is `TARGETING_TYPE_USER_REWARDED_CONTENT`.
871    #[serde(rename = "userRewardedContentDetails")]
872    pub user_rewarded_content_details: Option<UserRewardedContentAssignedTargetingOptionDetails>,
873    /// Video player size details. This field will be populated when the targeting_type is `TARGETING_TYPE_VIDEO_PLAYER_SIZE`.
874    #[serde(rename = "videoPlayerSizeDetails")]
875    pub video_player_size_details: Option<VideoPlayerSizeAssignedTargetingOptionDetails>,
876    /// Viewability details. This field will be populated when the targeting_type is `TARGETING_TYPE_VIEWABILITY`. You can only target one viewability option per resource.
877    #[serde(rename = "viewabilityDetails")]
878    pub viewability_details: Option<ViewabilityAssignedTargetingOptionDetails>,
879}
880
881impl common::RequestValue for AssignedTargetingOption {}
882impl common::ResponseResult for AssignedTargetingOption {}
883
884/// A single assigned user role, which defines a user's authorized interaction with a specified partner or advertiser.
885///
886/// This type is not used in any activity, and only used as *part* of another schema.
887///
888#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
889#[serde_with::serde_as]
890#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
891pub struct AssignedUserRole {
892    /// The ID of the advertiser that the assigend user role applies to.
893    #[serde(rename = "advertiserId")]
894    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
895    pub advertiser_id: Option<i64>,
896    /// Output only. The ID of the assigned user role.
897    #[serde(rename = "assignedUserRoleId")]
898    pub assigned_user_role_id: Option<String>,
899    /// The ID of the partner that the assigned user role applies to.
900    #[serde(rename = "partnerId")]
901    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
902    pub partner_id: Option<i64>,
903    /// Required. The user role to assign to a user for the entity.
904    #[serde(rename = "userRole")]
905    pub user_role: Option<String>,
906}
907
908impl common::Part for AssignedUserRole {}
909
910/// Assigned audience group targeting option details. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_AUDIENCE_GROUP`. The relation between each group is UNION, except for excluded_first_and_third_party_audience_group and excluded_google_audience_group, of which COMPLEMENT is used as an INTERSECTION with other groups.
911///
912/// This type is not used in any activity, and only used as *part* of another schema.
913///
914#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
915#[serde_with::serde_as]
916#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
917pub struct AudienceGroupAssignedTargetingOptionDetails {
918    /// The first and third party audience ids and recencies of the excluded first and third party audience group. Used for negative targeting. The COMPLEMENT of the UNION of this group and other excluded audience groups is used as an INTERSECTION to any positive audience targeting. All items are logically ‘OR’ of each other.
919    #[serde(rename = "excludedFirstAndThirdPartyAudienceGroup")]
920    pub excluded_first_and_third_party_audience_group: Option<FirstAndThirdPartyAudienceGroup>,
921    /// The Google audience ids of the excluded Google audience group. Used for negative targeting. The COMPLEMENT of the UNION of this group and other excluded audience groups is used as an INTERSECTION to any positive audience targeting. Only contains Affinity, In-market and Installed-apps type Google audiences. All items are logically ‘OR’ of each other.
922    #[serde(rename = "excludedGoogleAudienceGroup")]
923    pub excluded_google_audience_group: Option<GoogleAudienceGroup>,
924    /// The combined audience ids of the included combined audience group. Contains combined audience ids only.
925    #[serde(rename = "includedCombinedAudienceGroup")]
926    pub included_combined_audience_group: Option<CombinedAudienceGroup>,
927    /// The custom list ids of the included custom list group. Contains custom list ids only.
928    #[serde(rename = "includedCustomListGroup")]
929    pub included_custom_list_group: Option<CustomListGroup>,
930    /// The first and third party audience ids and recencies of included first and third party audience groups. Each first and third party audience group contains first and third party audience ids only. The relation between each first and third party audience group is INTERSECTION, and the result is UNION'ed with other audience groups. Repeated groups with same settings will be ignored.
931    #[serde(rename = "includedFirstAndThirdPartyAudienceGroups")]
932    pub included_first_and_third_party_audience_groups:
933        Option<Vec<FirstAndThirdPartyAudienceGroup>>,
934    /// The Google audience ids of the included Google audience group. Contains Google audience ids only.
935    #[serde(rename = "includedGoogleAudienceGroup")]
936    pub included_google_audience_group: Option<GoogleAudienceGroup>,
937}
938
939impl common::Part for AudienceGroupAssignedTargetingOptionDetails {}
940
941/// Details for audio content type assigned targeting option. This will be populated in the audio_content_type_details field when targeting_type is `TARGETING_TYPE_AUDIO_CONTENT_TYPE`. Explicitly targeting all options is not supported. Remove all audio content type targeting options to achieve this effect.
942///
943/// This type is not used in any activity, and only used as *part* of another schema.
944///
945#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
946#[serde_with::serde_as]
947#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
948pub struct AudioContentTypeAssignedTargetingOptionDetails {
949    /// Required. The audio content type.
950    #[serde(rename = "audioContentType")]
951    pub audio_content_type: Option<String>,
952    /// Required. The targeting_option_id field when targeting_type is `TARGETING_TYPE_AUDIO_CONTENT_TYPE`.
953    #[serde(rename = "targetingOptionId")]
954    pub targeting_option_id: Option<String>,
955}
956
957impl common::Part for AudioContentTypeAssignedTargetingOptionDetails {}
958
959/// Represents a targetable audio content type. This will be populated in the audio_content_type_details field when targeting_type is `TARGETING_TYPE_AUDIO_CONTENT_TYPE`.
960///
961/// This type is not used in any activity, and only used as *part* of another schema.
962///
963#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
964#[serde_with::serde_as]
965#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
966pub struct AudioContentTypeTargetingOptionDetails {
967    /// Output only. The audio content type.
968    #[serde(rename = "audioContentType")]
969    pub audio_content_type: Option<String>,
970}
971
972impl common::Part for AudioContentTypeTargetingOptionDetails {}
973
974/// The length an audio or a video has been played.
975///
976/// This type is not used in any activity, and only used as *part* of another schema.
977///
978#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
979#[serde_with::serde_as]
980#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
981pub struct AudioVideoOffset {
982    /// The offset in percentage of the audio or video duration.
983    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
984    pub percentage: Option<i64>,
985    /// The offset in seconds from the start of the audio or video.
986    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
987    pub seconds: Option<i64>,
988}
989
990impl common::Part for AudioVideoOffset {}
991
992/// Response message for AdvertiserService.AuditAdvertiser.
993///
994/// # Activities
995///
996/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
997/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
998///
999/// * [audit advertisers](AdvertiserAuditCall) (response)
1000#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1001#[serde_with::serde_as]
1002#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1003pub struct AuditAdvertiserResponse {
1004    /// The number of individual targeting options from the following targeting types that are assigned to a line item under this advertiser. These individual targeting options count towards the limit of 4500000 ad group targeting options per advertiser. Qualifying Targeting types: * Channels, URLs, apps, and collections * Demographic * Google Audiences, including Affinity, Custom Affinity, and In-market audiences * Inventory source * Keyword * Mobile app category * User lists * Video targeting * Viewability
1005    #[serde(rename = "adGroupCriteriaCount")]
1006    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1007    pub ad_group_criteria_count: Option<i64>,
1008    /// The number of individual targeting options from the following targeting types that are assigned to a line item under this advertiser. These individual targeting options count towards the limit of 900000 campaign targeting options per advertiser. Qualifying Targeting types: * Position * Browser * Connection speed * Day and time * Device and operating system * Digital content label * Sensitive categories * Environment * Geography, including business chains and proximity * ISP * Language * Third-party verification
1009    #[serde(rename = "campaignCriteriaCount")]
1010    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1011    pub campaign_criteria_count: Option<i64>,
1012    /// The number of channels created under this advertiser. These channels count towards the limit of 1000 channels per advertiser.
1013    #[serde(rename = "channelsCount")]
1014    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1015    pub channels_count: Option<i64>,
1016    /// The number of negative keyword lists created under this advertiser. These negative keyword lists count towards the limit of 20 negative keyword lists per advertiser.
1017    #[serde(rename = "negativeKeywordListsCount")]
1018    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1019    pub negative_keyword_lists_count: Option<i64>,
1020    /// The number of negatively targeted channels created under this advertiser. These negatively targeted channels count towards the limit of 5 negatively targeted channels per advertiser.
1021    #[serde(rename = "negativelyTargetedChannelsCount")]
1022    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1023    pub negatively_targeted_channels_count: Option<i64>,
1024    /// The number of ACTIVE and PAUSED campaigns under this advertiser. These campaigns count towards the limit of 9999 campaigns per advertiser.
1025    #[serde(rename = "usedCampaignsCount")]
1026    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1027    pub used_campaigns_count: Option<i64>,
1028    /// The number of ACTIVE, PAUSED and DRAFT insertion orders under this advertiser. These insertion orders count towards the limit of 9999 insertion orders per advertiser.
1029    #[serde(rename = "usedInsertionOrdersCount")]
1030    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1031    pub used_insertion_orders_count: Option<i64>,
1032    /// The number of ACTIVE, PAUSED, and DRAFT line items under this advertiser. These line items count towards the limit of 9999 line items per advertiser.
1033    #[serde(rename = "usedLineItemsCount")]
1034    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1035    pub used_line_items_count: Option<i64>,
1036}
1037
1038impl common::ResponseResult for AuditAdvertiserResponse {}
1039
1040/// Represents an assigned authorized seller status. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS`. If a resource does not have an `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` assigned targeting option, it is using the "Authorized Direct Sellers and Resellers" option.
1041///
1042/// This type is not used in any activity, and only used as *part* of another schema.
1043///
1044#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1045#[serde_with::serde_as]
1046#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1047pub struct AuthorizedSellerStatusAssignedTargetingOptionDetails {
1048    /// Output only. The authorized seller status to target.
1049    #[serde(rename = "authorizedSellerStatus")]
1050    pub authorized_seller_status: Option<String>,
1051    /// Required. The targeting_option_id of a TargetingOption of type `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS`.
1052    #[serde(rename = "targetingOptionId")]
1053    pub targeting_option_id: Option<String>,
1054}
1055
1056impl common::Part for AuthorizedSellerStatusAssignedTargetingOptionDetails {}
1057
1058/// Represents a targetable authorized seller status. This will be populated in the authorized_seller_status_details field when targeting_type is `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS`.
1059///
1060/// This type is not used in any activity, and only used as *part* of another schema.
1061///
1062#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1063#[serde_with::serde_as]
1064#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1065pub struct AuthorizedSellerStatusTargetingOptionDetails {
1066    /// Output only. The authorized seller status.
1067    #[serde(rename = "authorizedSellerStatus")]
1068    pub authorized_seller_status: Option<String>,
1069}
1070
1071impl common::Part for AuthorizedSellerStatusTargetingOptionDetails {}
1072
1073/// Settings that control the bid strategy. Bid strategy determines the bid price.
1074///
1075/// This type is not used in any activity, and only used as *part* of another schema.
1076///
1077#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1078#[serde_with::serde_as]
1079#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1080pub struct BiddingStrategy {
1081    /// A strategy that uses a fixed bid price.
1082    #[serde(rename = "fixedBid")]
1083    pub fixed_bid: Option<FixedBidStrategy>,
1084    /// A strategy that automatically adjusts the bid to optimize to your performance goal while spending the full budget. At insertion order level, the markup_type of line items cannot be set to `PARTNER_REVENUE_MODEL_MARKUP_TYPE_CPM`. In addition, when performance_goal_type is one of: * `BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CPA` * `BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CPC` * `BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_AV_VIEWED` , the line_item_type of the insertion order line items must be either: * `LINE_ITEM_TYPE_DISPLAY_DEFAULT` * `LINE_ITEM_TYPE_VIDEO_DEFAULT` , and when performance_goal_type is either: * `BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CIVA` * `BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_IVO_TEN` the line_item_type of the insertion order line items must be `LINE_ITEM_TYPE_VIDEO_DEFAULT`.
1085    #[serde(rename = "maximizeSpendAutoBid")]
1086    pub maximize_spend_auto_bid: Option<MaximizeSpendBidStrategy>,
1087    /// A strategy that automatically adjusts the bid to meet or beat a specified performance goal. It is to be used only for a line item entity.
1088    #[serde(rename = "performanceGoalAutoBid")]
1089    pub performance_goal_auto_bid: Option<PerformanceGoalBidStrategy>,
1090}
1091
1092impl common::Part for BiddingStrategy {}
1093
1094/// Details for assigned browser targeting option. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_BROWSER`.
1095///
1096/// This type is not used in any activity, and only used as *part* of another schema.
1097///
1098#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1099#[serde_with::serde_as]
1100#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1101pub struct BrowserAssignedTargetingOptionDetails {
1102    /// Output only. The display name of the browser.
1103    #[serde(rename = "displayName")]
1104    pub display_name: Option<String>,
1105    /// Indicates if this option is being negatively targeted. All assigned browser targeting options on the same resource must have the same value for this field.
1106    pub negative: Option<bool>,
1107    /// Required. The targeting_option_id of a TargetingOption of type `TARGETING_TYPE_BROWSER`.
1108    #[serde(rename = "targetingOptionId")]
1109    pub targeting_option_id: Option<String>,
1110}
1111
1112impl common::Part for BrowserAssignedTargetingOptionDetails {}
1113
1114/// Represents a targetable browser. This will be populated in the browser_details field when targeting_type is `TARGETING_TYPE_BROWSER`.
1115///
1116/// This type is not used in any activity, and only used as *part* of another schema.
1117///
1118#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1119#[serde_with::serde_as]
1120#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1121pub struct BrowserTargetingOptionDetails {
1122    /// Output only. The display name of the browser.
1123    #[serde(rename = "displayName")]
1124    pub display_name: Option<String>,
1125}
1126
1127impl common::Part for BrowserTargetingOptionDetails {}
1128
1129/// Summarized information of an individual campaign budget.
1130///
1131/// This type is not used in any activity, and only used as *part* of another schema.
1132///
1133#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1134#[serde_with::serde_as]
1135#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1136pub struct BudgetSummary {
1137    /// Corresponds to the external_budget_id of a campaign budget. If the value is not set in the campaign budget, this field will be empty.
1138    #[serde(rename = "externalBudgetId")]
1139    pub external_budget_id: Option<String>,
1140    /// The sum of charges made under this budget before taxes, in micros of the invoice's currency. For example, if currency_code is `USD`, then 1000000 represents one US dollar.
1141    #[serde(rename = "preTaxAmountMicros")]
1142    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1143    pub pre_tax_amount_micros: Option<i64>,
1144    /// Relevant client, product, and estimate codes from the Mediaocean Prisma tool. Only applicable for campaign budgets with an external_budget_source of EXTERNAL_BUDGET_SOURCE_MEDIA_OCEAN.
1145    #[serde(rename = "prismaCpeCode")]
1146    pub prisma_cpe_code: Option<PrismaCpeCode>,
1147    /// The amount of tax applied to charges under this budget, in micros of the invoice's currency. For example, if currency_code is `USD`, then 1000000 represents one US dollar.
1148    #[serde(rename = "taxAmountMicros")]
1149    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1150    pub tax_amount_micros: Option<i64>,
1151    /// The total sum of charges made under this budget, including tax, in micros of the invoice's currency. For example, if currency_code is `USD`, then 1000000 represents one US dollar.
1152    #[serde(rename = "totalAmountMicros")]
1153    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1154    pub total_amount_micros: Option<i64>,
1155}
1156
1157impl common::Part for BudgetSummary {}
1158
1159/// Request message for BulkEditAdvertiserAssignedTargetingOptions.
1160///
1161/// # Activities
1162///
1163/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1164/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1165///
1166/// * [bulk edit advertiser assigned targeting options advertisers](AdvertiserBulkEditAdvertiserAssignedTargetingOptionCall) (request)
1167#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1168#[serde_with::serde_as]
1169#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1170pub struct BulkEditAdvertiserAssignedTargetingOptionsRequest {
1171    /// The assigned targeting options to create in batch, specified as a list of `CreateAssignedTargetingOptionsRequest`. Supported targeting types: * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_KEYWORD`
1172    #[serde(rename = "createRequests")]
1173    pub create_requests: Option<Vec<CreateAssignedTargetingOptionsRequest>>,
1174    /// The assigned targeting options to delete in batch, specified as a list of `DeleteAssignedTargetingOptionsRequest`. Supported targeting types: * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_KEYWORD`
1175    #[serde(rename = "deleteRequests")]
1176    pub delete_requests: Option<Vec<DeleteAssignedTargetingOptionsRequest>>,
1177}
1178
1179impl common::RequestValue for BulkEditAdvertiserAssignedTargetingOptionsRequest {}
1180
1181/// There is no detailed description.
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/// * [bulk edit advertiser assigned targeting options advertisers](AdvertiserBulkEditAdvertiserAssignedTargetingOptionCall) (response)
1189#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1190#[serde_with::serde_as]
1191#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1192pub struct BulkEditAdvertiserAssignedTargetingOptionsResponse {
1193    /// The list of assigned targeting options that have been successfully created. This list will be absent if empty.
1194    #[serde(rename = "createdAssignedTargetingOptions")]
1195    pub created_assigned_targeting_options: Option<Vec<AssignedTargetingOption>>,
1196}
1197
1198impl common::ResponseResult for BulkEditAdvertiserAssignedTargetingOptionsResponse {}
1199
1200/// Request message for AssignedInventorySourceService.BulkEdit.
1201///
1202/// # Activities
1203///
1204/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1205/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1206///
1207/// * [assigned inventory sources bulk edit inventory source groups](InventorySourceGroupAssignedInventorySourceBulkEditCall) (request)
1208#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1209#[serde_with::serde_as]
1210#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1211pub struct BulkEditAssignedInventorySourcesRequest {
1212    /// The ID of the advertiser that owns the parent inventory source group. The parent partner does not have access to these assigned inventory sources.
1213    #[serde(rename = "advertiserId")]
1214    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1215    pub advertiser_id: Option<i64>,
1216    /// The assigned inventory sources to create in bulk, specified as a list of AssignedInventorySources.
1217    #[serde(rename = "createdAssignedInventorySources")]
1218    pub created_assigned_inventory_sources: Option<Vec<AssignedInventorySource>>,
1219    /// The IDs of the assigned inventory sources to delete in bulk, specified as a list of assigned_inventory_source_ids.
1220    #[serde(rename = "deletedAssignedInventorySources")]
1221    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
1222    pub deleted_assigned_inventory_sources: Option<Vec<i64>>,
1223    /// The ID of the partner that owns the inventory source group. Only this partner has write access to these assigned inventory sources.
1224    #[serde(rename = "partnerId")]
1225    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1226    pub partner_id: Option<i64>,
1227}
1228
1229impl common::RequestValue for BulkEditAssignedInventorySourcesRequest {}
1230
1231/// Response message for AssignedInventorySourceService.BulkEdit.
1232///
1233/// # Activities
1234///
1235/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1236/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1237///
1238/// * [assigned inventory sources bulk edit inventory source groups](InventorySourceGroupAssignedInventorySourceBulkEditCall) (response)
1239#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1240#[serde_with::serde_as]
1241#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1242pub struct BulkEditAssignedInventorySourcesResponse {
1243    /// The list of assigned inventory sources that have been successfully created. This list will be absent if empty.
1244    #[serde(rename = "assignedInventorySources")]
1245    pub assigned_inventory_sources: Option<Vec<AssignedInventorySource>>,
1246}
1247
1248impl common::ResponseResult for BulkEditAssignedInventorySourcesResponse {}
1249
1250/// Request message for AssignedLocationService.BulkEditAssignedLocations.
1251///
1252/// # Activities
1253///
1254/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1255/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1256///
1257/// * [location lists assigned locations bulk edit advertisers](AdvertiserLocationListAssignedLocationBulkEditCall) (request)
1258#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1259#[serde_with::serde_as]
1260#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1261pub struct BulkEditAssignedLocationsRequest {
1262    /// The assigned locations to create in bulk, specified as a list of AssignedLocation resources.
1263    #[serde(rename = "createdAssignedLocations")]
1264    pub created_assigned_locations: Option<Vec<AssignedLocation>>,
1265    /// The IDs of the assigned locations to delete in bulk, specified as a list of assignedLocationId values.
1266    #[serde(rename = "deletedAssignedLocations")]
1267    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
1268    pub deleted_assigned_locations: Option<Vec<i64>>,
1269}
1270
1271impl common::RequestValue for BulkEditAssignedLocationsRequest {}
1272
1273/// There is no detailed description.
1274///
1275/// # Activities
1276///
1277/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1278/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1279///
1280/// * [location lists assigned locations bulk edit advertisers](AdvertiserLocationListAssignedLocationBulkEditCall) (response)
1281#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1282#[serde_with::serde_as]
1283#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1284pub struct BulkEditAssignedLocationsResponse {
1285    /// The list of assigned locations that have been successfully created. This list will be absent if empty.
1286    #[serde(rename = "assignedLocations")]
1287    pub assigned_locations: Option<Vec<AssignedLocation>>,
1288}
1289
1290impl common::ResponseResult for BulkEditAssignedLocationsResponse {}
1291
1292/// Request message for BulkEditAssignedUserRoles.
1293///
1294/// # Activities
1295///
1296/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1297/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1298///
1299/// * [bulk edit assigned user roles users](UserBulkEditAssignedUserRoleCall) (request)
1300#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1301#[serde_with::serde_as]
1302#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1303pub struct BulkEditAssignedUserRolesRequest {
1304    /// The assigned user roles to create in batch, specified as a list of AssignedUserRoles.
1305    #[serde(rename = "createdAssignedUserRoles")]
1306    pub created_assigned_user_roles: Option<Vec<AssignedUserRole>>,
1307    /// The assigned user roles to delete in batch, specified as a list of assigned_user_role_ids. The format of assigned_user_role_id is `entityType-entityid`, for example `partner-123`.
1308    #[serde(rename = "deletedAssignedUserRoles")]
1309    pub deleted_assigned_user_roles: Option<Vec<String>>,
1310}
1311
1312impl common::RequestValue for BulkEditAssignedUserRolesRequest {}
1313
1314/// There is no detailed description.
1315///
1316/// # Activities
1317///
1318/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1319/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1320///
1321/// * [bulk edit assigned user roles users](UserBulkEditAssignedUserRoleCall) (response)
1322#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1323#[serde_with::serde_as]
1324#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1325pub struct BulkEditAssignedUserRolesResponse {
1326    /// The list of assigned user roles that have been successfully created. This list will be absent if empty.
1327    #[serde(rename = "createdAssignedUserRoles")]
1328    pub created_assigned_user_roles: Option<Vec<AssignedUserRole>>,
1329}
1330
1331impl common::ResponseResult for BulkEditAssignedUserRolesResponse {}
1332
1333/// Request message for BulkEditLineItemAssignedTargetingOptions.
1334///
1335/// # Activities
1336///
1337/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1338/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1339///
1340/// * [line items bulk edit line item assigned targeting options advertisers](AdvertiserLineItemBulkEditLineItemAssignedTargetingOptionCall) (request)
1341#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1342#[serde_with::serde_as]
1343#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1344pub struct BulkEditLineItemAssignedTargetingOptionsRequest {
1345    /// The assigned targeting options to create in batch, specified as a list of `CreateAssignedTargetingOptionsRequest`.
1346    #[serde(rename = "createRequests")]
1347    pub create_requests: Option<Vec<CreateAssignedTargetingOptionsRequest>>,
1348    /// The assigned targeting options to delete in batch, specified as a list of `DeleteAssignedTargetingOptionsRequest`.
1349    #[serde(rename = "deleteRequests")]
1350    pub delete_requests: Option<Vec<DeleteAssignedTargetingOptionsRequest>>,
1351}
1352
1353impl common::RequestValue for BulkEditLineItemAssignedTargetingOptionsRequest {}
1354
1355/// There is no detailed description.
1356///
1357/// # Activities
1358///
1359/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1360/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1361///
1362/// * [line items bulk edit line item assigned targeting options advertisers](AdvertiserLineItemBulkEditLineItemAssignedTargetingOptionCall) (response)
1363#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1364#[serde_with::serde_as]
1365#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1366pub struct BulkEditLineItemAssignedTargetingOptionsResponse {
1367    /// The list of assigned targeting options that have been successfully created. This list will be absent if empty.
1368    #[serde(rename = "createdAssignedTargetingOptions")]
1369    pub created_assigned_targeting_options: Option<Vec<AssignedTargetingOption>>,
1370}
1371
1372impl common::ResponseResult for BulkEditLineItemAssignedTargetingOptionsResponse {}
1373
1374/// Request message for NegativeKeywordService.BulkEditNegativeKeywords.
1375///
1376/// # Activities
1377///
1378/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1379/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1380///
1381/// * [negative keyword lists negative keywords bulk edit advertisers](AdvertiserNegativeKeywordListNegativeKeywordBulkEditCall) (request)
1382#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1383#[serde_with::serde_as]
1384#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1385pub struct BulkEditNegativeKeywordsRequest {
1386    /// The negative keywords to create in batch, specified as a list of NegativeKeywords.
1387    #[serde(rename = "createdNegativeKeywords")]
1388    pub created_negative_keywords: Option<Vec<NegativeKeyword>>,
1389    /// The negative keywords to delete in batch, specified as a list of keyword_values.
1390    #[serde(rename = "deletedNegativeKeywords")]
1391    pub deleted_negative_keywords: Option<Vec<String>>,
1392}
1393
1394impl common::RequestValue for BulkEditNegativeKeywordsRequest {}
1395
1396/// Response message for NegativeKeywordService.BulkEditNegativeKeywords.
1397///
1398/// # Activities
1399///
1400/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1401/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1402///
1403/// * [negative keyword lists negative keywords bulk edit advertisers](AdvertiserNegativeKeywordListNegativeKeywordBulkEditCall) (response)
1404#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1405#[serde_with::serde_as]
1406#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1407pub struct BulkEditNegativeKeywordsResponse {
1408    /// The list of negative keywords that have been successfully created. This list will be absent if empty.
1409    #[serde(rename = "negativeKeywords")]
1410    pub negative_keywords: Option<Vec<NegativeKeyword>>,
1411}
1412
1413impl common::ResponseResult for BulkEditNegativeKeywordsResponse {}
1414
1415/// Request message for BulkEditPartnerAssignedTargetingOptions.
1416///
1417/// # Activities
1418///
1419/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1420/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1421///
1422/// * [bulk edit partner assigned targeting options partners](PartnerBulkEditPartnerAssignedTargetingOptionCall) (request)
1423#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1424#[serde_with::serde_as]
1425#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1426pub struct BulkEditPartnerAssignedTargetingOptionsRequest {
1427    /// The assigned targeting options to create in batch, specified as a list of `CreateAssignedTargetingOptionsRequest`. Supported targeting types: * `TARGETING_TYPE_CHANNEL`
1428    #[serde(rename = "createRequests")]
1429    pub create_requests: Option<Vec<CreateAssignedTargetingOptionsRequest>>,
1430    /// The assigned targeting options to delete in batch, specified as a list of `DeleteAssignedTargetingOptionsRequest`. Supported targeting types: * `TARGETING_TYPE_CHANNEL`
1431    #[serde(rename = "deleteRequests")]
1432    pub delete_requests: Option<Vec<DeleteAssignedTargetingOptionsRequest>>,
1433}
1434
1435impl common::RequestValue for BulkEditPartnerAssignedTargetingOptionsRequest {}
1436
1437/// There is no detailed description.
1438///
1439/// # Activities
1440///
1441/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1442/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1443///
1444/// * [bulk edit partner assigned targeting options partners](PartnerBulkEditPartnerAssignedTargetingOptionCall) (response)
1445#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1446#[serde_with::serde_as]
1447#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1448pub struct BulkEditPartnerAssignedTargetingOptionsResponse {
1449    /// The list of assigned targeting options that have been successfully created. This list will be absent if empty.
1450    #[serde(rename = "createdAssignedTargetingOptions")]
1451    pub created_assigned_targeting_options: Option<Vec<AssignedTargetingOption>>,
1452}
1453
1454impl common::ResponseResult for BulkEditPartnerAssignedTargetingOptionsResponse {}
1455
1456/// Request message for SiteService.BulkEditSites.
1457///
1458/// # Activities
1459///
1460/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1461/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1462///
1463/// * [channels sites bulk edit advertisers](AdvertiserChannelSiteBulkEditCall) (request)
1464/// * [channels sites bulk edit partners](PartnerChannelSiteBulkEditCall) (request)
1465#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1466#[serde_with::serde_as]
1467#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1468pub struct BulkEditSitesRequest {
1469    /// The ID of the advertiser that owns the parent channel.
1470    #[serde(rename = "advertiserId")]
1471    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1472    pub advertiser_id: Option<i64>,
1473    /// The sites to create in batch, specified as a list of Sites.
1474    #[serde(rename = "createdSites")]
1475    pub created_sites: Option<Vec<Site>>,
1476    /// The sites to delete in batch, specified as a list of site url_or_app_ids.
1477    #[serde(rename = "deletedSites")]
1478    pub deleted_sites: Option<Vec<String>>,
1479    /// The ID of the partner that owns the parent channel.
1480    #[serde(rename = "partnerId")]
1481    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1482    pub partner_id: Option<i64>,
1483}
1484
1485impl common::RequestValue for BulkEditSitesRequest {}
1486
1487/// Response message for SiteService.BulkEditSites.
1488///
1489/// # Activities
1490///
1491/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1492/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1493///
1494/// * [channels sites bulk edit advertisers](AdvertiserChannelSiteBulkEditCall) (response)
1495/// * [channels sites bulk edit partners](PartnerChannelSiteBulkEditCall) (response)
1496#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1497#[serde_with::serde_as]
1498#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1499pub struct BulkEditSitesResponse {
1500    /// The list of sites that have been successfully created. This list will be absent if empty.
1501    pub sites: Option<Vec<Site>>,
1502}
1503
1504impl common::ResponseResult for BulkEditSitesResponse {}
1505
1506/// There is no detailed description.
1507///
1508/// # Activities
1509///
1510/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1511/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1512///
1513/// * [bulk list advertiser assigned targeting options advertisers](AdvertiserBulkListAdvertiserAssignedTargetingOptionCall) (response)
1514#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1515#[serde_with::serde_as]
1516#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1517pub struct BulkListAdvertiserAssignedTargetingOptionsResponse {
1518    /// The list of assigned targeting options. This list will be absent if empty.
1519    #[serde(rename = "assignedTargetingOptions")]
1520    pub assigned_targeting_options: Option<Vec<AssignedTargetingOption>>,
1521    /// A token identifying the next page of results. This value should be specified as the pageToken in a subsequent BulkListAdvertiserAssignedTargetingOptionsRequest to fetch the next page of results. This token will be absent if there are no more assigned_targeting_options to return.
1522    #[serde(rename = "nextPageToken")]
1523    pub next_page_token: Option<String>,
1524}
1525
1526impl common::ResponseResult for BulkListAdvertiserAssignedTargetingOptionsResponse {}
1527
1528/// There is no detailed description.
1529///
1530/// # Activities
1531///
1532/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1533/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1534///
1535/// * [campaigns bulk list campaign assigned targeting options advertisers](AdvertiserCampaignBulkListCampaignAssignedTargetingOptionCall) (response)
1536#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1537#[serde_with::serde_as]
1538#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1539pub struct BulkListCampaignAssignedTargetingOptionsResponse {
1540    /// The list of assigned targeting options. This list will be absent if empty.
1541    #[serde(rename = "assignedTargetingOptions")]
1542    pub assigned_targeting_options: Option<Vec<AssignedTargetingOption>>,
1543    /// A token identifying the next page of results. This value should be specified as the pageToken in a subsequent BulkListCampaignAssignedTargetingOptionsRequest to fetch the next page of results. This token will be absent if there are no more assigned_targeting_options to return.
1544    #[serde(rename = "nextPageToken")]
1545    pub next_page_token: Option<String>,
1546}
1547
1548impl common::ResponseResult for BulkListCampaignAssignedTargetingOptionsResponse {}
1549
1550/// There is no detailed description.
1551///
1552/// # Activities
1553///
1554/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1555/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1556///
1557/// * [insertion orders bulk list insertion order assigned targeting options advertisers](AdvertiserInsertionOrderBulkListInsertionOrderAssignedTargetingOptionCall) (response)
1558#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1559#[serde_with::serde_as]
1560#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1561pub struct BulkListInsertionOrderAssignedTargetingOptionsResponse {
1562    /// The list of assigned targeting options. This list will be absent if empty.
1563    #[serde(rename = "assignedTargetingOptions")]
1564    pub assigned_targeting_options: Option<Vec<AssignedTargetingOption>>,
1565    /// A token identifying the next page of results. This value should be specified as the pageToken in a subsequent BulkListInsertionOrderAssignedTargetingOptionsRequest to fetch the next page of results. This token will be absent if there are no more assigned_targeting_options to return.
1566    #[serde(rename = "nextPageToken")]
1567    pub next_page_token: Option<String>,
1568}
1569
1570impl common::ResponseResult for BulkListInsertionOrderAssignedTargetingOptionsResponse {}
1571
1572/// There is no detailed description.
1573///
1574/// # Activities
1575///
1576/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1577/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1578///
1579/// * [line items bulk list line item assigned targeting options advertisers](AdvertiserLineItemBulkListLineItemAssignedTargetingOptionCall) (response)
1580#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1581#[serde_with::serde_as]
1582#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1583pub struct BulkListLineItemAssignedTargetingOptionsResponse {
1584    /// The list of assigned targeting options. This list will be absent if empty.
1585    #[serde(rename = "assignedTargetingOptions")]
1586    pub assigned_targeting_options: Option<Vec<AssignedTargetingOption>>,
1587    /// A token identifying the next page of results. This value should be specified as the pageToken in a subsequent BulkListLineItemAssignedTargetingOptionsRequest to fetch the next page of results. This token will be absent if there are no more assigned_targeting_options to return.
1588    #[serde(rename = "nextPageToken")]
1589    pub next_page_token: Option<String>,
1590}
1591
1592impl common::ResponseResult for BulkListLineItemAssignedTargetingOptionsResponse {}
1593
1594/// Details for assigned Business chain targeting option. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_BUSINESS_CHAIN`.
1595///
1596/// This type is not used in any activity, and only used as *part* of another schema.
1597///
1598#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1599#[serde_with::serde_as]
1600#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1601pub struct BusinessChainAssignedTargetingOptionDetails {
1602    /// Output only. The display name of a business chain, e.g. "KFC", "Chase Bank".
1603    #[serde(rename = "displayName")]
1604    pub display_name: Option<String>,
1605    /// Required. The radius of the area around the business chain that will be targeted. The units of the radius are specified by proximity_radius_unit. Must be 1 to 800 if unit is `DISTANCE_UNIT_KILOMETERS` and 1 to 500 if unit is `DISTANCE_UNIT_MILES`. The minimum increment for both cases is 0.1. Inputs will be rounded to the nearest acceptable value if it is too granular, e.g. 15.57 will become 15.6.
1606    #[serde(rename = "proximityRadiusAmount")]
1607    pub proximity_radius_amount: Option<f64>,
1608    /// Required. The unit of distance by which the targeting radius is measured.
1609    #[serde(rename = "proximityRadiusUnit")]
1610    pub proximity_radius_unit: Option<String>,
1611    /// Required. The targeting_option_id of a TargetingOption of type `TARGETING_TYPE_BUSINESS_CHAIN`. Accepted business chain targeting option IDs can be retrieved using SearchTargetingOptions.
1612    #[serde(rename = "targetingOptionId")]
1613    pub targeting_option_id: Option<String>,
1614}
1615
1616impl common::Part for BusinessChainAssignedTargetingOptionDetails {}
1617
1618/// Search terms for Business Chain targeting options. At least one of the field should be populated.
1619///
1620/// This type is not used in any activity, and only used as *part* of another schema.
1621///
1622#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1623#[serde_with::serde_as]
1624#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1625pub struct BusinessChainSearchTerms {
1626    /// The search query for the desired business chain. The query must be the full name of the business, e.g. "KFC", "mercedes-benz".
1627    #[serde(rename = "businessChainQuery")]
1628    pub business_chain_query: Option<String>,
1629    /// The search query for the desired geo region, e.g. "Seattle", "United State".
1630    #[serde(rename = "regionQuery")]
1631    pub region_query: Option<String>,
1632}
1633
1634impl common::Part for BusinessChainSearchTerms {}
1635
1636/// Represents a targetable business chain within a geo region. This will be populated in the business_chain_details field when targeting_type is `TARGETING_TYPE_BUSINESS_CHAIN`.
1637///
1638/// This type is not used in any activity, and only used as *part* of another schema.
1639///
1640#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1641#[serde_with::serde_as]
1642#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1643pub struct BusinessChainTargetingOptionDetails {
1644    /// Output only. The display name of the business chain, e.g. "KFC", "Chase Bank".
1645    #[serde(rename = "businessChain")]
1646    pub business_chain: Option<String>,
1647    /// Output only. The display name of the geographic region, e.g. "Ontario, Canada".
1648    #[serde(rename = "geoRegion")]
1649    pub geo_region: Option<String>,
1650    /// Output only. The type of the geographic region.
1651    #[serde(rename = "geoRegionType")]
1652    pub geo_region_type: Option<String>,
1653}
1654
1655impl common::Part for BusinessChainTargetingOptionDetails {}
1656
1657/// A single campaign.
1658///
1659/// # Activities
1660///
1661/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1662/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1663///
1664/// * [campaigns create advertisers](AdvertiserCampaignCreateCall) (request|response)
1665/// * [campaigns get advertisers](AdvertiserCampaignGetCall) (response)
1666/// * [campaigns patch advertisers](AdvertiserCampaignPatchCall) (request|response)
1667#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1668#[serde_with::serde_as]
1669#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1670pub struct Campaign {
1671    /// Output only. The unique ID of the advertiser the campaign belongs to.
1672    #[serde(rename = "advertiserId")]
1673    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1674    pub advertiser_id: Option<i64>,
1675    /// The list of budgets available to this campaign. If this field is not set, the campaign uses an unlimited budget.
1676    #[serde(rename = "campaignBudgets")]
1677    pub campaign_budgets: Option<Vec<CampaignBudget>>,
1678    /// Required. The planned spend and duration of the campaign.
1679    #[serde(rename = "campaignFlight")]
1680    pub campaign_flight: Option<CampaignFlight>,
1681    /// Required. The goal of the campaign.
1682    #[serde(rename = "campaignGoal")]
1683    pub campaign_goal: Option<CampaignGoal>,
1684    /// Output only. The unique ID of the campaign. Assigned by the system.
1685    #[serde(rename = "campaignId")]
1686    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1687    pub campaign_id: Option<i64>,
1688    /// Required. The display name of the campaign. Must be UTF-8 encoded with a maximum size of 240 bytes.
1689    #[serde(rename = "displayName")]
1690    pub display_name: Option<String>,
1691    /// Required. Controls whether or not the insertion orders under this campaign can spend their budgets and bid on inventory. * Accepted values are `ENTITY_STATUS_ACTIVE`, `ENTITY_STATUS_ARCHIVED`, and `ENTITY_STATUS_PAUSED`. * For CreateCampaign method, `ENTITY_STATUS_ARCHIVED` is not allowed.
1692    #[serde(rename = "entityStatus")]
1693    pub entity_status: Option<String>,
1694    /// Required. The frequency cap setting of the campaign.
1695    #[serde(rename = "frequencyCap")]
1696    pub frequency_cap: Option<FrequencyCap>,
1697    /// Output only. The resource name of the campaign.
1698    pub name: Option<String>,
1699    /// Output only. The timestamp when the campaign was last updated. Assigned by the system.
1700    #[serde(rename = "updateTime")]
1701    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1702}
1703
1704impl common::RequestValue for Campaign {}
1705impl common::ResponseResult for Campaign {}
1706
1707/// Settings that control how the campaign budget is allocated.
1708///
1709/// This type is not used in any activity, and only used as *part* of another schema.
1710///
1711#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1712#[serde_with::serde_as]
1713#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1714pub struct CampaignBudget {
1715    /// Required. The total amount the linked insertion order segments can budget. The amount is in micros. Must be greater than 0. For example, 500000000 represents 500 standard units of the currency.
1716    #[serde(rename = "budgetAmountMicros")]
1717    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1718    pub budget_amount_micros: Option<i64>,
1719    /// The unique ID of the campaign budget. Assigned by the system. Do not set for new budgets. Must be included when updating or adding budgets to campaign_budgets. Otherwise, a new ID will be generated and assigned.
1720    #[serde(rename = "budgetId")]
1721    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1722    pub budget_id: Option<i64>,
1723    /// Required. Immutable. Specifies whether the budget is measured in currency or impressions.
1724    #[serde(rename = "budgetUnit")]
1725    pub budget_unit: Option<String>,
1726    /// Required. The date range for the campaign budget. Linked budget segments may have a different date range. They are resolved relative to the parent advertiser's time zone. Both `start_date` and `end_date` must be before the year 2037.
1727    #[serde(rename = "dateRange")]
1728    pub date_range: Option<DateRange>,
1729    /// Required. The display name of the budget. Must be UTF-8 encoded with a maximum size of 240 bytes.
1730    #[serde(rename = "displayName")]
1731    pub display_name: Option<String>,
1732    /// Immutable. The ID identifying this budget to the external source. If this field is set and the invoice detail level of the corresponding billing profile is set to "Budget level PO", all impressions served against this budget will include this ID on the invoice. Must be unique under the campaign.
1733    #[serde(rename = "externalBudgetId")]
1734    pub external_budget_id: Option<String>,
1735    /// Required. The external source of the budget.
1736    #[serde(rename = "externalBudgetSource")]
1737    pub external_budget_source: Option<String>,
1738    /// Immutable. The ID used to group budgets to be included the same invoice. If this field is set and the invoice level of the corresponding billing profile is set to "Budget invoice grouping ID", all external_budget_id sharing the same invoice_grouping_id will be grouped in the same invoice.
1739    #[serde(rename = "invoiceGroupingId")]
1740    pub invoice_grouping_id: Option<String>,
1741    /// Additional metadata for use by the Mediaocean Prisma tool. Required for Mediaocean budgets. Only applicable to prisma_enabled advertisers.
1742    #[serde(rename = "prismaConfig")]
1743    pub prisma_config: Option<PrismaConfig>,
1744}
1745
1746impl common::Part for CampaignBudget {}
1747
1748/// Settings that track the planned spend and duration of a campaign.
1749///
1750/// This type is not used in any activity, and only used as *part* of another schema.
1751///
1752#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1753#[serde_with::serde_as]
1754#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1755pub struct CampaignFlight {
1756    /// Required. The dates that the campaign is expected to run. They are resolved relative to the parent advertiser's time zone. * The dates specified here will not affect serving. They are used to generate alerts and warnings. For example, if the flight date of any child insertion order is outside the range of these dates, the user interface will show a warning. * `start_date` is required and must be the current date or later. * `end_date` is optional. If specified, it must be the `start_date` or later. * Any specified date must be before the year 2037.
1757    #[serde(rename = "plannedDates")]
1758    pub planned_dates: Option<DateRange>,
1759    /// The amount the campaign is expected to spend for its given planned_dates. This will not limit serving, but will be used for tracking spend in the DV360 UI. The amount is in micros. Must be greater than or equal to 0. For example, 500000000 represents 500 standard units of the currency.
1760    #[serde(rename = "plannedSpendAmountMicros")]
1761    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1762    pub planned_spend_amount_micros: Option<i64>,
1763}
1764
1765impl common::Part for CampaignFlight {}
1766
1767/// Settings that control the goal of a campaign.
1768///
1769/// This type is not used in any activity, and only used as *part* of another schema.
1770///
1771#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1772#[serde_with::serde_as]
1773#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1774pub struct CampaignGoal {
1775    /// Required. The type of the campaign goal.
1776    #[serde(rename = "campaignGoalType")]
1777    pub campaign_goal_type: Option<String>,
1778    /// Required. The performance goal of the campaign. Acceptable values for performance_goal_type are: * `PERFORMANCE_GOAL_TYPE_CPM` * `PERFORMANCE_GOAL_TYPE_CPC` * `PERFORMANCE_GOAL_TYPE_CPA` * `PERFORMANCE_GOAL_TYPE_CPIAVC` * `PERFORMANCE_GOAL_TYPE_CTR` * `PERFORMANCE_GOAL_TYPE_VIEWABILITY` * `PERFORMANCE_GOAL_TYPE_OTHER`
1779    #[serde(rename = "performanceGoal")]
1780    pub performance_goal: Option<PerformanceGoal>,
1781}
1782
1783impl common::Part for CampaignGoal {}
1784
1785/// Details for assigned carrier and ISP targeting option. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_CARRIER_AND_ISP`.
1786///
1787/// This type is not used in any activity, and only used as *part* of another schema.
1788///
1789#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1790#[serde_with::serde_as]
1791#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1792pub struct CarrierAndIspAssignedTargetingOptionDetails {
1793    /// Output only. The display name of the carrier or ISP.
1794    #[serde(rename = "displayName")]
1795    pub display_name: Option<String>,
1796    /// Indicates if this option is being negatively targeted. All assigned carrier and ISP targeting options on the same resource must have the same value for this field.
1797    pub negative: Option<bool>,
1798    /// Required. The targeting_option_id of a TargetingOption of type `TARGETING_TYPE_CARRIER_AND_ISP`.
1799    #[serde(rename = "targetingOptionId")]
1800    pub targeting_option_id: Option<String>,
1801}
1802
1803impl common::Part for CarrierAndIspAssignedTargetingOptionDetails {}
1804
1805/// Represents a targetable carrier or ISP. This will be populated in the carrier_and_isp_details field of a TargetingOption when targeting_type is `TARGETING_TYPE_CARRIER_AND_ISP`.
1806///
1807/// This type is not used in any activity, and only used as *part* of another schema.
1808///
1809#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1810#[serde_with::serde_as]
1811#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1812pub struct CarrierAndIspTargetingOptionDetails {
1813    /// Output only. The display name of the carrier or ISP.
1814    #[serde(rename = "displayName")]
1815    pub display_name: Option<String>,
1816    /// Output only. The type indicating if it's carrier or ISP.
1817    #[serde(rename = "type")]
1818    pub type_: Option<String>,
1819}
1820
1821impl common::Part for CarrierAndIspTargetingOptionDetails {}
1822
1823/// Assigned category targeting option details. This will be populated in the category_details field when targeting_type is `TARGETING_TYPE_CATEGORY`.
1824///
1825/// This type is not used in any activity, and only used as *part* of another schema.
1826///
1827#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1828#[serde_with::serde_as]
1829#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1830pub struct CategoryAssignedTargetingOptionDetails {
1831    /// Output only. The display name of the category.
1832    #[serde(rename = "displayName")]
1833    pub display_name: Option<String>,
1834    /// Indicates if this option is being negatively targeted.
1835    pub negative: Option<bool>,
1836    /// Required. The targeting_option_id field when targeting_type is `TARGETING_TYPE_CATEGORY`.
1837    #[serde(rename = "targetingOptionId")]
1838    pub targeting_option_id: Option<String>,
1839}
1840
1841impl common::Part for CategoryAssignedTargetingOptionDetails {}
1842
1843/// Represents a targetable category. This will be populated in the category_details field of a TargetingOption when targeting_type is `TARGETING_TYPE_CATEGORY`.
1844///
1845/// This type is not used in any activity, and only used as *part* of another schema.
1846///
1847#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1848#[serde_with::serde_as]
1849#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1850pub struct CategoryTargetingOptionDetails {
1851    /// Output only. The display name of the category.
1852    #[serde(rename = "displayName")]
1853    pub display_name: Option<String>,
1854}
1855
1856impl common::Part for CategoryTargetingOptionDetails {}
1857
1858/// A single channel. Channels are custom groups of related websites and apps.
1859///
1860/// # Activities
1861///
1862/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1863/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1864///
1865/// * [channels create advertisers](AdvertiserChannelCreateCall) (request|response)
1866/// * [channels get advertisers](AdvertiserChannelGetCall) (response)
1867/// * [channels patch advertisers](AdvertiserChannelPatchCall) (request|response)
1868/// * [channels create partners](PartnerChannelCreateCall) (request|response)
1869/// * [channels get partners](PartnerChannelGetCall) (response)
1870/// * [channels patch partners](PartnerChannelPatchCall) (request|response)
1871#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1872#[serde_with::serde_as]
1873#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1874pub struct Channel {
1875    /// The ID of the advertiser that owns the channel.
1876    #[serde(rename = "advertiserId")]
1877    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1878    pub advertiser_id: Option<i64>,
1879    /// Output only. The unique ID of the channel. Assigned by the system.
1880    #[serde(rename = "channelId")]
1881    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1882    pub channel_id: Option<i64>,
1883    /// Required. The display name of the channel. Must be UTF-8 encoded with a maximum length of 240 bytes.
1884    #[serde(rename = "displayName")]
1885    pub display_name: Option<String>,
1886    /// Output only. The resource name of the channel.
1887    pub name: Option<String>,
1888    /// Output only. Number of line items that are directly targeting this channel negatively.
1889    #[serde(rename = "negativelyTargetedLineItemCount")]
1890    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1891    pub negatively_targeted_line_item_count: Option<i64>,
1892    /// The ID of the partner that owns the channel.
1893    #[serde(rename = "partnerId")]
1894    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1895    pub partner_id: Option<i64>,
1896    /// Output only. Number of line items that are directly targeting this channel positively.
1897    #[serde(rename = "positivelyTargetedLineItemCount")]
1898    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1899    pub positively_targeted_line_item_count: Option<i64>,
1900}
1901
1902impl common::RequestValue for Channel {}
1903impl common::ResponseResult for Channel {}
1904
1905/// Details for assigned channel targeting option. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_CHANNEL`.
1906///
1907/// This type is not used in any activity, and only used as *part* of another schema.
1908///
1909#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1910#[serde_with::serde_as]
1911#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1912pub struct ChannelAssignedTargetingOptionDetails {
1913    /// Required. ID of the channel. Should refer to the channel ID field on a [Partner-owned channel](partners.channels#Channel.FIELDS.channel_id) or [advertiser-owned channel](advertisers.channels#Channel.FIELDS.channel_id) resource.
1914    #[serde(rename = "channelId")]
1915    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1916    pub channel_id: Option<i64>,
1917    /// Indicates if this option is being negatively targeted. For advertiser level assigned targeting option, this field must be true.
1918    pub negative: Option<bool>,
1919}
1920
1921impl common::Part for ChannelAssignedTargetingOptionDetails {}
1922
1923/// Settings for advertisers that use both Campaign Manager 360 (CM360) and third-party ad servers.
1924///
1925/// This type is not used in any activity, and only used as *part* of another schema.
1926///
1927#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1928#[serde_with::serde_as]
1929#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1930pub struct CmHybridConfig {
1931    /// Required. Immutable. Account ID of the CM360 Floodlight configuration linked with the DV360 advertiser.
1932    #[serde(rename = "cmAccountId")]
1933    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1934    pub cm_account_id: Option<i64>,
1935    /// Output only. The set of CM360 Advertiser IDs sharing the CM360 Floodlight configuration.
1936    #[serde(rename = "cmAdvertiserIds")]
1937    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
1938    pub cm_advertiser_ids: Option<Vec<i64>>,
1939    /// Required. Immutable. ID of the CM360 Floodlight configuration linked with the DV360 advertiser.
1940    #[serde(rename = "cmFloodlightConfigId")]
1941    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1942    pub cm_floodlight_config_id: Option<i64>,
1943    /// Required. Immutable. By setting this field to `true`, you, on behalf of your company, authorize the sharing of information from the given Floodlight configuration to this Display & Video 360 advertiser.
1944    #[serde(rename = "cmFloodlightLinkingAuthorized")]
1945    pub cm_floodlight_linking_authorized: Option<bool>,
1946    /// A list of CM360 sites whose placements will be synced to DV360 as creatives. If absent or empty in CreateAdvertiser method, the system will automatically create a CM360 site. Removing sites from this list may cause DV360 creatives synced from CM360 to be deleted. At least one site must be specified.
1947    #[serde(rename = "cmSyncableSiteIds")]
1948    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
1949    pub cm_syncable_site_ids: Option<Vec<i64>>,
1950    /// Whether or not to report DV360 cost to CM360.
1951    #[serde(rename = "dv360ToCmCostReportingEnabled")]
1952    pub dv360_to_cm_cost_reporting_enabled: Option<bool>,
1953    /// Whether or not to include DV360 data in CM360 data transfer reports.
1954    #[serde(rename = "dv360ToCmDataSharingEnabled")]
1955    pub dv360_to_cm_data_sharing_enabled: Option<bool>,
1956}
1957
1958impl common::Part for CmHybridConfig {}
1959
1960/// A Campaign Manager 360 tracking ad.
1961///
1962/// This type is not used in any activity, and only used as *part* of another schema.
1963///
1964#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1965#[serde_with::serde_as]
1966#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1967pub struct CmTrackingAd {
1968    /// The ad ID of the campaign manager 360 tracking Ad.
1969    #[serde(rename = "cmAdId")]
1970    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1971    pub cm_ad_id: Option<i64>,
1972    /// The creative ID of the campaign manager 360 tracking Ad.
1973    #[serde(rename = "cmCreativeId")]
1974    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1975    pub cm_creative_id: Option<i64>,
1976    /// The placement ID of the campaign manager 360 tracking Ad.
1977    #[serde(rename = "cmPlacementId")]
1978    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1979    pub cm_placement_id: Option<i64>,
1980}
1981
1982impl common::Part for CmTrackingAd {}
1983
1984/// Describes a combined audience resource.
1985///
1986/// # Activities
1987///
1988/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1989/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1990///
1991/// * [get combined audiences](CombinedAudienceGetCall) (response)
1992/// * [list combined audiences](CombinedAudienceListCall) (none)
1993#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1994#[serde_with::serde_as]
1995#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1996pub struct CombinedAudience {
1997    /// Output only. The unique ID of the combined audience. Assigned by the system.
1998    #[serde(rename = "combinedAudienceId")]
1999    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2000    pub combined_audience_id: Option<i64>,
2001    /// Output only. The display name of the combined audience. .
2002    #[serde(rename = "displayName")]
2003    pub display_name: Option<String>,
2004    /// Output only. The resource name of the combined audience.
2005    pub name: Option<String>,
2006}
2007
2008impl common::Resource for CombinedAudience {}
2009impl common::ResponseResult for CombinedAudience {}
2010
2011/// Details of combined audience group. All combined audience targeting settings are logically ‘OR’ of each other.
2012///
2013/// This type is not used in any activity, and only used as *part* of another schema.
2014///
2015#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2016#[serde_with::serde_as]
2017#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2018pub struct CombinedAudienceGroup {
2019    /// Required. All combined audience targeting settings in combined audience group. Repeated settings with same id will be ignored. The number of combined audience settings should be no more than five, error will be thrown otherwise.
2020    pub settings: Option<Vec<CombinedAudienceTargetingSetting>>,
2021}
2022
2023impl common::Part for CombinedAudienceGroup {}
2024
2025/// Details of combined audience targeting setting.
2026///
2027/// This type is not used in any activity, and only used as *part* of another schema.
2028///
2029#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2030#[serde_with::serde_as]
2031#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2032pub struct CombinedAudienceTargetingSetting {
2033    /// Required. Combined audience id of combined audience targeting setting. This id is combined_audience_id.
2034    #[serde(rename = "combinedAudienceId")]
2035    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2036    pub combined_audience_id: Option<i64>,
2037}
2038
2039impl common::Part for CombinedAudienceTargetingSetting {}
2040
2041/// User consent status.
2042///
2043/// This type is not used in any activity, and only used as *part* of another schema.
2044///
2045#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2046#[serde_with::serde_as]
2047#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2048pub struct Consent {
2049    /// Represents consent for ad personalization.
2050    #[serde(rename = "adPersonalization")]
2051    pub ad_personalization: Option<String>,
2052    /// Represents consent for ad user data.
2053    #[serde(rename = "adUserData")]
2054    pub ad_user_data: Option<String>,
2055}
2056
2057impl common::Part for Consent {}
2058
2059/// Contact information defining a Customer Match audience member.
2060///
2061/// This type is not used in any activity, and only used as *part* of another schema.
2062///
2063#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2064#[serde_with::serde_as]
2065#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2066pub struct ContactInfo {
2067    /// Country code of the member. Must also be set with the following fields: * hashed_first_name * hashed_last_name * zip_codes
2068    #[serde(rename = "countryCode")]
2069    pub country_code: Option<String>,
2070    /// A list of SHA256 hashed email of the member. Before hashing, remove all whitespace and make sure the string is all lowercase.
2071    #[serde(rename = "hashedEmails")]
2072    pub hashed_emails: Option<Vec<String>>,
2073    /// SHA256 hashed first name of the member. Before hashing, remove all whitespace and make sure the string is all lowercase. Must also be set with the following fields: * country_code * hashed_last_name * zip_codes
2074    #[serde(rename = "hashedFirstName")]
2075    pub hashed_first_name: Option<String>,
2076    /// SHA256 hashed last name of the member. Before hashing, remove all whitespace and make sure the string is all lowercase. Must also be set with the following fields: * country_code * hashed_first_name * zip_codes
2077    #[serde(rename = "hashedLastName")]
2078    pub hashed_last_name: Option<String>,
2079    /// A list of SHA256 hashed phone numbers of the member. Before hashing, all phone numbers must be formatted using the [E.164 format](https://developers.google.com//en.wikipedia.org/wiki/E.164) and include the country calling code.
2080    #[serde(rename = "hashedPhoneNumbers")]
2081    pub hashed_phone_numbers: Option<Vec<String>>,
2082    /// A list of zip codes of the member. Must also be set with the following fields: * country_code * hashed_first_name * hashed_last_name
2083    #[serde(rename = "zipCodes")]
2084    pub zip_codes: Option<Vec<String>>,
2085}
2086
2087impl common::Part for ContactInfo {}
2088
2089/// Wrapper message for a list of contact information defining Customer Match audience members.
2090///
2091/// This type is not used in any activity, and only used as *part* of another schema.
2092///
2093#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2094#[serde_with::serde_as]
2095#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2096pub struct ContactInfoList {
2097    /// Input only. The consent setting for the users in contact_infos. Leaving this field unset indicates that consent is not specified. If ad_user_data or ad_personalization fields are set to `CONSENT_STATUS_DENIED`, the request will return an error.
2098    pub consent: Option<Consent>,
2099    /// A list of ContactInfo objects defining Customer Match audience members. The size of members after splitting the contact_infos mustn't be greater than 500,000.
2100    #[serde(rename = "contactInfos")]
2101    pub contact_infos: Option<Vec<ContactInfo>>,
2102}
2103
2104impl common::Part for ContactInfoList {}
2105
2106/// Details for content duration assigned targeting option. This will be populated in the content_duration_details field when targeting_type is `TARGETING_TYPE_CONTENT_DURATION`. Explicitly targeting all options is not supported. Remove all content duration targeting options to achieve this effect.
2107///
2108/// This type is not used in any activity, and only used as *part* of another schema.
2109///
2110#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2111#[serde_with::serde_as]
2112#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2113pub struct ContentDurationAssignedTargetingOptionDetails {
2114    /// Output only. The content duration.
2115    #[serde(rename = "contentDuration")]
2116    pub content_duration: Option<String>,
2117    /// Required. The targeting_option_id field when targeting_type is `TARGETING_TYPE_CONTENT_DURATION`.
2118    #[serde(rename = "targetingOptionId")]
2119    pub targeting_option_id: Option<String>,
2120}
2121
2122impl common::Part for ContentDurationAssignedTargetingOptionDetails {}
2123
2124/// Represents a targetable content duration. This will be populated in the content_duration_details field when targeting_type is `TARGETING_TYPE_CONTENT_DURATION`.
2125///
2126/// This type is not used in any activity, and only used as *part* of another schema.
2127///
2128#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2129#[serde_with::serde_as]
2130#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2131pub struct ContentDurationTargetingOptionDetails {
2132    /// Output only. The content duration.
2133    #[serde(rename = "contentDuration")]
2134    pub content_duration: Option<String>,
2135}
2136
2137impl common::Part for ContentDurationTargetingOptionDetails {}
2138
2139/// Details for content genre assigned targeting option. This will be populated in the content_genre_details field when targeting_type is `TARGETING_TYPE_CONTENT_GENRE`. Explicitly targeting all options is not supported. Remove all content genre targeting options to achieve this effect.
2140///
2141/// This type is not used in any activity, and only used as *part* of another schema.
2142///
2143#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2144#[serde_with::serde_as]
2145#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2146pub struct ContentGenreAssignedTargetingOptionDetails {
2147    /// Output only. The display name of the content genre.
2148    #[serde(rename = "displayName")]
2149    pub display_name: Option<String>,
2150    /// Indicates if this option is being negatively targeted.
2151    pub negative: Option<bool>,
2152    /// Required. The targeting_option_id field when targeting_type is `TARGETING_TYPE_CONTENT_GENRE`.
2153    #[serde(rename = "targetingOptionId")]
2154    pub targeting_option_id: Option<String>,
2155}
2156
2157impl common::Part for ContentGenreAssignedTargetingOptionDetails {}
2158
2159/// Represents a targetable content genre. This will be populated in the content_genre_details field when targeting_type is `TARGETING_TYPE_CONTENT_GENRE`.
2160///
2161/// This type is not used in any activity, and only used as *part* of another schema.
2162///
2163#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2164#[serde_with::serde_as]
2165#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2166pub struct ContentGenreTargetingOptionDetails {
2167    /// Output only. The display name of the content genre
2168    #[serde(rename = "displayName")]
2169    pub display_name: Option<String>,
2170}
2171
2172impl common::Part for ContentGenreTargetingOptionDetails {}
2173
2174/// Assigned content instream position targeting option details. This will be populated in the content_instream_position_details field when targeting_type is `TARGETING_TYPE_CONTENT_INSTREAM_POSITION`.
2175///
2176/// This type is not used in any activity, and only used as *part* of another schema.
2177///
2178#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2179#[serde_with::serde_as]
2180#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2181pub struct ContentInstreamPositionAssignedTargetingOptionDetails {
2182    /// Output only. The ad type to target. Only applicable to insertion order targeting and new line items supporting the specified ad type will inherit this targeting option by default. Possible values are: * `AD_TYPE_VIDEO`, the setting will be inherited by new line item when line_item_type is `LINE_ITEM_TYPE_VIDEO_DEFAULT`. * `AD_TYPE_AUDIO`, the setting will be inherited by new line item when line_item_type is `LINE_ITEM_TYPE_AUDIO_DEFAULT`.
2183    #[serde(rename = "adType")]
2184    pub ad_type: Option<String>,
2185    /// Required. The content instream position for video or audio ads.
2186    #[serde(rename = "contentInstreamPosition")]
2187    pub content_instream_position: Option<String>,
2188    /// Required. The targeting_option_id field when targeting_type is `TARGETING_TYPE_CONTENT_INSTREAM_POSITION`.
2189    #[serde(rename = "targetingOptionId")]
2190    pub targeting_option_id: Option<String>,
2191}
2192
2193impl common::Part for ContentInstreamPositionAssignedTargetingOptionDetails {}
2194
2195/// Represents a targetable content instream position, which could be used by video and audio ads. This will be populated in the content_instream_position_details field when targeting_type is `TARGETING_TYPE_CONTENT_INSTREAM_POSITION`.
2196///
2197/// This type is not used in any activity, and only used as *part* of another schema.
2198///
2199#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2200#[serde_with::serde_as]
2201#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2202pub struct ContentInstreamPositionTargetingOptionDetails {
2203    /// Output only. The content instream position.
2204    #[serde(rename = "contentInstreamPosition")]
2205    pub content_instream_position: Option<String>,
2206}
2207
2208impl common::Part for ContentInstreamPositionTargetingOptionDetails {}
2209
2210/// Assigned content outstream position targeting option details. This will be populated in the content_outstream_position_details field when targeting_type is `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION`.
2211///
2212/// This type is not used in any activity, and only used as *part* of another schema.
2213///
2214#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2215#[serde_with::serde_as]
2216#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2217pub struct ContentOutstreamPositionAssignedTargetingOptionDetails {
2218    /// Output only. The ad type to target. Only applicable to insertion order targeting and new line items supporting the specified ad type will inherit this targeting option by default. Possible values are: * `AD_TYPE_DISPLAY`, the setting will be inherited by new line item when line_item_type is `LINE_ITEM_TYPE_DISPLAY_DEFAULT`. * `AD_TYPE_VIDEO`, the setting will be inherited by new line item when line_item_type is `LINE_ITEM_TYPE_VIDEO_DEFAULT`.
2219    #[serde(rename = "adType")]
2220    pub ad_type: Option<String>,
2221    /// Required. The content outstream position.
2222    #[serde(rename = "contentOutstreamPosition")]
2223    pub content_outstream_position: Option<String>,
2224    /// Required. The targeting_option_id field when targeting_type is `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION`.
2225    #[serde(rename = "targetingOptionId")]
2226    pub targeting_option_id: Option<String>,
2227}
2228
2229impl common::Part for ContentOutstreamPositionAssignedTargetingOptionDetails {}
2230
2231/// Represents a targetable content outstream position, which could be used by display and video ads. This will be populated in the content_outstream_position_details field when targeting_type is `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION`.
2232///
2233/// This type is not used in any activity, and only used as *part* of another schema.
2234///
2235#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2236#[serde_with::serde_as]
2237#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2238pub struct ContentOutstreamPositionTargetingOptionDetails {
2239    /// Output only. The content outstream position.
2240    #[serde(rename = "contentOutstreamPosition")]
2241    pub content_outstream_position: Option<String>,
2242}
2243
2244impl common::Part for ContentOutstreamPositionTargetingOptionDetails {}
2245
2246/// Details for content stream type assigned targeting option. This will be populated in the content_stream_type_details field when targeting_type is `TARGETING_TYPE_CONTENT_STREAM_TYPE`. Explicitly targeting all options is not supported. Remove all content stream type targeting options to achieve this effect.
2247///
2248/// This type is not used in any activity, and only used as *part* of another schema.
2249///
2250#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2251#[serde_with::serde_as]
2252#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2253pub struct ContentStreamTypeAssignedTargetingOptionDetails {
2254    /// Output only. The content stream type.
2255    #[serde(rename = "contentStreamType")]
2256    pub content_stream_type: Option<String>,
2257    /// Required. The targeting_option_id field when targeting_type is `TARGETING_TYPE_CONTENT_STREAM_TYPE`.
2258    #[serde(rename = "targetingOptionId")]
2259    pub targeting_option_id: Option<String>,
2260}
2261
2262impl common::Part for ContentStreamTypeAssignedTargetingOptionDetails {}
2263
2264/// Represents a targetable content stream type. This will be populated in the content_stream_type_details field when targeting_type is `TARGETING_TYPE_CONTENT_STREAM_TYPE`.
2265///
2266/// This type is not used in any activity, and only used as *part* of another schema.
2267///
2268#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2269#[serde_with::serde_as]
2270#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2271pub struct ContentStreamTypeTargetingOptionDetails {
2272    /// Output only. The content stream type.
2273    #[serde(rename = "contentStreamType")]
2274    pub content_stream_type: Option<String>,
2275}
2276
2277impl common::Part for ContentStreamTypeTargetingOptionDetails {}
2278
2279/// Settings that control how conversions are counted. All post-click conversions will be counted. A percentage value can be set for post-view conversions counting.
2280///
2281/// This type is not used in any activity, and only used as *part* of another schema.
2282///
2283#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2284#[serde_with::serde_as]
2285#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2286pub struct ConversionCountingConfig {
2287    /// The Floodlight activity configs used to track conversions. The number of conversions counted is the sum of all of the conversions counted by all of the Floodlight activity IDs specified in this field.
2288    #[serde(rename = "floodlightActivityConfigs")]
2289    pub floodlight_activity_configs: Option<Vec<TrackingFloodlightActivityConfig>>,
2290    /// The percentage of post-view conversions to count, in millis (1/1000 of a percent). Must be between 0 and 100000 inclusive. For example, to track 50% of the post-click conversions, set a value of 50000.
2291    #[serde(rename = "postViewCountPercentageMillis")]
2292    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2293    pub post_view_count_percentage_millis: Option<i64>,
2294}
2295
2296impl common::Part for ConversionCountingConfig {}
2297
2298/// Counter event of the creative.
2299///
2300/// This type is not used in any activity, and only used as *part* of another schema.
2301///
2302#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2303#[serde_with::serde_as]
2304#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2305pub struct CounterEvent {
2306    /// Required. The name of the counter event.
2307    pub name: Option<String>,
2308    /// Required. The name used to identify this counter event in reports.
2309    #[serde(rename = "reportingName")]
2310    pub reporting_name: Option<String>,
2311}
2312
2313impl common::Part for CounterEvent {}
2314
2315/// A request message for CreateAsset.
2316///
2317/// # Activities
2318///
2319/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2320/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2321///
2322/// * [assets upload advertisers](AdvertiserAssetUploadCall) (request)
2323#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2324#[serde_with::serde_as]
2325#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2326pub struct CreateAssetRequest {
2327    /// Required. The filename of the asset, including the file extension. The filename must be UTF-8 encoded with a maximum size of 240 bytes.
2328    pub filename: Option<String>,
2329}
2330
2331impl common::RequestValue for CreateAssetRequest {}
2332
2333/// A response message for CreateAsset.
2334///
2335/// # Activities
2336///
2337/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2338/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2339///
2340/// * [assets upload advertisers](AdvertiserAssetUploadCall) (response)
2341#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2342#[serde_with::serde_as]
2343#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2344pub struct CreateAssetResponse {
2345    /// The uploaded asset, if successful.
2346    pub asset: Option<Asset>,
2347}
2348
2349impl common::ResponseResult for CreateAssetResponse {}
2350
2351/// A request listing which assigned targeting options of a given targeting type should be created and added.
2352///
2353/// This type is not used in any activity, and only used as *part* of another schema.
2354///
2355#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2356#[serde_with::serde_as]
2357#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2358pub struct CreateAssignedTargetingOptionsRequest {
2359    /// Required. The assigned targeting options to create and add.
2360    #[serde(rename = "assignedTargetingOptions")]
2361    pub assigned_targeting_options: Option<Vec<AssignedTargetingOption>>,
2362    /// Required. Identifies the type of this assigned targeting option.
2363    #[serde(rename = "targetingType")]
2364    pub targeting_type: Option<String>,
2365}
2366
2367impl common::Part for CreateAssignedTargetingOptionsRequest {}
2368
2369/// Request message for \[SdfDownloadTaskService.CreateSdfDownloadTask\].
2370///
2371/// # Activities
2372///
2373/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2374/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2375///
2376/// * [create sdfdownloadtasks](SdfdownloadtaskCreateCall) (request)
2377#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2378#[serde_with::serde_as]
2379#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2380pub struct CreateSdfDownloadTaskRequest {
2381    /// The ID of the advertiser to download SDF for.
2382    #[serde(rename = "advertiserId")]
2383    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2384    pub advertiser_id: Option<i64>,
2385    /// Filters on entities by their entity IDs.
2386    #[serde(rename = "idFilter")]
2387    pub id_filter: Option<IdFilter>,
2388    /// Filters on Inventory Sources by their IDs.
2389    #[serde(rename = "inventorySourceFilter")]
2390    pub inventory_source_filter: Option<InventorySourceFilter>,
2391    /// Filters on selected file types. The entities in each file are filtered by a chosen set of filter entities. The filter entities must be the same type as, or a parent type of, the selected file types.
2392    #[serde(rename = "parentEntityFilter")]
2393    pub parent_entity_filter: Option<ParentEntityFilter>,
2394    /// The ID of the partner to download SDF for.
2395    #[serde(rename = "partnerId")]
2396    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2397    pub partner_id: Option<i64>,
2398    /// Required. The SDF version of the downloaded file. If set to `SDF_VERSION_UNSPECIFIED`, this will default to the version specified by the advertiser or partner identified by `root_id`. An advertiser inherits its SDF version from its partner unless configured otherwise.
2399    pub version: Option<String>,
2400}
2401
2402impl common::RequestValue for CreateSdfDownloadTaskRequest {}
2403
2404/// A single Creative.
2405///
2406/// # Activities
2407///
2408/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2409/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2410///
2411/// * [creatives create advertisers](AdvertiserCreativeCreateCall) (request|response)
2412/// * [creatives get advertisers](AdvertiserCreativeGetCall) (response)
2413/// * [creatives patch advertisers](AdvertiserCreativePatchCall) (request|response)
2414#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2415#[serde_with::serde_as]
2416#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2417pub struct Creative {
2418    /// Additional dimensions. Applicable when creative_type is one of: * `CREATIVE_TYPE_STANDARD` * `CREATIVE_TYPE_EXPANDABLE` * `CREATIVE_TYPE_NATIVE` * `CREATIVE_TYPE_NATIVE_SITE_SQUARE` * `CREATIVE_TYPE_LIGHTBOX` * `CREATIVE_TYPE_PUBLISHER_HOSTED` If this field is specified, width_pixels and height_pixels are both required and must be greater than or equal to 0.
2419    #[serde(rename = "additionalDimensions")]
2420    pub additional_dimensions: Option<Vec<Dimensions>>,
2421    /// Output only. The unique ID of the advertiser the creative belongs to.
2422    #[serde(rename = "advertiserId")]
2423    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2424    pub advertiser_id: Option<i64>,
2425    /// Third-party HTML tracking tag to be appended to the creative tag.
2426    #[serde(rename = "appendedTag")]
2427    pub appended_tag: Option<String>,
2428    /// Required. Assets associated to this creative.
2429    pub assets: Option<Vec<AssetAssociation>>,
2430    /// Output only. The unique ID of the Campaign Manager 360 placement associated with the creative. This field is only applicable for creatives that are synced from Campaign Manager.
2431    #[serde(rename = "cmPlacementId")]
2432    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2433    pub cm_placement_id: Option<i64>,
2434    /// The Campaign Manager 360 tracking ad associated with the creative. Optional for the following creative_type when created by an advertiser that uses both Campaign Manager 360 and third-party ad serving: * `CREATIVE_TYPE_NATIVE` * `CREATIVE_TYPE_NATIVE_SITE_SQUARE` Output only for other cases.
2435    #[serde(rename = "cmTrackingAd")]
2436    pub cm_tracking_ad: Option<CmTrackingAd>,
2437    /// The IDs of companion creatives for a video creative. You can assign existing display creatives (with image or HTML5 assets) to serve surrounding the publisher's video player. Companions display around the video player while the video is playing and remain after the video has completed. Creatives contain additional dimensions can not be companion creatives. This field is only supported for following creative_type: * `CREATIVE_TYPE_AUDIO` * `CREATIVE_TYPE_VIDEO`
2438    #[serde(rename = "companionCreativeIds")]
2439    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
2440    pub companion_creative_ids: Option<Vec<i64>>,
2441    /// Counter events for a rich media creative. Counters track the number of times that a user interacts with any part of a rich media creative in a specified way (mouse-overs, mouse-outs, clicks, taps, data loading, keyboard entries, etc.). Any event that can be captured in the creative can be recorded as a counter. Leave it empty or unset for creatives containing image assets only.
2442    #[serde(rename = "counterEvents")]
2443    pub counter_events: Option<Vec<CounterEvent>>,
2444    /// Output only. The timestamp when the creative was created. Assigned by the system.
2445    #[serde(rename = "createTime")]
2446    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2447    /// Output only. A list of attributes of the creative that is generated by the system.
2448    #[serde(rename = "creativeAttributes")]
2449    pub creative_attributes: Option<Vec<String>>,
2450    /// Output only. The unique ID of the creative. Assigned by the system.
2451    #[serde(rename = "creativeId")]
2452    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2453    pub creative_id: Option<i64>,
2454    /// Required. Immutable. The type of the creative.
2455    #[serde(rename = "creativeType")]
2456    pub creative_type: Option<String>,
2457    /// Required. Primary dimensions of the creative. Applicable to all creative types. The value of width_pixels and height_pixels defaults to `0` when creative_type is one of: * `CREATIVE_TYPE_VIDEO` * `CREATIVE_TYPE_AUDIO` * `CREATIVE_TYPE_NATIVE_VIDEO`
2458    pub dimensions: Option<Dimensions>,
2459    /// Required. The display name of the creative. Must be UTF-8 encoded with a maximum size of 240 bytes.
2460    #[serde(rename = "displayName")]
2461    pub display_name: Option<String>,
2462    /// Output only. Indicates whether the creative is dynamic.
2463    pub dynamic: Option<bool>,
2464    /// Required. Controls whether or not the creative can serve. Accepted values are: * `ENTITY_STATUS_ACTIVE` * `ENTITY_STATUS_ARCHIVED` * `ENTITY_STATUS_PAUSED`
2465    #[serde(rename = "entityStatus")]
2466    pub entity_status: Option<String>,
2467    /// Required. Exit events for this creative. An exit (also known as a click tag) is any area in your creative that someone can click or tap to open an advertiser's landing page. Every creative must include at least one exit. You can add an exit to your creative in any of the following ways: * Use Google Web Designer's tap area. * Define a JavaScript variable called "clickTag". * Use the Enabler (Enabler.exit()) to track exits in rich media formats.
2468    #[serde(rename = "exitEvents")]
2469    pub exit_events: Option<Vec<ExitEvent>>,
2470    /// Optional. Indicates the creative will automatically expand on hover. Optional and only valid for third-party expandable creatives. Third-party expandable creatives are creatives with following hosting source: * `HOSTING_SOURCE_THIRD_PARTY` combined with following creative_type: * `CREATIVE_TYPE_EXPANDABLE`
2471    #[serde(rename = "expandOnHover")]
2472    pub expand_on_hover: Option<bool>,
2473    /// Optional. Specifies the expanding direction of the creative. Required and only valid for third-party expandable creatives. Third-party expandable creatives are creatives with following hosting source: * `HOSTING_SOURCE_THIRD_PARTY` combined with following creative_type: * `CREATIVE_TYPE_EXPANDABLE`
2474    #[serde(rename = "expandingDirection")]
2475    pub expanding_direction: Option<String>,
2476    /// Required. Indicates where the creative is hosted.
2477    #[serde(rename = "hostingSource")]
2478    pub hosting_source: Option<String>,
2479    /// Output only. Indicates the third-party VAST tag creative requires HTML5 Video support. Output only and only valid for third-party VAST tag creatives. Third-party VAST tag creatives are creatives with following hosting_source: * `HOSTING_SOURCE_THIRD_PARTY` combined with following creative_type: * `CREATIVE_TYPE_VIDEO`
2480    #[serde(rename = "html5Video")]
2481    pub html5_video: Option<bool>,
2482    /// Indicates whether Integral Ad Science (IAS) campaign monitoring is enabled. To enable this for the creative, make sure the Advertiser.creative_config.ias_client_id has been set to your IAS client ID.
2483    #[serde(rename = "iasCampaignMonitoring")]
2484    pub ias_campaign_monitoring: Option<bool>,
2485    /// ID information used to link this creative to an external system. Must be UTF-8 encoded with a length of no more than 10,000 characters.
2486    #[serde(rename = "integrationCode")]
2487    pub integration_code: Option<String>,
2488    /// JavaScript measurement URL from supported third-party verification providers (ComScore, DoubleVerify, IAS, Moat). HTML script tags are not supported. This field is only writeable in following creative_type: * `CREATIVE_TYPE_NATIVE` * `CREATIVE_TYPE_NATIVE_SITE_SQUARE` * `CREATIVE_TYPE_NATIVE_VIDEO`
2489    #[serde(rename = "jsTrackerUrl")]
2490    pub js_tracker_url: Option<String>,
2491    /// Output only. The IDs of the line items this creative is associated with. To associate a creative to a line item, use LineItem.creative_ids instead.
2492    #[serde(rename = "lineItemIds")]
2493    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
2494    pub line_item_ids: Option<Vec<i64>>,
2495    /// Output only. Media duration of the creative. Applicable when creative_type is one of: * `CREATIVE_TYPE_VIDEO` * `CREATIVE_TYPE_AUDIO` * `CREATIVE_TYPE_NATIVE_VIDEO` * `CREATIVE_TYPE_PUBLISHER_HOSTED`
2496    #[serde(rename = "mediaDuration")]
2497    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2498    pub media_duration: Option<chrono::Duration>,
2499    /// Output only. Indicates the third-party audio creative supports MP3. Output only and only valid for third-party audio creatives. Third-party audio creatives are creatives with following hosting_source: * `HOSTING_SOURCE_THIRD_PARTY` combined with following creative_type: * `CREATIVE_TYPE_AUDIO`
2500    #[serde(rename = "mp3Audio")]
2501    pub mp3_audio: Option<bool>,
2502    /// Output only. The resource name of the creative.
2503    pub name: Option<String>,
2504    /// User notes for this creative. Must be UTF-8 encoded with a length of no more than 20,000 characters.
2505    pub notes: Option<String>,
2506    /// Specifies the OBA icon for a video creative. This field is only supported in following creative_type: * `CREATIVE_TYPE_VIDEO`
2507    #[serde(rename = "obaIcon")]
2508    pub oba_icon: Option<ObaIcon>,
2509    /// Output only. Indicates the third-party audio creative supports OGG. Output only and only valid for third-party audio creatives. Third-party audio creatives are creatives with following hosting_source: * `HOSTING_SOURCE_THIRD_PARTY` combined with following creative_type: * `CREATIVE_TYPE_AUDIO`
2510    #[serde(rename = "oggAudio")]
2511    pub ogg_audio: Option<bool>,
2512    /// Amount of time to play the video before counting a view. This field is required when skippable is true. This field is only supported for the following creative_type: * `CREATIVE_TYPE_VIDEO`
2513    #[serde(rename = "progressOffset")]
2514    pub progress_offset: Option<AudioVideoOffset>,
2515    /// Optional. Indicates that the creative relies on HTML5 to render properly. Optional and only valid for third-party tag creatives. Third-party tag creatives are creatives with following hosting_source: * `HOSTING_SOURCE_THIRD_PARTY` combined with following creative_type: * `CREATIVE_TYPE_STANDARD` * `CREATIVE_TYPE_EXPANDABLE`
2516    #[serde(rename = "requireHtml5")]
2517    pub require_html5: Option<bool>,
2518    /// Optional. Indicates that the creative requires MRAID (Mobile Rich Media Ad Interface Definitions system). Set this if the creative relies on mobile gestures for interactivity, such as swiping or tapping. Optional and only valid for third-party tag creatives. Third-party tag creatives are creatives with following hosting_source: * `HOSTING_SOURCE_THIRD_PARTY` combined with following creative_type: * `CREATIVE_TYPE_STANDARD` * `CREATIVE_TYPE_EXPANDABLE`
2519    #[serde(rename = "requireMraid")]
2520    pub require_mraid: Option<bool>,
2521    /// Optional. Indicates that the creative will wait for a return ping for attribution. Only valid when using a Campaign Manager 360 tracking ad with a third-party ad server parameter and the ${DC_DBM_TOKEN} macro. Optional and only valid for third-party tag creatives or third-party VAST tag creatives. Third-party tag creatives are creatives with following hosting_source: * `HOSTING_SOURCE_THIRD_PARTY` combined with following creative_type: * `CREATIVE_TYPE_STANDARD` * `CREATIVE_TYPE_EXPANDABLE` Third-party VAST tag creatives are creatives with following hosting_source: * `HOSTING_SOURCE_THIRD_PARTY` combined with following creative_type: * `CREATIVE_TYPE_AUDIO` * `CREATIVE_TYPE_VIDEO`
2522    #[serde(rename = "requirePingForAttribution")]
2523    pub require_ping_for_attribution: Option<bool>,
2524    /// Output only. The current status of the creative review process.
2525    #[serde(rename = "reviewStatus")]
2526    pub review_status: Option<ReviewStatusInfo>,
2527    /// Amount of time to play the video before the skip button appears. This field is required when skippable is true. This field is only supported for the following creative_type: * `CREATIVE_TYPE_VIDEO`
2528    #[serde(rename = "skipOffset")]
2529    pub skip_offset: Option<AudioVideoOffset>,
2530    /// Whether the user can choose to skip a video creative. This field is only supported for the following creative_type: * `CREATIVE_TYPE_VIDEO`
2531    pub skippable: Option<bool>,
2532    /// Optional. The original third-party tag used for the creative. Required and only valid for third-party tag creatives. Third-party tag creatives are creatives with following hosting_source: * `HOSTING_SOURCE_THIRD_PARTY` combined with following creative_type: * `CREATIVE_TYPE_STANDARD` * `CREATIVE_TYPE_EXPANDABLE`
2533    #[serde(rename = "thirdPartyTag")]
2534    pub third_party_tag: Option<String>,
2535    /// Tracking URLs from third parties to track interactions with a video creative. This field is only supported for the following creative_type: * `CREATIVE_TYPE_AUDIO` * `CREATIVE_TYPE_VIDEO` * `CREATIVE_TYPE_NATIVE_VIDEO`
2536    #[serde(rename = "thirdPartyUrls")]
2537    pub third_party_urls: Option<Vec<ThirdPartyUrl>>,
2538    /// Timer custom events for a rich media creative. Timers track the time during which a user views and interacts with a specified part of a rich media creative. A creative can have multiple timer events, each timed independently. Leave it empty or unset for creatives containing image assets only.
2539    #[serde(rename = "timerEvents")]
2540    pub timer_events: Option<Vec<TimerEvent>>,
2541    /// Tracking URLs for analytics providers or third-party ad technology vendors. The URLs must start with https (except on inventory that doesn't require SSL compliance). If using macros in your URL, use only macros supported by Display & Video 360. Standard URLs only, no IMG or SCRIPT tags. This field is only writeable in following creative_type: * `CREATIVE_TYPE_NATIVE` * `CREATIVE_TYPE_NATIVE_SITE_SQUARE` * `CREATIVE_TYPE_NATIVE_VIDEO`
2542    #[serde(rename = "trackerUrls")]
2543    pub tracker_urls: Option<Vec<String>>,
2544    /// Output only. Audio/Video transcodes. Display & Video 360 transcodes the main asset into a number of alternative versions that use different file formats or have different properties (resolution, audio bit rate, and video bit rate), each designed for specific video players or bandwidths. These transcodes give a publisher's system more options to choose from for each impression on your video and ensures that the appropriate file serves based on the viewer’s connection and screen size. This field is only supported in following creative_type: * `CREATIVE_TYPE_VIDEO` * `CREATIVE_TYPE_NATIVE_VIDEO` * `CREATIVE_TYPE_AUDIO`
2545    pub transcodes: Option<Vec<Transcode>>,
2546    /// Optional. An optional creative identifier provided by a registry that is unique across all platforms. Universal Ad ID is part of the VAST 4.0 standard. It can be modified after the creative is created. This field is only supported for the following creative_type: * `CREATIVE_TYPE_VIDEO`
2547    #[serde(rename = "universalAdId")]
2548    pub universal_ad_id: Option<UniversalAdId>,
2549    /// Output only. The timestamp when the creative was last updated, either by the user or system (e.g. creative review). Assigned by the system.
2550    #[serde(rename = "updateTime")]
2551    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2552    /// Optional. The URL of the VAST tag for a third-party VAST tag creative. Required and only valid for third-party VAST tag creatives. Third-party VAST tag creatives are creatives with following hosting_source: * `HOSTING_SOURCE_THIRD_PARTY` combined with following creative_type: * `CREATIVE_TYPE_AUDIO` * `CREATIVE_TYPE_VIDEO`
2553    #[serde(rename = "vastTagUrl")]
2554    pub vast_tag_url: Option<String>,
2555    /// Output only. Indicates the third-party VAST tag creative requires VPAID (Digital Video Player-Ad Interface). Output only and only valid for third-party VAST tag creatives. Third-party VAST tag creatives are creatives with following hosting_source: * `HOSTING_SOURCE_THIRD_PARTY` combined with following creative_type: * `CREATIVE_TYPE_VIDEO`
2556    pub vpaid: Option<bool>,
2557}
2558
2559impl common::RequestValue for Creative {}
2560impl common::ResponseResult for Creative {}
2561
2562/// Creative requirements configuration for the inventory source.
2563///
2564/// This type is not used in any activity, and only used as *part* of another schema.
2565///
2566#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2567#[serde_with::serde_as]
2568#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2569pub struct CreativeConfig {
2570    /// The type of creative that can be assigned to the inventory source. Only the following types are supported: * `CREATIVE_TYPE_STANDARD` * `CREATIVE_TYPE_VIDEO`
2571    #[serde(rename = "creativeType")]
2572    pub creative_type: Option<String>,
2573    /// The configuration for display creatives. Applicable when creative_type is `CREATIVE_TYPE_STANDARD`.
2574    #[serde(rename = "displayCreativeConfig")]
2575    pub display_creative_config: Option<InventorySourceDisplayCreativeConfig>,
2576    /// The configuration for video creatives. Applicable when creative_type is `CREATIVE_TYPE_VIDEO`.
2577    #[serde(rename = "videoCreativeConfig")]
2578    pub video_creative_config: Option<InventorySourceVideoCreativeConfig>,
2579}
2580
2581impl common::Part for CreativeConfig {}
2582
2583/// A single custom bidding algorithm.
2584///
2585/// # Activities
2586///
2587/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2588/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2589///
2590/// * [scripts create custom bidding algorithms](CustomBiddingAlgorithmScriptCreateCall) (none)
2591/// * [scripts get custom bidding algorithms](CustomBiddingAlgorithmScriptGetCall) (none)
2592/// * [scripts list custom bidding algorithms](CustomBiddingAlgorithmScriptListCall) (none)
2593/// * [create custom bidding algorithms](CustomBiddingAlgorithmCreateCall) (request|response)
2594/// * [get custom bidding algorithms](CustomBiddingAlgorithmGetCall) (response)
2595/// * [list custom bidding algorithms](CustomBiddingAlgorithmListCall) (none)
2596/// * [patch custom bidding algorithms](CustomBiddingAlgorithmPatchCall) (request|response)
2597/// * [upload script custom bidding algorithms](CustomBiddingAlgorithmUploadScriptCall) (none)
2598#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2599#[serde_with::serde_as]
2600#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2601pub struct CustomBiddingAlgorithm {
2602    /// Immutable. The unique ID of the advertiser that owns the custom bidding algorithm.
2603    #[serde(rename = "advertiserId")]
2604    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2605    pub advertiser_id: Option<i64>,
2606    /// Output only. The unique ID of the custom bidding algorithm. Assigned by the system.
2607    #[serde(rename = "customBiddingAlgorithmId")]
2608    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2609    pub custom_bidding_algorithm_id: Option<i64>,
2610    /// Output only. The status of custom bidding algorithm.
2611    #[serde(rename = "customBiddingAlgorithmState")]
2612    pub custom_bidding_algorithm_state: Option<String>,
2613    /// Required. Immutable. The type of custom bidding algorithm.
2614    #[serde(rename = "customBiddingAlgorithmType")]
2615    pub custom_bidding_algorithm_type: Option<String>,
2616    /// Required. The display name of the custom bidding algorithm. Must be UTF-8 encoded with a maximum size of 240 bytes.
2617    #[serde(rename = "displayName")]
2618    pub display_name: Option<String>,
2619    /// Controls whether or not the custom bidding algorithm can be used as a bidding strategy. Accepted values are: * `ENTITY_STATUS_ACTIVE` * `ENTITY_STATUS_ARCHIVED`
2620    #[serde(rename = "entityStatus")]
2621    pub entity_status: Option<String>,
2622    /// Output only. The state of custom bidding model readiness for each advertiser who has access. This field may only include the state of the queried advertiser if the algorithm [`owner`](https://developers.google.com/display-video/api/reference/rest/v1/customBiddingAlgorithms#CustomBiddingAlgorithm.FIELDS.oneof_owner) is a partner and is being retrieved using an advertiser [`accessor`](https://developers.google.com/display-video/api/reference/rest/v1/customBiddingAlgorithms/list#body.QUERY_PARAMETERS.oneof_accessor).
2623    #[serde(rename = "modelReadiness")]
2624    pub model_readiness: Option<Vec<CustomBiddingModelReadinessState>>,
2625    /// Output only. The resource name of the custom bidding algorithm.
2626    pub name: Option<String>,
2627    /// Immutable. The unique ID of the partner that owns the custom bidding algorithm.
2628    #[serde(rename = "partnerId")]
2629    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2630    pub partner_id: Option<i64>,
2631    /// The IDs of the advertisers who have access to this algorithm. If advertiser_id is set, this field will only consist of that value. This field will not be set if the algorithm [`owner`](https://developers.google.com/display-video/api/reference/rest/v1/customBiddingAlgorithms#CustomBiddingAlgorithm.FIELDS.oneof_owner) is a partner and is being retrieved using an advertiser [`accessor`](https://developers.google.com/display-video/api/reference/rest/v1/customBiddingAlgorithms/list#body.QUERY_PARAMETERS.oneof_accessor).
2632    #[serde(rename = "sharedAdvertiserIds")]
2633    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
2634    pub shared_advertiser_ids: Option<Vec<i64>>,
2635}
2636
2637impl common::RequestValue for CustomBiddingAlgorithm {}
2638impl common::Resource for CustomBiddingAlgorithm {}
2639impl common::ResponseResult for CustomBiddingAlgorithm {}
2640
2641/// The custom bidding algorithm model readiness state for a single shared advertiser.
2642///
2643/// This type is not used in any activity, and only used as *part* of another schema.
2644///
2645#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2646#[serde_with::serde_as]
2647#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2648pub struct CustomBiddingModelReadinessState {
2649    /// The unique ID of the relevant advertiser.
2650    #[serde(rename = "advertiserId")]
2651    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2652    pub advertiser_id: Option<i64>,
2653    /// The readiness state of custom bidding model.
2654    #[serde(rename = "readinessState")]
2655    pub readiness_state: Option<String>,
2656}
2657
2658impl common::Part for CustomBiddingModelReadinessState {}
2659
2660/// A single custom bidding script.
2661///
2662/// # Activities
2663///
2664/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2665/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2666///
2667/// * [scripts create custom bidding algorithms](CustomBiddingAlgorithmScriptCreateCall) (request|response)
2668/// * [scripts get custom bidding algorithms](CustomBiddingAlgorithmScriptGetCall) (response)
2669#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2670#[serde_with::serde_as]
2671#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2672pub struct CustomBiddingScript {
2673    /// Output only. Whether the script is currently being used for scoring by the parent algorithm.
2674    pub active: Option<bool>,
2675    /// Output only. The time when the script was created.
2676    #[serde(rename = "createTime")]
2677    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2678    /// Output only. The unique ID of the custom bidding algorithm the script belongs to.
2679    #[serde(rename = "customBiddingAlgorithmId")]
2680    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2681    pub custom_bidding_algorithm_id: Option<i64>,
2682    /// Output only. The unique ID of the custom bidding script.
2683    #[serde(rename = "customBiddingScriptId")]
2684    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2685    pub custom_bidding_script_id: Option<i64>,
2686    /// Output only. Error details of a rejected custom bidding script. This field will only be populated when state is REJECTED.
2687    pub errors: Option<Vec<ScriptError>>,
2688    /// Output only. The resource name of the custom bidding script.
2689    pub name: Option<String>,
2690    /// The reference to the uploaded script file.
2691    pub script: Option<CustomBiddingScriptRef>,
2692    /// Output only. The state of the custom bidding script.
2693    pub state: Option<String>,
2694}
2695
2696impl common::RequestValue for CustomBiddingScript {}
2697impl common::ResponseResult for CustomBiddingScript {}
2698
2699/// The reference to the uploaded custom bidding script file.
2700///
2701/// # Activities
2702///
2703/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2704/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2705///
2706/// * [upload script custom bidding algorithms](CustomBiddingAlgorithmUploadScriptCall) (response)
2707#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2708#[serde_with::serde_as]
2709#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2710pub struct CustomBiddingScriptRef {
2711    /// A resource name to be used in media.download to Download the script files. Or media.upload to Upload the script files. Resource names have the format `customBiddingAlgorithms/{custom_bidding_algorithm_id}/scriptRef/{ref_id}`.
2712    #[serde(rename = "resourceName")]
2713    pub resource_name: Option<String>,
2714}
2715
2716impl common::ResponseResult for CustomBiddingScriptRef {}
2717
2718/// Describes a custom list entity, such as a custom affinity or custom intent audience list.
2719///
2720/// # Activities
2721///
2722/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2723/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2724///
2725/// * [get custom lists](CustomListGetCall) (response)
2726/// * [list custom lists](CustomListListCall) (none)
2727#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2728#[serde_with::serde_as]
2729#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2730pub struct CustomList {
2731    /// Output only. The unique ID of the custom list. Assigned by the system.
2732    #[serde(rename = "customListId")]
2733    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2734    pub custom_list_id: Option<i64>,
2735    /// Output only. The display name of the custom list. .
2736    #[serde(rename = "displayName")]
2737    pub display_name: Option<String>,
2738    /// Output only. The resource name of the custom list.
2739    pub name: Option<String>,
2740}
2741
2742impl common::Resource for CustomList {}
2743impl common::ResponseResult for CustomList {}
2744
2745/// Details of custom list group. All custom list targeting settings are logically ‘OR’ of each other.
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 CustomListGroup {
2753    /// Required. All custom list targeting settings in custom list group. Repeated settings with same id will be ignored.
2754    pub settings: Option<Vec<CustomListTargetingSetting>>,
2755}
2756
2757impl common::Part for CustomListGroup {}
2758
2759/// Details of custom list targeting setting.
2760///
2761/// This type is not used in any activity, and only used as *part* of another schema.
2762///
2763#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2764#[serde_with::serde_as]
2765#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2766pub struct CustomListTargetingSetting {
2767    /// Required. Custom id of custom list targeting setting. This id is custom_list_id.
2768    #[serde(rename = "customListId")]
2769    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2770    pub custom_list_id: Option<i64>,
2771}
2772
2773impl common::Part for CustomListTargetingSetting {}
2774
2775/// Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
2776///
2777/// This type is not used in any activity, and only used as *part* of another schema.
2778///
2779#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2780#[serde_with::serde_as]
2781#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2782pub struct Date {
2783    /// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
2784    pub day: Option<i32>,
2785    /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
2786    pub month: Option<i32>,
2787    /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
2788    pub year: Option<i32>,
2789}
2790
2791impl common::Part for Date {}
2792
2793/// A date range.
2794///
2795/// This type is not used in any activity, and only used as *part* of another schema.
2796///
2797#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2798#[serde_with::serde_as]
2799#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2800pub struct DateRange {
2801    /// The upper bound of the date range, inclusive. Must specify a positive value for `year`, `month`, and `day`.
2802    #[serde(rename = "endDate")]
2803    pub end_date: Option<Date>,
2804    /// The lower bound of the date range, inclusive. Must specify a positive value for `year`, `month`, and `day`.
2805    #[serde(rename = "startDate")]
2806    pub start_date: Option<Date>,
2807}
2808
2809impl common::Part for DateRange {}
2810
2811/// Representation of a segment of time defined on a specific day of the week and with a start and end time. The time represented by `start_hour` must be before the time represented by `end_hour`.
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 DayAndTimeAssignedTargetingOptionDetails {
2819    /// Required. The day of the week for this day and time targeting setting.
2820    #[serde(rename = "dayOfWeek")]
2821    pub day_of_week: Option<String>,
2822    /// Required. The end hour for day and time targeting. Must be between 1 (1 hour after start of day) and 24 (end of day).
2823    #[serde(rename = "endHour")]
2824    pub end_hour: Option<i32>,
2825    /// Required. The start hour for day and time targeting. Must be between 0 (start of day) and 23 (1 hour before end of day).
2826    #[serde(rename = "startHour")]
2827    pub start_hour: Option<i32>,
2828    /// Required. The mechanism used to determine which timezone to use for this day and time targeting setting.
2829    #[serde(rename = "timeZoneResolution")]
2830    pub time_zone_resolution: Option<String>,
2831}
2832
2833impl common::Part for DayAndTimeAssignedTargetingOptionDetails {}
2834
2835/// Request message for ManualTriggerService.DeactivateManualTrigger.
2836///
2837/// # Activities
2838///
2839/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2840/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2841///
2842/// * [manual triggers deactivate advertisers](AdvertiserManualTriggerDeactivateCall) (request)
2843#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2844#[serde_with::serde_as]
2845#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2846pub struct DeactivateManualTriggerRequest {
2847    _never_set: Option<bool>,
2848}
2849
2850impl common::RequestValue for DeactivateManualTriggerRequest {}
2851
2852/// A request listing which assigned targeting options of a given targeting type should be deleted.
2853///
2854/// This type is not used in any activity, and only used as *part* of another schema.
2855///
2856#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2857#[serde_with::serde_as]
2858#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2859pub struct DeleteAssignedTargetingOptionsRequest {
2860    /// Required. The assigned targeting option IDs to delete.
2861    #[serde(rename = "assignedTargetingOptionIds")]
2862    pub assigned_targeting_option_ids: Option<Vec<String>>,
2863    /// Required. Identifies the type of this assigned targeting option.
2864    #[serde(rename = "targetingType")]
2865    pub targeting_type: Option<String>,
2866}
2867
2868impl common::Part for DeleteAssignedTargetingOptionsRequest {}
2869
2870/// Assigned device make and model targeting option details. This will be populated in the device_make_model_details field when targeting_type is `TARGETING_TYPE_DEVICE_MAKE_MODEL`.
2871///
2872/// This type is not used in any activity, and only used as *part* of another schema.
2873///
2874#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2875#[serde_with::serde_as]
2876#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2877pub struct DeviceMakeModelAssignedTargetingOptionDetails {
2878    /// Output only. The display name of the device make and model.
2879    #[serde(rename = "displayName")]
2880    pub display_name: Option<String>,
2881    /// Indicates if this option is being negatively targeted.
2882    pub negative: Option<bool>,
2883    /// Required. The targeting_option_id field when targeting_type is `TARGETING_TYPE_DEVICE_MAKE_MODEL`.
2884    #[serde(rename = "targetingOptionId")]
2885    pub targeting_option_id: Option<String>,
2886}
2887
2888impl common::Part for DeviceMakeModelAssignedTargetingOptionDetails {}
2889
2890/// Represents a targetable device make and model. This will be populated in the device_make_model_details field of a TargetingOption when targeting_type is `TARGETING_TYPE_DEVICE_MAKE_MODEL`.
2891///
2892/// This type is not used in any activity, and only used as *part* of another schema.
2893///
2894#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2895#[serde_with::serde_as]
2896#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2897pub struct DeviceMakeModelTargetingOptionDetails {
2898    /// Output only. The display name of the device make and model.
2899    #[serde(rename = "displayName")]
2900    pub display_name: Option<String>,
2901}
2902
2903impl common::Part for DeviceMakeModelTargetingOptionDetails {}
2904
2905/// Targeting details for device type. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_DEVICE_TYPE`.
2906///
2907/// This type is not used in any activity, and only used as *part* of another schema.
2908///
2909#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2910#[serde_with::serde_as]
2911#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2912pub struct DeviceTypeAssignedTargetingOptionDetails {
2913    /// Required. The display name of the device type.
2914    #[serde(rename = "deviceType")]
2915    pub device_type: Option<String>,
2916    /// Required. ID of the device type.
2917    #[serde(rename = "targetingOptionId")]
2918    pub targeting_option_id: Option<String>,
2919}
2920
2921impl common::Part for DeviceTypeAssignedTargetingOptionDetails {}
2922
2923/// Represents a targetable device type. This will be populated in the device_type_details field of a TargetingOption when targeting_type is `TARGETING_TYPE_DEVICE_TYPE`.
2924///
2925/// This type is not used in any activity, and only used as *part* of another schema.
2926///
2927#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2928#[serde_with::serde_as]
2929#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2930pub struct DeviceTypeTargetingOptionDetails {
2931    /// Output only. The device type that is used to be targeted.
2932    #[serde(rename = "deviceType")]
2933    pub device_type: Option<String>,
2934}
2935
2936impl common::Part for DeviceTypeTargetingOptionDetails {}
2937
2938/// Targeting details for digital content label. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION`.
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 DigitalContentLabelAssignedTargetingOptionDetails {
2946    /// Output only. The display name of the digital content label rating tier.
2947    #[serde(rename = "contentRatingTier")]
2948    pub content_rating_tier: Option<String>,
2949    /// Required. ID of the digital content label to be EXCLUDED.
2950    #[serde(rename = "excludedTargetingOptionId")]
2951    pub excluded_targeting_option_id: Option<String>,
2952}
2953
2954impl common::Part for DigitalContentLabelAssignedTargetingOptionDetails {}
2955
2956/// Represents a targetable digital content label rating tier. This will be populated in the digital_content_label_details field of the TargetingOption when targeting_type is `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION`.
2957///
2958/// This type is not used in any activity, and only used as *part* of another schema.
2959///
2960#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2961#[serde_with::serde_as]
2962#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2963pub struct DigitalContentLabelTargetingOptionDetails {
2964    /// Output only. An enum for the content label brand safety tiers.
2965    #[serde(rename = "contentRatingTier")]
2966    pub content_rating_tier: Option<String>,
2967}
2968
2969impl common::Part for DigitalContentLabelTargetingOptionDetails {}
2970
2971/// Dimensions.
2972///
2973/// This type is not used in any activity, and only used as *part* of another schema.
2974///
2975#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2976#[serde_with::serde_as]
2977#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2978pub struct Dimensions {
2979    /// The height in pixels.
2980    #[serde(rename = "heightPixels")]
2981    pub height_pixels: Option<i32>,
2982    /// The width in pixels.
2983    #[serde(rename = "widthPixels")]
2984    pub width_pixels: Option<i32>,
2985}
2986
2987impl common::Part for Dimensions {}
2988
2989/// Details of DoubleVerify settings.
2990///
2991/// This type is not used in any activity, and only used as *part* of another schema.
2992///
2993#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2994#[serde_with::serde_as]
2995#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2996pub struct DoubleVerify {
2997    /// Avoid bidding on apps with the star ratings.
2998    #[serde(rename = "appStarRating")]
2999    pub app_star_rating: Option<DoubleVerifyAppStarRating>,
3000    /// Avoid bidding on apps with the age rating.
3001    #[serde(rename = "avoidedAgeRatings")]
3002    pub avoided_age_ratings: Option<Vec<String>>,
3003    /// DV Brand Safety Controls.
3004    #[serde(rename = "brandSafetyCategories")]
3005    pub brand_safety_categories: Option<DoubleVerifyBrandSafetyCategories>,
3006    /// The custom segment ID provided by DoubleVerify. The ID must start with "51" and consist of eight digits. Custom segment ID cannot be specified along with any of the following fields: * brand_safety_categories * avoided_age_ratings * app_star_rating * fraud_invalid_traffic
3007    #[serde(rename = "customSegmentId")]
3008    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3009    pub custom_segment_id: Option<i64>,
3010    /// Display viewability settings (applicable to display line items only).
3011    #[serde(rename = "displayViewability")]
3012    pub display_viewability: Option<DoubleVerifyDisplayViewability>,
3013    /// Avoid Sites and Apps with historical Fraud & IVT Rates.
3014    #[serde(rename = "fraudInvalidTraffic")]
3015    pub fraud_invalid_traffic: Option<DoubleVerifyFraudInvalidTraffic>,
3016    /// Video viewability settings (applicable to video line items only).
3017    #[serde(rename = "videoViewability")]
3018    pub video_viewability: Option<DoubleVerifyVideoViewability>,
3019}
3020
3021impl common::Part for DoubleVerify {}
3022
3023/// Details of DoubleVerify star ratings settings.
3024///
3025/// This type is not used in any activity, and only used as *part* of another schema.
3026///
3027#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3028#[serde_with::serde_as]
3029#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3030pub struct DoubleVerifyAppStarRating {
3031    /// Avoid bidding on apps with insufficient star ratings.
3032    #[serde(rename = "avoidInsufficientStarRating")]
3033    pub avoid_insufficient_star_rating: Option<bool>,
3034    /// Avoid bidding on apps with the star ratings.
3035    #[serde(rename = "avoidedStarRating")]
3036    pub avoided_star_rating: Option<String>,
3037}
3038
3039impl common::Part for DoubleVerifyAppStarRating {}
3040
3041/// Settings for brand safety controls.
3042///
3043/// This type is not used in any activity, and only used as *part* of another schema.
3044///
3045#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3046#[serde_with::serde_as]
3047#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3048pub struct DoubleVerifyBrandSafetyCategories {
3049    /// Unknown or unrateable.
3050    #[serde(rename = "avoidUnknownBrandSafetyCategory")]
3051    pub avoid_unknown_brand_safety_category: Option<bool>,
3052    /// Brand safety high severity avoidance categories.
3053    #[serde(rename = "avoidedHighSeverityCategories")]
3054    pub avoided_high_severity_categories: Option<Vec<String>>,
3055    /// Brand safety medium severity avoidance categories.
3056    #[serde(rename = "avoidedMediumSeverityCategories")]
3057    pub avoided_medium_severity_categories: Option<Vec<String>>,
3058}
3059
3060impl common::Part for DoubleVerifyBrandSafetyCategories {}
3061
3062/// Details of DoubleVerify display viewability settings.
3063///
3064/// This type is not used in any activity, and only used as *part* of another schema.
3065///
3066#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3067#[serde_with::serde_as]
3068#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3069pub struct DoubleVerifyDisplayViewability {
3070    /// Target web and app inventory to maximize IAB viewable rate.
3071    pub iab: Option<String>,
3072    /// Target web and app inventory to maximize 100% viewable duration.
3073    #[serde(rename = "viewableDuring")]
3074    pub viewable_during: Option<String>,
3075}
3076
3077impl common::Part for DoubleVerifyDisplayViewability {}
3078
3079/// DoubleVerify Fraud & Invalid Traffic settings.
3080///
3081/// This type is not used in any activity, and only used as *part* of another schema.
3082///
3083#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3084#[serde_with::serde_as]
3085#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3086pub struct DoubleVerifyFraudInvalidTraffic {
3087    /// Insufficient Historical Fraud & IVT Stats.
3088    #[serde(rename = "avoidInsufficientOption")]
3089    pub avoid_insufficient_option: Option<bool>,
3090    /// Avoid Sites and Apps with historical Fraud & IVT.
3091    #[serde(rename = "avoidedFraudOption")]
3092    pub avoided_fraud_option: Option<String>,
3093}
3094
3095impl common::Part for DoubleVerifyFraudInvalidTraffic {}
3096
3097/// Details of DoubleVerify video viewability settings.
3098///
3099/// This type is not used in any activity, and only used as *part* of another schema.
3100///
3101#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3102#[serde_with::serde_as]
3103#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3104pub struct DoubleVerifyVideoViewability {
3105    /// Target inventory to maximize impressions with 400x300 or greater player size.
3106    #[serde(rename = "playerImpressionRate")]
3107    pub player_impression_rate: Option<String>,
3108    /// Target web inventory to maximize IAB viewable rate.
3109    #[serde(rename = "videoIab")]
3110    pub video_iab: Option<String>,
3111    /// Target web inventory to maximize fully viewable rate.
3112    #[serde(rename = "videoViewableRate")]
3113    pub video_viewable_rate: Option<String>,
3114}
3115
3116impl common::Part for DoubleVerifyVideoViewability {}
3117
3118/// Request message for FirstAndThirdPartyAudienceService.EditCustomerMatchMembers.
3119///
3120/// # Activities
3121///
3122/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3123/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3124///
3125/// * [edit customer match members first and third party audiences](FirstAndThirdPartyAudienceEditCustomerMatchMemberCall) (request)
3126#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3127#[serde_with::serde_as]
3128#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3129pub struct EditCustomerMatchMembersRequest {
3130    /// Input only. A list of contact information to define the members to be added.
3131    #[serde(rename = "addedContactInfoList")]
3132    pub added_contact_info_list: Option<ContactInfoList>,
3133    /// Input only. A list of mobile device IDs to define the members to be added.
3134    #[serde(rename = "addedMobileDeviceIdList")]
3135    pub added_mobile_device_id_list: Option<MobileDeviceIdList>,
3136    /// Required. The ID of the owner advertiser of the updated Customer Match FirstAndThirdPartyAudience.
3137    #[serde(rename = "advertiserId")]
3138    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3139    pub advertiser_id: Option<i64>,
3140    /// Input only. A list of contact information to define the members to be removed.
3141    #[serde(rename = "removedContactInfoList")]
3142    pub removed_contact_info_list: Option<ContactInfoList>,
3143    /// Input only. A list of mobile device IDs to define the members to be removed.
3144    #[serde(rename = "removedMobileDeviceIdList")]
3145    pub removed_mobile_device_id_list: Option<MobileDeviceIdList>,
3146}
3147
3148impl common::RequestValue for EditCustomerMatchMembersRequest {}
3149
3150/// The response of FirstAndThirdPartyAudienceService.EditCustomerMatchMembers.
3151///
3152/// # Activities
3153///
3154/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3155/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3156///
3157/// * [edit customer match members first and third party audiences](FirstAndThirdPartyAudienceEditCustomerMatchMemberCall) (response)
3158#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3159#[serde_with::serde_as]
3160#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3161pub struct EditCustomerMatchMembersResponse {
3162    /// Required. The ID of the updated Customer Match FirstAndThirdPartyAudience.
3163    #[serde(rename = "firstAndThirdPartyAudienceId")]
3164    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3165    pub first_and_third_party_audience_id: Option<i64>,
3166}
3167
3168impl common::ResponseResult for EditCustomerMatchMembersResponse {}
3169
3170/// Request message for GuaranteedOrderService.EditGuaranteedOrderReadAccessors.
3171///
3172/// # Activities
3173///
3174/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3175/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3176///
3177/// * [edit guaranteed order read accessors guaranteed orders](GuaranteedOrderEditGuaranteedOrderReadAccessorCall) (request)
3178#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3179#[serde_with::serde_as]
3180#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3181pub struct EditGuaranteedOrderReadAccessorsRequest {
3182    /// The advertisers to add as read accessors to the guaranteed order.
3183    #[serde(rename = "addedAdvertisers")]
3184    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
3185    pub added_advertisers: Option<Vec<i64>>,
3186    /// Required. The partner context in which the change is being made.
3187    #[serde(rename = "partnerId")]
3188    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3189    pub partner_id: Option<i64>,
3190    /// Whether to give all advertisers of the read/write accessor partner read access to the guaranteed order. Only applicable if read_write_partner_id is set in the guaranteed order.
3191    #[serde(rename = "readAccessInherited")]
3192    pub read_access_inherited: Option<bool>,
3193    /// The advertisers to remove as read accessors to the guaranteed order.
3194    #[serde(rename = "removedAdvertisers")]
3195    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
3196    pub removed_advertisers: Option<Vec<i64>>,
3197}
3198
3199impl common::RequestValue for EditGuaranteedOrderReadAccessorsRequest {}
3200
3201/// There is no detailed description.
3202///
3203/// # Activities
3204///
3205/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3206/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3207///
3208/// * [edit guaranteed order read accessors guaranteed orders](GuaranteedOrderEditGuaranteedOrderReadAccessorCall) (response)
3209#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3210#[serde_with::serde_as]
3211#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3212pub struct EditGuaranteedOrderReadAccessorsResponse {
3213    /// Whether all advertisers of read_write_partner_id have read access to the guaranteed order.
3214    #[serde(rename = "readAccessInherited")]
3215    pub read_access_inherited: Option<bool>,
3216    /// The IDs of advertisers with read access to the guaranteed order.
3217    #[serde(rename = "readAdvertiserIds")]
3218    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
3219    pub read_advertiser_ids: Option<Vec<i64>>,
3220}
3221
3222impl common::ResponseResult for EditGuaranteedOrderReadAccessorsResponse {}
3223
3224/// Request message for InventorySourceService.EditInventorySourceReadWriteAccessors.
3225///
3226/// # Activities
3227///
3228/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3229/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3230///
3231/// * [edit inventory source read write accessors inventory sources](InventorySourceEditInventorySourceReadWriteAccessorCall) (request)
3232#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3233#[serde_with::serde_as]
3234#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3235pub struct EditInventorySourceReadWriteAccessorsRequest {
3236    /// The advertisers to add or remove from the list of advertisers that have read/write access to the inventory source. This change will remove an existing partner read/write accessor.
3237    #[serde(rename = "advertisersUpdate")]
3238    pub advertisers_update: Option<EditInventorySourceReadWriteAccessorsRequestAdvertisersUpdate>,
3239    /// Set the partner context as read/write accessor of the inventory source. This will remove all other current read/write advertiser accessors.
3240    #[serde(rename = "assignPartner")]
3241    pub assign_partner: Option<bool>,
3242    /// Required. The partner context by which the accessors change is being made.
3243    #[serde(rename = "partnerId")]
3244    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3245    pub partner_id: Option<i64>,
3246}
3247
3248impl common::RequestValue for EditInventorySourceReadWriteAccessorsRequest {}
3249
3250/// Update to the list of advertisers with read/write access to the inventory source.
3251///
3252/// This type is not used in any activity, and only used as *part* of another schema.
3253///
3254#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3255#[serde_with::serde_as]
3256#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3257pub struct EditInventorySourceReadWriteAccessorsRequestAdvertisersUpdate {
3258    /// The advertisers to add.
3259    #[serde(rename = "addedAdvertisers")]
3260    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
3261    pub added_advertisers: Option<Vec<i64>>,
3262    /// The advertisers to remove.
3263    #[serde(rename = "removedAdvertisers")]
3264    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
3265    pub removed_advertisers: Option<Vec<i64>>,
3266}
3267
3268impl common::Part for EditInventorySourceReadWriteAccessorsRequestAdvertisersUpdate {}
3269
3270/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
3271///
3272/// # Activities
3273///
3274/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3275/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3276///
3277/// * [campaigns delete advertisers](AdvertiserCampaignDeleteCall) (response)
3278/// * [channels sites delete advertisers](AdvertiserChannelSiteDeleteCall) (response)
3279/// * [creatives delete advertisers](AdvertiserCreativeDeleteCall) (response)
3280/// * [insertion orders delete advertisers](AdvertiserInsertionOrderDeleteCall) (response)
3281/// * [line items targeting types assigned targeting options delete advertisers](AdvertiserLineItemTargetingTypeAssignedTargetingOptionDeleteCall) (response)
3282/// * [line items delete advertisers](AdvertiserLineItemDeleteCall) (response)
3283/// * [location lists assigned locations delete advertisers](AdvertiserLocationListAssignedLocationDeleteCall) (response)
3284/// * [negative keyword lists negative keywords delete advertisers](AdvertiserNegativeKeywordListNegativeKeywordDeleteCall) (response)
3285/// * [negative keyword lists delete advertisers](AdvertiserNegativeKeywordListDeleteCall) (response)
3286/// * [targeting types assigned targeting options delete advertisers](AdvertiserTargetingTypeAssignedTargetingOptionDeleteCall) (response)
3287/// * [delete advertisers](AdvertiserDeleteCall) (response)
3288/// * [assigned inventory sources delete inventory source groups](InventorySourceGroupAssignedInventorySourceDeleteCall) (response)
3289/// * [delete inventory source groups](InventorySourceGroupDeleteCall) (response)
3290/// * [channels sites delete partners](PartnerChannelSiteDeleteCall) (response)
3291/// * [targeting types assigned targeting options delete partners](PartnerTargetingTypeAssignedTargetingOptionDeleteCall) (response)
3292/// * [delete users](UserDeleteCall) (response)
3293#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3294#[serde_with::serde_as]
3295#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3296pub struct Empty {
3297    _never_set: Option<bool>,
3298}
3299
3300impl common::ResponseResult for Empty {}
3301
3302/// Assigned environment targeting option details. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_ENVIRONMENT`.
3303///
3304/// This type is not used in any activity, and only used as *part* of another schema.
3305///
3306#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3307#[serde_with::serde_as]
3308#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3309pub struct EnvironmentAssignedTargetingOptionDetails {
3310    /// Required. The serving environment.
3311    pub environment: Option<String>,
3312    /// Required. The targeting_option_id of a TargetingOption of type `TARGETING_TYPE_ENVIRONMENT` (e.g., "508010" for targeting the `ENVIRONMENT_WEB_OPTIMIZED` option).
3313    #[serde(rename = "targetingOptionId")]
3314    pub targeting_option_id: Option<String>,
3315}
3316
3317impl common::Part for EnvironmentAssignedTargetingOptionDetails {}
3318
3319/// Represents a targetable environment. This will be populated in the environment_details field of a TargetingOption when targeting_type is `TARGETING_TYPE_ENVIRONMENT`.
3320///
3321/// This type is not used in any activity, and only used as *part* of another schema.
3322///
3323#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3324#[serde_with::serde_as]
3325#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3326pub struct EnvironmentTargetingOptionDetails {
3327    /// Output only. The serving environment.
3328    pub environment: Option<String>,
3329}
3330
3331impl common::Part for EnvironmentTargetingOptionDetails {}
3332
3333/// Details for assigned exchange targeting option. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_EXCHANGE`.
3334///
3335/// This type is not used in any activity, and only used as *part* of another schema.
3336///
3337#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3338#[serde_with::serde_as]
3339#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3340pub struct ExchangeAssignedTargetingOptionDetails {
3341    /// Required. The targeting_option_id of a TargetingOption of type `TARGETING_TYPE_EXCHANGE`.
3342    #[serde(rename = "targetingOptionId")]
3343    pub targeting_option_id: Option<String>,
3344}
3345
3346impl common::Part for ExchangeAssignedTargetingOptionDetails {}
3347
3348/// Settings that control which exchanges are enabled for a partner.
3349///
3350/// This type is not used in any activity, and only used as *part* of another schema.
3351///
3352#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3353#[serde_with::serde_as]
3354#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3355pub struct ExchangeConfig {
3356    /// All enabled exchanges in the partner. Duplicate enabled exchanges will be ignored.
3357    #[serde(rename = "enabledExchanges")]
3358    pub enabled_exchanges: Option<Vec<ExchangeConfigEnabledExchange>>,
3359}
3360
3361impl common::Part for ExchangeConfig {}
3362
3363/// An enabled exchange in the partner.
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 ExchangeConfigEnabledExchange {
3371    /// The enabled exchange.
3372    pub exchange: Option<String>,
3373    /// Output only. Agency ID of Google Ad Manager. The field is only relevant when Google Ad Manager is the enabled exchange.
3374    #[serde(rename = "googleAdManagerAgencyId")]
3375    pub google_ad_manager_agency_id: Option<String>,
3376    /// Output only. Network ID of Google Ad Manager. The field is only relevant when Google Ad Manager is the enabled exchange.
3377    #[serde(rename = "googleAdManagerBuyerNetworkId")]
3378    pub google_ad_manager_buyer_network_id: Option<String>,
3379    /// Output only. Seat ID of the enabled exchange.
3380    #[serde(rename = "seatId")]
3381    pub seat_id: Option<String>,
3382}
3383
3384impl common::Part for ExchangeConfigEnabledExchange {}
3385
3386/// Exchange review status for the creative.
3387///
3388/// This type is not used in any activity, and only used as *part* of another schema.
3389///
3390#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3391#[serde_with::serde_as]
3392#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3393pub struct ExchangeReviewStatus {
3394    /// The exchange reviewing the creative.
3395    pub exchange: Option<String>,
3396    /// Status of the exchange review.
3397    pub status: Option<String>,
3398}
3399
3400impl common::Part for ExchangeReviewStatus {}
3401
3402/// Represents a targetable exchange. This will be populated in the exchange_details field of a TargetingOption when targeting_type is `TARGETING_TYPE_EXCHANGE`.
3403///
3404/// This type is not used in any activity, and only used as *part* of another schema.
3405///
3406#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3407#[serde_with::serde_as]
3408#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3409pub struct ExchangeTargetingOptionDetails {
3410    /// Output only. The type of exchange.
3411    pub exchange: Option<String>,
3412}
3413
3414impl common::Part for ExchangeTargetingOptionDetails {}
3415
3416/// Exit event of the creative.
3417///
3418/// This type is not used in any activity, and only used as *part* of another schema.
3419///
3420#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3421#[serde_with::serde_as]
3422#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3423pub struct ExitEvent {
3424    /// The name of the click tag of the exit event. The name must be unique within one creative. Leave it empty or unset for creatives containing image assets only.
3425    pub name: Option<String>,
3426    /// The name used to identify this event in reports. Leave it empty or unset for creatives containing image assets only.
3427    #[serde(rename = "reportingName")]
3428    pub reporting_name: Option<String>,
3429    /// Required. The type of the exit event.
3430    #[serde(rename = "type")]
3431    pub type_: Option<String>,
3432    /// Required. The click through URL of the exit event. This is required when type is: * `EXIT_EVENT_TYPE_DEFAULT` * `EXIT_EVENT_TYPE_BACKUP`
3433    pub url: Option<String>,
3434}
3435
3436impl common::Part for ExitEvent {}
3437
3438/// Describes a first or third party audience list used for targeting. First party audiences are created via usage of client data. Third party audiences are provided by Third Party data providers and can only be licensed to customers.
3439///
3440/// # Activities
3441///
3442/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3443/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3444///
3445/// * [create first and third party audiences](FirstAndThirdPartyAudienceCreateCall) (request|response)
3446/// * [edit customer match members first and third party audiences](FirstAndThirdPartyAudienceEditCustomerMatchMemberCall) (none)
3447/// * [get first and third party audiences](FirstAndThirdPartyAudienceGetCall) (response)
3448/// * [list first and third party audiences](FirstAndThirdPartyAudienceListCall) (none)
3449/// * [patch first and third party audiences](FirstAndThirdPartyAudiencePatchCall) (request|response)
3450#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3451#[serde_with::serde_as]
3452#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3453pub struct FirstAndThirdPartyAudience {
3454    /// Output only. The estimated audience size for the Display network in the past month. If the size is less than 1000, the number will be hidden and 0 will be returned due to privacy reasons. Otherwise, the number will be rounded off to two significant digits. Only returned in GET request.
3455    #[serde(rename = "activeDisplayAudienceSize")]
3456    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3457    pub active_display_audience_size: Option<i64>,
3458    /// The app_id matches with the type of the mobile_device_ids being uploaded. Only applicable to audience_type `CUSTOMER_MATCH_DEVICE_ID`
3459    #[serde(rename = "appId")]
3460    pub app_id: Option<String>,
3461    /// Output only. The source of the audience.
3462    #[serde(rename = "audienceSource")]
3463    pub audience_source: Option<String>,
3464    /// The type of the audience.
3465    #[serde(rename = "audienceType")]
3466    pub audience_type: Option<String>,
3467    /// Input only. A list of contact information to define the initial audience members. Only applicable to audience_type `CUSTOMER_MATCH_CONTACT_INFO`
3468    #[serde(rename = "contactInfoList")]
3469    pub contact_info_list: Option<ContactInfoList>,
3470    /// The user-provided description of the audience. Only applicable to first party audiences.
3471    pub description: Option<String>,
3472    /// Output only. The estimated audience size for the Display network. If the size is less than 1000, the number will be hidden and 0 will be returned due to privacy reasons. Otherwise, the number will be rounded off to two significant digits. Only returned in GET request.
3473    #[serde(rename = "displayAudienceSize")]
3474    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3475    pub display_audience_size: Option<i64>,
3476    /// Output only. The estimated desktop audience size in Display network. If the size is less than 1000, the number will be hidden and 0 will be returned due to privacy reasons. Otherwise, the number will be rounded off to two significant digits. Only applicable to first party audiences. Only returned in GET request.
3477    #[serde(rename = "displayDesktopAudienceSize")]
3478    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3479    pub display_desktop_audience_size: Option<i64>,
3480    /// Output only. The estimated mobile app audience size in Display network. If the size is less than 1000, the number will be hidden and 0 will be returned due to privacy reasons. Otherwise, the number will be rounded off to two significant digits. Only applicable to first party audiences. Only returned in GET request.
3481    #[serde(rename = "displayMobileAppAudienceSize")]
3482    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3483    pub display_mobile_app_audience_size: Option<i64>,
3484    /// Output only. The estimated mobile web audience size in Display network. If the size is less than 1000, the number will be hidden and 0 will be returned due to privacy reasons. Otherwise, the number will be rounded off to two significant digits. Only applicable to first party audiences. Only returned in GET request.
3485    #[serde(rename = "displayMobileWebAudienceSize")]
3486    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3487    pub display_mobile_web_audience_size: Option<i64>,
3488    /// The display name of the first and third party audience.
3489    #[serde(rename = "displayName")]
3490    pub display_name: Option<String>,
3491    /// Output only. The unique ID of the first and third party audience. Assigned by the system.
3492    #[serde(rename = "firstAndThirdPartyAudienceId")]
3493    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3494    pub first_and_third_party_audience_id: Option<i64>,
3495    /// Whether the audience is a first or third party audience.
3496    #[serde(rename = "firstAndThirdPartyAudienceType")]
3497    pub first_and_third_party_audience_type: Option<String>,
3498    /// Output only. The estimated audience size for Gmail network. If the size is less than 1000, the number will be hidden and 0 will be returned due to privacy reasons. Otherwise, the number will be rounded off to two significant digits. Only applicable to first party audiences. Only returned in GET request.
3499    #[serde(rename = "gmailAudienceSize")]
3500    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3501    pub gmail_audience_size: Option<i64>,
3502    /// The duration in days that an entry remains in the audience after the qualifying event. If the audience has no expiration, set the value of this field to 10000. Otherwise, the set value must be greater than 0 and less than or equal to 540. Only applicable to first party audiences. This field is required if one of the following audience_type is used: * `CUSTOMER_MATCH_CONTACT_INFO` * `CUSTOMER_MATCH_DEVICE_ID`
3503    #[serde(rename = "membershipDurationDays")]
3504    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3505    pub membership_duration_days: Option<i64>,
3506    /// Input only. A list of mobile device IDs to define the initial audience members. Only applicable to audience_type `CUSTOMER_MATCH_DEVICE_ID`
3507    #[serde(rename = "mobileDeviceIdList")]
3508    pub mobile_device_id_list: Option<MobileDeviceIdList>,
3509    /// Output only. The resource name of the first and third party audience.
3510    pub name: Option<String>,
3511    /// Output only. The estimated audience size for YouTube network. If the size is less than 1000, the number will be hidden and 0 will be returned due to privacy reasons. Otherwise, the number will be rounded off to two significant digits. Only applicable to first party audiences. Only returned in GET request.
3512    #[serde(rename = "youtubeAudienceSize")]
3513    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3514    pub youtube_audience_size: Option<i64>,
3515}
3516
3517impl common::RequestValue for FirstAndThirdPartyAudience {}
3518impl common::Resource for FirstAndThirdPartyAudience {}
3519impl common::ResponseResult for FirstAndThirdPartyAudience {}
3520
3521/// Details of first and third party audience group. All first and third party audience targeting settings are logically ‘OR’ of each other.
3522///
3523/// This type is not used in any activity, and only used as *part* of another schema.
3524///
3525#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3526#[serde_with::serde_as]
3527#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3528pub struct FirstAndThirdPartyAudienceGroup {
3529    /// Required. All first and third party audience targeting settings in first and third party audience group. Repeated settings with same id are not allowed.
3530    pub settings: Option<Vec<FirstAndThirdPartyAudienceTargetingSetting>>,
3531}
3532
3533impl common::Part for FirstAndThirdPartyAudienceGroup {}
3534
3535/// Details of first and third party audience targeting setting.
3536///
3537/// This type is not used in any activity, and only used as *part* of another schema.
3538///
3539#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3540#[serde_with::serde_as]
3541#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3542pub struct FirstAndThirdPartyAudienceTargetingSetting {
3543    /// Required. First and third party audience id of the first and third party audience targeting setting. This id is first_and_third_party_audience_id.
3544    #[serde(rename = "firstAndThirdPartyAudienceId")]
3545    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3546    pub first_and_third_party_audience_id: Option<i64>,
3547    /// The recency of the first and third party audience targeting setting. Only applicable to first party audiences, otherwise will be ignored. For more info, refer to https://support.google.com/displayvideo/answer/2949947#recency When unspecified, no recency limit will be used.
3548    pub recency: Option<String>,
3549}
3550
3551impl common::Part for FirstAndThirdPartyAudienceTargetingSetting {}
3552
3553/// A strategy that uses a fixed bidding price.
3554///
3555/// This type is not used in any activity, and only used as *part* of another schema.
3556///
3557#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3558#[serde_with::serde_as]
3559#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3560pub struct FixedBidStrategy {
3561    /// The fixed bid amount, in micros of the advertiser's currency. For insertion order entity, bid_amount_micros should be set as 0. For line item entity, bid_amount_micros must be greater than or equal to billable unit of the given currency and smaller than or equal to the upper limit 1000000000. For example, 1500000 represents 1.5 standard units of the currency.
3562    #[serde(rename = "bidAmountMicros")]
3563    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3564    pub bid_amount_micros: Option<i64>,
3565}
3566
3567impl common::Part for FixedBidStrategy {}
3568
3569/// A single Floodlight group.
3570///
3571/// # Activities
3572///
3573/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3574/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3575///
3576/// * [get floodlight groups](FloodlightGroupGetCall) (response)
3577/// * [patch floodlight groups](FloodlightGroupPatchCall) (request|response)
3578#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3579#[serde_with::serde_as]
3580#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3581pub struct FloodlightGroup {
3582    /// The Active View video viewability metric configuration for the Floodlight group.
3583    #[serde(rename = "activeViewConfig")]
3584    pub active_view_config: Option<ActiveViewVideoViewabilityMetricConfig>,
3585    /// User-defined custom variables owned by the Floodlight group. Use custom Floodlight variables to create reporting data that is tailored to your unique business needs. Custom Floodlight variables use the keys `U1=`, `U2=`, and so on, and can take any values that you choose to pass to them. You can use them to track virtually any type of data that you collect about your customers, such as the genre of movie that a customer purchases, the country to which the item is shipped, and so on. Custom Floodlight variables may not be used to pass any data that could be used or recognized as personally identifiable information (PII). Example: `custom_variables { fields { "U1": value { number_value: 123.4 }, "U2": value { string_value: "MyVariable2" }, "U3": value { string_value: "MyVariable3" } } }` Acceptable values for keys are "U1" through "U100", inclusive. String values must be less than 64 characters long, and cannot contain the following characters: `"<>`.
3586    #[serde(rename = "customVariables")]
3587    pub custom_variables: Option<HashMap<String, serde_json::Value>>,
3588    /// Required. The display name of the Floodlight group.
3589    #[serde(rename = "displayName")]
3590    pub display_name: Option<String>,
3591    /// Output only. The unique ID of the Floodlight group. Assigned by the system.
3592    #[serde(rename = "floodlightGroupId")]
3593    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3594    pub floodlight_group_id: Option<i64>,
3595    /// Required. The lookback window for the Floodlight group. Both click_days and impression_days are required. Acceptable values for both are `0` to `90`, inclusive.
3596    #[serde(rename = "lookbackWindow")]
3597    pub lookback_window: Option<LookbackWindow>,
3598    /// Output only. The resource name of the Floodlight group.
3599    pub name: Option<String>,
3600    /// Required. The web tag type enabled for the Floodlight group.
3601    #[serde(rename = "webTagType")]
3602    pub web_tag_type: Option<String>,
3603}
3604
3605impl common::RequestValue for FloodlightGroup {}
3606impl common::Resource for FloodlightGroup {}
3607impl common::ResponseResult for FloodlightGroup {}
3608
3609/// Settings that control the number of times a user may be shown with the same ad during a given time period.
3610///
3611/// This type is not used in any activity, and only used as *part* of another schema.
3612///
3613#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3614#[serde_with::serde_as]
3615#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3616pub struct FrequencyCap {
3617    /// The maximum number of times a user may be shown the same ad during this period. Must be greater than 0. Required when unlimited is `false` and max_views is not set.
3618    #[serde(rename = "maxImpressions")]
3619    pub max_impressions: Option<i32>,
3620    /// The time unit in which the frequency cap will be applied. Required when unlimited is `false`.
3621    #[serde(rename = "timeUnit")]
3622    pub time_unit: Option<String>,
3623    /// The number of time_unit the frequency cap will last. Required when unlimited is `false`. The following restrictions apply based on the value of time_unit: * `TIME_UNIT_LIFETIME` - this field is output only and will default to 1 * `TIME_UNIT_MONTHS` - must be between 1 and 2 * `TIME_UNIT_WEEKS` - must be between 1 and 4 * `TIME_UNIT_DAYS` - must be between 1 and 6 * `TIME_UNIT_HOURS` - must be between 1 and 23 * `TIME_UNIT_MINUTES` - must be between 1 and 59
3624    #[serde(rename = "timeUnitCount")]
3625    pub time_unit_count: Option<i32>,
3626    /// Whether unlimited frequency capping is applied. When this field is set to `true`, the remaining frequency cap fields are not applicable.
3627    pub unlimited: Option<bool>,
3628}
3629
3630impl common::Part for FrequencyCap {}
3631
3632/// Details for assigned gender targeting option. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_GENDER`.
3633///
3634/// This type is not used in any activity, and only used as *part* of another schema.
3635///
3636#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3637#[serde_with::serde_as]
3638#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3639pub struct GenderAssignedTargetingOptionDetails {
3640    /// Required. The gender of the audience.
3641    pub gender: Option<String>,
3642    /// Required. The targeting_option_id of a TargetingOption of type `TARGETING_TYPE_GENDER`.
3643    #[serde(rename = "targetingOptionId")]
3644    pub targeting_option_id: Option<String>,
3645}
3646
3647impl common::Part for GenderAssignedTargetingOptionDetails {}
3648
3649/// Represents a targetable gender. This will be populated in the gender_details field of a TargetingOption when targeting_type is `TARGETING_TYPE_GENDER`.
3650///
3651/// This type is not used in any activity, and only used as *part* of another schema.
3652///
3653#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3654#[serde_with::serde_as]
3655#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3656pub struct GenderTargetingOptionDetails {
3657    /// Output only. The gender of an audience.
3658    pub gender: Option<String>,
3659}
3660
3661impl common::Part for GenderTargetingOptionDetails {}
3662
3663/// Request message for LineItemService.GenerateDefaultLineItem.
3664///
3665/// # Activities
3666///
3667/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3668/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3669///
3670/// * [line items generate default advertisers](AdvertiserLineItemGenerateDefaultCall) (request)
3671#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3672#[serde_with::serde_as]
3673#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3674pub struct GenerateDefaultLineItemRequest {
3675    /// Required. The display name of the line item. Must be UTF-8 encoded with a maximum size of 240 bytes.
3676    #[serde(rename = "displayName")]
3677    pub display_name: Option<String>,
3678    /// Required. The unique ID of the insertion order that the line item belongs to.
3679    #[serde(rename = "insertionOrderId")]
3680    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3681    pub insertion_order_id: Option<i64>,
3682    /// Required. The type of the line item.
3683    #[serde(rename = "lineItemType")]
3684    pub line_item_type: Option<String>,
3685    /// The mobile app promoted by the line item. This is applicable only when line_item_type is either `LINE_ITEM_TYPE_DISPLAY_MOBILE_APP_INSTALL` or `LINE_ITEM_TYPE_VIDEO_MOBILE_APP_INSTALL`.
3686    #[serde(rename = "mobileApp")]
3687    pub mobile_app: Option<MobileApp>,
3688}
3689
3690impl common::RequestValue for GenerateDefaultLineItemRequest {}
3691
3692/// Details for assigned geographic region targeting option. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_GEO_REGION`.
3693///
3694/// This type is not used in any activity, and only used as *part* of another schema.
3695///
3696#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3697#[serde_with::serde_as]
3698#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3699pub struct GeoRegionAssignedTargetingOptionDetails {
3700    /// Output only. The display name of the geographic region (e.g., "Ontario, Canada").
3701    #[serde(rename = "displayName")]
3702    pub display_name: Option<String>,
3703    /// Output only. The type of geographic region targeting.
3704    #[serde(rename = "geoRegionType")]
3705    pub geo_region_type: Option<String>,
3706    /// Indicates if this option is being negatively targeted.
3707    pub negative: Option<bool>,
3708    /// Required. The targeting_option_id of a TargetingOption of type `TARGETING_TYPE_GEO_REGION`.
3709    #[serde(rename = "targetingOptionId")]
3710    pub targeting_option_id: Option<String>,
3711}
3712
3713impl common::Part for GeoRegionAssignedTargetingOptionDetails {}
3714
3715/// Search terms for geo region targeting options.
3716///
3717/// This type is not used in any activity, and only used as *part* of another schema.
3718///
3719#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3720#[serde_with::serde_as]
3721#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3722pub struct GeoRegionSearchTerms {
3723    /// The search query for the desired geo region. The query can be a prefix, e.g. "New Yor", "Seattle", "USA", etc.
3724    #[serde(rename = "geoRegionQuery")]
3725    pub geo_region_query: Option<String>,
3726}
3727
3728impl common::Part for GeoRegionSearchTerms {}
3729
3730/// Represents a targetable geographic region. This will be populated in the geo_region_details field when targeting_type is `TARGETING_TYPE_GEO_REGION`.
3731///
3732/// This type is not used in any activity, and only used as *part* of another schema.
3733///
3734#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3735#[serde_with::serde_as]
3736#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3737pub struct GeoRegionTargetingOptionDetails {
3738    /// Output only. The display name of the geographic region (e.g., "Ontario, Canada").
3739    #[serde(rename = "displayName")]
3740    pub display_name: Option<String>,
3741    /// Output only. The type of geographic region targeting.
3742    #[serde(rename = "geoRegionType")]
3743    pub geo_region_type: Option<String>,
3744}
3745
3746impl common::Part for GeoRegionTargetingOptionDetails {}
3747
3748/// Describes a Google audience resource. Includes Google audience lists.
3749///
3750/// # Activities
3751///
3752/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3753/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3754///
3755/// * [get google audiences](GoogleAudienceGetCall) (response)
3756/// * [list google audiences](GoogleAudienceListCall) (none)
3757#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3758#[serde_with::serde_as]
3759#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3760pub struct GoogleAudience {
3761    /// Output only. The display name of the Google audience. .
3762    #[serde(rename = "displayName")]
3763    pub display_name: Option<String>,
3764    /// Output only. The unique ID of the Google audience. Assigned by the system.
3765    #[serde(rename = "googleAudienceId")]
3766    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3767    pub google_audience_id: Option<i64>,
3768    /// Output only. The type of Google audience. .
3769    #[serde(rename = "googleAudienceType")]
3770    pub google_audience_type: Option<String>,
3771    /// Output only. The resource name of the google audience.
3772    pub name: Option<String>,
3773}
3774
3775impl common::Resource for GoogleAudience {}
3776impl common::ResponseResult for GoogleAudience {}
3777
3778/// Details of Google audience group. All Google audience targeting settings are logically ‘OR’ of each other.
3779///
3780/// This type is not used in any activity, and only used as *part* of another schema.
3781///
3782#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3783#[serde_with::serde_as]
3784#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3785pub struct GoogleAudienceGroup {
3786    /// Required. All Google audience targeting settings in Google audience group. Repeated settings with same id will be ignored.
3787    pub settings: Option<Vec<GoogleAudienceTargetingSetting>>,
3788}
3789
3790impl common::Part for GoogleAudienceGroup {}
3791
3792/// Details of Google audience targeting setting.
3793///
3794/// This type is not used in any activity, and only used as *part* of another schema.
3795///
3796#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3797#[serde_with::serde_as]
3798#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3799pub struct GoogleAudienceTargetingSetting {
3800    /// Required. Google audience id of the Google audience targeting setting. This id is google_audience_id.
3801    #[serde(rename = "googleAudienceId")]
3802    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3803    pub google_audience_id: Option<i64>,
3804}
3805
3806impl common::Part for GoogleAudienceTargetingSetting {}
3807
3808/// Media resource.
3809///
3810/// # Activities
3811///
3812/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3813/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3814///
3815/// * [download media](MediaDownloadCall) (response)
3816/// * [upload media](MediaUploadCall) (request|response)
3817#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3818#[serde_with::serde_as]
3819#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3820pub struct GoogleBytestreamMedia {
3821    /// Name of the media resource.
3822    #[serde(rename = "resourceName")]
3823    pub resource_name: Option<String>,
3824}
3825
3826impl common::RequestValue for GoogleBytestreamMedia {}
3827impl common::ResponseResult for GoogleBytestreamMedia {}
3828
3829/// A guaranteed order. Guaranteed orders are parent entity of guaranteed inventory sources. When creating a guaranteed inventory source, a guaranteed order ID must be assigned to the inventory source.
3830///
3831/// # Activities
3832///
3833/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3834/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3835///
3836/// * [create guaranteed orders](GuaranteedOrderCreateCall) (request|response)
3837/// * [edit guaranteed order read accessors guaranteed orders](GuaranteedOrderEditGuaranteedOrderReadAccessorCall) (none)
3838/// * [get guaranteed orders](GuaranteedOrderGetCall) (response)
3839/// * [list guaranteed orders](GuaranteedOrderListCall) (none)
3840/// * [patch guaranteed orders](GuaranteedOrderPatchCall) (request|response)
3841#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3842#[serde_with::serde_as]
3843#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3844pub struct GuaranteedOrder {
3845    /// Output only. The ID of default advertiser of the guaranteed order. The default advertiser is either the read_write_advertiser_id or, if that is not set, the first advertiser listed in read_advertiser_ids. Otherwise, there is no default advertiser.
3846    #[serde(rename = "defaultAdvertiserId")]
3847    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3848    pub default_advertiser_id: Option<i64>,
3849    /// The ID of the default campaign that is assigned to the guaranteed order. The default campaign must belong to the default advertiser.
3850    #[serde(rename = "defaultCampaignId")]
3851    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3852    pub default_campaign_id: Option<i64>,
3853    /// Required. The display name of the guaranteed order. Must be UTF-8 encoded with a maximum size of 240 bytes.
3854    #[serde(rename = "displayName")]
3855    pub display_name: Option<String>,
3856    /// Required. Immutable. The exchange where the guaranteed order originated.
3857    pub exchange: Option<String>,
3858    /// Output only. The unique identifier of the guaranteed order. The guaranteed order IDs have the format `{exchange}-{legacy_guaranteed_order_id}`.
3859    #[serde(rename = "guaranteedOrderId")]
3860    pub guaranteed_order_id: Option<String>,
3861    /// Output only. The legacy ID of the guaranteed order. Assigned by the original exchange. The legacy ID is unique within one exchange, but is not guaranteed to be unique across all guaranteed orders. This ID is used in SDF and UI.
3862    #[serde(rename = "legacyGuaranteedOrderId")]
3863    pub legacy_guaranteed_order_id: Option<String>,
3864    /// Output only. The resource name of the guaranteed order.
3865    pub name: Option<String>,
3866    /// Required. The publisher name of the guaranteed order. Must be UTF-8 encoded with a maximum size of 240 bytes.
3867    #[serde(rename = "publisherName")]
3868    pub publisher_name: Option<String>,
3869    /// Whether all advertisers of read_write_partner_id have read access to the guaranteed order. Only applicable if read_write_partner_id is set. If True, overrides read_advertiser_ids.
3870    #[serde(rename = "readAccessInherited")]
3871    pub read_access_inherited: Option<bool>,
3872    /// The IDs of advertisers with read access to the guaranteed order. This field must not include the advertiser assigned to read_write_advertiser_id if it is set. All advertisers in this field must belong to read_write_partner_id or the same partner as read_write_advertiser_id.
3873    #[serde(rename = "readAdvertiserIds")]
3874    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
3875    pub read_advertiser_ids: Option<Vec<i64>>,
3876    /// The advertiser with read/write access to the guaranteed order. This is also the default advertiser of the guaranteed order.
3877    #[serde(rename = "readWriteAdvertiserId")]
3878    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3879    pub read_write_advertiser_id: Option<i64>,
3880    /// The partner with read/write access to the guaranteed order.
3881    #[serde(rename = "readWritePartnerId")]
3882    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3883    pub read_write_partner_id: Option<i64>,
3884    /// The status settings of the guaranteed order.
3885    pub status: Option<GuaranteedOrderStatus>,
3886    /// Output only. The timestamp when the guaranteed order was last updated. Assigned by the system.
3887    #[serde(rename = "updateTime")]
3888    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3889}
3890
3891impl common::RequestValue for GuaranteedOrder {}
3892impl common::Resource for GuaranteedOrder {}
3893impl common::ResponseResult for GuaranteedOrder {}
3894
3895/// The status settings of the guaranteed order.
3896///
3897/// This type is not used in any activity, and only used as *part* of another schema.
3898///
3899#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3900#[serde_with::serde_as]
3901#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3902pub struct GuaranteedOrderStatus {
3903    /// Output only. The configuration status of the guaranteed order. Acceptable values are `PENDING` and `COMPLETED`. A guaranteed order must be configured (fill in the required fields, choose creatives, and select a default campaign) before it can serve. Currently the configuration action can only be performed via UI.
3904    #[serde(rename = "configStatus")]
3905    pub config_status: Option<String>,
3906    /// The user-provided reason for pausing this guaranteed order. Must be UTF-8 encoded with a maximum length of 100 bytes. Only applicable when entity_status is set to `ENTITY_STATUS_PAUSED`.
3907    #[serde(rename = "entityPauseReason")]
3908    pub entity_pause_reason: Option<String>,
3909    /// Whether or not the guaranteed order is servable. Acceptable values are `ENTITY_STATUS_ACTIVE`, `ENTITY_STATUS_ARCHIVED`, and `ENTITY_STATUS_PAUSED`. Default value is `ENTITY_STATUS_ACTIVE`.
3910    #[serde(rename = "entityStatus")]
3911    pub entity_status: Option<String>,
3912}
3913
3914impl common::Part for GuaranteedOrderStatus {}
3915
3916/// Details for assigned household income targeting option. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_HOUSEHOLD_INCOME`.
3917///
3918/// This type is not used in any activity, and only used as *part* of another schema.
3919///
3920#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3921#[serde_with::serde_as]
3922#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3923pub struct HouseholdIncomeAssignedTargetingOptionDetails {
3924    /// Required. The household income of the audience.
3925    #[serde(rename = "householdIncome")]
3926    pub household_income: Option<String>,
3927    /// Required. The targeting_option_id of a TargetingOption of type `TARGETING_TYPE_HOUSEHOLD_INCOME`.
3928    #[serde(rename = "targetingOptionId")]
3929    pub targeting_option_id: Option<String>,
3930}
3931
3932impl common::Part for HouseholdIncomeAssignedTargetingOptionDetails {}
3933
3934/// Represents a targetable household income. This will be populated in the household_income_details field of a TargetingOption when targeting_type is `TARGETING_TYPE_HOUSEHOLD_INCOME`.
3935///
3936/// This type is not used in any activity, and only used as *part* of another schema.
3937///
3938#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3939#[serde_with::serde_as]
3940#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3941pub struct HouseholdIncomeTargetingOptionDetails {
3942    /// Output only. The household income of an audience.
3943    #[serde(rename = "householdIncome")]
3944    pub household_income: Option<String>,
3945}
3946
3947impl common::Part for HouseholdIncomeTargetingOptionDetails {}
3948
3949/// A filtering option that filters entities by their entity IDs.
3950///
3951/// This type is not used in any activity, and only used as *part* of another schema.
3952///
3953#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3954#[serde_with::serde_as]
3955#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3956pub struct IdFilter {
3957    /// YouTube Ads to download by ID. All IDs must belong to the same Advertiser or Partner specified in CreateSdfDownloadTaskRequest.
3958    #[serde(rename = "adGroupAdIds")]
3959    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
3960    pub ad_group_ad_ids: Option<Vec<i64>>,
3961    /// YouTube Ad Groups to download by ID. All IDs must belong to the same Advertiser or Partner specified in CreateSdfDownloadTaskRequest.
3962    #[serde(rename = "adGroupIds")]
3963    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
3964    pub ad_group_ids: Option<Vec<i64>>,
3965    /// Campaigns to download by ID. All IDs must belong to the same Advertiser or Partner specified in CreateSdfDownloadTaskRequest.
3966    #[serde(rename = "campaignIds")]
3967    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
3968    pub campaign_ids: Option<Vec<i64>>,
3969    /// Insertion Orders to download by ID. All IDs must belong to the same Advertiser or Partner specified in CreateSdfDownloadTaskRequest.
3970    #[serde(rename = "insertionOrderIds")]
3971    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
3972    pub insertion_order_ids: Option<Vec<i64>>,
3973    /// Line Items to download by ID. All IDs must belong to the same Advertiser or Partner specified in CreateSdfDownloadTaskRequest.
3974    #[serde(rename = "lineItemIds")]
3975    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
3976    pub line_item_ids: Option<Vec<i64>>,
3977    /// Media Products to download by ID. All IDs must belong to the same Advertiser or Partner specified in CreateSdfDownloadTaskRequest.
3978    #[serde(rename = "mediaProductIds")]
3979    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
3980    pub media_product_ids: Option<Vec<i64>>,
3981}
3982
3983impl common::Part for IdFilter {}
3984
3985/// A single insertion order.
3986///
3987/// # Activities
3988///
3989/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3990/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3991///
3992/// * [insertion orders create advertisers](AdvertiserInsertionOrderCreateCall) (request|response)
3993/// * [insertion orders get advertisers](AdvertiserInsertionOrderGetCall) (response)
3994/// * [insertion orders patch advertisers](AdvertiserInsertionOrderPatchCall) (request|response)
3995#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3996#[serde_with::serde_as]
3997#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3998pub struct InsertionOrder {
3999    /// Output only. The unique ID of the advertiser the insertion order belongs to.
4000    #[serde(rename = "advertiserId")]
4001    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4002    pub advertiser_id: Option<i64>,
4003    /// The bidding strategy of the insertion order. By default, fixed_bid is set.
4004    #[serde(rename = "bidStrategy")]
4005    pub bid_strategy: Option<BiddingStrategy>,
4006    /// Immutable. The billable outcome of the insertion order. Outcome based buying is deprecated. `BILLABLE_OUTCOME_PAY_PER_IMPRESSION` is the only valid value.
4007    #[serde(rename = "billableOutcome")]
4008    pub billable_outcome: Option<String>,
4009    /// Required. The budget allocation settings of the insertion order.
4010    pub budget: Option<InsertionOrderBudget>,
4011    /// Required. Immutable. The unique ID of the campaign that the insertion order belongs to.
4012    #[serde(rename = "campaignId")]
4013    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4014    pub campaign_id: Option<i64>,
4015    /// Required. The display name of the insertion order. Must be UTF-8 encoded with a maximum size of 240 bytes.
4016    #[serde(rename = "displayName")]
4017    pub display_name: Option<String>,
4018    /// Required. Controls whether or not the insertion order can spend its budget and bid on inventory. * For CreateInsertionOrder method, only `ENTITY_STATUS_DRAFT` is allowed. To activate an insertion order, use UpdateInsertionOrder method and update the status to `ENTITY_STATUS_ACTIVE` after creation. * An insertion order cannot be changed back to `ENTITY_STATUS_DRAFT` status from any other status. * An insertion order cannot be set to `ENTITY_STATUS_ACTIVE` if its parent campaign is not active.
4019    #[serde(rename = "entityStatus")]
4020    pub entity_status: Option<String>,
4021    /// Required. The frequency capping setting of the insertion order.
4022    #[serde(rename = "frequencyCap")]
4023    pub frequency_cap: Option<FrequencyCap>,
4024    /// Output only. The unique ID of the insertion order. Assigned by the system.
4025    #[serde(rename = "insertionOrderId")]
4026    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4027    pub insertion_order_id: Option<i64>,
4028    /// The type of insertion order. If this field is unspecified in creation, the value defaults to `RTB`.
4029    #[serde(rename = "insertionOrderType")]
4030    pub insertion_order_type: Option<String>,
4031    /// Additional integration details of the insertion order.
4032    #[serde(rename = "integrationDetails")]
4033    pub integration_details: Option<IntegrationDetails>,
4034    /// Output only. The resource name of the insertion order.
4035    pub name: Option<String>,
4036    /// Required. The budget spending speed setting of the insertion order.
4037    pub pacing: Option<Pacing>,
4038    /// The partner costs associated with the insertion order. If absent or empty in CreateInsertionOrder method, the newly created insertion order will inherit partner costs from the partner settings.
4039    #[serde(rename = "partnerCosts")]
4040    pub partner_costs: Option<Vec<PartnerCost>>,
4041    /// Required. Performance goal of the insertion order.
4042    #[serde(rename = "performanceGoal")]
4043    pub performance_goal: Option<PerformanceGoal>,
4044    /// Output only. The reservation type of the insertion order.
4045    #[serde(rename = "reservationType")]
4046    pub reservation_type: Option<String>,
4047    /// Output only. The timestamp when the insertion order was last updated. Assigned by the system.
4048    #[serde(rename = "updateTime")]
4049    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
4050}
4051
4052impl common::RequestValue for InsertionOrder {}
4053impl common::ResponseResult for InsertionOrder {}
4054
4055/// Settings that control how insertion order budget is allocated.
4056///
4057/// This type is not used in any activity, and only used as *part* of another schema.
4058///
4059#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4060#[serde_with::serde_as]
4061#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4062pub struct InsertionOrderBudget {
4063    /// The type of automation used to manage bid and budget for the insertion order. If this field is unspecified in creation, the value defaults to `INSERTION_ORDER_AUTOMATION_TYPE_NONE`.
4064    #[serde(rename = "automationType")]
4065    pub automation_type: Option<String>,
4066    /// Required. The list of budget segments. Use a budget segment to specify a specific budget for a given period of time an insertion order is running.
4067    #[serde(rename = "budgetSegments")]
4068    pub budget_segments: Option<Vec<InsertionOrderBudgetSegment>>,
4069    /// Required. Immutable. The budget unit specifies whether the budget is currency based or impression based.
4070    #[serde(rename = "budgetUnit")]
4071    pub budget_unit: Option<String>,
4072}
4073
4074impl common::Part for InsertionOrderBudget {}
4075
4076/// Settings that control the budget of a single budget segment.
4077///
4078/// This type is not used in any activity, and only used as *part* of another schema.
4079///
4080#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4081#[serde_with::serde_as]
4082#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4083pub struct InsertionOrderBudgetSegment {
4084    /// Required. The budget amount the insertion order will spend for the given date_range. The amount is in micros. Must be greater than 0. For example, 500000000 represents 500 standard units of the currency.
4085    #[serde(rename = "budgetAmountMicros")]
4086    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4087    pub budget_amount_micros: Option<i64>,
4088    /// The budget_id of the campaign budget that this insertion order budget segment is a part of.
4089    #[serde(rename = "campaignBudgetId")]
4090    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4091    pub campaign_budget_id: Option<i64>,
4092    /// Required. The start and end date settings of the budget segment. They are resolved relative to the parent advertiser's time zone. * When creating a new budget segment, both `start_date` and `end_date` must be in the future. * An existing budget segment with a `start_date` in the past has a mutable `end_date` but an immutable `start_date`. * `end_date` must be the `start_date` or later, both before the year 2037.
4093    #[serde(rename = "dateRange")]
4094    pub date_range: Option<DateRange>,
4095    /// The budget segment description. It can be used to enter Purchase Order information for each budget segment and have that information printed on the invoices. Must be UTF-8 encoded.
4096    pub description: Option<String>,
4097}
4098
4099impl common::Part for InsertionOrderBudgetSegment {}
4100
4101/// Details of Integral Ad Science settings.
4102///
4103/// This type is not used in any activity, and only used as *part* of another schema.
4104///
4105#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4106#[serde_with::serde_as]
4107#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4108pub struct IntegralAdScience {
4109    /// The custom segment ID provided by Integral Ad Science. The ID must be between `1000001` and `1999999`, inclusive.
4110    #[serde(rename = "customSegmentId")]
4111    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
4112    pub custom_segment_id: Option<Vec<i64>>,
4113    /// Display Viewability section (applicable to display line items only).
4114    #[serde(rename = "displayViewability")]
4115    pub display_viewability: Option<String>,
4116    /// Brand Safety - **Unrateable**.
4117    #[serde(rename = "excludeUnrateable")]
4118    pub exclude_unrateable: Option<bool>,
4119    /// Ad Fraud settings.
4120    #[serde(rename = "excludedAdFraudRisk")]
4121    pub excluded_ad_fraud_risk: Option<String>,
4122    /// Brand Safety - **Adult content**.
4123    #[serde(rename = "excludedAdultRisk")]
4124    pub excluded_adult_risk: Option<String>,
4125    /// Brand Safety - **Alcohol**.
4126    #[serde(rename = "excludedAlcoholRisk")]
4127    pub excluded_alcohol_risk: Option<String>,
4128    /// Brand Safety - **Drugs**.
4129    #[serde(rename = "excludedDrugsRisk")]
4130    pub excluded_drugs_risk: Option<String>,
4131    /// Brand Safety - **Gambling**.
4132    #[serde(rename = "excludedGamblingRisk")]
4133    pub excluded_gambling_risk: Option<String>,
4134    /// Brand Safety - **Hate speech**.
4135    #[serde(rename = "excludedHateSpeechRisk")]
4136    pub excluded_hate_speech_risk: Option<String>,
4137    /// Brand Safety - **Illegal downloads**.
4138    #[serde(rename = "excludedIllegalDownloadsRisk")]
4139    pub excluded_illegal_downloads_risk: Option<String>,
4140    /// Brand Safety - **Offensive language**.
4141    #[serde(rename = "excludedOffensiveLanguageRisk")]
4142    pub excluded_offensive_language_risk: Option<String>,
4143    /// Brand Safety - **Violence**.
4144    #[serde(rename = "excludedViolenceRisk")]
4145    pub excluded_violence_risk: Option<String>,
4146    /// True advertising quality (applicable to Display line items only).
4147    #[serde(rename = "traqScoreOption")]
4148    pub traq_score_option: Option<String>,
4149    /// Video Viewability Section (applicable to video line items only).
4150    #[serde(rename = "videoViewability")]
4151    pub video_viewability: Option<String>,
4152}
4153
4154impl common::Part for IntegralAdScience {}
4155
4156/// Integration details of an entry.
4157///
4158/// This type is not used in any activity, and only used as *part* of another schema.
4159///
4160#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4161#[serde_with::serde_as]
4162#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4163pub struct IntegrationDetails {
4164    /// Additional details of the entry in string format. Must be UTF-8 encoded with a length of no more than 1000 characters.
4165    pub details: Option<String>,
4166    /// An external identifier to be associated with the entry. The integration code will show up together with the entry in many places in the system, for example, reporting. Must be UTF-8 encoded with a length of no more than 500 characters.
4167    #[serde(rename = "integrationCode")]
4168    pub integration_code: Option<String>,
4169}
4170
4171impl common::Part for IntegrationDetails {}
4172
4173/// An inventory source.
4174///
4175/// # Activities
4176///
4177/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4178/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4179///
4180/// * [create inventory sources](InventorySourceCreateCall) (request|response)
4181/// * [edit inventory source read write accessors inventory sources](InventorySourceEditInventorySourceReadWriteAccessorCall) (none)
4182/// * [get inventory sources](InventorySourceGetCall) (response)
4183/// * [list inventory sources](InventorySourceListCall) (none)
4184/// * [patch inventory sources](InventorySourcePatchCall) (request|response)
4185#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4186#[serde_with::serde_as]
4187#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4188pub struct InventorySource {
4189    /// Whether the inventory source has a guaranteed or non-guaranteed delivery.
4190    pub commitment: Option<String>,
4191    /// The creative requirements of the inventory source. Not applicable for auction packages.
4192    #[serde(rename = "creativeConfigs")]
4193    pub creative_configs: Option<Vec<CreativeConfig>>,
4194    /// The ID in the exchange space that uniquely identifies the inventory source. Must be unique across buyers within each exchange but not necessarily unique across exchanges.
4195    #[serde(rename = "dealId")]
4196    pub deal_id: Option<String>,
4197    /// The delivery method of the inventory source. * For non-guaranteed inventory sources, the only acceptable value is `INVENTORY_SOURCE_DELIVERY_METHOD_PROGRAMMATIC`. * For guaranteed inventory sources, acceptable values are `INVENTORY_SOURCE_DELIVERY_METHOD_TAG` and `INVENTORY_SOURCE_DELIVERY_METHOD_PROGRAMMATIC`.
4198    #[serde(rename = "deliveryMethod")]
4199    pub delivery_method: Option<String>,
4200    /// The display name of the inventory source. Must be UTF-8 encoded with a maximum size of 240 bytes.
4201    #[serde(rename = "displayName")]
4202    pub display_name: Option<String>,
4203    /// The exchange to which the inventory source belongs.
4204    pub exchange: Option<String>,
4205    /// Immutable. The ID of the guaranteed order that this inventory source belongs to. Only applicable when commitment is `INVENTORY_SOURCE_COMMITMENT_GUARANTEED`.
4206    #[serde(rename = "guaranteedOrderId")]
4207    pub guaranteed_order_id: Option<String>,
4208    /// Output only. The unique ID of the inventory source. Assigned by the system.
4209    #[serde(rename = "inventorySourceId")]
4210    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4211    pub inventory_source_id: Option<i64>,
4212    /// Output only. The product type of the inventory source, denoting the way through which it sells inventory.
4213    #[serde(rename = "inventorySourceProductType")]
4214    pub inventory_source_product_type: Option<String>,
4215    /// Denotes the type of the inventory source.
4216    #[serde(rename = "inventorySourceType")]
4217    pub inventory_source_type: Option<String>,
4218    /// Output only. The resource name of the inventory source.
4219    pub name: Option<String>,
4220    /// The publisher/seller name of the inventory source.
4221    #[serde(rename = "publisherName")]
4222    pub publisher_name: Option<String>,
4223    /// Required. The rate details of the inventory source.
4224    #[serde(rename = "rateDetails")]
4225    pub rate_details: Option<RateDetails>,
4226    /// Output only. The IDs of advertisers with read-only access to the inventory source.
4227    #[serde(rename = "readAdvertiserIds")]
4228    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
4229    pub read_advertiser_ids: Option<Vec<i64>>,
4230    /// Output only. The IDs of partners with read-only access to the inventory source. All advertisers of partners in this field inherit read-only access to the inventory source.
4231    #[serde(rename = "readPartnerIds")]
4232    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
4233    pub read_partner_ids: Option<Vec<i64>>,
4234    /// The partner or advertisers that have read/write access to the inventory source. Output only when commitment is `INVENTORY_SOURCE_COMMITMENT_GUARANTEED`, in which case the read/write accessors are inherited from the parent guaranteed order. Required when commitment is `INVENTORY_SOURCE_COMMITMENT_NON_GUARANTEED`. If commitment is `INVENTORY_SOURCE_COMMITMENT_NON_GUARANTEED` and a partner is set in this field, all advertisers under this partner will automatically have read-only access to the inventory source. These advertisers will not be included in read_advertiser_ids.
4235    #[serde(rename = "readWriteAccessors")]
4236    pub read_write_accessors: Option<InventorySourceAccessors>,
4237    /// The status settings of the inventory source.
4238    pub status: Option<InventorySourceStatus>,
4239    /// The time range when this inventory source starts and stops serving.
4240    #[serde(rename = "timeRange")]
4241    pub time_range: Option<TimeRange>,
4242    /// Output only. The timestamp when the inventory source was last updated. Assigned by the system.
4243    #[serde(rename = "updateTime")]
4244    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
4245}
4246
4247impl common::RequestValue for InventorySource {}
4248impl common::Resource for InventorySource {}
4249impl common::ResponseResult for InventorySource {}
4250
4251/// The partner or advertisers with access to the inventory source.
4252///
4253/// # Activities
4254///
4255/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4256/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4257///
4258/// * [edit inventory source read write accessors inventory sources](InventorySourceEditInventorySourceReadWriteAccessorCall) (response)
4259#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4260#[serde_with::serde_as]
4261#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4262pub struct InventorySourceAccessors {
4263    /// The advertisers with access to the inventory source. All advertisers must belong to the same partner.
4264    pub advertisers: Option<InventorySourceAccessorsAdvertiserAccessors>,
4265    /// The partner with access to the inventory source.
4266    pub partner: Option<InventorySourceAccessorsPartnerAccessor>,
4267}
4268
4269impl common::ResponseResult for InventorySourceAccessors {}
4270
4271/// The advertisers with access to the inventory source.
4272///
4273/// This type is not used in any activity, and only used as *part* of another schema.
4274///
4275#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4276#[serde_with::serde_as]
4277#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4278pub struct InventorySourceAccessorsAdvertiserAccessors {
4279    /// The IDs of the advertisers.
4280    #[serde(rename = "advertiserIds")]
4281    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
4282    pub advertiser_ids: Option<Vec<i64>>,
4283}
4284
4285impl common::Part for InventorySourceAccessorsAdvertiserAccessors {}
4286
4287/// The partner with access to the inventory source.
4288///
4289/// This type is not used in any activity, and only used as *part* of another schema.
4290///
4291#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4292#[serde_with::serde_as]
4293#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4294pub struct InventorySourceAccessorsPartnerAccessor {
4295    /// The ID of the partner.
4296    #[serde(rename = "partnerId")]
4297    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4298    pub partner_id: Option<i64>,
4299}
4300
4301impl common::Part for InventorySourceAccessorsPartnerAccessor {}
4302
4303/// Targeting details for inventory source. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_INVENTORY_SOURCE`.
4304///
4305/// This type is not used in any activity, and only used as *part* of another schema.
4306///
4307#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4308#[serde_with::serde_as]
4309#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4310pub struct InventorySourceAssignedTargetingOptionDetails {
4311    /// Required. ID of the inventory source. Should refer to the inventory_source_id field of an InventorySource resource.
4312    #[serde(rename = "inventorySourceId")]
4313    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4314    pub inventory_source_id: Option<i64>,
4315}
4316
4317impl common::Part for InventorySourceAssignedTargetingOptionDetails {}
4318
4319/// The configuration for display creatives.
4320///
4321/// This type is not used in any activity, and only used as *part* of another schema.
4322///
4323#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4324#[serde_with::serde_as]
4325#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4326pub struct InventorySourceDisplayCreativeConfig {
4327    /// The size requirements for display creatives that can be assigned to the inventory source.
4328    #[serde(rename = "creativeSize")]
4329    pub creative_size: Option<Dimensions>,
4330}
4331
4332impl common::Part for InventorySourceDisplayCreativeConfig {}
4333
4334/// A filtering option for filtering on Inventory Source entities.
4335///
4336/// This type is not used in any activity, and only used as *part* of another schema.
4337///
4338#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4339#[serde_with::serde_as]
4340#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4341pub struct InventorySourceFilter {
4342    /// Inventory Sources to download by ID. All IDs must belong to the same Advertiser or Partner specified in CreateSdfDownloadTaskRequest. Leave empty to download all Inventory Sources for the selected Advertiser or Partner.
4343    #[serde(rename = "inventorySourceIds")]
4344    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
4345    pub inventory_source_ids: Option<Vec<i64>>,
4346}
4347
4348impl common::Part for InventorySourceFilter {}
4349
4350/// A collection of targetable inventory sources.
4351///
4352/// # Activities
4353///
4354/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4355/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4356///
4357/// * [assigned inventory sources bulk edit inventory source groups](InventorySourceGroupAssignedInventorySourceBulkEditCall) (none)
4358/// * [assigned inventory sources create inventory source groups](InventorySourceGroupAssignedInventorySourceCreateCall) (none)
4359/// * [assigned inventory sources delete inventory source groups](InventorySourceGroupAssignedInventorySourceDeleteCall) (none)
4360/// * [assigned inventory sources list inventory source groups](InventorySourceGroupAssignedInventorySourceListCall) (none)
4361/// * [create inventory source groups](InventorySourceGroupCreateCall) (request|response)
4362/// * [delete inventory source groups](InventorySourceGroupDeleteCall) (none)
4363/// * [get inventory source groups](InventorySourceGroupGetCall) (response)
4364/// * [list inventory source groups](InventorySourceGroupListCall) (none)
4365/// * [patch inventory source groups](InventorySourceGroupPatchCall) (request|response)
4366#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4367#[serde_with::serde_as]
4368#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4369pub struct InventorySourceGroup {
4370    /// Required. The display name of the inventory source group. Must be UTF-8 encoded with a maximum size of 240 bytes.
4371    #[serde(rename = "displayName")]
4372    pub display_name: Option<String>,
4373    /// Output only. The unique ID of the inventory source group. Assigned by the system.
4374    #[serde(rename = "inventorySourceGroupId")]
4375    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4376    pub inventory_source_group_id: Option<i64>,
4377    /// Output only. The resource name of the inventory source group.
4378    pub name: Option<String>,
4379}
4380
4381impl common::RequestValue for InventorySourceGroup {}
4382impl common::Resource for InventorySourceGroup {}
4383impl common::ResponseResult for InventorySourceGroup {}
4384
4385/// Targeting details for inventory source group. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_INVENTORY_SOURCE_GROUP`.
4386///
4387/// This type is not used in any activity, and only used as *part* of another schema.
4388///
4389#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4390#[serde_with::serde_as]
4391#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4392pub struct InventorySourceGroupAssignedTargetingOptionDetails {
4393    /// Required. ID of the inventory source group. Should refer to the inventory_source_group_id field of an InventorySourceGroup resource.
4394    #[serde(rename = "inventorySourceGroupId")]
4395    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4396    pub inventory_source_group_id: Option<i64>,
4397}
4398
4399impl common::Part for InventorySourceGroupAssignedTargetingOptionDetails {}
4400
4401/// The status related settings of the inventory source.
4402///
4403/// This type is not used in any activity, and only used as *part* of another schema.
4404///
4405#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4406#[serde_with::serde_as]
4407#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4408pub struct InventorySourceStatus {
4409    /// Output only. The configuration status of the inventory source. Only applicable for guaranteed inventory sources. Acceptable values are `INVENTORY_SOURCE_CONFIG_STATUS_PENDING` and `INVENTORY_SOURCE_CONFIG_STATUS_COMPLETED`. An inventory source must be configured (fill in the required fields, choose creatives, and select a default campaign) before it can serve.
4410    #[serde(rename = "configStatus")]
4411    pub config_status: Option<String>,
4412    /// The user-provided reason for pausing this inventory source. Must not exceed 100 characters. Only applicable when entity_status is set to `ENTITY_STATUS_PAUSED`.
4413    #[serde(rename = "entityPauseReason")]
4414    pub entity_pause_reason: Option<String>,
4415    /// Whether or not the inventory source is servable. Acceptable values are `ENTITY_STATUS_ACTIVE`, `ENTITY_STATUS_ARCHIVED`, and `ENTITY_STATUS_PAUSED`. Default value is `ENTITY_STATUS_ACTIVE`.
4416    #[serde(rename = "entityStatus")]
4417    pub entity_status: Option<String>,
4418    /// Output only. The seller-provided reason for pausing this inventory source. Only applicable for inventory sources synced directly from the publishers and when seller_status is set to `ENTITY_STATUS_PAUSED`.
4419    #[serde(rename = "sellerPauseReason")]
4420    pub seller_pause_reason: Option<String>,
4421    /// Output only. The status set by the seller for the inventory source. Only applicable for inventory sources synced directly from the publishers. Acceptable values are `ENTITY_STATUS_ACTIVE` and `ENTITY_STATUS_PAUSED`.
4422    #[serde(rename = "sellerStatus")]
4423    pub seller_status: Option<String>,
4424}
4425
4426impl common::Part for InventorySourceStatus {}
4427
4428/// The configuration for video creatives.
4429///
4430/// This type is not used in any activity, and only used as *part* of another schema.
4431///
4432#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4433#[serde_with::serde_as]
4434#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4435pub struct InventorySourceVideoCreativeConfig {
4436    /// The duration requirements for the video creatives that can be assigned to the inventory source.
4437    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
4438    pub duration: Option<chrono::Duration>,
4439}
4440
4441impl common::Part for InventorySourceVideoCreativeConfig {}
4442
4443/// A single invoice.
4444///
4445/// This type is not used in any activity, and only used as *part* of another schema.
4446///
4447#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4448#[serde_with::serde_as]
4449#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4450pub struct Invoice {
4451    /// The budget grouping ID for this invoice. This field will only be set if the invoice level of the corresponding billing profile was set to "Budget invoice grouping ID".
4452    #[serde(rename = "budgetInvoiceGroupingId")]
4453    pub budget_invoice_grouping_id: Option<String>,
4454    /// The list of summarized information for each budget associated with this invoice. This field will only be set if the invoice detail level of the corresponding billing profile was set to "Budget level PO".
4455    #[serde(rename = "budgetSummaries")]
4456    pub budget_summaries: Option<Vec<BudgetSummary>>,
4457    /// The ID of the original invoice being adjusted by this invoice, if applicable. May appear on the invoice PDF as `Reference invoice number`. If replaced_invoice_ids is set, this field will be empty.
4458    #[serde(rename = "correctedInvoiceId")]
4459    pub corrected_invoice_id: Option<String>,
4460    /// The currency used in the invoice in ISO 4217 format.
4461    #[serde(rename = "currencyCode")]
4462    pub currency_code: Option<String>,
4463    /// The display name of the invoice.
4464    #[serde(rename = "displayName")]
4465    pub display_name: Option<String>,
4466    /// The date when the invoice is due.
4467    #[serde(rename = "dueDate")]
4468    pub due_date: Option<Date>,
4469    /// The unique ID of the invoice.
4470    #[serde(rename = "invoiceId")]
4471    pub invoice_id: Option<String>,
4472    /// The type of invoice document.
4473    #[serde(rename = "invoiceType")]
4474    pub invoice_type: Option<String>,
4475    /// The date when the invoice was issued.
4476    #[serde(rename = "issueDate")]
4477    pub issue_date: Option<Date>,
4478    /// The resource name of the invoice.
4479    pub name: Option<String>,
4480    /// The total amount of costs or adjustments not tied to a particular budget, in micros of the invoice's currency. For example, if currency_code is `USD`, then 1000000 represents one US dollar.
4481    #[serde(rename = "nonBudgetMicros")]
4482    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4483    pub non_budget_micros: Option<i64>,
4484    /// The ID of the payments account the invoice belongs to. Appears on the invoice PDF as `Billing Account Number`.
4485    #[serde(rename = "paymentsAccountId")]
4486    pub payments_account_id: Option<String>,
4487    /// The ID of the payments profile the invoice belongs to. Appears on the invoice PDF as `Billing ID`.
4488    #[serde(rename = "paymentsProfileId")]
4489    pub payments_profile_id: Option<String>,
4490    /// The URL to download a PDF copy of the invoice. This URL is user specific and requires a valid OAuth 2.0 access token to access. The access token must be provided in an `Authorization: Bearer` HTTP header and be authorized for one of the following scopes: * `https://www.googleapis.com/auth/display-video-mediaplanning` * `https://www.googleapis.com/auth/display-video` The URL will be valid for 7 days after retrieval of this invoice object or until this invoice is retrieved again.
4491    #[serde(rename = "pdfUrl")]
4492    pub pdf_url: Option<String>,
4493    /// Purchase order number associated with the invoice.
4494    #[serde(rename = "purchaseOrderNumber")]
4495    pub purchase_order_number: Option<String>,
4496    /// The ID(s) of any originally issued invoice that is being cancelled by this invoice, if applicable. Multiple invoices may be listed if those invoices are being consolidated into a single invoice. May appear on invoice PDF as `Replaced invoice numbers`. If corrected_invoice_id is set, this field will be empty.
4497    #[serde(rename = "replacedInvoiceIds")]
4498    pub replaced_invoice_ids: Option<Vec<String>>,
4499    /// The service start and end dates which are covered by this invoice.
4500    #[serde(rename = "serviceDateRange")]
4501    pub service_date_range: Option<DateRange>,
4502    /// The pre-tax subtotal amount, in micros of the invoice's currency. For example, if currency_code is `USD`, then 1000000 represents one US dollar.
4503    #[serde(rename = "subtotalAmountMicros")]
4504    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4505    pub subtotal_amount_micros: Option<i64>,
4506    /// The invoice total amount, in micros of the invoice's currency. For example, if currency_code is `USD`, then 1000000 represents one US dollar.
4507    #[serde(rename = "totalAmountMicros")]
4508    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4509    pub total_amount_micros: Option<i64>,
4510    /// The sum of all taxes in invoice, in micros of the invoice's currency. For example, if currency_code is `USD`, then 1000000 represents one US dollar.
4511    #[serde(rename = "totalTaxAmountMicros")]
4512    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4513    pub total_tax_amount_micros: Option<i64>,
4514}
4515
4516impl common::Part for Invoice {}
4517
4518/// Details for assigned keyword targeting option. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_KEYWORD`.
4519///
4520/// This type is not used in any activity, and only used as *part* of another schema.
4521///
4522#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4523#[serde_with::serde_as]
4524#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4525pub struct KeywordAssignedTargetingOptionDetails {
4526    /// Required. The keyword, for example `car insurance`. Positive keyword cannot be offensive word. Must be UTF-8 encoded with a maximum size of 255 bytes. Maximum number of characters is 80. Maximum number of words is 10.
4527    pub keyword: Option<String>,
4528    /// Indicates if this option is being negatively targeted.
4529    pub negative: Option<bool>,
4530}
4531
4532impl common::Part for KeywordAssignedTargetingOptionDetails {}
4533
4534/// Details for assigned language targeting option. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_LANGUAGE`.
4535///
4536/// This type is not used in any activity, and only used as *part* of another schema.
4537///
4538#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4539#[serde_with::serde_as]
4540#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4541pub struct LanguageAssignedTargetingOptionDetails {
4542    /// Output only. The display name of the language (e.g., "French").
4543    #[serde(rename = "displayName")]
4544    pub display_name: Option<String>,
4545    /// Indicates if this option is being negatively targeted. All assigned language targeting options on the same resource must have the same value for this field.
4546    pub negative: Option<bool>,
4547    /// Required. The targeting_option_id of a TargetingOption of type `TARGETING_TYPE_LANGUAGE`.
4548    #[serde(rename = "targetingOptionId")]
4549    pub targeting_option_id: Option<String>,
4550}
4551
4552impl common::Part for LanguageAssignedTargetingOptionDetails {}
4553
4554/// Represents a targetable language. This will be populated in the language_details field when targeting_type is `TARGETING_TYPE_LANGUAGE`.
4555///
4556/// This type is not used in any activity, and only used as *part* of another schema.
4557///
4558#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4559#[serde_with::serde_as]
4560#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4561pub struct LanguageTargetingOptionDetails {
4562    /// Output only. The display name of the language (e.g., "French").
4563    #[serde(rename = "displayName")]
4564    pub display_name: Option<String>,
4565}
4566
4567impl common::Part for LanguageTargetingOptionDetails {}
4568
4569/// A single line item.
4570///
4571/// # Activities
4572///
4573/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4574/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4575///
4576/// * [line items create advertisers](AdvertiserLineItemCreateCall) (request|response)
4577/// * [line items generate default advertisers](AdvertiserLineItemGenerateDefaultCall) (response)
4578/// * [line items get advertisers](AdvertiserLineItemGetCall) (response)
4579/// * [line items patch advertisers](AdvertiserLineItemPatchCall) (request|response)
4580#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4581#[serde_with::serde_as]
4582#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4583pub struct LineItem {
4584    /// Output only. The unique ID of the advertiser the line item belongs to.
4585    #[serde(rename = "advertiserId")]
4586    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4587    pub advertiser_id: Option<i64>,
4588    /// Required. The bidding strategy of the line item.
4589    #[serde(rename = "bidStrategy")]
4590    pub bid_strategy: Option<BiddingStrategy>,
4591    /// Required. The budget allocation setting of the line item.
4592    pub budget: Option<LineItemBudget>,
4593    /// Output only. The unique ID of the campaign that the line item belongs to.
4594    #[serde(rename = "campaignId")]
4595    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4596    pub campaign_id: Option<i64>,
4597    /// The conversion tracking setting of the line item.
4598    #[serde(rename = "conversionCounting")]
4599    pub conversion_counting: Option<ConversionCountingConfig>,
4600    /// The IDs of the creatives associated with the line item.
4601    #[serde(rename = "creativeIds")]
4602    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
4603    pub creative_ids: Option<Vec<i64>>,
4604    /// Required. The display name of the line item. Must be UTF-8 encoded with a maximum size of 240 bytes.
4605    #[serde(rename = "displayName")]
4606    pub display_name: Option<String>,
4607    /// Required. Controls whether or not the line item can spend its budget and bid on inventory. * For CreateLineItem method, only `ENTITY_STATUS_DRAFT` is allowed. To activate a line item, use UpdateLineItem method and update the status to `ENTITY_STATUS_ACTIVE` after creation. * A line item cannot be changed back to `ENTITY_STATUS_DRAFT` status from any other status. * If the line item's parent insertion order is not active, the line item can't spend its budget even if its own status is `ENTITY_STATUS_ACTIVE`.
4608    #[serde(rename = "entityStatus")]
4609    pub entity_status: Option<String>,
4610    /// Whether to exclude new exchanges from automatically being targeted by the line item. This field is false by default.
4611    #[serde(rename = "excludeNewExchanges")]
4612    pub exclude_new_exchanges: Option<bool>,
4613    /// Required. The start and end time of the line item's flight.
4614    pub flight: Option<LineItemFlight>,
4615    /// Required. The impression frequency cap settings of the line item. The max_impressions field in this settings object must be used if assigning a limited cap.
4616    #[serde(rename = "frequencyCap")]
4617    pub frequency_cap: Option<FrequencyCap>,
4618    /// Required. Immutable. The unique ID of the insertion order that the line item belongs to.
4619    #[serde(rename = "insertionOrderId")]
4620    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4621    pub insertion_order_id: Option<i64>,
4622    /// Integration details of the line item.
4623    #[serde(rename = "integrationDetails")]
4624    pub integration_details: Option<IntegrationDetails>,
4625    /// The IDs of the private inventory sources assigned to the line item.
4626    #[serde(rename = "inventorySourceIds")]
4627    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
4628    pub inventory_source_ids: Option<Vec<i64>>,
4629    /// Output only. The unique ID of the line item. Assigned by the system.
4630    #[serde(rename = "lineItemId")]
4631    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4632    pub line_item_id: Option<i64>,
4633    /// Required. Immutable. The type of the line item.
4634    #[serde(rename = "lineItemType")]
4635    pub line_item_type: Option<String>,
4636    /// The mobile app promoted by the line item. This is applicable only when line_item_type is either `LINE_ITEM_TYPE_DISPLAY_MOBILE_APP_INSTALL` or `LINE_ITEM_TYPE_VIDEO_MOBILE_APP_INSTALL`.
4637    #[serde(rename = "mobileApp")]
4638    pub mobile_app: Option<MobileApp>,
4639    /// Output only. The resource name of the line item.
4640    pub name: Option<String>,
4641    /// Required. The budget spending speed setting of the line item.
4642    pub pacing: Option<Pacing>,
4643    /// The partner costs associated with the line item. If absent or empty in CreateLineItem method, the newly created line item will inherit partner costs from its parent insertion order.
4644    #[serde(rename = "partnerCosts")]
4645    pub partner_costs: Option<Vec<PartnerCost>>,
4646    /// Required. The partner revenue model setting of the line item.
4647    #[serde(rename = "partnerRevenueModel")]
4648    pub partner_revenue_model: Option<PartnerRevenueModel>,
4649    /// Output only. The reservation type of the line item.
4650    #[serde(rename = "reservationType")]
4651    pub reservation_type: Option<String>,
4652    /// The [optimized targeting](https://developers.google.com//support.google.com/displayvideo/answer/12060859) settings of the line item. This config is only applicable for display, video, or audio line items that use automated bidding and positively target eligible audience lists.
4653    #[serde(rename = "targetingExpansion")]
4654    pub targeting_expansion: Option<TargetingExpansionConfig>,
4655    /// Output only. The timestamp when the line item was last updated. Assigned by the system.
4656    #[serde(rename = "updateTime")]
4657    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
4658    /// Output only. The warning messages generated by the line item. These warnings do not block saving the line item, but some may block the line item from running.
4659    #[serde(rename = "warningMessages")]
4660    pub warning_messages: Option<Vec<String>>,
4661}
4662
4663impl common::RequestValue for LineItem {}
4664impl common::ResponseResult for LineItem {}
4665
4666/// Settings that control how budget is allocated.
4667///
4668/// This type is not used in any activity, and only used as *part* of another schema.
4669///
4670#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4671#[serde_with::serde_as]
4672#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4673pub struct LineItemBudget {
4674    /// Required. The type of the budget allocation. `LINE_ITEM_BUDGET_ALLOCATION_TYPE_AUTOMATIC` is only applicable when automatic budget allocation is enabled for the parent insertion order.
4675    #[serde(rename = "budgetAllocationType")]
4676    pub budget_allocation_type: Option<String>,
4677    /// Output only. The budget unit specifies whether the budget is currency based or impression based. This value is inherited from the parent insertion order.
4678    #[serde(rename = "budgetUnit")]
4679    pub budget_unit: Option<String>,
4680    /// The maximum budget amount the line item will spend. Must be greater than 0. When budget_allocation_type is: * `LINE_ITEM_BUDGET_ALLOCATION_TYPE_AUTOMATIC`, this field is immutable and is set by the system. * `LINE_ITEM_BUDGET_ALLOCATION_TYPE_FIXED`, if budget_unit is: - `BUDGET_UNIT_CURRENCY`, this field represents maximum budget amount to spend, in micros of the advertiser's currency. For example, 1500000 represents 1.5 standard units of the currency. - `BUDGET_UNIT_IMPRESSIONS`, this field represents the maximum number of impressions to serve. * `LINE_ITEM_BUDGET_ALLOCATION_TYPE_UNLIMITED`, this field is not applicable and will be ignored by the system.
4681    #[serde(rename = "maxAmount")]
4682    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4683    pub max_amount: Option<i64>,
4684}
4685
4686impl common::Part for LineItemBudget {}
4687
4688/// Settings that control the active duration of a line item.
4689///
4690/// This type is not used in any activity, and only used as *part* of another schema.
4691///
4692#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4693#[serde_with::serde_as]
4694#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4695pub struct LineItemFlight {
4696    /// The flight start and end dates of the line item. They are resolved relative to the parent advertiser's time zone. * Required when flight_date_type is `LINE_ITEM_FLIGHT_DATE_TYPE_CUSTOM`. Output only otherwise. * When creating a new flight, both `start_date` and `end_date` must be in the future. * An existing flight with a `start_date` in the past has a mutable `end_date` but an immutable `start_date`. * `end_date` must be the `start_date` or later, both before the year 2037.
4697    #[serde(rename = "dateRange")]
4698    pub date_range: Option<DateRange>,
4699    /// Required. The type of the line item's flight dates.
4700    #[serde(rename = "flightDateType")]
4701    pub flight_date_type: Option<String>,
4702    /// The ID of the manual trigger associated with the line item. * Required when flight_date_type is `LINE_ITEM_FLIGHT_DATE_TYPE_TRIGGER`. Must not be set otherwise. * When set, the line item’s flight dates are inherited from its parent insertion order. * Active line items will spend when the selected trigger is activated within the parent insertion order’s flight dates. **Warning:** Line Items using manual triggers no longer serve in Display & Video 360. This field will sunset on August 1, 2023. Read our [feature deprecation announcement](https://developers.google.com/display-video/api/deprecations#features.manual_triggers) for more information.
4703    #[serde(rename = "triggerId")]
4704    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4705    pub trigger_id: Option<i64>,
4706}
4707
4708impl common::Part for LineItemFlight {}
4709
4710/// Response message for ListAdvertiserAssignedTargetingOptions.
4711///
4712/// # Activities
4713///
4714/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4715/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4716///
4717/// * [targeting types assigned targeting options list advertisers](AdvertiserTargetingTypeAssignedTargetingOptionListCall) (response)
4718#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4719#[serde_with::serde_as]
4720#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4721pub struct ListAdvertiserAssignedTargetingOptionsResponse {
4722    /// The list of assigned targeting options. This list will be absent if empty.
4723    #[serde(rename = "assignedTargetingOptions")]
4724    pub assigned_targeting_options: Option<Vec<AssignedTargetingOption>>,
4725    /// A token identifying the next page of results. This value should be specified as the pageToken in a subsequent ListAdvertiserAssignedTargetingOptionsRequest to fetch the next page of results. This token will be absent if there are no more assigned_targeting_options to return.
4726    #[serde(rename = "nextPageToken")]
4727    pub next_page_token: Option<String>,
4728}
4729
4730impl common::ResponseResult for ListAdvertiserAssignedTargetingOptionsResponse {}
4731
4732/// There is no detailed description.
4733///
4734/// # Activities
4735///
4736/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4737/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4738///
4739/// * [list advertisers](AdvertiserListCall) (response)
4740#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4741#[serde_with::serde_as]
4742#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4743pub struct ListAdvertisersResponse {
4744    /// The list of advertisers. This list will be absent if empty.
4745    pub advertisers: Option<Vec<Advertiser>>,
4746    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListAdvertisers` method to retrieve the next page of results.
4747    #[serde(rename = "nextPageToken")]
4748    pub next_page_token: Option<String>,
4749}
4750
4751impl common::ResponseResult for ListAdvertisersResponse {}
4752
4753/// Response message for AssignedInventorySourceService.ListAssignedInventorySources.
4754///
4755/// # Activities
4756///
4757/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4758/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4759///
4760/// * [assigned inventory sources list inventory source groups](InventorySourceGroupAssignedInventorySourceListCall) (response)
4761#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4762#[serde_with::serde_as]
4763#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4764pub struct ListAssignedInventorySourcesResponse {
4765    /// The list of assigned inventory sources. This list will be absent if empty.
4766    #[serde(rename = "assignedInventorySources")]
4767    pub assigned_inventory_sources: Option<Vec<AssignedInventorySource>>,
4768    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListAssignedInventorySources` method to retrieve the next page of results.
4769    #[serde(rename = "nextPageToken")]
4770    pub next_page_token: Option<String>,
4771}
4772
4773impl common::ResponseResult for ListAssignedInventorySourcesResponse {}
4774
4775/// Response message for AssignedLocationService.ListAssignedLocations.
4776///
4777/// # Activities
4778///
4779/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4780/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4781///
4782/// * [location lists assigned locations list advertisers](AdvertiserLocationListAssignedLocationListCall) (response)
4783#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4784#[serde_with::serde_as]
4785#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4786pub struct ListAssignedLocationsResponse {
4787    /// The list of assigned locations. This list will be absent if empty.
4788    #[serde(rename = "assignedLocations")]
4789    pub assigned_locations: Option<Vec<AssignedLocation>>,
4790    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListAssignedLocations` method to retrieve the next page of results.
4791    #[serde(rename = "nextPageToken")]
4792    pub next_page_token: Option<String>,
4793}
4794
4795impl common::ResponseResult for ListAssignedLocationsResponse {}
4796
4797/// Response message for ListCampaignAssignedTargetingOptions.
4798///
4799/// # Activities
4800///
4801/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4802/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4803///
4804/// * [campaigns targeting types assigned targeting options list advertisers](AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall) (response)
4805#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4806#[serde_with::serde_as]
4807#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4808pub struct ListCampaignAssignedTargetingOptionsResponse {
4809    /// The list of assigned targeting options. This list will be absent if empty.
4810    #[serde(rename = "assignedTargetingOptions")]
4811    pub assigned_targeting_options: Option<Vec<AssignedTargetingOption>>,
4812    /// A token identifying the next page of results. This value should be specified as the pageToken in a subsequent ListCampaignAssignedTargetingOptionsRequest to fetch the next page of results. This token will be absent if there are no more assigned_targeting_options to return.
4813    #[serde(rename = "nextPageToken")]
4814    pub next_page_token: Option<String>,
4815}
4816
4817impl common::ResponseResult for ListCampaignAssignedTargetingOptionsResponse {}
4818
4819/// There is no detailed description.
4820///
4821/// # Activities
4822///
4823/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4824/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4825///
4826/// * [campaigns list advertisers](AdvertiserCampaignListCall) (response)
4827#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4828#[serde_with::serde_as]
4829#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4830pub struct ListCampaignsResponse {
4831    /// The list of campaigns. This list will be absent if empty.
4832    pub campaigns: Option<Vec<Campaign>>,
4833    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListCampaigns` method to retrieve the next page of results.
4834    #[serde(rename = "nextPageToken")]
4835    pub next_page_token: Option<String>,
4836}
4837
4838impl common::ResponseResult for ListCampaignsResponse {}
4839
4840/// There is no detailed description.
4841///
4842/// # Activities
4843///
4844/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4845/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4846///
4847/// * [channels list advertisers](AdvertiserChannelListCall) (response)
4848/// * [channels list partners](PartnerChannelListCall) (response)
4849#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4850#[serde_with::serde_as]
4851#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4852pub struct ListChannelsResponse {
4853    /// The list of channels. This list will be absent if empty.
4854    pub channels: Option<Vec<Channel>>,
4855    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListChannels` method to retrieve the next page of results.
4856    #[serde(rename = "nextPageToken")]
4857    pub next_page_token: Option<String>,
4858}
4859
4860impl common::ResponseResult for ListChannelsResponse {}
4861
4862/// There is no detailed description.
4863///
4864/// # Activities
4865///
4866/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4867/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4868///
4869/// * [list combined audiences](CombinedAudienceListCall) (response)
4870#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4871#[serde_with::serde_as]
4872#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4873pub struct ListCombinedAudiencesResponse {
4874    /// The list of combined audiences. This list will be absent if empty.
4875    #[serde(rename = "combinedAudiences")]
4876    pub combined_audiences: Option<Vec<CombinedAudience>>,
4877    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListCombinedAudiences` method to retrieve the next page of results.
4878    #[serde(rename = "nextPageToken")]
4879    pub next_page_token: Option<String>,
4880}
4881
4882impl common::ResponseResult for ListCombinedAudiencesResponse {}
4883
4884/// There is no detailed description.
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/// * [creatives list advertisers](AdvertiserCreativeListCall) (response)
4892#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4893#[serde_with::serde_as]
4894#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4895pub struct ListCreativesResponse {
4896    /// The list of creatives. This list will be absent if empty.
4897    pub creatives: Option<Vec<Creative>>,
4898    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListCreativesRequest` method to retrieve the next page of results. If this field is null, it means this is the last page.
4899    #[serde(rename = "nextPageToken")]
4900    pub next_page_token: Option<String>,
4901}
4902
4903impl common::ResponseResult for ListCreativesResponse {}
4904
4905/// There is no detailed description.
4906///
4907/// # Activities
4908///
4909/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4910/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4911///
4912/// * [list custom bidding algorithms](CustomBiddingAlgorithmListCall) (response)
4913#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4914#[serde_with::serde_as]
4915#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4916pub struct ListCustomBiddingAlgorithmsResponse {
4917    /// The list of custom bidding algorithms. This list will be absent if empty.
4918    #[serde(rename = "customBiddingAlgorithms")]
4919    pub custom_bidding_algorithms: Option<Vec<CustomBiddingAlgorithm>>,
4920    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListCustomBiddingAlgorithmsRequest` method to retrieve the next page of results. If this field is null, it means this is the last page.
4921    #[serde(rename = "nextPageToken")]
4922    pub next_page_token: Option<String>,
4923}
4924
4925impl common::ResponseResult for ListCustomBiddingAlgorithmsResponse {}
4926
4927/// There is no detailed description.
4928///
4929/// # Activities
4930///
4931/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4932/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4933///
4934/// * [scripts list custom bidding algorithms](CustomBiddingAlgorithmScriptListCall) (response)
4935#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4936#[serde_with::serde_as]
4937#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4938pub struct ListCustomBiddingScriptsResponse {
4939    /// The list of custom bidding scripts. This list will be absent if empty.
4940    #[serde(rename = "customBiddingScripts")]
4941    pub custom_bidding_scripts: Option<Vec<CustomBiddingScript>>,
4942    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListCustomBiddingScriptsRequest` method to retrieve the next page of results. If this field is null, it means this is the last page.
4943    #[serde(rename = "nextPageToken")]
4944    pub next_page_token: Option<String>,
4945}
4946
4947impl common::ResponseResult for ListCustomBiddingScriptsResponse {}
4948
4949/// There is no detailed description.
4950///
4951/// # Activities
4952///
4953/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4954/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4955///
4956/// * [list custom lists](CustomListListCall) (response)
4957#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4958#[serde_with::serde_as]
4959#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4960pub struct ListCustomListsResponse {
4961    /// The list of custom lists. This list will be absent if empty.
4962    #[serde(rename = "customLists")]
4963    pub custom_lists: Option<Vec<CustomList>>,
4964    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListCustomLists` method to retrieve the next page of results.
4965    #[serde(rename = "nextPageToken")]
4966    pub next_page_token: Option<String>,
4967}
4968
4969impl common::ResponseResult for ListCustomListsResponse {}
4970
4971/// There is no detailed description.
4972///
4973/// # Activities
4974///
4975/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4976/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4977///
4978/// * [list first and third party audiences](FirstAndThirdPartyAudienceListCall) (response)
4979#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4980#[serde_with::serde_as]
4981#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4982pub struct ListFirstAndThirdPartyAudiencesResponse {
4983    /// The list of first and third party audiences. Audience size properties will not be included. This list will be absent if empty.
4984    #[serde(rename = "firstAndThirdPartyAudiences")]
4985    pub first_and_third_party_audiences: Option<Vec<FirstAndThirdPartyAudience>>,
4986    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListFirstAndThirdPartyAudiences` method to retrieve the next page of results.
4987    #[serde(rename = "nextPageToken")]
4988    pub next_page_token: Option<String>,
4989}
4990
4991impl common::ResponseResult for ListFirstAndThirdPartyAudiencesResponse {}
4992
4993/// There is no detailed description.
4994///
4995/// # Activities
4996///
4997/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4998/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4999///
5000/// * [list google audiences](GoogleAudienceListCall) (response)
5001#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5002#[serde_with::serde_as]
5003#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5004pub struct ListGoogleAudiencesResponse {
5005    /// The list of Google audiences. This list will be absent if empty.
5006    #[serde(rename = "googleAudiences")]
5007    pub google_audiences: Option<Vec<GoogleAudience>>,
5008    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListGoogleAudiences` method to retrieve the next page of results.
5009    #[serde(rename = "nextPageToken")]
5010    pub next_page_token: Option<String>,
5011}
5012
5013impl common::ResponseResult for ListGoogleAudiencesResponse {}
5014
5015/// There is no detailed description.
5016///
5017/// # Activities
5018///
5019/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5020/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5021///
5022/// * [list guaranteed orders](GuaranteedOrderListCall) (response)
5023#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5024#[serde_with::serde_as]
5025#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5026pub struct ListGuaranteedOrdersResponse {
5027    /// The list of guaranteed orders. This list will be absent if empty.
5028    #[serde(rename = "guaranteedOrders")]
5029    pub guaranteed_orders: Option<Vec<GuaranteedOrder>>,
5030    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListGuaranteedOrders` method to retrieve the next page of results.
5031    #[serde(rename = "nextPageToken")]
5032    pub next_page_token: Option<String>,
5033}
5034
5035impl common::ResponseResult for ListGuaranteedOrdersResponse {}
5036
5037/// There is no detailed description.
5038///
5039/// # Activities
5040///
5041/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5042/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5043///
5044/// * [insertion orders targeting types assigned targeting options list advertisers](AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall) (response)
5045#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5046#[serde_with::serde_as]
5047#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5048pub struct ListInsertionOrderAssignedTargetingOptionsResponse {
5049    /// The list of assigned targeting options. This list will be absent if empty.
5050    #[serde(rename = "assignedTargetingOptions")]
5051    pub assigned_targeting_options: Option<Vec<AssignedTargetingOption>>,
5052    /// A token identifying the next page of results. This value should be specified as the pageToken in a subsequent ListInsertionOrderAssignedTargetingOptionsRequest to fetch the next page of results. This token will be absent if there are no more assigned_targeting_options to return.
5053    #[serde(rename = "nextPageToken")]
5054    pub next_page_token: Option<String>,
5055}
5056
5057impl common::ResponseResult for ListInsertionOrderAssignedTargetingOptionsResponse {}
5058
5059/// There is no detailed description.
5060///
5061/// # Activities
5062///
5063/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5064/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5065///
5066/// * [insertion orders list advertisers](AdvertiserInsertionOrderListCall) (response)
5067#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5068#[serde_with::serde_as]
5069#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5070pub struct ListInsertionOrdersResponse {
5071    /// The list of insertion orders. This list will be absent if empty.
5072    #[serde(rename = "insertionOrders")]
5073    pub insertion_orders: Option<Vec<InsertionOrder>>,
5074    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListInsertionOrders` method to retrieve the next page of results.
5075    #[serde(rename = "nextPageToken")]
5076    pub next_page_token: Option<String>,
5077}
5078
5079impl common::ResponseResult for ListInsertionOrdersResponse {}
5080
5081/// Response message for InventorySourceGroupService.ListInventorySourceGroups.
5082///
5083/// # Activities
5084///
5085/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5086/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5087///
5088/// * [list inventory source groups](InventorySourceGroupListCall) (response)
5089#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5090#[serde_with::serde_as]
5091#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5092pub struct ListInventorySourceGroupsResponse {
5093    /// The list of inventory source groups. This list will be absent if empty.
5094    #[serde(rename = "inventorySourceGroups")]
5095    pub inventory_source_groups: Option<Vec<InventorySourceGroup>>,
5096    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListInventorySourceGroups` method to retrieve the next page of results.
5097    #[serde(rename = "nextPageToken")]
5098    pub next_page_token: Option<String>,
5099}
5100
5101impl common::ResponseResult for ListInventorySourceGroupsResponse {}
5102
5103/// There is no detailed description.
5104///
5105/// # Activities
5106///
5107/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5108/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5109///
5110/// * [list inventory sources](InventorySourceListCall) (response)
5111#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5112#[serde_with::serde_as]
5113#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5114pub struct ListInventorySourcesResponse {
5115    /// The list of inventory sources. This list will be absent if empty.
5116    #[serde(rename = "inventorySources")]
5117    pub inventory_sources: Option<Vec<InventorySource>>,
5118    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListInventorySources` method to retrieve the next page of results.
5119    #[serde(rename = "nextPageToken")]
5120    pub next_page_token: Option<String>,
5121}
5122
5123impl common::ResponseResult for ListInventorySourcesResponse {}
5124
5125/// There is no detailed description.
5126///
5127/// # Activities
5128///
5129/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5130/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5131///
5132/// * [invoices list advertisers](AdvertiserInvoiceListCall) (response)
5133#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5134#[serde_with::serde_as]
5135#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5136pub struct ListInvoicesResponse {
5137    /// The list of invoices. This list will be absent if empty.
5138    pub invoices: Option<Vec<Invoice>>,
5139    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListInvoices` method to retrieve the next page of results. This token will be absent if there are no more invoices to return.
5140    #[serde(rename = "nextPageToken")]
5141    pub next_page_token: Option<String>,
5142}
5143
5144impl common::ResponseResult for ListInvoicesResponse {}
5145
5146/// Response message for ListLineItemAssignedTargetingOptions.
5147///
5148/// # Activities
5149///
5150/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5151/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5152///
5153/// * [line items targeting types assigned targeting options list advertisers](AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall) (response)
5154#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5155#[serde_with::serde_as]
5156#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5157pub struct ListLineItemAssignedTargetingOptionsResponse {
5158    /// The list of assigned targeting options. This list will be absent if empty.
5159    #[serde(rename = "assignedTargetingOptions")]
5160    pub assigned_targeting_options: Option<Vec<AssignedTargetingOption>>,
5161    /// A token identifying the next page of results. This value should be specified as the pageToken in a subsequent ListLineItemAssignedTargetingOptionsRequest to fetch the next page of results. This token will be absent if there are no more assigned_targeting_options to return.
5162    #[serde(rename = "nextPageToken")]
5163    pub next_page_token: Option<String>,
5164}
5165
5166impl common::ResponseResult for ListLineItemAssignedTargetingOptionsResponse {}
5167
5168/// There is no detailed description.
5169///
5170/// # Activities
5171///
5172/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5173/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5174///
5175/// * [line items list advertisers](AdvertiserLineItemListCall) (response)
5176#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5177#[serde_with::serde_as]
5178#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5179pub struct ListLineItemsResponse {
5180    /// The list of line items. This list will be absent if empty.
5181    #[serde(rename = "lineItems")]
5182    pub line_items: Option<Vec<LineItem>>,
5183    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListLineItems` method to retrieve the next page of results.
5184    #[serde(rename = "nextPageToken")]
5185    pub next_page_token: Option<String>,
5186}
5187
5188impl common::ResponseResult for ListLineItemsResponse {}
5189
5190/// There is no detailed description.
5191///
5192/// # Activities
5193///
5194/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5195/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5196///
5197/// * [location lists list advertisers](AdvertiserLocationListListCall) (response)
5198#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5199#[serde_with::serde_as]
5200#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5201pub struct ListLocationListsResponse {
5202    /// The list of location lists. This list will be absent if empty.
5203    #[serde(rename = "locationLists")]
5204    pub location_lists: Option<Vec<LocationList>>,
5205    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListLocationLists` method to retrieve the next page of results.
5206    #[serde(rename = "nextPageToken")]
5207    pub next_page_token: Option<String>,
5208}
5209
5210impl common::ResponseResult for ListLocationListsResponse {}
5211
5212/// There is no detailed description.
5213///
5214/// # Activities
5215///
5216/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5217/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5218///
5219/// * [manual triggers list advertisers](AdvertiserManualTriggerListCall) (response)
5220#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5221#[serde_with::serde_as]
5222#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5223pub struct ListManualTriggersResponse {
5224    /// The list of manual triggers. This list will be absent if empty.
5225    #[serde(rename = "manualTriggers")]
5226    pub manual_triggers: Option<Vec<ManualTrigger>>,
5227    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListManualTriggers` method to retrieve the next page of results.
5228    #[serde(rename = "nextPageToken")]
5229    pub next_page_token: Option<String>,
5230}
5231
5232impl common::ResponseResult for ListManualTriggersResponse {}
5233
5234/// Response message for NegativeKeywordListService.ListNegativeKeywordLists.
5235///
5236/// # Activities
5237///
5238/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5239/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5240///
5241/// * [negative keyword lists list advertisers](AdvertiserNegativeKeywordListListCall) (response)
5242#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5243#[serde_with::serde_as]
5244#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5245pub struct ListNegativeKeywordListsResponse {
5246    /// The list of negative keyword lists. This list will be absent if empty.
5247    #[serde(rename = "negativeKeywordLists")]
5248    pub negative_keyword_lists: Option<Vec<NegativeKeywordList>>,
5249    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListNegativeKeywordLists` method to retrieve the next page of results.
5250    #[serde(rename = "nextPageToken")]
5251    pub next_page_token: Option<String>,
5252}
5253
5254impl common::ResponseResult for ListNegativeKeywordListsResponse {}
5255
5256/// Response message for NegativeKeywordService.ListNegativeKeywords.
5257///
5258/// # Activities
5259///
5260/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5261/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5262///
5263/// * [negative keyword lists negative keywords list advertisers](AdvertiserNegativeKeywordListNegativeKeywordListCall) (response)
5264#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5265#[serde_with::serde_as]
5266#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5267pub struct ListNegativeKeywordsResponse {
5268    /// The list of negative keywords. This list will be absent if empty.
5269    #[serde(rename = "negativeKeywords")]
5270    pub negative_keywords: Option<Vec<NegativeKeyword>>,
5271    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListNegativeKeywords` method to retrieve the next page of results.
5272    #[serde(rename = "nextPageToken")]
5273    pub next_page_token: Option<String>,
5274}
5275
5276impl common::ResponseResult for ListNegativeKeywordsResponse {}
5277
5278/// There is no detailed description.
5279///
5280/// # Activities
5281///
5282/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5283/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5284///
5285/// * [targeting types assigned targeting options list partners](PartnerTargetingTypeAssignedTargetingOptionListCall) (response)
5286#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5287#[serde_with::serde_as]
5288#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5289pub struct ListPartnerAssignedTargetingOptionsResponse {
5290    /// The list of assigned targeting options. This list will be absent if empty.
5291    #[serde(rename = "assignedTargetingOptions")]
5292    pub assigned_targeting_options: Option<Vec<AssignedTargetingOption>>,
5293    /// A token identifying the next page of results. This value should be specified as the pageToken in a subsequent ListPartnerAssignedTargetingOptionsRequest to fetch the next page of results. This token will be absent if there are no more assigned_targeting_options to return.
5294    #[serde(rename = "nextPageToken")]
5295    pub next_page_token: Option<String>,
5296}
5297
5298impl common::ResponseResult for ListPartnerAssignedTargetingOptionsResponse {}
5299
5300/// There is no detailed description.
5301///
5302/// # Activities
5303///
5304/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5305/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5306///
5307/// * [list partners](PartnerListCall) (response)
5308#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5309#[serde_with::serde_as]
5310#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5311pub struct ListPartnersResponse {
5312    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListPartners` method to retrieve the next page of results.
5313    #[serde(rename = "nextPageToken")]
5314    pub next_page_token: Option<String>,
5315    /// The list of partners. This list will be absent if empty.
5316    pub partners: Option<Vec<Partner>>,
5317}
5318
5319impl common::ResponseResult for ListPartnersResponse {}
5320
5321/// Response message for SiteService.ListSites.
5322///
5323/// # Activities
5324///
5325/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5326/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5327///
5328/// * [channels sites list advertisers](AdvertiserChannelSiteListCall) (response)
5329/// * [channels sites list partners](PartnerChannelSiteListCall) (response)
5330#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5331#[serde_with::serde_as]
5332#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5333pub struct ListSitesResponse {
5334    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListSites` method to retrieve the next page of results.
5335    #[serde(rename = "nextPageToken")]
5336    pub next_page_token: Option<String>,
5337    /// The list of sites. This list will be absent if empty.
5338    pub sites: Option<Vec<Site>>,
5339}
5340
5341impl common::ResponseResult for ListSitesResponse {}
5342
5343/// Response message for ListTargetingOptions.
5344///
5345/// # Activities
5346///
5347/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5348/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5349///
5350/// * [targeting options list targeting types](TargetingTypeTargetingOptionListCall) (response)
5351#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5352#[serde_with::serde_as]
5353#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5354pub struct ListTargetingOptionsResponse {
5355    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListTargetingOptions` method to retrieve the next page of results.
5356    #[serde(rename = "nextPageToken")]
5357    pub next_page_token: Option<String>,
5358    /// The list of targeting options. This list will be absent if empty.
5359    #[serde(rename = "targetingOptions")]
5360    pub targeting_options: Option<Vec<TargetingOption>>,
5361}
5362
5363impl common::ResponseResult for ListTargetingOptionsResponse {}
5364
5365/// There is no detailed description.
5366///
5367/// # Activities
5368///
5369/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5370/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5371///
5372/// * [list users](UserListCall) (response)
5373#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5374#[serde_with::serde_as]
5375#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5376pub struct ListUsersResponse {
5377    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `ListUsers` method to retrieve the next page of results. This token will be absent if there are no more results to return.
5378    #[serde(rename = "nextPageToken")]
5379    pub next_page_token: Option<String>,
5380    /// The list of users. This list will be absent if empty.
5381    pub users: Option<Vec<User>>,
5382}
5383
5384impl common::ResponseResult for ListUsersResponse {}
5385
5386/// A list of locations used for targeting.
5387///
5388/// # Activities
5389///
5390/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5391/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5392///
5393/// * [location lists create advertisers](AdvertiserLocationListCreateCall) (request|response)
5394/// * [location lists get advertisers](AdvertiserLocationListGetCall) (response)
5395/// * [location lists patch advertisers](AdvertiserLocationListPatchCall) (request|response)
5396#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5397#[serde_with::serde_as]
5398#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5399pub struct LocationList {
5400    /// Required. Immutable. The unique ID of the advertiser the location list belongs to.
5401    #[serde(rename = "advertiserId")]
5402    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5403    pub advertiser_id: Option<i64>,
5404    /// Required. The display name of the location list. Must be UTF-8 encoded with a maximum size of 240 bytes.
5405    #[serde(rename = "displayName")]
5406    pub display_name: Option<String>,
5407    /// Output only. The unique ID of the location list. Assigned by the system.
5408    #[serde(rename = "locationListId")]
5409    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5410    pub location_list_id: Option<i64>,
5411    /// Required. Immutable. The type of location. All locations in the list will share this type.
5412    #[serde(rename = "locationType")]
5413    pub location_type: Option<String>,
5414    /// Output only. The resource name of the location list.
5415    pub name: Option<String>,
5416}
5417
5418impl common::RequestValue for LocationList {}
5419impl common::ResponseResult for LocationList {}
5420
5421/// Specifies how many days into the past to look when determining whether to record a conversion.
5422///
5423/// This type is not used in any activity, and only used as *part* of another schema.
5424///
5425#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5426#[serde_with::serde_as]
5427#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5428pub struct LookbackWindow {
5429    /// Lookback window, in days, from the last time a given user clicked on one of your ads.
5430    #[serde(rename = "clickDays")]
5431    pub click_days: Option<i32>,
5432    /// Lookback window, in days, from the last time a given user viewed one of your ads.
5433    #[serde(rename = "impressionDays")]
5434    pub impression_days: Option<i32>,
5435}
5436
5437impl common::Part for LookbackWindow {}
5438
5439/// There is no detailed description.
5440///
5441/// # Activities
5442///
5443/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5444/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5445///
5446/// * [invoices lookup invoice currency advertisers](AdvertiserInvoiceLookupInvoiceCurrencyCall) (response)
5447#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5448#[serde_with::serde_as]
5449#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5450pub struct LookupInvoiceCurrencyResponse {
5451    /// Currency used by the advertiser in ISO 4217 format.
5452    #[serde(rename = "currencyCode")]
5453    pub currency_code: Option<String>,
5454}
5455
5456impl common::ResponseResult for LookupInvoiceCurrencyResponse {}
5457
5458/// A single manual trigger in Display & Video 360. **Warning:** Line Items using manual triggers no longer serve in Display & Video 360. This resource will sunset on August 1, 2023. Read our [feature deprecation announcement](https://developers.google.com/display-video/api/deprecations#features.manual_triggers) for more information.
5459///
5460/// # Activities
5461///
5462/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5463/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5464///
5465/// * [manual triggers activate advertisers](AdvertiserManualTriggerActivateCall) (response)
5466/// * [manual triggers create advertisers](AdvertiserManualTriggerCreateCall) (request|response)
5467/// * [manual triggers deactivate advertisers](AdvertiserManualTriggerDeactivateCall) (response)
5468/// * [manual triggers get advertisers](AdvertiserManualTriggerGetCall) (response)
5469/// * [manual triggers patch advertisers](AdvertiserManualTriggerPatchCall) (request|response)
5470#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5471#[serde_with::serde_as]
5472#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5473pub struct ManualTrigger {
5474    /// Required. The maximum duration of each activation in minutes. Must be between 1 and 360 inclusive. After this duration, the trigger will be automatically deactivated.
5475    #[serde(rename = "activationDurationMinutes")]
5476    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5477    pub activation_duration_minutes: Option<i64>,
5478    /// Required. Immutable. The unique ID of the advertiser that the manual trigger belongs to.
5479    #[serde(rename = "advertiserId")]
5480    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5481    pub advertiser_id: Option<i64>,
5482    /// Required. The display name of the manual trigger. Must be UTF-8 encoded with a maximum size of 240 bytes.
5483    #[serde(rename = "displayName")]
5484    pub display_name: Option<String>,
5485    /// Output only. The timestamp of the trigger's latest activation.
5486    #[serde(rename = "latestActivationTime")]
5487    pub latest_activation_time: Option<chrono::DateTime<chrono::offset::Utc>>,
5488    /// Output only. The resource name of the manual trigger.
5489    pub name: Option<String>,
5490    /// Output only. The state of the manual trigger. Will be set to the `INACTIVE` state upon creation.
5491    pub state: Option<String>,
5492    /// Output only. The unique ID of the manual trigger.
5493    #[serde(rename = "triggerId")]
5494    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5495    pub trigger_id: Option<i64>,
5496}
5497
5498impl common::RequestValue for ManualTrigger {}
5499impl common::ResponseResult for ManualTrigger {}
5500
5501/// A strategy that automatically adjusts the bid to optimize a specified performance goal while spending the full budget.
5502///
5503/// This type is not used in any activity, and only used as *part* of another schema.
5504///
5505#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5506#[serde_with::serde_as]
5507#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5508pub struct MaximizeSpendBidStrategy {
5509    /// The ID of the Custom Bidding Algorithm used by this strategy. Only applicable when performance_goal_type is set to `BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CUSTOM_ALGO`.
5510    #[serde(rename = "customBiddingAlgorithmId")]
5511    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5512    pub custom_bidding_algorithm_id: Option<i64>,
5513    /// The maximum average CPM that may be bid, in micros of the advertiser's currency. Must be greater than or equal to a billable unit of the given currency. For example, 1500000 represents 1.5 standard units of the currency.
5514    #[serde(rename = "maxAverageCpmBidAmountMicros")]
5515    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5516    pub max_average_cpm_bid_amount_micros: Option<i64>,
5517    /// Required. The type of the performance goal that the bidding strategy tries to minimize while spending the full budget. `BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_VIEWABLE_CPM` is not supported for this strategy.
5518    #[serde(rename = "performanceGoalType")]
5519    pub performance_goal_type: Option<String>,
5520    /// Whether the strategy takes deal floor prices into account.
5521    #[serde(rename = "raiseBidForDeals")]
5522    pub raise_bid_for_deals: Option<bool>,
5523}
5524
5525impl common::Part for MaximizeSpendBidStrategy {}
5526
5527/// Measurement settings of a partner.
5528///
5529/// This type is not used in any activity, and only used as *part* of another schema.
5530///
5531#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5532#[serde_with::serde_as]
5533#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5534pub struct MeasurementConfig {
5535    /// Whether or not to report DV360 cost to CM360.
5536    #[serde(rename = "dv360ToCmCostReportingEnabled")]
5537    pub dv360_to_cm_cost_reporting_enabled: Option<bool>,
5538    /// Whether or not to include DV360 data in CM360 data transfer reports.
5539    #[serde(rename = "dv360ToCmDataSharingEnabled")]
5540    pub dv360_to_cm_data_sharing_enabled: Option<bool>,
5541}
5542
5543impl common::Part for MeasurementConfig {}
5544
5545/// A mobile app promoted by a mobile app install line item.
5546///
5547/// This type is not used in any activity, and only used as *part* of another schema.
5548///
5549#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5550#[serde_with::serde_as]
5551#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5552pub struct MobileApp {
5553    /// Required. The ID of the app provided by the platform store. Android apps are identified by the bundle ID used by Android's Play store, such as `com.google.android.gm`. iOS apps are identified by a nine-digit app ID used by Apple's App store, such as `422689480`.
5554    #[serde(rename = "appId")]
5555    pub app_id: Option<String>,
5556    /// Output only. The app name.
5557    #[serde(rename = "displayName")]
5558    pub display_name: Option<String>,
5559    /// Output only. The app platform.
5560    pub platform: Option<String>,
5561    /// Output only. The app publisher.
5562    pub publisher: Option<String>,
5563}
5564
5565impl common::Part for MobileApp {}
5566
5567/// Wrapper message for a list of mobile device IDs defining Customer Match audience members.
5568///
5569/// This type is not used in any activity, and only used as *part* of another schema.
5570///
5571#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5572#[serde_with::serde_as]
5573#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5574pub struct MobileDeviceIdList {
5575    /// Input only. The consent setting for the users in mobile_device_ids. Leaving this field unset indicates that consent is not specified. If ad_user_data or ad_personalization fields are set to `CONSENT_STATUS_DENIED`, the request will return an error.
5576    pub consent: Option<Consent>,
5577    /// A list of mobile device IDs defining Customer Match audience members. The size of mobile_device_ids mustn't be greater than 500,000.
5578    #[serde(rename = "mobileDeviceIds")]
5579    pub mobile_device_ids: Option<Vec<String>>,
5580}
5581
5582impl common::Part for MobileDeviceIdList {}
5583
5584/// Represents an amount of money with its currency type.
5585///
5586/// This type is not used in any activity, and only used as *part* of another schema.
5587///
5588#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5589#[serde_with::serde_as]
5590#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5591pub struct Money {
5592    /// The three-letter currency code defined in ISO 4217.
5593    #[serde(rename = "currencyCode")]
5594    pub currency_code: Option<String>,
5595    /// Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If `units` is positive, `nanos` must be positive or zero. If `units` is zero, `nanos` can be positive, zero, or negative. If `units` is negative, `nanos` must be negative or zero. For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
5596    pub nanos: Option<i32>,
5597    /// The whole units of the amount. For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
5598    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5599    pub units: Option<i64>,
5600}
5601
5602impl common::Part for Money {}
5603
5604/// Details for native content position assigned targeting option. This will be populated in the native_content_position_details field when targeting_type is `TARGETING_TYPE_NATIVE_CONTENT_POSITION`. Explicitly targeting all options is not supported. Remove all native content position targeting options to achieve this effect.
5605///
5606/// This type is not used in any activity, and only used as *part* of another schema.
5607///
5608#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5609#[serde_with::serde_as]
5610#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5611pub struct NativeContentPositionAssignedTargetingOptionDetails {
5612    /// Required. The content position.
5613    #[serde(rename = "contentPosition")]
5614    pub content_position: Option<String>,
5615    /// Required. The targeting_option_id field when targeting_type is `TARGETING_TYPE_NATIVE_CONTENT_POSITION`.
5616    #[serde(rename = "targetingOptionId")]
5617    pub targeting_option_id: Option<String>,
5618}
5619
5620impl common::Part for NativeContentPositionAssignedTargetingOptionDetails {}
5621
5622/// Represents a targetable native content position. This will be populated in the native_content_position_details field when targeting_type is `TARGETING_TYPE_NATIVE_CONTENT_POSITION`.
5623///
5624/// This type is not used in any activity, and only used as *part* of another schema.
5625///
5626#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5627#[serde_with::serde_as]
5628#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5629pub struct NativeContentPositionTargetingOptionDetails {
5630    /// Output only. The content position.
5631    #[serde(rename = "contentPosition")]
5632    pub content_position: Option<String>,
5633}
5634
5635impl common::Part for NativeContentPositionTargetingOptionDetails {}
5636
5637/// A negatively targeted keyword that belongs to a negative keyword list.
5638///
5639/// # Activities
5640///
5641/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5642/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5643///
5644/// * [negative keyword lists negative keywords create advertisers](AdvertiserNegativeKeywordListNegativeKeywordCreateCall) (request|response)
5645#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5646#[serde_with::serde_as]
5647#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5648pub struct NegativeKeyword {
5649    /// Required. Immutable. The negatively targeted keyword, for example `car insurance`. Must be UTF-8 encoded with a maximum size of 255 bytes. Maximum number of characters is 80. Maximum number of words is 10. Valid characters are restricted to ASCII characters only. The only URL-escaping permitted is for representing whitespace between words. Leading or trailing whitespace is ignored.
5650    #[serde(rename = "keywordValue")]
5651    pub keyword_value: Option<String>,
5652    /// Output only. The resource name of the negative keyword.
5653    pub name: Option<String>,
5654}
5655
5656impl common::RequestValue for NegativeKeyword {}
5657impl common::ResponseResult for NegativeKeyword {}
5658
5659/// A list of negative keywords used for targeting.
5660///
5661/// # Activities
5662///
5663/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5664/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5665///
5666/// * [negative keyword lists create advertisers](AdvertiserNegativeKeywordListCreateCall) (request|response)
5667/// * [negative keyword lists get advertisers](AdvertiserNegativeKeywordListGetCall) (response)
5668/// * [negative keyword lists patch advertisers](AdvertiserNegativeKeywordListPatchCall) (request|response)
5669#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5670#[serde_with::serde_as]
5671#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5672pub struct NegativeKeywordList {
5673    /// Output only. The unique ID of the advertiser the negative keyword list belongs to.
5674    #[serde(rename = "advertiserId")]
5675    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5676    pub advertiser_id: Option<i64>,
5677    /// Required. The display name of the negative keyword list. Must be UTF-8 encoded with a maximum size of 255 bytes.
5678    #[serde(rename = "displayName")]
5679    pub display_name: Option<String>,
5680    /// Output only. The resource name of the negative keyword list.
5681    pub name: Option<String>,
5682    /// Output only. The unique ID of the negative keyword list. Assigned by the system.
5683    #[serde(rename = "negativeKeywordListId")]
5684    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5685    pub negative_keyword_list_id: Option<i64>,
5686    /// Output only. Number of line items that are directly targeting this negative keyword list.
5687    #[serde(rename = "targetedLineItemCount")]
5688    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5689    pub targeted_line_item_count: Option<i64>,
5690}
5691
5692impl common::RequestValue for NegativeKeywordList {}
5693impl common::ResponseResult for NegativeKeywordList {}
5694
5695/// Targeting details for negative keyword list. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_NEGATIVE_KEYWORD_LIST`.
5696///
5697/// This type is not used in any activity, and only used as *part* of another schema.
5698///
5699#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5700#[serde_with::serde_as]
5701#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5702pub struct NegativeKeywordListAssignedTargetingOptionDetails {
5703    /// Required. ID of the negative keyword list. Should refer to the negative_keyword_list_id field of a NegativeKeywordList resource.
5704    #[serde(rename = "negativeKeywordListId")]
5705    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5706    pub negative_keyword_list_id: Option<i64>,
5707}
5708
5709impl common::Part for NegativeKeywordListAssignedTargetingOptionDetails {}
5710
5711/// OBA Icon for a Creative
5712///
5713/// This type is not used in any activity, and only used as *part* of another schema.
5714///
5715#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5716#[serde_with::serde_as]
5717#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5718pub struct ObaIcon {
5719    /// Required. The click tracking URL of the OBA icon. Only URLs of the following domains are allowed: * https://info.evidon.com * https://l.betrad.com
5720    #[serde(rename = "clickTrackingUrl")]
5721    pub click_tracking_url: Option<String>,
5722    /// The dimensions of the OBA icon.
5723    pub dimensions: Option<Dimensions>,
5724    /// Required. The landing page URL of the OBA icon. Only URLs of the following domains are allowed: * https://info.evidon.com * https://l.betrad.com
5725    #[serde(rename = "landingPageUrl")]
5726    pub landing_page_url: Option<String>,
5727    /// The position of the OBA icon on the creative.
5728    pub position: Option<String>,
5729    /// The program of the OBA icon. For example: “AdChoices”.
5730    pub program: Option<String>,
5731    /// The MIME type of the OBA icon resource.
5732    #[serde(rename = "resourceMimeType")]
5733    pub resource_mime_type: Option<String>,
5734    /// The URL of the OBA icon resource.
5735    #[serde(rename = "resourceUrl")]
5736    pub resource_url: Option<String>,
5737    /// Required. The view tracking URL of the OBA icon. Only URLs of the following domains are allowed: * https://info.evidon.com * https://l.betrad.com
5738    #[serde(rename = "viewTrackingUrl")]
5739    pub view_tracking_url: Option<String>,
5740}
5741
5742impl common::Part for ObaIcon {}
5743
5744/// Represents a targetable Open Measurement enabled inventory type. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_OMID`.
5745///
5746/// This type is not used in any activity, and only used as *part* of another schema.
5747///
5748#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5749#[serde_with::serde_as]
5750#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5751pub struct OmidAssignedTargetingOptionDetails {
5752    /// Required. The type of Open Measurement enabled inventory.
5753    pub omid: Option<String>,
5754    /// Required. The targeting_option_id of a TargetingOption of type `TARGETING_TYPE_OMID`.
5755    #[serde(rename = "targetingOptionId")]
5756    pub targeting_option_id: Option<String>,
5757}
5758
5759impl common::Part for OmidAssignedTargetingOptionDetails {}
5760
5761/// Represents a targetable Open Measurement enabled inventory type. This will be populated in the omid_details field when targeting_type is `TARGETING_TYPE_OMID`.
5762///
5763/// This type is not used in any activity, and only used as *part* of another schema.
5764///
5765#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5766#[serde_with::serde_as]
5767#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5768pub struct OmidTargetingOptionDetails {
5769    /// Output only. The type of Open Measurement enabled inventory.
5770    pub omid: Option<String>,
5771}
5772
5773impl common::Part for OmidTargetingOptionDetails {}
5774
5775/// On screen position targeting option details. This will be populated in the on_screen_position_details field when targeting_type is `TARGETING_TYPE_ON_SCREEN_POSITION`.
5776///
5777/// This type is not used in any activity, and only used as *part* of another schema.
5778///
5779#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5780#[serde_with::serde_as]
5781#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5782pub struct OnScreenPositionAssignedTargetingOptionDetails {
5783    /// Output only. The ad type to target. Only applicable to insertion order targeting and new line items supporting the specified ad type will inherit this targeting option by default. Possible values are: * `AD_TYPE_DISPLAY`, the setting will be inherited by new line item when line_item_type is `LINE_ITEM_TYPE_DISPLAY_DEFAULT`. * `AD_TYPE_VIDEO`, the setting will be inherited by new line item when line_item_type is `LINE_ITEM_TYPE_VIDEO_DEFAULT`.
5784    #[serde(rename = "adType")]
5785    pub ad_type: Option<String>,
5786    /// Output only. The on screen position.
5787    #[serde(rename = "onScreenPosition")]
5788    pub on_screen_position: Option<String>,
5789    /// Required. The targeting_option_id field when targeting_type is `TARGETING_TYPE_ON_SCREEN_POSITION`.
5790    #[serde(rename = "targetingOptionId")]
5791    pub targeting_option_id: Option<String>,
5792}
5793
5794impl common::Part for OnScreenPositionAssignedTargetingOptionDetails {}
5795
5796/// Represents a targetable on screen position, which could be used by display and video ads. This will be populated in the on_screen_position_details field when targeting_type is `TARGETING_TYPE_ON_SCREEN_POSITION`.
5797///
5798/// This type is not used in any activity, and only used as *part* of another schema.
5799///
5800#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5801#[serde_with::serde_as]
5802#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5803pub struct OnScreenPositionTargetingOptionDetails {
5804    /// Output only. The on screen position.
5805    #[serde(rename = "onScreenPosition")]
5806    pub on_screen_position: Option<String>,
5807}
5808
5809impl common::Part for OnScreenPositionTargetingOptionDetails {}
5810
5811/// Assigned operating system targeting option details. This will be populated in the operating_system_details field when targeting_type is `TARGETING_TYPE_OPERATING_SYSTEM`.
5812///
5813/// This type is not used in any activity, and only used as *part* of another schema.
5814///
5815#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5816#[serde_with::serde_as]
5817#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5818pub struct OperatingSystemAssignedTargetingOptionDetails {
5819    /// Output only. The display name of the operating system.
5820    #[serde(rename = "displayName")]
5821    pub display_name: Option<String>,
5822    /// Indicates if this option is being negatively targeted.
5823    pub negative: Option<bool>,
5824    /// Required. The targeting option ID populated in targeting_option_id field when targeting_type is `TARGETING_TYPE_OPERATING_SYSTEM`.
5825    #[serde(rename = "targetingOptionId")]
5826    pub targeting_option_id: Option<String>,
5827}
5828
5829impl common::Part for OperatingSystemAssignedTargetingOptionDetails {}
5830
5831/// Represents a targetable operating system. This will be populated in the operating_system_details field of a TargetingOption when targeting_type is `TARGETING_TYPE_OPERATING_SYSTEM`.
5832///
5833/// This type is not used in any activity, and only used as *part* of another schema.
5834///
5835#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5836#[serde_with::serde_as]
5837#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5838pub struct OperatingSystemTargetingOptionDetails {
5839    /// Output only. The display name of the operating system.
5840    #[serde(rename = "displayName")]
5841    pub display_name: Option<String>,
5842}
5843
5844impl common::Part for OperatingSystemTargetingOptionDetails {}
5845
5846/// This resource represents a long-running operation that is the result of a network API call.
5847///
5848/// # Activities
5849///
5850/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5851/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5852///
5853/// * [operations get sdfdownloadtasks](SdfdownloadtaskOperationGetCall) (response)
5854/// * [create sdfdownloadtasks](SdfdownloadtaskCreateCall) (response)
5855#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5856#[serde_with::serde_as]
5857#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5858pub struct Operation {
5859    /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
5860    pub done: Option<bool>,
5861    /// The error result of the operation in case of failure or cancellation.
5862    pub error: Option<Status>,
5863    /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
5864    pub metadata: Option<HashMap<String, serde_json::Value>>,
5865    /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
5866    pub name: Option<String>,
5867    /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
5868    pub response: Option<HashMap<String, serde_json::Value>>,
5869}
5870
5871impl common::ResponseResult for Operation {}
5872
5873/// Settings that control the rate at which a budget is spent.
5874///
5875/// This type is not used in any activity, and only used as *part* of another schema.
5876///
5877#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5878#[serde_with::serde_as]
5879#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5880pub struct Pacing {
5881    /// Maximum number of impressions to serve every day. Applicable when the budget is impression based. Must be greater than 0.
5882    #[serde(rename = "dailyMaxImpressions")]
5883    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5884    pub daily_max_impressions: Option<i64>,
5885    /// Maximum currency amount to spend every day in micros of advertiser's currency. Applicable when the budget is currency based. Must be greater than 0. For example, for 1.5 standard unit of the currency, set this field to 1500000. The value assigned will be rounded to whole billable units for the relevant currency by the following rules: any positive value less than a single billable unit will be rounded up to one billable unit and any value larger than a single billable unit will be rounded down to the nearest billable value. For example, if the currency's billable unit is 0.01, and this field is set to 10257770, it will round down to 10250000, a value of 10.25. If set to 505, it will round up to 10000, a value of 0.01.
5886    #[serde(rename = "dailyMaxMicros")]
5887    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5888    pub daily_max_micros: Option<i64>,
5889    /// Required. The time period in which the pacing budget will be spent. When automatic budget allocation is enabled at the insertion order via automationType, this field is output only and defaults to `PACING_PERIOD_FLIGHT`.
5890    #[serde(rename = "pacingPeriod")]
5891    pub pacing_period: Option<String>,
5892    /// Required. The type of pacing that defines how the budget amount will be spent across the pacing_period.
5893    #[serde(rename = "pacingType")]
5894    pub pacing_type: Option<String>,
5895}
5896
5897impl common::Part for Pacing {}
5898
5899/// A filtering option that filters on selected file types belonging to a chosen set of filter entities.
5900///
5901/// This type is not used in any activity, and only used as *part* of another schema.
5902///
5903#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5904#[serde_with::serde_as]
5905#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5906pub struct ParentEntityFilter {
5907    /// Required. File types that will be returned.
5908    #[serde(rename = "fileType")]
5909    pub file_type: Option<Vec<String>>,
5910    /// The IDs of the specified filter type. This is used to filter entities to fetch. If filter type is not `FILTER_TYPE_NONE`, at least one ID must be specified.
5911    #[serde(rename = "filterIds")]
5912    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
5913    pub filter_ids: Option<Vec<i64>>,
5914    /// Required. Filter type used to filter fetched entities.
5915    #[serde(rename = "filterType")]
5916    pub filter_type: Option<String>,
5917}
5918
5919impl common::Part for ParentEntityFilter {}
5920
5921/// Details for assigned parental status targeting option. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_PARENTAL_STATUS`.
5922///
5923/// This type is not used in any activity, and only used as *part* of another schema.
5924///
5925#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5926#[serde_with::serde_as]
5927#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5928pub struct ParentalStatusAssignedTargetingOptionDetails {
5929    /// Required. The parental status of the audience.
5930    #[serde(rename = "parentalStatus")]
5931    pub parental_status: Option<String>,
5932    /// Required. The targeting_option_id of a TargetingOption of type `TARGETING_TYPE_PARENTAL_STATUS`.
5933    #[serde(rename = "targetingOptionId")]
5934    pub targeting_option_id: Option<String>,
5935}
5936
5937impl common::Part for ParentalStatusAssignedTargetingOptionDetails {}
5938
5939/// Represents a targetable parental status. This will be populated in the parental_status_details field of a TargetingOption when targeting_type is `TARGETING_TYPE_PARENTAL_STATUS`.
5940///
5941/// This type is not used in any activity, and only used as *part* of another schema.
5942///
5943#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5944#[serde_with::serde_as]
5945#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5946pub struct ParentalStatusTargetingOptionDetails {
5947    /// Output only. The parental status of an audience.
5948    #[serde(rename = "parentalStatus")]
5949    pub parental_status: Option<String>,
5950}
5951
5952impl common::Part for ParentalStatusTargetingOptionDetails {}
5953
5954/// A single partner in Display & Video 360 (DV360).
5955///
5956/// # Activities
5957///
5958/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5959/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5960///
5961/// * [channels sites bulk edit partners](PartnerChannelSiteBulkEditCall) (none)
5962/// * [channels sites create partners](PartnerChannelSiteCreateCall) (none)
5963/// * [channels sites delete partners](PartnerChannelSiteDeleteCall) (none)
5964/// * [channels sites list partners](PartnerChannelSiteListCall) (none)
5965/// * [channels sites replace partners](PartnerChannelSiteReplaceCall) (none)
5966/// * [channels create partners](PartnerChannelCreateCall) (none)
5967/// * [channels get partners](PartnerChannelGetCall) (none)
5968/// * [channels list partners](PartnerChannelListCall) (none)
5969/// * [channels patch partners](PartnerChannelPatchCall) (none)
5970/// * [targeting types assigned targeting options create partners](PartnerTargetingTypeAssignedTargetingOptionCreateCall) (none)
5971/// * [targeting types assigned targeting options delete partners](PartnerTargetingTypeAssignedTargetingOptionDeleteCall) (none)
5972/// * [targeting types assigned targeting options get partners](PartnerTargetingTypeAssignedTargetingOptionGetCall) (none)
5973/// * [targeting types assigned targeting options list partners](PartnerTargetingTypeAssignedTargetingOptionListCall) (none)
5974/// * [bulk edit partner assigned targeting options partners](PartnerBulkEditPartnerAssignedTargetingOptionCall) (none)
5975/// * [get partners](PartnerGetCall) (response)
5976/// * [list partners](PartnerListCall) (none)
5977#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5978#[serde_with::serde_as]
5979#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5980pub struct Partner {
5981    /// Ad server related settings of the partner.
5982    #[serde(rename = "adServerConfig")]
5983    pub ad_server_config: Option<PartnerAdServerConfig>,
5984    /// Settings that control how partner data may be accessed.
5985    #[serde(rename = "dataAccessConfig")]
5986    pub data_access_config: Option<PartnerDataAccessConfig>,
5987    /// The display name of the partner. Must be UTF-8 encoded with a maximum size of 240 bytes.
5988    #[serde(rename = "displayName")]
5989    pub display_name: Option<String>,
5990    /// Output only. The status of the partner.
5991    #[serde(rename = "entityStatus")]
5992    pub entity_status: Option<String>,
5993    /// Settings that control which exchanges are enabled for the partner.
5994    #[serde(rename = "exchangeConfig")]
5995    pub exchange_config: Option<ExchangeConfig>,
5996    /// General settings of the partner.
5997    #[serde(rename = "generalConfig")]
5998    pub general_config: Option<PartnerGeneralConfig>,
5999    /// Output only. The resource name of the partner.
6000    pub name: Option<String>,
6001    /// Output only. The unique ID of the partner. Assigned by the system.
6002    #[serde(rename = "partnerId")]
6003    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6004    pub partner_id: Option<i64>,
6005    /// Output only. The timestamp when the partner was last updated. Assigned by the system.
6006    #[serde(rename = "updateTime")]
6007    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
6008}
6009
6010impl common::Resource for Partner {}
6011impl common::ResponseResult for Partner {}
6012
6013/// Ad server related settings of a partner.
6014///
6015/// This type is not used in any activity, and only used as *part* of another schema.
6016///
6017#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6018#[serde_with::serde_as]
6019#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6020pub struct PartnerAdServerConfig {
6021    /// Measurement settings of a partner.
6022    #[serde(rename = "measurementConfig")]
6023    pub measurement_config: Option<MeasurementConfig>,
6024}
6025
6026impl common::Part for PartnerAdServerConfig {}
6027
6028/// Settings that control a partner cost. A partner cost is any type of expense involved in running a campaign, other than the costs of purchasing impressions (which is called the media cost) and using third-party audience segment data (data fee). Some examples of partner costs include the fees for using DV360, a third-party ad server, or a third-party ad serving verification service.
6029///
6030/// This type is not used in any activity, and only used as *part* of another schema.
6031///
6032#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6033#[serde_with::serde_as]
6034#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6035pub struct PartnerCost {
6036    /// Required. The type of the partner cost.
6037    #[serde(rename = "costType")]
6038    pub cost_type: Option<String>,
6039    /// The CPM fee amount in micros of advertiser's currency. Applicable when the fee_type is `PARTNER_FEE_TYPE_CPM_FEE`. Must be greater than or equal to 0. For example, for 1.5 standard unit of the advertiser's currency, set this field to 1500000.
6040    #[serde(rename = "feeAmount")]
6041    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6042    pub fee_amount: Option<i64>,
6043    /// The media fee percentage in millis (1/1000 of a percent). Applicable when the fee_type is `PARTNER_FEE_TYPE_MEDIA_FEE`. Must be greater than or equal to 0. For example: 100 represents 0.1%.
6044    #[serde(rename = "feePercentageMillis")]
6045    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6046    pub fee_percentage_millis: Option<i64>,
6047    /// Required. The fee type for this partner cost.
6048    #[serde(rename = "feeType")]
6049    pub fee_type: Option<String>,
6050    /// The invoice type for this partner cost. * Required when cost_type is one of: - `PARTNER_COST_TYPE_ADLOOX` - `PARTNER_COST_TYPE_DOUBLE_VERIFY` - `PARTNER_COST_TYPE_INTEGRAL_AD_SCIENCE`. * Output only for other types.
6051    #[serde(rename = "invoiceType")]
6052    pub invoice_type: Option<String>,
6053}
6054
6055impl common::Part for PartnerCost {}
6056
6057/// Settings that control how partner related data may be accessed.
6058///
6059/// This type is not used in any activity, and only used as *part* of another schema.
6060///
6061#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6062#[serde_with::serde_as]
6063#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6064pub struct PartnerDataAccessConfig {
6065    /// Structured Data Files (SDF) settings for the partner. The SDF configuration for the partner.
6066    #[serde(rename = "sdfConfig")]
6067    pub sdf_config: Option<SdfConfig>,
6068}
6069
6070impl common::Part for PartnerDataAccessConfig {}
6071
6072/// General settings of a partner.
6073///
6074/// This type is not used in any activity, and only used as *part* of another schema.
6075///
6076#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6077#[serde_with::serde_as]
6078#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6079pub struct PartnerGeneralConfig {
6080    /// Immutable. Partner's currency in ISO 4217 format.
6081    #[serde(rename = "currencyCode")]
6082    pub currency_code: Option<String>,
6083    /// Immutable. The standard TZ database name of the partner's time zone. For example, `America/New_York`. See more at: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
6084    #[serde(rename = "timeZone")]
6085    pub time_zone: Option<String>,
6086}
6087
6088impl common::Part for PartnerGeneralConfig {}
6089
6090/// Settings that control how partner revenue is calculated.
6091///
6092/// This type is not used in any activity, and only used as *part* of another schema.
6093///
6094#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6095#[serde_with::serde_as]
6096#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6097pub struct PartnerRevenueModel {
6098    /// Required. The markup amount of the partner revenue model. Must be greater than or equal to 0. * When the markup_type is set to be `PARTNER_REVENUE_MODEL_MARKUP_TYPE_CPM`, this field represents the CPM markup in micros of advertiser's currency. For example, 1500000 represents 1.5 standard units of the currency. * When the markup_type is set to be `PARTNER_REVENUE_MODEL_MARKUP_TYPE_MEDIA_COST_MARKUP`, this field represents the media cost percent markup in millis. For example, 100 represents 0.1% (decimal 0.001). * When the markup_type is set to be `PARTNER_REVENUE_MODEL_MARKUP_TYPE_TOTAL_MEDIA_COST_MARKUP`, this field represents the total media cost percent markup in millis. For example, 100 represents 0.1% (decimal 0.001).
6099    #[serde(rename = "markupAmount")]
6100    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6101    pub markup_amount: Option<i64>,
6102    /// Required. The markup type of the partner revenue model.
6103    #[serde(rename = "markupType")]
6104    pub markup_type: Option<String>,
6105}
6106
6107impl common::Part for PartnerRevenueModel {}
6108
6109/// Settings that control the performance goal of a campaign.
6110///
6111/// This type is not used in any activity, and only used as *part* of another schema.
6112///
6113#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6114#[serde_with::serde_as]
6115#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6116pub struct PerformanceGoal {
6117    /// The goal amount, in micros of the advertiser's currency. Applicable when performance_goal_type is one of: * `PERFORMANCE_GOAL_TYPE_CPM` * `PERFORMANCE_GOAL_TYPE_CPC` * `PERFORMANCE_GOAL_TYPE_CPA` * `PERFORMANCE_GOAL_TYPE_CPIAVC` * `PERFORMANCE_GOAL_TYPE_VCPM` For example 1500000 represents 1.5 standard units of the currency.
6118    #[serde(rename = "performanceGoalAmountMicros")]
6119    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6120    pub performance_goal_amount_micros: Option<i64>,
6121    /// The decimal representation of the goal percentage in micros. Applicable when performance_goal_type is one of: * `PERFORMANCE_GOAL_TYPE_CTR` * `PERFORMANCE_GOAL_TYPE_VIEWABILITY` * `PERFORMANCE_GOAL_TYPE_CLICK_CVR` * `PERFORMANCE_GOAL_TYPE_IMPRESSION_CVR` * `PERFORMANCE_GOAL_TYPE_VTR` * `PERFORMANCE_GOAL_TYPE_AUDIO_COMPLETION_RATE` * `PERFORMANCE_GOAL_TYPE_VIDEO_COMPLETION_RATE` For example, 70000 represents 7% (decimal 0.07).
6122    #[serde(rename = "performanceGoalPercentageMicros")]
6123    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6124    pub performance_goal_percentage_micros: Option<i64>,
6125    /// A key performance indicator (KPI) string, which can be empty. Must be UTF-8 encoded with a length of no more than 100 characters. Applicable when performance_goal_type is set to `PERFORMANCE_GOAL_TYPE_OTHER`.
6126    #[serde(rename = "performanceGoalString")]
6127    pub performance_goal_string: Option<String>,
6128    /// Required. The type of the performance goal.
6129    #[serde(rename = "performanceGoalType")]
6130    pub performance_goal_type: Option<String>,
6131}
6132
6133impl common::Part for PerformanceGoal {}
6134
6135/// A strategy that automatically adjusts the bid to meet or beat a specified performance goal.
6136///
6137/// This type is not used in any activity, and only used as *part* of another schema.
6138///
6139#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6140#[serde_with::serde_as]
6141#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6142pub struct PerformanceGoalBidStrategy {
6143    /// The ID of the Custom Bidding Algorithm used by this strategy. Only applicable when performance_goal_type is set to `BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CUSTOM_ALGO`.
6144    #[serde(rename = "customBiddingAlgorithmId")]
6145    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6146    pub custom_bidding_algorithm_id: Option<i64>,
6147    /// The maximum average CPM that may be bid, in micros of the advertiser's currency. Must be greater than or equal to a billable unit of the given currency. Not applicable when performance_goal_type is set to `BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_VIEWABLE_CPM`. For example, 1500000 represents 1.5 standard units of the currency.
6148    #[serde(rename = "maxAverageCpmBidAmountMicros")]
6149    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6150    pub max_average_cpm_bid_amount_micros: Option<i64>,
6151    /// Required. The performance goal the bidding strategy will attempt to meet or beat, in micros of the advertiser's currency or in micro of the ROAS (Return On Advertising Spend) value which is also based on advertiser's currency. Must be greater than or equal to a billable unit of the given currency and smaller or equal to upper bounds. Each performance_goal_type has its upper bound: * when performance_goal_type is `BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CPA`, upper bound is 10000.00 USD. * when performance_goal_type is `BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CPC`, upper bound is 1000.00 USD. * when performance_goal_type is `BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_VIEWABLE_CPM`, upper bound is 1000.00 USD. * when performance_goal_type is `BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CUSTOM_ALGO`, upper bound is 1000.00 and lower bound is 0.01. Example: If set to `BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_VIEWABLE_CPM`, the bid price will be based on the probability that each available impression will be viewable. For example, if viewable CPM target is $2 and an impression is 40% likely to be viewable, the bid price will be $0.80 CPM (40% of $2). For example, 1500000 represents 1.5 standard units of the currency or ROAS value.
6152    #[serde(rename = "performanceGoalAmountMicros")]
6153    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6154    pub performance_goal_amount_micros: Option<i64>,
6155    /// Required. The type of the performance goal that the bidding strategy will try to meet or beat. For line item level usage, the value must be one of: * `BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CPA` * `BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CPC` * `BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_VIEWABLE_CPM` * `BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CUSTOM_ALGO`.
6156    #[serde(rename = "performanceGoalType")]
6157    pub performance_goal_type: Option<String>,
6158}
6159
6160impl common::Part for PerformanceGoalBidStrategy {}
6161
6162/// Details for assigned POI targeting option. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_POI`.
6163///
6164/// This type is not used in any activity, and only used as *part* of another schema.
6165///
6166#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6167#[serde_with::serde_as]
6168#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6169pub struct PoiAssignedTargetingOptionDetails {
6170    /// Output only. The display name of a POI, e.g. "Times Square", "Space Needle", followed by its full address if available.
6171    #[serde(rename = "displayName")]
6172    pub display_name: Option<String>,
6173    /// Output only. Latitude of the POI rounding to 6th decimal place.
6174    pub latitude: Option<f64>,
6175    /// Output only. Longitude of the POI rounding to 6th decimal place.
6176    pub longitude: Option<f64>,
6177    /// Required. The radius of the area around the POI that will be targeted. The units of the radius are specified by proximity_radius_unit. Must be 1 to 800 if unit is `DISTANCE_UNIT_KILOMETERS` and 1 to 500 if unit is `DISTANCE_UNIT_MILES`.
6178    #[serde(rename = "proximityRadiusAmount")]
6179    pub proximity_radius_amount: Option<f64>,
6180    /// Required. The unit of distance by which the targeting radius is measured.
6181    #[serde(rename = "proximityRadiusUnit")]
6182    pub proximity_radius_unit: Option<String>,
6183    /// Required. The targeting_option_id of a TargetingOption of type `TARGETING_TYPE_POI`. Accepted POI targeting option IDs can be retrieved using `targetingTypes.targetingOptions.search`. If targeting a specific latitude/longitude coordinate removed from an address or POI name, you can generate the necessary targeting option ID by rounding the desired coordinate values to the 6th decimal place, removing the decimals, and concatenating the string values separated by a semicolon. For example, you can target the latitude/longitude pair of 40.7414691, -74.003387 using the targeting option ID "40741469;-74003387". **Upon** **creation, this field value will be updated to append a semicolon and** **alphanumerical hash value if only latitude/longitude coordinates are** **provided.**
6184    #[serde(rename = "targetingOptionId")]
6185    pub targeting_option_id: Option<String>,
6186}
6187
6188impl common::Part for PoiAssignedTargetingOptionDetails {}
6189
6190/// Search terms for POI targeting options.
6191///
6192/// This type is not used in any activity, and only used as *part* of another schema.
6193///
6194#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6195#[serde_with::serde_as]
6196#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6197pub struct PoiSearchTerms {
6198    /// The search query for the desired POI name, street address, or coordinate of the desired POI. The query can be a prefix, e.g. "Times squar", "40.7505045,-73.99562", "315 W 44th St", etc.
6199    #[serde(rename = "poiQuery")]
6200    pub poi_query: Option<String>,
6201}
6202
6203impl common::Part for PoiSearchTerms {}
6204
6205/// Represents a targetable point of interest(POI). This will be populated in the poi_details field when targeting_type is `TARGETING_TYPE_POI`.
6206///
6207/// This type is not used in any activity, and only used as *part* of another schema.
6208///
6209#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6210#[serde_with::serde_as]
6211#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6212pub struct PoiTargetingOptionDetails {
6213    /// Output only. The display name of a POI(e.g. "Times Square", "Space Needle"), followed by its full address if available.
6214    #[serde(rename = "displayName")]
6215    pub display_name: Option<String>,
6216    /// Output only. Latitude of the POI rounding to 6th decimal place.
6217    pub latitude: Option<f64>,
6218    /// Output only. Longitude of the POI rounding to 6th decimal place.
6219    pub longitude: Option<f64>,
6220}
6221
6222impl common::Part for PoiTargetingOptionDetails {}
6223
6224/// Settings specific to the Mediaocean Prisma tool.
6225///
6226/// This type is not used in any activity, and only used as *part* of another schema.
6227///
6228#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6229#[serde_with::serde_as]
6230#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6231pub struct PrismaConfig {
6232    /// Required. Relevant client, product, and estimate codes from the Mediaocean Prisma tool.
6233    #[serde(rename = "prismaCpeCode")]
6234    pub prisma_cpe_code: Option<PrismaCpeCode>,
6235    /// Required. The Prisma type.
6236    #[serde(rename = "prismaType")]
6237    pub prisma_type: Option<String>,
6238    /// Required. The entity allocated this budget (DSP, site, etc.).
6239    pub supplier: Option<String>,
6240}
6241
6242impl common::Part for PrismaConfig {}
6243
6244/// Google Payments Center supports searching and filtering on the component fields of this code.
6245///
6246/// This type is not used in any activity, and only used as *part* of another schema.
6247///
6248#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6249#[serde_with::serde_as]
6250#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6251pub struct PrismaCpeCode {
6252    /// The Prisma client code.
6253    #[serde(rename = "prismaClientCode")]
6254    pub prisma_client_code: Option<String>,
6255    /// The Prisma estimate code.
6256    #[serde(rename = "prismaEstimateCode")]
6257    pub prisma_estimate_code: Option<String>,
6258    /// The Prisma product code.
6259    #[serde(rename = "prismaProductCode")]
6260    pub prisma_product_code: Option<String>,
6261}
6262
6263impl common::Part for PrismaCpeCode {}
6264
6265/// Targeting details for proximity location list. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_PROXIMITY_LOCATION_LIST`.
6266///
6267/// This type is not used in any activity, and only used as *part* of another schema.
6268///
6269#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6270#[serde_with::serde_as]
6271#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6272pub struct ProximityLocationListAssignedTargetingOptionDetails {
6273    /// Required. ID of the proximity location list. Should refer to the location_list_id field of a LocationList resource whose type is `TARGETING_LOCATION_TYPE_PROXIMITY`.
6274    #[serde(rename = "proximityLocationListId")]
6275    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6276    pub proximity_location_list_id: Option<i64>,
6277    /// Required. Radius range for proximity location list. This represents the size of the area around a chosen location that will be targeted. `All` proximity location targeting under a single resource must have the same radius range value. Set this value to match any existing targeting. If updated, this field will change the radius range for all proximity targeting under the resource.
6278    #[serde(rename = "proximityRadiusRange")]
6279    pub proximity_radius_range: Option<String>,
6280}
6281
6282impl common::Part for ProximityLocationListAssignedTargetingOptionDetails {}
6283
6284/// The rate related settings of the inventory source.
6285///
6286/// This type is not used in any activity, and only used as *part* of another schema.
6287///
6288#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6289#[serde_with::serde_as]
6290#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6291pub struct RateDetails {
6292    /// The rate type. Acceptable values are `INVENTORY_SOURCE_RATE_TYPE_CPM_FIXED`, `INVENTORY_SOURCE_RATE_TYPE_CPM_FLOOR`, and `INVENTORY_SOURCE_RATE_TYPE_CPD`.
6293    #[serde(rename = "inventorySourceRateType")]
6294    pub inventory_source_rate_type: Option<String>,
6295    /// Output only. The amount that the buyer has committed to spending on the inventory source up front. Only applicable for guaranteed inventory sources.
6296    #[serde(rename = "minimumSpend")]
6297    pub minimum_spend: Option<Money>,
6298    /// The rate for the inventory source.
6299    pub rate: Option<Money>,
6300    /// Required for guaranteed inventory sources. The number of impressions guaranteed by the seller.
6301    #[serde(rename = "unitsPurchased")]
6302    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6303    pub units_purchased: Option<i64>,
6304}
6305
6306impl common::Part for RateDetails {}
6307
6308/// Targeting details for regional location list. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_REGIONAL_LOCATION_LIST`.
6309///
6310/// This type is not used in any activity, and only used as *part* of another schema.
6311///
6312#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6313#[serde_with::serde_as]
6314#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6315pub struct RegionalLocationListAssignedTargetingOptionDetails {
6316    /// Indicates if this option is being negatively targeted.
6317    pub negative: Option<bool>,
6318    /// Required. ID of the regional location list. Should refer to the location_list_id field of a LocationList resource whose type is `TARGETING_LOCATION_TYPE_REGIONAL`.
6319    #[serde(rename = "regionalLocationListId")]
6320    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6321    pub regional_location_list_id: Option<i64>,
6322}
6323
6324impl common::Part for RegionalLocationListAssignedTargetingOptionDetails {}
6325
6326/// Request message for NegativeKeywordService.ReplaceNegativeKeywords.
6327///
6328/// # Activities
6329///
6330/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6331/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6332///
6333/// * [negative keyword lists negative keywords replace advertisers](AdvertiserNegativeKeywordListNegativeKeywordReplaceCall) (request)
6334#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6335#[serde_with::serde_as]
6336#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6337pub struct ReplaceNegativeKeywordsRequest {
6338    /// The negative keywords that will replace the existing keywords in the negative keyword list, specified as a list of NegativeKeywords.
6339    #[serde(rename = "newNegativeKeywords")]
6340    pub new_negative_keywords: Option<Vec<NegativeKeyword>>,
6341}
6342
6343impl common::RequestValue for ReplaceNegativeKeywordsRequest {}
6344
6345/// Response message for NegativeKeywordService.ReplaceNegativeKeywords.
6346///
6347/// # Activities
6348///
6349/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6350/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6351///
6352/// * [negative keyword lists negative keywords replace advertisers](AdvertiserNegativeKeywordListNegativeKeywordReplaceCall) (response)
6353#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6354#[serde_with::serde_as]
6355#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6356pub struct ReplaceNegativeKeywordsResponse {
6357    /// The full list of negative keywords now present in the negative keyword list.
6358    #[serde(rename = "negativeKeywords")]
6359    pub negative_keywords: Option<Vec<NegativeKeyword>>,
6360}
6361
6362impl common::ResponseResult for ReplaceNegativeKeywordsResponse {}
6363
6364/// Request message for SiteService.ReplaceSites.
6365///
6366/// # Activities
6367///
6368/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6369/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6370///
6371/// * [channels sites replace advertisers](AdvertiserChannelSiteReplaceCall) (request)
6372/// * [channels sites replace partners](PartnerChannelSiteReplaceCall) (request)
6373#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6374#[serde_with::serde_as]
6375#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6376pub struct ReplaceSitesRequest {
6377    /// The ID of the advertiser that owns the parent channel.
6378    #[serde(rename = "advertiserId")]
6379    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6380    pub advertiser_id: Option<i64>,
6381    /// The sites that will replace the existing sites assigned to the channel, specified as a list of Sites.
6382    #[serde(rename = "newSites")]
6383    pub new_sites: Option<Vec<Site>>,
6384    /// The ID of the partner that owns the parent channel.
6385    #[serde(rename = "partnerId")]
6386    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6387    pub partner_id: Option<i64>,
6388}
6389
6390impl common::RequestValue for ReplaceSitesRequest {}
6391
6392/// Response message for SiteService.ReplaceSites.
6393///
6394/// # Activities
6395///
6396/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6397/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6398///
6399/// * [channels sites replace advertisers](AdvertiserChannelSiteReplaceCall) (response)
6400/// * [channels sites replace partners](PartnerChannelSiteReplaceCall) (response)
6401#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6402#[serde_with::serde_as]
6403#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6404pub struct ReplaceSitesResponse {
6405    /// The list of sites in the channel after replacing.
6406    pub sites: Option<Vec<Site>>,
6407}
6408
6409impl common::ResponseResult for ReplaceSitesResponse {}
6410
6411/// Review statuses for the creative.
6412///
6413/// This type is not used in any activity, and only used as *part* of another schema.
6414///
6415#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6416#[serde_with::serde_as]
6417#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6418pub struct ReviewStatusInfo {
6419    /// Represents the basic approval needed for a creative to begin serving. Summary of creative_and_landing_page_review_status and content_and_policy_review_status.
6420    #[serde(rename = "approvalStatus")]
6421    pub approval_status: Option<String>,
6422    /// Content and policy review status for the creative.
6423    #[serde(rename = "contentAndPolicyReviewStatus")]
6424    pub content_and_policy_review_status: Option<String>,
6425    /// Creative and landing page review status for the creative.
6426    #[serde(rename = "creativeAndLandingPageReviewStatus")]
6427    pub creative_and_landing_page_review_status: Option<String>,
6428    /// Exchange review statuses for the creative.
6429    #[serde(rename = "exchangeReviewStatuses")]
6430    pub exchange_review_statuses: Option<Vec<ExchangeReviewStatus>>,
6431}
6432
6433impl common::Part for ReviewStatusInfo {}
6434
6435/// An error message for a custom bidding script.
6436///
6437/// This type is not used in any activity, and only used as *part* of another schema.
6438///
6439#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6440#[serde_with::serde_as]
6441#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6442pub struct ScriptError {
6443    /// The column number in the script where the error was thrown.
6444    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6445    pub column: Option<i64>,
6446    /// The type of error.
6447    #[serde(rename = "errorCode")]
6448    pub error_code: Option<String>,
6449    /// The detailed error message.
6450    #[serde(rename = "errorMessage")]
6451    pub error_message: Option<String>,
6452    /// The line number in the script where the error was thrown.
6453    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6454    pub line: Option<i64>,
6455}
6456
6457impl common::Part for ScriptError {}
6458
6459/// Structured Data File (SDF) related settings.
6460///
6461/// This type is not used in any activity, and only used as *part* of another schema.
6462///
6463#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6464#[serde_with::serde_as]
6465#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6466pub struct SdfConfig {
6467    /// An administrator email address to which the SDF processing status reports will be sent.
6468    #[serde(rename = "adminEmail")]
6469    pub admin_email: Option<String>,
6470    /// Required. The version of SDF being used.
6471    pub version: Option<String>,
6472}
6473
6474impl common::Part for SdfConfig {}
6475
6476/// Request message for SearchTargetingOptions.
6477///
6478/// # Activities
6479///
6480/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6481/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6482///
6483/// * [targeting options search targeting types](TargetingTypeTargetingOptionSearchCall) (request)
6484#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6485#[serde_with::serde_as]
6486#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6487pub struct SearchTargetingOptionsRequest {
6488    /// Required. The Advertiser this request is being made in the context of.
6489    #[serde(rename = "advertiserId")]
6490    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6491    pub advertiser_id: Option<i64>,
6492    /// Search terms for Business Chain targeting options. Can only be used when targeting_type is `TARGETING_TYPE_BUSINESS_CHAIN`.
6493    #[serde(rename = "businessChainSearchTerms")]
6494    pub business_chain_search_terms: Option<BusinessChainSearchTerms>,
6495    /// Search terms for geo region targeting options. Can only be used when targeting_type is `TARGETING_TYPE_GEO_REGION`.
6496    #[serde(rename = "geoRegionSearchTerms")]
6497    pub geo_region_search_terms: Option<GeoRegionSearchTerms>,
6498    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
6499    #[serde(rename = "pageSize")]
6500    pub page_size: Option<i32>,
6501    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `SearchTargetingOptions` method. If not specified, the first page of results will be returned.
6502    #[serde(rename = "pageToken")]
6503    pub page_token: Option<String>,
6504    /// Search terms for POI targeting options. Can only be used when targeting_type is `TARGETING_TYPE_POI`.
6505    #[serde(rename = "poiSearchTerms")]
6506    pub poi_search_terms: Option<PoiSearchTerms>,
6507}
6508
6509impl common::RequestValue for SearchTargetingOptionsRequest {}
6510
6511/// Response message for SearchTargetingOptions.
6512///
6513/// # Activities
6514///
6515/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6516/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6517///
6518/// * [targeting options search targeting types](TargetingTypeTargetingOptionSearchCall) (response)
6519#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6520#[serde_with::serde_as]
6521#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6522pub struct SearchTargetingOptionsResponse {
6523    /// A token to retrieve the next page of results. Pass this value in the page_token field in the subsequent call to `SearchTargetingOptions` method to retrieve the next page of results.
6524    #[serde(rename = "nextPageToken")]
6525    pub next_page_token: Option<String>,
6526    /// The list of targeting options that match the search criteria. This list will be absent if empty.
6527    #[serde(rename = "targetingOptions")]
6528    pub targeting_options: Option<Vec<TargetingOption>>,
6529}
6530
6531impl common::ResponseResult for SearchTargetingOptionsResponse {}
6532
6533/// Targeting details for sensitive category. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION`.
6534///
6535/// This type is not used in any activity, and only used as *part* of another schema.
6536///
6537#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6538#[serde_with::serde_as]
6539#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6540pub struct SensitiveCategoryAssignedTargetingOptionDetails {
6541    /// Required. ID of the sensitive category to be EXCLUDED.
6542    #[serde(rename = "excludedTargetingOptionId")]
6543    pub excluded_targeting_option_id: Option<String>,
6544    /// Output only. An enum for the DV360 Sensitive category content classifier.
6545    #[serde(rename = "sensitiveCategory")]
6546    pub sensitive_category: Option<String>,
6547}
6548
6549impl common::Part for SensitiveCategoryAssignedTargetingOptionDetails {}
6550
6551/// Represents a targetable sensitive category. This will be populated in the sensitive_category_details field of the TargetingOption when targeting_type is `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION`.
6552///
6553/// This type is not used in any activity, and only used as *part* of another schema.
6554///
6555#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6556#[serde_with::serde_as]
6557#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6558pub struct SensitiveCategoryTargetingOptionDetails {
6559    /// Output only. An enum for the DV360 Sensitive category content classifier.
6560    #[serde(rename = "sensitiveCategory")]
6561    pub sensitive_category: Option<String>,
6562}
6563
6564impl common::Part for SensitiveCategoryTargetingOptionDetails {}
6565
6566/// A single site. Sites are apps or websites belonging to a channel.
6567///
6568/// # Activities
6569///
6570/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6571/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6572///
6573/// * [channels sites create advertisers](AdvertiserChannelSiteCreateCall) (request|response)
6574/// * [channels sites create partners](PartnerChannelSiteCreateCall) (request|response)
6575#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6576#[serde_with::serde_as]
6577#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6578pub struct Site {
6579    /// Output only. The resource name of the site.
6580    pub name: Option<String>,
6581    /// Required. The app ID or URL of the site. Must be UTF-8 encoded with a maximum length of 240 bytes.
6582    #[serde(rename = "urlOrAppId")]
6583    pub url_or_app_id: Option<String>,
6584}
6585
6586impl common::RequestValue for Site {}
6587impl common::ResponseResult for Site {}
6588
6589/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
6590///
6591/// This type is not used in any activity, and only used as *part* of another schema.
6592///
6593#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6594#[serde_with::serde_as]
6595#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6596pub struct Status {
6597    /// The status code, which should be an enum value of google.rpc.Code.
6598    pub code: Option<i32>,
6599    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
6600    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
6601    /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
6602    pub message: Option<String>,
6603}
6604
6605impl common::Part for Status {}
6606
6607/// Details for assigned sub-exchange targeting option. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_SUB_EXCHANGE`.
6608///
6609/// This type is not used in any activity, and only used as *part* of another schema.
6610///
6611#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6612#[serde_with::serde_as]
6613#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6614pub struct SubExchangeAssignedTargetingOptionDetails {
6615    /// Required. The targeting_option_id of a TargetingOption of type `TARGETING_TYPE_SUB_EXCHANGE`.
6616    #[serde(rename = "targetingOptionId")]
6617    pub targeting_option_id: Option<String>,
6618}
6619
6620impl common::Part for SubExchangeAssignedTargetingOptionDetails {}
6621
6622/// Represents a targetable sub-exchange. This will be populated in the sub_exchange_details field of a TargetingOption when targeting_type is `TARGETING_TYPE_SUB_EXCHANGE`.
6623///
6624/// This type is not used in any activity, and only used as *part* of another schema.
6625///
6626#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6627#[serde_with::serde_as]
6628#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6629pub struct SubExchangeTargetingOptionDetails {
6630    /// Output only. The display name of the sub-exchange.
6631    #[serde(rename = "displayName")]
6632    pub display_name: Option<String>,
6633}
6634
6635impl common::Part for SubExchangeTargetingOptionDetails {}
6636
6637/// Settings that control the [optimized targeting](https://developers.google.com//support.google.com/displayvideo/answer/12060859) settings of the line item.
6638///
6639/// This type is not used in any activity, and only used as *part* of another schema.
6640#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6641#[serde_with::serde_as]
6642#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6643pub struct TargetingExpansionConfig {
6644    /// Whether to exclude first-party audiences from use in targeting expansion. This field was deprecated with the launch of [optimized targeting](https://developers.google.com//support.google.com/displayvideo/answer/12060859). This field will be set to `false`. If this field is set to `true` when deprecated, all positive first-party audience targeting assigned to this line item will be replaced with negative targeting of the same first-party audiences to ensure the continued exclusion of those audiences.
6645    #[serde(rename = "excludeFirstPartyAudience")]
6646    pub exclude_first_party_audience: Option<bool>,
6647    /// Required. Whether optimized targeting is turned on. This field supports the following values: * `NO_EXPANSION`: optimized targeting is turned off * `LEAST_EXPANSION`: optimized targeting is turned on If this field is set to any other value, it will automatically be set to `LEAST_EXPANSION`. `NO_EXPANSION` will be the default value for the field and will be automatically assigned if you do not set the field.
6648    #[serde(rename = "targetingExpansionLevel")]
6649    pub targeting_expansion_level: Option<String>,
6650}
6651
6652impl common::Part for TargetingExpansionConfig {}
6653
6654/// Represents a single targeting option, which is a targetable concept in DV360.
6655///
6656/// # Activities
6657///
6658/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6659/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6660///
6661/// * [targeting options get targeting types](TargetingTypeTargetingOptionGetCall) (response)
6662#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6663#[serde_with::serde_as]
6664#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6665pub struct TargetingOption {
6666    /// Age range details.
6667    #[serde(rename = "ageRangeDetails")]
6668    pub age_range_details: Option<AgeRangeTargetingOptionDetails>,
6669    /// App category details.
6670    #[serde(rename = "appCategoryDetails")]
6671    pub app_category_details: Option<AppCategoryTargetingOptionDetails>,
6672    /// Audio content type details.
6673    #[serde(rename = "audioContentTypeDetails")]
6674    pub audio_content_type_details: Option<AudioContentTypeTargetingOptionDetails>,
6675    /// Authorized seller status resource details.
6676    #[serde(rename = "authorizedSellerStatusDetails")]
6677    pub authorized_seller_status_details: Option<AuthorizedSellerStatusTargetingOptionDetails>,
6678    /// Browser details.
6679    #[serde(rename = "browserDetails")]
6680    pub browser_details: Option<BrowserTargetingOptionDetails>,
6681    /// Business chain resource details.
6682    #[serde(rename = "businessChainDetails")]
6683    pub business_chain_details: Option<BusinessChainTargetingOptionDetails>,
6684    /// Carrier and ISP details.
6685    #[serde(rename = "carrierAndIspDetails")]
6686    pub carrier_and_isp_details: Option<CarrierAndIspTargetingOptionDetails>,
6687    /// Category resource details.
6688    #[serde(rename = "categoryDetails")]
6689    pub category_details: Option<CategoryTargetingOptionDetails>,
6690    /// Content duration resource details.
6691    #[serde(rename = "contentDurationDetails")]
6692    pub content_duration_details: Option<ContentDurationTargetingOptionDetails>,
6693    /// Content genre resource details.
6694    #[serde(rename = "contentGenreDetails")]
6695    pub content_genre_details: Option<ContentGenreTargetingOptionDetails>,
6696    /// Content instream position details.
6697    #[serde(rename = "contentInstreamPositionDetails")]
6698    pub content_instream_position_details: Option<ContentInstreamPositionTargetingOptionDetails>,
6699    /// Content outstream position details.
6700    #[serde(rename = "contentOutstreamPositionDetails")]
6701    pub content_outstream_position_details: Option<ContentOutstreamPositionTargetingOptionDetails>,
6702    /// Content stream type resource details.
6703    #[serde(rename = "contentStreamTypeDetails")]
6704    pub content_stream_type_details: Option<ContentStreamTypeTargetingOptionDetails>,
6705    /// Device make and model resource details.
6706    #[serde(rename = "deviceMakeModelDetails")]
6707    pub device_make_model_details: Option<DeviceMakeModelTargetingOptionDetails>,
6708    /// Device type details.
6709    #[serde(rename = "deviceTypeDetails")]
6710    pub device_type_details: Option<DeviceTypeTargetingOptionDetails>,
6711    /// Digital content label details.
6712    #[serde(rename = "digitalContentLabelDetails")]
6713    pub digital_content_label_details: Option<DigitalContentLabelTargetingOptionDetails>,
6714    /// Environment details.
6715    #[serde(rename = "environmentDetails")]
6716    pub environment_details: Option<EnvironmentTargetingOptionDetails>,
6717    /// Exchange details.
6718    #[serde(rename = "exchangeDetails")]
6719    pub exchange_details: Option<ExchangeTargetingOptionDetails>,
6720    /// Gender details.
6721    #[serde(rename = "genderDetails")]
6722    pub gender_details: Option<GenderTargetingOptionDetails>,
6723    /// Geographic region resource details.
6724    #[serde(rename = "geoRegionDetails")]
6725    pub geo_region_details: Option<GeoRegionTargetingOptionDetails>,
6726    /// Household income details.
6727    #[serde(rename = "householdIncomeDetails")]
6728    pub household_income_details: Option<HouseholdIncomeTargetingOptionDetails>,
6729    /// Language resource details.
6730    #[serde(rename = "languageDetails")]
6731    pub language_details: Option<LanguageTargetingOptionDetails>,
6732    /// Output only. The resource name for this targeting option.
6733    pub name: Option<String>,
6734    /// Native content position details.
6735    #[serde(rename = "nativeContentPositionDetails")]
6736    pub native_content_position_details: Option<NativeContentPositionTargetingOptionDetails>,
6737    /// Open Measurement enabled inventory details.
6738    #[serde(rename = "omidDetails")]
6739    pub omid_details: Option<OmidTargetingOptionDetails>,
6740    /// On screen position details.
6741    #[serde(rename = "onScreenPositionDetails")]
6742    pub on_screen_position_details: Option<OnScreenPositionTargetingOptionDetails>,
6743    /// Operating system resources details.
6744    #[serde(rename = "operatingSystemDetails")]
6745    pub operating_system_details: Option<OperatingSystemTargetingOptionDetails>,
6746    /// Parental status details.
6747    #[serde(rename = "parentalStatusDetails")]
6748    pub parental_status_details: Option<ParentalStatusTargetingOptionDetails>,
6749    /// POI resource details.
6750    #[serde(rename = "poiDetails")]
6751    pub poi_details: Option<PoiTargetingOptionDetails>,
6752    /// Sensitive Category details.
6753    #[serde(rename = "sensitiveCategoryDetails")]
6754    pub sensitive_category_details: Option<SensitiveCategoryTargetingOptionDetails>,
6755    /// Sub-exchange details.
6756    #[serde(rename = "subExchangeDetails")]
6757    pub sub_exchange_details: Option<SubExchangeTargetingOptionDetails>,
6758    /// Output only. A unique identifier for this targeting option. The tuple {`targeting_type`, `targeting_option_id`} will be unique.
6759    #[serde(rename = "targetingOptionId")]
6760    pub targeting_option_id: Option<String>,
6761    /// Output only. The type of this targeting option.
6762    #[serde(rename = "targetingType")]
6763    pub targeting_type: Option<String>,
6764    /// User rewarded content details.
6765    #[serde(rename = "userRewardedContentDetails")]
6766    pub user_rewarded_content_details: Option<UserRewardedContentTargetingOptionDetails>,
6767    /// Video player size details.
6768    #[serde(rename = "videoPlayerSizeDetails")]
6769    pub video_player_size_details: Option<VideoPlayerSizeTargetingOptionDetails>,
6770    /// Viewability resource details.
6771    #[serde(rename = "viewabilityDetails")]
6772    pub viewability_details: Option<ViewabilityTargetingOptionDetails>,
6773}
6774
6775impl common::ResponseResult for TargetingOption {}
6776
6777/// Settings for advertisers that use third-party ad servers only.
6778///
6779/// This type is not used in any activity, and only used as *part* of another schema.
6780///
6781#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6782#[serde_with::serde_as]
6783#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6784pub struct ThirdPartyOnlyConfig {
6785    /// Whether or not order ID reporting for pixels is enabled. This value cannot be changed once set to `true`.
6786    #[serde(rename = "pixelOrderIdReportingEnabled")]
6787    pub pixel_order_id_reporting_enabled: Option<bool>,
6788}
6789
6790impl common::Part for ThirdPartyOnlyConfig {}
6791
6792/// Tracking URLs from third parties to track interactions with an audio or a video creative.
6793///
6794/// This type is not used in any activity, and only used as *part* of another schema.
6795///
6796#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6797#[serde_with::serde_as]
6798#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6799pub struct ThirdPartyUrl {
6800    /// The type of interaction needs to be tracked by the tracking URL
6801    #[serde(rename = "type")]
6802    pub type_: Option<String>,
6803    /// Tracking URL used to track the interaction. Provide a URL with optional path or query string, beginning with `https:`. For example, https://www.example.com/path
6804    pub url: Option<String>,
6805}
6806
6807impl common::Part for ThirdPartyUrl {}
6808
6809/// Assigned third party verifier targeting option details. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_THIRD_PARTY_VERIFIER`.
6810///
6811/// This type is not used in any activity, and only used as *part* of another schema.
6812///
6813#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6814#[serde_with::serde_as]
6815#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6816pub struct ThirdPartyVerifierAssignedTargetingOptionDetails {
6817    /// Third party brand verifier -- Adloox.
6818    pub adloox: Option<Adloox>,
6819    /// Third party brand verifier -- DoubleVerify.
6820    #[serde(rename = "doubleVerify")]
6821    pub double_verify: Option<DoubleVerify>,
6822    /// Third party brand verifier -- Integral Ad Science.
6823    #[serde(rename = "integralAdScience")]
6824    pub integral_ad_science: Option<IntegralAdScience>,
6825}
6826
6827impl common::Part for ThirdPartyVerifierAssignedTargetingOptionDetails {}
6828
6829/// A time range.
6830///
6831/// This type is not used in any activity, and only used as *part* of another schema.
6832///
6833#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6834#[serde_with::serde_as]
6835#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6836pub struct TimeRange {
6837    /// Required. The upper bound of a time range, inclusive.
6838    #[serde(rename = "endTime")]
6839    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
6840    /// Required. The lower bound of a time range, inclusive.
6841    #[serde(rename = "startTime")]
6842    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
6843}
6844
6845impl common::Part for TimeRange {}
6846
6847/// Timer event of the creative.
6848///
6849/// This type is not used in any activity, and only used as *part* of another schema.
6850///
6851#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6852#[serde_with::serde_as]
6853#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6854pub struct TimerEvent {
6855    /// Required. The name of the timer event.
6856    pub name: Option<String>,
6857    /// Required. The name used to identify this timer event in reports.
6858    #[serde(rename = "reportingName")]
6859    pub reporting_name: Option<String>,
6860}
6861
6862impl common::Part for TimerEvent {}
6863
6864/// Settings that control the behavior of a single Floodlight activity config.
6865///
6866/// This type is not used in any activity, and only used as *part* of another schema.
6867///
6868#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6869#[serde_with::serde_as]
6870#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6871pub struct TrackingFloodlightActivityConfig {
6872    /// Required. The ID of the Floodlight activity.
6873    #[serde(rename = "floodlightActivityId")]
6874    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6875    pub floodlight_activity_id: Option<i64>,
6876    /// Required. The number of days after an ad has been clicked in which a conversion may be counted. Must be between 0 and 90 inclusive.
6877    #[serde(rename = "postClickLookbackWindowDays")]
6878    pub post_click_lookback_window_days: Option<i32>,
6879    /// Required. The number of days after an ad has been viewed in which a conversion may be counted. Must be between 0 and 90 inclusive.
6880    #[serde(rename = "postViewLookbackWindowDays")]
6881    pub post_view_lookback_window_days: Option<i32>,
6882}
6883
6884impl common::Part for TrackingFloodlightActivityConfig {}
6885
6886/// Represents information about the transcoded audio or video file.
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 Transcode {
6894    /// The bit rate for the audio stream of the transcoded video, or the bit rate for the transcoded audio, in kilobits per second.
6895    #[serde(rename = "audioBitRateKbps")]
6896    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6897    pub audio_bit_rate_kbps: Option<i64>,
6898    /// The sample rate for the audio stream of the transcoded video, or the sample rate for the transcoded audio, in hertz.
6899    #[serde(rename = "audioSampleRateHz")]
6900    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6901    pub audio_sample_rate_hz: Option<i64>,
6902    /// The transcoding bit rate of the transcoded video, in kilobits per second.
6903    #[serde(rename = "bitRateKbps")]
6904    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6905    pub bit_rate_kbps: Option<i64>,
6906    /// The dimensions of the transcoded video.
6907    pub dimensions: Option<Dimensions>,
6908    /// The size of the transcoded file, in bytes.
6909    #[serde(rename = "fileSizeBytes")]
6910    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6911    pub file_size_bytes: Option<i64>,
6912    /// The frame rate of the transcoded video, in frames per second.
6913    #[serde(rename = "frameRate")]
6914    pub frame_rate: Option<f32>,
6915    /// The MIME type of the transcoded file.
6916    #[serde(rename = "mimeType")]
6917    pub mime_type: Option<String>,
6918    /// The name of the transcoded file.
6919    pub name: Option<String>,
6920    /// Indicates if the transcoding was successful.
6921    pub transcoded: Option<bool>,
6922}
6923
6924impl common::Part for Transcode {}
6925
6926/// A creative identifier provided by a registry that is unique across all platforms. This is part of the VAST 4.0 standard.
6927///
6928/// This type is not used in any activity, and only used as *part* of another schema.
6929///
6930#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6931#[serde_with::serde_as]
6932#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6933pub struct UniversalAdId {
6934    /// The unique creative identifier.
6935    pub id: Option<String>,
6936    /// The registry provides unique creative identifiers.
6937    pub registry: Option<String>,
6938}
6939
6940impl common::Part for UniversalAdId {}
6941
6942/// Details for assigned URL targeting option. This will be populated in the details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_URL`.
6943///
6944/// This type is not used in any activity, and only used as *part* of another schema.
6945///
6946#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6947#[serde_with::serde_as]
6948#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6949pub struct UrlAssignedTargetingOptionDetails {
6950    /// Indicates if this option is being negatively targeted.
6951    pub negative: Option<bool>,
6952    /// Required. The URL, for example `example.com`. DV360 supports two levels of subdirectory targeting, for example `www.example.com/one-subdirectory-level/second-level`, and five levels of subdomain targeting, for example `five.four.three.two.one.example.com`.
6953    pub url: Option<String>,
6954}
6955
6956impl common::Part for UrlAssignedTargetingOptionDetails {}
6957
6958/// A single user in Display & Video 360.
6959///
6960/// # Activities
6961///
6962/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6963/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6964///
6965/// * [bulk edit assigned user roles users](UserBulkEditAssignedUserRoleCall) (none)
6966/// * [create users](UserCreateCall) (request|response)
6967/// * [delete users](UserDeleteCall) (none)
6968/// * [get users](UserGetCall) (response)
6969/// * [list users](UserListCall) (none)
6970/// * [patch users](UserPatchCall) (request|response)
6971#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6972#[serde_with::serde_as]
6973#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6974pub struct User {
6975    /// The assigned user roles. Required in CreateUser. Output only in UpdateUser. Can only be updated through BulkEditAssignedUserRoles.
6976    #[serde(rename = "assignedUserRoles")]
6977    pub assigned_user_roles: Option<Vec<AssignedUserRole>>,
6978    /// Required. The display name of the user. Must be UTF-8 encoded with a maximum size of 240 bytes.
6979    #[serde(rename = "displayName")]
6980    pub display_name: Option<String>,
6981    /// Required. Immutable. The email address used to identify the user.
6982    pub email: Option<String>,
6983    /// Output only. The timestamp when the user last logged in DV360 UI.
6984    #[serde(rename = "lastLoginTime")]
6985    pub last_login_time: Option<chrono::DateTime<chrono::offset::Utc>>,
6986    /// Output only. The resource name of the user.
6987    pub name: Option<String>,
6988    /// Output only. The unique ID of the user. Assigned by the system.
6989    #[serde(rename = "userId")]
6990    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6991    pub user_id: Option<i64>,
6992}
6993
6994impl common::RequestValue for User {}
6995impl common::Resource for User {}
6996impl common::ResponseResult for User {}
6997
6998/// User rewarded content targeting option details. This will be populated in the user_rewarded_content_details field when targeting_type is `TARGETING_TYPE_USER_REWARDED_CONTENT`.
6999///
7000/// This type is not used in any activity, and only used as *part* of another schema.
7001///
7002#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7003#[serde_with::serde_as]
7004#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7005pub struct UserRewardedContentAssignedTargetingOptionDetails {
7006    /// Required. The targeting_option_id field when targeting_type is `TARGETING_TYPE_USER_REWARDED_CONTENT`.
7007    #[serde(rename = "targetingOptionId")]
7008    pub targeting_option_id: Option<String>,
7009    /// Output only. User rewarded content status for video ads.
7010    #[serde(rename = "userRewardedContent")]
7011    pub user_rewarded_content: Option<String>,
7012}
7013
7014impl common::Part for UserRewardedContentAssignedTargetingOptionDetails {}
7015
7016/// Represents a targetable user rewarded content status for video ads only. This will be populated in the user_rewarded_content_details field when targeting_type is `TARGETING_TYPE_USER_REWARDED_CONTENT`.
7017///
7018/// This type is not used in any activity, and only used as *part* of another schema.
7019///
7020#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7021#[serde_with::serde_as]
7022#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7023pub struct UserRewardedContentTargetingOptionDetails {
7024    /// Output only. User rewarded content status for video ads.
7025    #[serde(rename = "userRewardedContent")]
7026    pub user_rewarded_content: Option<String>,
7027}
7028
7029impl common::Part for UserRewardedContentTargetingOptionDetails {}
7030
7031/// Video player size targeting option details. This will be populated in the video_player_size_details field when targeting_type is `TARGETING_TYPE_VIDEO_PLAYER_SIZE`. Explicitly targeting all options is not supported. Remove all video player size targeting options to achieve this effect.
7032///
7033/// This type is not used in any activity, and only used as *part* of another schema.
7034///
7035#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7036#[serde_with::serde_as]
7037#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7038pub struct VideoPlayerSizeAssignedTargetingOptionDetails {
7039    /// Required. The targeting_option_id field when targeting_type is `TARGETING_TYPE_VIDEO_PLAYER_SIZE`.
7040    #[serde(rename = "targetingOptionId")]
7041    pub targeting_option_id: Option<String>,
7042    /// Required. The video player size.
7043    #[serde(rename = "videoPlayerSize")]
7044    pub video_player_size: Option<String>,
7045}
7046
7047impl common::Part for VideoPlayerSizeAssignedTargetingOptionDetails {}
7048
7049/// Represents a targetable video player size. This will be populated in the video_player_size_details field when targeting_type is `TARGETING_TYPE_VIDEO_PLAYER_SIZE`.
7050///
7051/// This type is not used in any activity, and only used as *part* of another schema.
7052///
7053#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7054#[serde_with::serde_as]
7055#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7056pub struct VideoPlayerSizeTargetingOptionDetails {
7057    /// Output only. The video player size.
7058    #[serde(rename = "videoPlayerSize")]
7059    pub video_player_size: Option<String>,
7060}
7061
7062impl common::Part for VideoPlayerSizeTargetingOptionDetails {}
7063
7064/// Assigned viewability targeting option details. This will be populated in the viewability_details field of an AssignedTargetingOption when targeting_type is `TARGETING_TYPE_VIEWABILITY`.
7065///
7066/// This type is not used in any activity, and only used as *part* of another schema.
7067///
7068#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7069#[serde_with::serde_as]
7070#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7071pub struct ViewabilityAssignedTargetingOptionDetails {
7072    /// Required. The targeting_option_id of a TargetingOption of type `TARGETING_TYPE_VIEWABILITY` (e.g., "509010" for targeting the `VIEWABILITY_10_PERCENT_OR_MORE` option).
7073    #[serde(rename = "targetingOptionId")]
7074    pub targeting_option_id: Option<String>,
7075    /// Required. The predicted viewability percentage.
7076    pub viewability: Option<String>,
7077}
7078
7079impl common::Part for ViewabilityAssignedTargetingOptionDetails {}
7080
7081/// Represents a targetable viewability. This will be populated in the viewability_details field of a TargetingOption when targeting_type is `TARGETING_TYPE_VIEWABILITY`.
7082///
7083/// This type is not used in any activity, and only used as *part* of another schema.
7084///
7085#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7086#[serde_with::serde_as]
7087#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7088pub struct ViewabilityTargetingOptionDetails {
7089    /// Output only. The predicted viewability percentage.
7090    pub viewability: Option<String>,
7091}
7092
7093impl common::Part for ViewabilityTargetingOptionDetails {}
7094
7095// ###################
7096// MethodBuilders ###
7097// #################
7098
7099/// A builder providing access to all methods supported on *advertiser* resources.
7100/// It is not used directly, but through the [`DisplayVideo`] hub.
7101///
7102/// # Example
7103///
7104/// Instantiate a resource builder
7105///
7106/// ```test_harness,no_run
7107/// extern crate hyper;
7108/// extern crate hyper_rustls;
7109/// extern crate google_displayvideo1 as displayvideo1;
7110///
7111/// # async fn dox() {
7112/// use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7113///
7114/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7115/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7116///     secret,
7117///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7118/// ).build().await.unwrap();
7119///
7120/// let client = hyper_util::client::legacy::Client::builder(
7121///     hyper_util::rt::TokioExecutor::new()
7122/// )
7123/// .build(
7124///     hyper_rustls::HttpsConnectorBuilder::new()
7125///         .with_native_roots()
7126///         .unwrap()
7127///         .https_or_http()
7128///         .enable_http1()
7129///         .build()
7130/// );
7131/// let mut hub = DisplayVideo::new(client, auth);
7132/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7133/// // like `assets_upload(...)`, `audit(...)`, `bulk_edit_advertiser_assigned_targeting_options(...)`, `bulk_list_advertiser_assigned_targeting_options(...)`, `campaigns_bulk_list_campaign_assigned_targeting_options(...)`, `campaigns_create(...)`, `campaigns_delete(...)`, `campaigns_get(...)`, `campaigns_list(...)`, `campaigns_patch(...)`, `campaigns_targeting_types_assigned_targeting_options_get(...)`, `campaigns_targeting_types_assigned_targeting_options_list(...)`, `channels_create(...)`, `channels_get(...)`, `channels_list(...)`, `channels_patch(...)`, `channels_sites_bulk_edit(...)`, `channels_sites_create(...)`, `channels_sites_delete(...)`, `channels_sites_list(...)`, `channels_sites_replace(...)`, `create(...)`, `creatives_create(...)`, `creatives_delete(...)`, `creatives_get(...)`, `creatives_list(...)`, `creatives_patch(...)`, `delete(...)`, `get(...)`, `insertion_orders_bulk_list_insertion_order_assigned_targeting_options(...)`, `insertion_orders_create(...)`, `insertion_orders_delete(...)`, `insertion_orders_get(...)`, `insertion_orders_list(...)`, `insertion_orders_patch(...)`, `insertion_orders_targeting_types_assigned_targeting_options_get(...)`, `insertion_orders_targeting_types_assigned_targeting_options_list(...)`, `invoices_list(...)`, `invoices_lookup_invoice_currency(...)`, `line_items_bulk_edit_line_item_assigned_targeting_options(...)`, `line_items_bulk_list_line_item_assigned_targeting_options(...)`, `line_items_create(...)`, `line_items_delete(...)`, `line_items_generate_default(...)`, `line_items_get(...)`, `line_items_list(...)`, `line_items_patch(...)`, `line_items_targeting_types_assigned_targeting_options_create(...)`, `line_items_targeting_types_assigned_targeting_options_delete(...)`, `line_items_targeting_types_assigned_targeting_options_get(...)`, `line_items_targeting_types_assigned_targeting_options_list(...)`, `list(...)`, `location_lists_assigned_locations_bulk_edit(...)`, `location_lists_assigned_locations_create(...)`, `location_lists_assigned_locations_delete(...)`, `location_lists_assigned_locations_list(...)`, `location_lists_create(...)`, `location_lists_get(...)`, `location_lists_list(...)`, `location_lists_patch(...)`, `manual_triggers_activate(...)`, `manual_triggers_create(...)`, `manual_triggers_deactivate(...)`, `manual_triggers_get(...)`, `manual_triggers_list(...)`, `manual_triggers_patch(...)`, `negative_keyword_lists_create(...)`, `negative_keyword_lists_delete(...)`, `negative_keyword_lists_get(...)`, `negative_keyword_lists_list(...)`, `negative_keyword_lists_negative_keywords_bulk_edit(...)`, `negative_keyword_lists_negative_keywords_create(...)`, `negative_keyword_lists_negative_keywords_delete(...)`, `negative_keyword_lists_negative_keywords_list(...)`, `negative_keyword_lists_negative_keywords_replace(...)`, `negative_keyword_lists_patch(...)`, `patch(...)`, `targeting_types_assigned_targeting_options_create(...)`, `targeting_types_assigned_targeting_options_delete(...)`, `targeting_types_assigned_targeting_options_get(...)` and `targeting_types_assigned_targeting_options_list(...)`
7134/// // to build up your call.
7135/// let rb = hub.advertisers();
7136/// # }
7137/// ```
7138pub struct AdvertiserMethods<'a, C>
7139where
7140    C: 'a,
7141{
7142    hub: &'a DisplayVideo<C>,
7143}
7144
7145impl<'a, C> common::MethodsBuilder for AdvertiserMethods<'a, C> {}
7146
7147impl<'a, C> AdvertiserMethods<'a, C> {
7148    /// Create a builder to help you perform the following task:
7149    ///
7150    /// Uploads an asset. Returns the ID of the newly uploaded asset if successful. The asset file size should be no more than 10 MB for images, 200 MB for ZIP files, and 1 GB for videos. Must be used within the [multipart media upload process](https://developers.google.com/display-video/api/guides/how-tos/upload#multipart). Examples using provided client libraries can be found in our [Creating Creatives guide](https://developers.google.com/display-video/api/guides/creating-creatives/overview#upload_an_asset).
7151    ///
7152    /// # Arguments
7153    ///
7154    /// * `request` - No description provided.
7155    /// * `advertiserId` - Required. The ID of the advertiser this asset belongs to.
7156    pub fn assets_upload(
7157        &self,
7158        request: CreateAssetRequest,
7159        advertiser_id: i64,
7160    ) -> AdvertiserAssetUploadCall<'a, C> {
7161        AdvertiserAssetUploadCall {
7162            hub: self.hub,
7163            _request: request,
7164            _advertiser_id: advertiser_id,
7165            _delegate: Default::default(),
7166            _additional_params: Default::default(),
7167            _scopes: Default::default(),
7168        }
7169    }
7170
7171    /// Create a builder to help you perform the following task:
7172    ///
7173    /// Gets a single targeting option assigned to a campaign.
7174    ///
7175    /// # Arguments
7176    ///
7177    /// * `advertiserId` - Required. The ID of the advertiser the campaign belongs to.
7178    /// * `campaignId` - Required. The ID of the campaign the assigned targeting option belongs to.
7179    /// * `targetingType` - Required. Identifies the type of this assigned targeting option. Supported targeting types: * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_INVENTORY_SOURCE` * `TARGETING_TYPE_INVENTORY_SOURCE_GROUP` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_THIRD_PARTY_VERIFIER` * `TARGETING_TYPE_VIEWABILITY`
7180    /// * `assignedTargetingOptionId` - Required. An identifier unique to the targeting type in this campaign that identifies the assigned targeting option being requested.
7181    pub fn campaigns_targeting_types_assigned_targeting_options_get(
7182        &self,
7183        advertiser_id: i64,
7184        campaign_id: i64,
7185        targeting_type: &str,
7186        assigned_targeting_option_id: &str,
7187    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
7188        AdvertiserCampaignTargetingTypeAssignedTargetingOptionGetCall {
7189            hub: self.hub,
7190            _advertiser_id: advertiser_id,
7191            _campaign_id: campaign_id,
7192            _targeting_type: targeting_type.to_string(),
7193            _assigned_targeting_option_id: assigned_targeting_option_id.to_string(),
7194            _delegate: Default::default(),
7195            _additional_params: Default::default(),
7196            _scopes: Default::default(),
7197        }
7198    }
7199
7200    /// Create a builder to help you perform the following task:
7201    ///
7202    /// Lists the targeting options assigned to a campaign for a specified targeting type.
7203    ///
7204    /// # Arguments
7205    ///
7206    /// * `advertiserId` - Required. The ID of the advertiser the campaign belongs to.
7207    /// * `campaignId` - Required. The ID of the campaign to list assigned targeting options for.
7208    /// * `targetingType` - Required. Identifies the type of assigned targeting options to list. Supported targeting types: * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_INVENTORY_SOURCE` * `TARGETING_TYPE_INVENTORY_SOURCE_GROUP` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_THIRD_PARTY_VERIFIER` * `TARGETING_TYPE_VIEWABILITY`
7209    pub fn campaigns_targeting_types_assigned_targeting_options_list(
7210        &self,
7211        advertiser_id: i64,
7212        campaign_id: i64,
7213        targeting_type: &str,
7214    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall<'a, C> {
7215        AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall {
7216            hub: self.hub,
7217            _advertiser_id: advertiser_id,
7218            _campaign_id: campaign_id,
7219            _targeting_type: targeting_type.to_string(),
7220            _page_token: Default::default(),
7221            _page_size: Default::default(),
7222            _order_by: Default::default(),
7223            _filter: Default::default(),
7224            _delegate: Default::default(),
7225            _additional_params: Default::default(),
7226            _scopes: Default::default(),
7227        }
7228    }
7229
7230    /// Create a builder to help you perform the following task:
7231    ///
7232    /// Lists assigned targeting options of a campaign across targeting types.
7233    ///
7234    /// # Arguments
7235    ///
7236    /// * `advertiserId` - Required. The ID of the advertiser the campaign belongs to.
7237    /// * `campaignId` - Required. The ID of the campaign to list assigned targeting options for.
7238    pub fn campaigns_bulk_list_campaign_assigned_targeting_options(
7239        &self,
7240        advertiser_id: i64,
7241        campaign_id: i64,
7242    ) -> AdvertiserCampaignBulkListCampaignAssignedTargetingOptionCall<'a, C> {
7243        AdvertiserCampaignBulkListCampaignAssignedTargetingOptionCall {
7244            hub: self.hub,
7245            _advertiser_id: advertiser_id,
7246            _campaign_id: campaign_id,
7247            _page_token: Default::default(),
7248            _page_size: Default::default(),
7249            _order_by: Default::default(),
7250            _filter: Default::default(),
7251            _delegate: Default::default(),
7252            _additional_params: Default::default(),
7253            _scopes: Default::default(),
7254        }
7255    }
7256
7257    /// Create a builder to help you perform the following task:
7258    ///
7259    /// Creates a new campaign. Returns the newly created campaign if successful.
7260    ///
7261    /// # Arguments
7262    ///
7263    /// * `request` - No description provided.
7264    /// * `advertiserId` - Output only. The unique ID of the advertiser the campaign belongs to.
7265    pub fn campaigns_create(
7266        &self,
7267        request: Campaign,
7268        advertiser_id: i64,
7269    ) -> AdvertiserCampaignCreateCall<'a, C> {
7270        AdvertiserCampaignCreateCall {
7271            hub: self.hub,
7272            _request: request,
7273            _advertiser_id: advertiser_id,
7274            _delegate: Default::default(),
7275            _additional_params: Default::default(),
7276            _scopes: Default::default(),
7277        }
7278    }
7279
7280    /// Create a builder to help you perform the following task:
7281    ///
7282    /// Permanently deletes a campaign. A deleted campaign cannot be recovered. The campaign should be archived first, i.e. set entity_status to `ENTITY_STATUS_ARCHIVED`, to be able to delete it. **This method regularly experiences high latency.** We recommend [increasing your default timeout](https://developers.google.com/display-video/api/guides/best-practices/timeouts#client_library_timeout) to avoid errors.
7283    ///
7284    /// # Arguments
7285    ///
7286    /// * `advertiserId` - The ID of the advertiser this campaign belongs to.
7287    /// * `campaignId` - The ID of the campaign we need to delete.
7288    pub fn campaigns_delete(
7289        &self,
7290        advertiser_id: i64,
7291        campaign_id: i64,
7292    ) -> AdvertiserCampaignDeleteCall<'a, C> {
7293        AdvertiserCampaignDeleteCall {
7294            hub: self.hub,
7295            _advertiser_id: advertiser_id,
7296            _campaign_id: campaign_id,
7297            _delegate: Default::default(),
7298            _additional_params: Default::default(),
7299            _scopes: Default::default(),
7300        }
7301    }
7302
7303    /// Create a builder to help you perform the following task:
7304    ///
7305    /// Gets a campaign.
7306    ///
7307    /// # Arguments
7308    ///
7309    /// * `advertiserId` - Required. The ID of the advertiser this campaign belongs to.
7310    /// * `campaignId` - Required. The ID of the campaign to fetch.
7311    pub fn campaigns_get(
7312        &self,
7313        advertiser_id: i64,
7314        campaign_id: i64,
7315    ) -> AdvertiserCampaignGetCall<'a, C> {
7316        AdvertiserCampaignGetCall {
7317            hub: self.hub,
7318            _advertiser_id: advertiser_id,
7319            _campaign_id: campaign_id,
7320            _delegate: Default::default(),
7321            _additional_params: Default::default(),
7322            _scopes: Default::default(),
7323        }
7324    }
7325
7326    /// Create a builder to help you perform the following task:
7327    ///
7328    /// Lists campaigns in an advertiser. The order is defined by the order_by parameter. If a filter by entity_status is not specified, campaigns with `ENTITY_STATUS_ARCHIVED` will not be included in the results.
7329    ///
7330    /// # Arguments
7331    ///
7332    /// * `advertiserId` - The ID of the advertiser to list campaigns for.
7333    pub fn campaigns_list(&self, advertiser_id: i64) -> AdvertiserCampaignListCall<'a, C> {
7334        AdvertiserCampaignListCall {
7335            hub: self.hub,
7336            _advertiser_id: advertiser_id,
7337            _page_token: Default::default(),
7338            _page_size: Default::default(),
7339            _order_by: Default::default(),
7340            _filter: Default::default(),
7341            _delegate: Default::default(),
7342            _additional_params: Default::default(),
7343            _scopes: Default::default(),
7344        }
7345    }
7346
7347    /// Create a builder to help you perform the following task:
7348    ///
7349    /// Updates an existing campaign. Returns the updated campaign if successful.
7350    ///
7351    /// # Arguments
7352    ///
7353    /// * `request` - No description provided.
7354    /// * `advertiserId` - Output only. The unique ID of the advertiser the campaign belongs to.
7355    /// * `campaignId` - Output only. The unique ID of the campaign. Assigned by the system.
7356    pub fn campaigns_patch(
7357        &self,
7358        request: Campaign,
7359        advertiser_id: i64,
7360        campaign_id: i64,
7361    ) -> AdvertiserCampaignPatchCall<'a, C> {
7362        AdvertiserCampaignPatchCall {
7363            hub: self.hub,
7364            _request: request,
7365            _advertiser_id: advertiser_id,
7366            _campaign_id: campaign_id,
7367            _update_mask: Default::default(),
7368            _delegate: Default::default(),
7369            _additional_params: Default::default(),
7370            _scopes: Default::default(),
7371        }
7372    }
7373
7374    /// Create a builder to help you perform the following task:
7375    ///
7376    /// Bulk edits sites under a single channel. The operation will delete the sites provided in BulkEditSitesRequest.deleted_sites and then create the sites provided in BulkEditSitesRequest.created_sites.
7377    ///
7378    /// # Arguments
7379    ///
7380    /// * `request` - No description provided.
7381    /// * `advertiserId` - The ID of the advertiser that owns the parent channel.
7382    /// * `channelId` - Required. The ID of the parent channel to which the sites belong.
7383    pub fn channels_sites_bulk_edit(
7384        &self,
7385        request: BulkEditSitesRequest,
7386        advertiser_id: i64,
7387        channel_id: i64,
7388    ) -> AdvertiserChannelSiteBulkEditCall<'a, C> {
7389        AdvertiserChannelSiteBulkEditCall {
7390            hub: self.hub,
7391            _request: request,
7392            _advertiser_id: advertiser_id,
7393            _channel_id: channel_id,
7394            _delegate: Default::default(),
7395            _additional_params: Default::default(),
7396            _scopes: Default::default(),
7397        }
7398    }
7399
7400    /// Create a builder to help you perform the following task:
7401    ///
7402    /// Creates a site in a channel.
7403    ///
7404    /// # Arguments
7405    ///
7406    /// * `request` - No description provided.
7407    /// * `advertiserId` - The ID of the advertiser that owns the parent channel.
7408    /// * `channelId` - Required. The ID of the parent channel in which the site will be created.
7409    pub fn channels_sites_create(
7410        &self,
7411        request: Site,
7412        advertiser_id: i64,
7413        channel_id: i64,
7414    ) -> AdvertiserChannelSiteCreateCall<'a, C> {
7415        AdvertiserChannelSiteCreateCall {
7416            hub: self.hub,
7417            _request: request,
7418            _advertiser_id: advertiser_id,
7419            _channel_id: channel_id,
7420            _partner_id: Default::default(),
7421            _delegate: Default::default(),
7422            _additional_params: Default::default(),
7423            _scopes: Default::default(),
7424        }
7425    }
7426
7427    /// Create a builder to help you perform the following task:
7428    ///
7429    /// Deletes a site from a channel.
7430    ///
7431    /// # Arguments
7432    ///
7433    /// * `advertiserId` - The ID of the advertiser that owns the parent channel.
7434    /// * `channelId` - Required. The ID of the parent channel to which the site belongs.
7435    /// * `urlOrAppId` - Required. The URL or app ID of the site to delete.
7436    pub fn channels_sites_delete(
7437        &self,
7438        advertiser_id: i64,
7439        channel_id: i64,
7440        url_or_app_id: &str,
7441    ) -> AdvertiserChannelSiteDeleteCall<'a, C> {
7442        AdvertiserChannelSiteDeleteCall {
7443            hub: self.hub,
7444            _advertiser_id: advertiser_id,
7445            _channel_id: channel_id,
7446            _url_or_app_id: url_or_app_id.to_string(),
7447            _partner_id: Default::default(),
7448            _delegate: Default::default(),
7449            _additional_params: Default::default(),
7450            _scopes: Default::default(),
7451        }
7452    }
7453
7454    /// Create a builder to help you perform the following task:
7455    ///
7456    /// Lists sites in a channel.
7457    ///
7458    /// # Arguments
7459    ///
7460    /// * `advertiserId` - The ID of the advertiser that owns the parent channel.
7461    /// * `channelId` - Required. The ID of the parent channel to which the requested sites belong.
7462    pub fn channels_sites_list(
7463        &self,
7464        advertiser_id: i64,
7465        channel_id: i64,
7466    ) -> AdvertiserChannelSiteListCall<'a, C> {
7467        AdvertiserChannelSiteListCall {
7468            hub: self.hub,
7469            _advertiser_id: advertiser_id,
7470            _channel_id: channel_id,
7471            _partner_id: Default::default(),
7472            _page_token: Default::default(),
7473            _page_size: Default::default(),
7474            _order_by: Default::default(),
7475            _filter: Default::default(),
7476            _delegate: Default::default(),
7477            _additional_params: Default::default(),
7478            _scopes: Default::default(),
7479        }
7480    }
7481
7482    /// Create a builder to help you perform the following task:
7483    ///
7484    /// Replaces all of the sites under a single channel. The operation will replace the sites under a channel with the sites provided in ReplaceSitesRequest.new_sites. **This method regularly experiences high latency.** We recommend [increasing your default timeout](https://developers.google.com/display-video/api/guides/best-practices/timeouts#client_library_timeout) to avoid errors.
7485    ///
7486    /// # Arguments
7487    ///
7488    /// * `request` - No description provided.
7489    /// * `advertiserId` - The ID of the advertiser that owns the parent channel.
7490    /// * `channelId` - Required. The ID of the parent channel whose sites will be replaced.
7491    pub fn channels_sites_replace(
7492        &self,
7493        request: ReplaceSitesRequest,
7494        advertiser_id: i64,
7495        channel_id: i64,
7496    ) -> AdvertiserChannelSiteReplaceCall<'a, C> {
7497        AdvertiserChannelSiteReplaceCall {
7498            hub: self.hub,
7499            _request: request,
7500            _advertiser_id: advertiser_id,
7501            _channel_id: channel_id,
7502            _delegate: Default::default(),
7503            _additional_params: Default::default(),
7504            _scopes: Default::default(),
7505        }
7506    }
7507
7508    /// Create a builder to help you perform the following task:
7509    ///
7510    /// Creates a new channel. Returns the newly created channel if successful.
7511    ///
7512    /// # Arguments
7513    ///
7514    /// * `request` - No description provided.
7515    /// * `advertiserId` - The ID of the advertiser that owns the created channel.
7516    pub fn channels_create(
7517        &self,
7518        request: Channel,
7519        advertiser_id: i64,
7520    ) -> AdvertiserChannelCreateCall<'a, C> {
7521        AdvertiserChannelCreateCall {
7522            hub: self.hub,
7523            _request: request,
7524            _advertiser_id: advertiser_id,
7525            _partner_id: Default::default(),
7526            _delegate: Default::default(),
7527            _additional_params: Default::default(),
7528            _scopes: Default::default(),
7529        }
7530    }
7531
7532    /// Create a builder to help you perform the following task:
7533    ///
7534    /// Gets a channel for a partner or advertiser.
7535    ///
7536    /// # Arguments
7537    ///
7538    /// * `advertiserId` - The ID of the advertiser that owns the fetched channel.
7539    /// * `channelId` - Required. The ID of the channel to fetch.
7540    pub fn channels_get(
7541        &self,
7542        advertiser_id: i64,
7543        channel_id: i64,
7544    ) -> AdvertiserChannelGetCall<'a, C> {
7545        AdvertiserChannelGetCall {
7546            hub: self.hub,
7547            _advertiser_id: advertiser_id,
7548            _channel_id: channel_id,
7549            _partner_id: Default::default(),
7550            _delegate: Default::default(),
7551            _additional_params: Default::default(),
7552            _scopes: Default::default(),
7553        }
7554    }
7555
7556    /// Create a builder to help you perform the following task:
7557    ///
7558    /// Lists channels for a partner or advertiser.
7559    ///
7560    /// # Arguments
7561    ///
7562    /// * `advertiserId` - The ID of the advertiser that owns the channels.
7563    pub fn channels_list(&self, advertiser_id: i64) -> AdvertiserChannelListCall<'a, C> {
7564        AdvertiserChannelListCall {
7565            hub: self.hub,
7566            _advertiser_id: advertiser_id,
7567            _partner_id: Default::default(),
7568            _page_token: Default::default(),
7569            _page_size: Default::default(),
7570            _order_by: Default::default(),
7571            _filter: Default::default(),
7572            _delegate: Default::default(),
7573            _additional_params: Default::default(),
7574            _scopes: Default::default(),
7575        }
7576    }
7577
7578    /// Create a builder to help you perform the following task:
7579    ///
7580    /// Updates a channel. Returns the updated channel if successful.
7581    ///
7582    /// # Arguments
7583    ///
7584    /// * `request` - No description provided.
7585    /// * `advertiserId` - The ID of the advertiser that owns the created channel.
7586    /// * `channelId` - Output only. The unique ID of the channel. Assigned by the system.
7587    pub fn channels_patch(
7588        &self,
7589        request: Channel,
7590        advertiser_id: i64,
7591        channel_id: i64,
7592    ) -> AdvertiserChannelPatchCall<'a, C> {
7593        AdvertiserChannelPatchCall {
7594            hub: self.hub,
7595            _request: request,
7596            _advertiser_id: advertiser_id,
7597            _channel_id: channel_id,
7598            _update_mask: Default::default(),
7599            _partner_id: Default::default(),
7600            _delegate: Default::default(),
7601            _additional_params: Default::default(),
7602            _scopes: Default::default(),
7603        }
7604    }
7605
7606    /// Create a builder to help you perform the following task:
7607    ///
7608    /// Creates a new creative. Returns the newly created creative if successful. A [“Standard” user role](https://developers.google.com//support.google.com/displayvideo/answer/2723011) or greater for the parent advertiser or partner is required to make this request.
7609    ///
7610    /// # Arguments
7611    ///
7612    /// * `request` - No description provided.
7613    /// * `advertiserId` - Output only. The unique ID of the advertiser the creative belongs to.
7614    pub fn creatives_create(
7615        &self,
7616        request: Creative,
7617        advertiser_id: i64,
7618    ) -> AdvertiserCreativeCreateCall<'a, C> {
7619        AdvertiserCreativeCreateCall {
7620            hub: self.hub,
7621            _request: request,
7622            _advertiser_id: advertiser_id,
7623            _delegate: Default::default(),
7624            _additional_params: Default::default(),
7625            _scopes: Default::default(),
7626        }
7627    }
7628
7629    /// Create a builder to help you perform the following task:
7630    ///
7631    /// Deletes a creative. Returns error code `NOT_FOUND` if the creative does not exist. The creative should be archived first, i.e. set entity_status to `ENTITY_STATUS_ARCHIVED`, before it can be deleted. A [“Standard” user role](https://developers.google.com//support.google.com/displayvideo/answer/2723011) or greater for the parent advertiser or partner is required to make this request.
7632    ///
7633    /// # Arguments
7634    ///
7635    /// * `advertiserId` - The ID of the advertiser this creative belongs to.
7636    /// * `creativeId` - The ID of the creative to be deleted.
7637    pub fn creatives_delete(
7638        &self,
7639        advertiser_id: i64,
7640        creative_id: i64,
7641    ) -> AdvertiserCreativeDeleteCall<'a, C> {
7642        AdvertiserCreativeDeleteCall {
7643            hub: self.hub,
7644            _advertiser_id: advertiser_id,
7645            _creative_id: creative_id,
7646            _delegate: Default::default(),
7647            _additional_params: Default::default(),
7648            _scopes: Default::default(),
7649        }
7650    }
7651
7652    /// Create a builder to help you perform the following task:
7653    ///
7654    /// Gets a creative.
7655    ///
7656    /// # Arguments
7657    ///
7658    /// * `advertiserId` - Required. The ID of the advertiser this creative belongs to.
7659    /// * `creativeId` - Required. The ID of the creative to fetch.
7660    pub fn creatives_get(
7661        &self,
7662        advertiser_id: i64,
7663        creative_id: i64,
7664    ) -> AdvertiserCreativeGetCall<'a, C> {
7665        AdvertiserCreativeGetCall {
7666            hub: self.hub,
7667            _advertiser_id: advertiser_id,
7668            _creative_id: creative_id,
7669            _delegate: Default::default(),
7670            _additional_params: Default::default(),
7671            _scopes: Default::default(),
7672        }
7673    }
7674
7675    /// Create a builder to help you perform the following task:
7676    ///
7677    /// Lists creatives in an advertiser. The order is defined by the order_by parameter. If a filter by entity_status is not specified, creatives with `ENTITY_STATUS_ARCHIVED` will not be included in the results.
7678    ///
7679    /// # Arguments
7680    ///
7681    /// * `advertiserId` - Required. The ID of the advertiser to list creatives for.
7682    pub fn creatives_list(&self, advertiser_id: i64) -> AdvertiserCreativeListCall<'a, C> {
7683        AdvertiserCreativeListCall {
7684            hub: self.hub,
7685            _advertiser_id: advertiser_id,
7686            _page_token: Default::default(),
7687            _page_size: Default::default(),
7688            _order_by: Default::default(),
7689            _filter: Default::default(),
7690            _delegate: Default::default(),
7691            _additional_params: Default::default(),
7692            _scopes: Default::default(),
7693        }
7694    }
7695
7696    /// Create a builder to help you perform the following task:
7697    ///
7698    /// Updates an existing creative. Returns the updated creative if successful. A [“Standard” user role](https://developers.google.com//support.google.com/displayvideo/answer/2723011) or greater for the parent advertiser or partner is required to make this request.
7699    ///
7700    /// # Arguments
7701    ///
7702    /// * `request` - No description provided.
7703    /// * `advertiserId` - Output only. The unique ID of the advertiser the creative belongs to.
7704    /// * `creativeId` - Output only. The unique ID of the creative. Assigned by the system.
7705    pub fn creatives_patch(
7706        &self,
7707        request: Creative,
7708        advertiser_id: i64,
7709        creative_id: i64,
7710    ) -> AdvertiserCreativePatchCall<'a, C> {
7711        AdvertiserCreativePatchCall {
7712            hub: self.hub,
7713            _request: request,
7714            _advertiser_id: advertiser_id,
7715            _creative_id: creative_id,
7716            _update_mask: Default::default(),
7717            _delegate: Default::default(),
7718            _additional_params: Default::default(),
7719            _scopes: Default::default(),
7720        }
7721    }
7722
7723    /// Create a builder to help you perform the following task:
7724    ///
7725    /// Gets a single targeting option assigned to an insertion order.
7726    ///
7727    /// # Arguments
7728    ///
7729    /// * `advertiserId` - Required. The ID of the advertiser the insertion order belongs to.
7730    /// * `insertionOrderId` - Required. The ID of the insertion order the assigned targeting option belongs to.
7731    /// * `targetingType` - Required. Identifies the type of this assigned targeting option. Supported targeting types include: * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_APP` * `TARGETING_TYPE_APP_CATEGORY` * `TARGETING_TYPE_AUDIENCE_GROUP` * `TARGETING_TYPE_AUDIO_CONTENT_TYPE` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_BROWSER` * `TARGETING_TYPE_BUSINESS_CHAIN` * `TARGETING_TYPE_CARRIER_AND_ISP` * `TARGETING_TYPE_CATEGORY` * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_CONTENT_DURATION` * `TARGETING_TYPE_CONTENT_GENRE` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_STREAM_TYPE` * `TARGETING_TYPE_DAY_AND_TIME` * `TARGETING_TYPE_DEVICE_MAKE_MODEL` * `TARGETING_TYPE_DEVICE_TYPE` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_INVENTORY_SOURCE` * `TARGETING_TYPE_INVENTORY_SOURCE_GROUP` * `TARGETING_TYPE_KEYWORD` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_NATIVE_CONTENT_POSITION` * `TARGETING_TYPE_NEGATIVE_KEYWORD_LIST` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_OPERATING_SYSTEM` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_POI` * `TARGETING_TYPE_PROXIMITY_LOCATION_LIST` * `TARGETING_TYPE_REGIONAL_LOCATION_LIST` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_THIRD_PARTY_VERIFIER` * `TARGETING_TYPE_URL` * `TARGETING_TYPE_USER_REWARDED_CONTENT` * `TARGETING_TYPE_VIDEO_PLAYER_SIZE` * `TARGETING_TYPE_VIEWABILITY`
7732    /// * `assignedTargetingOptionId` - Required. An identifier unique to the targeting type in this insertion order that identifies the assigned targeting option being requested.
7733    pub fn insertion_orders_targeting_types_assigned_targeting_options_get(
7734        &self,
7735        advertiser_id: i64,
7736        insertion_order_id: i64,
7737        targeting_type: &str,
7738        assigned_targeting_option_id: &str,
7739    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
7740        AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionGetCall {
7741            hub: self.hub,
7742            _advertiser_id: advertiser_id,
7743            _insertion_order_id: insertion_order_id,
7744            _targeting_type: targeting_type.to_string(),
7745            _assigned_targeting_option_id: assigned_targeting_option_id.to_string(),
7746            _delegate: Default::default(),
7747            _additional_params: Default::default(),
7748            _scopes: Default::default(),
7749        }
7750    }
7751
7752    /// Create a builder to help you perform the following task:
7753    ///
7754    /// Lists the targeting options assigned to an insertion order.
7755    ///
7756    /// # Arguments
7757    ///
7758    /// * `advertiserId` - Required. The ID of the advertiser the insertion order belongs to.
7759    /// * `insertionOrderId` - Required. The ID of the insertion order to list assigned targeting options for.
7760    /// * `targetingType` - Required. Identifies the type of assigned targeting options to list. Supported targeting types include: * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_APP` * `TARGETING_TYPE_APP_CATEGORY` * `TARGETING_TYPE_AUDIENCE_GROUP` * `TARGETING_TYPE_AUDIO_CONTENT_TYPE` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_BROWSER` * `TARGETING_TYPE_BUSINESS_CHAIN` * `TARGETING_TYPE_CARRIER_AND_ISP` * `TARGETING_TYPE_CATEGORY` * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_CONTENT_DURATION` * `TARGETING_TYPE_CONTENT_GENRE` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_STREAM_TYPE` * `TARGETING_TYPE_DAY_AND_TIME` * `TARGETING_TYPE_DEVICE_MAKE_MODEL` * `TARGETING_TYPE_DEVICE_TYPE` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_INVENTORY_SOURCE` * `TARGETING_TYPE_INVENTORY_SOURCE_GROUP` * `TARGETING_TYPE_KEYWORD` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_NATIVE_CONTENT_POSITION` * `TARGETING_TYPE_NEGATIVE_KEYWORD_LIST` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_OPERATING_SYSTEM` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_POI` * `TARGETING_TYPE_PROXIMITY_LOCATION_LIST` * `TARGETING_TYPE_REGIONAL_LOCATION_LIST` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_THIRD_PARTY_VERIFIER` * `TARGETING_TYPE_URL` * `TARGETING_TYPE_USER_REWARDED_CONTENT` * `TARGETING_TYPE_VIDEO_PLAYER_SIZE` * `TARGETING_TYPE_VIEWABILITY`
7761    pub fn insertion_orders_targeting_types_assigned_targeting_options_list(
7762        &self,
7763        advertiser_id: i64,
7764        insertion_order_id: i64,
7765        targeting_type: &str,
7766    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall<'a, C> {
7767        AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall {
7768            hub: self.hub,
7769            _advertiser_id: advertiser_id,
7770            _insertion_order_id: insertion_order_id,
7771            _targeting_type: targeting_type.to_string(),
7772            _page_token: Default::default(),
7773            _page_size: Default::default(),
7774            _order_by: Default::default(),
7775            _filter: Default::default(),
7776            _delegate: Default::default(),
7777            _additional_params: Default::default(),
7778            _scopes: Default::default(),
7779        }
7780    }
7781
7782    /// Create a builder to help you perform the following task:
7783    ///
7784    /// Lists assigned targeting options of an insertion order across targeting types.
7785    ///
7786    /// # Arguments
7787    ///
7788    /// * `advertiserId` - Required. The ID of the advertiser the insertion order belongs to.
7789    /// * `insertionOrderId` - Required. The ID of the insertion order to list assigned targeting options for.
7790    pub fn insertion_orders_bulk_list_insertion_order_assigned_targeting_options(
7791        &self,
7792        advertiser_id: i64,
7793        insertion_order_id: i64,
7794    ) -> AdvertiserInsertionOrderBulkListInsertionOrderAssignedTargetingOptionCall<'a, C> {
7795        AdvertiserInsertionOrderBulkListInsertionOrderAssignedTargetingOptionCall {
7796            hub: self.hub,
7797            _advertiser_id: advertiser_id,
7798            _insertion_order_id: insertion_order_id,
7799            _page_token: Default::default(),
7800            _page_size: Default::default(),
7801            _order_by: Default::default(),
7802            _filter: Default::default(),
7803            _delegate: Default::default(),
7804            _additional_params: Default::default(),
7805            _scopes: Default::default(),
7806        }
7807    }
7808
7809    /// Create a builder to help you perform the following task:
7810    ///
7811    /// Creates a new insertion order. Returns the newly created insertion order if successful.
7812    ///
7813    /// # Arguments
7814    ///
7815    /// * `request` - No description provided.
7816    /// * `advertiserId` - Output only. The unique ID of the advertiser the insertion order belongs to.
7817    pub fn insertion_orders_create(
7818        &self,
7819        request: InsertionOrder,
7820        advertiser_id: i64,
7821    ) -> AdvertiserInsertionOrderCreateCall<'a, C> {
7822        AdvertiserInsertionOrderCreateCall {
7823            hub: self.hub,
7824            _request: request,
7825            _advertiser_id: advertiser_id,
7826            _delegate: Default::default(),
7827            _additional_params: Default::default(),
7828            _scopes: Default::default(),
7829        }
7830    }
7831
7832    /// Create a builder to help you perform the following task:
7833    ///
7834    /// Deletes an insertion order. Returns error code `NOT_FOUND` if the insertion order does not exist. The insertion order should be archived first, i.e. set entity_status to `ENTITY_STATUS_ARCHIVED`, to be able to delete it.
7835    ///
7836    /// # Arguments
7837    ///
7838    /// * `advertiserId` - The ID of the advertiser this insertion order belongs to.
7839    /// * `insertionOrderId` - The ID of the insertion order to delete.
7840    pub fn insertion_orders_delete(
7841        &self,
7842        advertiser_id: i64,
7843        insertion_order_id: i64,
7844    ) -> AdvertiserInsertionOrderDeleteCall<'a, C> {
7845        AdvertiserInsertionOrderDeleteCall {
7846            hub: self.hub,
7847            _advertiser_id: advertiser_id,
7848            _insertion_order_id: insertion_order_id,
7849            _delegate: Default::default(),
7850            _additional_params: Default::default(),
7851            _scopes: Default::default(),
7852        }
7853    }
7854
7855    /// Create a builder to help you perform the following task:
7856    ///
7857    /// Gets an insertion order. Returns error code `NOT_FOUND` if the insertion order does not exist.
7858    ///
7859    /// # Arguments
7860    ///
7861    /// * `advertiserId` - Required. The ID of the advertiser this insertion order belongs to.
7862    /// * `insertionOrderId` - Required. The ID of the insertion order to fetch.
7863    pub fn insertion_orders_get(
7864        &self,
7865        advertiser_id: i64,
7866        insertion_order_id: i64,
7867    ) -> AdvertiserInsertionOrderGetCall<'a, C> {
7868        AdvertiserInsertionOrderGetCall {
7869            hub: self.hub,
7870            _advertiser_id: advertiser_id,
7871            _insertion_order_id: insertion_order_id,
7872            _delegate: Default::default(),
7873            _additional_params: Default::default(),
7874            _scopes: Default::default(),
7875        }
7876    }
7877
7878    /// Create a builder to help you perform the following task:
7879    ///
7880    /// Lists insertion orders in an advertiser. The order is defined by the order_by parameter. If a filter by entity_status is not specified, insertion orders with `ENTITY_STATUS_ARCHIVED` will not be included in the results.
7881    ///
7882    /// # Arguments
7883    ///
7884    /// * `advertiserId` - Required. The ID of the advertiser to list insertion orders for.
7885    pub fn insertion_orders_list(
7886        &self,
7887        advertiser_id: i64,
7888    ) -> AdvertiserInsertionOrderListCall<'a, C> {
7889        AdvertiserInsertionOrderListCall {
7890            hub: self.hub,
7891            _advertiser_id: advertiser_id,
7892            _page_token: Default::default(),
7893            _page_size: Default::default(),
7894            _order_by: Default::default(),
7895            _filter: Default::default(),
7896            _delegate: Default::default(),
7897            _additional_params: Default::default(),
7898            _scopes: Default::default(),
7899        }
7900    }
7901
7902    /// Create a builder to help you perform the following task:
7903    ///
7904    /// Updates an existing insertion order. Returns the updated insertion order if successful.
7905    ///
7906    /// # Arguments
7907    ///
7908    /// * `request` - No description provided.
7909    /// * `advertiserId` - Output only. The unique ID of the advertiser the insertion order belongs to.
7910    /// * `insertionOrderId` - Output only. The unique ID of the insertion order. Assigned by the system.
7911    pub fn insertion_orders_patch(
7912        &self,
7913        request: InsertionOrder,
7914        advertiser_id: i64,
7915        insertion_order_id: i64,
7916    ) -> AdvertiserInsertionOrderPatchCall<'a, C> {
7917        AdvertiserInsertionOrderPatchCall {
7918            hub: self.hub,
7919            _request: request,
7920            _advertiser_id: advertiser_id,
7921            _insertion_order_id: insertion_order_id,
7922            _update_mask: Default::default(),
7923            _delegate: Default::default(),
7924            _additional_params: Default::default(),
7925            _scopes: Default::default(),
7926        }
7927    }
7928
7929    /// Create a builder to help you perform the following task:
7930    ///
7931    /// Lists invoices posted for an advertiser in a given month. Invoices generated by billing profiles with a "Partner" invoice level are not retrievable through this method.
7932    ///
7933    /// # Arguments
7934    ///
7935    /// * `advertiserId` - Required. The ID of the advertiser to list invoices for.
7936    pub fn invoices_list(&self, advertiser_id: i64) -> AdvertiserInvoiceListCall<'a, C> {
7937        AdvertiserInvoiceListCall {
7938            hub: self.hub,
7939            _advertiser_id: advertiser_id,
7940            _page_token: Default::default(),
7941            _page_size: Default::default(),
7942            _loi_sapin_invoice_type: Default::default(),
7943            _issue_month: Default::default(),
7944            _delegate: Default::default(),
7945            _additional_params: Default::default(),
7946            _scopes: Default::default(),
7947        }
7948    }
7949
7950    /// Create a builder to help you perform the following task:
7951    ///
7952    /// Retrieves the invoice currency used by an advertiser in a given month.
7953    ///
7954    /// # Arguments
7955    ///
7956    /// * `advertiserId` - Required. The ID of the advertiser to lookup currency for.
7957    pub fn invoices_lookup_invoice_currency(
7958        &self,
7959        advertiser_id: i64,
7960    ) -> AdvertiserInvoiceLookupInvoiceCurrencyCall<'a, C> {
7961        AdvertiserInvoiceLookupInvoiceCurrencyCall {
7962            hub: self.hub,
7963            _advertiser_id: advertiser_id,
7964            _invoice_month: Default::default(),
7965            _delegate: Default::default(),
7966            _additional_params: Default::default(),
7967            _scopes: Default::default(),
7968        }
7969    }
7970
7971    /// Create a builder to help you perform the following task:
7972    ///
7973    /// Assigns a targeting option to a line item. Returns the assigned targeting option if successful. Requests to this endpoint cannot be made concurrently with the following requests updating the same line item: * lineItems.bulkEditAssignedTargetingOptions * lineItems.bulkUpdate * lineItems.patch * DeleteLineItemAssignedTargetingOption YouTube & Partners line items cannot be created or updated using the API.
7974    ///
7975    /// # Arguments
7976    ///
7977    /// * `request` - No description provided.
7978    /// * `advertiserId` - Required. The ID of the advertiser the line item belongs to.
7979    /// * `lineItemId` - Required. The ID of the line item the assigned targeting option will belong to.
7980    /// * `targetingType` - Required. Identifies the type of this assigned targeting option. Supported targeting types include: * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_APP` * `TARGETING_TYPE_APP_CATEGORY` * `TARGETING_TYPE_AUDIENCE_GROUP` * `TARGETING_TYPE_AUDIO_CONTENT_TYPE` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_BROWSER` * `TARGETING_TYPE_BUSINESS_CHAIN` * `TARGETING_TYPE_CARRIER_AND_ISP` * `TARGETING_TYPE_CATEGORY` * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_CONTENT_DURATION` * `TARGETING_TYPE_CONTENT_GENRE` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_STREAM_TYPE` * `TARGETING_TYPE_DAY_AND_TIME` * `TARGETING_TYPE_DEVICE_MAKE_MODEL` * `TARGETING_TYPE_DEVICE_TYPE` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_INVENTORY_SOURCE` * `TARGETING_TYPE_INVENTORY_SOURCE_GROUP` * `TARGETING_TYPE_KEYWORD` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_NATIVE_CONTENT_POSITION` * `TARGETING_TYPE_NEGATIVE_KEYWORD_LIST` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_OPERATING_SYSTEM` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_POI` * `TARGETING_TYPE_PROXIMITY_LOCATION_LIST` * `TARGETING_TYPE_REGIONAL_LOCATION_LIST` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_THIRD_PARTY_VERIFIER` * `TARGETING_TYPE_URL` * `TARGETING_TYPE_USER_REWARDED_CONTENT` * `TARGETING_TYPE_VIDEO_PLAYER_SIZE` * `TARGETING_TYPE_VIEWABILITY`
7981    pub fn line_items_targeting_types_assigned_targeting_options_create(
7982        &self,
7983        request: AssignedTargetingOption,
7984        advertiser_id: i64,
7985        line_item_id: i64,
7986        targeting_type: &str,
7987    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
7988        AdvertiserLineItemTargetingTypeAssignedTargetingOptionCreateCall {
7989            hub: self.hub,
7990            _request: request,
7991            _advertiser_id: advertiser_id,
7992            _line_item_id: line_item_id,
7993            _targeting_type: targeting_type.to_string(),
7994            _delegate: Default::default(),
7995            _additional_params: Default::default(),
7996            _scopes: Default::default(),
7997        }
7998    }
7999
8000    /// Create a builder to help you perform the following task:
8001    ///
8002    /// Deletes an assigned targeting option from a line item. Requests to this endpoint cannot be made concurrently with the following requests updating the same line item: * lineItems.bulkEditAssignedTargetingOptions * lineItems.bulkUpdate * lineItems.patch * CreateLineItemAssignedTargetingOption YouTube & Partners line items cannot be created or updated using the API.
8003    ///
8004    /// # Arguments
8005    ///
8006    /// * `advertiserId` - Required. The ID of the advertiser the line item belongs to.
8007    /// * `lineItemId` - Required. The ID of the line item the assigned targeting option belongs to.
8008    /// * `targetingType` - Required. Identifies the type of this assigned targeting option. Supported targeting types include: * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_APP` * `TARGETING_TYPE_APP_CATEGORY` * `TARGETING_TYPE_AUDIENCE_GROUP` * `TARGETING_TYPE_AUDIO_CONTENT_TYPE` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_BROWSER` * `TARGETING_TYPE_BUSINESS_CHAIN` * `TARGETING_TYPE_CARRIER_AND_ISP` * `TARGETING_TYPE_CATEGORY` * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_CONTENT_DURATION` * `TARGETING_TYPE_CONTENT_GENRE` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_STREAM_TYPE` * `TARGETING_TYPE_DAY_AND_TIME` * `TARGETING_TYPE_DEVICE_MAKE_MODEL` * `TARGETING_TYPE_DEVICE_TYPE` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_INVENTORY_SOURCE` * `TARGETING_TYPE_INVENTORY_SOURCE_GROUP` * `TARGETING_TYPE_KEYWORD` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_NATIVE_CONTENT_POSITION` * `TARGETING_TYPE_NEGATIVE_KEYWORD_LIST` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_OPERATING_SYSTEM` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_POI` * `TARGETING_TYPE_PROXIMITY_LOCATION_LIST` * `TARGETING_TYPE_REGIONAL_LOCATION_LIST` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_THIRD_PARTY_VERIFIER` * `TARGETING_TYPE_URL` * `TARGETING_TYPE_USER_REWARDED_CONTENT` * `TARGETING_TYPE_VIDEO_PLAYER_SIZE` * `TARGETING_TYPE_VIEWABILITY`
8009    /// * `assignedTargetingOptionId` - Required. The ID of the assigned targeting option to delete.
8010    pub fn line_items_targeting_types_assigned_targeting_options_delete(
8011        &self,
8012        advertiser_id: i64,
8013        line_item_id: i64,
8014        targeting_type: &str,
8015        assigned_targeting_option_id: &str,
8016    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
8017        AdvertiserLineItemTargetingTypeAssignedTargetingOptionDeleteCall {
8018            hub: self.hub,
8019            _advertiser_id: advertiser_id,
8020            _line_item_id: line_item_id,
8021            _targeting_type: targeting_type.to_string(),
8022            _assigned_targeting_option_id: assigned_targeting_option_id.to_string(),
8023            _delegate: Default::default(),
8024            _additional_params: Default::default(),
8025            _scopes: Default::default(),
8026        }
8027    }
8028
8029    /// Create a builder to help you perform the following task:
8030    ///
8031    /// Gets a single targeting option assigned to a line item.
8032    ///
8033    /// # Arguments
8034    ///
8035    /// * `advertiserId` - Required. The ID of the advertiser the line item belongs to.
8036    /// * `lineItemId` - Required. The ID of the line item the assigned targeting option belongs to.
8037    /// * `targetingType` - Required. Identifies the type of this assigned targeting option. Supported targeting types include: * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_APP` * `TARGETING_TYPE_APP_CATEGORY` * `TARGETING_TYPE_AUDIENCE_GROUP` * `TARGETING_TYPE_AUDIO_CONTENT_TYPE` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_BROWSER` * `TARGETING_TYPE_BUSINESS_CHAIN` * `TARGETING_TYPE_CARRIER_AND_ISP` * `TARGETING_TYPE_CATEGORY` * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_CONTENT_DURATION` * `TARGETING_TYPE_CONTENT_GENRE` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_STREAM_TYPE` * `TARGETING_TYPE_DAY_AND_TIME` * `TARGETING_TYPE_DEVICE_MAKE_MODEL` * `TARGETING_TYPE_DEVICE_TYPE` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_INVENTORY_SOURCE` * `TARGETING_TYPE_INVENTORY_SOURCE_GROUP` * `TARGETING_TYPE_KEYWORD` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_NATIVE_CONTENT_POSITION` * `TARGETING_TYPE_NEGATIVE_KEYWORD_LIST` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_OPERATING_SYSTEM` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_POI` * `TARGETING_TYPE_PROXIMITY_LOCATION_LIST` * `TARGETING_TYPE_REGIONAL_LOCATION_LIST` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_THIRD_PARTY_VERIFIER` * `TARGETING_TYPE_URL` * `TARGETING_TYPE_USER_REWARDED_CONTENT` * `TARGETING_TYPE_VIDEO_PLAYER_SIZE` * `TARGETING_TYPE_VIEWABILITY` * `TARGETING_TYPE_YOUTUBE_CHANNEL` (only for `LINE_ITEM_TYPE_YOUTUBE_AND_PARTNERS_VIDEO_SEQUENCE` line items) * `TARGETING_TYPE_YOUTUBE_VIDEO` (only for `LINE_ITEM_TYPE_YOUTUBE_AND_PARTNERS_VIDEO_SEQUENCE` line items)
8038    /// * `assignedTargetingOptionId` - Required. An identifier unique to the targeting type in this line item that identifies the assigned targeting option being requested.
8039    pub fn line_items_targeting_types_assigned_targeting_options_get(
8040        &self,
8041        advertiser_id: i64,
8042        line_item_id: i64,
8043        targeting_type: &str,
8044        assigned_targeting_option_id: &str,
8045    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
8046        AdvertiserLineItemTargetingTypeAssignedTargetingOptionGetCall {
8047            hub: self.hub,
8048            _advertiser_id: advertiser_id,
8049            _line_item_id: line_item_id,
8050            _targeting_type: targeting_type.to_string(),
8051            _assigned_targeting_option_id: assigned_targeting_option_id.to_string(),
8052            _delegate: Default::default(),
8053            _additional_params: Default::default(),
8054            _scopes: Default::default(),
8055        }
8056    }
8057
8058    /// Create a builder to help you perform the following task:
8059    ///
8060    /// Lists the targeting options assigned to a line item.
8061    ///
8062    /// # Arguments
8063    ///
8064    /// * `advertiserId` - Required. The ID of the advertiser the line item belongs to.
8065    /// * `lineItemId` - Required. The ID of the line item to list assigned targeting options for.
8066    /// * `targetingType` - Required. Identifies the type of assigned targeting options to list. Supported targeting types include: * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_APP` * `TARGETING_TYPE_APP_CATEGORY` * `TARGETING_TYPE_AUDIENCE_GROUP` * `TARGETING_TYPE_AUDIO_CONTENT_TYPE` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_BROWSER` * `TARGETING_TYPE_BUSINESS_CHAIN` * `TARGETING_TYPE_CARRIER_AND_ISP` * `TARGETING_TYPE_CATEGORY` * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_CONTENT_DURATION` * `TARGETING_TYPE_CONTENT_GENRE` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_STREAM_TYPE` * `TARGETING_TYPE_DAY_AND_TIME` * `TARGETING_TYPE_DEVICE_MAKE_MODEL` * `TARGETING_TYPE_DEVICE_TYPE` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_INVENTORY_SOURCE` * `TARGETING_TYPE_INVENTORY_SOURCE_GROUP` * `TARGETING_TYPE_KEYWORD` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_NATIVE_CONTENT_POSITION` * `TARGETING_TYPE_NEGATIVE_KEYWORD_LIST` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_OPERATING_SYSTEM` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_POI` * `TARGETING_TYPE_PROXIMITY_LOCATION_LIST` * `TARGETING_TYPE_REGIONAL_LOCATION_LIST` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_THIRD_PARTY_VERIFIER` * `TARGETING_TYPE_URL` * `TARGETING_TYPE_USER_REWARDED_CONTENT` * `TARGETING_TYPE_VIDEO_PLAYER_SIZE` * `TARGETING_TYPE_VIEWABILITY` * `TARGETING_TYPE_YOUTUBE_CHANNEL` (only for `LINE_ITEM_TYPE_YOUTUBE_AND_PARTNERS_VIDEO_SEQUENCE` line items) * `TARGETING_TYPE_YOUTUBE_VIDEO` (only for `LINE_ITEM_TYPE_YOUTUBE_AND_PARTNERS_VIDEO_SEQUENCE` line items)
8067    pub fn line_items_targeting_types_assigned_targeting_options_list(
8068        &self,
8069        advertiser_id: i64,
8070        line_item_id: i64,
8071        targeting_type: &str,
8072    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall<'a, C> {
8073        AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall {
8074            hub: self.hub,
8075            _advertiser_id: advertiser_id,
8076            _line_item_id: line_item_id,
8077            _targeting_type: targeting_type.to_string(),
8078            _page_token: Default::default(),
8079            _page_size: Default::default(),
8080            _order_by: Default::default(),
8081            _filter: Default::default(),
8082            _delegate: Default::default(),
8083            _additional_params: Default::default(),
8084            _scopes: Default::default(),
8085        }
8086    }
8087
8088    /// Create a builder to help you perform the following task:
8089    ///
8090    /// Bulk edits targeting options under a single line item. The operation will delete the assigned targeting options provided in BulkEditLineItemAssignedTargetingOptionsRequest.delete_requests and then create the assigned targeting options provided in BulkEditLineItemAssignedTargetingOptionsRequest.create_requests. Requests to this endpoint cannot be made concurrently with the following requests updating the same line item: * lineItems.patch * assignedTargetingOptions.create * assignedTargetingOptions.delete YouTube & Partners line items cannot be created or updated using the API.
8091    ///
8092    /// # Arguments
8093    ///
8094    /// * `request` - No description provided.
8095    /// * `advertiserId` - Required. The ID of the advertiser the line item belongs to.
8096    /// * `lineItemId` - Required. The ID of the line item the assigned targeting option will belong to.
8097    pub fn line_items_bulk_edit_line_item_assigned_targeting_options(
8098        &self,
8099        request: BulkEditLineItemAssignedTargetingOptionsRequest,
8100        advertiser_id: i64,
8101        line_item_id: i64,
8102    ) -> AdvertiserLineItemBulkEditLineItemAssignedTargetingOptionCall<'a, C> {
8103        AdvertiserLineItemBulkEditLineItemAssignedTargetingOptionCall {
8104            hub: self.hub,
8105            _request: request,
8106            _advertiser_id: advertiser_id,
8107            _line_item_id: line_item_id,
8108            _delegate: Default::default(),
8109            _additional_params: Default::default(),
8110            _scopes: Default::default(),
8111        }
8112    }
8113
8114    /// Create a builder to help you perform the following task:
8115    ///
8116    /// Lists assigned targeting options of a line item across targeting types.
8117    ///
8118    /// # Arguments
8119    ///
8120    /// * `advertiserId` - Required. The ID of the advertiser the line item belongs to.
8121    /// * `lineItemId` - Required. The ID of the line item to list assigned targeting options for.
8122    pub fn line_items_bulk_list_line_item_assigned_targeting_options(
8123        &self,
8124        advertiser_id: i64,
8125        line_item_id: i64,
8126    ) -> AdvertiserLineItemBulkListLineItemAssignedTargetingOptionCall<'a, C> {
8127        AdvertiserLineItemBulkListLineItemAssignedTargetingOptionCall {
8128            hub: self.hub,
8129            _advertiser_id: advertiser_id,
8130            _line_item_id: line_item_id,
8131            _page_token: Default::default(),
8132            _page_size: Default::default(),
8133            _order_by: Default::default(),
8134            _filter: Default::default(),
8135            _delegate: Default::default(),
8136            _additional_params: Default::default(),
8137            _scopes: Default::default(),
8138        }
8139    }
8140
8141    /// Create a builder to help you perform the following task:
8142    ///
8143    /// Creates a new line item. Returns the newly created line item if successful. YouTube & Partners line items cannot be created or updated using the API.
8144    ///
8145    /// # Arguments
8146    ///
8147    /// * `request` - No description provided.
8148    /// * `advertiserId` - Output only. The unique ID of the advertiser the line item belongs to.
8149    pub fn line_items_create(
8150        &self,
8151        request: LineItem,
8152        advertiser_id: i64,
8153    ) -> AdvertiserLineItemCreateCall<'a, C> {
8154        AdvertiserLineItemCreateCall {
8155            hub: self.hub,
8156            _request: request,
8157            _advertiser_id: advertiser_id,
8158            _delegate: Default::default(),
8159            _additional_params: Default::default(),
8160            _scopes: Default::default(),
8161        }
8162    }
8163
8164    /// Create a builder to help you perform the following task:
8165    ///
8166    /// Deletes a line item. Returns error code `NOT_FOUND` if the line item does not exist. The line item should be archived first, i.e. set entity_status to `ENTITY_STATUS_ARCHIVED`, to be able to delete it. YouTube & Partners line items cannot be created or updated using the API.
8167    ///
8168    /// # Arguments
8169    ///
8170    /// * `advertiserId` - The ID of the advertiser this line item belongs to.
8171    /// * `lineItemId` - The ID of the line item to delete.
8172    pub fn line_items_delete(
8173        &self,
8174        advertiser_id: i64,
8175        line_item_id: i64,
8176    ) -> AdvertiserLineItemDeleteCall<'a, C> {
8177        AdvertiserLineItemDeleteCall {
8178            hub: self.hub,
8179            _advertiser_id: advertiser_id,
8180            _line_item_id: line_item_id,
8181            _delegate: Default::default(),
8182            _additional_params: Default::default(),
8183            _scopes: Default::default(),
8184        }
8185    }
8186
8187    /// Create a builder to help you perform the following task:
8188    ///
8189    /// Creates a new line item with settings (including targeting) inherited from the insertion order and an `ENTITY_STATUS_DRAFT` entity_status. Returns the newly created line item if successful. There are default values based on the three fields: * The insertion order's insertion_order_type * The insertion order's automation_type * The given line_item_type YouTube & Partners line items cannot be created or updated using the API.
8190    ///
8191    /// # Arguments
8192    ///
8193    /// * `request` - No description provided.
8194    /// * `advertiserId` - Required. The ID of the advertiser this line item belongs to.
8195    pub fn line_items_generate_default(
8196        &self,
8197        request: GenerateDefaultLineItemRequest,
8198        advertiser_id: i64,
8199    ) -> AdvertiserLineItemGenerateDefaultCall<'a, C> {
8200        AdvertiserLineItemGenerateDefaultCall {
8201            hub: self.hub,
8202            _request: request,
8203            _advertiser_id: advertiser_id,
8204            _delegate: Default::default(),
8205            _additional_params: Default::default(),
8206            _scopes: Default::default(),
8207        }
8208    }
8209
8210    /// Create a builder to help you perform the following task:
8211    ///
8212    /// Gets a line item.
8213    ///
8214    /// # Arguments
8215    ///
8216    /// * `advertiserId` - Required. The ID of the advertiser this line item belongs to.
8217    /// * `lineItemId` - Required. The ID of the line item to fetch.
8218    pub fn line_items_get(
8219        &self,
8220        advertiser_id: i64,
8221        line_item_id: i64,
8222    ) -> AdvertiserLineItemGetCall<'a, C> {
8223        AdvertiserLineItemGetCall {
8224            hub: self.hub,
8225            _advertiser_id: advertiser_id,
8226            _line_item_id: line_item_id,
8227            _delegate: Default::default(),
8228            _additional_params: Default::default(),
8229            _scopes: Default::default(),
8230        }
8231    }
8232
8233    /// Create a builder to help you perform the following task:
8234    ///
8235    /// Lists line items in an advertiser. The order is defined by the order_by parameter. If a filter by entity_status is not specified, line items with `ENTITY_STATUS_ARCHIVED` will not be included in the results.
8236    ///
8237    /// # Arguments
8238    ///
8239    /// * `advertiserId` - Required. The ID of the advertiser to list line items for.
8240    pub fn line_items_list(&self, advertiser_id: i64) -> AdvertiserLineItemListCall<'a, C> {
8241        AdvertiserLineItemListCall {
8242            hub: self.hub,
8243            _advertiser_id: advertiser_id,
8244            _page_token: Default::default(),
8245            _page_size: Default::default(),
8246            _order_by: Default::default(),
8247            _filter: Default::default(),
8248            _delegate: Default::default(),
8249            _additional_params: Default::default(),
8250            _scopes: Default::default(),
8251        }
8252    }
8253
8254    /// Create a builder to help you perform the following task:
8255    ///
8256    /// Updates an existing line item. Returns the updated line item if successful. Requests to this endpoint cannot be made concurrently with the following requests updating the same line item: * BulkEditAssignedTargetingOptions * BulkUpdateLineItems * assignedTargetingOptions.create * assignedTargetingOptions.delete YouTube & Partners line items cannot be created or updated using the API. **This method regularly experiences high latency.** We recommend [increasing your default timeout](https://developers.google.com/display-video/api/guides/best-practices/timeouts#client_library_timeout) to avoid errors.
8257    ///
8258    /// # Arguments
8259    ///
8260    /// * `request` - No description provided.
8261    /// * `advertiserId` - Output only. The unique ID of the advertiser the line item belongs to.
8262    /// * `lineItemId` - Output only. The unique ID of the line item. Assigned by the system.
8263    pub fn line_items_patch(
8264        &self,
8265        request: LineItem,
8266        advertiser_id: i64,
8267        line_item_id: i64,
8268    ) -> AdvertiserLineItemPatchCall<'a, C> {
8269        AdvertiserLineItemPatchCall {
8270            hub: self.hub,
8271            _request: request,
8272            _advertiser_id: advertiser_id,
8273            _line_item_id: line_item_id,
8274            _update_mask: Default::default(),
8275            _delegate: Default::default(),
8276            _additional_params: Default::default(),
8277            _scopes: Default::default(),
8278        }
8279    }
8280
8281    /// Create a builder to help you perform the following task:
8282    ///
8283    /// Bulk edits multiple assignments between locations and a single location list. The operation will delete the assigned locations provided in deletedAssignedLocations and then create the assigned locations provided in createdAssignedLocations.
8284    ///
8285    /// # Arguments
8286    ///
8287    /// * `request` - No description provided.
8288    /// * `advertiserId` - Required. The ID of the DV360 advertiser to which the location list belongs.
8289    /// * `locationListId` - Required. The ID of the location list to which these assignments are assigned.
8290    pub fn location_lists_assigned_locations_bulk_edit(
8291        &self,
8292        request: BulkEditAssignedLocationsRequest,
8293        advertiser_id: i64,
8294        location_list_id: i64,
8295    ) -> AdvertiserLocationListAssignedLocationBulkEditCall<'a, C> {
8296        AdvertiserLocationListAssignedLocationBulkEditCall {
8297            hub: self.hub,
8298            _request: request,
8299            _advertiser_id: advertiser_id,
8300            _location_list_id: location_list_id,
8301            _delegate: Default::default(),
8302            _additional_params: Default::default(),
8303            _scopes: Default::default(),
8304        }
8305    }
8306
8307    /// Create a builder to help you perform the following task:
8308    ///
8309    /// Creates an assignment between a location and a location list.
8310    ///
8311    /// # Arguments
8312    ///
8313    /// * `request` - No description provided.
8314    /// * `advertiserId` - Required. The ID of the DV360 advertiser to which the location list belongs.
8315    /// * `locationListId` - Required. The ID of the location list for which the assignment will be created.
8316    pub fn location_lists_assigned_locations_create(
8317        &self,
8318        request: AssignedLocation,
8319        advertiser_id: i64,
8320        location_list_id: i64,
8321    ) -> AdvertiserLocationListAssignedLocationCreateCall<'a, C> {
8322        AdvertiserLocationListAssignedLocationCreateCall {
8323            hub: self.hub,
8324            _request: request,
8325            _advertiser_id: advertiser_id,
8326            _location_list_id: location_list_id,
8327            _delegate: Default::default(),
8328            _additional_params: Default::default(),
8329            _scopes: Default::default(),
8330        }
8331    }
8332
8333    /// Create a builder to help you perform the following task:
8334    ///
8335    /// Deletes the assignment between a location and a location list.
8336    ///
8337    /// # Arguments
8338    ///
8339    /// * `advertiserId` - Required. The ID of the DV360 advertiser to which the location list belongs.
8340    /// * `locationListId` - Required. The ID of the location list to which this assignment is assigned.
8341    /// * `assignedLocationId` - Required. The ID of the assigned location to delete.
8342    pub fn location_lists_assigned_locations_delete(
8343        &self,
8344        advertiser_id: i64,
8345        location_list_id: i64,
8346        assigned_location_id: i64,
8347    ) -> AdvertiserLocationListAssignedLocationDeleteCall<'a, C> {
8348        AdvertiserLocationListAssignedLocationDeleteCall {
8349            hub: self.hub,
8350            _advertiser_id: advertiser_id,
8351            _location_list_id: location_list_id,
8352            _assigned_location_id: assigned_location_id,
8353            _delegate: Default::default(),
8354            _additional_params: Default::default(),
8355            _scopes: Default::default(),
8356        }
8357    }
8358
8359    /// Create a builder to help you perform the following task:
8360    ///
8361    /// Lists locations assigned to a location list.
8362    ///
8363    /// # Arguments
8364    ///
8365    /// * `advertiserId` - Required. The ID of the DV360 advertiser to which the location list belongs.
8366    /// * `locationListId` - Required. The ID of the location list to which these assignments are assigned.
8367    pub fn location_lists_assigned_locations_list(
8368        &self,
8369        advertiser_id: i64,
8370        location_list_id: i64,
8371    ) -> AdvertiserLocationListAssignedLocationListCall<'a, C> {
8372        AdvertiserLocationListAssignedLocationListCall {
8373            hub: self.hub,
8374            _advertiser_id: advertiser_id,
8375            _location_list_id: location_list_id,
8376            _page_token: Default::default(),
8377            _page_size: Default::default(),
8378            _order_by: Default::default(),
8379            _filter: Default::default(),
8380            _delegate: Default::default(),
8381            _additional_params: Default::default(),
8382            _scopes: Default::default(),
8383        }
8384    }
8385
8386    /// Create a builder to help you perform the following task:
8387    ///
8388    /// Creates a new location list. Returns the newly created location list if successful.
8389    ///
8390    /// # Arguments
8391    ///
8392    /// * `request` - No description provided.
8393    /// * `advertiserId` - Required. The ID of the DV360 advertiser to which the location list belongs.
8394    pub fn location_lists_create(
8395        &self,
8396        request: LocationList,
8397        advertiser_id: i64,
8398    ) -> AdvertiserLocationListCreateCall<'a, C> {
8399        AdvertiserLocationListCreateCall {
8400            hub: self.hub,
8401            _request: request,
8402            _advertiser_id: advertiser_id,
8403            _delegate: Default::default(),
8404            _additional_params: Default::default(),
8405            _scopes: Default::default(),
8406        }
8407    }
8408
8409    /// Create a builder to help you perform the following task:
8410    ///
8411    /// Gets a location list.
8412    ///
8413    /// # Arguments
8414    ///
8415    /// * `advertiserId` - Required. The ID of the DV360 advertiser to which the fetched location list belongs.
8416    /// * `locationListId` - Required. The ID of the location list to fetch.
8417    pub fn location_lists_get(
8418        &self,
8419        advertiser_id: i64,
8420        location_list_id: i64,
8421    ) -> AdvertiserLocationListGetCall<'a, C> {
8422        AdvertiserLocationListGetCall {
8423            hub: self.hub,
8424            _advertiser_id: advertiser_id,
8425            _location_list_id: location_list_id,
8426            _delegate: Default::default(),
8427            _additional_params: Default::default(),
8428            _scopes: Default::default(),
8429        }
8430    }
8431
8432    /// Create a builder to help you perform the following task:
8433    ///
8434    /// Lists location lists based on a given advertiser id.
8435    ///
8436    /// # Arguments
8437    ///
8438    /// * `advertiserId` - Required. The ID of the DV360 advertiser to which the fetched location lists belong.
8439    pub fn location_lists_list(&self, advertiser_id: i64) -> AdvertiserLocationListListCall<'a, C> {
8440        AdvertiserLocationListListCall {
8441            hub: self.hub,
8442            _advertiser_id: advertiser_id,
8443            _page_token: Default::default(),
8444            _page_size: Default::default(),
8445            _order_by: Default::default(),
8446            _filter: Default::default(),
8447            _delegate: Default::default(),
8448            _additional_params: Default::default(),
8449            _scopes: Default::default(),
8450        }
8451    }
8452
8453    /// Create a builder to help you perform the following task:
8454    ///
8455    /// Updates a location list. Returns the updated location list if successful.
8456    ///
8457    /// # Arguments
8458    ///
8459    /// * `request` - No description provided.
8460    /// * `advertiserId` - Required. The ID of the DV360 advertiser to which the location lists belongs.
8461    /// * `locationListId` - Output only. The unique ID of the location list. Assigned by the system.
8462    pub fn location_lists_patch(
8463        &self,
8464        request: LocationList,
8465        advertiser_id: i64,
8466        location_list_id: i64,
8467    ) -> AdvertiserLocationListPatchCall<'a, C> {
8468        AdvertiserLocationListPatchCall {
8469            hub: self.hub,
8470            _request: request,
8471            _advertiser_id: advertiser_id,
8472            _location_list_id: location_list_id,
8473            _update_mask: Default::default(),
8474            _delegate: Default::default(),
8475            _additional_params: Default::default(),
8476            _scopes: Default::default(),
8477        }
8478    }
8479
8480    /// Create a builder to help you perform the following task:
8481    ///
8482    /// Activates a manual trigger. Each activation of the manual trigger must be at least 5 minutes apart, otherwise an error will be returned. **Warning:** Line Items using manual triggers no longer serve in Display & Video 360. This method will sunset on August 1, 2023. Read our [feature deprecation announcement](https://developers.google.com/display-video/api/deprecations#features.manual_triggers) for more information.
8483    ///
8484    /// # Arguments
8485    ///
8486    /// * `request` - No description provided.
8487    /// * `advertiserId` - Required. The ID of the advertiser that the manual trigger belongs.
8488    /// * `triggerId` - Required. The ID of the manual trigger to activate.
8489    pub fn manual_triggers_activate(
8490        &self,
8491        request: ActivateManualTriggerRequest,
8492        advertiser_id: i64,
8493        trigger_id: i64,
8494    ) -> AdvertiserManualTriggerActivateCall<'a, C> {
8495        AdvertiserManualTriggerActivateCall {
8496            hub: self.hub,
8497            _request: request,
8498            _advertiser_id: advertiser_id,
8499            _trigger_id: trigger_id,
8500            _delegate: Default::default(),
8501            _additional_params: Default::default(),
8502            _scopes: Default::default(),
8503        }
8504    }
8505
8506    /// Create a builder to help you perform the following task:
8507    ///
8508    /// Creates a new manual trigger. Returns the newly created manual trigger if successful. **Warning:** Line Items using manual triggers no longer serve in Display & Video 360. This method will sunset on August 1, 2023. Read our [feature deprecation announcement](https://developers.google.com/display-video/api/deprecations#features.manual_triggers) for more information.
8509    ///
8510    /// # Arguments
8511    ///
8512    /// * `request` - No description provided.
8513    /// * `advertiserId` - Required. Immutable. The unique ID of the advertiser that the manual trigger belongs to.
8514    pub fn manual_triggers_create(
8515        &self,
8516        request: ManualTrigger,
8517        advertiser_id: i64,
8518    ) -> AdvertiserManualTriggerCreateCall<'a, C> {
8519        AdvertiserManualTriggerCreateCall {
8520            hub: self.hub,
8521            _request: request,
8522            _advertiser_id: advertiser_id,
8523            _delegate: Default::default(),
8524            _additional_params: Default::default(),
8525            _scopes: Default::default(),
8526        }
8527    }
8528
8529    /// Create a builder to help you perform the following task:
8530    ///
8531    /// Deactivates a manual trigger. **Warning:** Line Items using manual triggers no longer serve in Display & Video 360. This method will sunset on August 1, 2023. Read our [feature deprecation announcement](https://developers.google.com/display-video/api/deprecations#features.manual_triggers) for more information.
8532    ///
8533    /// # Arguments
8534    ///
8535    /// * `request` - No description provided.
8536    /// * `advertiserId` - Required. The ID of the advertiser that the manual trigger belongs.
8537    /// * `triggerId` - Required. The ID of the manual trigger to deactivate.
8538    pub fn manual_triggers_deactivate(
8539        &self,
8540        request: DeactivateManualTriggerRequest,
8541        advertiser_id: i64,
8542        trigger_id: i64,
8543    ) -> AdvertiserManualTriggerDeactivateCall<'a, C> {
8544        AdvertiserManualTriggerDeactivateCall {
8545            hub: self.hub,
8546            _request: request,
8547            _advertiser_id: advertiser_id,
8548            _trigger_id: trigger_id,
8549            _delegate: Default::default(),
8550            _additional_params: Default::default(),
8551            _scopes: Default::default(),
8552        }
8553    }
8554
8555    /// Create a builder to help you perform the following task:
8556    ///
8557    /// Gets a manual trigger. **Warning:** Line Items using manual triggers no longer serve in Display & Video 360. This method will sunset on August 1, 2023. Read our [feature deprecation announcement](https://developers.google.com/display-video/api/deprecations#features.manual_triggers) for more information.
8558    ///
8559    /// # Arguments
8560    ///
8561    /// * `advertiserId` - Required. The ID of the advertiser this manual trigger belongs to.
8562    /// * `triggerId` - Required. The ID of the manual trigger to fetch.
8563    pub fn manual_triggers_get(
8564        &self,
8565        advertiser_id: i64,
8566        trigger_id: i64,
8567    ) -> AdvertiserManualTriggerGetCall<'a, C> {
8568        AdvertiserManualTriggerGetCall {
8569            hub: self.hub,
8570            _advertiser_id: advertiser_id,
8571            _trigger_id: trigger_id,
8572            _delegate: Default::default(),
8573            _additional_params: Default::default(),
8574            _scopes: Default::default(),
8575        }
8576    }
8577
8578    /// Create a builder to help you perform the following task:
8579    ///
8580    /// Lists manual triggers that are accessible to the current user for a given advertiser ID. The order is defined by the order_by parameter. A single advertiser_id is required. **Warning:** Line Items using manual triggers no longer serve in Display & Video 360. This method will sunset on August 1, 2023. Read our [feature deprecation announcement](https://developers.google.com/display-video/api/deprecations#features.manual_triggers) for more information.
8581    ///
8582    /// # Arguments
8583    ///
8584    /// * `advertiserId` - Required. The ID of the advertiser that the fetched manual triggers belong to.
8585    pub fn manual_triggers_list(
8586        &self,
8587        advertiser_id: i64,
8588    ) -> AdvertiserManualTriggerListCall<'a, C> {
8589        AdvertiserManualTriggerListCall {
8590            hub: self.hub,
8591            _advertiser_id: advertiser_id,
8592            _page_token: Default::default(),
8593            _page_size: Default::default(),
8594            _order_by: Default::default(),
8595            _filter: Default::default(),
8596            _delegate: Default::default(),
8597            _additional_params: Default::default(),
8598            _scopes: Default::default(),
8599        }
8600    }
8601
8602    /// Create a builder to help you perform the following task:
8603    ///
8604    /// Updates a manual trigger. Returns the updated manual trigger if successful. **Warning:** Line Items using manual triggers no longer serve in Display & Video 360. This method will sunset on August 1, 2023. Read our [feature deprecation announcement](https://developers.google.com/display-video/api/deprecations#features.manual_triggers) for more information.
8605    ///
8606    /// # Arguments
8607    ///
8608    /// * `request` - No description provided.
8609    /// * `advertiserId` - Required. Immutable. The unique ID of the advertiser that the manual trigger belongs to.
8610    /// * `triggerId` - Output only. The unique ID of the manual trigger.
8611    pub fn manual_triggers_patch(
8612        &self,
8613        request: ManualTrigger,
8614        advertiser_id: i64,
8615        trigger_id: i64,
8616    ) -> AdvertiserManualTriggerPatchCall<'a, C> {
8617        AdvertiserManualTriggerPatchCall {
8618            hub: self.hub,
8619            _request: request,
8620            _advertiser_id: advertiser_id,
8621            _trigger_id: trigger_id,
8622            _update_mask: Default::default(),
8623            _delegate: Default::default(),
8624            _additional_params: Default::default(),
8625            _scopes: Default::default(),
8626        }
8627    }
8628
8629    /// Create a builder to help you perform the following task:
8630    ///
8631    /// Bulk edits negative keywords in a single negative keyword list. The operation will delete the negative keywords provided in BulkEditNegativeKeywordsRequest.deleted_negative_keywords and then create the negative keywords provided in BulkEditNegativeKeywordsRequest.created_negative_keywords. This operation is guaranteed to be atomic and will never result in a partial success or partial failure.
8632    ///
8633    /// # Arguments
8634    ///
8635    /// * `request` - No description provided.
8636    /// * `advertiserId` - Required. The ID of the DV360 advertiser to which the parent negative keyword list belongs.
8637    /// * `negativeKeywordListId` - Required. The ID of the parent negative keyword list to which the negative keywords belong.
8638    pub fn negative_keyword_lists_negative_keywords_bulk_edit(
8639        &self,
8640        request: BulkEditNegativeKeywordsRequest,
8641        advertiser_id: i64,
8642        negative_keyword_list_id: i64,
8643    ) -> AdvertiserNegativeKeywordListNegativeKeywordBulkEditCall<'a, C> {
8644        AdvertiserNegativeKeywordListNegativeKeywordBulkEditCall {
8645            hub: self.hub,
8646            _request: request,
8647            _advertiser_id: advertiser_id,
8648            _negative_keyword_list_id: negative_keyword_list_id,
8649            _delegate: Default::default(),
8650            _additional_params: Default::default(),
8651            _scopes: Default::default(),
8652        }
8653    }
8654
8655    /// Create a builder to help you perform the following task:
8656    ///
8657    /// Creates a negative keyword in a negative keyword list.
8658    ///
8659    /// # Arguments
8660    ///
8661    /// * `request` - No description provided.
8662    /// * `advertiserId` - Required. The ID of the DV360 advertiser to which the parent negative keyword list belongs.
8663    /// * `negativeKeywordListId` - Required. The ID of the parent negative keyword list in which the negative keyword will be created.
8664    pub fn negative_keyword_lists_negative_keywords_create(
8665        &self,
8666        request: NegativeKeyword,
8667        advertiser_id: i64,
8668        negative_keyword_list_id: i64,
8669    ) -> AdvertiserNegativeKeywordListNegativeKeywordCreateCall<'a, C> {
8670        AdvertiserNegativeKeywordListNegativeKeywordCreateCall {
8671            hub: self.hub,
8672            _request: request,
8673            _advertiser_id: advertiser_id,
8674            _negative_keyword_list_id: negative_keyword_list_id,
8675            _delegate: Default::default(),
8676            _additional_params: Default::default(),
8677            _scopes: Default::default(),
8678        }
8679    }
8680
8681    /// Create a builder to help you perform the following task:
8682    ///
8683    /// Deletes a negative keyword from a negative keyword list.
8684    ///
8685    /// # Arguments
8686    ///
8687    /// * `advertiserId` - Required. The ID of the DV360 advertiser to which the parent negative keyword list belongs.
8688    /// * `negativeKeywordListId` - Required. The ID of the parent negative keyword list to which the negative keyword belongs.
8689    /// * `keywordValue` - Required. The keyword value of the negative keyword to delete.
8690    pub fn negative_keyword_lists_negative_keywords_delete(
8691        &self,
8692        advertiser_id: i64,
8693        negative_keyword_list_id: i64,
8694        keyword_value: &str,
8695    ) -> AdvertiserNegativeKeywordListNegativeKeywordDeleteCall<'a, C> {
8696        AdvertiserNegativeKeywordListNegativeKeywordDeleteCall {
8697            hub: self.hub,
8698            _advertiser_id: advertiser_id,
8699            _negative_keyword_list_id: negative_keyword_list_id,
8700            _keyword_value: keyword_value.to_string(),
8701            _delegate: Default::default(),
8702            _additional_params: Default::default(),
8703            _scopes: Default::default(),
8704        }
8705    }
8706
8707    /// Create a builder to help you perform the following task:
8708    ///
8709    /// Lists negative keywords in a negative keyword list.
8710    ///
8711    /// # Arguments
8712    ///
8713    /// * `advertiserId` - Required. The ID of the DV360 advertiser to which the parent negative keyword list belongs.
8714    /// * `negativeKeywordListId` - Required. The ID of the parent negative keyword list to which the requested negative keywords belong.
8715    pub fn negative_keyword_lists_negative_keywords_list(
8716        &self,
8717        advertiser_id: i64,
8718        negative_keyword_list_id: i64,
8719    ) -> AdvertiserNegativeKeywordListNegativeKeywordListCall<'a, C> {
8720        AdvertiserNegativeKeywordListNegativeKeywordListCall {
8721            hub: self.hub,
8722            _advertiser_id: advertiser_id,
8723            _negative_keyword_list_id: negative_keyword_list_id,
8724            _page_token: Default::default(),
8725            _page_size: Default::default(),
8726            _order_by: Default::default(),
8727            _filter: Default::default(),
8728            _delegate: Default::default(),
8729            _additional_params: Default::default(),
8730            _scopes: Default::default(),
8731        }
8732    }
8733
8734    /// Create a builder to help you perform the following task:
8735    ///
8736    /// Replaces all negative keywords in a single negative keyword list. The operation will replace the keywords in a negative keyword list with keywords provided in ReplaceNegativeKeywordsRequest.new_negative_keywords.
8737    ///
8738    /// # Arguments
8739    ///
8740    /// * `request` - No description provided.
8741    /// * `advertiserId` - Required. The ID of the DV360 advertiser to which the parent negative keyword list belongs.
8742    /// * `negativeKeywordListId` - Required. The ID of the parent negative keyword list to which the negative keywords belong.
8743    pub fn negative_keyword_lists_negative_keywords_replace(
8744        &self,
8745        request: ReplaceNegativeKeywordsRequest,
8746        advertiser_id: i64,
8747        negative_keyword_list_id: i64,
8748    ) -> AdvertiserNegativeKeywordListNegativeKeywordReplaceCall<'a, C> {
8749        AdvertiserNegativeKeywordListNegativeKeywordReplaceCall {
8750            hub: self.hub,
8751            _request: request,
8752            _advertiser_id: advertiser_id,
8753            _negative_keyword_list_id: negative_keyword_list_id,
8754            _delegate: Default::default(),
8755            _additional_params: Default::default(),
8756            _scopes: Default::default(),
8757        }
8758    }
8759
8760    /// Create a builder to help you perform the following task:
8761    ///
8762    /// Creates a new negative keyword list. Returns the newly created negative keyword list if successful.
8763    ///
8764    /// # Arguments
8765    ///
8766    /// * `request` - No description provided.
8767    /// * `advertiserId` - Required. The ID of the DV360 advertiser to which the negative keyword list will belong.
8768    pub fn negative_keyword_lists_create(
8769        &self,
8770        request: NegativeKeywordList,
8771        advertiser_id: i64,
8772    ) -> AdvertiserNegativeKeywordListCreateCall<'a, C> {
8773        AdvertiserNegativeKeywordListCreateCall {
8774            hub: self.hub,
8775            _request: request,
8776            _advertiser_id: advertiser_id,
8777            _delegate: Default::default(),
8778            _additional_params: Default::default(),
8779            _scopes: Default::default(),
8780        }
8781    }
8782
8783    /// Create a builder to help you perform the following task:
8784    ///
8785    /// Deletes a negative keyword list given an advertiser ID and a negative keyword list ID.
8786    ///
8787    /// # Arguments
8788    ///
8789    /// * `advertiserId` - Required. The ID of the DV360 advertiser to which the negative keyword list belongs.
8790    /// * `negativeKeywordListId` - Required. The ID of the negative keyword list to delete.
8791    pub fn negative_keyword_lists_delete(
8792        &self,
8793        advertiser_id: i64,
8794        negative_keyword_list_id: i64,
8795    ) -> AdvertiserNegativeKeywordListDeleteCall<'a, C> {
8796        AdvertiserNegativeKeywordListDeleteCall {
8797            hub: self.hub,
8798            _advertiser_id: advertiser_id,
8799            _negative_keyword_list_id: negative_keyword_list_id,
8800            _delegate: Default::default(),
8801            _additional_params: Default::default(),
8802            _scopes: Default::default(),
8803        }
8804    }
8805
8806    /// Create a builder to help you perform the following task:
8807    ///
8808    /// Gets a negative keyword list given an advertiser ID and a negative keyword list ID.
8809    ///
8810    /// # Arguments
8811    ///
8812    /// * `advertiserId` - Required. The ID of the DV360 advertiser to which the fetched negative keyword list belongs.
8813    /// * `negativeKeywordListId` - Required. The ID of the negative keyword list to fetch.
8814    pub fn negative_keyword_lists_get(
8815        &self,
8816        advertiser_id: i64,
8817        negative_keyword_list_id: i64,
8818    ) -> AdvertiserNegativeKeywordListGetCall<'a, C> {
8819        AdvertiserNegativeKeywordListGetCall {
8820            hub: self.hub,
8821            _advertiser_id: advertiser_id,
8822            _negative_keyword_list_id: negative_keyword_list_id,
8823            _delegate: Default::default(),
8824            _additional_params: Default::default(),
8825            _scopes: Default::default(),
8826        }
8827    }
8828
8829    /// Create a builder to help you perform the following task:
8830    ///
8831    /// Lists negative keyword lists based on a given advertiser id.
8832    ///
8833    /// # Arguments
8834    ///
8835    /// * `advertiserId` - Required. The ID of the DV360 advertiser to which the fetched negative keyword lists belong.
8836    pub fn negative_keyword_lists_list(
8837        &self,
8838        advertiser_id: i64,
8839    ) -> AdvertiserNegativeKeywordListListCall<'a, C> {
8840        AdvertiserNegativeKeywordListListCall {
8841            hub: self.hub,
8842            _advertiser_id: advertiser_id,
8843            _page_token: Default::default(),
8844            _page_size: Default::default(),
8845            _delegate: Default::default(),
8846            _additional_params: Default::default(),
8847            _scopes: Default::default(),
8848        }
8849    }
8850
8851    /// Create a builder to help you perform the following task:
8852    ///
8853    /// Updates a negative keyword list. Returns the updated negative keyword list if successful.
8854    ///
8855    /// # Arguments
8856    ///
8857    /// * `request` - No description provided.
8858    /// * `advertiserId` - Required. The ID of the DV360 advertiser to which the negative keyword list belongs.
8859    /// * `negativeKeywordListId` - Output only. The unique ID of the negative keyword list. Assigned by the system.
8860    pub fn negative_keyword_lists_patch(
8861        &self,
8862        request: NegativeKeywordList,
8863        advertiser_id: i64,
8864        negative_keyword_list_id: i64,
8865    ) -> AdvertiserNegativeKeywordListPatchCall<'a, C> {
8866        AdvertiserNegativeKeywordListPatchCall {
8867            hub: self.hub,
8868            _request: request,
8869            _advertiser_id: advertiser_id,
8870            _negative_keyword_list_id: negative_keyword_list_id,
8871            _update_mask: Default::default(),
8872            _delegate: Default::default(),
8873            _additional_params: Default::default(),
8874            _scopes: Default::default(),
8875        }
8876    }
8877
8878    /// Create a builder to help you perform the following task:
8879    ///
8880    /// Assigns a targeting option to an advertiser. Returns the assigned targeting option if successful.
8881    ///
8882    /// # Arguments
8883    ///
8884    /// * `request` - No description provided.
8885    /// * `advertiserId` - Required. The ID of the advertiser.
8886    /// * `targetingType` - Required. Identifies the type of this assigned targeting option. Supported targeting types: * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_KEYWORD`
8887    pub fn targeting_types_assigned_targeting_options_create(
8888        &self,
8889        request: AssignedTargetingOption,
8890        advertiser_id: i64,
8891        targeting_type: &str,
8892    ) -> AdvertiserTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
8893        AdvertiserTargetingTypeAssignedTargetingOptionCreateCall {
8894            hub: self.hub,
8895            _request: request,
8896            _advertiser_id: advertiser_id,
8897            _targeting_type: targeting_type.to_string(),
8898            _delegate: Default::default(),
8899            _additional_params: Default::default(),
8900            _scopes: Default::default(),
8901        }
8902    }
8903
8904    /// Create a builder to help you perform the following task:
8905    ///
8906    /// Deletes an assigned targeting option from an advertiser.
8907    ///
8908    /// # Arguments
8909    ///
8910    /// * `advertiserId` - Required. The ID of the advertiser.
8911    /// * `targetingType` - Required. Identifies the type of this assigned targeting option. Supported targeting types: * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_KEYWORD`
8912    /// * `assignedTargetingOptionId` - Required. The ID of the assigned targeting option to delete.
8913    pub fn targeting_types_assigned_targeting_options_delete(
8914        &self,
8915        advertiser_id: i64,
8916        targeting_type: &str,
8917        assigned_targeting_option_id: &str,
8918    ) -> AdvertiserTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
8919        AdvertiserTargetingTypeAssignedTargetingOptionDeleteCall {
8920            hub: self.hub,
8921            _advertiser_id: advertiser_id,
8922            _targeting_type: targeting_type.to_string(),
8923            _assigned_targeting_option_id: assigned_targeting_option_id.to_string(),
8924            _delegate: Default::default(),
8925            _additional_params: Default::default(),
8926            _scopes: Default::default(),
8927        }
8928    }
8929
8930    /// Create a builder to help you perform the following task:
8931    ///
8932    /// Gets a single targeting option assigned to an advertiser.
8933    ///
8934    /// # Arguments
8935    ///
8936    /// * `advertiserId` - Required. The ID of the advertiser.
8937    /// * `targetingType` - Required. Identifies the type of this assigned targeting option. Supported targeting types: * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_YOUTUBE_VIDEO` * `TARGETING_TYPE_YOUTUBE_CHANNEL` * `TARGETING_TYPE_KEYWORD`
8938    /// * `assignedTargetingOptionId` - Required. An identifier unique to the targeting type in this advertiser that identifies the assigned targeting option being requested.
8939    pub fn targeting_types_assigned_targeting_options_get(
8940        &self,
8941        advertiser_id: i64,
8942        targeting_type: &str,
8943        assigned_targeting_option_id: &str,
8944    ) -> AdvertiserTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
8945        AdvertiserTargetingTypeAssignedTargetingOptionGetCall {
8946            hub: self.hub,
8947            _advertiser_id: advertiser_id,
8948            _targeting_type: targeting_type.to_string(),
8949            _assigned_targeting_option_id: assigned_targeting_option_id.to_string(),
8950            _delegate: Default::default(),
8951            _additional_params: Default::default(),
8952            _scopes: Default::default(),
8953        }
8954    }
8955
8956    /// Create a builder to help you perform the following task:
8957    ///
8958    /// Lists the targeting options assigned to an advertiser.
8959    ///
8960    /// # Arguments
8961    ///
8962    /// * `advertiserId` - Required. The ID of the advertiser.
8963    /// * `targetingType` - Required. Identifies the type of assigned targeting options to list. Supported targeting types: * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_YOUTUBE_VIDEO` * `TARGETING_TYPE_YOUTUBE_CHANNEL` * `TARGETING_TYPE_KEYWORD`
8964    pub fn targeting_types_assigned_targeting_options_list(
8965        &self,
8966        advertiser_id: i64,
8967        targeting_type: &str,
8968    ) -> AdvertiserTargetingTypeAssignedTargetingOptionListCall<'a, C> {
8969        AdvertiserTargetingTypeAssignedTargetingOptionListCall {
8970            hub: self.hub,
8971            _advertiser_id: advertiser_id,
8972            _targeting_type: targeting_type.to_string(),
8973            _page_token: Default::default(),
8974            _page_size: Default::default(),
8975            _order_by: Default::default(),
8976            _filter: Default::default(),
8977            _delegate: Default::default(),
8978            _additional_params: Default::default(),
8979            _scopes: Default::default(),
8980        }
8981    }
8982
8983    /// Create a builder to help you perform the following task:
8984    ///
8985    /// Audits an advertiser. Returns the counts of used entities per resource type under the advertiser provided. Used entities count towards their respective resource limit. See https://support.google.com/displayvideo/answer/6071450.
8986    ///
8987    /// # Arguments
8988    ///
8989    /// * `advertiserId` - Required. The ID of the advertiser to audit.
8990    pub fn audit(&self, advertiser_id: i64) -> AdvertiserAuditCall<'a, C> {
8991        AdvertiserAuditCall {
8992            hub: self.hub,
8993            _advertiser_id: advertiser_id,
8994            _read_mask: Default::default(),
8995            _delegate: Default::default(),
8996            _additional_params: Default::default(),
8997            _scopes: Default::default(),
8998        }
8999    }
9000
9001    /// Create a builder to help you perform the following task:
9002    ///
9003    /// Bulk edits targeting options under a single advertiser. The operation will delete the assigned targeting options provided in BulkEditAdvertiserAssignedTargetingOptionsRequest.delete_requests and then create the assigned targeting options provided in BulkEditAdvertiserAssignedTargetingOptionsRequest.create_requests .
9004    ///
9005    /// # Arguments
9006    ///
9007    /// * `request` - No description provided.
9008    /// * `advertiserId` - Required. The ID of the advertiser.
9009    pub fn bulk_edit_advertiser_assigned_targeting_options(
9010        &self,
9011        request: BulkEditAdvertiserAssignedTargetingOptionsRequest,
9012        advertiser_id: i64,
9013    ) -> AdvertiserBulkEditAdvertiserAssignedTargetingOptionCall<'a, C> {
9014        AdvertiserBulkEditAdvertiserAssignedTargetingOptionCall {
9015            hub: self.hub,
9016            _request: request,
9017            _advertiser_id: advertiser_id,
9018            _delegate: Default::default(),
9019            _additional_params: Default::default(),
9020            _scopes: Default::default(),
9021        }
9022    }
9023
9024    /// Create a builder to help you perform the following task:
9025    ///
9026    /// Lists assigned targeting options of an advertiser across targeting types.
9027    ///
9028    /// # Arguments
9029    ///
9030    /// * `advertiserId` - Required. The ID of the advertiser the line item belongs to.
9031    pub fn bulk_list_advertiser_assigned_targeting_options(
9032        &self,
9033        advertiser_id: i64,
9034    ) -> AdvertiserBulkListAdvertiserAssignedTargetingOptionCall<'a, C> {
9035        AdvertiserBulkListAdvertiserAssignedTargetingOptionCall {
9036            hub: self.hub,
9037            _advertiser_id: advertiser_id,
9038            _page_token: Default::default(),
9039            _page_size: Default::default(),
9040            _order_by: Default::default(),
9041            _filter: Default::default(),
9042            _delegate: Default::default(),
9043            _additional_params: Default::default(),
9044            _scopes: Default::default(),
9045        }
9046    }
9047
9048    /// Create a builder to help you perform the following task:
9049    ///
9050    /// Creates a new advertiser. Returns the newly created advertiser if successful. **This method regularly experiences high latency.** We recommend [increasing your default timeout](https://developers.google.com/display-video/api/guides/best-practices/timeouts#client_library_timeout) to avoid errors.
9051    ///
9052    /// # Arguments
9053    ///
9054    /// * `request` - No description provided.
9055    pub fn create(&self, request: Advertiser) -> AdvertiserCreateCall<'a, C> {
9056        AdvertiserCreateCall {
9057            hub: self.hub,
9058            _request: request,
9059            _delegate: Default::default(),
9060            _additional_params: Default::default(),
9061            _scopes: Default::default(),
9062        }
9063    }
9064
9065    /// Create a builder to help you perform the following task:
9066    ///
9067    /// Deletes an advertiser. Deleting an advertiser will delete all of its child resources, for example, campaigns, insertion orders and line items. A deleted advertiser cannot be recovered.
9068    ///
9069    /// # Arguments
9070    ///
9071    /// * `advertiserId` - The ID of the advertiser we need to delete.
9072    pub fn delete(&self, advertiser_id: i64) -> AdvertiserDeleteCall<'a, C> {
9073        AdvertiserDeleteCall {
9074            hub: self.hub,
9075            _advertiser_id: advertiser_id,
9076            _delegate: Default::default(),
9077            _additional_params: Default::default(),
9078            _scopes: Default::default(),
9079        }
9080    }
9081
9082    /// Create a builder to help you perform the following task:
9083    ///
9084    /// Gets an advertiser.
9085    ///
9086    /// # Arguments
9087    ///
9088    /// * `advertiserId` - Required. The ID of the advertiser to fetch.
9089    pub fn get(&self, advertiser_id: i64) -> AdvertiserGetCall<'a, C> {
9090        AdvertiserGetCall {
9091            hub: self.hub,
9092            _advertiser_id: advertiser_id,
9093            _delegate: Default::default(),
9094            _additional_params: Default::default(),
9095            _scopes: Default::default(),
9096        }
9097    }
9098
9099    /// Create a builder to help you perform the following task:
9100    ///
9101    /// Lists advertisers that are accessible to the current user. The order is defined by the order_by parameter. A single partner_id is required. Cross-partner listing is not supported.
9102    pub fn list(&self) -> AdvertiserListCall<'a, C> {
9103        AdvertiserListCall {
9104            hub: self.hub,
9105            _partner_id: Default::default(),
9106            _page_token: Default::default(),
9107            _page_size: Default::default(),
9108            _order_by: Default::default(),
9109            _filter: Default::default(),
9110            _delegate: Default::default(),
9111            _additional_params: Default::default(),
9112            _scopes: Default::default(),
9113        }
9114    }
9115
9116    /// Create a builder to help you perform the following task:
9117    ///
9118    /// Updates an existing advertiser. Returns the updated advertiser if successful.
9119    ///
9120    /// # Arguments
9121    ///
9122    /// * `request` - No description provided.
9123    /// * `advertiserId` - Output only. The unique ID of the advertiser. Assigned by the system.
9124    pub fn patch(&self, request: Advertiser, advertiser_id: i64) -> AdvertiserPatchCall<'a, C> {
9125        AdvertiserPatchCall {
9126            hub: self.hub,
9127            _request: request,
9128            _advertiser_id: advertiser_id,
9129            _update_mask: Default::default(),
9130            _delegate: Default::default(),
9131            _additional_params: Default::default(),
9132            _scopes: Default::default(),
9133        }
9134    }
9135}
9136
9137/// A builder providing access to all methods supported on *combinedAudience* resources.
9138/// It is not used directly, but through the [`DisplayVideo`] hub.
9139///
9140/// # Example
9141///
9142/// Instantiate a resource builder
9143///
9144/// ```test_harness,no_run
9145/// extern crate hyper;
9146/// extern crate hyper_rustls;
9147/// extern crate google_displayvideo1 as displayvideo1;
9148///
9149/// # async fn dox() {
9150/// use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9151///
9152/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9153/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9154///     secret,
9155///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9156/// ).build().await.unwrap();
9157///
9158/// let client = hyper_util::client::legacy::Client::builder(
9159///     hyper_util::rt::TokioExecutor::new()
9160/// )
9161/// .build(
9162///     hyper_rustls::HttpsConnectorBuilder::new()
9163///         .with_native_roots()
9164///         .unwrap()
9165///         .https_or_http()
9166///         .enable_http1()
9167///         .build()
9168/// );
9169/// let mut hub = DisplayVideo::new(client, auth);
9170/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9171/// // like `get(...)` and `list(...)`
9172/// // to build up your call.
9173/// let rb = hub.combined_audiences();
9174/// # }
9175/// ```
9176pub struct CombinedAudienceMethods<'a, C>
9177where
9178    C: 'a,
9179{
9180    hub: &'a DisplayVideo<C>,
9181}
9182
9183impl<'a, C> common::MethodsBuilder for CombinedAudienceMethods<'a, C> {}
9184
9185impl<'a, C> CombinedAudienceMethods<'a, C> {
9186    /// Create a builder to help you perform the following task:
9187    ///
9188    /// Gets a combined audience.
9189    ///
9190    /// # Arguments
9191    ///
9192    /// * `combinedAudienceId` - Required. The ID of the combined audience to fetch.
9193    pub fn get(&self, combined_audience_id: i64) -> CombinedAudienceGetCall<'a, C> {
9194        CombinedAudienceGetCall {
9195            hub: self.hub,
9196            _combined_audience_id: combined_audience_id,
9197            _partner_id: Default::default(),
9198            _advertiser_id: Default::default(),
9199            _delegate: Default::default(),
9200            _additional_params: Default::default(),
9201            _scopes: Default::default(),
9202        }
9203    }
9204
9205    /// Create a builder to help you perform the following task:
9206    ///
9207    /// Lists combined audiences. The order is defined by the order_by parameter.
9208    pub fn list(&self) -> CombinedAudienceListCall<'a, C> {
9209        CombinedAudienceListCall {
9210            hub: self.hub,
9211            _partner_id: Default::default(),
9212            _page_token: Default::default(),
9213            _page_size: Default::default(),
9214            _order_by: Default::default(),
9215            _filter: Default::default(),
9216            _advertiser_id: Default::default(),
9217            _delegate: Default::default(),
9218            _additional_params: Default::default(),
9219            _scopes: Default::default(),
9220        }
9221    }
9222}
9223
9224/// A builder providing access to all methods supported on *customBiddingAlgorithm* resources.
9225/// It is not used directly, but through the [`DisplayVideo`] hub.
9226///
9227/// # Example
9228///
9229/// Instantiate a resource builder
9230///
9231/// ```test_harness,no_run
9232/// extern crate hyper;
9233/// extern crate hyper_rustls;
9234/// extern crate google_displayvideo1 as displayvideo1;
9235///
9236/// # async fn dox() {
9237/// use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9238///
9239/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9240/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9241///     secret,
9242///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9243/// ).build().await.unwrap();
9244///
9245/// let client = hyper_util::client::legacy::Client::builder(
9246///     hyper_util::rt::TokioExecutor::new()
9247/// )
9248/// .build(
9249///     hyper_rustls::HttpsConnectorBuilder::new()
9250///         .with_native_roots()
9251///         .unwrap()
9252///         .https_or_http()
9253///         .enable_http1()
9254///         .build()
9255/// );
9256/// let mut hub = DisplayVideo::new(client, auth);
9257/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9258/// // like `create(...)`, `get(...)`, `list(...)`, `patch(...)`, `scripts_create(...)`, `scripts_get(...)`, `scripts_list(...)` and `upload_script(...)`
9259/// // to build up your call.
9260/// let rb = hub.custom_bidding_algorithms();
9261/// # }
9262/// ```
9263pub struct CustomBiddingAlgorithmMethods<'a, C>
9264where
9265    C: 'a,
9266{
9267    hub: &'a DisplayVideo<C>,
9268}
9269
9270impl<'a, C> common::MethodsBuilder for CustomBiddingAlgorithmMethods<'a, C> {}
9271
9272impl<'a, C> CustomBiddingAlgorithmMethods<'a, C> {
9273    /// Create a builder to help you perform the following task:
9274    ///
9275    /// Creates a new custom bidding script. Returns the newly created script if successful.
9276    ///
9277    /// # Arguments
9278    ///
9279    /// * `request` - No description provided.
9280    /// * `customBiddingAlgorithmId` - Required. The ID of the custom bidding algorithm that owns the script.
9281    pub fn scripts_create(
9282        &self,
9283        request: CustomBiddingScript,
9284        custom_bidding_algorithm_id: i64,
9285    ) -> CustomBiddingAlgorithmScriptCreateCall<'a, C> {
9286        CustomBiddingAlgorithmScriptCreateCall {
9287            hub: self.hub,
9288            _request: request,
9289            _custom_bidding_algorithm_id: custom_bidding_algorithm_id,
9290            _partner_id: Default::default(),
9291            _advertiser_id: Default::default(),
9292            _delegate: Default::default(),
9293            _additional_params: Default::default(),
9294            _scopes: Default::default(),
9295        }
9296    }
9297
9298    /// Create a builder to help you perform the following task:
9299    ///
9300    /// Gets a custom bidding script.
9301    ///
9302    /// # Arguments
9303    ///
9304    /// * `customBiddingAlgorithmId` - Required. The ID of the custom bidding algorithm owns the script.
9305    /// * `customBiddingScriptId` - Required. The ID of the custom bidding script to fetch.
9306    pub fn scripts_get(
9307        &self,
9308        custom_bidding_algorithm_id: i64,
9309        custom_bidding_script_id: i64,
9310    ) -> CustomBiddingAlgorithmScriptGetCall<'a, C> {
9311        CustomBiddingAlgorithmScriptGetCall {
9312            hub: self.hub,
9313            _custom_bidding_algorithm_id: custom_bidding_algorithm_id,
9314            _custom_bidding_script_id: custom_bidding_script_id,
9315            _partner_id: Default::default(),
9316            _advertiser_id: Default::default(),
9317            _delegate: Default::default(),
9318            _additional_params: Default::default(),
9319            _scopes: Default::default(),
9320        }
9321    }
9322
9323    /// Create a builder to help you perform the following task:
9324    ///
9325    /// Lists custom bidding scripts that belong to the given algorithm. The order is defined by the order_by parameter.
9326    ///
9327    /// # Arguments
9328    ///
9329    /// * `customBiddingAlgorithmId` - Required. The ID of the custom bidding algorithm owns the script.
9330    pub fn scripts_list(
9331        &self,
9332        custom_bidding_algorithm_id: i64,
9333    ) -> CustomBiddingAlgorithmScriptListCall<'a, C> {
9334        CustomBiddingAlgorithmScriptListCall {
9335            hub: self.hub,
9336            _custom_bidding_algorithm_id: custom_bidding_algorithm_id,
9337            _partner_id: Default::default(),
9338            _page_token: Default::default(),
9339            _page_size: Default::default(),
9340            _order_by: Default::default(),
9341            _advertiser_id: Default::default(),
9342            _delegate: Default::default(),
9343            _additional_params: Default::default(),
9344            _scopes: Default::default(),
9345        }
9346    }
9347
9348    /// Create a builder to help you perform the following task:
9349    ///
9350    /// Creates a new custom bidding algorithm. Returns the newly created custom bidding algorithm if successful.
9351    ///
9352    /// # Arguments
9353    ///
9354    /// * `request` - No description provided.
9355    pub fn create(
9356        &self,
9357        request: CustomBiddingAlgorithm,
9358    ) -> CustomBiddingAlgorithmCreateCall<'a, C> {
9359        CustomBiddingAlgorithmCreateCall {
9360            hub: self.hub,
9361            _request: request,
9362            _delegate: Default::default(),
9363            _additional_params: Default::default(),
9364            _scopes: Default::default(),
9365        }
9366    }
9367
9368    /// Create a builder to help you perform the following task:
9369    ///
9370    /// Gets a custom bidding algorithm.
9371    ///
9372    /// # Arguments
9373    ///
9374    /// * `customBiddingAlgorithmId` - Required. The ID of the custom bidding algorithm to fetch.
9375    pub fn get(&self, custom_bidding_algorithm_id: i64) -> CustomBiddingAlgorithmGetCall<'a, C> {
9376        CustomBiddingAlgorithmGetCall {
9377            hub: self.hub,
9378            _custom_bidding_algorithm_id: custom_bidding_algorithm_id,
9379            _partner_id: Default::default(),
9380            _advertiser_id: Default::default(),
9381            _delegate: Default::default(),
9382            _additional_params: Default::default(),
9383            _scopes: Default::default(),
9384        }
9385    }
9386
9387    /// Create a builder to help you perform the following task:
9388    ///
9389    /// Lists custom bidding algorithms that are accessible to the current user and can be used in bidding stratgies. The order is defined by the order_by parameter.
9390    pub fn list(&self) -> CustomBiddingAlgorithmListCall<'a, C> {
9391        CustomBiddingAlgorithmListCall {
9392            hub: self.hub,
9393            _partner_id: Default::default(),
9394            _page_token: Default::default(),
9395            _page_size: Default::default(),
9396            _order_by: Default::default(),
9397            _filter: Default::default(),
9398            _advertiser_id: Default::default(),
9399            _delegate: Default::default(),
9400            _additional_params: Default::default(),
9401            _scopes: Default::default(),
9402        }
9403    }
9404
9405    /// Create a builder to help you perform the following task:
9406    ///
9407    /// Updates an existing custom bidding algorithm. Returns the updated custom bidding algorithm if successful.
9408    ///
9409    /// # Arguments
9410    ///
9411    /// * `request` - No description provided.
9412    /// * `customBiddingAlgorithmId` - Output only. The unique ID of the custom bidding algorithm. Assigned by the system.
9413    pub fn patch(
9414        &self,
9415        request: CustomBiddingAlgorithm,
9416        custom_bidding_algorithm_id: i64,
9417    ) -> CustomBiddingAlgorithmPatchCall<'a, C> {
9418        CustomBiddingAlgorithmPatchCall {
9419            hub: self.hub,
9420            _request: request,
9421            _custom_bidding_algorithm_id: custom_bidding_algorithm_id,
9422            _update_mask: Default::default(),
9423            _delegate: Default::default(),
9424            _additional_params: Default::default(),
9425            _scopes: Default::default(),
9426        }
9427    }
9428
9429    /// Create a builder to help you perform the following task:
9430    ///
9431    /// Creates a custom bidding script reference object for a script file. The resulting reference object provides a resource path to which the script file should be uploaded. This reference object should be included in when creating a new custom bidding script object.
9432    ///
9433    /// # Arguments
9434    ///
9435    /// * `customBiddingAlgorithmId` - Required. The ID of the custom bidding algorithm owns the script.
9436    pub fn upload_script(
9437        &self,
9438        custom_bidding_algorithm_id: i64,
9439    ) -> CustomBiddingAlgorithmUploadScriptCall<'a, C> {
9440        CustomBiddingAlgorithmUploadScriptCall {
9441            hub: self.hub,
9442            _custom_bidding_algorithm_id: custom_bidding_algorithm_id,
9443            _partner_id: Default::default(),
9444            _advertiser_id: Default::default(),
9445            _delegate: Default::default(),
9446            _additional_params: Default::default(),
9447            _scopes: Default::default(),
9448        }
9449    }
9450}
9451
9452/// A builder providing access to all methods supported on *customList* resources.
9453/// It is not used directly, but through the [`DisplayVideo`] hub.
9454///
9455/// # Example
9456///
9457/// Instantiate a resource builder
9458///
9459/// ```test_harness,no_run
9460/// extern crate hyper;
9461/// extern crate hyper_rustls;
9462/// extern crate google_displayvideo1 as displayvideo1;
9463///
9464/// # async fn dox() {
9465/// use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9466///
9467/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9468/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9469///     secret,
9470///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9471/// ).build().await.unwrap();
9472///
9473/// let client = hyper_util::client::legacy::Client::builder(
9474///     hyper_util::rt::TokioExecutor::new()
9475/// )
9476/// .build(
9477///     hyper_rustls::HttpsConnectorBuilder::new()
9478///         .with_native_roots()
9479///         .unwrap()
9480///         .https_or_http()
9481///         .enable_http1()
9482///         .build()
9483/// );
9484/// let mut hub = DisplayVideo::new(client, auth);
9485/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9486/// // like `get(...)` and `list(...)`
9487/// // to build up your call.
9488/// let rb = hub.custom_lists();
9489/// # }
9490/// ```
9491pub struct CustomListMethods<'a, C>
9492where
9493    C: 'a,
9494{
9495    hub: &'a DisplayVideo<C>,
9496}
9497
9498impl<'a, C> common::MethodsBuilder for CustomListMethods<'a, C> {}
9499
9500impl<'a, C> CustomListMethods<'a, C> {
9501    /// Create a builder to help you perform the following task:
9502    ///
9503    /// Gets a custom list.
9504    ///
9505    /// # Arguments
9506    ///
9507    /// * `customListId` - Required. The ID of the custom list to fetch.
9508    pub fn get(&self, custom_list_id: i64) -> CustomListGetCall<'a, C> {
9509        CustomListGetCall {
9510            hub: self.hub,
9511            _custom_list_id: custom_list_id,
9512            _advertiser_id: Default::default(),
9513            _delegate: Default::default(),
9514            _additional_params: Default::default(),
9515            _scopes: Default::default(),
9516        }
9517    }
9518
9519    /// Create a builder to help you perform the following task:
9520    ///
9521    /// Lists custom lists. The order is defined by the order_by parameter.
9522    pub fn list(&self) -> CustomListListCall<'a, C> {
9523        CustomListListCall {
9524            hub: self.hub,
9525            _page_token: Default::default(),
9526            _page_size: Default::default(),
9527            _order_by: Default::default(),
9528            _filter: Default::default(),
9529            _advertiser_id: Default::default(),
9530            _delegate: Default::default(),
9531            _additional_params: Default::default(),
9532            _scopes: Default::default(),
9533        }
9534    }
9535}
9536
9537/// A builder providing access to all methods supported on *firstAndThirdPartyAudience* resources.
9538/// It is not used directly, but through the [`DisplayVideo`] hub.
9539///
9540/// # Example
9541///
9542/// Instantiate a resource builder
9543///
9544/// ```test_harness,no_run
9545/// extern crate hyper;
9546/// extern crate hyper_rustls;
9547/// extern crate google_displayvideo1 as displayvideo1;
9548///
9549/// # async fn dox() {
9550/// use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9551///
9552/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9553/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9554///     secret,
9555///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9556/// ).build().await.unwrap();
9557///
9558/// let client = hyper_util::client::legacy::Client::builder(
9559///     hyper_util::rt::TokioExecutor::new()
9560/// )
9561/// .build(
9562///     hyper_rustls::HttpsConnectorBuilder::new()
9563///         .with_native_roots()
9564///         .unwrap()
9565///         .https_or_http()
9566///         .enable_http1()
9567///         .build()
9568/// );
9569/// let mut hub = DisplayVideo::new(client, auth);
9570/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9571/// // like `create(...)`, `edit_customer_match_members(...)`, `get(...)`, `list(...)` and `patch(...)`
9572/// // to build up your call.
9573/// let rb = hub.first_and_third_party_audiences();
9574/// # }
9575/// ```
9576pub struct FirstAndThirdPartyAudienceMethods<'a, C>
9577where
9578    C: 'a,
9579{
9580    hub: &'a DisplayVideo<C>,
9581}
9582
9583impl<'a, C> common::MethodsBuilder for FirstAndThirdPartyAudienceMethods<'a, C> {}
9584
9585impl<'a, C> FirstAndThirdPartyAudienceMethods<'a, C> {
9586    /// Create a builder to help you perform the following task:
9587    ///
9588    /// Creates a FirstAndThirdPartyAudience. Only supported for the following audience_type: * `CUSTOMER_MATCH_CONTACT_INFO` * `CUSTOMER_MATCH_DEVICE_ID`
9589    ///
9590    /// # Arguments
9591    ///
9592    /// * `request` - No description provided.
9593    pub fn create(
9594        &self,
9595        request: FirstAndThirdPartyAudience,
9596    ) -> FirstAndThirdPartyAudienceCreateCall<'a, C> {
9597        FirstAndThirdPartyAudienceCreateCall {
9598            hub: self.hub,
9599            _request: request,
9600            _advertiser_id: Default::default(),
9601            _delegate: Default::default(),
9602            _additional_params: Default::default(),
9603            _scopes: Default::default(),
9604        }
9605    }
9606
9607    /// Create a builder to help you perform the following task:
9608    ///
9609    /// Updates the member list of a Customer Match audience. Only supported for the following audience_type: * `CUSTOMER_MATCH_CONTACT_INFO` * `CUSTOMER_MATCH_DEVICE_ID`
9610    ///
9611    /// # Arguments
9612    ///
9613    /// * `request` - No description provided.
9614    /// * `firstAndThirdPartyAudienceId` - Required. The ID of the Customer Match FirstAndThirdPartyAudience whose members will be edited.
9615    pub fn edit_customer_match_members(
9616        &self,
9617        request: EditCustomerMatchMembersRequest,
9618        first_and_third_party_audience_id: i64,
9619    ) -> FirstAndThirdPartyAudienceEditCustomerMatchMemberCall<'a, C> {
9620        FirstAndThirdPartyAudienceEditCustomerMatchMemberCall {
9621            hub: self.hub,
9622            _request: request,
9623            _first_and_third_party_audience_id: first_and_third_party_audience_id,
9624            _delegate: Default::default(),
9625            _additional_params: Default::default(),
9626            _scopes: Default::default(),
9627        }
9628    }
9629
9630    /// Create a builder to help you perform the following task:
9631    ///
9632    /// Gets a first and third party audience.
9633    ///
9634    /// # Arguments
9635    ///
9636    /// * `firstAndThirdPartyAudienceId` - Required. The ID of the first and third party audience to fetch.
9637    pub fn get(
9638        &self,
9639        first_and_third_party_audience_id: i64,
9640    ) -> FirstAndThirdPartyAudienceGetCall<'a, C> {
9641        FirstAndThirdPartyAudienceGetCall {
9642            hub: self.hub,
9643            _first_and_third_party_audience_id: first_and_third_party_audience_id,
9644            _partner_id: Default::default(),
9645            _advertiser_id: Default::default(),
9646            _delegate: Default::default(),
9647            _additional_params: Default::default(),
9648            _scopes: Default::default(),
9649        }
9650    }
9651
9652    /// Create a builder to help you perform the following task:
9653    ///
9654    /// Lists first and third party audiences. The order is defined by the order_by parameter.
9655    pub fn list(&self) -> FirstAndThirdPartyAudienceListCall<'a, C> {
9656        FirstAndThirdPartyAudienceListCall {
9657            hub: self.hub,
9658            _partner_id: Default::default(),
9659            _page_token: Default::default(),
9660            _page_size: Default::default(),
9661            _order_by: Default::default(),
9662            _filter: Default::default(),
9663            _advertiser_id: Default::default(),
9664            _delegate: Default::default(),
9665            _additional_params: Default::default(),
9666            _scopes: Default::default(),
9667        }
9668    }
9669
9670    /// Create a builder to help you perform the following task:
9671    ///
9672    /// Updates an existing FirstAndThirdPartyAudience. Only supported for the following audience_type: * `CUSTOMER_MATCH_CONTACT_INFO` * `CUSTOMER_MATCH_DEVICE_ID`
9673    ///
9674    /// # Arguments
9675    ///
9676    /// * `request` - No description provided.
9677    /// * `firstAndThirdPartyAudienceId` - Output only. The unique ID of the first and third party audience. Assigned by the system.
9678    pub fn patch(
9679        &self,
9680        request: FirstAndThirdPartyAudience,
9681        first_and_third_party_audience_id: i64,
9682    ) -> FirstAndThirdPartyAudiencePatchCall<'a, C> {
9683        FirstAndThirdPartyAudiencePatchCall {
9684            hub: self.hub,
9685            _request: request,
9686            _first_and_third_party_audience_id: first_and_third_party_audience_id,
9687            _update_mask: Default::default(),
9688            _advertiser_id: Default::default(),
9689            _delegate: Default::default(),
9690            _additional_params: Default::default(),
9691            _scopes: Default::default(),
9692        }
9693    }
9694}
9695
9696/// A builder providing access to all methods supported on *floodlightGroup* resources.
9697/// It is not used directly, but through the [`DisplayVideo`] hub.
9698///
9699/// # Example
9700///
9701/// Instantiate a resource builder
9702///
9703/// ```test_harness,no_run
9704/// extern crate hyper;
9705/// extern crate hyper_rustls;
9706/// extern crate google_displayvideo1 as displayvideo1;
9707///
9708/// # async fn dox() {
9709/// use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9710///
9711/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9712/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9713///     secret,
9714///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9715/// ).build().await.unwrap();
9716///
9717/// let client = hyper_util::client::legacy::Client::builder(
9718///     hyper_util::rt::TokioExecutor::new()
9719/// )
9720/// .build(
9721///     hyper_rustls::HttpsConnectorBuilder::new()
9722///         .with_native_roots()
9723///         .unwrap()
9724///         .https_or_http()
9725///         .enable_http1()
9726///         .build()
9727/// );
9728/// let mut hub = DisplayVideo::new(client, auth);
9729/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9730/// // like `get(...)` and `patch(...)`
9731/// // to build up your call.
9732/// let rb = hub.floodlight_groups();
9733/// # }
9734/// ```
9735pub struct FloodlightGroupMethods<'a, C>
9736where
9737    C: 'a,
9738{
9739    hub: &'a DisplayVideo<C>,
9740}
9741
9742impl<'a, C> common::MethodsBuilder for FloodlightGroupMethods<'a, C> {}
9743
9744impl<'a, C> FloodlightGroupMethods<'a, C> {
9745    /// Create a builder to help you perform the following task:
9746    ///
9747    /// Gets a Floodlight group.
9748    ///
9749    /// # Arguments
9750    ///
9751    /// * `floodlightGroupId` - Required. The ID of the Floodlight group to fetch.
9752    pub fn get(&self, floodlight_group_id: i64) -> FloodlightGroupGetCall<'a, C> {
9753        FloodlightGroupGetCall {
9754            hub: self.hub,
9755            _floodlight_group_id: floodlight_group_id,
9756            _partner_id: Default::default(),
9757            _delegate: Default::default(),
9758            _additional_params: Default::default(),
9759            _scopes: Default::default(),
9760        }
9761    }
9762
9763    /// Create a builder to help you perform the following task:
9764    ///
9765    /// Updates an existing Floodlight group. Returns the updated Floodlight group if successful.
9766    ///
9767    /// # Arguments
9768    ///
9769    /// * `request` - No description provided.
9770    /// * `floodlightGroupId` - Output only. The unique ID of the Floodlight group. Assigned by the system.
9771    pub fn patch(
9772        &self,
9773        request: FloodlightGroup,
9774        floodlight_group_id: i64,
9775    ) -> FloodlightGroupPatchCall<'a, C> {
9776        FloodlightGroupPatchCall {
9777            hub: self.hub,
9778            _request: request,
9779            _floodlight_group_id: floodlight_group_id,
9780            _update_mask: Default::default(),
9781            _partner_id: Default::default(),
9782            _delegate: Default::default(),
9783            _additional_params: Default::default(),
9784            _scopes: Default::default(),
9785        }
9786    }
9787}
9788
9789/// A builder providing access to all methods supported on *googleAudience* resources.
9790/// It is not used directly, but through the [`DisplayVideo`] hub.
9791///
9792/// # Example
9793///
9794/// Instantiate a resource builder
9795///
9796/// ```test_harness,no_run
9797/// extern crate hyper;
9798/// extern crate hyper_rustls;
9799/// extern crate google_displayvideo1 as displayvideo1;
9800///
9801/// # async fn dox() {
9802/// use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9803///
9804/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9805/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9806///     secret,
9807///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9808/// ).build().await.unwrap();
9809///
9810/// let client = hyper_util::client::legacy::Client::builder(
9811///     hyper_util::rt::TokioExecutor::new()
9812/// )
9813/// .build(
9814///     hyper_rustls::HttpsConnectorBuilder::new()
9815///         .with_native_roots()
9816///         .unwrap()
9817///         .https_or_http()
9818///         .enable_http1()
9819///         .build()
9820/// );
9821/// let mut hub = DisplayVideo::new(client, auth);
9822/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9823/// // like `get(...)` and `list(...)`
9824/// // to build up your call.
9825/// let rb = hub.google_audiences();
9826/// # }
9827/// ```
9828pub struct GoogleAudienceMethods<'a, C>
9829where
9830    C: 'a,
9831{
9832    hub: &'a DisplayVideo<C>,
9833}
9834
9835impl<'a, C> common::MethodsBuilder for GoogleAudienceMethods<'a, C> {}
9836
9837impl<'a, C> GoogleAudienceMethods<'a, C> {
9838    /// Create a builder to help you perform the following task:
9839    ///
9840    /// Gets a Google audience.
9841    ///
9842    /// # Arguments
9843    ///
9844    /// * `googleAudienceId` - Required. The ID of the Google audience to fetch.
9845    pub fn get(&self, google_audience_id: i64) -> GoogleAudienceGetCall<'a, C> {
9846        GoogleAudienceGetCall {
9847            hub: self.hub,
9848            _google_audience_id: google_audience_id,
9849            _partner_id: Default::default(),
9850            _advertiser_id: Default::default(),
9851            _delegate: Default::default(),
9852            _additional_params: Default::default(),
9853            _scopes: Default::default(),
9854        }
9855    }
9856
9857    /// Create a builder to help you perform the following task:
9858    ///
9859    /// Lists Google audiences. The order is defined by the order_by parameter.
9860    pub fn list(&self) -> GoogleAudienceListCall<'a, C> {
9861        GoogleAudienceListCall {
9862            hub: self.hub,
9863            _partner_id: Default::default(),
9864            _page_token: Default::default(),
9865            _page_size: Default::default(),
9866            _order_by: Default::default(),
9867            _filter: Default::default(),
9868            _advertiser_id: Default::default(),
9869            _delegate: Default::default(),
9870            _additional_params: Default::default(),
9871            _scopes: Default::default(),
9872        }
9873    }
9874}
9875
9876/// A builder providing access to all methods supported on *guaranteedOrder* resources.
9877/// It is not used directly, but through the [`DisplayVideo`] hub.
9878///
9879/// # Example
9880///
9881/// Instantiate a resource builder
9882///
9883/// ```test_harness,no_run
9884/// extern crate hyper;
9885/// extern crate hyper_rustls;
9886/// extern crate google_displayvideo1 as displayvideo1;
9887///
9888/// # async fn dox() {
9889/// use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9890///
9891/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9892/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9893///     secret,
9894///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9895/// ).build().await.unwrap();
9896///
9897/// let client = hyper_util::client::legacy::Client::builder(
9898///     hyper_util::rt::TokioExecutor::new()
9899/// )
9900/// .build(
9901///     hyper_rustls::HttpsConnectorBuilder::new()
9902///         .with_native_roots()
9903///         .unwrap()
9904///         .https_or_http()
9905///         .enable_http1()
9906///         .build()
9907/// );
9908/// let mut hub = DisplayVideo::new(client, auth);
9909/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9910/// // like `create(...)`, `edit_guaranteed_order_read_accessors(...)`, `get(...)`, `list(...)` and `patch(...)`
9911/// // to build up your call.
9912/// let rb = hub.guaranteed_orders();
9913/// # }
9914/// ```
9915pub struct GuaranteedOrderMethods<'a, C>
9916where
9917    C: 'a,
9918{
9919    hub: &'a DisplayVideo<C>,
9920}
9921
9922impl<'a, C> common::MethodsBuilder for GuaranteedOrderMethods<'a, C> {}
9923
9924impl<'a, C> GuaranteedOrderMethods<'a, C> {
9925    /// Create a builder to help you perform the following task:
9926    ///
9927    /// Creates a new guaranteed order. Returns the newly created guaranteed order if successful.
9928    ///
9929    /// # Arguments
9930    ///
9931    /// * `request` - No description provided.
9932    pub fn create(&self, request: GuaranteedOrder) -> GuaranteedOrderCreateCall<'a, C> {
9933        GuaranteedOrderCreateCall {
9934            hub: self.hub,
9935            _request: request,
9936            _partner_id: Default::default(),
9937            _advertiser_id: Default::default(),
9938            _delegate: Default::default(),
9939            _additional_params: Default::default(),
9940            _scopes: Default::default(),
9941        }
9942    }
9943
9944    /// Create a builder to help you perform the following task:
9945    ///
9946    /// Edits read advertisers of a guaranteed order.
9947    ///
9948    /// # Arguments
9949    ///
9950    /// * `request` - No description provided.
9951    /// * `guaranteedOrderId` - Required. The ID of the guaranteed order to edit. The ID is of the format `{exchange}-{legacy_guaranteed_order_id}`
9952    pub fn edit_guaranteed_order_read_accessors(
9953        &self,
9954        request: EditGuaranteedOrderReadAccessorsRequest,
9955        guaranteed_order_id: &str,
9956    ) -> GuaranteedOrderEditGuaranteedOrderReadAccessorCall<'a, C> {
9957        GuaranteedOrderEditGuaranteedOrderReadAccessorCall {
9958            hub: self.hub,
9959            _request: request,
9960            _guaranteed_order_id: guaranteed_order_id.to_string(),
9961            _delegate: Default::default(),
9962            _additional_params: Default::default(),
9963            _scopes: Default::default(),
9964        }
9965    }
9966
9967    /// Create a builder to help you perform the following task:
9968    ///
9969    /// Gets a guaranteed order.
9970    ///
9971    /// # Arguments
9972    ///
9973    /// * `guaranteedOrderId` - Required. The ID of the guaranteed order to fetch. The ID is of the format `{exchange}-{legacy_guaranteed_order_id}`
9974    pub fn get(&self, guaranteed_order_id: &str) -> GuaranteedOrderGetCall<'a, C> {
9975        GuaranteedOrderGetCall {
9976            hub: self.hub,
9977            _guaranteed_order_id: guaranteed_order_id.to_string(),
9978            _partner_id: Default::default(),
9979            _advertiser_id: Default::default(),
9980            _delegate: Default::default(),
9981            _additional_params: Default::default(),
9982            _scopes: Default::default(),
9983        }
9984    }
9985
9986    /// Create a builder to help you perform the following task:
9987    ///
9988    /// Lists guaranteed orders that are accessible to the current user. The order is defined by the order_by parameter. If a filter by entity_status is not specified, guaranteed orders with entity status `ENTITY_STATUS_ARCHIVED` will not be included in the results.
9989    pub fn list(&self) -> GuaranteedOrderListCall<'a, C> {
9990        GuaranteedOrderListCall {
9991            hub: self.hub,
9992            _partner_id: Default::default(),
9993            _page_token: Default::default(),
9994            _page_size: Default::default(),
9995            _order_by: Default::default(),
9996            _filter: Default::default(),
9997            _advertiser_id: Default::default(),
9998            _delegate: Default::default(),
9999            _additional_params: Default::default(),
10000            _scopes: Default::default(),
10001        }
10002    }
10003
10004    /// Create a builder to help you perform the following task:
10005    ///
10006    /// Updates an existing guaranteed order. Returns the updated guaranteed order if successful.
10007    ///
10008    /// # Arguments
10009    ///
10010    /// * `request` - No description provided.
10011    /// * `guaranteedOrderId` - Output only. The unique identifier of the guaranteed order. The guaranteed order IDs have the format `{exchange}-{legacy_guaranteed_order_id}`.
10012    pub fn patch(
10013        &self,
10014        request: GuaranteedOrder,
10015        guaranteed_order_id: &str,
10016    ) -> GuaranteedOrderPatchCall<'a, C> {
10017        GuaranteedOrderPatchCall {
10018            hub: self.hub,
10019            _request: request,
10020            _guaranteed_order_id: guaranteed_order_id.to_string(),
10021            _update_mask: Default::default(),
10022            _partner_id: Default::default(),
10023            _advertiser_id: Default::default(),
10024            _delegate: Default::default(),
10025            _additional_params: Default::default(),
10026            _scopes: Default::default(),
10027        }
10028    }
10029}
10030
10031/// A builder providing access to all methods supported on *inventorySourceGroup* resources.
10032/// It is not used directly, but through the [`DisplayVideo`] hub.
10033///
10034/// # Example
10035///
10036/// Instantiate a resource builder
10037///
10038/// ```test_harness,no_run
10039/// extern crate hyper;
10040/// extern crate hyper_rustls;
10041/// extern crate google_displayvideo1 as displayvideo1;
10042///
10043/// # async fn dox() {
10044/// use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10045///
10046/// let secret: yup_oauth2::ApplicationSecret = Default::default();
10047/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10048///     secret,
10049///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10050/// ).build().await.unwrap();
10051///
10052/// let client = hyper_util::client::legacy::Client::builder(
10053///     hyper_util::rt::TokioExecutor::new()
10054/// )
10055/// .build(
10056///     hyper_rustls::HttpsConnectorBuilder::new()
10057///         .with_native_roots()
10058///         .unwrap()
10059///         .https_or_http()
10060///         .enable_http1()
10061///         .build()
10062/// );
10063/// let mut hub = DisplayVideo::new(client, auth);
10064/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
10065/// // like `assigned_inventory_sources_bulk_edit(...)`, `assigned_inventory_sources_create(...)`, `assigned_inventory_sources_delete(...)`, `assigned_inventory_sources_list(...)`, `create(...)`, `delete(...)`, `get(...)`, `list(...)` and `patch(...)`
10066/// // to build up your call.
10067/// let rb = hub.inventory_source_groups();
10068/// # }
10069/// ```
10070pub struct InventorySourceGroupMethods<'a, C>
10071where
10072    C: 'a,
10073{
10074    hub: &'a DisplayVideo<C>,
10075}
10076
10077impl<'a, C> common::MethodsBuilder for InventorySourceGroupMethods<'a, C> {}
10078
10079impl<'a, C> InventorySourceGroupMethods<'a, C> {
10080    /// Create a builder to help you perform the following task:
10081    ///
10082    /// Bulk edits multiple assignments between inventory sources and a single inventory source group. The operation will delete the assigned inventory sources provided in BulkEditAssignedInventorySourcesRequest.deleted_assigned_inventory_sources and then create the assigned inventory sources provided in BulkEditAssignedInventorySourcesRequest.created_assigned_inventory_sources.
10083    ///
10084    /// # Arguments
10085    ///
10086    /// * `request` - No description provided.
10087    /// * `inventorySourceGroupId` - Required. The ID of the inventory source group to which the assignments are assigned.
10088    pub fn assigned_inventory_sources_bulk_edit(
10089        &self,
10090        request: BulkEditAssignedInventorySourcesRequest,
10091        inventory_source_group_id: i64,
10092    ) -> InventorySourceGroupAssignedInventorySourceBulkEditCall<'a, C> {
10093        InventorySourceGroupAssignedInventorySourceBulkEditCall {
10094            hub: self.hub,
10095            _request: request,
10096            _inventory_source_group_id: inventory_source_group_id,
10097            _delegate: Default::default(),
10098            _additional_params: Default::default(),
10099            _scopes: Default::default(),
10100        }
10101    }
10102
10103    /// Create a builder to help you perform the following task:
10104    ///
10105    /// Creates an assignment between an inventory source and an inventory source group.
10106    ///
10107    /// # Arguments
10108    ///
10109    /// * `request` - No description provided.
10110    /// * `inventorySourceGroupId` - Required. The ID of the inventory source group to which the assignment will be assigned.
10111    pub fn assigned_inventory_sources_create(
10112        &self,
10113        request: AssignedInventorySource,
10114        inventory_source_group_id: i64,
10115    ) -> InventorySourceGroupAssignedInventorySourceCreateCall<'a, C> {
10116        InventorySourceGroupAssignedInventorySourceCreateCall {
10117            hub: self.hub,
10118            _request: request,
10119            _inventory_source_group_id: inventory_source_group_id,
10120            _partner_id: Default::default(),
10121            _advertiser_id: Default::default(),
10122            _delegate: Default::default(),
10123            _additional_params: Default::default(),
10124            _scopes: Default::default(),
10125        }
10126    }
10127
10128    /// Create a builder to help you perform the following task:
10129    ///
10130    /// Deletes the assignment between an inventory source and an inventory source group.
10131    ///
10132    /// # Arguments
10133    ///
10134    /// * `inventorySourceGroupId` - Required. The ID of the inventory source group to which this assignment is assigned.
10135    /// * `assignedInventorySourceId` - Required. The ID of the assigned inventory source to delete.
10136    pub fn assigned_inventory_sources_delete(
10137        &self,
10138        inventory_source_group_id: i64,
10139        assigned_inventory_source_id: i64,
10140    ) -> InventorySourceGroupAssignedInventorySourceDeleteCall<'a, C> {
10141        InventorySourceGroupAssignedInventorySourceDeleteCall {
10142            hub: self.hub,
10143            _inventory_source_group_id: inventory_source_group_id,
10144            _assigned_inventory_source_id: assigned_inventory_source_id,
10145            _partner_id: Default::default(),
10146            _advertiser_id: Default::default(),
10147            _delegate: Default::default(),
10148            _additional_params: Default::default(),
10149            _scopes: Default::default(),
10150        }
10151    }
10152
10153    /// Create a builder to help you perform the following task:
10154    ///
10155    /// Lists inventory sources assigned to an inventory source group.
10156    ///
10157    /// # Arguments
10158    ///
10159    /// * `inventorySourceGroupId` - Required. The ID of the inventory source group to which these assignments are assigned.
10160    pub fn assigned_inventory_sources_list(
10161        &self,
10162        inventory_source_group_id: i64,
10163    ) -> InventorySourceGroupAssignedInventorySourceListCall<'a, C> {
10164        InventorySourceGroupAssignedInventorySourceListCall {
10165            hub: self.hub,
10166            _inventory_source_group_id: inventory_source_group_id,
10167            _partner_id: Default::default(),
10168            _page_token: Default::default(),
10169            _page_size: Default::default(),
10170            _order_by: Default::default(),
10171            _filter: Default::default(),
10172            _advertiser_id: Default::default(),
10173            _delegate: Default::default(),
10174            _additional_params: Default::default(),
10175            _scopes: Default::default(),
10176        }
10177    }
10178
10179    /// Create a builder to help you perform the following task:
10180    ///
10181    /// Creates a new inventory source group. Returns the newly created inventory source group if successful.
10182    ///
10183    /// # Arguments
10184    ///
10185    /// * `request` - No description provided.
10186    pub fn create(&self, request: InventorySourceGroup) -> InventorySourceGroupCreateCall<'a, C> {
10187        InventorySourceGroupCreateCall {
10188            hub: self.hub,
10189            _request: request,
10190            _partner_id: Default::default(),
10191            _advertiser_id: Default::default(),
10192            _delegate: Default::default(),
10193            _additional_params: Default::default(),
10194            _scopes: Default::default(),
10195        }
10196    }
10197
10198    /// Create a builder to help you perform the following task:
10199    ///
10200    /// Deletes an inventory source group.
10201    ///
10202    /// # Arguments
10203    ///
10204    /// * `inventorySourceGroupId` - Required. The ID of the inventory source group to delete.
10205    pub fn delete(&self, inventory_source_group_id: i64) -> InventorySourceGroupDeleteCall<'a, C> {
10206        InventorySourceGroupDeleteCall {
10207            hub: self.hub,
10208            _inventory_source_group_id: inventory_source_group_id,
10209            _partner_id: Default::default(),
10210            _advertiser_id: Default::default(),
10211            _delegate: Default::default(),
10212            _additional_params: Default::default(),
10213            _scopes: Default::default(),
10214        }
10215    }
10216
10217    /// Create a builder to help you perform the following task:
10218    ///
10219    /// Gets an inventory source group.
10220    ///
10221    /// # Arguments
10222    ///
10223    /// * `inventorySourceGroupId` - Required. The ID of the inventory source group to fetch.
10224    pub fn get(&self, inventory_source_group_id: i64) -> InventorySourceGroupGetCall<'a, C> {
10225        InventorySourceGroupGetCall {
10226            hub: self.hub,
10227            _inventory_source_group_id: inventory_source_group_id,
10228            _partner_id: Default::default(),
10229            _advertiser_id: Default::default(),
10230            _delegate: Default::default(),
10231            _additional_params: Default::default(),
10232            _scopes: Default::default(),
10233        }
10234    }
10235
10236    /// Create a builder to help you perform the following task:
10237    ///
10238    /// Lists inventory source groups that are accessible to the current user. The order is defined by the order_by parameter.
10239    pub fn list(&self) -> InventorySourceGroupListCall<'a, C> {
10240        InventorySourceGroupListCall {
10241            hub: self.hub,
10242            _partner_id: Default::default(),
10243            _page_token: Default::default(),
10244            _page_size: Default::default(),
10245            _order_by: Default::default(),
10246            _filter: Default::default(),
10247            _advertiser_id: Default::default(),
10248            _delegate: Default::default(),
10249            _additional_params: Default::default(),
10250            _scopes: Default::default(),
10251        }
10252    }
10253
10254    /// Create a builder to help you perform the following task:
10255    ///
10256    /// Updates an inventory source group. Returns the updated inventory source group if successful.
10257    ///
10258    /// # Arguments
10259    ///
10260    /// * `request` - No description provided.
10261    /// * `inventorySourceGroupId` - Output only. The unique ID of the inventory source group. Assigned by the system.
10262    pub fn patch(
10263        &self,
10264        request: InventorySourceGroup,
10265        inventory_source_group_id: i64,
10266    ) -> InventorySourceGroupPatchCall<'a, C> {
10267        InventorySourceGroupPatchCall {
10268            hub: self.hub,
10269            _request: request,
10270            _inventory_source_group_id: inventory_source_group_id,
10271            _update_mask: Default::default(),
10272            _partner_id: Default::default(),
10273            _advertiser_id: Default::default(),
10274            _delegate: Default::default(),
10275            _additional_params: Default::default(),
10276            _scopes: Default::default(),
10277        }
10278    }
10279}
10280
10281/// A builder providing access to all methods supported on *inventorySource* resources.
10282/// It is not used directly, but through the [`DisplayVideo`] hub.
10283///
10284/// # Example
10285///
10286/// Instantiate a resource builder
10287///
10288/// ```test_harness,no_run
10289/// extern crate hyper;
10290/// extern crate hyper_rustls;
10291/// extern crate google_displayvideo1 as displayvideo1;
10292///
10293/// # async fn dox() {
10294/// use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10295///
10296/// let secret: yup_oauth2::ApplicationSecret = Default::default();
10297/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10298///     secret,
10299///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10300/// ).build().await.unwrap();
10301///
10302/// let client = hyper_util::client::legacy::Client::builder(
10303///     hyper_util::rt::TokioExecutor::new()
10304/// )
10305/// .build(
10306///     hyper_rustls::HttpsConnectorBuilder::new()
10307///         .with_native_roots()
10308///         .unwrap()
10309///         .https_or_http()
10310///         .enable_http1()
10311///         .build()
10312/// );
10313/// let mut hub = DisplayVideo::new(client, auth);
10314/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
10315/// // like `create(...)`, `edit_inventory_source_read_write_accessors(...)`, `get(...)`, `list(...)` and `patch(...)`
10316/// // to build up your call.
10317/// let rb = hub.inventory_sources();
10318/// # }
10319/// ```
10320pub struct InventorySourceMethods<'a, C>
10321where
10322    C: 'a,
10323{
10324    hub: &'a DisplayVideo<C>,
10325}
10326
10327impl<'a, C> common::MethodsBuilder for InventorySourceMethods<'a, C> {}
10328
10329impl<'a, C> InventorySourceMethods<'a, C> {
10330    /// Create a builder to help you perform the following task:
10331    ///
10332    /// Creates a new inventory source. Returns the newly created inventory source if successful.
10333    ///
10334    /// # Arguments
10335    ///
10336    /// * `request` - No description provided.
10337    pub fn create(&self, request: InventorySource) -> InventorySourceCreateCall<'a, C> {
10338        InventorySourceCreateCall {
10339            hub: self.hub,
10340            _request: request,
10341            _partner_id: Default::default(),
10342            _advertiser_id: Default::default(),
10343            _delegate: Default::default(),
10344            _additional_params: Default::default(),
10345            _scopes: Default::default(),
10346        }
10347    }
10348
10349    /// Create a builder to help you perform the following task:
10350    ///
10351    /// Edits read/write accessors of an inventory source. Returns the updated read_write_accessors for the inventory source.
10352    ///
10353    /// # Arguments
10354    ///
10355    /// * `request` - No description provided.
10356    /// * `inventorySourceId` - Required. The ID of inventory source to update.
10357    pub fn edit_inventory_source_read_write_accessors(
10358        &self,
10359        request: EditInventorySourceReadWriteAccessorsRequest,
10360        inventory_source_id: i64,
10361    ) -> InventorySourceEditInventorySourceReadWriteAccessorCall<'a, C> {
10362        InventorySourceEditInventorySourceReadWriteAccessorCall {
10363            hub: self.hub,
10364            _request: request,
10365            _inventory_source_id: inventory_source_id,
10366            _delegate: Default::default(),
10367            _additional_params: Default::default(),
10368            _scopes: Default::default(),
10369        }
10370    }
10371
10372    /// Create a builder to help you perform the following task:
10373    ///
10374    /// Gets an inventory source.
10375    ///
10376    /// # Arguments
10377    ///
10378    /// * `inventorySourceId` - Required. The ID of the inventory source to fetch.
10379    pub fn get(&self, inventory_source_id: i64) -> InventorySourceGetCall<'a, C> {
10380        InventorySourceGetCall {
10381            hub: self.hub,
10382            _inventory_source_id: inventory_source_id,
10383            _partner_id: Default::default(),
10384            _delegate: Default::default(),
10385            _additional_params: Default::default(),
10386            _scopes: Default::default(),
10387        }
10388    }
10389
10390    /// Create a builder to help you perform the following task:
10391    ///
10392    /// Lists inventory sources that are accessible to the current user. The order is defined by the order_by parameter. If a filter by entity_status is not specified, inventory sources with entity status `ENTITY_STATUS_ARCHIVED` will not be included in the results.
10393    pub fn list(&self) -> InventorySourceListCall<'a, C> {
10394        InventorySourceListCall {
10395            hub: self.hub,
10396            _partner_id: Default::default(),
10397            _page_token: Default::default(),
10398            _page_size: Default::default(),
10399            _order_by: Default::default(),
10400            _filter: Default::default(),
10401            _advertiser_id: Default::default(),
10402            _delegate: Default::default(),
10403            _additional_params: Default::default(),
10404            _scopes: Default::default(),
10405        }
10406    }
10407
10408    /// Create a builder to help you perform the following task:
10409    ///
10410    /// Updates an existing inventory source. Returns the updated inventory source if successful.
10411    ///
10412    /// # Arguments
10413    ///
10414    /// * `request` - No description provided.
10415    /// * `inventorySourceId` - Output only. The unique ID of the inventory source. Assigned by the system.
10416    pub fn patch(
10417        &self,
10418        request: InventorySource,
10419        inventory_source_id: i64,
10420    ) -> InventorySourcePatchCall<'a, C> {
10421        InventorySourcePatchCall {
10422            hub: self.hub,
10423            _request: request,
10424            _inventory_source_id: inventory_source_id,
10425            _update_mask: Default::default(),
10426            _partner_id: Default::default(),
10427            _advertiser_id: Default::default(),
10428            _delegate: Default::default(),
10429            _additional_params: Default::default(),
10430            _scopes: Default::default(),
10431        }
10432    }
10433}
10434
10435/// A builder providing access to all methods supported on *media* resources.
10436/// It is not used directly, but through the [`DisplayVideo`] hub.
10437///
10438/// # Example
10439///
10440/// Instantiate a resource builder
10441///
10442/// ```test_harness,no_run
10443/// extern crate hyper;
10444/// extern crate hyper_rustls;
10445/// extern crate google_displayvideo1 as displayvideo1;
10446///
10447/// # async fn dox() {
10448/// use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10449///
10450/// let secret: yup_oauth2::ApplicationSecret = Default::default();
10451/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10452///     secret,
10453///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10454/// ).build().await.unwrap();
10455///
10456/// let client = hyper_util::client::legacy::Client::builder(
10457///     hyper_util::rt::TokioExecutor::new()
10458/// )
10459/// .build(
10460///     hyper_rustls::HttpsConnectorBuilder::new()
10461///         .with_native_roots()
10462///         .unwrap()
10463///         .https_or_http()
10464///         .enable_http1()
10465///         .build()
10466/// );
10467/// let mut hub = DisplayVideo::new(client, auth);
10468/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
10469/// // like `download(...)` and `upload(...)`
10470/// // to build up your call.
10471/// let rb = hub.media();
10472/// # }
10473/// ```
10474pub struct MediaMethods<'a, C>
10475where
10476    C: 'a,
10477{
10478    hub: &'a DisplayVideo<C>,
10479}
10480
10481impl<'a, C> common::MethodsBuilder for MediaMethods<'a, C> {}
10482
10483impl<'a, C> MediaMethods<'a, C> {
10484    /// Create a builder to help you perform the following task:
10485    ///
10486    /// Downloads media. Download is supported on the URI `/download/{resource_name=**}?alt=media.` **Note**: Download requests will not be successful without including `alt=media` query string.
10487    ///
10488    /// # Arguments
10489    ///
10490    /// * `resourceName` - Name of the media that is being downloaded. See ReadRequest.resource_name.
10491    pub fn download(&self, resource_name: &str) -> MediaDownloadCall<'a, C> {
10492        MediaDownloadCall {
10493            hub: self.hub,
10494            _resource_name: resource_name.to_string(),
10495            _delegate: Default::default(),
10496            _additional_params: Default::default(),
10497            _scopes: Default::default(),
10498        }
10499    }
10500
10501    /// Create a builder to help you perform the following task:
10502    ///
10503    /// Uploads media. Upload is supported on the URI `/upload/media/{resource_name=**}?upload_type=media.` **Note**: Upload requests will not be successful without including `upload_type=media` query string.
10504    ///
10505    /// # Arguments
10506    ///
10507    /// * `request` - No description provided.
10508    /// * `resourceName` - Name of the media that is being downloaded. See ReadRequest.resource_name.
10509    pub fn upload(
10510        &self,
10511        request: GoogleBytestreamMedia,
10512        resource_name: &str,
10513    ) -> MediaUploadCall<'a, C> {
10514        MediaUploadCall {
10515            hub: self.hub,
10516            _request: request,
10517            _resource_name: resource_name.to_string(),
10518            _delegate: Default::default(),
10519            _additional_params: Default::default(),
10520            _scopes: Default::default(),
10521        }
10522    }
10523}
10524
10525/// A builder providing access to all methods supported on *partner* resources.
10526/// It is not used directly, but through the [`DisplayVideo`] hub.
10527///
10528/// # Example
10529///
10530/// Instantiate a resource builder
10531///
10532/// ```test_harness,no_run
10533/// extern crate hyper;
10534/// extern crate hyper_rustls;
10535/// extern crate google_displayvideo1 as displayvideo1;
10536///
10537/// # async fn dox() {
10538/// use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10539///
10540/// let secret: yup_oauth2::ApplicationSecret = Default::default();
10541/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10542///     secret,
10543///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10544/// ).build().await.unwrap();
10545///
10546/// let client = hyper_util::client::legacy::Client::builder(
10547///     hyper_util::rt::TokioExecutor::new()
10548/// )
10549/// .build(
10550///     hyper_rustls::HttpsConnectorBuilder::new()
10551///         .with_native_roots()
10552///         .unwrap()
10553///         .https_or_http()
10554///         .enable_http1()
10555///         .build()
10556/// );
10557/// let mut hub = DisplayVideo::new(client, auth);
10558/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
10559/// // like `bulk_edit_partner_assigned_targeting_options(...)`, `channels_create(...)`, `channels_get(...)`, `channels_list(...)`, `channels_patch(...)`, `channels_sites_bulk_edit(...)`, `channels_sites_create(...)`, `channels_sites_delete(...)`, `channels_sites_list(...)`, `channels_sites_replace(...)`, `get(...)`, `list(...)`, `targeting_types_assigned_targeting_options_create(...)`, `targeting_types_assigned_targeting_options_delete(...)`, `targeting_types_assigned_targeting_options_get(...)` and `targeting_types_assigned_targeting_options_list(...)`
10560/// // to build up your call.
10561/// let rb = hub.partners();
10562/// # }
10563/// ```
10564pub struct PartnerMethods<'a, C>
10565where
10566    C: 'a,
10567{
10568    hub: &'a DisplayVideo<C>,
10569}
10570
10571impl<'a, C> common::MethodsBuilder for PartnerMethods<'a, C> {}
10572
10573impl<'a, C> PartnerMethods<'a, C> {
10574    /// Create a builder to help you perform the following task:
10575    ///
10576    /// Bulk edits sites under a single channel. The operation will delete the sites provided in BulkEditSitesRequest.deleted_sites and then create the sites provided in BulkEditSitesRequest.created_sites.
10577    ///
10578    /// # Arguments
10579    ///
10580    /// * `request` - No description provided.
10581    /// * `partnerId` - The ID of the partner that owns the parent channel.
10582    /// * `channelId` - Required. The ID of the parent channel to which the sites belong.
10583    pub fn channels_sites_bulk_edit(
10584        &self,
10585        request: BulkEditSitesRequest,
10586        partner_id: i64,
10587        channel_id: i64,
10588    ) -> PartnerChannelSiteBulkEditCall<'a, C> {
10589        PartnerChannelSiteBulkEditCall {
10590            hub: self.hub,
10591            _request: request,
10592            _partner_id: partner_id,
10593            _channel_id: channel_id,
10594            _delegate: Default::default(),
10595            _additional_params: Default::default(),
10596            _scopes: Default::default(),
10597        }
10598    }
10599
10600    /// Create a builder to help you perform the following task:
10601    ///
10602    /// Creates a site in a channel.
10603    ///
10604    /// # Arguments
10605    ///
10606    /// * `request` - No description provided.
10607    /// * `partnerId` - The ID of the partner that owns the parent channel.
10608    /// * `channelId` - Required. The ID of the parent channel in which the site will be created.
10609    pub fn channels_sites_create(
10610        &self,
10611        request: Site,
10612        partner_id: i64,
10613        channel_id: i64,
10614    ) -> PartnerChannelSiteCreateCall<'a, C> {
10615        PartnerChannelSiteCreateCall {
10616            hub: self.hub,
10617            _request: request,
10618            _partner_id: partner_id,
10619            _channel_id: channel_id,
10620            _advertiser_id: Default::default(),
10621            _delegate: Default::default(),
10622            _additional_params: Default::default(),
10623            _scopes: Default::default(),
10624        }
10625    }
10626
10627    /// Create a builder to help you perform the following task:
10628    ///
10629    /// Deletes a site from a channel.
10630    ///
10631    /// # Arguments
10632    ///
10633    /// * `partnerId` - The ID of the partner that owns the parent channel.
10634    /// * `channelId` - Required. The ID of the parent channel to which the site belongs.
10635    /// * `urlOrAppId` - Required. The URL or app ID of the site to delete.
10636    pub fn channels_sites_delete(
10637        &self,
10638        partner_id: i64,
10639        channel_id: i64,
10640        url_or_app_id: &str,
10641    ) -> PartnerChannelSiteDeleteCall<'a, C> {
10642        PartnerChannelSiteDeleteCall {
10643            hub: self.hub,
10644            _partner_id: partner_id,
10645            _channel_id: channel_id,
10646            _url_or_app_id: url_or_app_id.to_string(),
10647            _advertiser_id: Default::default(),
10648            _delegate: Default::default(),
10649            _additional_params: Default::default(),
10650            _scopes: Default::default(),
10651        }
10652    }
10653
10654    /// Create a builder to help you perform the following task:
10655    ///
10656    /// Lists sites in a channel.
10657    ///
10658    /// # Arguments
10659    ///
10660    /// * `partnerId` - The ID of the partner that owns the parent channel.
10661    /// * `channelId` - Required. The ID of the parent channel to which the requested sites belong.
10662    pub fn channels_sites_list(
10663        &self,
10664        partner_id: i64,
10665        channel_id: i64,
10666    ) -> PartnerChannelSiteListCall<'a, C> {
10667        PartnerChannelSiteListCall {
10668            hub: self.hub,
10669            _partner_id: partner_id,
10670            _channel_id: channel_id,
10671            _page_token: Default::default(),
10672            _page_size: Default::default(),
10673            _order_by: Default::default(),
10674            _filter: Default::default(),
10675            _advertiser_id: Default::default(),
10676            _delegate: Default::default(),
10677            _additional_params: Default::default(),
10678            _scopes: Default::default(),
10679        }
10680    }
10681
10682    /// Create a builder to help you perform the following task:
10683    ///
10684    /// Replaces all of the sites under a single channel. The operation will replace the sites under a channel with the sites provided in ReplaceSitesRequest.new_sites. **This method regularly experiences high latency.** We recommend [increasing your default timeout](https://developers.google.com/display-video/api/guides/best-practices/timeouts#client_library_timeout) to avoid errors.
10685    ///
10686    /// # Arguments
10687    ///
10688    /// * `request` - No description provided.
10689    /// * `partnerId` - The ID of the partner that owns the parent channel.
10690    /// * `channelId` - Required. The ID of the parent channel whose sites will be replaced.
10691    pub fn channels_sites_replace(
10692        &self,
10693        request: ReplaceSitesRequest,
10694        partner_id: i64,
10695        channel_id: i64,
10696    ) -> PartnerChannelSiteReplaceCall<'a, C> {
10697        PartnerChannelSiteReplaceCall {
10698            hub: self.hub,
10699            _request: request,
10700            _partner_id: partner_id,
10701            _channel_id: channel_id,
10702            _delegate: Default::default(),
10703            _additional_params: Default::default(),
10704            _scopes: Default::default(),
10705        }
10706    }
10707
10708    /// Create a builder to help you perform the following task:
10709    ///
10710    /// Creates a new channel. Returns the newly created channel if successful.
10711    ///
10712    /// # Arguments
10713    ///
10714    /// * `request` - No description provided.
10715    /// * `partnerId` - The ID of the partner that owns the created channel.
10716    pub fn channels_create(
10717        &self,
10718        request: Channel,
10719        partner_id: i64,
10720    ) -> PartnerChannelCreateCall<'a, C> {
10721        PartnerChannelCreateCall {
10722            hub: self.hub,
10723            _request: request,
10724            _partner_id: partner_id,
10725            _advertiser_id: Default::default(),
10726            _delegate: Default::default(),
10727            _additional_params: Default::default(),
10728            _scopes: Default::default(),
10729        }
10730    }
10731
10732    /// Create a builder to help you perform the following task:
10733    ///
10734    /// Gets a channel for a partner or advertiser.
10735    ///
10736    /// # Arguments
10737    ///
10738    /// * `partnerId` - The ID of the partner that owns the fetched channel.
10739    /// * `channelId` - Required. The ID of the channel to fetch.
10740    pub fn channels_get(&self, partner_id: i64, channel_id: i64) -> PartnerChannelGetCall<'a, C> {
10741        PartnerChannelGetCall {
10742            hub: self.hub,
10743            _partner_id: partner_id,
10744            _channel_id: channel_id,
10745            _advertiser_id: Default::default(),
10746            _delegate: Default::default(),
10747            _additional_params: Default::default(),
10748            _scopes: Default::default(),
10749        }
10750    }
10751
10752    /// Create a builder to help you perform the following task:
10753    ///
10754    /// Lists channels for a partner or advertiser.
10755    ///
10756    /// # Arguments
10757    ///
10758    /// * `partnerId` - The ID of the partner that owns the channels.
10759    pub fn channels_list(&self, partner_id: i64) -> PartnerChannelListCall<'a, C> {
10760        PartnerChannelListCall {
10761            hub: self.hub,
10762            _partner_id: partner_id,
10763            _page_token: Default::default(),
10764            _page_size: Default::default(),
10765            _order_by: Default::default(),
10766            _filter: Default::default(),
10767            _advertiser_id: Default::default(),
10768            _delegate: Default::default(),
10769            _additional_params: Default::default(),
10770            _scopes: Default::default(),
10771        }
10772    }
10773
10774    /// Create a builder to help you perform the following task:
10775    ///
10776    /// Updates a channel. Returns the updated channel if successful.
10777    ///
10778    /// # Arguments
10779    ///
10780    /// * `request` - No description provided.
10781    /// * `partnerId` - The ID of the partner that owns the created channel.
10782    /// * `channelId` - Output only. The unique ID of the channel. Assigned by the system.
10783    pub fn channels_patch(
10784        &self,
10785        request: Channel,
10786        partner_id: i64,
10787        channel_id: i64,
10788    ) -> PartnerChannelPatchCall<'a, C> {
10789        PartnerChannelPatchCall {
10790            hub: self.hub,
10791            _request: request,
10792            _partner_id: partner_id,
10793            _channel_id: channel_id,
10794            _update_mask: Default::default(),
10795            _advertiser_id: Default::default(),
10796            _delegate: Default::default(),
10797            _additional_params: Default::default(),
10798            _scopes: Default::default(),
10799        }
10800    }
10801
10802    /// Create a builder to help you perform the following task:
10803    ///
10804    /// Assigns a targeting option to a partner. Returns the assigned targeting option if successful.
10805    ///
10806    /// # Arguments
10807    ///
10808    /// * `request` - No description provided.
10809    /// * `partnerId` - Required. The ID of the partner.
10810    /// * `targetingType` - Required. Identifies the type of this assigned targeting option. Supported targeting types: * `TARGETING_TYPE_CHANNEL`
10811    pub fn targeting_types_assigned_targeting_options_create(
10812        &self,
10813        request: AssignedTargetingOption,
10814        partner_id: i64,
10815        targeting_type: &str,
10816    ) -> PartnerTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
10817        PartnerTargetingTypeAssignedTargetingOptionCreateCall {
10818            hub: self.hub,
10819            _request: request,
10820            _partner_id: partner_id,
10821            _targeting_type: targeting_type.to_string(),
10822            _delegate: Default::default(),
10823            _additional_params: Default::default(),
10824            _scopes: Default::default(),
10825        }
10826    }
10827
10828    /// Create a builder to help you perform the following task:
10829    ///
10830    /// Deletes an assigned targeting option from a partner.
10831    ///
10832    /// # Arguments
10833    ///
10834    /// * `partnerId` - Required. The ID of the partner.
10835    /// * `targetingType` - Required. Identifies the type of this assigned targeting option. Supported targeting types: * `TARGETING_TYPE_CHANNEL`
10836    /// * `assignedTargetingOptionId` - Required. The ID of the assigned targeting option to delete.
10837    pub fn targeting_types_assigned_targeting_options_delete(
10838        &self,
10839        partner_id: i64,
10840        targeting_type: &str,
10841        assigned_targeting_option_id: &str,
10842    ) -> PartnerTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
10843        PartnerTargetingTypeAssignedTargetingOptionDeleteCall {
10844            hub: self.hub,
10845            _partner_id: partner_id,
10846            _targeting_type: targeting_type.to_string(),
10847            _assigned_targeting_option_id: assigned_targeting_option_id.to_string(),
10848            _delegate: Default::default(),
10849            _additional_params: Default::default(),
10850            _scopes: Default::default(),
10851        }
10852    }
10853
10854    /// Create a builder to help you perform the following task:
10855    ///
10856    /// Gets a single targeting option assigned to a partner.
10857    ///
10858    /// # Arguments
10859    ///
10860    /// * `partnerId` - Required. The ID of the partner.
10861    /// * `targetingType` - Required. Identifies the type of this assigned targeting option. Supported targeting types: * `TARGETING_TYPE_CHANNEL`
10862    /// * `assignedTargetingOptionId` - Required. An identifier unique to the targeting type in this partner that identifies the assigned targeting option being requested.
10863    pub fn targeting_types_assigned_targeting_options_get(
10864        &self,
10865        partner_id: i64,
10866        targeting_type: &str,
10867        assigned_targeting_option_id: &str,
10868    ) -> PartnerTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
10869        PartnerTargetingTypeAssignedTargetingOptionGetCall {
10870            hub: self.hub,
10871            _partner_id: partner_id,
10872            _targeting_type: targeting_type.to_string(),
10873            _assigned_targeting_option_id: assigned_targeting_option_id.to_string(),
10874            _delegate: Default::default(),
10875            _additional_params: Default::default(),
10876            _scopes: Default::default(),
10877        }
10878    }
10879
10880    /// Create a builder to help you perform the following task:
10881    ///
10882    /// Lists the targeting options assigned to a partner.
10883    ///
10884    /// # Arguments
10885    ///
10886    /// * `partnerId` - Required. The ID of the partner.
10887    /// * `targetingType` - Required. Identifies the type of assigned targeting options to list. Supported targeting types: * `TARGETING_TYPE_CHANNEL`
10888    pub fn targeting_types_assigned_targeting_options_list(
10889        &self,
10890        partner_id: i64,
10891        targeting_type: &str,
10892    ) -> PartnerTargetingTypeAssignedTargetingOptionListCall<'a, C> {
10893        PartnerTargetingTypeAssignedTargetingOptionListCall {
10894            hub: self.hub,
10895            _partner_id: partner_id,
10896            _targeting_type: targeting_type.to_string(),
10897            _page_token: Default::default(),
10898            _page_size: Default::default(),
10899            _order_by: Default::default(),
10900            _filter: Default::default(),
10901            _delegate: Default::default(),
10902            _additional_params: Default::default(),
10903            _scopes: Default::default(),
10904        }
10905    }
10906
10907    /// Create a builder to help you perform the following task:
10908    ///
10909    /// Bulk edits targeting options under a single partner. The operation will delete the assigned targeting options provided in BulkEditPartnerAssignedTargetingOptionsRequest.deleteRequests and then create the assigned targeting options provided in BulkEditPartnerAssignedTargetingOptionsRequest.createRequests .
10910    ///
10911    /// # Arguments
10912    ///
10913    /// * `request` - No description provided.
10914    /// * `partnerId` - Required. The ID of the partner.
10915    pub fn bulk_edit_partner_assigned_targeting_options(
10916        &self,
10917        request: BulkEditPartnerAssignedTargetingOptionsRequest,
10918        partner_id: i64,
10919    ) -> PartnerBulkEditPartnerAssignedTargetingOptionCall<'a, C> {
10920        PartnerBulkEditPartnerAssignedTargetingOptionCall {
10921            hub: self.hub,
10922            _request: request,
10923            _partner_id: partner_id,
10924            _delegate: Default::default(),
10925            _additional_params: Default::default(),
10926            _scopes: Default::default(),
10927        }
10928    }
10929
10930    /// Create a builder to help you perform the following task:
10931    ///
10932    /// Gets a partner.
10933    ///
10934    /// # Arguments
10935    ///
10936    /// * `partnerId` - Required. The ID of the partner to fetch.
10937    pub fn get(&self, partner_id: i64) -> PartnerGetCall<'a, C> {
10938        PartnerGetCall {
10939            hub: self.hub,
10940            _partner_id: partner_id,
10941            _delegate: Default::default(),
10942            _additional_params: Default::default(),
10943            _scopes: Default::default(),
10944        }
10945    }
10946
10947    /// Create a builder to help you perform the following task:
10948    ///
10949    /// Lists partners that are accessible to the current user. The order is defined by the order_by parameter.
10950    pub fn list(&self) -> PartnerListCall<'a, C> {
10951        PartnerListCall {
10952            hub: self.hub,
10953            _page_token: Default::default(),
10954            _page_size: Default::default(),
10955            _order_by: Default::default(),
10956            _filter: Default::default(),
10957            _delegate: Default::default(),
10958            _additional_params: Default::default(),
10959            _scopes: Default::default(),
10960        }
10961    }
10962}
10963
10964/// A builder providing access to all methods supported on *sdfdownloadtask* resources.
10965/// It is not used directly, but through the [`DisplayVideo`] hub.
10966///
10967/// # Example
10968///
10969/// Instantiate a resource builder
10970///
10971/// ```test_harness,no_run
10972/// extern crate hyper;
10973/// extern crate hyper_rustls;
10974/// extern crate google_displayvideo1 as displayvideo1;
10975///
10976/// # async fn dox() {
10977/// use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10978///
10979/// let secret: yup_oauth2::ApplicationSecret = Default::default();
10980/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10981///     secret,
10982///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10983/// ).build().await.unwrap();
10984///
10985/// let client = hyper_util::client::legacy::Client::builder(
10986///     hyper_util::rt::TokioExecutor::new()
10987/// )
10988/// .build(
10989///     hyper_rustls::HttpsConnectorBuilder::new()
10990///         .with_native_roots()
10991///         .unwrap()
10992///         .https_or_http()
10993///         .enable_http1()
10994///         .build()
10995/// );
10996/// let mut hub = DisplayVideo::new(client, auth);
10997/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
10998/// // like `create(...)` and `operations_get(...)`
10999/// // to build up your call.
11000/// let rb = hub.sdfdownloadtasks();
11001/// # }
11002/// ```
11003pub struct SdfdownloadtaskMethods<'a, C>
11004where
11005    C: 'a,
11006{
11007    hub: &'a DisplayVideo<C>,
11008}
11009
11010impl<'a, C> common::MethodsBuilder for SdfdownloadtaskMethods<'a, C> {}
11011
11012impl<'a, C> SdfdownloadtaskMethods<'a, C> {
11013    /// Create a builder to help you perform the following task:
11014    ///
11015    /// Gets the latest state of an asynchronous SDF download task operation. Clients should poll this method at intervals of 30 seconds.
11016    ///
11017    /// # Arguments
11018    ///
11019    /// * `name` - The name of the operation resource.
11020    pub fn operations_get(&self, name: &str) -> SdfdownloadtaskOperationGetCall<'a, C> {
11021        SdfdownloadtaskOperationGetCall {
11022            hub: self.hub,
11023            _name: name.to_string(),
11024            _delegate: Default::default(),
11025            _additional_params: Default::default(),
11026            _scopes: Default::default(),
11027        }
11028    }
11029
11030    /// Create a builder to help you perform the following task:
11031    ///
11032    /// Creates an SDF Download Task. Returns an Operation. An SDF Download Task is a long-running, asynchronous operation. The metadata type of this operation is SdfDownloadTaskMetadata. If the request is successful, the response type of the operation is SdfDownloadTask. The response will not include the download files, which must be retrieved with media.download. The state of operation can be retrieved with sdfdownloadtask.operations.get. Any errors can be found in the error.message. Note that error.details is expected to be empty.
11033    ///
11034    /// # Arguments
11035    ///
11036    /// * `request` - No description provided.
11037    pub fn create(
11038        &self,
11039        request: CreateSdfDownloadTaskRequest,
11040    ) -> SdfdownloadtaskCreateCall<'a, C> {
11041        SdfdownloadtaskCreateCall {
11042            hub: self.hub,
11043            _request: request,
11044            _delegate: Default::default(),
11045            _additional_params: Default::default(),
11046            _scopes: Default::default(),
11047        }
11048    }
11049}
11050
11051/// A builder providing access to all methods supported on *targetingType* resources.
11052/// It is not used directly, but through the [`DisplayVideo`] hub.
11053///
11054/// # Example
11055///
11056/// Instantiate a resource builder
11057///
11058/// ```test_harness,no_run
11059/// extern crate hyper;
11060/// extern crate hyper_rustls;
11061/// extern crate google_displayvideo1 as displayvideo1;
11062///
11063/// # async fn dox() {
11064/// use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11065///
11066/// let secret: yup_oauth2::ApplicationSecret = Default::default();
11067/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11068///     secret,
11069///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11070/// ).build().await.unwrap();
11071///
11072/// let client = hyper_util::client::legacy::Client::builder(
11073///     hyper_util::rt::TokioExecutor::new()
11074/// )
11075/// .build(
11076///     hyper_rustls::HttpsConnectorBuilder::new()
11077///         .with_native_roots()
11078///         .unwrap()
11079///         .https_or_http()
11080///         .enable_http1()
11081///         .build()
11082/// );
11083/// let mut hub = DisplayVideo::new(client, auth);
11084/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
11085/// // like `targeting_options_get(...)`, `targeting_options_list(...)` and `targeting_options_search(...)`
11086/// // to build up your call.
11087/// let rb = hub.targeting_types();
11088/// # }
11089/// ```
11090pub struct TargetingTypeMethods<'a, C>
11091where
11092    C: 'a,
11093{
11094    hub: &'a DisplayVideo<C>,
11095}
11096
11097impl<'a, C> common::MethodsBuilder for TargetingTypeMethods<'a, C> {}
11098
11099impl<'a, C> TargetingTypeMethods<'a, C> {
11100    /// Create a builder to help you perform the following task:
11101    ///
11102    /// Gets a single targeting option.
11103    ///
11104    /// # Arguments
11105    ///
11106    /// * `targetingType` - Required. The type of targeting option to retrieve. Accepted values are: * `TARGETING_TYPE_APP_CATEGORY` * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_VIDEO_PLAYER_SIZE` * `TARGETING_TYPE_USER_REWARDED_CONTENT` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_DEVICE_TYPE` * `TARGETING_TYPE_BROWSER` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_CARRIER_AND_ISP` * `TARGETING_TYPE_OPERATING_SYSTEM` * `TARGETING_TYPE_DEVICE_MAKE_MODEL` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_CATEGORY` * `TARGETING_TYPE_VIEWABILITY` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_NATIVE_CONTENT_POSITION` * `TARGETING_TYPE_OMID`
11107    /// * `targetingOptionId` - Required. The ID of the of targeting option to retrieve.
11108    pub fn targeting_options_get(
11109        &self,
11110        targeting_type: &str,
11111        targeting_option_id: &str,
11112    ) -> TargetingTypeTargetingOptionGetCall<'a, C> {
11113        TargetingTypeTargetingOptionGetCall {
11114            hub: self.hub,
11115            _targeting_type: targeting_type.to_string(),
11116            _targeting_option_id: targeting_option_id.to_string(),
11117            _advertiser_id: Default::default(),
11118            _delegate: Default::default(),
11119            _additional_params: Default::default(),
11120            _scopes: Default::default(),
11121        }
11122    }
11123
11124    /// Create a builder to help you perform the following task:
11125    ///
11126    /// Lists targeting options of a given type.
11127    ///
11128    /// # Arguments
11129    ///
11130    /// * `targetingType` - Required. The type of targeting option to be listed. Accepted values are: * `TARGETING_TYPE_APP_CATEGORY` * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_VIDEO_PLAYER_SIZE` * `TARGETING_TYPE_USER_REWARDED_CONTENT` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_DEVICE_TYPE` * `TARGETING_TYPE_BROWSER` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_CARRIER_AND_ISP` * `TARGETING_TYPE_OPERATING_SYSTEM` * `TARGETING_TYPE_DEVICE_MAKE_MODEL` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_CATEGORY` * `TARGETING_TYPE_VIEWABILITY` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_NATIVE_CONTENT_POSITION` * `TARGETING_TYPE_OMID`
11131    pub fn targeting_options_list(
11132        &self,
11133        targeting_type: &str,
11134    ) -> TargetingTypeTargetingOptionListCall<'a, C> {
11135        TargetingTypeTargetingOptionListCall {
11136            hub: self.hub,
11137            _targeting_type: targeting_type.to_string(),
11138            _page_token: Default::default(),
11139            _page_size: Default::default(),
11140            _order_by: Default::default(),
11141            _filter: Default::default(),
11142            _advertiser_id: Default::default(),
11143            _delegate: Default::default(),
11144            _additional_params: Default::default(),
11145            _scopes: Default::default(),
11146        }
11147    }
11148
11149    /// Create a builder to help you perform the following task:
11150    ///
11151    /// Searches for targeting options of a given type based on the given search terms.
11152    ///
11153    /// # Arguments
11154    ///
11155    /// * `request` - No description provided.
11156    /// * `targetingType` - Required. The type of targeting options to retrieve. Accepted values are: * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_POI` * `TARGETING_TYPE_BUSINESS_CHAIN`
11157    pub fn targeting_options_search(
11158        &self,
11159        request: SearchTargetingOptionsRequest,
11160        targeting_type: &str,
11161    ) -> TargetingTypeTargetingOptionSearchCall<'a, C> {
11162        TargetingTypeTargetingOptionSearchCall {
11163            hub: self.hub,
11164            _request: request,
11165            _targeting_type: targeting_type.to_string(),
11166            _delegate: Default::default(),
11167            _additional_params: Default::default(),
11168            _scopes: Default::default(),
11169        }
11170    }
11171}
11172
11173/// A builder providing access to all methods supported on *user* resources.
11174/// It is not used directly, but through the [`DisplayVideo`] hub.
11175///
11176/// # Example
11177///
11178/// Instantiate a resource builder
11179///
11180/// ```test_harness,no_run
11181/// extern crate hyper;
11182/// extern crate hyper_rustls;
11183/// extern crate google_displayvideo1 as displayvideo1;
11184///
11185/// # async fn dox() {
11186/// use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11187///
11188/// let secret: yup_oauth2::ApplicationSecret = Default::default();
11189/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11190///     secret,
11191///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11192/// ).build().await.unwrap();
11193///
11194/// let client = hyper_util::client::legacy::Client::builder(
11195///     hyper_util::rt::TokioExecutor::new()
11196/// )
11197/// .build(
11198///     hyper_rustls::HttpsConnectorBuilder::new()
11199///         .with_native_roots()
11200///         .unwrap()
11201///         .https_or_http()
11202///         .enable_http1()
11203///         .build()
11204/// );
11205/// let mut hub = DisplayVideo::new(client, auth);
11206/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
11207/// // like `bulk_edit_assigned_user_roles(...)`, `create(...)`, `delete(...)`, `get(...)`, `list(...)` and `patch(...)`
11208/// // to build up your call.
11209/// let rb = hub.users();
11210/// # }
11211/// ```
11212pub struct UserMethods<'a, C>
11213where
11214    C: 'a,
11215{
11216    hub: &'a DisplayVideo<C>,
11217}
11218
11219impl<'a, C> common::MethodsBuilder for UserMethods<'a, C> {}
11220
11221impl<'a, C> UserMethods<'a, C> {
11222    /// Create a builder to help you perform the following task:
11223    ///
11224    /// Bulk edits user roles for a user. The operation will delete the assigned user roles provided in BulkEditAssignedUserRolesRequest.deletedAssignedUserRoles and then assign the user roles provided in BulkEditAssignedUserRolesRequest.createdAssignedUserRoles. This method has unique authentication requirements. Read the prerequisites in our [Managing Users guide](https://developers.google.com/display-video/api/guides/users/overview#prerequisites) before using this method. The “Try this method” feature does not work for this method.
11225    ///
11226    /// # Arguments
11227    ///
11228    /// * `request` - No description provided.
11229    /// * `userId` - Required. The ID of the user to which the assigned user roles belong.
11230    pub fn bulk_edit_assigned_user_roles(
11231        &self,
11232        request: BulkEditAssignedUserRolesRequest,
11233        user_id: i64,
11234    ) -> UserBulkEditAssignedUserRoleCall<'a, C> {
11235        UserBulkEditAssignedUserRoleCall {
11236            hub: self.hub,
11237            _request: request,
11238            _user_id: user_id,
11239            _delegate: Default::default(),
11240            _additional_params: Default::default(),
11241            _scopes: Default::default(),
11242        }
11243    }
11244
11245    /// Create a builder to help you perform the following task:
11246    ///
11247    /// Creates a new user. Returns the newly created user if successful. This method has unique authentication requirements. Read the prerequisites in our [Managing Users guide](https://developers.google.com/display-video/api/guides/users/overview#prerequisites) before using this method. The “Try this method” feature does not work for this method.
11248    ///
11249    /// # Arguments
11250    ///
11251    /// * `request` - No description provided.
11252    pub fn create(&self, request: User) -> UserCreateCall<'a, C> {
11253        UserCreateCall {
11254            hub: self.hub,
11255            _request: request,
11256            _delegate: Default::default(),
11257            _additional_params: Default::default(),
11258            _scopes: Default::default(),
11259        }
11260    }
11261
11262    /// Create a builder to help you perform the following task:
11263    ///
11264    /// Deletes a user. This method has unique authentication requirements. Read the prerequisites in our [Managing Users guide](https://developers.google.com/display-video/api/guides/users/overview#prerequisites) before using this method. The “Try this method” feature does not work for this method.
11265    ///
11266    /// # Arguments
11267    ///
11268    /// * `userId` - Required. The ID of the user to delete.
11269    pub fn delete(&self, user_id: i64) -> UserDeleteCall<'a, C> {
11270        UserDeleteCall {
11271            hub: self.hub,
11272            _user_id: user_id,
11273            _delegate: Default::default(),
11274            _additional_params: Default::default(),
11275            _scopes: Default::default(),
11276        }
11277    }
11278
11279    /// Create a builder to help you perform the following task:
11280    ///
11281    /// Gets a user. This method has unique authentication requirements. Read the prerequisites in our [Managing Users guide](https://developers.google.com/display-video/api/guides/users/overview#prerequisites) before using this method. The “Try this method” feature does not work for this method.
11282    ///
11283    /// # Arguments
11284    ///
11285    /// * `userId` - Required. The ID of the user to fetch.
11286    pub fn get(&self, user_id: i64) -> UserGetCall<'a, C> {
11287        UserGetCall {
11288            hub: self.hub,
11289            _user_id: user_id,
11290            _delegate: Default::default(),
11291            _additional_params: Default::default(),
11292            _scopes: Default::default(),
11293        }
11294    }
11295
11296    /// Create a builder to help you perform the following task:
11297    ///
11298    /// Lists users that are accessible to the current user. If two users have user roles on the same partner or advertiser, they can access each other. This method has unique authentication requirements. Read the prerequisites in our [Managing Users guide](https://developers.google.com/display-video/api/guides/users/overview#prerequisites) before using this method. The “Try this method” feature does not work for this method.
11299    pub fn list(&self) -> UserListCall<'a, C> {
11300        UserListCall {
11301            hub: self.hub,
11302            _page_token: Default::default(),
11303            _page_size: Default::default(),
11304            _order_by: Default::default(),
11305            _filter: Default::default(),
11306            _delegate: Default::default(),
11307            _additional_params: Default::default(),
11308            _scopes: Default::default(),
11309        }
11310    }
11311
11312    /// Create a builder to help you perform the following task:
11313    ///
11314    /// Updates an existing user. Returns the updated user if successful. This method has unique authentication requirements. Read the prerequisites in our [Managing Users guide](https://developers.google.com/display-video/api/guides/users/overview#prerequisites) before using this method. The “Try this method” feature does not work for this method.
11315    ///
11316    /// # Arguments
11317    ///
11318    /// * `request` - No description provided.
11319    /// * `userId` - Output only. The unique ID of the user. Assigned by the system.
11320    pub fn patch(&self, request: User, user_id: i64) -> UserPatchCall<'a, C> {
11321        UserPatchCall {
11322            hub: self.hub,
11323            _request: request,
11324            _user_id: user_id,
11325            _update_mask: Default::default(),
11326            _delegate: Default::default(),
11327            _additional_params: Default::default(),
11328            _scopes: Default::default(),
11329        }
11330    }
11331}
11332
11333// ###################
11334// CallBuilders   ###
11335// #################
11336
11337/// Uploads an asset. Returns the ID of the newly uploaded asset if successful. The asset file size should be no more than 10 MB for images, 200 MB for ZIP files, and 1 GB for videos. Must be used within the [multipart media upload process](https://developers.google.com/display-video/api/guides/how-tos/upload#multipart). Examples using provided client libraries can be found in our [Creating Creatives guide](https://developers.google.com/display-video/api/guides/creating-creatives/overview#upload_an_asset).
11338///
11339/// A builder for the *assets.upload* method supported by a *advertiser* resource.
11340/// It is not used directly, but through a [`AdvertiserMethods`] instance.
11341///
11342/// # Example
11343///
11344/// Instantiate a resource method builder
11345///
11346/// ```test_harness,no_run
11347/// # extern crate hyper;
11348/// # extern crate hyper_rustls;
11349/// # extern crate google_displayvideo1 as displayvideo1;
11350/// use displayvideo1::api::CreateAssetRequest;
11351/// use std::fs;
11352/// # async fn dox() {
11353/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11354///
11355/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11356/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11357/// #     secret,
11358/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11359/// # ).build().await.unwrap();
11360///
11361/// # let client = hyper_util::client::legacy::Client::builder(
11362/// #     hyper_util::rt::TokioExecutor::new()
11363/// # )
11364/// # .build(
11365/// #     hyper_rustls::HttpsConnectorBuilder::new()
11366/// #         .with_native_roots()
11367/// #         .unwrap()
11368/// #         .https_or_http()
11369/// #         .enable_http1()
11370/// #         .build()
11371/// # );
11372/// # let mut hub = DisplayVideo::new(client, auth);
11373/// // As the method needs a request, you would usually fill it with the desired information
11374/// // into the respective structure. Some of the parts shown here might not be applicable !
11375/// // Values shown here are possibly random and not representative !
11376/// let mut req = CreateAssetRequest::default();
11377///
11378/// // You can configure optional parameters by calling the respective setters at will, and
11379/// // execute the final call using `upload(...)`.
11380/// // Values shown here are possibly random and not representative !
11381/// let result = hub.advertisers().assets_upload(req, -47)
11382///              .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await;
11383/// # }
11384/// ```
11385pub struct AdvertiserAssetUploadCall<'a, C>
11386where
11387    C: 'a,
11388{
11389    hub: &'a DisplayVideo<C>,
11390    _request: CreateAssetRequest,
11391    _advertiser_id: i64,
11392    _delegate: Option<&'a mut dyn common::Delegate>,
11393    _additional_params: HashMap<String, String>,
11394    _scopes: BTreeSet<String>,
11395}
11396
11397impl<'a, C> common::CallBuilder for AdvertiserAssetUploadCall<'a, C> {}
11398
11399impl<'a, C> AdvertiserAssetUploadCall<'a, C>
11400where
11401    C: common::Connector,
11402{
11403    /// Perform the operation you have build so far.
11404    async fn doit<RS>(
11405        mut self,
11406        mut reader: RS,
11407        reader_mime_type: mime::Mime,
11408        protocol: common::UploadProtocol,
11409    ) -> common::Result<(common::Response, CreateAssetResponse)>
11410    where
11411        RS: common::ReadSeek,
11412    {
11413        use std::borrow::Cow;
11414        use std::io::{Read, Seek};
11415
11416        use common::{url::Params, ToParts};
11417        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11418
11419        let mut dd = common::DefaultDelegate;
11420        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11421        dlg.begin(common::MethodInfo {
11422            id: "displayvideo.advertisers.assets.upload",
11423            http_method: hyper::Method::POST,
11424        });
11425
11426        for &field in ["alt", "advertiserId"].iter() {
11427            if self._additional_params.contains_key(field) {
11428                dlg.finished(false);
11429                return Err(common::Error::FieldClash(field));
11430            }
11431        }
11432
11433        let mut params = Params::with_capacity(4 + self._additional_params.len());
11434        params.push("advertiserId", self._advertiser_id.to_string());
11435
11436        params.extend(self._additional_params.iter());
11437
11438        params.push("alt", "json");
11439        let (mut url, upload_type) = if protocol == common::UploadProtocol::Simple {
11440            (
11441                self.hub._root_url.clone() + "upload/v1/advertisers/{+advertiserId}/assets",
11442                "multipart",
11443            )
11444        } else {
11445            unreachable!()
11446        };
11447        params.push("uploadType", upload_type);
11448        if self._scopes.is_empty() {
11449            self._scopes
11450                .insert(Scope::DisplayVideo.as_ref().to_string());
11451        }
11452
11453        #[allow(clippy::single_element_loop)]
11454        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
11455            url = params.uri_replacement(url, param_name, find_this, true);
11456        }
11457        {
11458            let to_remove = ["advertiserId"];
11459            params.remove_params(&to_remove);
11460        }
11461
11462        let url = params.parse_with_url(&url);
11463
11464        let mut json_mime_type = mime::APPLICATION_JSON;
11465        let mut request_value_reader = {
11466            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11467            common::remove_json_null_values(&mut value);
11468            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11469            serde_json::to_writer(&mut dst, &value).unwrap();
11470            dst
11471        };
11472        let request_size = request_value_reader
11473            .seek(std::io::SeekFrom::End(0))
11474            .unwrap();
11475        request_value_reader
11476            .seek(std::io::SeekFrom::Start(0))
11477            .unwrap();
11478
11479        loop {
11480            let token = match self
11481                .hub
11482                .auth
11483                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11484                .await
11485            {
11486                Ok(token) => token,
11487                Err(e) => match dlg.token(e) {
11488                    Ok(token) => token,
11489                    Err(e) => {
11490                        dlg.finished(false);
11491                        return Err(common::Error::MissingToken(e));
11492                    }
11493                },
11494            };
11495            request_value_reader
11496                .seek(std::io::SeekFrom::Start(0))
11497                .unwrap();
11498            let mut req_result = {
11499                let mut mp_reader: common::MultiPartReader = Default::default();
11500                let (mut body_reader, content_type) = match protocol {
11501                    common::UploadProtocol::Simple => {
11502                        mp_reader.reserve_exact(2);
11503                        let size = reader.seek(std::io::SeekFrom::End(0)).unwrap();
11504                        reader.seek(std::io::SeekFrom::Start(0)).unwrap();
11505
11506                        mp_reader
11507                            .add_part(
11508                                &mut request_value_reader,
11509                                request_size,
11510                                json_mime_type.clone(),
11511                            )
11512                            .add_part(&mut reader, size, reader_mime_type.clone());
11513                        (
11514                            &mut mp_reader as &mut (dyn std::io::Read + Send),
11515                            common::MultiPartReader::mime_type(),
11516                        )
11517                    }
11518                    _ => (
11519                        &mut request_value_reader as &mut (dyn std::io::Read + Send),
11520                        json_mime_type.clone(),
11521                    ),
11522                };
11523                let client = &self.hub.client;
11524                dlg.pre_request();
11525                let mut req_builder = hyper::Request::builder()
11526                    .method(hyper::Method::POST)
11527                    .uri(url.as_str())
11528                    .header(USER_AGENT, self.hub._user_agent.clone());
11529
11530                if let Some(token) = token.as_ref() {
11531                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11532                }
11533
11534                let mut body_reader_bytes = vec![];
11535                body_reader.read_to_end(&mut body_reader_bytes).unwrap();
11536                let request = req_builder
11537                    .header(CONTENT_TYPE, content_type.to_string())
11538                    .body(common::to_body(body_reader_bytes.into()));
11539
11540                client.request(request.unwrap()).await
11541            };
11542
11543            match req_result {
11544                Err(err) => {
11545                    if let common::Retry::After(d) = dlg.http_error(&err) {
11546                        sleep(d).await;
11547                        continue;
11548                    }
11549                    dlg.finished(false);
11550                    return Err(common::Error::HttpError(err));
11551                }
11552                Ok(res) => {
11553                    let (mut parts, body) = res.into_parts();
11554                    let mut body = common::Body::new(body);
11555                    if !parts.status.is_success() {
11556                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11557                        let error = serde_json::from_str(&common::to_string(&bytes));
11558                        let response = common::to_response(parts, bytes.into());
11559
11560                        if let common::Retry::After(d) =
11561                            dlg.http_failure(&response, error.as_ref().ok())
11562                        {
11563                            sleep(d).await;
11564                            continue;
11565                        }
11566
11567                        dlg.finished(false);
11568
11569                        return Err(match error {
11570                            Ok(value) => common::Error::BadRequest(value),
11571                            _ => common::Error::Failure(response),
11572                        });
11573                    }
11574                    let response = {
11575                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11576                        let encoded = common::to_string(&bytes);
11577                        match serde_json::from_str(&encoded) {
11578                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11579                            Err(error) => {
11580                                dlg.response_json_decode_error(&encoded, &error);
11581                                return Err(common::Error::JsonDecodeError(
11582                                    encoded.to_string(),
11583                                    error,
11584                                ));
11585                            }
11586                        }
11587                    };
11588
11589                    dlg.finished(true);
11590                    return Ok(response);
11591                }
11592            }
11593        }
11594    }
11595
11596    /// Upload media all at once.
11597    /// If the upload fails for whichever reason, all progress is lost.
11598    ///
11599    /// * *multipart*: yes
11600    /// * *max size*: 0kb
11601    /// * *valid mime types*: '*/*'
11602    pub async fn upload<RS>(
11603        self,
11604        stream: RS,
11605        mime_type: mime::Mime,
11606    ) -> common::Result<(common::Response, CreateAssetResponse)>
11607    where
11608        RS: common::ReadSeek,
11609    {
11610        self.doit(stream, mime_type, common::UploadProtocol::Simple)
11611            .await
11612    }
11613
11614    ///
11615    /// Sets the *request* property to the given value.
11616    ///
11617    /// Even though the property as already been set when instantiating this call,
11618    /// we provide this method for API completeness.
11619    pub fn request(mut self, new_value: CreateAssetRequest) -> AdvertiserAssetUploadCall<'a, C> {
11620        self._request = new_value;
11621        self
11622    }
11623    /// Required. The ID of the advertiser this asset belongs to.
11624    ///
11625    /// Sets the *advertiser id* path property to the given value.
11626    ///
11627    /// Even though the property as already been set when instantiating this call,
11628    /// we provide this method for API completeness.
11629    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserAssetUploadCall<'a, C> {
11630        self._advertiser_id = new_value;
11631        self
11632    }
11633    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11634    /// while executing the actual API request.
11635    ///
11636    /// ````text
11637    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11638    /// ````
11639    ///
11640    /// Sets the *delegate* property to the given value.
11641    pub fn delegate(
11642        mut self,
11643        new_value: &'a mut dyn common::Delegate,
11644    ) -> AdvertiserAssetUploadCall<'a, C> {
11645        self._delegate = Some(new_value);
11646        self
11647    }
11648
11649    /// Set any additional parameter of the query string used in the request.
11650    /// It should be used to set parameters which are not yet available through their own
11651    /// setters.
11652    ///
11653    /// Please note that this method must not be used to set any of the known parameters
11654    /// which have their own setter method. If done anyway, the request will fail.
11655    ///
11656    /// # Additional Parameters
11657    ///
11658    /// * *$.xgafv* (query-string) - V1 error format.
11659    /// * *access_token* (query-string) - OAuth access token.
11660    /// * *alt* (query-string) - Data format for response.
11661    /// * *callback* (query-string) - JSONP
11662    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11663    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11664    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11665    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11666    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11667    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11668    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11669    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserAssetUploadCall<'a, C>
11670    where
11671        T: AsRef<str>,
11672    {
11673        self._additional_params
11674            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11675        self
11676    }
11677
11678    /// Identifies the authorization scope for the method you are building.
11679    ///
11680    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11681    /// [`Scope::DisplayVideo`].
11682    ///
11683    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11684    /// tokens for more than one scope.
11685    ///
11686    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11687    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11688    /// sufficient, a read-write scope will do as well.
11689    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserAssetUploadCall<'a, C>
11690    where
11691        St: AsRef<str>,
11692    {
11693        self._scopes.insert(String::from(scope.as_ref()));
11694        self
11695    }
11696    /// Identifies the authorization scope(s) for the method you are building.
11697    ///
11698    /// See [`Self::add_scope()`] for details.
11699    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserAssetUploadCall<'a, C>
11700    where
11701        I: IntoIterator<Item = St>,
11702        St: AsRef<str>,
11703    {
11704        self._scopes
11705            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11706        self
11707    }
11708
11709    /// Removes all scopes, and no default scope will be used either.
11710    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11711    /// for details).
11712    pub fn clear_scopes(mut self) -> AdvertiserAssetUploadCall<'a, C> {
11713        self._scopes.clear();
11714        self
11715    }
11716}
11717
11718/// Gets a single targeting option assigned to a campaign.
11719///
11720/// A builder for the *campaigns.targetingTypes.assignedTargetingOptions.get* method supported by a *advertiser* resource.
11721/// It is not used directly, but through a [`AdvertiserMethods`] instance.
11722///
11723/// # Example
11724///
11725/// Instantiate a resource method builder
11726///
11727/// ```test_harness,no_run
11728/// # extern crate hyper;
11729/// # extern crate hyper_rustls;
11730/// # extern crate google_displayvideo1 as displayvideo1;
11731/// # async fn dox() {
11732/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11733///
11734/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11735/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11736/// #     secret,
11737/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11738/// # ).build().await.unwrap();
11739///
11740/// # let client = hyper_util::client::legacy::Client::builder(
11741/// #     hyper_util::rt::TokioExecutor::new()
11742/// # )
11743/// # .build(
11744/// #     hyper_rustls::HttpsConnectorBuilder::new()
11745/// #         .with_native_roots()
11746/// #         .unwrap()
11747/// #         .https_or_http()
11748/// #         .enable_http1()
11749/// #         .build()
11750/// # );
11751/// # let mut hub = DisplayVideo::new(client, auth);
11752/// // You can configure optional parameters by calling the respective setters at will, and
11753/// // execute the final call using `doit()`.
11754/// // Values shown here are possibly random and not representative !
11755/// let result = hub.advertisers().campaigns_targeting_types_assigned_targeting_options_get(-20, -50, "targetingType", "assignedTargetingOptionId")
11756///              .doit().await;
11757/// # }
11758/// ```
11759pub struct AdvertiserCampaignTargetingTypeAssignedTargetingOptionGetCall<'a, C>
11760where
11761    C: 'a,
11762{
11763    hub: &'a DisplayVideo<C>,
11764    _advertiser_id: i64,
11765    _campaign_id: i64,
11766    _targeting_type: String,
11767    _assigned_targeting_option_id: String,
11768    _delegate: Option<&'a mut dyn common::Delegate>,
11769    _additional_params: HashMap<String, String>,
11770    _scopes: BTreeSet<String>,
11771}
11772
11773impl<'a, C> common::CallBuilder
11774    for AdvertiserCampaignTargetingTypeAssignedTargetingOptionGetCall<'a, C>
11775{
11776}
11777
11778impl<'a, C> AdvertiserCampaignTargetingTypeAssignedTargetingOptionGetCall<'a, C>
11779where
11780    C: common::Connector,
11781{
11782    /// Perform the operation you have build so far.
11783    pub async fn doit(mut self) -> common::Result<(common::Response, AssignedTargetingOption)> {
11784        use std::borrow::Cow;
11785        use std::io::{Read, Seek};
11786
11787        use common::{url::Params, ToParts};
11788        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11789
11790        let mut dd = common::DefaultDelegate;
11791        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11792        dlg.begin(common::MethodInfo {
11793            id: "displayvideo.advertisers.campaigns.targetingTypes.assignedTargetingOptions.get",
11794            http_method: hyper::Method::GET,
11795        });
11796
11797        for &field in [
11798            "alt",
11799            "advertiserId",
11800            "campaignId",
11801            "targetingType",
11802            "assignedTargetingOptionId",
11803        ]
11804        .iter()
11805        {
11806            if self._additional_params.contains_key(field) {
11807                dlg.finished(false);
11808                return Err(common::Error::FieldClash(field));
11809            }
11810        }
11811
11812        let mut params = Params::with_capacity(6 + self._additional_params.len());
11813        params.push("advertiserId", self._advertiser_id.to_string());
11814        params.push("campaignId", self._campaign_id.to_string());
11815        params.push("targetingType", self._targeting_type);
11816        params.push(
11817            "assignedTargetingOptionId",
11818            self._assigned_targeting_option_id,
11819        );
11820
11821        params.extend(self._additional_params.iter());
11822
11823        params.push("alt", "json");
11824        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/campaigns/{+campaignId}/targetingTypes/{+targetingType}/assignedTargetingOptions/{+assignedTargetingOptionId}";
11825        if self._scopes.is_empty() {
11826            self._scopes
11827                .insert(Scope::DisplayVideo.as_ref().to_string());
11828        }
11829
11830        #[allow(clippy::single_element_loop)]
11831        for &(find_this, param_name) in [
11832            ("{+advertiserId}", "advertiserId"),
11833            ("{+campaignId}", "campaignId"),
11834            ("{+targetingType}", "targetingType"),
11835            ("{+assignedTargetingOptionId}", "assignedTargetingOptionId"),
11836        ]
11837        .iter()
11838        {
11839            url = params.uri_replacement(url, param_name, find_this, true);
11840        }
11841        {
11842            let to_remove = [
11843                "assignedTargetingOptionId",
11844                "targetingType",
11845                "campaignId",
11846                "advertiserId",
11847            ];
11848            params.remove_params(&to_remove);
11849        }
11850
11851        let url = params.parse_with_url(&url);
11852
11853        loop {
11854            let token = match self
11855                .hub
11856                .auth
11857                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11858                .await
11859            {
11860                Ok(token) => token,
11861                Err(e) => match dlg.token(e) {
11862                    Ok(token) => token,
11863                    Err(e) => {
11864                        dlg.finished(false);
11865                        return Err(common::Error::MissingToken(e));
11866                    }
11867                },
11868            };
11869            let mut req_result = {
11870                let client = &self.hub.client;
11871                dlg.pre_request();
11872                let mut req_builder = hyper::Request::builder()
11873                    .method(hyper::Method::GET)
11874                    .uri(url.as_str())
11875                    .header(USER_AGENT, self.hub._user_agent.clone());
11876
11877                if let Some(token) = token.as_ref() {
11878                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11879                }
11880
11881                let request = req_builder
11882                    .header(CONTENT_LENGTH, 0_u64)
11883                    .body(common::to_body::<String>(None));
11884
11885                client.request(request.unwrap()).await
11886            };
11887
11888            match req_result {
11889                Err(err) => {
11890                    if let common::Retry::After(d) = dlg.http_error(&err) {
11891                        sleep(d).await;
11892                        continue;
11893                    }
11894                    dlg.finished(false);
11895                    return Err(common::Error::HttpError(err));
11896                }
11897                Ok(res) => {
11898                    let (mut parts, body) = res.into_parts();
11899                    let mut body = common::Body::new(body);
11900                    if !parts.status.is_success() {
11901                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11902                        let error = serde_json::from_str(&common::to_string(&bytes));
11903                        let response = common::to_response(parts, bytes.into());
11904
11905                        if let common::Retry::After(d) =
11906                            dlg.http_failure(&response, error.as_ref().ok())
11907                        {
11908                            sleep(d).await;
11909                            continue;
11910                        }
11911
11912                        dlg.finished(false);
11913
11914                        return Err(match error {
11915                            Ok(value) => common::Error::BadRequest(value),
11916                            _ => common::Error::Failure(response),
11917                        });
11918                    }
11919                    let response = {
11920                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11921                        let encoded = common::to_string(&bytes);
11922                        match serde_json::from_str(&encoded) {
11923                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11924                            Err(error) => {
11925                                dlg.response_json_decode_error(&encoded, &error);
11926                                return Err(common::Error::JsonDecodeError(
11927                                    encoded.to_string(),
11928                                    error,
11929                                ));
11930                            }
11931                        }
11932                    };
11933
11934                    dlg.finished(true);
11935                    return Ok(response);
11936                }
11937            }
11938        }
11939    }
11940
11941    /// Required. The ID of the advertiser the campaign belongs to.
11942    ///
11943    /// Sets the *advertiser id* path property to the given value.
11944    ///
11945    /// Even though the property as already been set when instantiating this call,
11946    /// we provide this method for API completeness.
11947    pub fn advertiser_id(
11948        mut self,
11949        new_value: i64,
11950    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
11951        self._advertiser_id = new_value;
11952        self
11953    }
11954    /// Required. The ID of the campaign the assigned targeting option belongs to.
11955    ///
11956    /// Sets the *campaign id* path property to the given value.
11957    ///
11958    /// Even though the property as already been set when instantiating this call,
11959    /// we provide this method for API completeness.
11960    pub fn campaign_id(
11961        mut self,
11962        new_value: i64,
11963    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
11964        self._campaign_id = new_value;
11965        self
11966    }
11967    /// Required. Identifies the type of this assigned targeting option. Supported targeting types: * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_INVENTORY_SOURCE` * `TARGETING_TYPE_INVENTORY_SOURCE_GROUP` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_THIRD_PARTY_VERIFIER` * `TARGETING_TYPE_VIEWABILITY`
11968    ///
11969    /// Sets the *targeting type* path property to the given value.
11970    ///
11971    /// Even though the property as already been set when instantiating this call,
11972    /// we provide this method for API completeness.
11973    pub fn targeting_type(
11974        mut self,
11975        new_value: &str,
11976    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
11977        self._targeting_type = new_value.to_string();
11978        self
11979    }
11980    /// Required. An identifier unique to the targeting type in this campaign that identifies the assigned targeting option being requested.
11981    ///
11982    /// Sets the *assigned targeting option id* path property to the given value.
11983    ///
11984    /// Even though the property as already been set when instantiating this call,
11985    /// we provide this method for API completeness.
11986    pub fn assigned_targeting_option_id(
11987        mut self,
11988        new_value: &str,
11989    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
11990        self._assigned_targeting_option_id = new_value.to_string();
11991        self
11992    }
11993    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11994    /// while executing the actual API request.
11995    ///
11996    /// ````text
11997    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11998    /// ````
11999    ///
12000    /// Sets the *delegate* property to the given value.
12001    pub fn delegate(
12002        mut self,
12003        new_value: &'a mut dyn common::Delegate,
12004    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
12005        self._delegate = Some(new_value);
12006        self
12007    }
12008
12009    /// Set any additional parameter of the query string used in the request.
12010    /// It should be used to set parameters which are not yet available through their own
12011    /// setters.
12012    ///
12013    /// Please note that this method must not be used to set any of the known parameters
12014    /// which have their own setter method. If done anyway, the request will fail.
12015    ///
12016    /// # Additional Parameters
12017    ///
12018    /// * *$.xgafv* (query-string) - V1 error format.
12019    /// * *access_token* (query-string) - OAuth access token.
12020    /// * *alt* (query-string) - Data format for response.
12021    /// * *callback* (query-string) - JSONP
12022    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12023    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12024    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12025    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12026    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12027    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12028    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12029    pub fn param<T>(
12030        mut self,
12031        name: T,
12032        value: T,
12033    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionGetCall<'a, C>
12034    where
12035        T: AsRef<str>,
12036    {
12037        self._additional_params
12038            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12039        self
12040    }
12041
12042    /// Identifies the authorization scope for the method you are building.
12043    ///
12044    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12045    /// [`Scope::DisplayVideo`].
12046    ///
12047    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12048    /// tokens for more than one scope.
12049    ///
12050    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12051    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12052    /// sufficient, a read-write scope will do as well.
12053    pub fn add_scope<St>(
12054        mut self,
12055        scope: St,
12056    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionGetCall<'a, C>
12057    where
12058        St: AsRef<str>,
12059    {
12060        self._scopes.insert(String::from(scope.as_ref()));
12061        self
12062    }
12063    /// Identifies the authorization scope(s) for the method you are building.
12064    ///
12065    /// See [`Self::add_scope()`] for details.
12066    pub fn add_scopes<I, St>(
12067        mut self,
12068        scopes: I,
12069    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionGetCall<'a, C>
12070    where
12071        I: IntoIterator<Item = St>,
12072        St: AsRef<str>,
12073    {
12074        self._scopes
12075            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12076        self
12077    }
12078
12079    /// Removes all scopes, and no default scope will be used either.
12080    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12081    /// for details).
12082    pub fn clear_scopes(
12083        mut self,
12084    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
12085        self._scopes.clear();
12086        self
12087    }
12088}
12089
12090/// Lists the targeting options assigned to a campaign for a specified targeting type.
12091///
12092/// A builder for the *campaigns.targetingTypes.assignedTargetingOptions.list* method supported by a *advertiser* resource.
12093/// It is not used directly, but through a [`AdvertiserMethods`] instance.
12094///
12095/// # Example
12096///
12097/// Instantiate a resource method builder
12098///
12099/// ```test_harness,no_run
12100/// # extern crate hyper;
12101/// # extern crate hyper_rustls;
12102/// # extern crate google_displayvideo1 as displayvideo1;
12103/// # async fn dox() {
12104/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12105///
12106/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12107/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12108/// #     secret,
12109/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12110/// # ).build().await.unwrap();
12111///
12112/// # let client = hyper_util::client::legacy::Client::builder(
12113/// #     hyper_util::rt::TokioExecutor::new()
12114/// # )
12115/// # .build(
12116/// #     hyper_rustls::HttpsConnectorBuilder::new()
12117/// #         .with_native_roots()
12118/// #         .unwrap()
12119/// #         .https_or_http()
12120/// #         .enable_http1()
12121/// #         .build()
12122/// # );
12123/// # let mut hub = DisplayVideo::new(client, auth);
12124/// // You can configure optional parameters by calling the respective setters at will, and
12125/// // execute the final call using `doit()`.
12126/// // Values shown here are possibly random and not representative !
12127/// let result = hub.advertisers().campaigns_targeting_types_assigned_targeting_options_list(-12, -16, "targetingType")
12128///              .page_token("ipsum")
12129///              .page_size(-50)
12130///              .order_by("est")
12131///              .filter("gubergren")
12132///              .doit().await;
12133/// # }
12134/// ```
12135pub struct AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall<'a, C>
12136where
12137    C: 'a,
12138{
12139    hub: &'a DisplayVideo<C>,
12140    _advertiser_id: i64,
12141    _campaign_id: i64,
12142    _targeting_type: String,
12143    _page_token: Option<String>,
12144    _page_size: Option<i32>,
12145    _order_by: Option<String>,
12146    _filter: Option<String>,
12147    _delegate: Option<&'a mut dyn common::Delegate>,
12148    _additional_params: HashMap<String, String>,
12149    _scopes: BTreeSet<String>,
12150}
12151
12152impl<'a, C> common::CallBuilder
12153    for AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall<'a, C>
12154{
12155}
12156
12157impl<'a, C> AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall<'a, C>
12158where
12159    C: common::Connector,
12160{
12161    /// Perform the operation you have build so far.
12162    pub async fn doit(
12163        mut self,
12164    ) -> common::Result<(
12165        common::Response,
12166        ListCampaignAssignedTargetingOptionsResponse,
12167    )> {
12168        use std::borrow::Cow;
12169        use std::io::{Read, Seek};
12170
12171        use common::{url::Params, ToParts};
12172        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12173
12174        let mut dd = common::DefaultDelegate;
12175        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12176        dlg.begin(common::MethodInfo {
12177            id: "displayvideo.advertisers.campaigns.targetingTypes.assignedTargetingOptions.list",
12178            http_method: hyper::Method::GET,
12179        });
12180
12181        for &field in [
12182            "alt",
12183            "advertiserId",
12184            "campaignId",
12185            "targetingType",
12186            "pageToken",
12187            "pageSize",
12188            "orderBy",
12189            "filter",
12190        ]
12191        .iter()
12192        {
12193            if self._additional_params.contains_key(field) {
12194                dlg.finished(false);
12195                return Err(common::Error::FieldClash(field));
12196            }
12197        }
12198
12199        let mut params = Params::with_capacity(9 + self._additional_params.len());
12200        params.push("advertiserId", self._advertiser_id.to_string());
12201        params.push("campaignId", self._campaign_id.to_string());
12202        params.push("targetingType", self._targeting_type);
12203        if let Some(value) = self._page_token.as_ref() {
12204            params.push("pageToken", value);
12205        }
12206        if let Some(value) = self._page_size.as_ref() {
12207            params.push("pageSize", value.to_string());
12208        }
12209        if let Some(value) = self._order_by.as_ref() {
12210            params.push("orderBy", value);
12211        }
12212        if let Some(value) = self._filter.as_ref() {
12213            params.push("filter", value);
12214        }
12215
12216        params.extend(self._additional_params.iter());
12217
12218        params.push("alt", "json");
12219        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/campaigns/{+campaignId}/targetingTypes/{+targetingType}/assignedTargetingOptions";
12220        if self._scopes.is_empty() {
12221            self._scopes
12222                .insert(Scope::DisplayVideo.as_ref().to_string());
12223        }
12224
12225        #[allow(clippy::single_element_loop)]
12226        for &(find_this, param_name) in [
12227            ("{+advertiserId}", "advertiserId"),
12228            ("{+campaignId}", "campaignId"),
12229            ("{+targetingType}", "targetingType"),
12230        ]
12231        .iter()
12232        {
12233            url = params.uri_replacement(url, param_name, find_this, true);
12234        }
12235        {
12236            let to_remove = ["targetingType", "campaignId", "advertiserId"];
12237            params.remove_params(&to_remove);
12238        }
12239
12240        let url = params.parse_with_url(&url);
12241
12242        loop {
12243            let token = match self
12244                .hub
12245                .auth
12246                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12247                .await
12248            {
12249                Ok(token) => token,
12250                Err(e) => match dlg.token(e) {
12251                    Ok(token) => token,
12252                    Err(e) => {
12253                        dlg.finished(false);
12254                        return Err(common::Error::MissingToken(e));
12255                    }
12256                },
12257            };
12258            let mut req_result = {
12259                let client = &self.hub.client;
12260                dlg.pre_request();
12261                let mut req_builder = hyper::Request::builder()
12262                    .method(hyper::Method::GET)
12263                    .uri(url.as_str())
12264                    .header(USER_AGENT, self.hub._user_agent.clone());
12265
12266                if let Some(token) = token.as_ref() {
12267                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12268                }
12269
12270                let request = req_builder
12271                    .header(CONTENT_LENGTH, 0_u64)
12272                    .body(common::to_body::<String>(None));
12273
12274                client.request(request.unwrap()).await
12275            };
12276
12277            match req_result {
12278                Err(err) => {
12279                    if let common::Retry::After(d) = dlg.http_error(&err) {
12280                        sleep(d).await;
12281                        continue;
12282                    }
12283                    dlg.finished(false);
12284                    return Err(common::Error::HttpError(err));
12285                }
12286                Ok(res) => {
12287                    let (mut parts, body) = res.into_parts();
12288                    let mut body = common::Body::new(body);
12289                    if !parts.status.is_success() {
12290                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12291                        let error = serde_json::from_str(&common::to_string(&bytes));
12292                        let response = common::to_response(parts, bytes.into());
12293
12294                        if let common::Retry::After(d) =
12295                            dlg.http_failure(&response, error.as_ref().ok())
12296                        {
12297                            sleep(d).await;
12298                            continue;
12299                        }
12300
12301                        dlg.finished(false);
12302
12303                        return Err(match error {
12304                            Ok(value) => common::Error::BadRequest(value),
12305                            _ => common::Error::Failure(response),
12306                        });
12307                    }
12308                    let response = {
12309                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12310                        let encoded = common::to_string(&bytes);
12311                        match serde_json::from_str(&encoded) {
12312                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12313                            Err(error) => {
12314                                dlg.response_json_decode_error(&encoded, &error);
12315                                return Err(common::Error::JsonDecodeError(
12316                                    encoded.to_string(),
12317                                    error,
12318                                ));
12319                            }
12320                        }
12321                    };
12322
12323                    dlg.finished(true);
12324                    return Ok(response);
12325                }
12326            }
12327        }
12328    }
12329
12330    /// Required. The ID of the advertiser the campaign belongs to.
12331    ///
12332    /// Sets the *advertiser id* path property to the given value.
12333    ///
12334    /// Even though the property as already been set when instantiating this call,
12335    /// we provide this method for API completeness.
12336    pub fn advertiser_id(
12337        mut self,
12338        new_value: i64,
12339    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall<'a, C> {
12340        self._advertiser_id = new_value;
12341        self
12342    }
12343    /// Required. The ID of the campaign to list assigned targeting options for.
12344    ///
12345    /// Sets the *campaign id* path property to the given value.
12346    ///
12347    /// Even though the property as already been set when instantiating this call,
12348    /// we provide this method for API completeness.
12349    pub fn campaign_id(
12350        mut self,
12351        new_value: i64,
12352    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall<'a, C> {
12353        self._campaign_id = new_value;
12354        self
12355    }
12356    /// Required. Identifies the type of assigned targeting options to list. Supported targeting types: * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_INVENTORY_SOURCE` * `TARGETING_TYPE_INVENTORY_SOURCE_GROUP` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_THIRD_PARTY_VERIFIER` * `TARGETING_TYPE_VIEWABILITY`
12357    ///
12358    /// Sets the *targeting type* path property to the given value.
12359    ///
12360    /// Even though the property as already been set when instantiating this call,
12361    /// we provide this method for API completeness.
12362    pub fn targeting_type(
12363        mut self,
12364        new_value: &str,
12365    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall<'a, C> {
12366        self._targeting_type = new_value.to_string();
12367        self
12368    }
12369    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListCampaignAssignedTargetingOptions` method. If not specified, the first page of results will be returned.
12370    ///
12371    /// Sets the *page token* query property to the given value.
12372    pub fn page_token(
12373        mut self,
12374        new_value: &str,
12375    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall<'a, C> {
12376        self._page_token = Some(new_value.to_string());
12377        self
12378    }
12379    /// Requested page size. Must be between `1` and `5000`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
12380    ///
12381    /// Sets the *page size* query property to the given value.
12382    pub fn page_size(
12383        mut self,
12384        new_value: i32,
12385    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall<'a, C> {
12386        self._page_size = Some(new_value);
12387        self
12388    }
12389    /// Field by which to sort the list. Acceptable values are: * `assignedTargetingOptionId` (default) The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `assignedTargetingOptionId desc`.
12390    ///
12391    /// Sets the *order by* query property to the given value.
12392    pub fn order_by(
12393        mut self,
12394        new_value: &str,
12395    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall<'a, C> {
12396        self._order_by = Some(new_value.to_string());
12397        self
12398    }
12399    /// Allows filtering by assigned targeting option fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by the `OR` logical operator. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `EQUALS (=)` operator. Supported fields: * `assignedTargetingOptionId` * `inheritance` Examples: * `AssignedTargetingOption` resources with ID 1 or 2 `assignedTargetingOptionId="1" OR assignedTargetingOptionId="2"` * `AssignedTargetingOption` resources with inheritance status of `NOT_INHERITED` or `INHERITED_FROM_PARTNER` `inheritance="NOT_INHERITED" OR inheritance="INHERITED_FROM_PARTNER"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
12400    ///
12401    /// Sets the *filter* query property to the given value.
12402    pub fn filter(
12403        mut self,
12404        new_value: &str,
12405    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall<'a, C> {
12406        self._filter = Some(new_value.to_string());
12407        self
12408    }
12409    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12410    /// while executing the actual API request.
12411    ///
12412    /// ````text
12413    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12414    /// ````
12415    ///
12416    /// Sets the *delegate* property to the given value.
12417    pub fn delegate(
12418        mut self,
12419        new_value: &'a mut dyn common::Delegate,
12420    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall<'a, C> {
12421        self._delegate = Some(new_value);
12422        self
12423    }
12424
12425    /// Set any additional parameter of the query string used in the request.
12426    /// It should be used to set parameters which are not yet available through their own
12427    /// setters.
12428    ///
12429    /// Please note that this method must not be used to set any of the known parameters
12430    /// which have their own setter method. If done anyway, the request will fail.
12431    ///
12432    /// # Additional Parameters
12433    ///
12434    /// * *$.xgafv* (query-string) - V1 error format.
12435    /// * *access_token* (query-string) - OAuth access token.
12436    /// * *alt* (query-string) - Data format for response.
12437    /// * *callback* (query-string) - JSONP
12438    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12439    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12440    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12441    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12442    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12443    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12444    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12445    pub fn param<T>(
12446        mut self,
12447        name: T,
12448        value: T,
12449    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall<'a, C>
12450    where
12451        T: AsRef<str>,
12452    {
12453        self._additional_params
12454            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12455        self
12456    }
12457
12458    /// Identifies the authorization scope for the method you are building.
12459    ///
12460    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12461    /// [`Scope::DisplayVideo`].
12462    ///
12463    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12464    /// tokens for more than one scope.
12465    ///
12466    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12467    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12468    /// sufficient, a read-write scope will do as well.
12469    pub fn add_scope<St>(
12470        mut self,
12471        scope: St,
12472    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall<'a, C>
12473    where
12474        St: AsRef<str>,
12475    {
12476        self._scopes.insert(String::from(scope.as_ref()));
12477        self
12478    }
12479    /// Identifies the authorization scope(s) for the method you are building.
12480    ///
12481    /// See [`Self::add_scope()`] for details.
12482    pub fn add_scopes<I, St>(
12483        mut self,
12484        scopes: I,
12485    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall<'a, C>
12486    where
12487        I: IntoIterator<Item = St>,
12488        St: AsRef<str>,
12489    {
12490        self._scopes
12491            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12492        self
12493    }
12494
12495    /// Removes all scopes, and no default scope will be used either.
12496    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12497    /// for details).
12498    pub fn clear_scopes(
12499        mut self,
12500    ) -> AdvertiserCampaignTargetingTypeAssignedTargetingOptionListCall<'a, C> {
12501        self._scopes.clear();
12502        self
12503    }
12504}
12505
12506/// Lists assigned targeting options of a campaign across targeting types.
12507///
12508/// A builder for the *campaigns.bulkListCampaignAssignedTargetingOptions* method supported by a *advertiser* resource.
12509/// It is not used directly, but through a [`AdvertiserMethods`] instance.
12510///
12511/// # Example
12512///
12513/// Instantiate a resource method builder
12514///
12515/// ```test_harness,no_run
12516/// # extern crate hyper;
12517/// # extern crate hyper_rustls;
12518/// # extern crate google_displayvideo1 as displayvideo1;
12519/// # async fn dox() {
12520/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12521///
12522/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12523/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12524/// #     secret,
12525/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12526/// # ).build().await.unwrap();
12527///
12528/// # let client = hyper_util::client::legacy::Client::builder(
12529/// #     hyper_util::rt::TokioExecutor::new()
12530/// # )
12531/// # .build(
12532/// #     hyper_rustls::HttpsConnectorBuilder::new()
12533/// #         .with_native_roots()
12534/// #         .unwrap()
12535/// #         .https_or_http()
12536/// #         .enable_http1()
12537/// #         .build()
12538/// # );
12539/// # let mut hub = DisplayVideo::new(client, auth);
12540/// // You can configure optional parameters by calling the respective setters at will, and
12541/// // execute the final call using `doit()`.
12542/// // Values shown here are possibly random and not representative !
12543/// let result = hub.advertisers().campaigns_bulk_list_campaign_assigned_targeting_options(-17, -99)
12544///              .page_token("Lorem")
12545///              .page_size(-25)
12546///              .order_by("labore")
12547///              .filter("sed")
12548///              .doit().await;
12549/// # }
12550/// ```
12551pub struct AdvertiserCampaignBulkListCampaignAssignedTargetingOptionCall<'a, C>
12552where
12553    C: 'a,
12554{
12555    hub: &'a DisplayVideo<C>,
12556    _advertiser_id: i64,
12557    _campaign_id: i64,
12558    _page_token: Option<String>,
12559    _page_size: Option<i32>,
12560    _order_by: Option<String>,
12561    _filter: Option<String>,
12562    _delegate: Option<&'a mut dyn common::Delegate>,
12563    _additional_params: HashMap<String, String>,
12564    _scopes: BTreeSet<String>,
12565}
12566
12567impl<'a, C> common::CallBuilder
12568    for AdvertiserCampaignBulkListCampaignAssignedTargetingOptionCall<'a, C>
12569{
12570}
12571
12572impl<'a, C> AdvertiserCampaignBulkListCampaignAssignedTargetingOptionCall<'a, C>
12573where
12574    C: common::Connector,
12575{
12576    /// Perform the operation you have build so far.
12577    pub async fn doit(
12578        mut self,
12579    ) -> common::Result<(
12580        common::Response,
12581        BulkListCampaignAssignedTargetingOptionsResponse,
12582    )> {
12583        use std::borrow::Cow;
12584        use std::io::{Read, Seek};
12585
12586        use common::{url::Params, ToParts};
12587        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12588
12589        let mut dd = common::DefaultDelegate;
12590        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12591        dlg.begin(common::MethodInfo {
12592            id: "displayvideo.advertisers.campaigns.bulkListCampaignAssignedTargetingOptions",
12593            http_method: hyper::Method::GET,
12594        });
12595
12596        for &field in [
12597            "alt",
12598            "advertiserId",
12599            "campaignId",
12600            "pageToken",
12601            "pageSize",
12602            "orderBy",
12603            "filter",
12604        ]
12605        .iter()
12606        {
12607            if self._additional_params.contains_key(field) {
12608                dlg.finished(false);
12609                return Err(common::Error::FieldClash(field));
12610            }
12611        }
12612
12613        let mut params = Params::with_capacity(8 + self._additional_params.len());
12614        params.push("advertiserId", self._advertiser_id.to_string());
12615        params.push("campaignId", self._campaign_id.to_string());
12616        if let Some(value) = self._page_token.as_ref() {
12617            params.push("pageToken", value);
12618        }
12619        if let Some(value) = self._page_size.as_ref() {
12620            params.push("pageSize", value.to_string());
12621        }
12622        if let Some(value) = self._order_by.as_ref() {
12623            params.push("orderBy", value);
12624        }
12625        if let Some(value) = self._filter.as_ref() {
12626            params.push("filter", value);
12627        }
12628
12629        params.extend(self._additional_params.iter());
12630
12631        params.push("alt", "json");
12632        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/campaigns/{+campaignId}:bulkListCampaignAssignedTargetingOptions";
12633        if self._scopes.is_empty() {
12634            self._scopes
12635                .insert(Scope::DisplayVideo.as_ref().to_string());
12636        }
12637
12638        #[allow(clippy::single_element_loop)]
12639        for &(find_this, param_name) in [
12640            ("{+advertiserId}", "advertiserId"),
12641            ("{+campaignId}", "campaignId"),
12642        ]
12643        .iter()
12644        {
12645            url = params.uri_replacement(url, param_name, find_this, true);
12646        }
12647        {
12648            let to_remove = ["campaignId", "advertiserId"];
12649            params.remove_params(&to_remove);
12650        }
12651
12652        let url = params.parse_with_url(&url);
12653
12654        loop {
12655            let token = match self
12656                .hub
12657                .auth
12658                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12659                .await
12660            {
12661                Ok(token) => token,
12662                Err(e) => match dlg.token(e) {
12663                    Ok(token) => token,
12664                    Err(e) => {
12665                        dlg.finished(false);
12666                        return Err(common::Error::MissingToken(e));
12667                    }
12668                },
12669            };
12670            let mut req_result = {
12671                let client = &self.hub.client;
12672                dlg.pre_request();
12673                let mut req_builder = hyper::Request::builder()
12674                    .method(hyper::Method::GET)
12675                    .uri(url.as_str())
12676                    .header(USER_AGENT, self.hub._user_agent.clone());
12677
12678                if let Some(token) = token.as_ref() {
12679                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12680                }
12681
12682                let request = req_builder
12683                    .header(CONTENT_LENGTH, 0_u64)
12684                    .body(common::to_body::<String>(None));
12685
12686                client.request(request.unwrap()).await
12687            };
12688
12689            match req_result {
12690                Err(err) => {
12691                    if let common::Retry::After(d) = dlg.http_error(&err) {
12692                        sleep(d).await;
12693                        continue;
12694                    }
12695                    dlg.finished(false);
12696                    return Err(common::Error::HttpError(err));
12697                }
12698                Ok(res) => {
12699                    let (mut parts, body) = res.into_parts();
12700                    let mut body = common::Body::new(body);
12701                    if !parts.status.is_success() {
12702                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12703                        let error = serde_json::from_str(&common::to_string(&bytes));
12704                        let response = common::to_response(parts, bytes.into());
12705
12706                        if let common::Retry::After(d) =
12707                            dlg.http_failure(&response, error.as_ref().ok())
12708                        {
12709                            sleep(d).await;
12710                            continue;
12711                        }
12712
12713                        dlg.finished(false);
12714
12715                        return Err(match error {
12716                            Ok(value) => common::Error::BadRequest(value),
12717                            _ => common::Error::Failure(response),
12718                        });
12719                    }
12720                    let response = {
12721                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12722                        let encoded = common::to_string(&bytes);
12723                        match serde_json::from_str(&encoded) {
12724                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12725                            Err(error) => {
12726                                dlg.response_json_decode_error(&encoded, &error);
12727                                return Err(common::Error::JsonDecodeError(
12728                                    encoded.to_string(),
12729                                    error,
12730                                ));
12731                            }
12732                        }
12733                    };
12734
12735                    dlg.finished(true);
12736                    return Ok(response);
12737                }
12738            }
12739        }
12740    }
12741
12742    /// Required. The ID of the advertiser the campaign belongs to.
12743    ///
12744    /// Sets the *advertiser id* path property to the given value.
12745    ///
12746    /// Even though the property as already been set when instantiating this call,
12747    /// we provide this method for API completeness.
12748    pub fn advertiser_id(
12749        mut self,
12750        new_value: i64,
12751    ) -> AdvertiserCampaignBulkListCampaignAssignedTargetingOptionCall<'a, C> {
12752        self._advertiser_id = new_value;
12753        self
12754    }
12755    /// Required. The ID of the campaign to list assigned targeting options for.
12756    ///
12757    /// Sets the *campaign id* path property to the given value.
12758    ///
12759    /// Even though the property as already been set when instantiating this call,
12760    /// we provide this method for API completeness.
12761    pub fn campaign_id(
12762        mut self,
12763        new_value: i64,
12764    ) -> AdvertiserCampaignBulkListCampaignAssignedTargetingOptionCall<'a, C> {
12765        self._campaign_id = new_value;
12766        self
12767    }
12768    /// A token that lets the client fetch the next page of results. Typically, this is the value of next_page_token returned from the previous call to `BulkListCampaignAssignedTargetingOptions` method. If not specified, the first page of results will be returned.
12769    ///
12770    /// Sets the *page token* query property to the given value.
12771    pub fn page_token(
12772        mut self,
12773        new_value: &str,
12774    ) -> AdvertiserCampaignBulkListCampaignAssignedTargetingOptionCall<'a, C> {
12775        self._page_token = Some(new_value.to_string());
12776        self
12777    }
12778    /// Requested page size. The size must be an integer between `1` and `5000`. If unspecified, the default is `5000`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
12779    ///
12780    /// Sets the *page size* query property to the given value.
12781    pub fn page_size(
12782        mut self,
12783        new_value: i32,
12784    ) -> AdvertiserCampaignBulkListCampaignAssignedTargetingOptionCall<'a, C> {
12785        self._page_size = Some(new_value);
12786        self
12787    }
12788    /// Field by which to sort the list. Acceptable values are: * `targetingType` (default) The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `targetingType desc`.
12789    ///
12790    /// Sets the *order by* query property to the given value.
12791    pub fn order_by(
12792        mut self,
12793        new_value: &str,
12794    ) -> AdvertiserCampaignBulkListCampaignAssignedTargetingOptionCall<'a, C> {
12795        self._order_by = Some(new_value.to_string());
12796        self
12797    }
12798    /// Allows filtering by assigned targeting option fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by the `OR` logical operator. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `EQUALS (=)` operator. Supported fields: * `targetingType` * `inheritance` Examples: * `AssignedTargetingOption` resources of targeting type `TARGETING_TYPE_LANGUAGE` or `TARGETING_TYPE_GENDER`: `targetingType="TARGETING_TYPE_LANGUAGE" OR targetingType="TARGETING_TYPE_GENDER"` * `AssignedTargetingOption` resources with inheritance status of `NOT_INHERITED` or `INHERITED_FROM_PARTNER`: `inheritance="NOT_INHERITED" OR inheritance="INHERITED_FROM_PARTNER"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
12799    ///
12800    /// Sets the *filter* query property to the given value.
12801    pub fn filter(
12802        mut self,
12803        new_value: &str,
12804    ) -> AdvertiserCampaignBulkListCampaignAssignedTargetingOptionCall<'a, C> {
12805        self._filter = Some(new_value.to_string());
12806        self
12807    }
12808    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12809    /// while executing the actual API request.
12810    ///
12811    /// ````text
12812    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12813    /// ````
12814    ///
12815    /// Sets the *delegate* property to the given value.
12816    pub fn delegate(
12817        mut self,
12818        new_value: &'a mut dyn common::Delegate,
12819    ) -> AdvertiserCampaignBulkListCampaignAssignedTargetingOptionCall<'a, C> {
12820        self._delegate = Some(new_value);
12821        self
12822    }
12823
12824    /// Set any additional parameter of the query string used in the request.
12825    /// It should be used to set parameters which are not yet available through their own
12826    /// setters.
12827    ///
12828    /// Please note that this method must not be used to set any of the known parameters
12829    /// which have their own setter method. If done anyway, the request will fail.
12830    ///
12831    /// # Additional Parameters
12832    ///
12833    /// * *$.xgafv* (query-string) - V1 error format.
12834    /// * *access_token* (query-string) - OAuth access token.
12835    /// * *alt* (query-string) - Data format for response.
12836    /// * *callback* (query-string) - JSONP
12837    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12838    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12839    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12840    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12841    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12842    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12843    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12844    pub fn param<T>(
12845        mut self,
12846        name: T,
12847        value: T,
12848    ) -> AdvertiserCampaignBulkListCampaignAssignedTargetingOptionCall<'a, C>
12849    where
12850        T: AsRef<str>,
12851    {
12852        self._additional_params
12853            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12854        self
12855    }
12856
12857    /// Identifies the authorization scope for the method you are building.
12858    ///
12859    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12860    /// [`Scope::DisplayVideo`].
12861    ///
12862    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12863    /// tokens for more than one scope.
12864    ///
12865    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12866    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12867    /// sufficient, a read-write scope will do as well.
12868    pub fn add_scope<St>(
12869        mut self,
12870        scope: St,
12871    ) -> AdvertiserCampaignBulkListCampaignAssignedTargetingOptionCall<'a, C>
12872    where
12873        St: AsRef<str>,
12874    {
12875        self._scopes.insert(String::from(scope.as_ref()));
12876        self
12877    }
12878    /// Identifies the authorization scope(s) for the method you are building.
12879    ///
12880    /// See [`Self::add_scope()`] for details.
12881    pub fn add_scopes<I, St>(
12882        mut self,
12883        scopes: I,
12884    ) -> AdvertiserCampaignBulkListCampaignAssignedTargetingOptionCall<'a, C>
12885    where
12886        I: IntoIterator<Item = St>,
12887        St: AsRef<str>,
12888    {
12889        self._scopes
12890            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12891        self
12892    }
12893
12894    /// Removes all scopes, and no default scope will be used either.
12895    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12896    /// for details).
12897    pub fn clear_scopes(
12898        mut self,
12899    ) -> AdvertiserCampaignBulkListCampaignAssignedTargetingOptionCall<'a, C> {
12900        self._scopes.clear();
12901        self
12902    }
12903}
12904
12905/// Creates a new campaign. Returns the newly created campaign if successful.
12906///
12907/// A builder for the *campaigns.create* method supported by a *advertiser* resource.
12908/// It is not used directly, but through a [`AdvertiserMethods`] instance.
12909///
12910/// # Example
12911///
12912/// Instantiate a resource method builder
12913///
12914/// ```test_harness,no_run
12915/// # extern crate hyper;
12916/// # extern crate hyper_rustls;
12917/// # extern crate google_displayvideo1 as displayvideo1;
12918/// use displayvideo1::api::Campaign;
12919/// # async fn dox() {
12920/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12921///
12922/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12923/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12924/// #     secret,
12925/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12926/// # ).build().await.unwrap();
12927///
12928/// # let client = hyper_util::client::legacy::Client::builder(
12929/// #     hyper_util::rt::TokioExecutor::new()
12930/// # )
12931/// # .build(
12932/// #     hyper_rustls::HttpsConnectorBuilder::new()
12933/// #         .with_native_roots()
12934/// #         .unwrap()
12935/// #         .https_or_http()
12936/// #         .enable_http1()
12937/// #         .build()
12938/// # );
12939/// # let mut hub = DisplayVideo::new(client, auth);
12940/// // As the method needs a request, you would usually fill it with the desired information
12941/// // into the respective structure. Some of the parts shown here might not be applicable !
12942/// // Values shown here are possibly random and not representative !
12943/// let mut req = Campaign::default();
12944///
12945/// // You can configure optional parameters by calling the respective setters at will, and
12946/// // execute the final call using `doit()`.
12947/// // Values shown here are possibly random and not representative !
12948/// let result = hub.advertisers().campaigns_create(req, -70)
12949///              .doit().await;
12950/// # }
12951/// ```
12952pub struct AdvertiserCampaignCreateCall<'a, C>
12953where
12954    C: 'a,
12955{
12956    hub: &'a DisplayVideo<C>,
12957    _request: Campaign,
12958    _advertiser_id: i64,
12959    _delegate: Option<&'a mut dyn common::Delegate>,
12960    _additional_params: HashMap<String, String>,
12961    _scopes: BTreeSet<String>,
12962}
12963
12964impl<'a, C> common::CallBuilder for AdvertiserCampaignCreateCall<'a, C> {}
12965
12966impl<'a, C> AdvertiserCampaignCreateCall<'a, C>
12967where
12968    C: common::Connector,
12969{
12970    /// Perform the operation you have build so far.
12971    pub async fn doit(mut self) -> common::Result<(common::Response, Campaign)> {
12972        use std::borrow::Cow;
12973        use std::io::{Read, Seek};
12974
12975        use common::{url::Params, ToParts};
12976        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12977
12978        let mut dd = common::DefaultDelegate;
12979        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12980        dlg.begin(common::MethodInfo {
12981            id: "displayvideo.advertisers.campaigns.create",
12982            http_method: hyper::Method::POST,
12983        });
12984
12985        for &field in ["alt", "advertiserId"].iter() {
12986            if self._additional_params.contains_key(field) {
12987                dlg.finished(false);
12988                return Err(common::Error::FieldClash(field));
12989            }
12990        }
12991
12992        let mut params = Params::with_capacity(4 + self._additional_params.len());
12993        params.push("advertiserId", self._advertiser_id.to_string());
12994
12995        params.extend(self._additional_params.iter());
12996
12997        params.push("alt", "json");
12998        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/campaigns";
12999        if self._scopes.is_empty() {
13000            self._scopes
13001                .insert(Scope::DisplayVideo.as_ref().to_string());
13002        }
13003
13004        #[allow(clippy::single_element_loop)]
13005        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
13006            url = params.uri_replacement(url, param_name, find_this, true);
13007        }
13008        {
13009            let to_remove = ["advertiserId"];
13010            params.remove_params(&to_remove);
13011        }
13012
13013        let url = params.parse_with_url(&url);
13014
13015        let mut json_mime_type = mime::APPLICATION_JSON;
13016        let mut request_value_reader = {
13017            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13018            common::remove_json_null_values(&mut value);
13019            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13020            serde_json::to_writer(&mut dst, &value).unwrap();
13021            dst
13022        };
13023        let request_size = request_value_reader
13024            .seek(std::io::SeekFrom::End(0))
13025            .unwrap();
13026        request_value_reader
13027            .seek(std::io::SeekFrom::Start(0))
13028            .unwrap();
13029
13030        loop {
13031            let token = match self
13032                .hub
13033                .auth
13034                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13035                .await
13036            {
13037                Ok(token) => token,
13038                Err(e) => match dlg.token(e) {
13039                    Ok(token) => token,
13040                    Err(e) => {
13041                        dlg.finished(false);
13042                        return Err(common::Error::MissingToken(e));
13043                    }
13044                },
13045            };
13046            request_value_reader
13047                .seek(std::io::SeekFrom::Start(0))
13048                .unwrap();
13049            let mut req_result = {
13050                let client = &self.hub.client;
13051                dlg.pre_request();
13052                let mut req_builder = hyper::Request::builder()
13053                    .method(hyper::Method::POST)
13054                    .uri(url.as_str())
13055                    .header(USER_AGENT, self.hub._user_agent.clone());
13056
13057                if let Some(token) = token.as_ref() {
13058                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13059                }
13060
13061                let request = req_builder
13062                    .header(CONTENT_TYPE, json_mime_type.to_string())
13063                    .header(CONTENT_LENGTH, request_size as u64)
13064                    .body(common::to_body(
13065                        request_value_reader.get_ref().clone().into(),
13066                    ));
13067
13068                client.request(request.unwrap()).await
13069            };
13070
13071            match req_result {
13072                Err(err) => {
13073                    if let common::Retry::After(d) = dlg.http_error(&err) {
13074                        sleep(d).await;
13075                        continue;
13076                    }
13077                    dlg.finished(false);
13078                    return Err(common::Error::HttpError(err));
13079                }
13080                Ok(res) => {
13081                    let (mut parts, body) = res.into_parts();
13082                    let mut body = common::Body::new(body);
13083                    if !parts.status.is_success() {
13084                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13085                        let error = serde_json::from_str(&common::to_string(&bytes));
13086                        let response = common::to_response(parts, bytes.into());
13087
13088                        if let common::Retry::After(d) =
13089                            dlg.http_failure(&response, error.as_ref().ok())
13090                        {
13091                            sleep(d).await;
13092                            continue;
13093                        }
13094
13095                        dlg.finished(false);
13096
13097                        return Err(match error {
13098                            Ok(value) => common::Error::BadRequest(value),
13099                            _ => common::Error::Failure(response),
13100                        });
13101                    }
13102                    let response = {
13103                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13104                        let encoded = common::to_string(&bytes);
13105                        match serde_json::from_str(&encoded) {
13106                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13107                            Err(error) => {
13108                                dlg.response_json_decode_error(&encoded, &error);
13109                                return Err(common::Error::JsonDecodeError(
13110                                    encoded.to_string(),
13111                                    error,
13112                                ));
13113                            }
13114                        }
13115                    };
13116
13117                    dlg.finished(true);
13118                    return Ok(response);
13119                }
13120            }
13121        }
13122    }
13123
13124    ///
13125    /// Sets the *request* property to the given value.
13126    ///
13127    /// Even though the property as already been set when instantiating this call,
13128    /// we provide this method for API completeness.
13129    pub fn request(mut self, new_value: Campaign) -> AdvertiserCampaignCreateCall<'a, C> {
13130        self._request = new_value;
13131        self
13132    }
13133    /// Output only. The unique ID of the advertiser the campaign belongs to.
13134    ///
13135    /// Sets the *advertiser id* path property to the given value.
13136    ///
13137    /// Even though the property as already been set when instantiating this call,
13138    /// we provide this method for API completeness.
13139    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserCampaignCreateCall<'a, C> {
13140        self._advertiser_id = new_value;
13141        self
13142    }
13143    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13144    /// while executing the actual API request.
13145    ///
13146    /// ````text
13147    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13148    /// ````
13149    ///
13150    /// Sets the *delegate* property to the given value.
13151    pub fn delegate(
13152        mut self,
13153        new_value: &'a mut dyn common::Delegate,
13154    ) -> AdvertiserCampaignCreateCall<'a, C> {
13155        self._delegate = Some(new_value);
13156        self
13157    }
13158
13159    /// Set any additional parameter of the query string used in the request.
13160    /// It should be used to set parameters which are not yet available through their own
13161    /// setters.
13162    ///
13163    /// Please note that this method must not be used to set any of the known parameters
13164    /// which have their own setter method. If done anyway, the request will fail.
13165    ///
13166    /// # Additional Parameters
13167    ///
13168    /// * *$.xgafv* (query-string) - V1 error format.
13169    /// * *access_token* (query-string) - OAuth access token.
13170    /// * *alt* (query-string) - Data format for response.
13171    /// * *callback* (query-string) - JSONP
13172    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13173    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13174    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13175    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13176    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13177    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13178    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13179    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserCampaignCreateCall<'a, C>
13180    where
13181        T: AsRef<str>,
13182    {
13183        self._additional_params
13184            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13185        self
13186    }
13187
13188    /// Identifies the authorization scope for the method you are building.
13189    ///
13190    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13191    /// [`Scope::DisplayVideo`].
13192    ///
13193    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13194    /// tokens for more than one scope.
13195    ///
13196    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13197    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13198    /// sufficient, a read-write scope will do as well.
13199    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserCampaignCreateCall<'a, C>
13200    where
13201        St: AsRef<str>,
13202    {
13203        self._scopes.insert(String::from(scope.as_ref()));
13204        self
13205    }
13206    /// Identifies the authorization scope(s) for the method you are building.
13207    ///
13208    /// See [`Self::add_scope()`] for details.
13209    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserCampaignCreateCall<'a, C>
13210    where
13211        I: IntoIterator<Item = St>,
13212        St: AsRef<str>,
13213    {
13214        self._scopes
13215            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13216        self
13217    }
13218
13219    /// Removes all scopes, and no default scope will be used either.
13220    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13221    /// for details).
13222    pub fn clear_scopes(mut self) -> AdvertiserCampaignCreateCall<'a, C> {
13223        self._scopes.clear();
13224        self
13225    }
13226}
13227
13228/// Permanently deletes a campaign. A deleted campaign cannot be recovered. The campaign should be archived first, i.e. set entity_status to `ENTITY_STATUS_ARCHIVED`, to be able to delete it. **This method regularly experiences high latency.** We recommend [increasing your default timeout](https://developers.google.com/display-video/api/guides/best-practices/timeouts#client_library_timeout) to avoid errors.
13229///
13230/// A builder for the *campaigns.delete* method supported by a *advertiser* resource.
13231/// It is not used directly, but through a [`AdvertiserMethods`] instance.
13232///
13233/// # Example
13234///
13235/// Instantiate a resource method builder
13236///
13237/// ```test_harness,no_run
13238/// # extern crate hyper;
13239/// # extern crate hyper_rustls;
13240/// # extern crate google_displayvideo1 as displayvideo1;
13241/// # async fn dox() {
13242/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13243///
13244/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13245/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13246/// #     secret,
13247/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13248/// # ).build().await.unwrap();
13249///
13250/// # let client = hyper_util::client::legacy::Client::builder(
13251/// #     hyper_util::rt::TokioExecutor::new()
13252/// # )
13253/// # .build(
13254/// #     hyper_rustls::HttpsConnectorBuilder::new()
13255/// #         .with_native_roots()
13256/// #         .unwrap()
13257/// #         .https_or_http()
13258/// #         .enable_http1()
13259/// #         .build()
13260/// # );
13261/// # let mut hub = DisplayVideo::new(client, auth);
13262/// // You can configure optional parameters by calling the respective setters at will, and
13263/// // execute the final call using `doit()`.
13264/// // Values shown here are possibly random and not representative !
13265/// let result = hub.advertisers().campaigns_delete(-80, -61)
13266///              .doit().await;
13267/// # }
13268/// ```
13269pub struct AdvertiserCampaignDeleteCall<'a, C>
13270where
13271    C: 'a,
13272{
13273    hub: &'a DisplayVideo<C>,
13274    _advertiser_id: i64,
13275    _campaign_id: i64,
13276    _delegate: Option<&'a mut dyn common::Delegate>,
13277    _additional_params: HashMap<String, String>,
13278    _scopes: BTreeSet<String>,
13279}
13280
13281impl<'a, C> common::CallBuilder for AdvertiserCampaignDeleteCall<'a, C> {}
13282
13283impl<'a, C> AdvertiserCampaignDeleteCall<'a, C>
13284where
13285    C: common::Connector,
13286{
13287    /// Perform the operation you have build so far.
13288    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
13289        use std::borrow::Cow;
13290        use std::io::{Read, Seek};
13291
13292        use common::{url::Params, ToParts};
13293        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13294
13295        let mut dd = common::DefaultDelegate;
13296        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13297        dlg.begin(common::MethodInfo {
13298            id: "displayvideo.advertisers.campaigns.delete",
13299            http_method: hyper::Method::DELETE,
13300        });
13301
13302        for &field in ["alt", "advertiserId", "campaignId"].iter() {
13303            if self._additional_params.contains_key(field) {
13304                dlg.finished(false);
13305                return Err(common::Error::FieldClash(field));
13306            }
13307        }
13308
13309        let mut params = Params::with_capacity(4 + self._additional_params.len());
13310        params.push("advertiserId", self._advertiser_id.to_string());
13311        params.push("campaignId", self._campaign_id.to_string());
13312
13313        params.extend(self._additional_params.iter());
13314
13315        params.push("alt", "json");
13316        let mut url =
13317            self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/campaigns/{+campaignId}";
13318        if self._scopes.is_empty() {
13319            self._scopes
13320                .insert(Scope::DisplayVideo.as_ref().to_string());
13321        }
13322
13323        #[allow(clippy::single_element_loop)]
13324        for &(find_this, param_name) in [
13325            ("{+advertiserId}", "advertiserId"),
13326            ("{+campaignId}", "campaignId"),
13327        ]
13328        .iter()
13329        {
13330            url = params.uri_replacement(url, param_name, find_this, true);
13331        }
13332        {
13333            let to_remove = ["campaignId", "advertiserId"];
13334            params.remove_params(&to_remove);
13335        }
13336
13337        let url = params.parse_with_url(&url);
13338
13339        loop {
13340            let token = match self
13341                .hub
13342                .auth
13343                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13344                .await
13345            {
13346                Ok(token) => token,
13347                Err(e) => match dlg.token(e) {
13348                    Ok(token) => token,
13349                    Err(e) => {
13350                        dlg.finished(false);
13351                        return Err(common::Error::MissingToken(e));
13352                    }
13353                },
13354            };
13355            let mut req_result = {
13356                let client = &self.hub.client;
13357                dlg.pre_request();
13358                let mut req_builder = hyper::Request::builder()
13359                    .method(hyper::Method::DELETE)
13360                    .uri(url.as_str())
13361                    .header(USER_AGENT, self.hub._user_agent.clone());
13362
13363                if let Some(token) = token.as_ref() {
13364                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13365                }
13366
13367                let request = req_builder
13368                    .header(CONTENT_LENGTH, 0_u64)
13369                    .body(common::to_body::<String>(None));
13370
13371                client.request(request.unwrap()).await
13372            };
13373
13374            match req_result {
13375                Err(err) => {
13376                    if let common::Retry::After(d) = dlg.http_error(&err) {
13377                        sleep(d).await;
13378                        continue;
13379                    }
13380                    dlg.finished(false);
13381                    return Err(common::Error::HttpError(err));
13382                }
13383                Ok(res) => {
13384                    let (mut parts, body) = res.into_parts();
13385                    let mut body = common::Body::new(body);
13386                    if !parts.status.is_success() {
13387                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13388                        let error = serde_json::from_str(&common::to_string(&bytes));
13389                        let response = common::to_response(parts, bytes.into());
13390
13391                        if let common::Retry::After(d) =
13392                            dlg.http_failure(&response, error.as_ref().ok())
13393                        {
13394                            sleep(d).await;
13395                            continue;
13396                        }
13397
13398                        dlg.finished(false);
13399
13400                        return Err(match error {
13401                            Ok(value) => common::Error::BadRequest(value),
13402                            _ => common::Error::Failure(response),
13403                        });
13404                    }
13405                    let response = {
13406                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13407                        let encoded = common::to_string(&bytes);
13408                        match serde_json::from_str(&encoded) {
13409                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13410                            Err(error) => {
13411                                dlg.response_json_decode_error(&encoded, &error);
13412                                return Err(common::Error::JsonDecodeError(
13413                                    encoded.to_string(),
13414                                    error,
13415                                ));
13416                            }
13417                        }
13418                    };
13419
13420                    dlg.finished(true);
13421                    return Ok(response);
13422                }
13423            }
13424        }
13425    }
13426
13427    /// The ID of the advertiser this campaign belongs to.
13428    ///
13429    /// Sets the *advertiser id* path property to the given value.
13430    ///
13431    /// Even though the property as already been set when instantiating this call,
13432    /// we provide this method for API completeness.
13433    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserCampaignDeleteCall<'a, C> {
13434        self._advertiser_id = new_value;
13435        self
13436    }
13437    /// The ID of the campaign we need to delete.
13438    ///
13439    /// Sets the *campaign id* path property to the given value.
13440    ///
13441    /// Even though the property as already been set when instantiating this call,
13442    /// we provide this method for API completeness.
13443    pub fn campaign_id(mut self, new_value: i64) -> AdvertiserCampaignDeleteCall<'a, C> {
13444        self._campaign_id = new_value;
13445        self
13446    }
13447    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13448    /// while executing the actual API request.
13449    ///
13450    /// ````text
13451    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13452    /// ````
13453    ///
13454    /// Sets the *delegate* property to the given value.
13455    pub fn delegate(
13456        mut self,
13457        new_value: &'a mut dyn common::Delegate,
13458    ) -> AdvertiserCampaignDeleteCall<'a, C> {
13459        self._delegate = Some(new_value);
13460        self
13461    }
13462
13463    /// Set any additional parameter of the query string used in the request.
13464    /// It should be used to set parameters which are not yet available through their own
13465    /// setters.
13466    ///
13467    /// Please note that this method must not be used to set any of the known parameters
13468    /// which have their own setter method. If done anyway, the request will fail.
13469    ///
13470    /// # Additional Parameters
13471    ///
13472    /// * *$.xgafv* (query-string) - V1 error format.
13473    /// * *access_token* (query-string) - OAuth access token.
13474    /// * *alt* (query-string) - Data format for response.
13475    /// * *callback* (query-string) - JSONP
13476    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13477    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13478    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13479    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13480    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13481    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13482    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13483    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserCampaignDeleteCall<'a, C>
13484    where
13485        T: AsRef<str>,
13486    {
13487        self._additional_params
13488            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13489        self
13490    }
13491
13492    /// Identifies the authorization scope for the method you are building.
13493    ///
13494    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13495    /// [`Scope::DisplayVideo`].
13496    ///
13497    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13498    /// tokens for more than one scope.
13499    ///
13500    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13501    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13502    /// sufficient, a read-write scope will do as well.
13503    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserCampaignDeleteCall<'a, C>
13504    where
13505        St: AsRef<str>,
13506    {
13507        self._scopes.insert(String::from(scope.as_ref()));
13508        self
13509    }
13510    /// Identifies the authorization scope(s) for the method you are building.
13511    ///
13512    /// See [`Self::add_scope()`] for details.
13513    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserCampaignDeleteCall<'a, C>
13514    where
13515        I: IntoIterator<Item = St>,
13516        St: AsRef<str>,
13517    {
13518        self._scopes
13519            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13520        self
13521    }
13522
13523    /// Removes all scopes, and no default scope will be used either.
13524    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13525    /// for details).
13526    pub fn clear_scopes(mut self) -> AdvertiserCampaignDeleteCall<'a, C> {
13527        self._scopes.clear();
13528        self
13529    }
13530}
13531
13532/// Gets a campaign.
13533///
13534/// A builder for the *campaigns.get* method supported by a *advertiser* resource.
13535/// It is not used directly, but through a [`AdvertiserMethods`] instance.
13536///
13537/// # Example
13538///
13539/// Instantiate a resource method builder
13540///
13541/// ```test_harness,no_run
13542/// # extern crate hyper;
13543/// # extern crate hyper_rustls;
13544/// # extern crate google_displayvideo1 as displayvideo1;
13545/// # async fn dox() {
13546/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13547///
13548/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13549/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13550/// #     secret,
13551/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13552/// # ).build().await.unwrap();
13553///
13554/// # let client = hyper_util::client::legacy::Client::builder(
13555/// #     hyper_util::rt::TokioExecutor::new()
13556/// # )
13557/// # .build(
13558/// #     hyper_rustls::HttpsConnectorBuilder::new()
13559/// #         .with_native_roots()
13560/// #         .unwrap()
13561/// #         .https_or_http()
13562/// #         .enable_http1()
13563/// #         .build()
13564/// # );
13565/// # let mut hub = DisplayVideo::new(client, auth);
13566/// // You can configure optional parameters by calling the respective setters at will, and
13567/// // execute the final call using `doit()`.
13568/// // Values shown here are possibly random and not representative !
13569/// let result = hub.advertisers().campaigns_get(-15, -13)
13570///              .doit().await;
13571/// # }
13572/// ```
13573pub struct AdvertiserCampaignGetCall<'a, C>
13574where
13575    C: 'a,
13576{
13577    hub: &'a DisplayVideo<C>,
13578    _advertiser_id: i64,
13579    _campaign_id: i64,
13580    _delegate: Option<&'a mut dyn common::Delegate>,
13581    _additional_params: HashMap<String, String>,
13582    _scopes: BTreeSet<String>,
13583}
13584
13585impl<'a, C> common::CallBuilder for AdvertiserCampaignGetCall<'a, C> {}
13586
13587impl<'a, C> AdvertiserCampaignGetCall<'a, C>
13588where
13589    C: common::Connector,
13590{
13591    /// Perform the operation you have build so far.
13592    pub async fn doit(mut self) -> common::Result<(common::Response, Campaign)> {
13593        use std::borrow::Cow;
13594        use std::io::{Read, Seek};
13595
13596        use common::{url::Params, ToParts};
13597        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13598
13599        let mut dd = common::DefaultDelegate;
13600        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13601        dlg.begin(common::MethodInfo {
13602            id: "displayvideo.advertisers.campaigns.get",
13603            http_method: hyper::Method::GET,
13604        });
13605
13606        for &field in ["alt", "advertiserId", "campaignId"].iter() {
13607            if self._additional_params.contains_key(field) {
13608                dlg.finished(false);
13609                return Err(common::Error::FieldClash(field));
13610            }
13611        }
13612
13613        let mut params = Params::with_capacity(4 + self._additional_params.len());
13614        params.push("advertiserId", self._advertiser_id.to_string());
13615        params.push("campaignId", self._campaign_id.to_string());
13616
13617        params.extend(self._additional_params.iter());
13618
13619        params.push("alt", "json");
13620        let mut url =
13621            self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/campaigns/{+campaignId}";
13622        if self._scopes.is_empty() {
13623            self._scopes
13624                .insert(Scope::DisplayVideo.as_ref().to_string());
13625        }
13626
13627        #[allow(clippy::single_element_loop)]
13628        for &(find_this, param_name) in [
13629            ("{+advertiserId}", "advertiserId"),
13630            ("{+campaignId}", "campaignId"),
13631        ]
13632        .iter()
13633        {
13634            url = params.uri_replacement(url, param_name, find_this, true);
13635        }
13636        {
13637            let to_remove = ["campaignId", "advertiserId"];
13638            params.remove_params(&to_remove);
13639        }
13640
13641        let url = params.parse_with_url(&url);
13642
13643        loop {
13644            let token = match self
13645                .hub
13646                .auth
13647                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13648                .await
13649            {
13650                Ok(token) => token,
13651                Err(e) => match dlg.token(e) {
13652                    Ok(token) => token,
13653                    Err(e) => {
13654                        dlg.finished(false);
13655                        return Err(common::Error::MissingToken(e));
13656                    }
13657                },
13658            };
13659            let mut req_result = {
13660                let client = &self.hub.client;
13661                dlg.pre_request();
13662                let mut req_builder = hyper::Request::builder()
13663                    .method(hyper::Method::GET)
13664                    .uri(url.as_str())
13665                    .header(USER_AGENT, self.hub._user_agent.clone());
13666
13667                if let Some(token) = token.as_ref() {
13668                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13669                }
13670
13671                let request = req_builder
13672                    .header(CONTENT_LENGTH, 0_u64)
13673                    .body(common::to_body::<String>(None));
13674
13675                client.request(request.unwrap()).await
13676            };
13677
13678            match req_result {
13679                Err(err) => {
13680                    if let common::Retry::After(d) = dlg.http_error(&err) {
13681                        sleep(d).await;
13682                        continue;
13683                    }
13684                    dlg.finished(false);
13685                    return Err(common::Error::HttpError(err));
13686                }
13687                Ok(res) => {
13688                    let (mut parts, body) = res.into_parts();
13689                    let mut body = common::Body::new(body);
13690                    if !parts.status.is_success() {
13691                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13692                        let error = serde_json::from_str(&common::to_string(&bytes));
13693                        let response = common::to_response(parts, bytes.into());
13694
13695                        if let common::Retry::After(d) =
13696                            dlg.http_failure(&response, error.as_ref().ok())
13697                        {
13698                            sleep(d).await;
13699                            continue;
13700                        }
13701
13702                        dlg.finished(false);
13703
13704                        return Err(match error {
13705                            Ok(value) => common::Error::BadRequest(value),
13706                            _ => common::Error::Failure(response),
13707                        });
13708                    }
13709                    let response = {
13710                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13711                        let encoded = common::to_string(&bytes);
13712                        match serde_json::from_str(&encoded) {
13713                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13714                            Err(error) => {
13715                                dlg.response_json_decode_error(&encoded, &error);
13716                                return Err(common::Error::JsonDecodeError(
13717                                    encoded.to_string(),
13718                                    error,
13719                                ));
13720                            }
13721                        }
13722                    };
13723
13724                    dlg.finished(true);
13725                    return Ok(response);
13726                }
13727            }
13728        }
13729    }
13730
13731    /// Required. The ID of the advertiser this campaign belongs to.
13732    ///
13733    /// Sets the *advertiser id* path property to the given value.
13734    ///
13735    /// Even though the property as already been set when instantiating this call,
13736    /// we provide this method for API completeness.
13737    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserCampaignGetCall<'a, C> {
13738        self._advertiser_id = new_value;
13739        self
13740    }
13741    /// Required. The ID of the campaign to fetch.
13742    ///
13743    /// Sets the *campaign id* path property to the given value.
13744    ///
13745    /// Even though the property as already been set when instantiating this call,
13746    /// we provide this method for API completeness.
13747    pub fn campaign_id(mut self, new_value: i64) -> AdvertiserCampaignGetCall<'a, C> {
13748        self._campaign_id = new_value;
13749        self
13750    }
13751    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13752    /// while executing the actual API request.
13753    ///
13754    /// ````text
13755    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13756    /// ````
13757    ///
13758    /// Sets the *delegate* property to the given value.
13759    pub fn delegate(
13760        mut self,
13761        new_value: &'a mut dyn common::Delegate,
13762    ) -> AdvertiserCampaignGetCall<'a, C> {
13763        self._delegate = Some(new_value);
13764        self
13765    }
13766
13767    /// Set any additional parameter of the query string used in the request.
13768    /// It should be used to set parameters which are not yet available through their own
13769    /// setters.
13770    ///
13771    /// Please note that this method must not be used to set any of the known parameters
13772    /// which have their own setter method. If done anyway, the request will fail.
13773    ///
13774    /// # Additional Parameters
13775    ///
13776    /// * *$.xgafv* (query-string) - V1 error format.
13777    /// * *access_token* (query-string) - OAuth access token.
13778    /// * *alt* (query-string) - Data format for response.
13779    /// * *callback* (query-string) - JSONP
13780    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13781    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13782    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13783    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13784    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13785    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13786    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13787    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserCampaignGetCall<'a, C>
13788    where
13789        T: AsRef<str>,
13790    {
13791        self._additional_params
13792            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13793        self
13794    }
13795
13796    /// Identifies the authorization scope for the method you are building.
13797    ///
13798    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13799    /// [`Scope::DisplayVideo`].
13800    ///
13801    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13802    /// tokens for more than one scope.
13803    ///
13804    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13805    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13806    /// sufficient, a read-write scope will do as well.
13807    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserCampaignGetCall<'a, C>
13808    where
13809        St: AsRef<str>,
13810    {
13811        self._scopes.insert(String::from(scope.as_ref()));
13812        self
13813    }
13814    /// Identifies the authorization scope(s) for the method you are building.
13815    ///
13816    /// See [`Self::add_scope()`] for details.
13817    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserCampaignGetCall<'a, C>
13818    where
13819        I: IntoIterator<Item = St>,
13820        St: AsRef<str>,
13821    {
13822        self._scopes
13823            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13824        self
13825    }
13826
13827    /// Removes all scopes, and no default scope will be used either.
13828    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13829    /// for details).
13830    pub fn clear_scopes(mut self) -> AdvertiserCampaignGetCall<'a, C> {
13831        self._scopes.clear();
13832        self
13833    }
13834}
13835
13836/// Lists campaigns in an advertiser. The order is defined by the order_by parameter. If a filter by entity_status is not specified, campaigns with `ENTITY_STATUS_ARCHIVED` will not be included in the results.
13837///
13838/// A builder for the *campaigns.list* method supported by a *advertiser* resource.
13839/// It is not used directly, but through a [`AdvertiserMethods`] instance.
13840///
13841/// # Example
13842///
13843/// Instantiate a resource method builder
13844///
13845/// ```test_harness,no_run
13846/// # extern crate hyper;
13847/// # extern crate hyper_rustls;
13848/// # extern crate google_displayvideo1 as displayvideo1;
13849/// # async fn dox() {
13850/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13851///
13852/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13853/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13854/// #     secret,
13855/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13856/// # ).build().await.unwrap();
13857///
13858/// # let client = hyper_util::client::legacy::Client::builder(
13859/// #     hyper_util::rt::TokioExecutor::new()
13860/// # )
13861/// # .build(
13862/// #     hyper_rustls::HttpsConnectorBuilder::new()
13863/// #         .with_native_roots()
13864/// #         .unwrap()
13865/// #         .https_or_http()
13866/// #         .enable_http1()
13867/// #         .build()
13868/// # );
13869/// # let mut hub = DisplayVideo::new(client, auth);
13870/// // You can configure optional parameters by calling the respective setters at will, and
13871/// // execute the final call using `doit()`.
13872/// // Values shown here are possibly random and not representative !
13873/// let result = hub.advertisers().campaigns_list(-24)
13874///              .page_token("sed")
13875///              .page_size(-24)
13876///              .order_by("et")
13877///              .filter("vero")
13878///              .doit().await;
13879/// # }
13880/// ```
13881pub struct AdvertiserCampaignListCall<'a, C>
13882where
13883    C: 'a,
13884{
13885    hub: &'a DisplayVideo<C>,
13886    _advertiser_id: i64,
13887    _page_token: Option<String>,
13888    _page_size: Option<i32>,
13889    _order_by: Option<String>,
13890    _filter: Option<String>,
13891    _delegate: Option<&'a mut dyn common::Delegate>,
13892    _additional_params: HashMap<String, String>,
13893    _scopes: BTreeSet<String>,
13894}
13895
13896impl<'a, C> common::CallBuilder for AdvertiserCampaignListCall<'a, C> {}
13897
13898impl<'a, C> AdvertiserCampaignListCall<'a, C>
13899where
13900    C: common::Connector,
13901{
13902    /// Perform the operation you have build so far.
13903    pub async fn doit(mut self) -> common::Result<(common::Response, ListCampaignsResponse)> {
13904        use std::borrow::Cow;
13905        use std::io::{Read, Seek};
13906
13907        use common::{url::Params, ToParts};
13908        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13909
13910        let mut dd = common::DefaultDelegate;
13911        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13912        dlg.begin(common::MethodInfo {
13913            id: "displayvideo.advertisers.campaigns.list",
13914            http_method: hyper::Method::GET,
13915        });
13916
13917        for &field in [
13918            "alt",
13919            "advertiserId",
13920            "pageToken",
13921            "pageSize",
13922            "orderBy",
13923            "filter",
13924        ]
13925        .iter()
13926        {
13927            if self._additional_params.contains_key(field) {
13928                dlg.finished(false);
13929                return Err(common::Error::FieldClash(field));
13930            }
13931        }
13932
13933        let mut params = Params::with_capacity(7 + self._additional_params.len());
13934        params.push("advertiserId", self._advertiser_id.to_string());
13935        if let Some(value) = self._page_token.as_ref() {
13936            params.push("pageToken", value);
13937        }
13938        if let Some(value) = self._page_size.as_ref() {
13939            params.push("pageSize", value.to_string());
13940        }
13941        if let Some(value) = self._order_by.as_ref() {
13942            params.push("orderBy", value);
13943        }
13944        if let Some(value) = self._filter.as_ref() {
13945            params.push("filter", value);
13946        }
13947
13948        params.extend(self._additional_params.iter());
13949
13950        params.push("alt", "json");
13951        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/campaigns";
13952        if self._scopes.is_empty() {
13953            self._scopes
13954                .insert(Scope::DisplayVideo.as_ref().to_string());
13955        }
13956
13957        #[allow(clippy::single_element_loop)]
13958        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
13959            url = params.uri_replacement(url, param_name, find_this, true);
13960        }
13961        {
13962            let to_remove = ["advertiserId"];
13963            params.remove_params(&to_remove);
13964        }
13965
13966        let url = params.parse_with_url(&url);
13967
13968        loop {
13969            let token = match self
13970                .hub
13971                .auth
13972                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13973                .await
13974            {
13975                Ok(token) => token,
13976                Err(e) => match dlg.token(e) {
13977                    Ok(token) => token,
13978                    Err(e) => {
13979                        dlg.finished(false);
13980                        return Err(common::Error::MissingToken(e));
13981                    }
13982                },
13983            };
13984            let mut req_result = {
13985                let client = &self.hub.client;
13986                dlg.pre_request();
13987                let mut req_builder = hyper::Request::builder()
13988                    .method(hyper::Method::GET)
13989                    .uri(url.as_str())
13990                    .header(USER_AGENT, self.hub._user_agent.clone());
13991
13992                if let Some(token) = token.as_ref() {
13993                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13994                }
13995
13996                let request = req_builder
13997                    .header(CONTENT_LENGTH, 0_u64)
13998                    .body(common::to_body::<String>(None));
13999
14000                client.request(request.unwrap()).await
14001            };
14002
14003            match req_result {
14004                Err(err) => {
14005                    if let common::Retry::After(d) = dlg.http_error(&err) {
14006                        sleep(d).await;
14007                        continue;
14008                    }
14009                    dlg.finished(false);
14010                    return Err(common::Error::HttpError(err));
14011                }
14012                Ok(res) => {
14013                    let (mut parts, body) = res.into_parts();
14014                    let mut body = common::Body::new(body);
14015                    if !parts.status.is_success() {
14016                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14017                        let error = serde_json::from_str(&common::to_string(&bytes));
14018                        let response = common::to_response(parts, bytes.into());
14019
14020                        if let common::Retry::After(d) =
14021                            dlg.http_failure(&response, error.as_ref().ok())
14022                        {
14023                            sleep(d).await;
14024                            continue;
14025                        }
14026
14027                        dlg.finished(false);
14028
14029                        return Err(match error {
14030                            Ok(value) => common::Error::BadRequest(value),
14031                            _ => common::Error::Failure(response),
14032                        });
14033                    }
14034                    let response = {
14035                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14036                        let encoded = common::to_string(&bytes);
14037                        match serde_json::from_str(&encoded) {
14038                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14039                            Err(error) => {
14040                                dlg.response_json_decode_error(&encoded, &error);
14041                                return Err(common::Error::JsonDecodeError(
14042                                    encoded.to_string(),
14043                                    error,
14044                                ));
14045                            }
14046                        }
14047                    };
14048
14049                    dlg.finished(true);
14050                    return Ok(response);
14051                }
14052            }
14053        }
14054    }
14055
14056    /// The ID of the advertiser to list campaigns for.
14057    ///
14058    /// Sets the *advertiser id* path property to the given value.
14059    ///
14060    /// Even though the property as already been set when instantiating this call,
14061    /// we provide this method for API completeness.
14062    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserCampaignListCall<'a, C> {
14063        self._advertiser_id = new_value;
14064        self
14065    }
14066    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListCampaigns` method. If not specified, the first page of results will be returned.
14067    ///
14068    /// Sets the *page token* query property to the given value.
14069    pub fn page_token(mut self, new_value: &str) -> AdvertiserCampaignListCall<'a, C> {
14070        self._page_token = Some(new_value.to_string());
14071        self
14072    }
14073    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`.
14074    ///
14075    /// Sets the *page size* query property to the given value.
14076    pub fn page_size(mut self, new_value: i32) -> AdvertiserCampaignListCall<'a, C> {
14077        self._page_size = Some(new_value);
14078        self
14079    }
14080    /// Field by which to sort the list. Acceptable values are: * `displayName` (default) * `entityStatus` * `updateTime` The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `displayName desc`.
14081    ///
14082    /// Sets the *order by* query property to the given value.
14083    pub fn order_by(mut self, new_value: &str) -> AdvertiserCampaignListCall<'a, C> {
14084        self._order_by = Some(new_value.to_string());
14085        self
14086    }
14087    /// Allows filtering by campaign fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by `AND` or `OR` logical operators. A sequence of restrictions implicitly uses `AND`. * A restriction has the form of `{field} {operator} {value}`. * The `updateTime` field must use the `GREATER THAN OR EQUAL TO (>=)` or `LESS THAN OR EQUAL TO (<=)` operators. * All other fields must use the `EQUALS (=)` operator. Supported fields: * `campaignId` * `displayName` * `entityStatus` * `updateTime` (input in ISO 8601 format, or `YYYY-MM-DDTHH:MM:SSZ`) Examples: * All `ENTITY_STATUS_ACTIVE` or `ENTITY_STATUS_PAUSED` campaigns under an advertiser: `(entityStatus="ENTITY_STATUS_ACTIVE" OR entityStatus="ENTITY_STATUS_PAUSED")` * All campaigns with an update time less than or equal to 2020-11-04T18:54:47Z (format of ISO 8601): `updateTime<="2020-11-04T18:54:47Z"` * All campaigns with an update time greater than or equal to 2020-11-04T18:54:47Z (format of ISO 8601): `updateTime>="2020-11-04T18:54:47Z"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
14088    ///
14089    /// Sets the *filter* query property to the given value.
14090    pub fn filter(mut self, new_value: &str) -> AdvertiserCampaignListCall<'a, C> {
14091        self._filter = Some(new_value.to_string());
14092        self
14093    }
14094    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14095    /// while executing the actual API request.
14096    ///
14097    /// ````text
14098    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14099    /// ````
14100    ///
14101    /// Sets the *delegate* property to the given value.
14102    pub fn delegate(
14103        mut self,
14104        new_value: &'a mut dyn common::Delegate,
14105    ) -> AdvertiserCampaignListCall<'a, C> {
14106        self._delegate = Some(new_value);
14107        self
14108    }
14109
14110    /// Set any additional parameter of the query string used in the request.
14111    /// It should be used to set parameters which are not yet available through their own
14112    /// setters.
14113    ///
14114    /// Please note that this method must not be used to set any of the known parameters
14115    /// which have their own setter method. If done anyway, the request will fail.
14116    ///
14117    /// # Additional Parameters
14118    ///
14119    /// * *$.xgafv* (query-string) - V1 error format.
14120    /// * *access_token* (query-string) - OAuth access token.
14121    /// * *alt* (query-string) - Data format for response.
14122    /// * *callback* (query-string) - JSONP
14123    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14124    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14125    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14126    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14127    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14128    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14129    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14130    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserCampaignListCall<'a, C>
14131    where
14132        T: AsRef<str>,
14133    {
14134        self._additional_params
14135            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14136        self
14137    }
14138
14139    /// Identifies the authorization scope for the method you are building.
14140    ///
14141    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14142    /// [`Scope::DisplayVideo`].
14143    ///
14144    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14145    /// tokens for more than one scope.
14146    ///
14147    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14148    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14149    /// sufficient, a read-write scope will do as well.
14150    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserCampaignListCall<'a, C>
14151    where
14152        St: AsRef<str>,
14153    {
14154        self._scopes.insert(String::from(scope.as_ref()));
14155        self
14156    }
14157    /// Identifies the authorization scope(s) for the method you are building.
14158    ///
14159    /// See [`Self::add_scope()`] for details.
14160    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserCampaignListCall<'a, C>
14161    where
14162        I: IntoIterator<Item = St>,
14163        St: AsRef<str>,
14164    {
14165        self._scopes
14166            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14167        self
14168    }
14169
14170    /// Removes all scopes, and no default scope will be used either.
14171    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14172    /// for details).
14173    pub fn clear_scopes(mut self) -> AdvertiserCampaignListCall<'a, C> {
14174        self._scopes.clear();
14175        self
14176    }
14177}
14178
14179/// Updates an existing campaign. Returns the updated campaign if successful.
14180///
14181/// A builder for the *campaigns.patch* method supported by a *advertiser* resource.
14182/// It is not used directly, but through a [`AdvertiserMethods`] instance.
14183///
14184/// # Example
14185///
14186/// Instantiate a resource method builder
14187///
14188/// ```test_harness,no_run
14189/// # extern crate hyper;
14190/// # extern crate hyper_rustls;
14191/// # extern crate google_displayvideo1 as displayvideo1;
14192/// use displayvideo1::api::Campaign;
14193/// # async fn dox() {
14194/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14195///
14196/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14197/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14198/// #     secret,
14199/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14200/// # ).build().await.unwrap();
14201///
14202/// # let client = hyper_util::client::legacy::Client::builder(
14203/// #     hyper_util::rt::TokioExecutor::new()
14204/// # )
14205/// # .build(
14206/// #     hyper_rustls::HttpsConnectorBuilder::new()
14207/// #         .with_native_roots()
14208/// #         .unwrap()
14209/// #         .https_or_http()
14210/// #         .enable_http1()
14211/// #         .build()
14212/// # );
14213/// # let mut hub = DisplayVideo::new(client, auth);
14214/// // As the method needs a request, you would usually fill it with the desired information
14215/// // into the respective structure. Some of the parts shown here might not be applicable !
14216/// // Values shown here are possibly random and not representative !
14217/// let mut req = Campaign::default();
14218///
14219/// // You can configure optional parameters by calling the respective setters at will, and
14220/// // execute the final call using `doit()`.
14221/// // Values shown here are possibly random and not representative !
14222/// let result = hub.advertisers().campaigns_patch(req, -31, -93)
14223///              .update_mask(FieldMask::new::<&str>(&[]))
14224///              .doit().await;
14225/// # }
14226/// ```
14227pub struct AdvertiserCampaignPatchCall<'a, C>
14228where
14229    C: 'a,
14230{
14231    hub: &'a DisplayVideo<C>,
14232    _request: Campaign,
14233    _advertiser_id: i64,
14234    _campaign_id: i64,
14235    _update_mask: Option<common::FieldMask>,
14236    _delegate: Option<&'a mut dyn common::Delegate>,
14237    _additional_params: HashMap<String, String>,
14238    _scopes: BTreeSet<String>,
14239}
14240
14241impl<'a, C> common::CallBuilder for AdvertiserCampaignPatchCall<'a, C> {}
14242
14243impl<'a, C> AdvertiserCampaignPatchCall<'a, C>
14244where
14245    C: common::Connector,
14246{
14247    /// Perform the operation you have build so far.
14248    pub async fn doit(mut self) -> common::Result<(common::Response, Campaign)> {
14249        use std::borrow::Cow;
14250        use std::io::{Read, Seek};
14251
14252        use common::{url::Params, ToParts};
14253        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14254
14255        let mut dd = common::DefaultDelegate;
14256        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14257        dlg.begin(common::MethodInfo {
14258            id: "displayvideo.advertisers.campaigns.patch",
14259            http_method: hyper::Method::PATCH,
14260        });
14261
14262        for &field in ["alt", "advertiserId", "campaignId", "updateMask"].iter() {
14263            if self._additional_params.contains_key(field) {
14264                dlg.finished(false);
14265                return Err(common::Error::FieldClash(field));
14266            }
14267        }
14268
14269        let mut params = Params::with_capacity(6 + self._additional_params.len());
14270        params.push("advertiserId", self._advertiser_id.to_string());
14271        params.push("campaignId", self._campaign_id.to_string());
14272        if let Some(value) = self._update_mask.as_ref() {
14273            params.push("updateMask", value.to_string());
14274        }
14275
14276        params.extend(self._additional_params.iter());
14277
14278        params.push("alt", "json");
14279        let mut url =
14280            self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/campaigns/{+campaignId}";
14281        if self._scopes.is_empty() {
14282            self._scopes
14283                .insert(Scope::DisplayVideo.as_ref().to_string());
14284        }
14285
14286        #[allow(clippy::single_element_loop)]
14287        for &(find_this, param_name) in [
14288            ("{+advertiserId}", "advertiserId"),
14289            ("{+campaignId}", "campaignId"),
14290        ]
14291        .iter()
14292        {
14293            url = params.uri_replacement(url, param_name, find_this, true);
14294        }
14295        {
14296            let to_remove = ["campaignId", "advertiserId"];
14297            params.remove_params(&to_remove);
14298        }
14299
14300        let url = params.parse_with_url(&url);
14301
14302        let mut json_mime_type = mime::APPLICATION_JSON;
14303        let mut request_value_reader = {
14304            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14305            common::remove_json_null_values(&mut value);
14306            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14307            serde_json::to_writer(&mut dst, &value).unwrap();
14308            dst
14309        };
14310        let request_size = request_value_reader
14311            .seek(std::io::SeekFrom::End(0))
14312            .unwrap();
14313        request_value_reader
14314            .seek(std::io::SeekFrom::Start(0))
14315            .unwrap();
14316
14317        loop {
14318            let token = match self
14319                .hub
14320                .auth
14321                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14322                .await
14323            {
14324                Ok(token) => token,
14325                Err(e) => match dlg.token(e) {
14326                    Ok(token) => token,
14327                    Err(e) => {
14328                        dlg.finished(false);
14329                        return Err(common::Error::MissingToken(e));
14330                    }
14331                },
14332            };
14333            request_value_reader
14334                .seek(std::io::SeekFrom::Start(0))
14335                .unwrap();
14336            let mut req_result = {
14337                let client = &self.hub.client;
14338                dlg.pre_request();
14339                let mut req_builder = hyper::Request::builder()
14340                    .method(hyper::Method::PATCH)
14341                    .uri(url.as_str())
14342                    .header(USER_AGENT, self.hub._user_agent.clone());
14343
14344                if let Some(token) = token.as_ref() {
14345                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14346                }
14347
14348                let request = req_builder
14349                    .header(CONTENT_TYPE, json_mime_type.to_string())
14350                    .header(CONTENT_LENGTH, request_size as u64)
14351                    .body(common::to_body(
14352                        request_value_reader.get_ref().clone().into(),
14353                    ));
14354
14355                client.request(request.unwrap()).await
14356            };
14357
14358            match req_result {
14359                Err(err) => {
14360                    if let common::Retry::After(d) = dlg.http_error(&err) {
14361                        sleep(d).await;
14362                        continue;
14363                    }
14364                    dlg.finished(false);
14365                    return Err(common::Error::HttpError(err));
14366                }
14367                Ok(res) => {
14368                    let (mut parts, body) = res.into_parts();
14369                    let mut body = common::Body::new(body);
14370                    if !parts.status.is_success() {
14371                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14372                        let error = serde_json::from_str(&common::to_string(&bytes));
14373                        let response = common::to_response(parts, bytes.into());
14374
14375                        if let common::Retry::After(d) =
14376                            dlg.http_failure(&response, error.as_ref().ok())
14377                        {
14378                            sleep(d).await;
14379                            continue;
14380                        }
14381
14382                        dlg.finished(false);
14383
14384                        return Err(match error {
14385                            Ok(value) => common::Error::BadRequest(value),
14386                            _ => common::Error::Failure(response),
14387                        });
14388                    }
14389                    let response = {
14390                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14391                        let encoded = common::to_string(&bytes);
14392                        match serde_json::from_str(&encoded) {
14393                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14394                            Err(error) => {
14395                                dlg.response_json_decode_error(&encoded, &error);
14396                                return Err(common::Error::JsonDecodeError(
14397                                    encoded.to_string(),
14398                                    error,
14399                                ));
14400                            }
14401                        }
14402                    };
14403
14404                    dlg.finished(true);
14405                    return Ok(response);
14406                }
14407            }
14408        }
14409    }
14410
14411    ///
14412    /// Sets the *request* property to the given value.
14413    ///
14414    /// Even though the property as already been set when instantiating this call,
14415    /// we provide this method for API completeness.
14416    pub fn request(mut self, new_value: Campaign) -> AdvertiserCampaignPatchCall<'a, C> {
14417        self._request = new_value;
14418        self
14419    }
14420    /// Output only. The unique ID of the advertiser the campaign belongs to.
14421    ///
14422    /// Sets the *advertiser id* path property to the given value.
14423    ///
14424    /// Even though the property as already been set when instantiating this call,
14425    /// we provide this method for API completeness.
14426    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserCampaignPatchCall<'a, C> {
14427        self._advertiser_id = new_value;
14428        self
14429    }
14430    /// Output only. The unique ID of the campaign. Assigned by the system.
14431    ///
14432    /// Sets the *campaign id* path property to the given value.
14433    ///
14434    /// Even though the property as already been set when instantiating this call,
14435    /// we provide this method for API completeness.
14436    pub fn campaign_id(mut self, new_value: i64) -> AdvertiserCampaignPatchCall<'a, C> {
14437        self._campaign_id = new_value;
14438        self
14439    }
14440    /// Required. The mask to control which fields to update.
14441    ///
14442    /// Sets the *update mask* query property to the given value.
14443    pub fn update_mask(
14444        mut self,
14445        new_value: common::FieldMask,
14446    ) -> AdvertiserCampaignPatchCall<'a, C> {
14447        self._update_mask = Some(new_value);
14448        self
14449    }
14450    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14451    /// while executing the actual API request.
14452    ///
14453    /// ````text
14454    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14455    /// ````
14456    ///
14457    /// Sets the *delegate* property to the given value.
14458    pub fn delegate(
14459        mut self,
14460        new_value: &'a mut dyn common::Delegate,
14461    ) -> AdvertiserCampaignPatchCall<'a, C> {
14462        self._delegate = Some(new_value);
14463        self
14464    }
14465
14466    /// Set any additional parameter of the query string used in the request.
14467    /// It should be used to set parameters which are not yet available through their own
14468    /// setters.
14469    ///
14470    /// Please note that this method must not be used to set any of the known parameters
14471    /// which have their own setter method. If done anyway, the request will fail.
14472    ///
14473    /// # Additional Parameters
14474    ///
14475    /// * *$.xgafv* (query-string) - V1 error format.
14476    /// * *access_token* (query-string) - OAuth access token.
14477    /// * *alt* (query-string) - Data format for response.
14478    /// * *callback* (query-string) - JSONP
14479    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14480    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14481    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14482    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14483    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14484    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14485    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14486    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserCampaignPatchCall<'a, C>
14487    where
14488        T: AsRef<str>,
14489    {
14490        self._additional_params
14491            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14492        self
14493    }
14494
14495    /// Identifies the authorization scope for the method you are building.
14496    ///
14497    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14498    /// [`Scope::DisplayVideo`].
14499    ///
14500    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14501    /// tokens for more than one scope.
14502    ///
14503    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14504    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14505    /// sufficient, a read-write scope will do as well.
14506    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserCampaignPatchCall<'a, C>
14507    where
14508        St: AsRef<str>,
14509    {
14510        self._scopes.insert(String::from(scope.as_ref()));
14511        self
14512    }
14513    /// Identifies the authorization scope(s) for the method you are building.
14514    ///
14515    /// See [`Self::add_scope()`] for details.
14516    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserCampaignPatchCall<'a, C>
14517    where
14518        I: IntoIterator<Item = St>,
14519        St: AsRef<str>,
14520    {
14521        self._scopes
14522            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14523        self
14524    }
14525
14526    /// Removes all scopes, and no default scope will be used either.
14527    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14528    /// for details).
14529    pub fn clear_scopes(mut self) -> AdvertiserCampaignPatchCall<'a, C> {
14530        self._scopes.clear();
14531        self
14532    }
14533}
14534
14535/// Bulk edits sites under a single channel. The operation will delete the sites provided in BulkEditSitesRequest.deleted_sites and then create the sites provided in BulkEditSitesRequest.created_sites.
14536///
14537/// A builder for the *channels.sites.bulkEdit* method supported by a *advertiser* resource.
14538/// It is not used directly, but through a [`AdvertiserMethods`] instance.
14539///
14540/// # Example
14541///
14542/// Instantiate a resource method builder
14543///
14544/// ```test_harness,no_run
14545/// # extern crate hyper;
14546/// # extern crate hyper_rustls;
14547/// # extern crate google_displayvideo1 as displayvideo1;
14548/// use displayvideo1::api::BulkEditSitesRequest;
14549/// # async fn dox() {
14550/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14551///
14552/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14553/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14554/// #     secret,
14555/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14556/// # ).build().await.unwrap();
14557///
14558/// # let client = hyper_util::client::legacy::Client::builder(
14559/// #     hyper_util::rt::TokioExecutor::new()
14560/// # )
14561/// # .build(
14562/// #     hyper_rustls::HttpsConnectorBuilder::new()
14563/// #         .with_native_roots()
14564/// #         .unwrap()
14565/// #         .https_or_http()
14566/// #         .enable_http1()
14567/// #         .build()
14568/// # );
14569/// # let mut hub = DisplayVideo::new(client, auth);
14570/// // As the method needs a request, you would usually fill it with the desired information
14571/// // into the respective structure. Some of the parts shown here might not be applicable !
14572/// // Values shown here are possibly random and not representative !
14573/// let mut req = BulkEditSitesRequest::default();
14574///
14575/// // You can configure optional parameters by calling the respective setters at will, and
14576/// // execute the final call using `doit()`.
14577/// // Values shown here are possibly random and not representative !
14578/// let result = hub.advertisers().channels_sites_bulk_edit(req, -20, -34)
14579///              .doit().await;
14580/// # }
14581/// ```
14582pub struct AdvertiserChannelSiteBulkEditCall<'a, C>
14583where
14584    C: 'a,
14585{
14586    hub: &'a DisplayVideo<C>,
14587    _request: BulkEditSitesRequest,
14588    _advertiser_id: i64,
14589    _channel_id: i64,
14590    _delegate: Option<&'a mut dyn common::Delegate>,
14591    _additional_params: HashMap<String, String>,
14592    _scopes: BTreeSet<String>,
14593}
14594
14595impl<'a, C> common::CallBuilder for AdvertiserChannelSiteBulkEditCall<'a, C> {}
14596
14597impl<'a, C> AdvertiserChannelSiteBulkEditCall<'a, C>
14598where
14599    C: common::Connector,
14600{
14601    /// Perform the operation you have build so far.
14602    pub async fn doit(mut self) -> common::Result<(common::Response, BulkEditSitesResponse)> {
14603        use std::borrow::Cow;
14604        use std::io::{Read, Seek};
14605
14606        use common::{url::Params, ToParts};
14607        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14608
14609        let mut dd = common::DefaultDelegate;
14610        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14611        dlg.begin(common::MethodInfo {
14612            id: "displayvideo.advertisers.channels.sites.bulkEdit",
14613            http_method: hyper::Method::POST,
14614        });
14615
14616        for &field in ["alt", "advertiserId", "channelId"].iter() {
14617            if self._additional_params.contains_key(field) {
14618                dlg.finished(false);
14619                return Err(common::Error::FieldClash(field));
14620            }
14621        }
14622
14623        let mut params = Params::with_capacity(5 + self._additional_params.len());
14624        params.push("advertiserId", self._advertiser_id.to_string());
14625        params.push("channelId", self._channel_id.to_string());
14626
14627        params.extend(self._additional_params.iter());
14628
14629        params.push("alt", "json");
14630        let mut url = self.hub._base_url.clone()
14631            + "v1/advertisers/{advertiserId}/channels/{+channelId}/sites:bulkEdit";
14632        if self._scopes.is_empty() {
14633            self._scopes
14634                .insert(Scope::DisplayVideo.as_ref().to_string());
14635        }
14636
14637        #[allow(clippy::single_element_loop)]
14638        for &(find_this, param_name) in [
14639            ("{advertiserId}", "advertiserId"),
14640            ("{+channelId}", "channelId"),
14641        ]
14642        .iter()
14643        {
14644            url = params.uri_replacement(url, param_name, find_this, true);
14645        }
14646        {
14647            let to_remove = ["channelId", "advertiserId"];
14648            params.remove_params(&to_remove);
14649        }
14650
14651        let url = params.parse_with_url(&url);
14652
14653        let mut json_mime_type = mime::APPLICATION_JSON;
14654        let mut request_value_reader = {
14655            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14656            common::remove_json_null_values(&mut value);
14657            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14658            serde_json::to_writer(&mut dst, &value).unwrap();
14659            dst
14660        };
14661        let request_size = request_value_reader
14662            .seek(std::io::SeekFrom::End(0))
14663            .unwrap();
14664        request_value_reader
14665            .seek(std::io::SeekFrom::Start(0))
14666            .unwrap();
14667
14668        loop {
14669            let token = match self
14670                .hub
14671                .auth
14672                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14673                .await
14674            {
14675                Ok(token) => token,
14676                Err(e) => match dlg.token(e) {
14677                    Ok(token) => token,
14678                    Err(e) => {
14679                        dlg.finished(false);
14680                        return Err(common::Error::MissingToken(e));
14681                    }
14682                },
14683            };
14684            request_value_reader
14685                .seek(std::io::SeekFrom::Start(0))
14686                .unwrap();
14687            let mut req_result = {
14688                let client = &self.hub.client;
14689                dlg.pre_request();
14690                let mut req_builder = hyper::Request::builder()
14691                    .method(hyper::Method::POST)
14692                    .uri(url.as_str())
14693                    .header(USER_AGENT, self.hub._user_agent.clone());
14694
14695                if let Some(token) = token.as_ref() {
14696                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14697                }
14698
14699                let request = req_builder
14700                    .header(CONTENT_TYPE, json_mime_type.to_string())
14701                    .header(CONTENT_LENGTH, request_size as u64)
14702                    .body(common::to_body(
14703                        request_value_reader.get_ref().clone().into(),
14704                    ));
14705
14706                client.request(request.unwrap()).await
14707            };
14708
14709            match req_result {
14710                Err(err) => {
14711                    if let common::Retry::After(d) = dlg.http_error(&err) {
14712                        sleep(d).await;
14713                        continue;
14714                    }
14715                    dlg.finished(false);
14716                    return Err(common::Error::HttpError(err));
14717                }
14718                Ok(res) => {
14719                    let (mut parts, body) = res.into_parts();
14720                    let mut body = common::Body::new(body);
14721                    if !parts.status.is_success() {
14722                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14723                        let error = serde_json::from_str(&common::to_string(&bytes));
14724                        let response = common::to_response(parts, bytes.into());
14725
14726                        if let common::Retry::After(d) =
14727                            dlg.http_failure(&response, error.as_ref().ok())
14728                        {
14729                            sleep(d).await;
14730                            continue;
14731                        }
14732
14733                        dlg.finished(false);
14734
14735                        return Err(match error {
14736                            Ok(value) => common::Error::BadRequest(value),
14737                            _ => common::Error::Failure(response),
14738                        });
14739                    }
14740                    let response = {
14741                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14742                        let encoded = common::to_string(&bytes);
14743                        match serde_json::from_str(&encoded) {
14744                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14745                            Err(error) => {
14746                                dlg.response_json_decode_error(&encoded, &error);
14747                                return Err(common::Error::JsonDecodeError(
14748                                    encoded.to_string(),
14749                                    error,
14750                                ));
14751                            }
14752                        }
14753                    };
14754
14755                    dlg.finished(true);
14756                    return Ok(response);
14757                }
14758            }
14759        }
14760    }
14761
14762    ///
14763    /// Sets the *request* property to the given value.
14764    ///
14765    /// Even though the property as already been set when instantiating this call,
14766    /// we provide this method for API completeness.
14767    pub fn request(
14768        mut self,
14769        new_value: BulkEditSitesRequest,
14770    ) -> AdvertiserChannelSiteBulkEditCall<'a, C> {
14771        self._request = new_value;
14772        self
14773    }
14774    /// The ID of the advertiser that owns the parent channel.
14775    ///
14776    /// Sets the *advertiser id* path property to the given value.
14777    ///
14778    /// Even though the property as already been set when instantiating this call,
14779    /// we provide this method for API completeness.
14780    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserChannelSiteBulkEditCall<'a, C> {
14781        self._advertiser_id = new_value;
14782        self
14783    }
14784    /// Required. The ID of the parent channel to which the sites belong.
14785    ///
14786    /// Sets the *channel id* path property to the given value.
14787    ///
14788    /// Even though the property as already been set when instantiating this call,
14789    /// we provide this method for API completeness.
14790    pub fn channel_id(mut self, new_value: i64) -> AdvertiserChannelSiteBulkEditCall<'a, C> {
14791        self._channel_id = new_value;
14792        self
14793    }
14794    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14795    /// while executing the actual API request.
14796    ///
14797    /// ````text
14798    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14799    /// ````
14800    ///
14801    /// Sets the *delegate* property to the given value.
14802    pub fn delegate(
14803        mut self,
14804        new_value: &'a mut dyn common::Delegate,
14805    ) -> AdvertiserChannelSiteBulkEditCall<'a, C> {
14806        self._delegate = Some(new_value);
14807        self
14808    }
14809
14810    /// Set any additional parameter of the query string used in the request.
14811    /// It should be used to set parameters which are not yet available through their own
14812    /// setters.
14813    ///
14814    /// Please note that this method must not be used to set any of the known parameters
14815    /// which have their own setter method. If done anyway, the request will fail.
14816    ///
14817    /// # Additional Parameters
14818    ///
14819    /// * *$.xgafv* (query-string) - V1 error format.
14820    /// * *access_token* (query-string) - OAuth access token.
14821    /// * *alt* (query-string) - Data format for response.
14822    /// * *callback* (query-string) - JSONP
14823    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14824    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14825    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14826    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14827    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14828    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14829    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14830    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserChannelSiteBulkEditCall<'a, C>
14831    where
14832        T: AsRef<str>,
14833    {
14834        self._additional_params
14835            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14836        self
14837    }
14838
14839    /// Identifies the authorization scope for the method you are building.
14840    ///
14841    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14842    /// [`Scope::DisplayVideo`].
14843    ///
14844    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14845    /// tokens for more than one scope.
14846    ///
14847    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14848    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14849    /// sufficient, a read-write scope will do as well.
14850    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserChannelSiteBulkEditCall<'a, C>
14851    where
14852        St: AsRef<str>,
14853    {
14854        self._scopes.insert(String::from(scope.as_ref()));
14855        self
14856    }
14857    /// Identifies the authorization scope(s) for the method you are building.
14858    ///
14859    /// See [`Self::add_scope()`] for details.
14860    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserChannelSiteBulkEditCall<'a, C>
14861    where
14862        I: IntoIterator<Item = St>,
14863        St: AsRef<str>,
14864    {
14865        self._scopes
14866            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14867        self
14868    }
14869
14870    /// Removes all scopes, and no default scope will be used either.
14871    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14872    /// for details).
14873    pub fn clear_scopes(mut self) -> AdvertiserChannelSiteBulkEditCall<'a, C> {
14874        self._scopes.clear();
14875        self
14876    }
14877}
14878
14879/// Creates a site in a channel.
14880///
14881/// A builder for the *channels.sites.create* method supported by a *advertiser* resource.
14882/// It is not used directly, but through a [`AdvertiserMethods`] instance.
14883///
14884/// # Example
14885///
14886/// Instantiate a resource method builder
14887///
14888/// ```test_harness,no_run
14889/// # extern crate hyper;
14890/// # extern crate hyper_rustls;
14891/// # extern crate google_displayvideo1 as displayvideo1;
14892/// use displayvideo1::api::Site;
14893/// # async fn dox() {
14894/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14895///
14896/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14897/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14898/// #     secret,
14899/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14900/// # ).build().await.unwrap();
14901///
14902/// # let client = hyper_util::client::legacy::Client::builder(
14903/// #     hyper_util::rt::TokioExecutor::new()
14904/// # )
14905/// # .build(
14906/// #     hyper_rustls::HttpsConnectorBuilder::new()
14907/// #         .with_native_roots()
14908/// #         .unwrap()
14909/// #         .https_or_http()
14910/// #         .enable_http1()
14911/// #         .build()
14912/// # );
14913/// # let mut hub = DisplayVideo::new(client, auth);
14914/// // As the method needs a request, you would usually fill it with the desired information
14915/// // into the respective structure. Some of the parts shown here might not be applicable !
14916/// // Values shown here are possibly random and not representative !
14917/// let mut req = Site::default();
14918///
14919/// // You can configure optional parameters by calling the respective setters at will, and
14920/// // execute the final call using `doit()`.
14921/// // Values shown here are possibly random and not representative !
14922/// let result = hub.advertisers().channels_sites_create(req, -22, -28)
14923///              .partner_id(-2)
14924///              .doit().await;
14925/// # }
14926/// ```
14927pub struct AdvertiserChannelSiteCreateCall<'a, C>
14928where
14929    C: 'a,
14930{
14931    hub: &'a DisplayVideo<C>,
14932    _request: Site,
14933    _advertiser_id: i64,
14934    _channel_id: i64,
14935    _partner_id: Option<i64>,
14936    _delegate: Option<&'a mut dyn common::Delegate>,
14937    _additional_params: HashMap<String, String>,
14938    _scopes: BTreeSet<String>,
14939}
14940
14941impl<'a, C> common::CallBuilder for AdvertiserChannelSiteCreateCall<'a, C> {}
14942
14943impl<'a, C> AdvertiserChannelSiteCreateCall<'a, C>
14944where
14945    C: common::Connector,
14946{
14947    /// Perform the operation you have build so far.
14948    pub async fn doit(mut self) -> common::Result<(common::Response, Site)> {
14949        use std::borrow::Cow;
14950        use std::io::{Read, Seek};
14951
14952        use common::{url::Params, ToParts};
14953        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14954
14955        let mut dd = common::DefaultDelegate;
14956        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14957        dlg.begin(common::MethodInfo {
14958            id: "displayvideo.advertisers.channels.sites.create",
14959            http_method: hyper::Method::POST,
14960        });
14961
14962        for &field in ["alt", "advertiserId", "channelId", "partnerId"].iter() {
14963            if self._additional_params.contains_key(field) {
14964                dlg.finished(false);
14965                return Err(common::Error::FieldClash(field));
14966            }
14967        }
14968
14969        let mut params = Params::with_capacity(6 + self._additional_params.len());
14970        params.push("advertiserId", self._advertiser_id.to_string());
14971        params.push("channelId", self._channel_id.to_string());
14972        if let Some(value) = self._partner_id.as_ref() {
14973            params.push("partnerId", value.to_string());
14974        }
14975
14976        params.extend(self._additional_params.iter());
14977
14978        params.push("alt", "json");
14979        let mut url = self.hub._base_url.clone()
14980            + "v1/advertisers/{advertiserId}/channels/{+channelId}/sites";
14981        if self._scopes.is_empty() {
14982            self._scopes
14983                .insert(Scope::DisplayVideo.as_ref().to_string());
14984        }
14985
14986        #[allow(clippy::single_element_loop)]
14987        for &(find_this, param_name) in [
14988            ("{advertiserId}", "advertiserId"),
14989            ("{+channelId}", "channelId"),
14990        ]
14991        .iter()
14992        {
14993            url = params.uri_replacement(url, param_name, find_this, true);
14994        }
14995        {
14996            let to_remove = ["channelId", "advertiserId"];
14997            params.remove_params(&to_remove);
14998        }
14999
15000        let url = params.parse_with_url(&url);
15001
15002        let mut json_mime_type = mime::APPLICATION_JSON;
15003        let mut request_value_reader = {
15004            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15005            common::remove_json_null_values(&mut value);
15006            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15007            serde_json::to_writer(&mut dst, &value).unwrap();
15008            dst
15009        };
15010        let request_size = request_value_reader
15011            .seek(std::io::SeekFrom::End(0))
15012            .unwrap();
15013        request_value_reader
15014            .seek(std::io::SeekFrom::Start(0))
15015            .unwrap();
15016
15017        loop {
15018            let token = match self
15019                .hub
15020                .auth
15021                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15022                .await
15023            {
15024                Ok(token) => token,
15025                Err(e) => match dlg.token(e) {
15026                    Ok(token) => token,
15027                    Err(e) => {
15028                        dlg.finished(false);
15029                        return Err(common::Error::MissingToken(e));
15030                    }
15031                },
15032            };
15033            request_value_reader
15034                .seek(std::io::SeekFrom::Start(0))
15035                .unwrap();
15036            let mut req_result = {
15037                let client = &self.hub.client;
15038                dlg.pre_request();
15039                let mut req_builder = hyper::Request::builder()
15040                    .method(hyper::Method::POST)
15041                    .uri(url.as_str())
15042                    .header(USER_AGENT, self.hub._user_agent.clone());
15043
15044                if let Some(token) = token.as_ref() {
15045                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15046                }
15047
15048                let request = req_builder
15049                    .header(CONTENT_TYPE, json_mime_type.to_string())
15050                    .header(CONTENT_LENGTH, request_size as u64)
15051                    .body(common::to_body(
15052                        request_value_reader.get_ref().clone().into(),
15053                    ));
15054
15055                client.request(request.unwrap()).await
15056            };
15057
15058            match req_result {
15059                Err(err) => {
15060                    if let common::Retry::After(d) = dlg.http_error(&err) {
15061                        sleep(d).await;
15062                        continue;
15063                    }
15064                    dlg.finished(false);
15065                    return Err(common::Error::HttpError(err));
15066                }
15067                Ok(res) => {
15068                    let (mut parts, body) = res.into_parts();
15069                    let mut body = common::Body::new(body);
15070                    if !parts.status.is_success() {
15071                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15072                        let error = serde_json::from_str(&common::to_string(&bytes));
15073                        let response = common::to_response(parts, bytes.into());
15074
15075                        if let common::Retry::After(d) =
15076                            dlg.http_failure(&response, error.as_ref().ok())
15077                        {
15078                            sleep(d).await;
15079                            continue;
15080                        }
15081
15082                        dlg.finished(false);
15083
15084                        return Err(match error {
15085                            Ok(value) => common::Error::BadRequest(value),
15086                            _ => common::Error::Failure(response),
15087                        });
15088                    }
15089                    let response = {
15090                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15091                        let encoded = common::to_string(&bytes);
15092                        match serde_json::from_str(&encoded) {
15093                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15094                            Err(error) => {
15095                                dlg.response_json_decode_error(&encoded, &error);
15096                                return Err(common::Error::JsonDecodeError(
15097                                    encoded.to_string(),
15098                                    error,
15099                                ));
15100                            }
15101                        }
15102                    };
15103
15104                    dlg.finished(true);
15105                    return Ok(response);
15106                }
15107            }
15108        }
15109    }
15110
15111    ///
15112    /// Sets the *request* property to the given value.
15113    ///
15114    /// Even though the property as already been set when instantiating this call,
15115    /// we provide this method for API completeness.
15116    pub fn request(mut self, new_value: Site) -> AdvertiserChannelSiteCreateCall<'a, C> {
15117        self._request = new_value;
15118        self
15119    }
15120    /// The ID of the advertiser that owns the parent channel.
15121    ///
15122    /// Sets the *advertiser id* path property to the given value.
15123    ///
15124    /// Even though the property as already been set when instantiating this call,
15125    /// we provide this method for API completeness.
15126    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserChannelSiteCreateCall<'a, C> {
15127        self._advertiser_id = new_value;
15128        self
15129    }
15130    /// Required. The ID of the parent channel in which the site will be created.
15131    ///
15132    /// Sets the *channel id* path property to the given value.
15133    ///
15134    /// Even though the property as already been set when instantiating this call,
15135    /// we provide this method for API completeness.
15136    pub fn channel_id(mut self, new_value: i64) -> AdvertiserChannelSiteCreateCall<'a, C> {
15137        self._channel_id = new_value;
15138        self
15139    }
15140    /// The ID of the partner that owns the parent channel.
15141    ///
15142    /// Sets the *partner id* query property to the given value.
15143    pub fn partner_id(mut self, new_value: i64) -> AdvertiserChannelSiteCreateCall<'a, C> {
15144        self._partner_id = Some(new_value);
15145        self
15146    }
15147    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15148    /// while executing the actual API request.
15149    ///
15150    /// ````text
15151    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15152    /// ````
15153    ///
15154    /// Sets the *delegate* property to the given value.
15155    pub fn delegate(
15156        mut self,
15157        new_value: &'a mut dyn common::Delegate,
15158    ) -> AdvertiserChannelSiteCreateCall<'a, C> {
15159        self._delegate = Some(new_value);
15160        self
15161    }
15162
15163    /// Set any additional parameter of the query string used in the request.
15164    /// It should be used to set parameters which are not yet available through their own
15165    /// setters.
15166    ///
15167    /// Please note that this method must not be used to set any of the known parameters
15168    /// which have their own setter method. If done anyway, the request will fail.
15169    ///
15170    /// # Additional Parameters
15171    ///
15172    /// * *$.xgafv* (query-string) - V1 error format.
15173    /// * *access_token* (query-string) - OAuth access token.
15174    /// * *alt* (query-string) - Data format for response.
15175    /// * *callback* (query-string) - JSONP
15176    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15177    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15178    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15179    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15180    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15181    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15182    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15183    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserChannelSiteCreateCall<'a, C>
15184    where
15185        T: AsRef<str>,
15186    {
15187        self._additional_params
15188            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15189        self
15190    }
15191
15192    /// Identifies the authorization scope for the method you are building.
15193    ///
15194    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15195    /// [`Scope::DisplayVideo`].
15196    ///
15197    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15198    /// tokens for more than one scope.
15199    ///
15200    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15201    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15202    /// sufficient, a read-write scope will do as well.
15203    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserChannelSiteCreateCall<'a, C>
15204    where
15205        St: AsRef<str>,
15206    {
15207        self._scopes.insert(String::from(scope.as_ref()));
15208        self
15209    }
15210    /// Identifies the authorization scope(s) for the method you are building.
15211    ///
15212    /// See [`Self::add_scope()`] for details.
15213    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserChannelSiteCreateCall<'a, C>
15214    where
15215        I: IntoIterator<Item = St>,
15216        St: AsRef<str>,
15217    {
15218        self._scopes
15219            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15220        self
15221    }
15222
15223    /// Removes all scopes, and no default scope will be used either.
15224    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15225    /// for details).
15226    pub fn clear_scopes(mut self) -> AdvertiserChannelSiteCreateCall<'a, C> {
15227        self._scopes.clear();
15228        self
15229    }
15230}
15231
15232/// Deletes a site from a channel.
15233///
15234/// A builder for the *channels.sites.delete* method supported by a *advertiser* resource.
15235/// It is not used directly, but through a [`AdvertiserMethods`] instance.
15236///
15237/// # Example
15238///
15239/// Instantiate a resource method builder
15240///
15241/// ```test_harness,no_run
15242/// # extern crate hyper;
15243/// # extern crate hyper_rustls;
15244/// # extern crate google_displayvideo1 as displayvideo1;
15245/// # async fn dox() {
15246/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15247///
15248/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15249/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15250/// #     secret,
15251/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15252/// # ).build().await.unwrap();
15253///
15254/// # let client = hyper_util::client::legacy::Client::builder(
15255/// #     hyper_util::rt::TokioExecutor::new()
15256/// # )
15257/// # .build(
15258/// #     hyper_rustls::HttpsConnectorBuilder::new()
15259/// #         .with_native_roots()
15260/// #         .unwrap()
15261/// #         .https_or_http()
15262/// #         .enable_http1()
15263/// #         .build()
15264/// # );
15265/// # let mut hub = DisplayVideo::new(client, auth);
15266/// // You can configure optional parameters by calling the respective setters at will, and
15267/// // execute the final call using `doit()`.
15268/// // Values shown here are possibly random and not representative !
15269/// let result = hub.advertisers().channels_sites_delete(-96, -92, "urlOrAppId")
15270///              .partner_id(-18)
15271///              .doit().await;
15272/// # }
15273/// ```
15274pub struct AdvertiserChannelSiteDeleteCall<'a, C>
15275where
15276    C: 'a,
15277{
15278    hub: &'a DisplayVideo<C>,
15279    _advertiser_id: i64,
15280    _channel_id: i64,
15281    _url_or_app_id: String,
15282    _partner_id: Option<i64>,
15283    _delegate: Option<&'a mut dyn common::Delegate>,
15284    _additional_params: HashMap<String, String>,
15285    _scopes: BTreeSet<String>,
15286}
15287
15288impl<'a, C> common::CallBuilder for AdvertiserChannelSiteDeleteCall<'a, C> {}
15289
15290impl<'a, C> AdvertiserChannelSiteDeleteCall<'a, C>
15291where
15292    C: common::Connector,
15293{
15294    /// Perform the operation you have build so far.
15295    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
15296        use std::borrow::Cow;
15297        use std::io::{Read, Seek};
15298
15299        use common::{url::Params, ToParts};
15300        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15301
15302        let mut dd = common::DefaultDelegate;
15303        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15304        dlg.begin(common::MethodInfo {
15305            id: "displayvideo.advertisers.channels.sites.delete",
15306            http_method: hyper::Method::DELETE,
15307        });
15308
15309        for &field in [
15310            "alt",
15311            "advertiserId",
15312            "channelId",
15313            "urlOrAppId",
15314            "partnerId",
15315        ]
15316        .iter()
15317        {
15318            if self._additional_params.contains_key(field) {
15319                dlg.finished(false);
15320                return Err(common::Error::FieldClash(field));
15321            }
15322        }
15323
15324        let mut params = Params::with_capacity(6 + self._additional_params.len());
15325        params.push("advertiserId", self._advertiser_id.to_string());
15326        params.push("channelId", self._channel_id.to_string());
15327        params.push("urlOrAppId", self._url_or_app_id);
15328        if let Some(value) = self._partner_id.as_ref() {
15329            params.push("partnerId", value.to_string());
15330        }
15331
15332        params.extend(self._additional_params.iter());
15333
15334        params.push("alt", "json");
15335        let mut url = self.hub._base_url.clone()
15336            + "v1/advertisers/{advertiserId}/channels/{+channelId}/sites/{+urlOrAppId}";
15337        if self._scopes.is_empty() {
15338            self._scopes
15339                .insert(Scope::DisplayVideo.as_ref().to_string());
15340        }
15341
15342        #[allow(clippy::single_element_loop)]
15343        for &(find_this, param_name) in [
15344            ("{advertiserId}", "advertiserId"),
15345            ("{+channelId}", "channelId"),
15346            ("{+urlOrAppId}", "urlOrAppId"),
15347        ]
15348        .iter()
15349        {
15350            url = params.uri_replacement(url, param_name, find_this, true);
15351        }
15352        {
15353            let to_remove = ["urlOrAppId", "channelId", "advertiserId"];
15354            params.remove_params(&to_remove);
15355        }
15356
15357        let url = params.parse_with_url(&url);
15358
15359        loop {
15360            let token = match self
15361                .hub
15362                .auth
15363                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15364                .await
15365            {
15366                Ok(token) => token,
15367                Err(e) => match dlg.token(e) {
15368                    Ok(token) => token,
15369                    Err(e) => {
15370                        dlg.finished(false);
15371                        return Err(common::Error::MissingToken(e));
15372                    }
15373                },
15374            };
15375            let mut req_result = {
15376                let client = &self.hub.client;
15377                dlg.pre_request();
15378                let mut req_builder = hyper::Request::builder()
15379                    .method(hyper::Method::DELETE)
15380                    .uri(url.as_str())
15381                    .header(USER_AGENT, self.hub._user_agent.clone());
15382
15383                if let Some(token) = token.as_ref() {
15384                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15385                }
15386
15387                let request = req_builder
15388                    .header(CONTENT_LENGTH, 0_u64)
15389                    .body(common::to_body::<String>(None));
15390
15391                client.request(request.unwrap()).await
15392            };
15393
15394            match req_result {
15395                Err(err) => {
15396                    if let common::Retry::After(d) = dlg.http_error(&err) {
15397                        sleep(d).await;
15398                        continue;
15399                    }
15400                    dlg.finished(false);
15401                    return Err(common::Error::HttpError(err));
15402                }
15403                Ok(res) => {
15404                    let (mut parts, body) = res.into_parts();
15405                    let mut body = common::Body::new(body);
15406                    if !parts.status.is_success() {
15407                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15408                        let error = serde_json::from_str(&common::to_string(&bytes));
15409                        let response = common::to_response(parts, bytes.into());
15410
15411                        if let common::Retry::After(d) =
15412                            dlg.http_failure(&response, error.as_ref().ok())
15413                        {
15414                            sleep(d).await;
15415                            continue;
15416                        }
15417
15418                        dlg.finished(false);
15419
15420                        return Err(match error {
15421                            Ok(value) => common::Error::BadRequest(value),
15422                            _ => common::Error::Failure(response),
15423                        });
15424                    }
15425                    let response = {
15426                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15427                        let encoded = common::to_string(&bytes);
15428                        match serde_json::from_str(&encoded) {
15429                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15430                            Err(error) => {
15431                                dlg.response_json_decode_error(&encoded, &error);
15432                                return Err(common::Error::JsonDecodeError(
15433                                    encoded.to_string(),
15434                                    error,
15435                                ));
15436                            }
15437                        }
15438                    };
15439
15440                    dlg.finished(true);
15441                    return Ok(response);
15442                }
15443            }
15444        }
15445    }
15446
15447    /// The ID of the advertiser that owns the parent channel.
15448    ///
15449    /// Sets the *advertiser id* path property to the given value.
15450    ///
15451    /// Even though the property as already been set when instantiating this call,
15452    /// we provide this method for API completeness.
15453    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserChannelSiteDeleteCall<'a, C> {
15454        self._advertiser_id = new_value;
15455        self
15456    }
15457    /// Required. The ID of the parent channel to which the site belongs.
15458    ///
15459    /// Sets the *channel id* path property to the given value.
15460    ///
15461    /// Even though the property as already been set when instantiating this call,
15462    /// we provide this method for API completeness.
15463    pub fn channel_id(mut self, new_value: i64) -> AdvertiserChannelSiteDeleteCall<'a, C> {
15464        self._channel_id = new_value;
15465        self
15466    }
15467    /// Required. The URL or app ID of the site to delete.
15468    ///
15469    /// Sets the *url or app id* path property to the given value.
15470    ///
15471    /// Even though the property as already been set when instantiating this call,
15472    /// we provide this method for API completeness.
15473    pub fn url_or_app_id(mut self, new_value: &str) -> AdvertiserChannelSiteDeleteCall<'a, C> {
15474        self._url_or_app_id = new_value.to_string();
15475        self
15476    }
15477    /// The ID of the partner that owns the parent channel.
15478    ///
15479    /// Sets the *partner id* query property to the given value.
15480    pub fn partner_id(mut self, new_value: i64) -> AdvertiserChannelSiteDeleteCall<'a, C> {
15481        self._partner_id = Some(new_value);
15482        self
15483    }
15484    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15485    /// while executing the actual API request.
15486    ///
15487    /// ````text
15488    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15489    /// ````
15490    ///
15491    /// Sets the *delegate* property to the given value.
15492    pub fn delegate(
15493        mut self,
15494        new_value: &'a mut dyn common::Delegate,
15495    ) -> AdvertiserChannelSiteDeleteCall<'a, C> {
15496        self._delegate = Some(new_value);
15497        self
15498    }
15499
15500    /// Set any additional parameter of the query string used in the request.
15501    /// It should be used to set parameters which are not yet available through their own
15502    /// setters.
15503    ///
15504    /// Please note that this method must not be used to set any of the known parameters
15505    /// which have their own setter method. If done anyway, the request will fail.
15506    ///
15507    /// # Additional Parameters
15508    ///
15509    /// * *$.xgafv* (query-string) - V1 error format.
15510    /// * *access_token* (query-string) - OAuth access token.
15511    /// * *alt* (query-string) - Data format for response.
15512    /// * *callback* (query-string) - JSONP
15513    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15514    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15515    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15516    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15517    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15518    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15519    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15520    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserChannelSiteDeleteCall<'a, C>
15521    where
15522        T: AsRef<str>,
15523    {
15524        self._additional_params
15525            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15526        self
15527    }
15528
15529    /// Identifies the authorization scope for the method you are building.
15530    ///
15531    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15532    /// [`Scope::DisplayVideo`].
15533    ///
15534    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15535    /// tokens for more than one scope.
15536    ///
15537    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15538    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15539    /// sufficient, a read-write scope will do as well.
15540    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserChannelSiteDeleteCall<'a, C>
15541    where
15542        St: AsRef<str>,
15543    {
15544        self._scopes.insert(String::from(scope.as_ref()));
15545        self
15546    }
15547    /// Identifies the authorization scope(s) for the method you are building.
15548    ///
15549    /// See [`Self::add_scope()`] for details.
15550    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserChannelSiteDeleteCall<'a, C>
15551    where
15552        I: IntoIterator<Item = St>,
15553        St: AsRef<str>,
15554    {
15555        self._scopes
15556            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15557        self
15558    }
15559
15560    /// Removes all scopes, and no default scope will be used either.
15561    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15562    /// for details).
15563    pub fn clear_scopes(mut self) -> AdvertiserChannelSiteDeleteCall<'a, C> {
15564        self._scopes.clear();
15565        self
15566    }
15567}
15568
15569/// Lists sites in a channel.
15570///
15571/// A builder for the *channels.sites.list* method supported by a *advertiser* resource.
15572/// It is not used directly, but through a [`AdvertiserMethods`] instance.
15573///
15574/// # Example
15575///
15576/// Instantiate a resource method builder
15577///
15578/// ```test_harness,no_run
15579/// # extern crate hyper;
15580/// # extern crate hyper_rustls;
15581/// # extern crate google_displayvideo1 as displayvideo1;
15582/// # async fn dox() {
15583/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15584///
15585/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15586/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15587/// #     secret,
15588/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15589/// # ).build().await.unwrap();
15590///
15591/// # let client = hyper_util::client::legacy::Client::builder(
15592/// #     hyper_util::rt::TokioExecutor::new()
15593/// # )
15594/// # .build(
15595/// #     hyper_rustls::HttpsConnectorBuilder::new()
15596/// #         .with_native_roots()
15597/// #         .unwrap()
15598/// #         .https_or_http()
15599/// #         .enable_http1()
15600/// #         .build()
15601/// # );
15602/// # let mut hub = DisplayVideo::new(client, auth);
15603/// // You can configure optional parameters by calling the respective setters at will, and
15604/// // execute the final call using `doit()`.
15605/// // Values shown here are possibly random and not representative !
15606/// let result = hub.advertisers().channels_sites_list(-22, -95)
15607///              .partner_id(-15)
15608///              .page_token("dolor")
15609///              .page_size(-20)
15610///              .order_by("vero")
15611///              .filter("vero")
15612///              .doit().await;
15613/// # }
15614/// ```
15615pub struct AdvertiserChannelSiteListCall<'a, C>
15616where
15617    C: 'a,
15618{
15619    hub: &'a DisplayVideo<C>,
15620    _advertiser_id: i64,
15621    _channel_id: i64,
15622    _partner_id: Option<i64>,
15623    _page_token: Option<String>,
15624    _page_size: Option<i32>,
15625    _order_by: Option<String>,
15626    _filter: Option<String>,
15627    _delegate: Option<&'a mut dyn common::Delegate>,
15628    _additional_params: HashMap<String, String>,
15629    _scopes: BTreeSet<String>,
15630}
15631
15632impl<'a, C> common::CallBuilder for AdvertiserChannelSiteListCall<'a, C> {}
15633
15634impl<'a, C> AdvertiserChannelSiteListCall<'a, C>
15635where
15636    C: common::Connector,
15637{
15638    /// Perform the operation you have build so far.
15639    pub async fn doit(mut self) -> common::Result<(common::Response, ListSitesResponse)> {
15640        use std::borrow::Cow;
15641        use std::io::{Read, Seek};
15642
15643        use common::{url::Params, ToParts};
15644        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15645
15646        let mut dd = common::DefaultDelegate;
15647        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15648        dlg.begin(common::MethodInfo {
15649            id: "displayvideo.advertisers.channels.sites.list",
15650            http_method: hyper::Method::GET,
15651        });
15652
15653        for &field in [
15654            "alt",
15655            "advertiserId",
15656            "channelId",
15657            "partnerId",
15658            "pageToken",
15659            "pageSize",
15660            "orderBy",
15661            "filter",
15662        ]
15663        .iter()
15664        {
15665            if self._additional_params.contains_key(field) {
15666                dlg.finished(false);
15667                return Err(common::Error::FieldClash(field));
15668            }
15669        }
15670
15671        let mut params = Params::with_capacity(9 + self._additional_params.len());
15672        params.push("advertiserId", self._advertiser_id.to_string());
15673        params.push("channelId", self._channel_id.to_string());
15674        if let Some(value) = self._partner_id.as_ref() {
15675            params.push("partnerId", value.to_string());
15676        }
15677        if let Some(value) = self._page_token.as_ref() {
15678            params.push("pageToken", value);
15679        }
15680        if let Some(value) = self._page_size.as_ref() {
15681            params.push("pageSize", value.to_string());
15682        }
15683        if let Some(value) = self._order_by.as_ref() {
15684            params.push("orderBy", value);
15685        }
15686        if let Some(value) = self._filter.as_ref() {
15687            params.push("filter", value);
15688        }
15689
15690        params.extend(self._additional_params.iter());
15691
15692        params.push("alt", "json");
15693        let mut url = self.hub._base_url.clone()
15694            + "v1/advertisers/{+advertiserId}/channels/{+channelId}/sites";
15695        if self._scopes.is_empty() {
15696            self._scopes
15697                .insert(Scope::DisplayVideo.as_ref().to_string());
15698        }
15699
15700        #[allow(clippy::single_element_loop)]
15701        for &(find_this, param_name) in [
15702            ("{+advertiserId}", "advertiserId"),
15703            ("{+channelId}", "channelId"),
15704        ]
15705        .iter()
15706        {
15707            url = params.uri_replacement(url, param_name, find_this, true);
15708        }
15709        {
15710            let to_remove = ["channelId", "advertiserId"];
15711            params.remove_params(&to_remove);
15712        }
15713
15714        let url = params.parse_with_url(&url);
15715
15716        loop {
15717            let token = match self
15718                .hub
15719                .auth
15720                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15721                .await
15722            {
15723                Ok(token) => token,
15724                Err(e) => match dlg.token(e) {
15725                    Ok(token) => token,
15726                    Err(e) => {
15727                        dlg.finished(false);
15728                        return Err(common::Error::MissingToken(e));
15729                    }
15730                },
15731            };
15732            let mut req_result = {
15733                let client = &self.hub.client;
15734                dlg.pre_request();
15735                let mut req_builder = hyper::Request::builder()
15736                    .method(hyper::Method::GET)
15737                    .uri(url.as_str())
15738                    .header(USER_AGENT, self.hub._user_agent.clone());
15739
15740                if let Some(token) = token.as_ref() {
15741                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15742                }
15743
15744                let request = req_builder
15745                    .header(CONTENT_LENGTH, 0_u64)
15746                    .body(common::to_body::<String>(None));
15747
15748                client.request(request.unwrap()).await
15749            };
15750
15751            match req_result {
15752                Err(err) => {
15753                    if let common::Retry::After(d) = dlg.http_error(&err) {
15754                        sleep(d).await;
15755                        continue;
15756                    }
15757                    dlg.finished(false);
15758                    return Err(common::Error::HttpError(err));
15759                }
15760                Ok(res) => {
15761                    let (mut parts, body) = res.into_parts();
15762                    let mut body = common::Body::new(body);
15763                    if !parts.status.is_success() {
15764                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15765                        let error = serde_json::from_str(&common::to_string(&bytes));
15766                        let response = common::to_response(parts, bytes.into());
15767
15768                        if let common::Retry::After(d) =
15769                            dlg.http_failure(&response, error.as_ref().ok())
15770                        {
15771                            sleep(d).await;
15772                            continue;
15773                        }
15774
15775                        dlg.finished(false);
15776
15777                        return Err(match error {
15778                            Ok(value) => common::Error::BadRequest(value),
15779                            _ => common::Error::Failure(response),
15780                        });
15781                    }
15782                    let response = {
15783                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15784                        let encoded = common::to_string(&bytes);
15785                        match serde_json::from_str(&encoded) {
15786                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15787                            Err(error) => {
15788                                dlg.response_json_decode_error(&encoded, &error);
15789                                return Err(common::Error::JsonDecodeError(
15790                                    encoded.to_string(),
15791                                    error,
15792                                ));
15793                            }
15794                        }
15795                    };
15796
15797                    dlg.finished(true);
15798                    return Ok(response);
15799                }
15800            }
15801        }
15802    }
15803
15804    /// The ID of the advertiser that owns the parent channel.
15805    ///
15806    /// Sets the *advertiser id* path property to the given value.
15807    ///
15808    /// Even though the property as already been set when instantiating this call,
15809    /// we provide this method for API completeness.
15810    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserChannelSiteListCall<'a, C> {
15811        self._advertiser_id = new_value;
15812        self
15813    }
15814    /// Required. The ID of the parent channel to which the requested sites belong.
15815    ///
15816    /// Sets the *channel id* path property to the given value.
15817    ///
15818    /// Even though the property as already been set when instantiating this call,
15819    /// we provide this method for API completeness.
15820    pub fn channel_id(mut self, new_value: i64) -> AdvertiserChannelSiteListCall<'a, C> {
15821        self._channel_id = new_value;
15822        self
15823    }
15824    /// The ID of the partner that owns the parent channel.
15825    ///
15826    /// Sets the *partner id* query property to the given value.
15827    pub fn partner_id(mut self, new_value: i64) -> AdvertiserChannelSiteListCall<'a, C> {
15828        self._partner_id = Some(new_value);
15829        self
15830    }
15831    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListSites` method. If not specified, the first page of results will be returned.
15832    ///
15833    /// Sets the *page token* query property to the given value.
15834    pub fn page_token(mut self, new_value: &str) -> AdvertiserChannelSiteListCall<'a, C> {
15835        self._page_token = Some(new_value.to_string());
15836        self
15837    }
15838    /// Requested page size. Must be between `1` and `10000`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
15839    ///
15840    /// Sets the *page size* query property to the given value.
15841    pub fn page_size(mut self, new_value: i32) -> AdvertiserChannelSiteListCall<'a, C> {
15842        self._page_size = Some(new_value);
15843        self
15844    }
15845    /// Field by which to sort the list. Acceptable values are: * `urlOrAppId` (default) The default sorting order is ascending. To specify descending order for a field, a suffix " desc" should be added to the field name. Example: `urlOrAppId desc`.
15846    ///
15847    /// Sets the *order by* query property to the given value.
15848    pub fn order_by(mut self, new_value: &str) -> AdvertiserChannelSiteListCall<'a, C> {
15849        self._order_by = Some(new_value.to_string());
15850        self
15851    }
15852    /// Allows filtering by site fields. Supported syntax: * Filter expressions for site retrieval can only contain at most one restriction. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `HAS (:)` operator. Supported fields: * `urlOrAppId` Examples: * All sites for which the URL or app ID contains “google”: `urlOrAppId : "google"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
15853    ///
15854    /// Sets the *filter* query property to the given value.
15855    pub fn filter(mut self, new_value: &str) -> AdvertiserChannelSiteListCall<'a, C> {
15856        self._filter = Some(new_value.to_string());
15857        self
15858    }
15859    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15860    /// while executing the actual API request.
15861    ///
15862    /// ````text
15863    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15864    /// ````
15865    ///
15866    /// Sets the *delegate* property to the given value.
15867    pub fn delegate(
15868        mut self,
15869        new_value: &'a mut dyn common::Delegate,
15870    ) -> AdvertiserChannelSiteListCall<'a, C> {
15871        self._delegate = Some(new_value);
15872        self
15873    }
15874
15875    /// Set any additional parameter of the query string used in the request.
15876    /// It should be used to set parameters which are not yet available through their own
15877    /// setters.
15878    ///
15879    /// Please note that this method must not be used to set any of the known parameters
15880    /// which have their own setter method. If done anyway, the request will fail.
15881    ///
15882    /// # Additional Parameters
15883    ///
15884    /// * *$.xgafv* (query-string) - V1 error format.
15885    /// * *access_token* (query-string) - OAuth access token.
15886    /// * *alt* (query-string) - Data format for response.
15887    /// * *callback* (query-string) - JSONP
15888    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15889    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15890    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15891    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15892    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15893    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15894    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15895    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserChannelSiteListCall<'a, C>
15896    where
15897        T: AsRef<str>,
15898    {
15899        self._additional_params
15900            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15901        self
15902    }
15903
15904    /// Identifies the authorization scope for the method you are building.
15905    ///
15906    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15907    /// [`Scope::DisplayVideo`].
15908    ///
15909    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15910    /// tokens for more than one scope.
15911    ///
15912    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15913    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15914    /// sufficient, a read-write scope will do as well.
15915    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserChannelSiteListCall<'a, C>
15916    where
15917        St: AsRef<str>,
15918    {
15919        self._scopes.insert(String::from(scope.as_ref()));
15920        self
15921    }
15922    /// Identifies the authorization scope(s) for the method you are building.
15923    ///
15924    /// See [`Self::add_scope()`] for details.
15925    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserChannelSiteListCall<'a, C>
15926    where
15927        I: IntoIterator<Item = St>,
15928        St: AsRef<str>,
15929    {
15930        self._scopes
15931            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15932        self
15933    }
15934
15935    /// Removes all scopes, and no default scope will be used either.
15936    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15937    /// for details).
15938    pub fn clear_scopes(mut self) -> AdvertiserChannelSiteListCall<'a, C> {
15939        self._scopes.clear();
15940        self
15941    }
15942}
15943
15944/// Replaces all of the sites under a single channel. The operation will replace the sites under a channel with the sites provided in ReplaceSitesRequest.new_sites. **This method regularly experiences high latency.** We recommend [increasing your default timeout](https://developers.google.com/display-video/api/guides/best-practices/timeouts#client_library_timeout) to avoid errors.
15945///
15946/// A builder for the *channels.sites.replace* method supported by a *advertiser* resource.
15947/// It is not used directly, but through a [`AdvertiserMethods`] instance.
15948///
15949/// # Example
15950///
15951/// Instantiate a resource method builder
15952///
15953/// ```test_harness,no_run
15954/// # extern crate hyper;
15955/// # extern crate hyper_rustls;
15956/// # extern crate google_displayvideo1 as displayvideo1;
15957/// use displayvideo1::api::ReplaceSitesRequest;
15958/// # async fn dox() {
15959/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15960///
15961/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15962/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15963/// #     secret,
15964/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15965/// # ).build().await.unwrap();
15966///
15967/// # let client = hyper_util::client::legacy::Client::builder(
15968/// #     hyper_util::rt::TokioExecutor::new()
15969/// # )
15970/// # .build(
15971/// #     hyper_rustls::HttpsConnectorBuilder::new()
15972/// #         .with_native_roots()
15973/// #         .unwrap()
15974/// #         .https_or_http()
15975/// #         .enable_http1()
15976/// #         .build()
15977/// # );
15978/// # let mut hub = DisplayVideo::new(client, auth);
15979/// // As the method needs a request, you would usually fill it with the desired information
15980/// // into the respective structure. Some of the parts shown here might not be applicable !
15981/// // Values shown here are possibly random and not representative !
15982/// let mut req = ReplaceSitesRequest::default();
15983///
15984/// // You can configure optional parameters by calling the respective setters at will, and
15985/// // execute the final call using `doit()`.
15986/// // Values shown here are possibly random and not representative !
15987/// let result = hub.advertisers().channels_sites_replace(req, -88, -65)
15988///              .doit().await;
15989/// # }
15990/// ```
15991pub struct AdvertiserChannelSiteReplaceCall<'a, C>
15992where
15993    C: 'a,
15994{
15995    hub: &'a DisplayVideo<C>,
15996    _request: ReplaceSitesRequest,
15997    _advertiser_id: i64,
15998    _channel_id: i64,
15999    _delegate: Option<&'a mut dyn common::Delegate>,
16000    _additional_params: HashMap<String, String>,
16001    _scopes: BTreeSet<String>,
16002}
16003
16004impl<'a, C> common::CallBuilder for AdvertiserChannelSiteReplaceCall<'a, C> {}
16005
16006impl<'a, C> AdvertiserChannelSiteReplaceCall<'a, C>
16007where
16008    C: common::Connector,
16009{
16010    /// Perform the operation you have build so far.
16011    pub async fn doit(mut self) -> common::Result<(common::Response, ReplaceSitesResponse)> {
16012        use std::borrow::Cow;
16013        use std::io::{Read, Seek};
16014
16015        use common::{url::Params, ToParts};
16016        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16017
16018        let mut dd = common::DefaultDelegate;
16019        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16020        dlg.begin(common::MethodInfo {
16021            id: "displayvideo.advertisers.channels.sites.replace",
16022            http_method: hyper::Method::POST,
16023        });
16024
16025        for &field in ["alt", "advertiserId", "channelId"].iter() {
16026            if self._additional_params.contains_key(field) {
16027                dlg.finished(false);
16028                return Err(common::Error::FieldClash(field));
16029            }
16030        }
16031
16032        let mut params = Params::with_capacity(5 + self._additional_params.len());
16033        params.push("advertiserId", self._advertiser_id.to_string());
16034        params.push("channelId", self._channel_id.to_string());
16035
16036        params.extend(self._additional_params.iter());
16037
16038        params.push("alt", "json");
16039        let mut url = self.hub._base_url.clone()
16040            + "v1/advertisers/{advertiserId}/channels/{+channelId}/sites:replace";
16041        if self._scopes.is_empty() {
16042            self._scopes
16043                .insert(Scope::DisplayVideo.as_ref().to_string());
16044        }
16045
16046        #[allow(clippy::single_element_loop)]
16047        for &(find_this, param_name) in [
16048            ("{advertiserId}", "advertiserId"),
16049            ("{+channelId}", "channelId"),
16050        ]
16051        .iter()
16052        {
16053            url = params.uri_replacement(url, param_name, find_this, true);
16054        }
16055        {
16056            let to_remove = ["channelId", "advertiserId"];
16057            params.remove_params(&to_remove);
16058        }
16059
16060        let url = params.parse_with_url(&url);
16061
16062        let mut json_mime_type = mime::APPLICATION_JSON;
16063        let mut request_value_reader = {
16064            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16065            common::remove_json_null_values(&mut value);
16066            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16067            serde_json::to_writer(&mut dst, &value).unwrap();
16068            dst
16069        };
16070        let request_size = request_value_reader
16071            .seek(std::io::SeekFrom::End(0))
16072            .unwrap();
16073        request_value_reader
16074            .seek(std::io::SeekFrom::Start(0))
16075            .unwrap();
16076
16077        loop {
16078            let token = match self
16079                .hub
16080                .auth
16081                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16082                .await
16083            {
16084                Ok(token) => token,
16085                Err(e) => match dlg.token(e) {
16086                    Ok(token) => token,
16087                    Err(e) => {
16088                        dlg.finished(false);
16089                        return Err(common::Error::MissingToken(e));
16090                    }
16091                },
16092            };
16093            request_value_reader
16094                .seek(std::io::SeekFrom::Start(0))
16095                .unwrap();
16096            let mut req_result = {
16097                let client = &self.hub.client;
16098                dlg.pre_request();
16099                let mut req_builder = hyper::Request::builder()
16100                    .method(hyper::Method::POST)
16101                    .uri(url.as_str())
16102                    .header(USER_AGENT, self.hub._user_agent.clone());
16103
16104                if let Some(token) = token.as_ref() {
16105                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16106                }
16107
16108                let request = req_builder
16109                    .header(CONTENT_TYPE, json_mime_type.to_string())
16110                    .header(CONTENT_LENGTH, request_size as u64)
16111                    .body(common::to_body(
16112                        request_value_reader.get_ref().clone().into(),
16113                    ));
16114
16115                client.request(request.unwrap()).await
16116            };
16117
16118            match req_result {
16119                Err(err) => {
16120                    if let common::Retry::After(d) = dlg.http_error(&err) {
16121                        sleep(d).await;
16122                        continue;
16123                    }
16124                    dlg.finished(false);
16125                    return Err(common::Error::HttpError(err));
16126                }
16127                Ok(res) => {
16128                    let (mut parts, body) = res.into_parts();
16129                    let mut body = common::Body::new(body);
16130                    if !parts.status.is_success() {
16131                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16132                        let error = serde_json::from_str(&common::to_string(&bytes));
16133                        let response = common::to_response(parts, bytes.into());
16134
16135                        if let common::Retry::After(d) =
16136                            dlg.http_failure(&response, error.as_ref().ok())
16137                        {
16138                            sleep(d).await;
16139                            continue;
16140                        }
16141
16142                        dlg.finished(false);
16143
16144                        return Err(match error {
16145                            Ok(value) => common::Error::BadRequest(value),
16146                            _ => common::Error::Failure(response),
16147                        });
16148                    }
16149                    let response = {
16150                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16151                        let encoded = common::to_string(&bytes);
16152                        match serde_json::from_str(&encoded) {
16153                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16154                            Err(error) => {
16155                                dlg.response_json_decode_error(&encoded, &error);
16156                                return Err(common::Error::JsonDecodeError(
16157                                    encoded.to_string(),
16158                                    error,
16159                                ));
16160                            }
16161                        }
16162                    };
16163
16164                    dlg.finished(true);
16165                    return Ok(response);
16166                }
16167            }
16168        }
16169    }
16170
16171    ///
16172    /// Sets the *request* property to the given value.
16173    ///
16174    /// Even though the property as already been set when instantiating this call,
16175    /// we provide this method for API completeness.
16176    pub fn request(
16177        mut self,
16178        new_value: ReplaceSitesRequest,
16179    ) -> AdvertiserChannelSiteReplaceCall<'a, C> {
16180        self._request = new_value;
16181        self
16182    }
16183    /// The ID of the advertiser that owns the parent channel.
16184    ///
16185    /// Sets the *advertiser id* path property to the given value.
16186    ///
16187    /// Even though the property as already been set when instantiating this call,
16188    /// we provide this method for API completeness.
16189    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserChannelSiteReplaceCall<'a, C> {
16190        self._advertiser_id = new_value;
16191        self
16192    }
16193    /// Required. The ID of the parent channel whose sites will be replaced.
16194    ///
16195    /// Sets the *channel id* path property to the given value.
16196    ///
16197    /// Even though the property as already been set when instantiating this call,
16198    /// we provide this method for API completeness.
16199    pub fn channel_id(mut self, new_value: i64) -> AdvertiserChannelSiteReplaceCall<'a, C> {
16200        self._channel_id = new_value;
16201        self
16202    }
16203    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16204    /// while executing the actual API request.
16205    ///
16206    /// ````text
16207    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16208    /// ````
16209    ///
16210    /// Sets the *delegate* property to the given value.
16211    pub fn delegate(
16212        mut self,
16213        new_value: &'a mut dyn common::Delegate,
16214    ) -> AdvertiserChannelSiteReplaceCall<'a, C> {
16215        self._delegate = Some(new_value);
16216        self
16217    }
16218
16219    /// Set any additional parameter of the query string used in the request.
16220    /// It should be used to set parameters which are not yet available through their own
16221    /// setters.
16222    ///
16223    /// Please note that this method must not be used to set any of the known parameters
16224    /// which have their own setter method. If done anyway, the request will fail.
16225    ///
16226    /// # Additional Parameters
16227    ///
16228    /// * *$.xgafv* (query-string) - V1 error format.
16229    /// * *access_token* (query-string) - OAuth access token.
16230    /// * *alt* (query-string) - Data format for response.
16231    /// * *callback* (query-string) - JSONP
16232    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16233    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16234    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16235    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16236    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16237    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16238    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16239    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserChannelSiteReplaceCall<'a, C>
16240    where
16241        T: AsRef<str>,
16242    {
16243        self._additional_params
16244            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16245        self
16246    }
16247
16248    /// Identifies the authorization scope for the method you are building.
16249    ///
16250    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16251    /// [`Scope::DisplayVideo`].
16252    ///
16253    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16254    /// tokens for more than one scope.
16255    ///
16256    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16257    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16258    /// sufficient, a read-write scope will do as well.
16259    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserChannelSiteReplaceCall<'a, C>
16260    where
16261        St: AsRef<str>,
16262    {
16263        self._scopes.insert(String::from(scope.as_ref()));
16264        self
16265    }
16266    /// Identifies the authorization scope(s) for the method you are building.
16267    ///
16268    /// See [`Self::add_scope()`] for details.
16269    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserChannelSiteReplaceCall<'a, C>
16270    where
16271        I: IntoIterator<Item = St>,
16272        St: AsRef<str>,
16273    {
16274        self._scopes
16275            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16276        self
16277    }
16278
16279    /// Removes all scopes, and no default scope will be used either.
16280    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16281    /// for details).
16282    pub fn clear_scopes(mut self) -> AdvertiserChannelSiteReplaceCall<'a, C> {
16283        self._scopes.clear();
16284        self
16285    }
16286}
16287
16288/// Creates a new channel. Returns the newly created channel if successful.
16289///
16290/// A builder for the *channels.create* method supported by a *advertiser* resource.
16291/// It is not used directly, but through a [`AdvertiserMethods`] instance.
16292///
16293/// # Example
16294///
16295/// Instantiate a resource method builder
16296///
16297/// ```test_harness,no_run
16298/// # extern crate hyper;
16299/// # extern crate hyper_rustls;
16300/// # extern crate google_displayvideo1 as displayvideo1;
16301/// use displayvideo1::api::Channel;
16302/// # async fn dox() {
16303/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16304///
16305/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16306/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16307/// #     secret,
16308/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16309/// # ).build().await.unwrap();
16310///
16311/// # let client = hyper_util::client::legacy::Client::builder(
16312/// #     hyper_util::rt::TokioExecutor::new()
16313/// # )
16314/// # .build(
16315/// #     hyper_rustls::HttpsConnectorBuilder::new()
16316/// #         .with_native_roots()
16317/// #         .unwrap()
16318/// #         .https_or_http()
16319/// #         .enable_http1()
16320/// #         .build()
16321/// # );
16322/// # let mut hub = DisplayVideo::new(client, auth);
16323/// // As the method needs a request, you would usually fill it with the desired information
16324/// // into the respective structure. Some of the parts shown here might not be applicable !
16325/// // Values shown here are possibly random and not representative !
16326/// let mut req = Channel::default();
16327///
16328/// // You can configure optional parameters by calling the respective setters at will, and
16329/// // execute the final call using `doit()`.
16330/// // Values shown here are possibly random and not representative !
16331/// let result = hub.advertisers().channels_create(req, -76)
16332///              .partner_id(-44)
16333///              .doit().await;
16334/// # }
16335/// ```
16336pub struct AdvertiserChannelCreateCall<'a, C>
16337where
16338    C: 'a,
16339{
16340    hub: &'a DisplayVideo<C>,
16341    _request: Channel,
16342    _advertiser_id: i64,
16343    _partner_id: Option<i64>,
16344    _delegate: Option<&'a mut dyn common::Delegate>,
16345    _additional_params: HashMap<String, String>,
16346    _scopes: BTreeSet<String>,
16347}
16348
16349impl<'a, C> common::CallBuilder for AdvertiserChannelCreateCall<'a, C> {}
16350
16351impl<'a, C> AdvertiserChannelCreateCall<'a, C>
16352where
16353    C: common::Connector,
16354{
16355    /// Perform the operation you have build so far.
16356    pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
16357        use std::borrow::Cow;
16358        use std::io::{Read, Seek};
16359
16360        use common::{url::Params, ToParts};
16361        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16362
16363        let mut dd = common::DefaultDelegate;
16364        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16365        dlg.begin(common::MethodInfo {
16366            id: "displayvideo.advertisers.channels.create",
16367            http_method: hyper::Method::POST,
16368        });
16369
16370        for &field in ["alt", "advertiserId", "partnerId"].iter() {
16371            if self._additional_params.contains_key(field) {
16372                dlg.finished(false);
16373                return Err(common::Error::FieldClash(field));
16374            }
16375        }
16376
16377        let mut params = Params::with_capacity(5 + self._additional_params.len());
16378        params.push("advertiserId", self._advertiser_id.to_string());
16379        if let Some(value) = self._partner_id.as_ref() {
16380            params.push("partnerId", value.to_string());
16381        }
16382
16383        params.extend(self._additional_params.iter());
16384
16385        params.push("alt", "json");
16386        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/channels";
16387        if self._scopes.is_empty() {
16388            self._scopes
16389                .insert(Scope::DisplayVideo.as_ref().to_string());
16390        }
16391
16392        #[allow(clippy::single_element_loop)]
16393        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
16394            url = params.uri_replacement(url, param_name, find_this, true);
16395        }
16396        {
16397            let to_remove = ["advertiserId"];
16398            params.remove_params(&to_remove);
16399        }
16400
16401        let url = params.parse_with_url(&url);
16402
16403        let mut json_mime_type = mime::APPLICATION_JSON;
16404        let mut request_value_reader = {
16405            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16406            common::remove_json_null_values(&mut value);
16407            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16408            serde_json::to_writer(&mut dst, &value).unwrap();
16409            dst
16410        };
16411        let request_size = request_value_reader
16412            .seek(std::io::SeekFrom::End(0))
16413            .unwrap();
16414        request_value_reader
16415            .seek(std::io::SeekFrom::Start(0))
16416            .unwrap();
16417
16418        loop {
16419            let token = match self
16420                .hub
16421                .auth
16422                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16423                .await
16424            {
16425                Ok(token) => token,
16426                Err(e) => match dlg.token(e) {
16427                    Ok(token) => token,
16428                    Err(e) => {
16429                        dlg.finished(false);
16430                        return Err(common::Error::MissingToken(e));
16431                    }
16432                },
16433            };
16434            request_value_reader
16435                .seek(std::io::SeekFrom::Start(0))
16436                .unwrap();
16437            let mut req_result = {
16438                let client = &self.hub.client;
16439                dlg.pre_request();
16440                let mut req_builder = hyper::Request::builder()
16441                    .method(hyper::Method::POST)
16442                    .uri(url.as_str())
16443                    .header(USER_AGENT, self.hub._user_agent.clone());
16444
16445                if let Some(token) = token.as_ref() {
16446                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16447                }
16448
16449                let request = req_builder
16450                    .header(CONTENT_TYPE, json_mime_type.to_string())
16451                    .header(CONTENT_LENGTH, request_size as u64)
16452                    .body(common::to_body(
16453                        request_value_reader.get_ref().clone().into(),
16454                    ));
16455
16456                client.request(request.unwrap()).await
16457            };
16458
16459            match req_result {
16460                Err(err) => {
16461                    if let common::Retry::After(d) = dlg.http_error(&err) {
16462                        sleep(d).await;
16463                        continue;
16464                    }
16465                    dlg.finished(false);
16466                    return Err(common::Error::HttpError(err));
16467                }
16468                Ok(res) => {
16469                    let (mut parts, body) = res.into_parts();
16470                    let mut body = common::Body::new(body);
16471                    if !parts.status.is_success() {
16472                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16473                        let error = serde_json::from_str(&common::to_string(&bytes));
16474                        let response = common::to_response(parts, bytes.into());
16475
16476                        if let common::Retry::After(d) =
16477                            dlg.http_failure(&response, error.as_ref().ok())
16478                        {
16479                            sleep(d).await;
16480                            continue;
16481                        }
16482
16483                        dlg.finished(false);
16484
16485                        return Err(match error {
16486                            Ok(value) => common::Error::BadRequest(value),
16487                            _ => common::Error::Failure(response),
16488                        });
16489                    }
16490                    let response = {
16491                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16492                        let encoded = common::to_string(&bytes);
16493                        match serde_json::from_str(&encoded) {
16494                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16495                            Err(error) => {
16496                                dlg.response_json_decode_error(&encoded, &error);
16497                                return Err(common::Error::JsonDecodeError(
16498                                    encoded.to_string(),
16499                                    error,
16500                                ));
16501                            }
16502                        }
16503                    };
16504
16505                    dlg.finished(true);
16506                    return Ok(response);
16507                }
16508            }
16509        }
16510    }
16511
16512    ///
16513    /// Sets the *request* property to the given value.
16514    ///
16515    /// Even though the property as already been set when instantiating this call,
16516    /// we provide this method for API completeness.
16517    pub fn request(mut self, new_value: Channel) -> AdvertiserChannelCreateCall<'a, C> {
16518        self._request = new_value;
16519        self
16520    }
16521    /// The ID of the advertiser that owns the created channel.
16522    ///
16523    /// Sets the *advertiser id* path property to the given value.
16524    ///
16525    /// Even though the property as already been set when instantiating this call,
16526    /// we provide this method for API completeness.
16527    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserChannelCreateCall<'a, C> {
16528        self._advertiser_id = new_value;
16529        self
16530    }
16531    /// The ID of the partner that owns the created channel.
16532    ///
16533    /// Sets the *partner id* query property to the given value.
16534    pub fn partner_id(mut self, new_value: i64) -> AdvertiserChannelCreateCall<'a, C> {
16535        self._partner_id = Some(new_value);
16536        self
16537    }
16538    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16539    /// while executing the actual API request.
16540    ///
16541    /// ````text
16542    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16543    /// ````
16544    ///
16545    /// Sets the *delegate* property to the given value.
16546    pub fn delegate(
16547        mut self,
16548        new_value: &'a mut dyn common::Delegate,
16549    ) -> AdvertiserChannelCreateCall<'a, C> {
16550        self._delegate = Some(new_value);
16551        self
16552    }
16553
16554    /// Set any additional parameter of the query string used in the request.
16555    /// It should be used to set parameters which are not yet available through their own
16556    /// setters.
16557    ///
16558    /// Please note that this method must not be used to set any of the known parameters
16559    /// which have their own setter method. If done anyway, the request will fail.
16560    ///
16561    /// # Additional Parameters
16562    ///
16563    /// * *$.xgafv* (query-string) - V1 error format.
16564    /// * *access_token* (query-string) - OAuth access token.
16565    /// * *alt* (query-string) - Data format for response.
16566    /// * *callback* (query-string) - JSONP
16567    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16568    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16569    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16570    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16571    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16572    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16573    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16574    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserChannelCreateCall<'a, C>
16575    where
16576        T: AsRef<str>,
16577    {
16578        self._additional_params
16579            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16580        self
16581    }
16582
16583    /// Identifies the authorization scope for the method you are building.
16584    ///
16585    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16586    /// [`Scope::DisplayVideo`].
16587    ///
16588    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16589    /// tokens for more than one scope.
16590    ///
16591    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16592    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16593    /// sufficient, a read-write scope will do as well.
16594    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserChannelCreateCall<'a, C>
16595    where
16596        St: AsRef<str>,
16597    {
16598        self._scopes.insert(String::from(scope.as_ref()));
16599        self
16600    }
16601    /// Identifies the authorization scope(s) for the method you are building.
16602    ///
16603    /// See [`Self::add_scope()`] for details.
16604    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserChannelCreateCall<'a, C>
16605    where
16606        I: IntoIterator<Item = St>,
16607        St: AsRef<str>,
16608    {
16609        self._scopes
16610            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16611        self
16612    }
16613
16614    /// Removes all scopes, and no default scope will be used either.
16615    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16616    /// for details).
16617    pub fn clear_scopes(mut self) -> AdvertiserChannelCreateCall<'a, C> {
16618        self._scopes.clear();
16619        self
16620    }
16621}
16622
16623/// Gets a channel for a partner or advertiser.
16624///
16625/// A builder for the *channels.get* method supported by a *advertiser* resource.
16626/// It is not used directly, but through a [`AdvertiserMethods`] instance.
16627///
16628/// # Example
16629///
16630/// Instantiate a resource method builder
16631///
16632/// ```test_harness,no_run
16633/// # extern crate hyper;
16634/// # extern crate hyper_rustls;
16635/// # extern crate google_displayvideo1 as displayvideo1;
16636/// # async fn dox() {
16637/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16638///
16639/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16640/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16641/// #     secret,
16642/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16643/// # ).build().await.unwrap();
16644///
16645/// # let client = hyper_util::client::legacy::Client::builder(
16646/// #     hyper_util::rt::TokioExecutor::new()
16647/// # )
16648/// # .build(
16649/// #     hyper_rustls::HttpsConnectorBuilder::new()
16650/// #         .with_native_roots()
16651/// #         .unwrap()
16652/// #         .https_or_http()
16653/// #         .enable_http1()
16654/// #         .build()
16655/// # );
16656/// # let mut hub = DisplayVideo::new(client, auth);
16657/// // You can configure optional parameters by calling the respective setters at will, and
16658/// // execute the final call using `doit()`.
16659/// // Values shown here are possibly random and not representative !
16660/// let result = hub.advertisers().channels_get(-6, -29)
16661///              .partner_id(-61)
16662///              .doit().await;
16663/// # }
16664/// ```
16665pub struct AdvertiserChannelGetCall<'a, C>
16666where
16667    C: 'a,
16668{
16669    hub: &'a DisplayVideo<C>,
16670    _advertiser_id: i64,
16671    _channel_id: i64,
16672    _partner_id: Option<i64>,
16673    _delegate: Option<&'a mut dyn common::Delegate>,
16674    _additional_params: HashMap<String, String>,
16675    _scopes: BTreeSet<String>,
16676}
16677
16678impl<'a, C> common::CallBuilder for AdvertiserChannelGetCall<'a, C> {}
16679
16680impl<'a, C> AdvertiserChannelGetCall<'a, C>
16681where
16682    C: common::Connector,
16683{
16684    /// Perform the operation you have build so far.
16685    pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
16686        use std::borrow::Cow;
16687        use std::io::{Read, Seek};
16688
16689        use common::{url::Params, ToParts};
16690        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16691
16692        let mut dd = common::DefaultDelegate;
16693        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16694        dlg.begin(common::MethodInfo {
16695            id: "displayvideo.advertisers.channels.get",
16696            http_method: hyper::Method::GET,
16697        });
16698
16699        for &field in ["alt", "advertiserId", "channelId", "partnerId"].iter() {
16700            if self._additional_params.contains_key(field) {
16701                dlg.finished(false);
16702                return Err(common::Error::FieldClash(field));
16703            }
16704        }
16705
16706        let mut params = Params::with_capacity(5 + self._additional_params.len());
16707        params.push("advertiserId", self._advertiser_id.to_string());
16708        params.push("channelId", self._channel_id.to_string());
16709        if let Some(value) = self._partner_id.as_ref() {
16710            params.push("partnerId", value.to_string());
16711        }
16712
16713        params.extend(self._additional_params.iter());
16714
16715        params.push("alt", "json");
16716        let mut url =
16717            self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/channels/{+channelId}";
16718        if self._scopes.is_empty() {
16719            self._scopes
16720                .insert(Scope::DisplayVideo.as_ref().to_string());
16721        }
16722
16723        #[allow(clippy::single_element_loop)]
16724        for &(find_this, param_name) in [
16725            ("{+advertiserId}", "advertiserId"),
16726            ("{+channelId}", "channelId"),
16727        ]
16728        .iter()
16729        {
16730            url = params.uri_replacement(url, param_name, find_this, true);
16731        }
16732        {
16733            let to_remove = ["channelId", "advertiserId"];
16734            params.remove_params(&to_remove);
16735        }
16736
16737        let url = params.parse_with_url(&url);
16738
16739        loop {
16740            let token = match self
16741                .hub
16742                .auth
16743                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16744                .await
16745            {
16746                Ok(token) => token,
16747                Err(e) => match dlg.token(e) {
16748                    Ok(token) => token,
16749                    Err(e) => {
16750                        dlg.finished(false);
16751                        return Err(common::Error::MissingToken(e));
16752                    }
16753                },
16754            };
16755            let mut req_result = {
16756                let client = &self.hub.client;
16757                dlg.pre_request();
16758                let mut req_builder = hyper::Request::builder()
16759                    .method(hyper::Method::GET)
16760                    .uri(url.as_str())
16761                    .header(USER_AGENT, self.hub._user_agent.clone());
16762
16763                if let Some(token) = token.as_ref() {
16764                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16765                }
16766
16767                let request = req_builder
16768                    .header(CONTENT_LENGTH, 0_u64)
16769                    .body(common::to_body::<String>(None));
16770
16771                client.request(request.unwrap()).await
16772            };
16773
16774            match req_result {
16775                Err(err) => {
16776                    if let common::Retry::After(d) = dlg.http_error(&err) {
16777                        sleep(d).await;
16778                        continue;
16779                    }
16780                    dlg.finished(false);
16781                    return Err(common::Error::HttpError(err));
16782                }
16783                Ok(res) => {
16784                    let (mut parts, body) = res.into_parts();
16785                    let mut body = common::Body::new(body);
16786                    if !parts.status.is_success() {
16787                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16788                        let error = serde_json::from_str(&common::to_string(&bytes));
16789                        let response = common::to_response(parts, bytes.into());
16790
16791                        if let common::Retry::After(d) =
16792                            dlg.http_failure(&response, error.as_ref().ok())
16793                        {
16794                            sleep(d).await;
16795                            continue;
16796                        }
16797
16798                        dlg.finished(false);
16799
16800                        return Err(match error {
16801                            Ok(value) => common::Error::BadRequest(value),
16802                            _ => common::Error::Failure(response),
16803                        });
16804                    }
16805                    let response = {
16806                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16807                        let encoded = common::to_string(&bytes);
16808                        match serde_json::from_str(&encoded) {
16809                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16810                            Err(error) => {
16811                                dlg.response_json_decode_error(&encoded, &error);
16812                                return Err(common::Error::JsonDecodeError(
16813                                    encoded.to_string(),
16814                                    error,
16815                                ));
16816                            }
16817                        }
16818                    };
16819
16820                    dlg.finished(true);
16821                    return Ok(response);
16822                }
16823            }
16824        }
16825    }
16826
16827    /// The ID of the advertiser that owns the fetched channel.
16828    ///
16829    /// Sets the *advertiser id* path property to the given value.
16830    ///
16831    /// Even though the property as already been set when instantiating this call,
16832    /// we provide this method for API completeness.
16833    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserChannelGetCall<'a, C> {
16834        self._advertiser_id = new_value;
16835        self
16836    }
16837    /// Required. The ID of the channel to fetch.
16838    ///
16839    /// Sets the *channel id* path property to the given value.
16840    ///
16841    /// Even though the property as already been set when instantiating this call,
16842    /// we provide this method for API completeness.
16843    pub fn channel_id(mut self, new_value: i64) -> AdvertiserChannelGetCall<'a, C> {
16844        self._channel_id = new_value;
16845        self
16846    }
16847    /// The ID of the partner that owns the fetched channel.
16848    ///
16849    /// Sets the *partner id* query property to the given value.
16850    pub fn partner_id(mut self, new_value: i64) -> AdvertiserChannelGetCall<'a, C> {
16851        self._partner_id = Some(new_value);
16852        self
16853    }
16854    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16855    /// while executing the actual API request.
16856    ///
16857    /// ````text
16858    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16859    /// ````
16860    ///
16861    /// Sets the *delegate* property to the given value.
16862    pub fn delegate(
16863        mut self,
16864        new_value: &'a mut dyn common::Delegate,
16865    ) -> AdvertiserChannelGetCall<'a, C> {
16866        self._delegate = Some(new_value);
16867        self
16868    }
16869
16870    /// Set any additional parameter of the query string used in the request.
16871    /// It should be used to set parameters which are not yet available through their own
16872    /// setters.
16873    ///
16874    /// Please note that this method must not be used to set any of the known parameters
16875    /// which have their own setter method. If done anyway, the request will fail.
16876    ///
16877    /// # Additional Parameters
16878    ///
16879    /// * *$.xgafv* (query-string) - V1 error format.
16880    /// * *access_token* (query-string) - OAuth access token.
16881    /// * *alt* (query-string) - Data format for response.
16882    /// * *callback* (query-string) - JSONP
16883    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16884    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16885    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16886    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16887    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16888    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16889    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16890    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserChannelGetCall<'a, C>
16891    where
16892        T: AsRef<str>,
16893    {
16894        self._additional_params
16895            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16896        self
16897    }
16898
16899    /// Identifies the authorization scope for the method you are building.
16900    ///
16901    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16902    /// [`Scope::DisplayVideo`].
16903    ///
16904    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16905    /// tokens for more than one scope.
16906    ///
16907    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16908    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16909    /// sufficient, a read-write scope will do as well.
16910    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserChannelGetCall<'a, C>
16911    where
16912        St: AsRef<str>,
16913    {
16914        self._scopes.insert(String::from(scope.as_ref()));
16915        self
16916    }
16917    /// Identifies the authorization scope(s) for the method you are building.
16918    ///
16919    /// See [`Self::add_scope()`] for details.
16920    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserChannelGetCall<'a, C>
16921    where
16922        I: IntoIterator<Item = St>,
16923        St: AsRef<str>,
16924    {
16925        self._scopes
16926            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16927        self
16928    }
16929
16930    /// Removes all scopes, and no default scope will be used either.
16931    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16932    /// for details).
16933    pub fn clear_scopes(mut self) -> AdvertiserChannelGetCall<'a, C> {
16934        self._scopes.clear();
16935        self
16936    }
16937}
16938
16939/// Lists channels for a partner or advertiser.
16940///
16941/// A builder for the *channels.list* method supported by a *advertiser* resource.
16942/// It is not used directly, but through a [`AdvertiserMethods`] instance.
16943///
16944/// # Example
16945///
16946/// Instantiate a resource method builder
16947///
16948/// ```test_harness,no_run
16949/// # extern crate hyper;
16950/// # extern crate hyper_rustls;
16951/// # extern crate google_displayvideo1 as displayvideo1;
16952/// # async fn dox() {
16953/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16954///
16955/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16956/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16957/// #     secret,
16958/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16959/// # ).build().await.unwrap();
16960///
16961/// # let client = hyper_util::client::legacy::Client::builder(
16962/// #     hyper_util::rt::TokioExecutor::new()
16963/// # )
16964/// # .build(
16965/// #     hyper_rustls::HttpsConnectorBuilder::new()
16966/// #         .with_native_roots()
16967/// #         .unwrap()
16968/// #         .https_or_http()
16969/// #         .enable_http1()
16970/// #         .build()
16971/// # );
16972/// # let mut hub = DisplayVideo::new(client, auth);
16973/// // You can configure optional parameters by calling the respective setters at will, and
16974/// // execute the final call using `doit()`.
16975/// // Values shown here are possibly random and not representative !
16976/// let result = hub.advertisers().channels_list(-100)
16977///              .partner_id(-23)
16978///              .page_token("takimata")
16979///              .page_size(-46)
16980///              .order_by("voluptua.")
16981///              .filter("et")
16982///              .doit().await;
16983/// # }
16984/// ```
16985pub struct AdvertiserChannelListCall<'a, C>
16986where
16987    C: 'a,
16988{
16989    hub: &'a DisplayVideo<C>,
16990    _advertiser_id: i64,
16991    _partner_id: Option<i64>,
16992    _page_token: Option<String>,
16993    _page_size: Option<i32>,
16994    _order_by: Option<String>,
16995    _filter: Option<String>,
16996    _delegate: Option<&'a mut dyn common::Delegate>,
16997    _additional_params: HashMap<String, String>,
16998    _scopes: BTreeSet<String>,
16999}
17000
17001impl<'a, C> common::CallBuilder for AdvertiserChannelListCall<'a, C> {}
17002
17003impl<'a, C> AdvertiserChannelListCall<'a, C>
17004where
17005    C: common::Connector,
17006{
17007    /// Perform the operation you have build so far.
17008    pub async fn doit(mut self) -> common::Result<(common::Response, ListChannelsResponse)> {
17009        use std::borrow::Cow;
17010        use std::io::{Read, Seek};
17011
17012        use common::{url::Params, ToParts};
17013        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17014
17015        let mut dd = common::DefaultDelegate;
17016        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17017        dlg.begin(common::MethodInfo {
17018            id: "displayvideo.advertisers.channels.list",
17019            http_method: hyper::Method::GET,
17020        });
17021
17022        for &field in [
17023            "alt",
17024            "advertiserId",
17025            "partnerId",
17026            "pageToken",
17027            "pageSize",
17028            "orderBy",
17029            "filter",
17030        ]
17031        .iter()
17032        {
17033            if self._additional_params.contains_key(field) {
17034                dlg.finished(false);
17035                return Err(common::Error::FieldClash(field));
17036            }
17037        }
17038
17039        let mut params = Params::with_capacity(8 + self._additional_params.len());
17040        params.push("advertiserId", self._advertiser_id.to_string());
17041        if let Some(value) = self._partner_id.as_ref() {
17042            params.push("partnerId", value.to_string());
17043        }
17044        if let Some(value) = self._page_token.as_ref() {
17045            params.push("pageToken", value);
17046        }
17047        if let Some(value) = self._page_size.as_ref() {
17048            params.push("pageSize", value.to_string());
17049        }
17050        if let Some(value) = self._order_by.as_ref() {
17051            params.push("orderBy", value);
17052        }
17053        if let Some(value) = self._filter.as_ref() {
17054            params.push("filter", value);
17055        }
17056
17057        params.extend(self._additional_params.iter());
17058
17059        params.push("alt", "json");
17060        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/channels";
17061        if self._scopes.is_empty() {
17062            self._scopes
17063                .insert(Scope::DisplayVideo.as_ref().to_string());
17064        }
17065
17066        #[allow(clippy::single_element_loop)]
17067        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
17068            url = params.uri_replacement(url, param_name, find_this, true);
17069        }
17070        {
17071            let to_remove = ["advertiserId"];
17072            params.remove_params(&to_remove);
17073        }
17074
17075        let url = params.parse_with_url(&url);
17076
17077        loop {
17078            let token = match self
17079                .hub
17080                .auth
17081                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17082                .await
17083            {
17084                Ok(token) => token,
17085                Err(e) => match dlg.token(e) {
17086                    Ok(token) => token,
17087                    Err(e) => {
17088                        dlg.finished(false);
17089                        return Err(common::Error::MissingToken(e));
17090                    }
17091                },
17092            };
17093            let mut req_result = {
17094                let client = &self.hub.client;
17095                dlg.pre_request();
17096                let mut req_builder = hyper::Request::builder()
17097                    .method(hyper::Method::GET)
17098                    .uri(url.as_str())
17099                    .header(USER_AGENT, self.hub._user_agent.clone());
17100
17101                if let Some(token) = token.as_ref() {
17102                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17103                }
17104
17105                let request = req_builder
17106                    .header(CONTENT_LENGTH, 0_u64)
17107                    .body(common::to_body::<String>(None));
17108
17109                client.request(request.unwrap()).await
17110            };
17111
17112            match req_result {
17113                Err(err) => {
17114                    if let common::Retry::After(d) = dlg.http_error(&err) {
17115                        sleep(d).await;
17116                        continue;
17117                    }
17118                    dlg.finished(false);
17119                    return Err(common::Error::HttpError(err));
17120                }
17121                Ok(res) => {
17122                    let (mut parts, body) = res.into_parts();
17123                    let mut body = common::Body::new(body);
17124                    if !parts.status.is_success() {
17125                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17126                        let error = serde_json::from_str(&common::to_string(&bytes));
17127                        let response = common::to_response(parts, bytes.into());
17128
17129                        if let common::Retry::After(d) =
17130                            dlg.http_failure(&response, error.as_ref().ok())
17131                        {
17132                            sleep(d).await;
17133                            continue;
17134                        }
17135
17136                        dlg.finished(false);
17137
17138                        return Err(match error {
17139                            Ok(value) => common::Error::BadRequest(value),
17140                            _ => common::Error::Failure(response),
17141                        });
17142                    }
17143                    let response = {
17144                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17145                        let encoded = common::to_string(&bytes);
17146                        match serde_json::from_str(&encoded) {
17147                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17148                            Err(error) => {
17149                                dlg.response_json_decode_error(&encoded, &error);
17150                                return Err(common::Error::JsonDecodeError(
17151                                    encoded.to_string(),
17152                                    error,
17153                                ));
17154                            }
17155                        }
17156                    };
17157
17158                    dlg.finished(true);
17159                    return Ok(response);
17160                }
17161            }
17162        }
17163    }
17164
17165    /// The ID of the advertiser that owns the channels.
17166    ///
17167    /// Sets the *advertiser id* path property to the given value.
17168    ///
17169    /// Even though the property as already been set when instantiating this call,
17170    /// we provide this method for API completeness.
17171    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserChannelListCall<'a, C> {
17172        self._advertiser_id = new_value;
17173        self
17174    }
17175    /// The ID of the partner that owns the channels.
17176    ///
17177    /// Sets the *partner id* query property to the given value.
17178    pub fn partner_id(mut self, new_value: i64) -> AdvertiserChannelListCall<'a, C> {
17179        self._partner_id = Some(new_value);
17180        self
17181    }
17182    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListChannels` method. If not specified, the first page of results will be returned.
17183    ///
17184    /// Sets the *page token* query property to the given value.
17185    pub fn page_token(mut self, new_value: &str) -> AdvertiserChannelListCall<'a, C> {
17186        self._page_token = Some(new_value.to_string());
17187        self
17188    }
17189    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
17190    ///
17191    /// Sets the *page size* query property to the given value.
17192    pub fn page_size(mut self, new_value: i32) -> AdvertiserChannelListCall<'a, C> {
17193        self._page_size = Some(new_value);
17194        self
17195    }
17196    /// Field by which to sort the list. Acceptable values are: * `displayName` (default) * `channelId` The default sorting order is ascending. To specify descending order for a field, a suffix " desc" should be added to the field name. Example: `displayName desc`.
17197    ///
17198    /// Sets the *order by* query property to the given value.
17199    pub fn order_by(mut self, new_value: &str) -> AdvertiserChannelListCall<'a, C> {
17200        self._order_by = Some(new_value.to_string());
17201        self
17202    }
17203    /// Allows filtering by channel fields. Supported syntax: * Filter expressions for channel can only contain at most one restriction. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `HAS (:)` operator. Supported fields: * `displayName` Examples: * All channels for which the display name contains “google”: `displayName : "google"`. The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
17204    ///
17205    /// Sets the *filter* query property to the given value.
17206    pub fn filter(mut self, new_value: &str) -> AdvertiserChannelListCall<'a, C> {
17207        self._filter = Some(new_value.to_string());
17208        self
17209    }
17210    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17211    /// while executing the actual API request.
17212    ///
17213    /// ````text
17214    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17215    /// ````
17216    ///
17217    /// Sets the *delegate* property to the given value.
17218    pub fn delegate(
17219        mut self,
17220        new_value: &'a mut dyn common::Delegate,
17221    ) -> AdvertiserChannelListCall<'a, C> {
17222        self._delegate = Some(new_value);
17223        self
17224    }
17225
17226    /// Set any additional parameter of the query string used in the request.
17227    /// It should be used to set parameters which are not yet available through their own
17228    /// setters.
17229    ///
17230    /// Please note that this method must not be used to set any of the known parameters
17231    /// which have their own setter method. If done anyway, the request will fail.
17232    ///
17233    /// # Additional Parameters
17234    ///
17235    /// * *$.xgafv* (query-string) - V1 error format.
17236    /// * *access_token* (query-string) - OAuth access token.
17237    /// * *alt* (query-string) - Data format for response.
17238    /// * *callback* (query-string) - JSONP
17239    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17240    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17241    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17242    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17243    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17244    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17245    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17246    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserChannelListCall<'a, C>
17247    where
17248        T: AsRef<str>,
17249    {
17250        self._additional_params
17251            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17252        self
17253    }
17254
17255    /// Identifies the authorization scope for the method you are building.
17256    ///
17257    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17258    /// [`Scope::DisplayVideo`].
17259    ///
17260    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17261    /// tokens for more than one scope.
17262    ///
17263    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17264    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17265    /// sufficient, a read-write scope will do as well.
17266    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserChannelListCall<'a, C>
17267    where
17268        St: AsRef<str>,
17269    {
17270        self._scopes.insert(String::from(scope.as_ref()));
17271        self
17272    }
17273    /// Identifies the authorization scope(s) for the method you are building.
17274    ///
17275    /// See [`Self::add_scope()`] for details.
17276    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserChannelListCall<'a, C>
17277    where
17278        I: IntoIterator<Item = St>,
17279        St: AsRef<str>,
17280    {
17281        self._scopes
17282            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17283        self
17284    }
17285
17286    /// Removes all scopes, and no default scope will be used either.
17287    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17288    /// for details).
17289    pub fn clear_scopes(mut self) -> AdvertiserChannelListCall<'a, C> {
17290        self._scopes.clear();
17291        self
17292    }
17293}
17294
17295/// Updates a channel. Returns the updated channel if successful.
17296///
17297/// A builder for the *channels.patch* method supported by a *advertiser* resource.
17298/// It is not used directly, but through a [`AdvertiserMethods`] instance.
17299///
17300/// # Example
17301///
17302/// Instantiate a resource method builder
17303///
17304/// ```test_harness,no_run
17305/// # extern crate hyper;
17306/// # extern crate hyper_rustls;
17307/// # extern crate google_displayvideo1 as displayvideo1;
17308/// use displayvideo1::api::Channel;
17309/// # async fn dox() {
17310/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17311///
17312/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17313/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17314/// #     secret,
17315/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17316/// # ).build().await.unwrap();
17317///
17318/// # let client = hyper_util::client::legacy::Client::builder(
17319/// #     hyper_util::rt::TokioExecutor::new()
17320/// # )
17321/// # .build(
17322/// #     hyper_rustls::HttpsConnectorBuilder::new()
17323/// #         .with_native_roots()
17324/// #         .unwrap()
17325/// #         .https_or_http()
17326/// #         .enable_http1()
17327/// #         .build()
17328/// # );
17329/// # let mut hub = DisplayVideo::new(client, auth);
17330/// // As the method needs a request, you would usually fill it with the desired information
17331/// // into the respective structure. Some of the parts shown here might not be applicable !
17332/// // Values shown here are possibly random and not representative !
17333/// let mut req = Channel::default();
17334///
17335/// // You can configure optional parameters by calling the respective setters at will, and
17336/// // execute the final call using `doit()`.
17337/// // Values shown here are possibly random and not representative !
17338/// let result = hub.advertisers().channels_patch(req, -31, -96)
17339///              .update_mask(FieldMask::new::<&str>(&[]))
17340///              .partner_id(-2)
17341///              .doit().await;
17342/// # }
17343/// ```
17344pub struct AdvertiserChannelPatchCall<'a, C>
17345where
17346    C: 'a,
17347{
17348    hub: &'a DisplayVideo<C>,
17349    _request: Channel,
17350    _advertiser_id: i64,
17351    _channel_id: i64,
17352    _update_mask: Option<common::FieldMask>,
17353    _partner_id: Option<i64>,
17354    _delegate: Option<&'a mut dyn common::Delegate>,
17355    _additional_params: HashMap<String, String>,
17356    _scopes: BTreeSet<String>,
17357}
17358
17359impl<'a, C> common::CallBuilder for AdvertiserChannelPatchCall<'a, C> {}
17360
17361impl<'a, C> AdvertiserChannelPatchCall<'a, C>
17362where
17363    C: common::Connector,
17364{
17365    /// Perform the operation you have build so far.
17366    pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
17367        use std::borrow::Cow;
17368        use std::io::{Read, Seek};
17369
17370        use common::{url::Params, ToParts};
17371        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17372
17373        let mut dd = common::DefaultDelegate;
17374        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17375        dlg.begin(common::MethodInfo {
17376            id: "displayvideo.advertisers.channels.patch",
17377            http_method: hyper::Method::PATCH,
17378        });
17379
17380        for &field in [
17381            "alt",
17382            "advertiserId",
17383            "channelId",
17384            "updateMask",
17385            "partnerId",
17386        ]
17387        .iter()
17388        {
17389            if self._additional_params.contains_key(field) {
17390                dlg.finished(false);
17391                return Err(common::Error::FieldClash(field));
17392            }
17393        }
17394
17395        let mut params = Params::with_capacity(7 + self._additional_params.len());
17396        params.push("advertiserId", self._advertiser_id.to_string());
17397        params.push("channelId", self._channel_id.to_string());
17398        if let Some(value) = self._update_mask.as_ref() {
17399            params.push("updateMask", value.to_string());
17400        }
17401        if let Some(value) = self._partner_id.as_ref() {
17402            params.push("partnerId", value.to_string());
17403        }
17404
17405        params.extend(self._additional_params.iter());
17406
17407        params.push("alt", "json");
17408        let mut url =
17409            self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/channels/{channelId}";
17410        if self._scopes.is_empty() {
17411            self._scopes
17412                .insert(Scope::DisplayVideo.as_ref().to_string());
17413        }
17414
17415        #[allow(clippy::single_element_loop)]
17416        for &(find_this, param_name) in [
17417            ("{+advertiserId}", "advertiserId"),
17418            ("{channelId}", "channelId"),
17419        ]
17420        .iter()
17421        {
17422            url = params.uri_replacement(url, param_name, find_this, true);
17423        }
17424        {
17425            let to_remove = ["channelId", "advertiserId"];
17426            params.remove_params(&to_remove);
17427        }
17428
17429        let url = params.parse_with_url(&url);
17430
17431        let mut json_mime_type = mime::APPLICATION_JSON;
17432        let mut request_value_reader = {
17433            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17434            common::remove_json_null_values(&mut value);
17435            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17436            serde_json::to_writer(&mut dst, &value).unwrap();
17437            dst
17438        };
17439        let request_size = request_value_reader
17440            .seek(std::io::SeekFrom::End(0))
17441            .unwrap();
17442        request_value_reader
17443            .seek(std::io::SeekFrom::Start(0))
17444            .unwrap();
17445
17446        loop {
17447            let token = match self
17448                .hub
17449                .auth
17450                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17451                .await
17452            {
17453                Ok(token) => token,
17454                Err(e) => match dlg.token(e) {
17455                    Ok(token) => token,
17456                    Err(e) => {
17457                        dlg.finished(false);
17458                        return Err(common::Error::MissingToken(e));
17459                    }
17460                },
17461            };
17462            request_value_reader
17463                .seek(std::io::SeekFrom::Start(0))
17464                .unwrap();
17465            let mut req_result = {
17466                let client = &self.hub.client;
17467                dlg.pre_request();
17468                let mut req_builder = hyper::Request::builder()
17469                    .method(hyper::Method::PATCH)
17470                    .uri(url.as_str())
17471                    .header(USER_AGENT, self.hub._user_agent.clone());
17472
17473                if let Some(token) = token.as_ref() {
17474                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17475                }
17476
17477                let request = req_builder
17478                    .header(CONTENT_TYPE, json_mime_type.to_string())
17479                    .header(CONTENT_LENGTH, request_size as u64)
17480                    .body(common::to_body(
17481                        request_value_reader.get_ref().clone().into(),
17482                    ));
17483
17484                client.request(request.unwrap()).await
17485            };
17486
17487            match req_result {
17488                Err(err) => {
17489                    if let common::Retry::After(d) = dlg.http_error(&err) {
17490                        sleep(d).await;
17491                        continue;
17492                    }
17493                    dlg.finished(false);
17494                    return Err(common::Error::HttpError(err));
17495                }
17496                Ok(res) => {
17497                    let (mut parts, body) = res.into_parts();
17498                    let mut body = common::Body::new(body);
17499                    if !parts.status.is_success() {
17500                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17501                        let error = serde_json::from_str(&common::to_string(&bytes));
17502                        let response = common::to_response(parts, bytes.into());
17503
17504                        if let common::Retry::After(d) =
17505                            dlg.http_failure(&response, error.as_ref().ok())
17506                        {
17507                            sleep(d).await;
17508                            continue;
17509                        }
17510
17511                        dlg.finished(false);
17512
17513                        return Err(match error {
17514                            Ok(value) => common::Error::BadRequest(value),
17515                            _ => common::Error::Failure(response),
17516                        });
17517                    }
17518                    let response = {
17519                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17520                        let encoded = common::to_string(&bytes);
17521                        match serde_json::from_str(&encoded) {
17522                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17523                            Err(error) => {
17524                                dlg.response_json_decode_error(&encoded, &error);
17525                                return Err(common::Error::JsonDecodeError(
17526                                    encoded.to_string(),
17527                                    error,
17528                                ));
17529                            }
17530                        }
17531                    };
17532
17533                    dlg.finished(true);
17534                    return Ok(response);
17535                }
17536            }
17537        }
17538    }
17539
17540    ///
17541    /// Sets the *request* property to the given value.
17542    ///
17543    /// Even though the property as already been set when instantiating this call,
17544    /// we provide this method for API completeness.
17545    pub fn request(mut self, new_value: Channel) -> AdvertiserChannelPatchCall<'a, C> {
17546        self._request = new_value;
17547        self
17548    }
17549    /// The ID of the advertiser that owns the created channel.
17550    ///
17551    /// Sets the *advertiser id* path property to the given value.
17552    ///
17553    /// Even though the property as already been set when instantiating this call,
17554    /// we provide this method for API completeness.
17555    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserChannelPatchCall<'a, C> {
17556        self._advertiser_id = new_value;
17557        self
17558    }
17559    /// Output only. The unique ID of the channel. Assigned by the system.
17560    ///
17561    /// Sets the *channel id* path property to the given value.
17562    ///
17563    /// Even though the property as already been set when instantiating this call,
17564    /// we provide this method for API completeness.
17565    pub fn channel_id(mut self, new_value: i64) -> AdvertiserChannelPatchCall<'a, C> {
17566        self._channel_id = new_value;
17567        self
17568    }
17569    /// Required. The mask to control which fields to update.
17570    ///
17571    /// Sets the *update mask* query property to the given value.
17572    pub fn update_mask(
17573        mut self,
17574        new_value: common::FieldMask,
17575    ) -> AdvertiserChannelPatchCall<'a, C> {
17576        self._update_mask = Some(new_value);
17577        self
17578    }
17579    /// The ID of the partner that owns the created channel.
17580    ///
17581    /// Sets the *partner id* query property to the given value.
17582    pub fn partner_id(mut self, new_value: i64) -> AdvertiserChannelPatchCall<'a, C> {
17583        self._partner_id = Some(new_value);
17584        self
17585    }
17586    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17587    /// while executing the actual API request.
17588    ///
17589    /// ````text
17590    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17591    /// ````
17592    ///
17593    /// Sets the *delegate* property to the given value.
17594    pub fn delegate(
17595        mut self,
17596        new_value: &'a mut dyn common::Delegate,
17597    ) -> AdvertiserChannelPatchCall<'a, C> {
17598        self._delegate = Some(new_value);
17599        self
17600    }
17601
17602    /// Set any additional parameter of the query string used in the request.
17603    /// It should be used to set parameters which are not yet available through their own
17604    /// setters.
17605    ///
17606    /// Please note that this method must not be used to set any of the known parameters
17607    /// which have their own setter method. If done anyway, the request will fail.
17608    ///
17609    /// # Additional Parameters
17610    ///
17611    /// * *$.xgafv* (query-string) - V1 error format.
17612    /// * *access_token* (query-string) - OAuth access token.
17613    /// * *alt* (query-string) - Data format for response.
17614    /// * *callback* (query-string) - JSONP
17615    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17616    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17617    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17618    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17619    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17620    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17621    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17622    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserChannelPatchCall<'a, C>
17623    where
17624        T: AsRef<str>,
17625    {
17626        self._additional_params
17627            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17628        self
17629    }
17630
17631    /// Identifies the authorization scope for the method you are building.
17632    ///
17633    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17634    /// [`Scope::DisplayVideo`].
17635    ///
17636    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17637    /// tokens for more than one scope.
17638    ///
17639    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17640    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17641    /// sufficient, a read-write scope will do as well.
17642    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserChannelPatchCall<'a, C>
17643    where
17644        St: AsRef<str>,
17645    {
17646        self._scopes.insert(String::from(scope.as_ref()));
17647        self
17648    }
17649    /// Identifies the authorization scope(s) for the method you are building.
17650    ///
17651    /// See [`Self::add_scope()`] for details.
17652    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserChannelPatchCall<'a, C>
17653    where
17654        I: IntoIterator<Item = St>,
17655        St: AsRef<str>,
17656    {
17657        self._scopes
17658            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17659        self
17660    }
17661
17662    /// Removes all scopes, and no default scope will be used either.
17663    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17664    /// for details).
17665    pub fn clear_scopes(mut self) -> AdvertiserChannelPatchCall<'a, C> {
17666        self._scopes.clear();
17667        self
17668    }
17669}
17670
17671/// Creates a new creative. Returns the newly created creative if successful. A [“Standard” user role](https://developers.google.com//support.google.com/displayvideo/answer/2723011) or greater for the parent advertiser or partner is required to make this request.
17672///
17673/// A builder for the *creatives.create* method supported by a *advertiser* resource.
17674/// It is not used directly, but through a [`AdvertiserMethods`] instance.
17675///
17676/// # Example
17677///
17678/// Instantiate a resource method builder
17679///
17680/// ```test_harness,no_run
17681/// # extern crate hyper;
17682/// # extern crate hyper_rustls;
17683/// # extern crate google_displayvideo1 as displayvideo1;
17684/// use displayvideo1::api::Creative;
17685/// # async fn dox() {
17686/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17687///
17688/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17689/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17690/// #     secret,
17691/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17692/// # ).build().await.unwrap();
17693///
17694/// # let client = hyper_util::client::legacy::Client::builder(
17695/// #     hyper_util::rt::TokioExecutor::new()
17696/// # )
17697/// # .build(
17698/// #     hyper_rustls::HttpsConnectorBuilder::new()
17699/// #         .with_native_roots()
17700/// #         .unwrap()
17701/// #         .https_or_http()
17702/// #         .enable_http1()
17703/// #         .build()
17704/// # );
17705/// # let mut hub = DisplayVideo::new(client, auth);
17706/// // As the method needs a request, you would usually fill it with the desired information
17707/// // into the respective structure. Some of the parts shown here might not be applicable !
17708/// // Values shown here are possibly random and not representative !
17709/// let mut req = Creative::default();
17710///
17711/// // You can configure optional parameters by calling the respective setters at will, and
17712/// // execute the final call using `doit()`.
17713/// // Values shown here are possibly random and not representative !
17714/// let result = hub.advertisers().creatives_create(req, -30)
17715///              .doit().await;
17716/// # }
17717/// ```
17718pub struct AdvertiserCreativeCreateCall<'a, C>
17719where
17720    C: 'a,
17721{
17722    hub: &'a DisplayVideo<C>,
17723    _request: Creative,
17724    _advertiser_id: i64,
17725    _delegate: Option<&'a mut dyn common::Delegate>,
17726    _additional_params: HashMap<String, String>,
17727    _scopes: BTreeSet<String>,
17728}
17729
17730impl<'a, C> common::CallBuilder for AdvertiserCreativeCreateCall<'a, C> {}
17731
17732impl<'a, C> AdvertiserCreativeCreateCall<'a, C>
17733where
17734    C: common::Connector,
17735{
17736    /// Perform the operation you have build so far.
17737    pub async fn doit(mut self) -> common::Result<(common::Response, Creative)> {
17738        use std::borrow::Cow;
17739        use std::io::{Read, Seek};
17740
17741        use common::{url::Params, ToParts};
17742        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17743
17744        let mut dd = common::DefaultDelegate;
17745        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17746        dlg.begin(common::MethodInfo {
17747            id: "displayvideo.advertisers.creatives.create",
17748            http_method: hyper::Method::POST,
17749        });
17750
17751        for &field in ["alt", "advertiserId"].iter() {
17752            if self._additional_params.contains_key(field) {
17753                dlg.finished(false);
17754                return Err(common::Error::FieldClash(field));
17755            }
17756        }
17757
17758        let mut params = Params::with_capacity(4 + self._additional_params.len());
17759        params.push("advertiserId", self._advertiser_id.to_string());
17760
17761        params.extend(self._additional_params.iter());
17762
17763        params.push("alt", "json");
17764        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/creatives";
17765        if self._scopes.is_empty() {
17766            self._scopes
17767                .insert(Scope::DisplayVideo.as_ref().to_string());
17768        }
17769
17770        #[allow(clippy::single_element_loop)]
17771        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
17772            url = params.uri_replacement(url, param_name, find_this, true);
17773        }
17774        {
17775            let to_remove = ["advertiserId"];
17776            params.remove_params(&to_remove);
17777        }
17778
17779        let url = params.parse_with_url(&url);
17780
17781        let mut json_mime_type = mime::APPLICATION_JSON;
17782        let mut request_value_reader = {
17783            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17784            common::remove_json_null_values(&mut value);
17785            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17786            serde_json::to_writer(&mut dst, &value).unwrap();
17787            dst
17788        };
17789        let request_size = request_value_reader
17790            .seek(std::io::SeekFrom::End(0))
17791            .unwrap();
17792        request_value_reader
17793            .seek(std::io::SeekFrom::Start(0))
17794            .unwrap();
17795
17796        loop {
17797            let token = match self
17798                .hub
17799                .auth
17800                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17801                .await
17802            {
17803                Ok(token) => token,
17804                Err(e) => match dlg.token(e) {
17805                    Ok(token) => token,
17806                    Err(e) => {
17807                        dlg.finished(false);
17808                        return Err(common::Error::MissingToken(e));
17809                    }
17810                },
17811            };
17812            request_value_reader
17813                .seek(std::io::SeekFrom::Start(0))
17814                .unwrap();
17815            let mut req_result = {
17816                let client = &self.hub.client;
17817                dlg.pre_request();
17818                let mut req_builder = hyper::Request::builder()
17819                    .method(hyper::Method::POST)
17820                    .uri(url.as_str())
17821                    .header(USER_AGENT, self.hub._user_agent.clone());
17822
17823                if let Some(token) = token.as_ref() {
17824                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17825                }
17826
17827                let request = req_builder
17828                    .header(CONTENT_TYPE, json_mime_type.to_string())
17829                    .header(CONTENT_LENGTH, request_size as u64)
17830                    .body(common::to_body(
17831                        request_value_reader.get_ref().clone().into(),
17832                    ));
17833
17834                client.request(request.unwrap()).await
17835            };
17836
17837            match req_result {
17838                Err(err) => {
17839                    if let common::Retry::After(d) = dlg.http_error(&err) {
17840                        sleep(d).await;
17841                        continue;
17842                    }
17843                    dlg.finished(false);
17844                    return Err(common::Error::HttpError(err));
17845                }
17846                Ok(res) => {
17847                    let (mut parts, body) = res.into_parts();
17848                    let mut body = common::Body::new(body);
17849                    if !parts.status.is_success() {
17850                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17851                        let error = serde_json::from_str(&common::to_string(&bytes));
17852                        let response = common::to_response(parts, bytes.into());
17853
17854                        if let common::Retry::After(d) =
17855                            dlg.http_failure(&response, error.as_ref().ok())
17856                        {
17857                            sleep(d).await;
17858                            continue;
17859                        }
17860
17861                        dlg.finished(false);
17862
17863                        return Err(match error {
17864                            Ok(value) => common::Error::BadRequest(value),
17865                            _ => common::Error::Failure(response),
17866                        });
17867                    }
17868                    let response = {
17869                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17870                        let encoded = common::to_string(&bytes);
17871                        match serde_json::from_str(&encoded) {
17872                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17873                            Err(error) => {
17874                                dlg.response_json_decode_error(&encoded, &error);
17875                                return Err(common::Error::JsonDecodeError(
17876                                    encoded.to_string(),
17877                                    error,
17878                                ));
17879                            }
17880                        }
17881                    };
17882
17883                    dlg.finished(true);
17884                    return Ok(response);
17885                }
17886            }
17887        }
17888    }
17889
17890    ///
17891    /// Sets the *request* property to the given value.
17892    ///
17893    /// Even though the property as already been set when instantiating this call,
17894    /// we provide this method for API completeness.
17895    pub fn request(mut self, new_value: Creative) -> AdvertiserCreativeCreateCall<'a, C> {
17896        self._request = new_value;
17897        self
17898    }
17899    /// Output only. The unique ID of the advertiser the creative belongs to.
17900    ///
17901    /// Sets the *advertiser id* path property to the given value.
17902    ///
17903    /// Even though the property as already been set when instantiating this call,
17904    /// we provide this method for API completeness.
17905    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserCreativeCreateCall<'a, C> {
17906        self._advertiser_id = new_value;
17907        self
17908    }
17909    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17910    /// while executing the actual API request.
17911    ///
17912    /// ````text
17913    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17914    /// ````
17915    ///
17916    /// Sets the *delegate* property to the given value.
17917    pub fn delegate(
17918        mut self,
17919        new_value: &'a mut dyn common::Delegate,
17920    ) -> AdvertiserCreativeCreateCall<'a, C> {
17921        self._delegate = Some(new_value);
17922        self
17923    }
17924
17925    /// Set any additional parameter of the query string used in the request.
17926    /// It should be used to set parameters which are not yet available through their own
17927    /// setters.
17928    ///
17929    /// Please note that this method must not be used to set any of the known parameters
17930    /// which have their own setter method. If done anyway, the request will fail.
17931    ///
17932    /// # Additional Parameters
17933    ///
17934    /// * *$.xgafv* (query-string) - V1 error format.
17935    /// * *access_token* (query-string) - OAuth access token.
17936    /// * *alt* (query-string) - Data format for response.
17937    /// * *callback* (query-string) - JSONP
17938    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17939    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17940    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17941    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17942    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17943    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17944    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17945    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserCreativeCreateCall<'a, C>
17946    where
17947        T: AsRef<str>,
17948    {
17949        self._additional_params
17950            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17951        self
17952    }
17953
17954    /// Identifies the authorization scope for the method you are building.
17955    ///
17956    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17957    /// [`Scope::DisplayVideo`].
17958    ///
17959    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17960    /// tokens for more than one scope.
17961    ///
17962    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17963    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17964    /// sufficient, a read-write scope will do as well.
17965    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserCreativeCreateCall<'a, C>
17966    where
17967        St: AsRef<str>,
17968    {
17969        self._scopes.insert(String::from(scope.as_ref()));
17970        self
17971    }
17972    /// Identifies the authorization scope(s) for the method you are building.
17973    ///
17974    /// See [`Self::add_scope()`] for details.
17975    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserCreativeCreateCall<'a, C>
17976    where
17977        I: IntoIterator<Item = St>,
17978        St: AsRef<str>,
17979    {
17980        self._scopes
17981            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17982        self
17983    }
17984
17985    /// Removes all scopes, and no default scope will be used either.
17986    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17987    /// for details).
17988    pub fn clear_scopes(mut self) -> AdvertiserCreativeCreateCall<'a, C> {
17989        self._scopes.clear();
17990        self
17991    }
17992}
17993
17994/// Deletes a creative. Returns error code `NOT_FOUND` if the creative does not exist. The creative should be archived first, i.e. set entity_status to `ENTITY_STATUS_ARCHIVED`, before it can be deleted. A [“Standard” user role](https://developers.google.com//support.google.com/displayvideo/answer/2723011) or greater for the parent advertiser or partner is required to make this request.
17995///
17996/// A builder for the *creatives.delete* method supported by a *advertiser* resource.
17997/// It is not used directly, but through a [`AdvertiserMethods`] instance.
17998///
17999/// # Example
18000///
18001/// Instantiate a resource method builder
18002///
18003/// ```test_harness,no_run
18004/// # extern crate hyper;
18005/// # extern crate hyper_rustls;
18006/// # extern crate google_displayvideo1 as displayvideo1;
18007/// # async fn dox() {
18008/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18009///
18010/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18011/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18012/// #     secret,
18013/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18014/// # ).build().await.unwrap();
18015///
18016/// # let client = hyper_util::client::legacy::Client::builder(
18017/// #     hyper_util::rt::TokioExecutor::new()
18018/// # )
18019/// # .build(
18020/// #     hyper_rustls::HttpsConnectorBuilder::new()
18021/// #         .with_native_roots()
18022/// #         .unwrap()
18023/// #         .https_or_http()
18024/// #         .enable_http1()
18025/// #         .build()
18026/// # );
18027/// # let mut hub = DisplayVideo::new(client, auth);
18028/// // You can configure optional parameters by calling the respective setters at will, and
18029/// // execute the final call using `doit()`.
18030/// // Values shown here are possibly random and not representative !
18031/// let result = hub.advertisers().creatives_delete(-9, -19)
18032///              .doit().await;
18033/// # }
18034/// ```
18035pub struct AdvertiserCreativeDeleteCall<'a, C>
18036where
18037    C: 'a,
18038{
18039    hub: &'a DisplayVideo<C>,
18040    _advertiser_id: i64,
18041    _creative_id: i64,
18042    _delegate: Option<&'a mut dyn common::Delegate>,
18043    _additional_params: HashMap<String, String>,
18044    _scopes: BTreeSet<String>,
18045}
18046
18047impl<'a, C> common::CallBuilder for AdvertiserCreativeDeleteCall<'a, C> {}
18048
18049impl<'a, C> AdvertiserCreativeDeleteCall<'a, C>
18050where
18051    C: common::Connector,
18052{
18053    /// Perform the operation you have build so far.
18054    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
18055        use std::borrow::Cow;
18056        use std::io::{Read, Seek};
18057
18058        use common::{url::Params, ToParts};
18059        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18060
18061        let mut dd = common::DefaultDelegate;
18062        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18063        dlg.begin(common::MethodInfo {
18064            id: "displayvideo.advertisers.creatives.delete",
18065            http_method: hyper::Method::DELETE,
18066        });
18067
18068        for &field in ["alt", "advertiserId", "creativeId"].iter() {
18069            if self._additional_params.contains_key(field) {
18070                dlg.finished(false);
18071                return Err(common::Error::FieldClash(field));
18072            }
18073        }
18074
18075        let mut params = Params::with_capacity(4 + self._additional_params.len());
18076        params.push("advertiserId", self._advertiser_id.to_string());
18077        params.push("creativeId", self._creative_id.to_string());
18078
18079        params.extend(self._additional_params.iter());
18080
18081        params.push("alt", "json");
18082        let mut url =
18083            self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/creatives/{+creativeId}";
18084        if self._scopes.is_empty() {
18085            self._scopes
18086                .insert(Scope::DisplayVideo.as_ref().to_string());
18087        }
18088
18089        #[allow(clippy::single_element_loop)]
18090        for &(find_this, param_name) in [
18091            ("{+advertiserId}", "advertiserId"),
18092            ("{+creativeId}", "creativeId"),
18093        ]
18094        .iter()
18095        {
18096            url = params.uri_replacement(url, param_name, find_this, true);
18097        }
18098        {
18099            let to_remove = ["creativeId", "advertiserId"];
18100            params.remove_params(&to_remove);
18101        }
18102
18103        let url = params.parse_with_url(&url);
18104
18105        loop {
18106            let token = match self
18107                .hub
18108                .auth
18109                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18110                .await
18111            {
18112                Ok(token) => token,
18113                Err(e) => match dlg.token(e) {
18114                    Ok(token) => token,
18115                    Err(e) => {
18116                        dlg.finished(false);
18117                        return Err(common::Error::MissingToken(e));
18118                    }
18119                },
18120            };
18121            let mut req_result = {
18122                let client = &self.hub.client;
18123                dlg.pre_request();
18124                let mut req_builder = hyper::Request::builder()
18125                    .method(hyper::Method::DELETE)
18126                    .uri(url.as_str())
18127                    .header(USER_AGENT, self.hub._user_agent.clone());
18128
18129                if let Some(token) = token.as_ref() {
18130                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18131                }
18132
18133                let request = req_builder
18134                    .header(CONTENT_LENGTH, 0_u64)
18135                    .body(common::to_body::<String>(None));
18136
18137                client.request(request.unwrap()).await
18138            };
18139
18140            match req_result {
18141                Err(err) => {
18142                    if let common::Retry::After(d) = dlg.http_error(&err) {
18143                        sleep(d).await;
18144                        continue;
18145                    }
18146                    dlg.finished(false);
18147                    return Err(common::Error::HttpError(err));
18148                }
18149                Ok(res) => {
18150                    let (mut parts, body) = res.into_parts();
18151                    let mut body = common::Body::new(body);
18152                    if !parts.status.is_success() {
18153                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18154                        let error = serde_json::from_str(&common::to_string(&bytes));
18155                        let response = common::to_response(parts, bytes.into());
18156
18157                        if let common::Retry::After(d) =
18158                            dlg.http_failure(&response, error.as_ref().ok())
18159                        {
18160                            sleep(d).await;
18161                            continue;
18162                        }
18163
18164                        dlg.finished(false);
18165
18166                        return Err(match error {
18167                            Ok(value) => common::Error::BadRequest(value),
18168                            _ => common::Error::Failure(response),
18169                        });
18170                    }
18171                    let response = {
18172                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18173                        let encoded = common::to_string(&bytes);
18174                        match serde_json::from_str(&encoded) {
18175                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18176                            Err(error) => {
18177                                dlg.response_json_decode_error(&encoded, &error);
18178                                return Err(common::Error::JsonDecodeError(
18179                                    encoded.to_string(),
18180                                    error,
18181                                ));
18182                            }
18183                        }
18184                    };
18185
18186                    dlg.finished(true);
18187                    return Ok(response);
18188                }
18189            }
18190        }
18191    }
18192
18193    /// The ID of the advertiser this creative belongs to.
18194    ///
18195    /// Sets the *advertiser id* path property to the given value.
18196    ///
18197    /// Even though the property as already been set when instantiating this call,
18198    /// we provide this method for API completeness.
18199    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserCreativeDeleteCall<'a, C> {
18200        self._advertiser_id = new_value;
18201        self
18202    }
18203    /// The ID of the creative to be deleted.
18204    ///
18205    /// Sets the *creative id* path property to the given value.
18206    ///
18207    /// Even though the property as already been set when instantiating this call,
18208    /// we provide this method for API completeness.
18209    pub fn creative_id(mut self, new_value: i64) -> AdvertiserCreativeDeleteCall<'a, C> {
18210        self._creative_id = new_value;
18211        self
18212    }
18213    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18214    /// while executing the actual API request.
18215    ///
18216    /// ````text
18217    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18218    /// ````
18219    ///
18220    /// Sets the *delegate* property to the given value.
18221    pub fn delegate(
18222        mut self,
18223        new_value: &'a mut dyn common::Delegate,
18224    ) -> AdvertiserCreativeDeleteCall<'a, C> {
18225        self._delegate = Some(new_value);
18226        self
18227    }
18228
18229    /// Set any additional parameter of the query string used in the request.
18230    /// It should be used to set parameters which are not yet available through their own
18231    /// setters.
18232    ///
18233    /// Please note that this method must not be used to set any of the known parameters
18234    /// which have their own setter method. If done anyway, the request will fail.
18235    ///
18236    /// # Additional Parameters
18237    ///
18238    /// * *$.xgafv* (query-string) - V1 error format.
18239    /// * *access_token* (query-string) - OAuth access token.
18240    /// * *alt* (query-string) - Data format for response.
18241    /// * *callback* (query-string) - JSONP
18242    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18243    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18244    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18245    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18246    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18247    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18248    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18249    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserCreativeDeleteCall<'a, C>
18250    where
18251        T: AsRef<str>,
18252    {
18253        self._additional_params
18254            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18255        self
18256    }
18257
18258    /// Identifies the authorization scope for the method you are building.
18259    ///
18260    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18261    /// [`Scope::DisplayVideo`].
18262    ///
18263    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18264    /// tokens for more than one scope.
18265    ///
18266    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18267    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18268    /// sufficient, a read-write scope will do as well.
18269    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserCreativeDeleteCall<'a, C>
18270    where
18271        St: AsRef<str>,
18272    {
18273        self._scopes.insert(String::from(scope.as_ref()));
18274        self
18275    }
18276    /// Identifies the authorization scope(s) for the method you are building.
18277    ///
18278    /// See [`Self::add_scope()`] for details.
18279    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserCreativeDeleteCall<'a, C>
18280    where
18281        I: IntoIterator<Item = St>,
18282        St: AsRef<str>,
18283    {
18284        self._scopes
18285            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18286        self
18287    }
18288
18289    /// Removes all scopes, and no default scope will be used either.
18290    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18291    /// for details).
18292    pub fn clear_scopes(mut self) -> AdvertiserCreativeDeleteCall<'a, C> {
18293        self._scopes.clear();
18294        self
18295    }
18296}
18297
18298/// Gets a creative.
18299///
18300/// A builder for the *creatives.get* method supported by a *advertiser* resource.
18301/// It is not used directly, but through a [`AdvertiserMethods`] instance.
18302///
18303/// # Example
18304///
18305/// Instantiate a resource method builder
18306///
18307/// ```test_harness,no_run
18308/// # extern crate hyper;
18309/// # extern crate hyper_rustls;
18310/// # extern crate google_displayvideo1 as displayvideo1;
18311/// # async fn dox() {
18312/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18313///
18314/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18315/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18316/// #     secret,
18317/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18318/// # ).build().await.unwrap();
18319///
18320/// # let client = hyper_util::client::legacy::Client::builder(
18321/// #     hyper_util::rt::TokioExecutor::new()
18322/// # )
18323/// # .build(
18324/// #     hyper_rustls::HttpsConnectorBuilder::new()
18325/// #         .with_native_roots()
18326/// #         .unwrap()
18327/// #         .https_or_http()
18328/// #         .enable_http1()
18329/// #         .build()
18330/// # );
18331/// # let mut hub = DisplayVideo::new(client, auth);
18332/// // You can configure optional parameters by calling the respective setters at will, and
18333/// // execute the final call using `doit()`.
18334/// // Values shown here are possibly random and not representative !
18335/// let result = hub.advertisers().creatives_get(-62, -74)
18336///              .doit().await;
18337/// # }
18338/// ```
18339pub struct AdvertiserCreativeGetCall<'a, C>
18340where
18341    C: 'a,
18342{
18343    hub: &'a DisplayVideo<C>,
18344    _advertiser_id: i64,
18345    _creative_id: i64,
18346    _delegate: Option<&'a mut dyn common::Delegate>,
18347    _additional_params: HashMap<String, String>,
18348    _scopes: BTreeSet<String>,
18349}
18350
18351impl<'a, C> common::CallBuilder for AdvertiserCreativeGetCall<'a, C> {}
18352
18353impl<'a, C> AdvertiserCreativeGetCall<'a, C>
18354where
18355    C: common::Connector,
18356{
18357    /// Perform the operation you have build so far.
18358    pub async fn doit(mut self) -> common::Result<(common::Response, Creative)> {
18359        use std::borrow::Cow;
18360        use std::io::{Read, Seek};
18361
18362        use common::{url::Params, ToParts};
18363        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18364
18365        let mut dd = common::DefaultDelegate;
18366        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18367        dlg.begin(common::MethodInfo {
18368            id: "displayvideo.advertisers.creatives.get",
18369            http_method: hyper::Method::GET,
18370        });
18371
18372        for &field in ["alt", "advertiserId", "creativeId"].iter() {
18373            if self._additional_params.contains_key(field) {
18374                dlg.finished(false);
18375                return Err(common::Error::FieldClash(field));
18376            }
18377        }
18378
18379        let mut params = Params::with_capacity(4 + self._additional_params.len());
18380        params.push("advertiserId", self._advertiser_id.to_string());
18381        params.push("creativeId", self._creative_id.to_string());
18382
18383        params.extend(self._additional_params.iter());
18384
18385        params.push("alt", "json");
18386        let mut url =
18387            self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/creatives/{+creativeId}";
18388        if self._scopes.is_empty() {
18389            self._scopes
18390                .insert(Scope::DisplayVideo.as_ref().to_string());
18391        }
18392
18393        #[allow(clippy::single_element_loop)]
18394        for &(find_this, param_name) in [
18395            ("{+advertiserId}", "advertiserId"),
18396            ("{+creativeId}", "creativeId"),
18397        ]
18398        .iter()
18399        {
18400            url = params.uri_replacement(url, param_name, find_this, true);
18401        }
18402        {
18403            let to_remove = ["creativeId", "advertiserId"];
18404            params.remove_params(&to_remove);
18405        }
18406
18407        let url = params.parse_with_url(&url);
18408
18409        loop {
18410            let token = match self
18411                .hub
18412                .auth
18413                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18414                .await
18415            {
18416                Ok(token) => token,
18417                Err(e) => match dlg.token(e) {
18418                    Ok(token) => token,
18419                    Err(e) => {
18420                        dlg.finished(false);
18421                        return Err(common::Error::MissingToken(e));
18422                    }
18423                },
18424            };
18425            let mut req_result = {
18426                let client = &self.hub.client;
18427                dlg.pre_request();
18428                let mut req_builder = hyper::Request::builder()
18429                    .method(hyper::Method::GET)
18430                    .uri(url.as_str())
18431                    .header(USER_AGENT, self.hub._user_agent.clone());
18432
18433                if let Some(token) = token.as_ref() {
18434                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18435                }
18436
18437                let request = req_builder
18438                    .header(CONTENT_LENGTH, 0_u64)
18439                    .body(common::to_body::<String>(None));
18440
18441                client.request(request.unwrap()).await
18442            };
18443
18444            match req_result {
18445                Err(err) => {
18446                    if let common::Retry::After(d) = dlg.http_error(&err) {
18447                        sleep(d).await;
18448                        continue;
18449                    }
18450                    dlg.finished(false);
18451                    return Err(common::Error::HttpError(err));
18452                }
18453                Ok(res) => {
18454                    let (mut parts, body) = res.into_parts();
18455                    let mut body = common::Body::new(body);
18456                    if !parts.status.is_success() {
18457                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18458                        let error = serde_json::from_str(&common::to_string(&bytes));
18459                        let response = common::to_response(parts, bytes.into());
18460
18461                        if let common::Retry::After(d) =
18462                            dlg.http_failure(&response, error.as_ref().ok())
18463                        {
18464                            sleep(d).await;
18465                            continue;
18466                        }
18467
18468                        dlg.finished(false);
18469
18470                        return Err(match error {
18471                            Ok(value) => common::Error::BadRequest(value),
18472                            _ => common::Error::Failure(response),
18473                        });
18474                    }
18475                    let response = {
18476                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18477                        let encoded = common::to_string(&bytes);
18478                        match serde_json::from_str(&encoded) {
18479                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18480                            Err(error) => {
18481                                dlg.response_json_decode_error(&encoded, &error);
18482                                return Err(common::Error::JsonDecodeError(
18483                                    encoded.to_string(),
18484                                    error,
18485                                ));
18486                            }
18487                        }
18488                    };
18489
18490                    dlg.finished(true);
18491                    return Ok(response);
18492                }
18493            }
18494        }
18495    }
18496
18497    /// Required. The ID of the advertiser this creative belongs to.
18498    ///
18499    /// Sets the *advertiser id* path property to the given value.
18500    ///
18501    /// Even though the property as already been set when instantiating this call,
18502    /// we provide this method for API completeness.
18503    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserCreativeGetCall<'a, C> {
18504        self._advertiser_id = new_value;
18505        self
18506    }
18507    /// Required. The ID of the creative to fetch.
18508    ///
18509    /// Sets the *creative id* path property to the given value.
18510    ///
18511    /// Even though the property as already been set when instantiating this call,
18512    /// we provide this method for API completeness.
18513    pub fn creative_id(mut self, new_value: i64) -> AdvertiserCreativeGetCall<'a, C> {
18514        self._creative_id = new_value;
18515        self
18516    }
18517    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18518    /// while executing the actual API request.
18519    ///
18520    /// ````text
18521    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18522    /// ````
18523    ///
18524    /// Sets the *delegate* property to the given value.
18525    pub fn delegate(
18526        mut self,
18527        new_value: &'a mut dyn common::Delegate,
18528    ) -> AdvertiserCreativeGetCall<'a, C> {
18529        self._delegate = Some(new_value);
18530        self
18531    }
18532
18533    /// Set any additional parameter of the query string used in the request.
18534    /// It should be used to set parameters which are not yet available through their own
18535    /// setters.
18536    ///
18537    /// Please note that this method must not be used to set any of the known parameters
18538    /// which have their own setter method. If done anyway, the request will fail.
18539    ///
18540    /// # Additional Parameters
18541    ///
18542    /// * *$.xgafv* (query-string) - V1 error format.
18543    /// * *access_token* (query-string) - OAuth access token.
18544    /// * *alt* (query-string) - Data format for response.
18545    /// * *callback* (query-string) - JSONP
18546    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18547    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18548    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18549    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18550    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18551    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18552    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18553    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserCreativeGetCall<'a, C>
18554    where
18555        T: AsRef<str>,
18556    {
18557        self._additional_params
18558            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18559        self
18560    }
18561
18562    /// Identifies the authorization scope for the method you are building.
18563    ///
18564    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18565    /// [`Scope::DisplayVideo`].
18566    ///
18567    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18568    /// tokens for more than one scope.
18569    ///
18570    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18571    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18572    /// sufficient, a read-write scope will do as well.
18573    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserCreativeGetCall<'a, C>
18574    where
18575        St: AsRef<str>,
18576    {
18577        self._scopes.insert(String::from(scope.as_ref()));
18578        self
18579    }
18580    /// Identifies the authorization scope(s) for the method you are building.
18581    ///
18582    /// See [`Self::add_scope()`] for details.
18583    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserCreativeGetCall<'a, C>
18584    where
18585        I: IntoIterator<Item = St>,
18586        St: AsRef<str>,
18587    {
18588        self._scopes
18589            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18590        self
18591    }
18592
18593    /// Removes all scopes, and no default scope will be used either.
18594    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18595    /// for details).
18596    pub fn clear_scopes(mut self) -> AdvertiserCreativeGetCall<'a, C> {
18597        self._scopes.clear();
18598        self
18599    }
18600}
18601
18602/// Lists creatives in an advertiser. The order is defined by the order_by parameter. If a filter by entity_status is not specified, creatives with `ENTITY_STATUS_ARCHIVED` will not be included in the results.
18603///
18604/// A builder for the *creatives.list* method supported by a *advertiser* resource.
18605/// It is not used directly, but through a [`AdvertiserMethods`] instance.
18606///
18607/// # Example
18608///
18609/// Instantiate a resource method builder
18610///
18611/// ```test_harness,no_run
18612/// # extern crate hyper;
18613/// # extern crate hyper_rustls;
18614/// # extern crate google_displayvideo1 as displayvideo1;
18615/// # async fn dox() {
18616/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18617///
18618/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18619/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18620/// #     secret,
18621/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18622/// # ).build().await.unwrap();
18623///
18624/// # let client = hyper_util::client::legacy::Client::builder(
18625/// #     hyper_util::rt::TokioExecutor::new()
18626/// # )
18627/// # .build(
18628/// #     hyper_rustls::HttpsConnectorBuilder::new()
18629/// #         .with_native_roots()
18630/// #         .unwrap()
18631/// #         .https_or_http()
18632/// #         .enable_http1()
18633/// #         .build()
18634/// # );
18635/// # let mut hub = DisplayVideo::new(client, auth);
18636/// // You can configure optional parameters by calling the respective setters at will, and
18637/// // execute the final call using `doit()`.
18638/// // Values shown here are possibly random and not representative !
18639/// let result = hub.advertisers().creatives_list(-23)
18640///              .page_token("voluptua.")
18641///              .page_size(-34)
18642///              .order_by("dolore")
18643///              .filter("dolore")
18644///              .doit().await;
18645/// # }
18646/// ```
18647pub struct AdvertiserCreativeListCall<'a, C>
18648where
18649    C: 'a,
18650{
18651    hub: &'a DisplayVideo<C>,
18652    _advertiser_id: i64,
18653    _page_token: Option<String>,
18654    _page_size: Option<i32>,
18655    _order_by: Option<String>,
18656    _filter: Option<String>,
18657    _delegate: Option<&'a mut dyn common::Delegate>,
18658    _additional_params: HashMap<String, String>,
18659    _scopes: BTreeSet<String>,
18660}
18661
18662impl<'a, C> common::CallBuilder for AdvertiserCreativeListCall<'a, C> {}
18663
18664impl<'a, C> AdvertiserCreativeListCall<'a, C>
18665where
18666    C: common::Connector,
18667{
18668    /// Perform the operation you have build so far.
18669    pub async fn doit(mut self) -> common::Result<(common::Response, ListCreativesResponse)> {
18670        use std::borrow::Cow;
18671        use std::io::{Read, Seek};
18672
18673        use common::{url::Params, ToParts};
18674        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18675
18676        let mut dd = common::DefaultDelegate;
18677        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18678        dlg.begin(common::MethodInfo {
18679            id: "displayvideo.advertisers.creatives.list",
18680            http_method: hyper::Method::GET,
18681        });
18682
18683        for &field in [
18684            "alt",
18685            "advertiserId",
18686            "pageToken",
18687            "pageSize",
18688            "orderBy",
18689            "filter",
18690        ]
18691        .iter()
18692        {
18693            if self._additional_params.contains_key(field) {
18694                dlg.finished(false);
18695                return Err(common::Error::FieldClash(field));
18696            }
18697        }
18698
18699        let mut params = Params::with_capacity(7 + self._additional_params.len());
18700        params.push("advertiserId", self._advertiser_id.to_string());
18701        if let Some(value) = self._page_token.as_ref() {
18702            params.push("pageToken", value);
18703        }
18704        if let Some(value) = self._page_size.as_ref() {
18705            params.push("pageSize", value.to_string());
18706        }
18707        if let Some(value) = self._order_by.as_ref() {
18708            params.push("orderBy", value);
18709        }
18710        if let Some(value) = self._filter.as_ref() {
18711            params.push("filter", value);
18712        }
18713
18714        params.extend(self._additional_params.iter());
18715
18716        params.push("alt", "json");
18717        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/creatives";
18718        if self._scopes.is_empty() {
18719            self._scopes
18720                .insert(Scope::DisplayVideo.as_ref().to_string());
18721        }
18722
18723        #[allow(clippy::single_element_loop)]
18724        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
18725            url = params.uri_replacement(url, param_name, find_this, true);
18726        }
18727        {
18728            let to_remove = ["advertiserId"];
18729            params.remove_params(&to_remove);
18730        }
18731
18732        let url = params.parse_with_url(&url);
18733
18734        loop {
18735            let token = match self
18736                .hub
18737                .auth
18738                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18739                .await
18740            {
18741                Ok(token) => token,
18742                Err(e) => match dlg.token(e) {
18743                    Ok(token) => token,
18744                    Err(e) => {
18745                        dlg.finished(false);
18746                        return Err(common::Error::MissingToken(e));
18747                    }
18748                },
18749            };
18750            let mut req_result = {
18751                let client = &self.hub.client;
18752                dlg.pre_request();
18753                let mut req_builder = hyper::Request::builder()
18754                    .method(hyper::Method::GET)
18755                    .uri(url.as_str())
18756                    .header(USER_AGENT, self.hub._user_agent.clone());
18757
18758                if let Some(token) = token.as_ref() {
18759                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18760                }
18761
18762                let request = req_builder
18763                    .header(CONTENT_LENGTH, 0_u64)
18764                    .body(common::to_body::<String>(None));
18765
18766                client.request(request.unwrap()).await
18767            };
18768
18769            match req_result {
18770                Err(err) => {
18771                    if let common::Retry::After(d) = dlg.http_error(&err) {
18772                        sleep(d).await;
18773                        continue;
18774                    }
18775                    dlg.finished(false);
18776                    return Err(common::Error::HttpError(err));
18777                }
18778                Ok(res) => {
18779                    let (mut parts, body) = res.into_parts();
18780                    let mut body = common::Body::new(body);
18781                    if !parts.status.is_success() {
18782                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18783                        let error = serde_json::from_str(&common::to_string(&bytes));
18784                        let response = common::to_response(parts, bytes.into());
18785
18786                        if let common::Retry::After(d) =
18787                            dlg.http_failure(&response, error.as_ref().ok())
18788                        {
18789                            sleep(d).await;
18790                            continue;
18791                        }
18792
18793                        dlg.finished(false);
18794
18795                        return Err(match error {
18796                            Ok(value) => common::Error::BadRequest(value),
18797                            _ => common::Error::Failure(response),
18798                        });
18799                    }
18800                    let response = {
18801                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18802                        let encoded = common::to_string(&bytes);
18803                        match serde_json::from_str(&encoded) {
18804                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18805                            Err(error) => {
18806                                dlg.response_json_decode_error(&encoded, &error);
18807                                return Err(common::Error::JsonDecodeError(
18808                                    encoded.to_string(),
18809                                    error,
18810                                ));
18811                            }
18812                        }
18813                    };
18814
18815                    dlg.finished(true);
18816                    return Ok(response);
18817                }
18818            }
18819        }
18820    }
18821
18822    /// Required. The ID of the advertiser to list creatives for.
18823    ///
18824    /// Sets the *advertiser id* path property to the given value.
18825    ///
18826    /// Even though the property as already been set when instantiating this call,
18827    /// we provide this method for API completeness.
18828    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserCreativeListCall<'a, C> {
18829        self._advertiser_id = new_value;
18830        self
18831    }
18832    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListCreatives` method. If not specified, the first page of results will be returned.
18833    ///
18834    /// Sets the *page token* query property to the given value.
18835    pub fn page_token(mut self, new_value: &str) -> AdvertiserCreativeListCall<'a, C> {
18836        self._page_token = Some(new_value.to_string());
18837        self
18838    }
18839    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
18840    ///
18841    /// Sets the *page size* query property to the given value.
18842    pub fn page_size(mut self, new_value: i32) -> AdvertiserCreativeListCall<'a, C> {
18843        self._page_size = Some(new_value);
18844        self
18845    }
18846    /// Field by which to sort the list. Acceptable values are: * `creativeId` (default) * `createTime` * `mediaDuration` * `dimensions` (sorts by width first, then by height) The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `createTime desc`.
18847    ///
18848    /// Sets the *order by* query property to the given value.
18849    pub fn order_by(mut self, new_value: &str) -> AdvertiserCreativeListCall<'a, C> {
18850        self._order_by = Some(new_value.to_string());
18851        self
18852    }
18853    /// Allows filtering by creative fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by `AND` or `OR` logical operators. A sequence of restrictions implicitly uses `AND`. * A restriction has the form of `{field} {operator} {value}`. * The `lineItemIds` field must use the `HAS (:)` operator. * The `updateTime` field must use the `GREATER THAN OR EQUAL TO (>=)` or `LESS THAN OR EQUAL TO (<=)` operators. * All other fields must use the `EQUALS (=)` operator. * For `entityStatus`, `minDuration`, `maxDuration`, `updateTime`, and `dynamic` fields, there may be at most one restriction. Supported Fields: * `approvalStatus` * `creativeId` * `creativeType` * `dimensions` (input in the form of `{width}x{height}`) * `dynamic` * `entityStatus` * `exchangeReviewStatus` (input in the form of `{exchange}-{reviewStatus}`) * `lineItemIds` * `maxDuration` (input in the form of `{duration}s`. Only seconds are supported) * `minDuration` (input in the form of `{duration}s`. Only seconds are supported) * `updateTime` (input in ISO 8601 format, or `YYYY-MM-DDTHH:MM:SSZ`) Notes: * For `updateTime`, a creative resource’s field value reflects the last time that a creative has been updated, which includes updates made by the system (e.g. creative review updates). Examples: * All native creatives: `creativeType="CREATIVE_TYPE_NATIVE"` * All active creatives with 300x400 or 50x100 dimensions: `entityStatus="ENTITY_STATUS_ACTIVE" AND (dimensions="300x400" OR dimensions="50x100")` * All dynamic creatives that are approved by AdX or AppNexus, with a minimum duration of 5 seconds and 200ms: `dynamic="true" AND minDuration="5.2s" AND (exchangeReviewStatus="EXCHANGE_GOOGLE_AD_MANAGER-REVIEW_STATUS_APPROVED" OR exchangeReviewStatus="EXCHANGE_APPNEXUS-REVIEW_STATUS_APPROVED")` * All video creatives that are associated with line item ID 1 or 2: `creativeType="CREATIVE_TYPE_VIDEO" AND (lineItemIds:1 OR lineItemIds:2)` * Find creatives by multiple creative IDs: `creativeId=1 OR creativeId=2` * All creatives with an update time greater than or equal to 2020-11-04T18:54:47Z (format of ISO 8601): `updateTime>="2020-11-04T18:54:47Z"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
18854    ///
18855    /// Sets the *filter* query property to the given value.
18856    pub fn filter(mut self, new_value: &str) -> AdvertiserCreativeListCall<'a, C> {
18857        self._filter = Some(new_value.to_string());
18858        self
18859    }
18860    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18861    /// while executing the actual API request.
18862    ///
18863    /// ````text
18864    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18865    /// ````
18866    ///
18867    /// Sets the *delegate* property to the given value.
18868    pub fn delegate(
18869        mut self,
18870        new_value: &'a mut dyn common::Delegate,
18871    ) -> AdvertiserCreativeListCall<'a, C> {
18872        self._delegate = Some(new_value);
18873        self
18874    }
18875
18876    /// Set any additional parameter of the query string used in the request.
18877    /// It should be used to set parameters which are not yet available through their own
18878    /// setters.
18879    ///
18880    /// Please note that this method must not be used to set any of the known parameters
18881    /// which have their own setter method. If done anyway, the request will fail.
18882    ///
18883    /// # Additional Parameters
18884    ///
18885    /// * *$.xgafv* (query-string) - V1 error format.
18886    /// * *access_token* (query-string) - OAuth access token.
18887    /// * *alt* (query-string) - Data format for response.
18888    /// * *callback* (query-string) - JSONP
18889    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18890    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18891    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18892    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18893    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18894    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18895    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18896    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserCreativeListCall<'a, C>
18897    where
18898        T: AsRef<str>,
18899    {
18900        self._additional_params
18901            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18902        self
18903    }
18904
18905    /// Identifies the authorization scope for the method you are building.
18906    ///
18907    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18908    /// [`Scope::DisplayVideo`].
18909    ///
18910    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18911    /// tokens for more than one scope.
18912    ///
18913    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18914    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18915    /// sufficient, a read-write scope will do as well.
18916    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserCreativeListCall<'a, C>
18917    where
18918        St: AsRef<str>,
18919    {
18920        self._scopes.insert(String::from(scope.as_ref()));
18921        self
18922    }
18923    /// Identifies the authorization scope(s) for the method you are building.
18924    ///
18925    /// See [`Self::add_scope()`] for details.
18926    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserCreativeListCall<'a, C>
18927    where
18928        I: IntoIterator<Item = St>,
18929        St: AsRef<str>,
18930    {
18931        self._scopes
18932            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18933        self
18934    }
18935
18936    /// Removes all scopes, and no default scope will be used either.
18937    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18938    /// for details).
18939    pub fn clear_scopes(mut self) -> AdvertiserCreativeListCall<'a, C> {
18940        self._scopes.clear();
18941        self
18942    }
18943}
18944
18945/// Updates an existing creative. Returns the updated creative if successful. A [“Standard” user role](https://developers.google.com//support.google.com/displayvideo/answer/2723011) or greater for the parent advertiser or partner is required to make this request.
18946///
18947/// A builder for the *creatives.patch* method supported by a *advertiser* resource.
18948/// It is not used directly, but through a [`AdvertiserMethods`] instance.
18949///
18950/// # Example
18951///
18952/// Instantiate a resource method builder
18953///
18954/// ```test_harness,no_run
18955/// # extern crate hyper;
18956/// # extern crate hyper_rustls;
18957/// # extern crate google_displayvideo1 as displayvideo1;
18958/// use displayvideo1::api::Creative;
18959/// # async fn dox() {
18960/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18961///
18962/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18963/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18964/// #     secret,
18965/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18966/// # ).build().await.unwrap();
18967///
18968/// # let client = hyper_util::client::legacy::Client::builder(
18969/// #     hyper_util::rt::TokioExecutor::new()
18970/// # )
18971/// # .build(
18972/// #     hyper_rustls::HttpsConnectorBuilder::new()
18973/// #         .with_native_roots()
18974/// #         .unwrap()
18975/// #         .https_or_http()
18976/// #         .enable_http1()
18977/// #         .build()
18978/// # );
18979/// # let mut hub = DisplayVideo::new(client, auth);
18980/// // As the method needs a request, you would usually fill it with the desired information
18981/// // into the respective structure. Some of the parts shown here might not be applicable !
18982/// // Values shown here are possibly random and not representative !
18983/// let mut req = Creative::default();
18984///
18985/// // You can configure optional parameters by calling the respective setters at will, and
18986/// // execute the final call using `doit()`.
18987/// // Values shown here are possibly random and not representative !
18988/// let result = hub.advertisers().creatives_patch(req, -78, -2)
18989///              .update_mask(FieldMask::new::<&str>(&[]))
18990///              .doit().await;
18991/// # }
18992/// ```
18993pub struct AdvertiserCreativePatchCall<'a, C>
18994where
18995    C: 'a,
18996{
18997    hub: &'a DisplayVideo<C>,
18998    _request: Creative,
18999    _advertiser_id: i64,
19000    _creative_id: i64,
19001    _update_mask: Option<common::FieldMask>,
19002    _delegate: Option<&'a mut dyn common::Delegate>,
19003    _additional_params: HashMap<String, String>,
19004    _scopes: BTreeSet<String>,
19005}
19006
19007impl<'a, C> common::CallBuilder for AdvertiserCreativePatchCall<'a, C> {}
19008
19009impl<'a, C> AdvertiserCreativePatchCall<'a, C>
19010where
19011    C: common::Connector,
19012{
19013    /// Perform the operation you have build so far.
19014    pub async fn doit(mut self) -> common::Result<(common::Response, Creative)> {
19015        use std::borrow::Cow;
19016        use std::io::{Read, Seek};
19017
19018        use common::{url::Params, ToParts};
19019        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19020
19021        let mut dd = common::DefaultDelegate;
19022        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19023        dlg.begin(common::MethodInfo {
19024            id: "displayvideo.advertisers.creatives.patch",
19025            http_method: hyper::Method::PATCH,
19026        });
19027
19028        for &field in ["alt", "advertiserId", "creativeId", "updateMask"].iter() {
19029            if self._additional_params.contains_key(field) {
19030                dlg.finished(false);
19031                return Err(common::Error::FieldClash(field));
19032            }
19033        }
19034
19035        let mut params = Params::with_capacity(6 + self._additional_params.len());
19036        params.push("advertiserId", self._advertiser_id.to_string());
19037        params.push("creativeId", self._creative_id.to_string());
19038        if let Some(value) = self._update_mask.as_ref() {
19039            params.push("updateMask", value.to_string());
19040        }
19041
19042        params.extend(self._additional_params.iter());
19043
19044        params.push("alt", "json");
19045        let mut url =
19046            self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/creatives/{+creativeId}";
19047        if self._scopes.is_empty() {
19048            self._scopes
19049                .insert(Scope::DisplayVideo.as_ref().to_string());
19050        }
19051
19052        #[allow(clippy::single_element_loop)]
19053        for &(find_this, param_name) in [
19054            ("{+advertiserId}", "advertiserId"),
19055            ("{+creativeId}", "creativeId"),
19056        ]
19057        .iter()
19058        {
19059            url = params.uri_replacement(url, param_name, find_this, true);
19060        }
19061        {
19062            let to_remove = ["creativeId", "advertiserId"];
19063            params.remove_params(&to_remove);
19064        }
19065
19066        let url = params.parse_with_url(&url);
19067
19068        let mut json_mime_type = mime::APPLICATION_JSON;
19069        let mut request_value_reader = {
19070            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19071            common::remove_json_null_values(&mut value);
19072            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19073            serde_json::to_writer(&mut dst, &value).unwrap();
19074            dst
19075        };
19076        let request_size = request_value_reader
19077            .seek(std::io::SeekFrom::End(0))
19078            .unwrap();
19079        request_value_reader
19080            .seek(std::io::SeekFrom::Start(0))
19081            .unwrap();
19082
19083        loop {
19084            let token = match self
19085                .hub
19086                .auth
19087                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19088                .await
19089            {
19090                Ok(token) => token,
19091                Err(e) => match dlg.token(e) {
19092                    Ok(token) => token,
19093                    Err(e) => {
19094                        dlg.finished(false);
19095                        return Err(common::Error::MissingToken(e));
19096                    }
19097                },
19098            };
19099            request_value_reader
19100                .seek(std::io::SeekFrom::Start(0))
19101                .unwrap();
19102            let mut req_result = {
19103                let client = &self.hub.client;
19104                dlg.pre_request();
19105                let mut req_builder = hyper::Request::builder()
19106                    .method(hyper::Method::PATCH)
19107                    .uri(url.as_str())
19108                    .header(USER_AGENT, self.hub._user_agent.clone());
19109
19110                if let Some(token) = token.as_ref() {
19111                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19112                }
19113
19114                let request = req_builder
19115                    .header(CONTENT_TYPE, json_mime_type.to_string())
19116                    .header(CONTENT_LENGTH, request_size as u64)
19117                    .body(common::to_body(
19118                        request_value_reader.get_ref().clone().into(),
19119                    ));
19120
19121                client.request(request.unwrap()).await
19122            };
19123
19124            match req_result {
19125                Err(err) => {
19126                    if let common::Retry::After(d) = dlg.http_error(&err) {
19127                        sleep(d).await;
19128                        continue;
19129                    }
19130                    dlg.finished(false);
19131                    return Err(common::Error::HttpError(err));
19132                }
19133                Ok(res) => {
19134                    let (mut parts, body) = res.into_parts();
19135                    let mut body = common::Body::new(body);
19136                    if !parts.status.is_success() {
19137                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19138                        let error = serde_json::from_str(&common::to_string(&bytes));
19139                        let response = common::to_response(parts, bytes.into());
19140
19141                        if let common::Retry::After(d) =
19142                            dlg.http_failure(&response, error.as_ref().ok())
19143                        {
19144                            sleep(d).await;
19145                            continue;
19146                        }
19147
19148                        dlg.finished(false);
19149
19150                        return Err(match error {
19151                            Ok(value) => common::Error::BadRequest(value),
19152                            _ => common::Error::Failure(response),
19153                        });
19154                    }
19155                    let response = {
19156                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19157                        let encoded = common::to_string(&bytes);
19158                        match serde_json::from_str(&encoded) {
19159                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19160                            Err(error) => {
19161                                dlg.response_json_decode_error(&encoded, &error);
19162                                return Err(common::Error::JsonDecodeError(
19163                                    encoded.to_string(),
19164                                    error,
19165                                ));
19166                            }
19167                        }
19168                    };
19169
19170                    dlg.finished(true);
19171                    return Ok(response);
19172                }
19173            }
19174        }
19175    }
19176
19177    ///
19178    /// Sets the *request* property to the given value.
19179    ///
19180    /// Even though the property as already been set when instantiating this call,
19181    /// we provide this method for API completeness.
19182    pub fn request(mut self, new_value: Creative) -> AdvertiserCreativePatchCall<'a, C> {
19183        self._request = new_value;
19184        self
19185    }
19186    /// Output only. The unique ID of the advertiser the creative belongs to.
19187    ///
19188    /// Sets the *advertiser id* path property to the given value.
19189    ///
19190    /// Even though the property as already been set when instantiating this call,
19191    /// we provide this method for API completeness.
19192    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserCreativePatchCall<'a, C> {
19193        self._advertiser_id = new_value;
19194        self
19195    }
19196    /// Output only. The unique ID of the creative. Assigned by the system.
19197    ///
19198    /// Sets the *creative id* path property to the given value.
19199    ///
19200    /// Even though the property as already been set when instantiating this call,
19201    /// we provide this method for API completeness.
19202    pub fn creative_id(mut self, new_value: i64) -> AdvertiserCreativePatchCall<'a, C> {
19203        self._creative_id = new_value;
19204        self
19205    }
19206    /// Required. The mask to control which fields to update.
19207    ///
19208    /// Sets the *update mask* query property to the given value.
19209    pub fn update_mask(
19210        mut self,
19211        new_value: common::FieldMask,
19212    ) -> AdvertiserCreativePatchCall<'a, C> {
19213        self._update_mask = Some(new_value);
19214        self
19215    }
19216    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19217    /// while executing the actual API request.
19218    ///
19219    /// ````text
19220    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19221    /// ````
19222    ///
19223    /// Sets the *delegate* property to the given value.
19224    pub fn delegate(
19225        mut self,
19226        new_value: &'a mut dyn common::Delegate,
19227    ) -> AdvertiserCreativePatchCall<'a, C> {
19228        self._delegate = Some(new_value);
19229        self
19230    }
19231
19232    /// Set any additional parameter of the query string used in the request.
19233    /// It should be used to set parameters which are not yet available through their own
19234    /// setters.
19235    ///
19236    /// Please note that this method must not be used to set any of the known parameters
19237    /// which have their own setter method. If done anyway, the request will fail.
19238    ///
19239    /// # Additional Parameters
19240    ///
19241    /// * *$.xgafv* (query-string) - V1 error format.
19242    /// * *access_token* (query-string) - OAuth access token.
19243    /// * *alt* (query-string) - Data format for response.
19244    /// * *callback* (query-string) - JSONP
19245    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19246    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19247    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19248    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19249    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19250    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19251    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19252    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserCreativePatchCall<'a, C>
19253    where
19254        T: AsRef<str>,
19255    {
19256        self._additional_params
19257            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19258        self
19259    }
19260
19261    /// Identifies the authorization scope for the method you are building.
19262    ///
19263    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19264    /// [`Scope::DisplayVideo`].
19265    ///
19266    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19267    /// tokens for more than one scope.
19268    ///
19269    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19270    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19271    /// sufficient, a read-write scope will do as well.
19272    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserCreativePatchCall<'a, C>
19273    where
19274        St: AsRef<str>,
19275    {
19276        self._scopes.insert(String::from(scope.as_ref()));
19277        self
19278    }
19279    /// Identifies the authorization scope(s) for the method you are building.
19280    ///
19281    /// See [`Self::add_scope()`] for details.
19282    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserCreativePatchCall<'a, C>
19283    where
19284        I: IntoIterator<Item = St>,
19285        St: AsRef<str>,
19286    {
19287        self._scopes
19288            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19289        self
19290    }
19291
19292    /// Removes all scopes, and no default scope will be used either.
19293    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19294    /// for details).
19295    pub fn clear_scopes(mut self) -> AdvertiserCreativePatchCall<'a, C> {
19296        self._scopes.clear();
19297        self
19298    }
19299}
19300
19301/// Gets a single targeting option assigned to an insertion order.
19302///
19303/// A builder for the *insertionOrders.targetingTypes.assignedTargetingOptions.get* method supported by a *advertiser* resource.
19304/// It is not used directly, but through a [`AdvertiserMethods`] instance.
19305///
19306/// # Example
19307///
19308/// Instantiate a resource method builder
19309///
19310/// ```test_harness,no_run
19311/// # extern crate hyper;
19312/// # extern crate hyper_rustls;
19313/// # extern crate google_displayvideo1 as displayvideo1;
19314/// # async fn dox() {
19315/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19316///
19317/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19318/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19319/// #     secret,
19320/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19321/// # ).build().await.unwrap();
19322///
19323/// # let client = hyper_util::client::legacy::Client::builder(
19324/// #     hyper_util::rt::TokioExecutor::new()
19325/// # )
19326/// # .build(
19327/// #     hyper_rustls::HttpsConnectorBuilder::new()
19328/// #         .with_native_roots()
19329/// #         .unwrap()
19330/// #         .https_or_http()
19331/// #         .enable_http1()
19332/// #         .build()
19333/// # );
19334/// # let mut hub = DisplayVideo::new(client, auth);
19335/// // You can configure optional parameters by calling the respective setters at will, and
19336/// // execute the final call using `doit()`.
19337/// // Values shown here are possibly random and not representative !
19338/// let result = hub.advertisers().insertion_orders_targeting_types_assigned_targeting_options_get(-17, -95, "targetingType", "assignedTargetingOptionId")
19339///              .doit().await;
19340/// # }
19341/// ```
19342pub struct AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionGetCall<'a, C>
19343where
19344    C: 'a,
19345{
19346    hub: &'a DisplayVideo<C>,
19347    _advertiser_id: i64,
19348    _insertion_order_id: i64,
19349    _targeting_type: String,
19350    _assigned_targeting_option_id: String,
19351    _delegate: Option<&'a mut dyn common::Delegate>,
19352    _additional_params: HashMap<String, String>,
19353    _scopes: BTreeSet<String>,
19354}
19355
19356impl<'a, C> common::CallBuilder
19357    for AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionGetCall<'a, C>
19358{
19359}
19360
19361impl<'a, C> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionGetCall<'a, C>
19362where
19363    C: common::Connector,
19364{
19365    /// Perform the operation you have build so far.
19366    pub async fn doit(mut self) -> common::Result<(common::Response, AssignedTargetingOption)> {
19367        use std::borrow::Cow;
19368        use std::io::{Read, Seek};
19369
19370        use common::{url::Params, ToParts};
19371        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19372
19373        let mut dd = common::DefaultDelegate;
19374        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19375        dlg.begin(common::MethodInfo { id: "displayvideo.advertisers.insertionOrders.targetingTypes.assignedTargetingOptions.get",
19376                               http_method: hyper::Method::GET });
19377
19378        for &field in [
19379            "alt",
19380            "advertiserId",
19381            "insertionOrderId",
19382            "targetingType",
19383            "assignedTargetingOptionId",
19384        ]
19385        .iter()
19386        {
19387            if self._additional_params.contains_key(field) {
19388                dlg.finished(false);
19389                return Err(common::Error::FieldClash(field));
19390            }
19391        }
19392
19393        let mut params = Params::with_capacity(6 + self._additional_params.len());
19394        params.push("advertiserId", self._advertiser_id.to_string());
19395        params.push("insertionOrderId", self._insertion_order_id.to_string());
19396        params.push("targetingType", self._targeting_type);
19397        params.push(
19398            "assignedTargetingOptionId",
19399            self._assigned_targeting_option_id,
19400        );
19401
19402        params.extend(self._additional_params.iter());
19403
19404        params.push("alt", "json");
19405        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/insertionOrders/{+insertionOrderId}/targetingTypes/{+targetingType}/assignedTargetingOptions/{+assignedTargetingOptionId}";
19406        if self._scopes.is_empty() {
19407            self._scopes
19408                .insert(Scope::DisplayVideo.as_ref().to_string());
19409        }
19410
19411        #[allow(clippy::single_element_loop)]
19412        for &(find_this, param_name) in [
19413            ("{+advertiserId}", "advertiserId"),
19414            ("{+insertionOrderId}", "insertionOrderId"),
19415            ("{+targetingType}", "targetingType"),
19416            ("{+assignedTargetingOptionId}", "assignedTargetingOptionId"),
19417        ]
19418        .iter()
19419        {
19420            url = params.uri_replacement(url, param_name, find_this, true);
19421        }
19422        {
19423            let to_remove = [
19424                "assignedTargetingOptionId",
19425                "targetingType",
19426                "insertionOrderId",
19427                "advertiserId",
19428            ];
19429            params.remove_params(&to_remove);
19430        }
19431
19432        let url = params.parse_with_url(&url);
19433
19434        loop {
19435            let token = match self
19436                .hub
19437                .auth
19438                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19439                .await
19440            {
19441                Ok(token) => token,
19442                Err(e) => match dlg.token(e) {
19443                    Ok(token) => token,
19444                    Err(e) => {
19445                        dlg.finished(false);
19446                        return Err(common::Error::MissingToken(e));
19447                    }
19448                },
19449            };
19450            let mut req_result = {
19451                let client = &self.hub.client;
19452                dlg.pre_request();
19453                let mut req_builder = hyper::Request::builder()
19454                    .method(hyper::Method::GET)
19455                    .uri(url.as_str())
19456                    .header(USER_AGENT, self.hub._user_agent.clone());
19457
19458                if let Some(token) = token.as_ref() {
19459                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19460                }
19461
19462                let request = req_builder
19463                    .header(CONTENT_LENGTH, 0_u64)
19464                    .body(common::to_body::<String>(None));
19465
19466                client.request(request.unwrap()).await
19467            };
19468
19469            match req_result {
19470                Err(err) => {
19471                    if let common::Retry::After(d) = dlg.http_error(&err) {
19472                        sleep(d).await;
19473                        continue;
19474                    }
19475                    dlg.finished(false);
19476                    return Err(common::Error::HttpError(err));
19477                }
19478                Ok(res) => {
19479                    let (mut parts, body) = res.into_parts();
19480                    let mut body = common::Body::new(body);
19481                    if !parts.status.is_success() {
19482                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19483                        let error = serde_json::from_str(&common::to_string(&bytes));
19484                        let response = common::to_response(parts, bytes.into());
19485
19486                        if let common::Retry::After(d) =
19487                            dlg.http_failure(&response, error.as_ref().ok())
19488                        {
19489                            sleep(d).await;
19490                            continue;
19491                        }
19492
19493                        dlg.finished(false);
19494
19495                        return Err(match error {
19496                            Ok(value) => common::Error::BadRequest(value),
19497                            _ => common::Error::Failure(response),
19498                        });
19499                    }
19500                    let response = {
19501                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19502                        let encoded = common::to_string(&bytes);
19503                        match serde_json::from_str(&encoded) {
19504                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19505                            Err(error) => {
19506                                dlg.response_json_decode_error(&encoded, &error);
19507                                return Err(common::Error::JsonDecodeError(
19508                                    encoded.to_string(),
19509                                    error,
19510                                ));
19511                            }
19512                        }
19513                    };
19514
19515                    dlg.finished(true);
19516                    return Ok(response);
19517                }
19518            }
19519        }
19520    }
19521
19522    /// Required. The ID of the advertiser the insertion order belongs to.
19523    ///
19524    /// Sets the *advertiser id* path property to the given value.
19525    ///
19526    /// Even though the property as already been set when instantiating this call,
19527    /// we provide this method for API completeness.
19528    pub fn advertiser_id(
19529        mut self,
19530        new_value: i64,
19531    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
19532        self._advertiser_id = new_value;
19533        self
19534    }
19535    /// Required. The ID of the insertion order the assigned targeting option belongs to.
19536    ///
19537    /// Sets the *insertion order id* path property to the given value.
19538    ///
19539    /// Even though the property as already been set when instantiating this call,
19540    /// we provide this method for API completeness.
19541    pub fn insertion_order_id(
19542        mut self,
19543        new_value: i64,
19544    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
19545        self._insertion_order_id = new_value;
19546        self
19547    }
19548    /// Required. Identifies the type of this assigned targeting option. Supported targeting types include: * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_APP` * `TARGETING_TYPE_APP_CATEGORY` * `TARGETING_TYPE_AUDIENCE_GROUP` * `TARGETING_TYPE_AUDIO_CONTENT_TYPE` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_BROWSER` * `TARGETING_TYPE_BUSINESS_CHAIN` * `TARGETING_TYPE_CARRIER_AND_ISP` * `TARGETING_TYPE_CATEGORY` * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_CONTENT_DURATION` * `TARGETING_TYPE_CONTENT_GENRE` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_STREAM_TYPE` * `TARGETING_TYPE_DAY_AND_TIME` * `TARGETING_TYPE_DEVICE_MAKE_MODEL` * `TARGETING_TYPE_DEVICE_TYPE` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_INVENTORY_SOURCE` * `TARGETING_TYPE_INVENTORY_SOURCE_GROUP` * `TARGETING_TYPE_KEYWORD` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_NATIVE_CONTENT_POSITION` * `TARGETING_TYPE_NEGATIVE_KEYWORD_LIST` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_OPERATING_SYSTEM` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_POI` * `TARGETING_TYPE_PROXIMITY_LOCATION_LIST` * `TARGETING_TYPE_REGIONAL_LOCATION_LIST` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_THIRD_PARTY_VERIFIER` * `TARGETING_TYPE_URL` * `TARGETING_TYPE_USER_REWARDED_CONTENT` * `TARGETING_TYPE_VIDEO_PLAYER_SIZE` * `TARGETING_TYPE_VIEWABILITY`
19549    ///
19550    /// Sets the *targeting type* path property to the given value.
19551    ///
19552    /// Even though the property as already been set when instantiating this call,
19553    /// we provide this method for API completeness.
19554    pub fn targeting_type(
19555        mut self,
19556        new_value: &str,
19557    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
19558        self._targeting_type = new_value.to_string();
19559        self
19560    }
19561    /// Required. An identifier unique to the targeting type in this insertion order that identifies the assigned targeting option being requested.
19562    ///
19563    /// Sets the *assigned targeting option id* path property to the given value.
19564    ///
19565    /// Even though the property as already been set when instantiating this call,
19566    /// we provide this method for API completeness.
19567    pub fn assigned_targeting_option_id(
19568        mut self,
19569        new_value: &str,
19570    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
19571        self._assigned_targeting_option_id = new_value.to_string();
19572        self
19573    }
19574    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19575    /// while executing the actual API request.
19576    ///
19577    /// ````text
19578    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19579    /// ````
19580    ///
19581    /// Sets the *delegate* property to the given value.
19582    pub fn delegate(
19583        mut self,
19584        new_value: &'a mut dyn common::Delegate,
19585    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
19586        self._delegate = Some(new_value);
19587        self
19588    }
19589
19590    /// Set any additional parameter of the query string used in the request.
19591    /// It should be used to set parameters which are not yet available through their own
19592    /// setters.
19593    ///
19594    /// Please note that this method must not be used to set any of the known parameters
19595    /// which have their own setter method. If done anyway, the request will fail.
19596    ///
19597    /// # Additional Parameters
19598    ///
19599    /// * *$.xgafv* (query-string) - V1 error format.
19600    /// * *access_token* (query-string) - OAuth access token.
19601    /// * *alt* (query-string) - Data format for response.
19602    /// * *callback* (query-string) - JSONP
19603    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19604    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19605    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19606    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19607    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19608    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19609    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19610    pub fn param<T>(
19611        mut self,
19612        name: T,
19613        value: T,
19614    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionGetCall<'a, C>
19615    where
19616        T: AsRef<str>,
19617    {
19618        self._additional_params
19619            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19620        self
19621    }
19622
19623    /// Identifies the authorization scope for the method you are building.
19624    ///
19625    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19626    /// [`Scope::DisplayVideo`].
19627    ///
19628    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19629    /// tokens for more than one scope.
19630    ///
19631    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19632    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19633    /// sufficient, a read-write scope will do as well.
19634    pub fn add_scope<St>(
19635        mut self,
19636        scope: St,
19637    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionGetCall<'a, C>
19638    where
19639        St: AsRef<str>,
19640    {
19641        self._scopes.insert(String::from(scope.as_ref()));
19642        self
19643    }
19644    /// Identifies the authorization scope(s) for the method you are building.
19645    ///
19646    /// See [`Self::add_scope()`] for details.
19647    pub fn add_scopes<I, St>(
19648        mut self,
19649        scopes: I,
19650    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionGetCall<'a, C>
19651    where
19652        I: IntoIterator<Item = St>,
19653        St: AsRef<str>,
19654    {
19655        self._scopes
19656            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19657        self
19658    }
19659
19660    /// Removes all scopes, and no default scope will be used either.
19661    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19662    /// for details).
19663    pub fn clear_scopes(
19664        mut self,
19665    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
19666        self._scopes.clear();
19667        self
19668    }
19669}
19670
19671/// Lists the targeting options assigned to an insertion order.
19672///
19673/// A builder for the *insertionOrders.targetingTypes.assignedTargetingOptions.list* method supported by a *advertiser* resource.
19674/// It is not used directly, but through a [`AdvertiserMethods`] instance.
19675///
19676/// # Example
19677///
19678/// Instantiate a resource method builder
19679///
19680/// ```test_harness,no_run
19681/// # extern crate hyper;
19682/// # extern crate hyper_rustls;
19683/// # extern crate google_displayvideo1 as displayvideo1;
19684/// # async fn dox() {
19685/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19686///
19687/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19688/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19689/// #     secret,
19690/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19691/// # ).build().await.unwrap();
19692///
19693/// # let client = hyper_util::client::legacy::Client::builder(
19694/// #     hyper_util::rt::TokioExecutor::new()
19695/// # )
19696/// # .build(
19697/// #     hyper_rustls::HttpsConnectorBuilder::new()
19698/// #         .with_native_roots()
19699/// #         .unwrap()
19700/// #         .https_or_http()
19701/// #         .enable_http1()
19702/// #         .build()
19703/// # );
19704/// # let mut hub = DisplayVideo::new(client, auth);
19705/// // You can configure optional parameters by calling the respective setters at will, and
19706/// // execute the final call using `doit()`.
19707/// // Values shown here are possibly random and not representative !
19708/// let result = hub.advertisers().insertion_orders_targeting_types_assigned_targeting_options_list(-11, -7, "targetingType")
19709///              .page_token("sed")
19710///              .page_size(-98)
19711///              .order_by("et")
19712///              .filter("tempor")
19713///              .doit().await;
19714/// # }
19715/// ```
19716pub struct AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall<'a, C>
19717where
19718    C: 'a,
19719{
19720    hub: &'a DisplayVideo<C>,
19721    _advertiser_id: i64,
19722    _insertion_order_id: i64,
19723    _targeting_type: String,
19724    _page_token: Option<String>,
19725    _page_size: Option<i32>,
19726    _order_by: Option<String>,
19727    _filter: Option<String>,
19728    _delegate: Option<&'a mut dyn common::Delegate>,
19729    _additional_params: HashMap<String, String>,
19730    _scopes: BTreeSet<String>,
19731}
19732
19733impl<'a, C> common::CallBuilder
19734    for AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall<'a, C>
19735{
19736}
19737
19738impl<'a, C> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall<'a, C>
19739where
19740    C: common::Connector,
19741{
19742    /// Perform the operation you have build so far.
19743    pub async fn doit(
19744        mut self,
19745    ) -> common::Result<(
19746        common::Response,
19747        ListInsertionOrderAssignedTargetingOptionsResponse,
19748    )> {
19749        use std::borrow::Cow;
19750        use std::io::{Read, Seek};
19751
19752        use common::{url::Params, ToParts};
19753        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19754
19755        let mut dd = common::DefaultDelegate;
19756        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19757        dlg.begin(common::MethodInfo { id: "displayvideo.advertisers.insertionOrders.targetingTypes.assignedTargetingOptions.list",
19758                               http_method: hyper::Method::GET });
19759
19760        for &field in [
19761            "alt",
19762            "advertiserId",
19763            "insertionOrderId",
19764            "targetingType",
19765            "pageToken",
19766            "pageSize",
19767            "orderBy",
19768            "filter",
19769        ]
19770        .iter()
19771        {
19772            if self._additional_params.contains_key(field) {
19773                dlg.finished(false);
19774                return Err(common::Error::FieldClash(field));
19775            }
19776        }
19777
19778        let mut params = Params::with_capacity(9 + self._additional_params.len());
19779        params.push("advertiserId", self._advertiser_id.to_string());
19780        params.push("insertionOrderId", self._insertion_order_id.to_string());
19781        params.push("targetingType", self._targeting_type);
19782        if let Some(value) = self._page_token.as_ref() {
19783            params.push("pageToken", value);
19784        }
19785        if let Some(value) = self._page_size.as_ref() {
19786            params.push("pageSize", value.to_string());
19787        }
19788        if let Some(value) = self._order_by.as_ref() {
19789            params.push("orderBy", value);
19790        }
19791        if let Some(value) = self._filter.as_ref() {
19792            params.push("filter", value);
19793        }
19794
19795        params.extend(self._additional_params.iter());
19796
19797        params.push("alt", "json");
19798        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/insertionOrders/{+insertionOrderId}/targetingTypes/{+targetingType}/assignedTargetingOptions";
19799        if self._scopes.is_empty() {
19800            self._scopes
19801                .insert(Scope::DisplayVideo.as_ref().to_string());
19802        }
19803
19804        #[allow(clippy::single_element_loop)]
19805        for &(find_this, param_name) in [
19806            ("{+advertiserId}", "advertiserId"),
19807            ("{+insertionOrderId}", "insertionOrderId"),
19808            ("{+targetingType}", "targetingType"),
19809        ]
19810        .iter()
19811        {
19812            url = params.uri_replacement(url, param_name, find_this, true);
19813        }
19814        {
19815            let to_remove = ["targetingType", "insertionOrderId", "advertiserId"];
19816            params.remove_params(&to_remove);
19817        }
19818
19819        let url = params.parse_with_url(&url);
19820
19821        loop {
19822            let token = match self
19823                .hub
19824                .auth
19825                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19826                .await
19827            {
19828                Ok(token) => token,
19829                Err(e) => match dlg.token(e) {
19830                    Ok(token) => token,
19831                    Err(e) => {
19832                        dlg.finished(false);
19833                        return Err(common::Error::MissingToken(e));
19834                    }
19835                },
19836            };
19837            let mut req_result = {
19838                let client = &self.hub.client;
19839                dlg.pre_request();
19840                let mut req_builder = hyper::Request::builder()
19841                    .method(hyper::Method::GET)
19842                    .uri(url.as_str())
19843                    .header(USER_AGENT, self.hub._user_agent.clone());
19844
19845                if let Some(token) = token.as_ref() {
19846                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19847                }
19848
19849                let request = req_builder
19850                    .header(CONTENT_LENGTH, 0_u64)
19851                    .body(common::to_body::<String>(None));
19852
19853                client.request(request.unwrap()).await
19854            };
19855
19856            match req_result {
19857                Err(err) => {
19858                    if let common::Retry::After(d) = dlg.http_error(&err) {
19859                        sleep(d).await;
19860                        continue;
19861                    }
19862                    dlg.finished(false);
19863                    return Err(common::Error::HttpError(err));
19864                }
19865                Ok(res) => {
19866                    let (mut parts, body) = res.into_parts();
19867                    let mut body = common::Body::new(body);
19868                    if !parts.status.is_success() {
19869                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19870                        let error = serde_json::from_str(&common::to_string(&bytes));
19871                        let response = common::to_response(parts, bytes.into());
19872
19873                        if let common::Retry::After(d) =
19874                            dlg.http_failure(&response, error.as_ref().ok())
19875                        {
19876                            sleep(d).await;
19877                            continue;
19878                        }
19879
19880                        dlg.finished(false);
19881
19882                        return Err(match error {
19883                            Ok(value) => common::Error::BadRequest(value),
19884                            _ => common::Error::Failure(response),
19885                        });
19886                    }
19887                    let response = {
19888                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19889                        let encoded = common::to_string(&bytes);
19890                        match serde_json::from_str(&encoded) {
19891                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19892                            Err(error) => {
19893                                dlg.response_json_decode_error(&encoded, &error);
19894                                return Err(common::Error::JsonDecodeError(
19895                                    encoded.to_string(),
19896                                    error,
19897                                ));
19898                            }
19899                        }
19900                    };
19901
19902                    dlg.finished(true);
19903                    return Ok(response);
19904                }
19905            }
19906        }
19907    }
19908
19909    /// Required. The ID of the advertiser the insertion order belongs to.
19910    ///
19911    /// Sets the *advertiser id* path property to the given value.
19912    ///
19913    /// Even though the property as already been set when instantiating this call,
19914    /// we provide this method for API completeness.
19915    pub fn advertiser_id(
19916        mut self,
19917        new_value: i64,
19918    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall<'a, C> {
19919        self._advertiser_id = new_value;
19920        self
19921    }
19922    /// Required. The ID of the insertion order to list assigned targeting options for.
19923    ///
19924    /// Sets the *insertion order id* path property to the given value.
19925    ///
19926    /// Even though the property as already been set when instantiating this call,
19927    /// we provide this method for API completeness.
19928    pub fn insertion_order_id(
19929        mut self,
19930        new_value: i64,
19931    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall<'a, C> {
19932        self._insertion_order_id = new_value;
19933        self
19934    }
19935    /// Required. Identifies the type of assigned targeting options to list. Supported targeting types include: * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_APP` * `TARGETING_TYPE_APP_CATEGORY` * `TARGETING_TYPE_AUDIENCE_GROUP` * `TARGETING_TYPE_AUDIO_CONTENT_TYPE` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_BROWSER` * `TARGETING_TYPE_BUSINESS_CHAIN` * `TARGETING_TYPE_CARRIER_AND_ISP` * `TARGETING_TYPE_CATEGORY` * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_CONTENT_DURATION` * `TARGETING_TYPE_CONTENT_GENRE` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_STREAM_TYPE` * `TARGETING_TYPE_DAY_AND_TIME` * `TARGETING_TYPE_DEVICE_MAKE_MODEL` * `TARGETING_TYPE_DEVICE_TYPE` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_INVENTORY_SOURCE` * `TARGETING_TYPE_INVENTORY_SOURCE_GROUP` * `TARGETING_TYPE_KEYWORD` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_NATIVE_CONTENT_POSITION` * `TARGETING_TYPE_NEGATIVE_KEYWORD_LIST` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_OPERATING_SYSTEM` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_POI` * `TARGETING_TYPE_PROXIMITY_LOCATION_LIST` * `TARGETING_TYPE_REGIONAL_LOCATION_LIST` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_THIRD_PARTY_VERIFIER` * `TARGETING_TYPE_URL` * `TARGETING_TYPE_USER_REWARDED_CONTENT` * `TARGETING_TYPE_VIDEO_PLAYER_SIZE` * `TARGETING_TYPE_VIEWABILITY`
19936    ///
19937    /// Sets the *targeting type* path property to the given value.
19938    ///
19939    /// Even though the property as already been set when instantiating this call,
19940    /// we provide this method for API completeness.
19941    pub fn targeting_type(
19942        mut self,
19943        new_value: &str,
19944    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall<'a, C> {
19945        self._targeting_type = new_value.to_string();
19946        self
19947    }
19948    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListInsertionOrderAssignedTargetingOptions` method. If not specified, the first page of results will be returned.
19949    ///
19950    /// Sets the *page token* query property to the given value.
19951    pub fn page_token(
19952        mut self,
19953        new_value: &str,
19954    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall<'a, C> {
19955        self._page_token = Some(new_value.to_string());
19956        self
19957    }
19958    /// Requested page size. Must be between `1` and `5000`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
19959    ///
19960    /// Sets the *page size* query property to the given value.
19961    pub fn page_size(
19962        mut self,
19963        new_value: i32,
19964    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall<'a, C> {
19965        self._page_size = Some(new_value);
19966        self
19967    }
19968    /// Field by which to sort the list. Acceptable values are: * `assignedTargetingOptionId` (default) The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `assignedTargetingOptionId desc`.
19969    ///
19970    /// Sets the *order by* query property to the given value.
19971    pub fn order_by(
19972        mut self,
19973        new_value: &str,
19974    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall<'a, C> {
19975        self._order_by = Some(new_value.to_string());
19976        self
19977    }
19978    /// Allows filtering by assigned targeting option fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by the logical operator `OR`. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `EQUALS (=)` operator. Supported fields: * `assignedTargetingOptionId` * `inheritance` Examples: * `AssignedTargetingOption` resources with ID 1 or 2: `assignedTargetingOptionId="1" OR assignedTargetingOptionId="2"` * `AssignedTargetingOption` resources with inheritance status of `NOT_INHERITED` or `INHERITED_FROM_PARTNER`: `inheritance="NOT_INHERITED" OR inheritance="INHERITED_FROM_PARTNER"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
19979    ///
19980    /// Sets the *filter* query property to the given value.
19981    pub fn filter(
19982        mut self,
19983        new_value: &str,
19984    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall<'a, C> {
19985        self._filter = Some(new_value.to_string());
19986        self
19987    }
19988    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19989    /// while executing the actual API request.
19990    ///
19991    /// ````text
19992    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19993    /// ````
19994    ///
19995    /// Sets the *delegate* property to the given value.
19996    pub fn delegate(
19997        mut self,
19998        new_value: &'a mut dyn common::Delegate,
19999    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall<'a, C> {
20000        self._delegate = Some(new_value);
20001        self
20002    }
20003
20004    /// Set any additional parameter of the query string used in the request.
20005    /// It should be used to set parameters which are not yet available through their own
20006    /// setters.
20007    ///
20008    /// Please note that this method must not be used to set any of the known parameters
20009    /// which have their own setter method. If done anyway, the request will fail.
20010    ///
20011    /// # Additional Parameters
20012    ///
20013    /// * *$.xgafv* (query-string) - V1 error format.
20014    /// * *access_token* (query-string) - OAuth access token.
20015    /// * *alt* (query-string) - Data format for response.
20016    /// * *callback* (query-string) - JSONP
20017    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20018    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20019    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20020    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20021    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20022    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20023    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20024    pub fn param<T>(
20025        mut self,
20026        name: T,
20027        value: T,
20028    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall<'a, C>
20029    where
20030        T: AsRef<str>,
20031    {
20032        self._additional_params
20033            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20034        self
20035    }
20036
20037    /// Identifies the authorization scope for the method you are building.
20038    ///
20039    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20040    /// [`Scope::DisplayVideo`].
20041    ///
20042    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20043    /// tokens for more than one scope.
20044    ///
20045    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20046    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20047    /// sufficient, a read-write scope will do as well.
20048    pub fn add_scope<St>(
20049        mut self,
20050        scope: St,
20051    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall<'a, C>
20052    where
20053        St: AsRef<str>,
20054    {
20055        self._scopes.insert(String::from(scope.as_ref()));
20056        self
20057    }
20058    /// Identifies the authorization scope(s) for the method you are building.
20059    ///
20060    /// See [`Self::add_scope()`] for details.
20061    pub fn add_scopes<I, St>(
20062        mut self,
20063        scopes: I,
20064    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall<'a, C>
20065    where
20066        I: IntoIterator<Item = St>,
20067        St: AsRef<str>,
20068    {
20069        self._scopes
20070            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20071        self
20072    }
20073
20074    /// Removes all scopes, and no default scope will be used either.
20075    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20076    /// for details).
20077    pub fn clear_scopes(
20078        mut self,
20079    ) -> AdvertiserInsertionOrderTargetingTypeAssignedTargetingOptionListCall<'a, C> {
20080        self._scopes.clear();
20081        self
20082    }
20083}
20084
20085/// Lists assigned targeting options of an insertion order across targeting types.
20086///
20087/// A builder for the *insertionOrders.bulkListInsertionOrderAssignedTargetingOptions* method supported by a *advertiser* resource.
20088/// It is not used directly, but through a [`AdvertiserMethods`] instance.
20089///
20090/// # Example
20091///
20092/// Instantiate a resource method builder
20093///
20094/// ```test_harness,no_run
20095/// # extern crate hyper;
20096/// # extern crate hyper_rustls;
20097/// # extern crate google_displayvideo1 as displayvideo1;
20098/// # async fn dox() {
20099/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20100///
20101/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20102/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20103/// #     secret,
20104/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20105/// # ).build().await.unwrap();
20106///
20107/// # let client = hyper_util::client::legacy::Client::builder(
20108/// #     hyper_util::rt::TokioExecutor::new()
20109/// # )
20110/// # .build(
20111/// #     hyper_rustls::HttpsConnectorBuilder::new()
20112/// #         .with_native_roots()
20113/// #         .unwrap()
20114/// #         .https_or_http()
20115/// #         .enable_http1()
20116/// #         .build()
20117/// # );
20118/// # let mut hub = DisplayVideo::new(client, auth);
20119/// // You can configure optional parameters by calling the respective setters at will, and
20120/// // execute the final call using `doit()`.
20121/// // Values shown here are possibly random and not representative !
20122/// let result = hub.advertisers().insertion_orders_bulk_list_insertion_order_assigned_targeting_options(-32, -5)
20123///              .page_token("et")
20124///              .page_size(-8)
20125///              .order_by("Lorem")
20126///              .filter("est")
20127///              .doit().await;
20128/// # }
20129/// ```
20130pub struct AdvertiserInsertionOrderBulkListInsertionOrderAssignedTargetingOptionCall<'a, C>
20131where
20132    C: 'a,
20133{
20134    hub: &'a DisplayVideo<C>,
20135    _advertiser_id: i64,
20136    _insertion_order_id: i64,
20137    _page_token: Option<String>,
20138    _page_size: Option<i32>,
20139    _order_by: Option<String>,
20140    _filter: Option<String>,
20141    _delegate: Option<&'a mut dyn common::Delegate>,
20142    _additional_params: HashMap<String, String>,
20143    _scopes: BTreeSet<String>,
20144}
20145
20146impl<'a, C> common::CallBuilder
20147    for AdvertiserInsertionOrderBulkListInsertionOrderAssignedTargetingOptionCall<'a, C>
20148{
20149}
20150
20151impl<'a, C> AdvertiserInsertionOrderBulkListInsertionOrderAssignedTargetingOptionCall<'a, C>
20152where
20153    C: common::Connector,
20154{
20155    /// Perform the operation you have build so far.
20156    pub async fn doit(
20157        mut self,
20158    ) -> common::Result<(
20159        common::Response,
20160        BulkListInsertionOrderAssignedTargetingOptionsResponse,
20161    )> {
20162        use std::borrow::Cow;
20163        use std::io::{Read, Seek};
20164
20165        use common::{url::Params, ToParts};
20166        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20167
20168        let mut dd = common::DefaultDelegate;
20169        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20170        dlg.begin(common::MethodInfo { id: "displayvideo.advertisers.insertionOrders.bulkListInsertionOrderAssignedTargetingOptions",
20171                               http_method: hyper::Method::GET });
20172
20173        for &field in [
20174            "alt",
20175            "advertiserId",
20176            "insertionOrderId",
20177            "pageToken",
20178            "pageSize",
20179            "orderBy",
20180            "filter",
20181        ]
20182        .iter()
20183        {
20184            if self._additional_params.contains_key(field) {
20185                dlg.finished(false);
20186                return Err(common::Error::FieldClash(field));
20187            }
20188        }
20189
20190        let mut params = Params::with_capacity(8 + self._additional_params.len());
20191        params.push("advertiserId", self._advertiser_id.to_string());
20192        params.push("insertionOrderId", self._insertion_order_id.to_string());
20193        if let Some(value) = self._page_token.as_ref() {
20194            params.push("pageToken", value);
20195        }
20196        if let Some(value) = self._page_size.as_ref() {
20197            params.push("pageSize", value.to_string());
20198        }
20199        if let Some(value) = self._order_by.as_ref() {
20200            params.push("orderBy", value);
20201        }
20202        if let Some(value) = self._filter.as_ref() {
20203            params.push("filter", value);
20204        }
20205
20206        params.extend(self._additional_params.iter());
20207
20208        params.push("alt", "json");
20209        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/insertionOrders/{+insertionOrderId}:bulkListInsertionOrderAssignedTargetingOptions";
20210        if self._scopes.is_empty() {
20211            self._scopes
20212                .insert(Scope::DisplayVideo.as_ref().to_string());
20213        }
20214
20215        #[allow(clippy::single_element_loop)]
20216        for &(find_this, param_name) in [
20217            ("{+advertiserId}", "advertiserId"),
20218            ("{+insertionOrderId}", "insertionOrderId"),
20219        ]
20220        .iter()
20221        {
20222            url = params.uri_replacement(url, param_name, find_this, true);
20223        }
20224        {
20225            let to_remove = ["insertionOrderId", "advertiserId"];
20226            params.remove_params(&to_remove);
20227        }
20228
20229        let url = params.parse_with_url(&url);
20230
20231        loop {
20232            let token = match self
20233                .hub
20234                .auth
20235                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20236                .await
20237            {
20238                Ok(token) => token,
20239                Err(e) => match dlg.token(e) {
20240                    Ok(token) => token,
20241                    Err(e) => {
20242                        dlg.finished(false);
20243                        return Err(common::Error::MissingToken(e));
20244                    }
20245                },
20246            };
20247            let mut req_result = {
20248                let client = &self.hub.client;
20249                dlg.pre_request();
20250                let mut req_builder = hyper::Request::builder()
20251                    .method(hyper::Method::GET)
20252                    .uri(url.as_str())
20253                    .header(USER_AGENT, self.hub._user_agent.clone());
20254
20255                if let Some(token) = token.as_ref() {
20256                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20257                }
20258
20259                let request = req_builder
20260                    .header(CONTENT_LENGTH, 0_u64)
20261                    .body(common::to_body::<String>(None));
20262
20263                client.request(request.unwrap()).await
20264            };
20265
20266            match req_result {
20267                Err(err) => {
20268                    if let common::Retry::After(d) = dlg.http_error(&err) {
20269                        sleep(d).await;
20270                        continue;
20271                    }
20272                    dlg.finished(false);
20273                    return Err(common::Error::HttpError(err));
20274                }
20275                Ok(res) => {
20276                    let (mut parts, body) = res.into_parts();
20277                    let mut body = common::Body::new(body);
20278                    if !parts.status.is_success() {
20279                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20280                        let error = serde_json::from_str(&common::to_string(&bytes));
20281                        let response = common::to_response(parts, bytes.into());
20282
20283                        if let common::Retry::After(d) =
20284                            dlg.http_failure(&response, error.as_ref().ok())
20285                        {
20286                            sleep(d).await;
20287                            continue;
20288                        }
20289
20290                        dlg.finished(false);
20291
20292                        return Err(match error {
20293                            Ok(value) => common::Error::BadRequest(value),
20294                            _ => common::Error::Failure(response),
20295                        });
20296                    }
20297                    let response = {
20298                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20299                        let encoded = common::to_string(&bytes);
20300                        match serde_json::from_str(&encoded) {
20301                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20302                            Err(error) => {
20303                                dlg.response_json_decode_error(&encoded, &error);
20304                                return Err(common::Error::JsonDecodeError(
20305                                    encoded.to_string(),
20306                                    error,
20307                                ));
20308                            }
20309                        }
20310                    };
20311
20312                    dlg.finished(true);
20313                    return Ok(response);
20314                }
20315            }
20316        }
20317    }
20318
20319    /// Required. The ID of the advertiser the insertion order belongs to.
20320    ///
20321    /// Sets the *advertiser id* path property to the given value.
20322    ///
20323    /// Even though the property as already been set when instantiating this call,
20324    /// we provide this method for API completeness.
20325    pub fn advertiser_id(
20326        mut self,
20327        new_value: i64,
20328    ) -> AdvertiserInsertionOrderBulkListInsertionOrderAssignedTargetingOptionCall<'a, C> {
20329        self._advertiser_id = new_value;
20330        self
20331    }
20332    /// Required. The ID of the insertion order to list assigned targeting options for.
20333    ///
20334    /// Sets the *insertion order id* path property to the given value.
20335    ///
20336    /// Even though the property as already been set when instantiating this call,
20337    /// we provide this method for API completeness.
20338    pub fn insertion_order_id(
20339        mut self,
20340        new_value: i64,
20341    ) -> AdvertiserInsertionOrderBulkListInsertionOrderAssignedTargetingOptionCall<'a, C> {
20342        self._insertion_order_id = new_value;
20343        self
20344    }
20345    /// A token that lets the client fetch the next page of results. Typically, this is the value of next_page_token returned from the previous call to `BulkListInsertionOrderAssignedTargetingOptions` method. If not specified, the first page of results will be returned.
20346    ///
20347    /// Sets the *page token* query property to the given value.
20348    pub fn page_token(
20349        mut self,
20350        new_value: &str,
20351    ) -> AdvertiserInsertionOrderBulkListInsertionOrderAssignedTargetingOptionCall<'a, C> {
20352        self._page_token = Some(new_value.to_string());
20353        self
20354    }
20355    /// Requested page size. The size must be an integer between `1` and `5000`. If unspecified, the default is `5000`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
20356    ///
20357    /// Sets the *page size* query property to the given value.
20358    pub fn page_size(
20359        mut self,
20360        new_value: i32,
20361    ) -> AdvertiserInsertionOrderBulkListInsertionOrderAssignedTargetingOptionCall<'a, C> {
20362        self._page_size = Some(new_value);
20363        self
20364    }
20365    /// Field by which to sort the list. Acceptable values are: * `targetingType` (default) The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `targetingType desc`.
20366    ///
20367    /// Sets the *order by* query property to the given value.
20368    pub fn order_by(
20369        mut self,
20370        new_value: &str,
20371    ) -> AdvertiserInsertionOrderBulkListInsertionOrderAssignedTargetingOptionCall<'a, C> {
20372        self._order_by = Some(new_value.to_string());
20373        self
20374    }
20375    /// Allows filtering by assigned targeting option fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by the logical operator `OR`. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `EQUALS (=)` operator. Supported fields: * `targetingType` * `inheritance` Examples: * `AssignedTargetingOption` resources of targeting type `TARGETING_TYPE_PROXIMITY_LOCATION_LIST` or `TARGETING_TYPE_CHANNEL`: `targetingType="TARGETING_TYPE_PROXIMITY_LOCATION_LIST" OR targetingType="TARGETING_TYPE_CHANNEL"` * `AssignedTargetingOption` resources with inheritance status of `NOT_INHERITED` or `INHERITED_FROM_PARTNER`: `inheritance="NOT_INHERITED" OR inheritance="INHERITED_FROM_PARTNER"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
20376    ///
20377    /// Sets the *filter* query property to the given value.
20378    pub fn filter(
20379        mut self,
20380        new_value: &str,
20381    ) -> AdvertiserInsertionOrderBulkListInsertionOrderAssignedTargetingOptionCall<'a, C> {
20382        self._filter = Some(new_value.to_string());
20383        self
20384    }
20385    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20386    /// while executing the actual API request.
20387    ///
20388    /// ````text
20389    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20390    /// ````
20391    ///
20392    /// Sets the *delegate* property to the given value.
20393    pub fn delegate(
20394        mut self,
20395        new_value: &'a mut dyn common::Delegate,
20396    ) -> AdvertiserInsertionOrderBulkListInsertionOrderAssignedTargetingOptionCall<'a, C> {
20397        self._delegate = Some(new_value);
20398        self
20399    }
20400
20401    /// Set any additional parameter of the query string used in the request.
20402    /// It should be used to set parameters which are not yet available through their own
20403    /// setters.
20404    ///
20405    /// Please note that this method must not be used to set any of the known parameters
20406    /// which have their own setter method. If done anyway, the request will fail.
20407    ///
20408    /// # Additional Parameters
20409    ///
20410    /// * *$.xgafv* (query-string) - V1 error format.
20411    /// * *access_token* (query-string) - OAuth access token.
20412    /// * *alt* (query-string) - Data format for response.
20413    /// * *callback* (query-string) - JSONP
20414    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20415    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20416    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20417    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20418    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20419    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20420    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20421    pub fn param<T>(
20422        mut self,
20423        name: T,
20424        value: T,
20425    ) -> AdvertiserInsertionOrderBulkListInsertionOrderAssignedTargetingOptionCall<'a, C>
20426    where
20427        T: AsRef<str>,
20428    {
20429        self._additional_params
20430            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20431        self
20432    }
20433
20434    /// Identifies the authorization scope for the method you are building.
20435    ///
20436    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20437    /// [`Scope::DisplayVideo`].
20438    ///
20439    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20440    /// tokens for more than one scope.
20441    ///
20442    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20443    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20444    /// sufficient, a read-write scope will do as well.
20445    pub fn add_scope<St>(
20446        mut self,
20447        scope: St,
20448    ) -> AdvertiserInsertionOrderBulkListInsertionOrderAssignedTargetingOptionCall<'a, C>
20449    where
20450        St: AsRef<str>,
20451    {
20452        self._scopes.insert(String::from(scope.as_ref()));
20453        self
20454    }
20455    /// Identifies the authorization scope(s) for the method you are building.
20456    ///
20457    /// See [`Self::add_scope()`] for details.
20458    pub fn add_scopes<I, St>(
20459        mut self,
20460        scopes: I,
20461    ) -> AdvertiserInsertionOrderBulkListInsertionOrderAssignedTargetingOptionCall<'a, C>
20462    where
20463        I: IntoIterator<Item = St>,
20464        St: AsRef<str>,
20465    {
20466        self._scopes
20467            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20468        self
20469    }
20470
20471    /// Removes all scopes, and no default scope will be used either.
20472    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20473    /// for details).
20474    pub fn clear_scopes(
20475        mut self,
20476    ) -> AdvertiserInsertionOrderBulkListInsertionOrderAssignedTargetingOptionCall<'a, C> {
20477        self._scopes.clear();
20478        self
20479    }
20480}
20481
20482/// Creates a new insertion order. Returns the newly created insertion order if successful.
20483///
20484/// A builder for the *insertionOrders.create* method supported by a *advertiser* resource.
20485/// It is not used directly, but through a [`AdvertiserMethods`] instance.
20486///
20487/// # Example
20488///
20489/// Instantiate a resource method builder
20490///
20491/// ```test_harness,no_run
20492/// # extern crate hyper;
20493/// # extern crate hyper_rustls;
20494/// # extern crate google_displayvideo1 as displayvideo1;
20495/// use displayvideo1::api::InsertionOrder;
20496/// # async fn dox() {
20497/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20498///
20499/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20500/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20501/// #     secret,
20502/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20503/// # ).build().await.unwrap();
20504///
20505/// # let client = hyper_util::client::legacy::Client::builder(
20506/// #     hyper_util::rt::TokioExecutor::new()
20507/// # )
20508/// # .build(
20509/// #     hyper_rustls::HttpsConnectorBuilder::new()
20510/// #         .with_native_roots()
20511/// #         .unwrap()
20512/// #         .https_or_http()
20513/// #         .enable_http1()
20514/// #         .build()
20515/// # );
20516/// # let mut hub = DisplayVideo::new(client, auth);
20517/// // As the method needs a request, you would usually fill it with the desired information
20518/// // into the respective structure. Some of the parts shown here might not be applicable !
20519/// // Values shown here are possibly random and not representative !
20520/// let mut req = InsertionOrder::default();
20521///
20522/// // You can configure optional parameters by calling the respective setters at will, and
20523/// // execute the final call using `doit()`.
20524/// // Values shown here are possibly random and not representative !
20525/// let result = hub.advertisers().insertion_orders_create(req, -30)
20526///              .doit().await;
20527/// # }
20528/// ```
20529pub struct AdvertiserInsertionOrderCreateCall<'a, C>
20530where
20531    C: 'a,
20532{
20533    hub: &'a DisplayVideo<C>,
20534    _request: InsertionOrder,
20535    _advertiser_id: i64,
20536    _delegate: Option<&'a mut dyn common::Delegate>,
20537    _additional_params: HashMap<String, String>,
20538    _scopes: BTreeSet<String>,
20539}
20540
20541impl<'a, C> common::CallBuilder for AdvertiserInsertionOrderCreateCall<'a, C> {}
20542
20543impl<'a, C> AdvertiserInsertionOrderCreateCall<'a, C>
20544where
20545    C: common::Connector,
20546{
20547    /// Perform the operation you have build so far.
20548    pub async fn doit(mut self) -> common::Result<(common::Response, InsertionOrder)> {
20549        use std::borrow::Cow;
20550        use std::io::{Read, Seek};
20551
20552        use common::{url::Params, ToParts};
20553        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20554
20555        let mut dd = common::DefaultDelegate;
20556        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20557        dlg.begin(common::MethodInfo {
20558            id: "displayvideo.advertisers.insertionOrders.create",
20559            http_method: hyper::Method::POST,
20560        });
20561
20562        for &field in ["alt", "advertiserId"].iter() {
20563            if self._additional_params.contains_key(field) {
20564                dlg.finished(false);
20565                return Err(common::Error::FieldClash(field));
20566            }
20567        }
20568
20569        let mut params = Params::with_capacity(4 + self._additional_params.len());
20570        params.push("advertiserId", self._advertiser_id.to_string());
20571
20572        params.extend(self._additional_params.iter());
20573
20574        params.push("alt", "json");
20575        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/insertionOrders";
20576        if self._scopes.is_empty() {
20577            self._scopes
20578                .insert(Scope::DisplayVideo.as_ref().to_string());
20579        }
20580
20581        #[allow(clippy::single_element_loop)]
20582        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
20583            url = params.uri_replacement(url, param_name, find_this, true);
20584        }
20585        {
20586            let to_remove = ["advertiserId"];
20587            params.remove_params(&to_remove);
20588        }
20589
20590        let url = params.parse_with_url(&url);
20591
20592        let mut json_mime_type = mime::APPLICATION_JSON;
20593        let mut request_value_reader = {
20594            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20595            common::remove_json_null_values(&mut value);
20596            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20597            serde_json::to_writer(&mut dst, &value).unwrap();
20598            dst
20599        };
20600        let request_size = request_value_reader
20601            .seek(std::io::SeekFrom::End(0))
20602            .unwrap();
20603        request_value_reader
20604            .seek(std::io::SeekFrom::Start(0))
20605            .unwrap();
20606
20607        loop {
20608            let token = match self
20609                .hub
20610                .auth
20611                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20612                .await
20613            {
20614                Ok(token) => token,
20615                Err(e) => match dlg.token(e) {
20616                    Ok(token) => token,
20617                    Err(e) => {
20618                        dlg.finished(false);
20619                        return Err(common::Error::MissingToken(e));
20620                    }
20621                },
20622            };
20623            request_value_reader
20624                .seek(std::io::SeekFrom::Start(0))
20625                .unwrap();
20626            let mut req_result = {
20627                let client = &self.hub.client;
20628                dlg.pre_request();
20629                let mut req_builder = hyper::Request::builder()
20630                    .method(hyper::Method::POST)
20631                    .uri(url.as_str())
20632                    .header(USER_AGENT, self.hub._user_agent.clone());
20633
20634                if let Some(token) = token.as_ref() {
20635                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20636                }
20637
20638                let request = req_builder
20639                    .header(CONTENT_TYPE, json_mime_type.to_string())
20640                    .header(CONTENT_LENGTH, request_size as u64)
20641                    .body(common::to_body(
20642                        request_value_reader.get_ref().clone().into(),
20643                    ));
20644
20645                client.request(request.unwrap()).await
20646            };
20647
20648            match req_result {
20649                Err(err) => {
20650                    if let common::Retry::After(d) = dlg.http_error(&err) {
20651                        sleep(d).await;
20652                        continue;
20653                    }
20654                    dlg.finished(false);
20655                    return Err(common::Error::HttpError(err));
20656                }
20657                Ok(res) => {
20658                    let (mut parts, body) = res.into_parts();
20659                    let mut body = common::Body::new(body);
20660                    if !parts.status.is_success() {
20661                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20662                        let error = serde_json::from_str(&common::to_string(&bytes));
20663                        let response = common::to_response(parts, bytes.into());
20664
20665                        if let common::Retry::After(d) =
20666                            dlg.http_failure(&response, error.as_ref().ok())
20667                        {
20668                            sleep(d).await;
20669                            continue;
20670                        }
20671
20672                        dlg.finished(false);
20673
20674                        return Err(match error {
20675                            Ok(value) => common::Error::BadRequest(value),
20676                            _ => common::Error::Failure(response),
20677                        });
20678                    }
20679                    let response = {
20680                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20681                        let encoded = common::to_string(&bytes);
20682                        match serde_json::from_str(&encoded) {
20683                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20684                            Err(error) => {
20685                                dlg.response_json_decode_error(&encoded, &error);
20686                                return Err(common::Error::JsonDecodeError(
20687                                    encoded.to_string(),
20688                                    error,
20689                                ));
20690                            }
20691                        }
20692                    };
20693
20694                    dlg.finished(true);
20695                    return Ok(response);
20696                }
20697            }
20698        }
20699    }
20700
20701    ///
20702    /// Sets the *request* property to the given value.
20703    ///
20704    /// Even though the property as already been set when instantiating this call,
20705    /// we provide this method for API completeness.
20706    pub fn request(
20707        mut self,
20708        new_value: InsertionOrder,
20709    ) -> AdvertiserInsertionOrderCreateCall<'a, C> {
20710        self._request = new_value;
20711        self
20712    }
20713    /// Output only. The unique ID of the advertiser the insertion order belongs to.
20714    ///
20715    /// Sets the *advertiser id* path property to the given value.
20716    ///
20717    /// Even though the property as already been set when instantiating this call,
20718    /// we provide this method for API completeness.
20719    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserInsertionOrderCreateCall<'a, C> {
20720        self._advertiser_id = new_value;
20721        self
20722    }
20723    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20724    /// while executing the actual API request.
20725    ///
20726    /// ````text
20727    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20728    /// ````
20729    ///
20730    /// Sets the *delegate* property to the given value.
20731    pub fn delegate(
20732        mut self,
20733        new_value: &'a mut dyn common::Delegate,
20734    ) -> AdvertiserInsertionOrderCreateCall<'a, C> {
20735        self._delegate = Some(new_value);
20736        self
20737    }
20738
20739    /// Set any additional parameter of the query string used in the request.
20740    /// It should be used to set parameters which are not yet available through their own
20741    /// setters.
20742    ///
20743    /// Please note that this method must not be used to set any of the known parameters
20744    /// which have their own setter method. If done anyway, the request will fail.
20745    ///
20746    /// # Additional Parameters
20747    ///
20748    /// * *$.xgafv* (query-string) - V1 error format.
20749    /// * *access_token* (query-string) - OAuth access token.
20750    /// * *alt* (query-string) - Data format for response.
20751    /// * *callback* (query-string) - JSONP
20752    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20753    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20754    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20755    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20756    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20757    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20758    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20759    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserInsertionOrderCreateCall<'a, C>
20760    where
20761        T: AsRef<str>,
20762    {
20763        self._additional_params
20764            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20765        self
20766    }
20767
20768    /// Identifies the authorization scope for the method you are building.
20769    ///
20770    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20771    /// [`Scope::DisplayVideo`].
20772    ///
20773    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20774    /// tokens for more than one scope.
20775    ///
20776    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20777    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20778    /// sufficient, a read-write scope will do as well.
20779    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserInsertionOrderCreateCall<'a, C>
20780    where
20781        St: AsRef<str>,
20782    {
20783        self._scopes.insert(String::from(scope.as_ref()));
20784        self
20785    }
20786    /// Identifies the authorization scope(s) for the method you are building.
20787    ///
20788    /// See [`Self::add_scope()`] for details.
20789    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserInsertionOrderCreateCall<'a, C>
20790    where
20791        I: IntoIterator<Item = St>,
20792        St: AsRef<str>,
20793    {
20794        self._scopes
20795            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20796        self
20797    }
20798
20799    /// Removes all scopes, and no default scope will be used either.
20800    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20801    /// for details).
20802    pub fn clear_scopes(mut self) -> AdvertiserInsertionOrderCreateCall<'a, C> {
20803        self._scopes.clear();
20804        self
20805    }
20806}
20807
20808/// Deletes an insertion order. Returns error code `NOT_FOUND` if the insertion order does not exist. The insertion order should be archived first, i.e. set entity_status to `ENTITY_STATUS_ARCHIVED`, to be able to delete it.
20809///
20810/// A builder for the *insertionOrders.delete* method supported by a *advertiser* resource.
20811/// It is not used directly, but through a [`AdvertiserMethods`] instance.
20812///
20813/// # Example
20814///
20815/// Instantiate a resource method builder
20816///
20817/// ```test_harness,no_run
20818/// # extern crate hyper;
20819/// # extern crate hyper_rustls;
20820/// # extern crate google_displayvideo1 as displayvideo1;
20821/// # async fn dox() {
20822/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20823///
20824/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20825/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20826/// #     secret,
20827/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20828/// # ).build().await.unwrap();
20829///
20830/// # let client = hyper_util::client::legacy::Client::builder(
20831/// #     hyper_util::rt::TokioExecutor::new()
20832/// # )
20833/// # .build(
20834/// #     hyper_rustls::HttpsConnectorBuilder::new()
20835/// #         .with_native_roots()
20836/// #         .unwrap()
20837/// #         .https_or_http()
20838/// #         .enable_http1()
20839/// #         .build()
20840/// # );
20841/// # let mut hub = DisplayVideo::new(client, auth);
20842/// // You can configure optional parameters by calling the respective setters at will, and
20843/// // execute the final call using `doit()`.
20844/// // Values shown here are possibly random and not representative !
20845/// let result = hub.advertisers().insertion_orders_delete(-29, -19)
20846///              .doit().await;
20847/// # }
20848/// ```
20849pub struct AdvertiserInsertionOrderDeleteCall<'a, C>
20850where
20851    C: 'a,
20852{
20853    hub: &'a DisplayVideo<C>,
20854    _advertiser_id: i64,
20855    _insertion_order_id: i64,
20856    _delegate: Option<&'a mut dyn common::Delegate>,
20857    _additional_params: HashMap<String, String>,
20858    _scopes: BTreeSet<String>,
20859}
20860
20861impl<'a, C> common::CallBuilder for AdvertiserInsertionOrderDeleteCall<'a, C> {}
20862
20863impl<'a, C> AdvertiserInsertionOrderDeleteCall<'a, C>
20864where
20865    C: common::Connector,
20866{
20867    /// Perform the operation you have build so far.
20868    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
20869        use std::borrow::Cow;
20870        use std::io::{Read, Seek};
20871
20872        use common::{url::Params, ToParts};
20873        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20874
20875        let mut dd = common::DefaultDelegate;
20876        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20877        dlg.begin(common::MethodInfo {
20878            id: "displayvideo.advertisers.insertionOrders.delete",
20879            http_method: hyper::Method::DELETE,
20880        });
20881
20882        for &field in ["alt", "advertiserId", "insertionOrderId"].iter() {
20883            if self._additional_params.contains_key(field) {
20884                dlg.finished(false);
20885                return Err(common::Error::FieldClash(field));
20886            }
20887        }
20888
20889        let mut params = Params::with_capacity(4 + self._additional_params.len());
20890        params.push("advertiserId", self._advertiser_id.to_string());
20891        params.push("insertionOrderId", self._insertion_order_id.to_string());
20892
20893        params.extend(self._additional_params.iter());
20894
20895        params.push("alt", "json");
20896        let mut url = self.hub._base_url.clone()
20897            + "v1/advertisers/{+advertiserId}/insertionOrders/{+insertionOrderId}";
20898        if self._scopes.is_empty() {
20899            self._scopes
20900                .insert(Scope::DisplayVideo.as_ref().to_string());
20901        }
20902
20903        #[allow(clippy::single_element_loop)]
20904        for &(find_this, param_name) in [
20905            ("{+advertiserId}", "advertiserId"),
20906            ("{+insertionOrderId}", "insertionOrderId"),
20907        ]
20908        .iter()
20909        {
20910            url = params.uri_replacement(url, param_name, find_this, true);
20911        }
20912        {
20913            let to_remove = ["insertionOrderId", "advertiserId"];
20914            params.remove_params(&to_remove);
20915        }
20916
20917        let url = params.parse_with_url(&url);
20918
20919        loop {
20920            let token = match self
20921                .hub
20922                .auth
20923                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20924                .await
20925            {
20926                Ok(token) => token,
20927                Err(e) => match dlg.token(e) {
20928                    Ok(token) => token,
20929                    Err(e) => {
20930                        dlg.finished(false);
20931                        return Err(common::Error::MissingToken(e));
20932                    }
20933                },
20934            };
20935            let mut req_result = {
20936                let client = &self.hub.client;
20937                dlg.pre_request();
20938                let mut req_builder = hyper::Request::builder()
20939                    .method(hyper::Method::DELETE)
20940                    .uri(url.as_str())
20941                    .header(USER_AGENT, self.hub._user_agent.clone());
20942
20943                if let Some(token) = token.as_ref() {
20944                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20945                }
20946
20947                let request = req_builder
20948                    .header(CONTENT_LENGTH, 0_u64)
20949                    .body(common::to_body::<String>(None));
20950
20951                client.request(request.unwrap()).await
20952            };
20953
20954            match req_result {
20955                Err(err) => {
20956                    if let common::Retry::After(d) = dlg.http_error(&err) {
20957                        sleep(d).await;
20958                        continue;
20959                    }
20960                    dlg.finished(false);
20961                    return Err(common::Error::HttpError(err));
20962                }
20963                Ok(res) => {
20964                    let (mut parts, body) = res.into_parts();
20965                    let mut body = common::Body::new(body);
20966                    if !parts.status.is_success() {
20967                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20968                        let error = serde_json::from_str(&common::to_string(&bytes));
20969                        let response = common::to_response(parts, bytes.into());
20970
20971                        if let common::Retry::After(d) =
20972                            dlg.http_failure(&response, error.as_ref().ok())
20973                        {
20974                            sleep(d).await;
20975                            continue;
20976                        }
20977
20978                        dlg.finished(false);
20979
20980                        return Err(match error {
20981                            Ok(value) => common::Error::BadRequest(value),
20982                            _ => common::Error::Failure(response),
20983                        });
20984                    }
20985                    let response = {
20986                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20987                        let encoded = common::to_string(&bytes);
20988                        match serde_json::from_str(&encoded) {
20989                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20990                            Err(error) => {
20991                                dlg.response_json_decode_error(&encoded, &error);
20992                                return Err(common::Error::JsonDecodeError(
20993                                    encoded.to_string(),
20994                                    error,
20995                                ));
20996                            }
20997                        }
20998                    };
20999
21000                    dlg.finished(true);
21001                    return Ok(response);
21002                }
21003            }
21004        }
21005    }
21006
21007    /// The ID of the advertiser this insertion order belongs to.
21008    ///
21009    /// Sets the *advertiser id* path property to the given value.
21010    ///
21011    /// Even though the property as already been set when instantiating this call,
21012    /// we provide this method for API completeness.
21013    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserInsertionOrderDeleteCall<'a, C> {
21014        self._advertiser_id = new_value;
21015        self
21016    }
21017    /// The ID of the insertion order to delete.
21018    ///
21019    /// Sets the *insertion order id* path property to the given value.
21020    ///
21021    /// Even though the property as already been set when instantiating this call,
21022    /// we provide this method for API completeness.
21023    pub fn insertion_order_id(
21024        mut self,
21025        new_value: i64,
21026    ) -> AdvertiserInsertionOrderDeleteCall<'a, C> {
21027        self._insertion_order_id = new_value;
21028        self
21029    }
21030    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21031    /// while executing the actual API request.
21032    ///
21033    /// ````text
21034    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21035    /// ````
21036    ///
21037    /// Sets the *delegate* property to the given value.
21038    pub fn delegate(
21039        mut self,
21040        new_value: &'a mut dyn common::Delegate,
21041    ) -> AdvertiserInsertionOrderDeleteCall<'a, C> {
21042        self._delegate = Some(new_value);
21043        self
21044    }
21045
21046    /// Set any additional parameter of the query string used in the request.
21047    /// It should be used to set parameters which are not yet available through their own
21048    /// setters.
21049    ///
21050    /// Please note that this method must not be used to set any of the known parameters
21051    /// which have their own setter method. If done anyway, the request will fail.
21052    ///
21053    /// # Additional Parameters
21054    ///
21055    /// * *$.xgafv* (query-string) - V1 error format.
21056    /// * *access_token* (query-string) - OAuth access token.
21057    /// * *alt* (query-string) - Data format for response.
21058    /// * *callback* (query-string) - JSONP
21059    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21060    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21061    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21062    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21063    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21064    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21065    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21066    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserInsertionOrderDeleteCall<'a, C>
21067    where
21068        T: AsRef<str>,
21069    {
21070        self._additional_params
21071            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21072        self
21073    }
21074
21075    /// Identifies the authorization scope for the method you are building.
21076    ///
21077    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21078    /// [`Scope::DisplayVideo`].
21079    ///
21080    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21081    /// tokens for more than one scope.
21082    ///
21083    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21084    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21085    /// sufficient, a read-write scope will do as well.
21086    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserInsertionOrderDeleteCall<'a, C>
21087    where
21088        St: AsRef<str>,
21089    {
21090        self._scopes.insert(String::from(scope.as_ref()));
21091        self
21092    }
21093    /// Identifies the authorization scope(s) for the method you are building.
21094    ///
21095    /// See [`Self::add_scope()`] for details.
21096    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserInsertionOrderDeleteCall<'a, C>
21097    where
21098        I: IntoIterator<Item = St>,
21099        St: AsRef<str>,
21100    {
21101        self._scopes
21102            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21103        self
21104    }
21105
21106    /// Removes all scopes, and no default scope will be used either.
21107    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21108    /// for details).
21109    pub fn clear_scopes(mut self) -> AdvertiserInsertionOrderDeleteCall<'a, C> {
21110        self._scopes.clear();
21111        self
21112    }
21113}
21114
21115/// Gets an insertion order. Returns error code `NOT_FOUND` if the insertion order does not exist.
21116///
21117/// A builder for the *insertionOrders.get* method supported by a *advertiser* resource.
21118/// It is not used directly, but through a [`AdvertiserMethods`] instance.
21119///
21120/// # Example
21121///
21122/// Instantiate a resource method builder
21123///
21124/// ```test_harness,no_run
21125/// # extern crate hyper;
21126/// # extern crate hyper_rustls;
21127/// # extern crate google_displayvideo1 as displayvideo1;
21128/// # async fn dox() {
21129/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21130///
21131/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21132/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21133/// #     secret,
21134/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21135/// # ).build().await.unwrap();
21136///
21137/// # let client = hyper_util::client::legacy::Client::builder(
21138/// #     hyper_util::rt::TokioExecutor::new()
21139/// # )
21140/// # .build(
21141/// #     hyper_rustls::HttpsConnectorBuilder::new()
21142/// #         .with_native_roots()
21143/// #         .unwrap()
21144/// #         .https_or_http()
21145/// #         .enable_http1()
21146/// #         .build()
21147/// # );
21148/// # let mut hub = DisplayVideo::new(client, auth);
21149/// // You can configure optional parameters by calling the respective setters at will, and
21150/// // execute the final call using `doit()`.
21151/// // Values shown here are possibly random and not representative !
21152/// let result = hub.advertisers().insertion_orders_get(-69, -68)
21153///              .doit().await;
21154/// # }
21155/// ```
21156pub struct AdvertiserInsertionOrderGetCall<'a, C>
21157where
21158    C: 'a,
21159{
21160    hub: &'a DisplayVideo<C>,
21161    _advertiser_id: i64,
21162    _insertion_order_id: i64,
21163    _delegate: Option<&'a mut dyn common::Delegate>,
21164    _additional_params: HashMap<String, String>,
21165    _scopes: BTreeSet<String>,
21166}
21167
21168impl<'a, C> common::CallBuilder for AdvertiserInsertionOrderGetCall<'a, C> {}
21169
21170impl<'a, C> AdvertiserInsertionOrderGetCall<'a, C>
21171where
21172    C: common::Connector,
21173{
21174    /// Perform the operation you have build so far.
21175    pub async fn doit(mut self) -> common::Result<(common::Response, InsertionOrder)> {
21176        use std::borrow::Cow;
21177        use std::io::{Read, Seek};
21178
21179        use common::{url::Params, ToParts};
21180        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21181
21182        let mut dd = common::DefaultDelegate;
21183        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21184        dlg.begin(common::MethodInfo {
21185            id: "displayvideo.advertisers.insertionOrders.get",
21186            http_method: hyper::Method::GET,
21187        });
21188
21189        for &field in ["alt", "advertiserId", "insertionOrderId"].iter() {
21190            if self._additional_params.contains_key(field) {
21191                dlg.finished(false);
21192                return Err(common::Error::FieldClash(field));
21193            }
21194        }
21195
21196        let mut params = Params::with_capacity(4 + self._additional_params.len());
21197        params.push("advertiserId", self._advertiser_id.to_string());
21198        params.push("insertionOrderId", self._insertion_order_id.to_string());
21199
21200        params.extend(self._additional_params.iter());
21201
21202        params.push("alt", "json");
21203        let mut url = self.hub._base_url.clone()
21204            + "v1/advertisers/{+advertiserId}/insertionOrders/{+insertionOrderId}";
21205        if self._scopes.is_empty() {
21206            self._scopes
21207                .insert(Scope::DisplayVideo.as_ref().to_string());
21208        }
21209
21210        #[allow(clippy::single_element_loop)]
21211        for &(find_this, param_name) in [
21212            ("{+advertiserId}", "advertiserId"),
21213            ("{+insertionOrderId}", "insertionOrderId"),
21214        ]
21215        .iter()
21216        {
21217            url = params.uri_replacement(url, param_name, find_this, true);
21218        }
21219        {
21220            let to_remove = ["insertionOrderId", "advertiserId"];
21221            params.remove_params(&to_remove);
21222        }
21223
21224        let url = params.parse_with_url(&url);
21225
21226        loop {
21227            let token = match self
21228                .hub
21229                .auth
21230                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21231                .await
21232            {
21233                Ok(token) => token,
21234                Err(e) => match dlg.token(e) {
21235                    Ok(token) => token,
21236                    Err(e) => {
21237                        dlg.finished(false);
21238                        return Err(common::Error::MissingToken(e));
21239                    }
21240                },
21241            };
21242            let mut req_result = {
21243                let client = &self.hub.client;
21244                dlg.pre_request();
21245                let mut req_builder = hyper::Request::builder()
21246                    .method(hyper::Method::GET)
21247                    .uri(url.as_str())
21248                    .header(USER_AGENT, self.hub._user_agent.clone());
21249
21250                if let Some(token) = token.as_ref() {
21251                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21252                }
21253
21254                let request = req_builder
21255                    .header(CONTENT_LENGTH, 0_u64)
21256                    .body(common::to_body::<String>(None));
21257
21258                client.request(request.unwrap()).await
21259            };
21260
21261            match req_result {
21262                Err(err) => {
21263                    if let common::Retry::After(d) = dlg.http_error(&err) {
21264                        sleep(d).await;
21265                        continue;
21266                    }
21267                    dlg.finished(false);
21268                    return Err(common::Error::HttpError(err));
21269                }
21270                Ok(res) => {
21271                    let (mut parts, body) = res.into_parts();
21272                    let mut body = common::Body::new(body);
21273                    if !parts.status.is_success() {
21274                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21275                        let error = serde_json::from_str(&common::to_string(&bytes));
21276                        let response = common::to_response(parts, bytes.into());
21277
21278                        if let common::Retry::After(d) =
21279                            dlg.http_failure(&response, error.as_ref().ok())
21280                        {
21281                            sleep(d).await;
21282                            continue;
21283                        }
21284
21285                        dlg.finished(false);
21286
21287                        return Err(match error {
21288                            Ok(value) => common::Error::BadRequest(value),
21289                            _ => common::Error::Failure(response),
21290                        });
21291                    }
21292                    let response = {
21293                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21294                        let encoded = common::to_string(&bytes);
21295                        match serde_json::from_str(&encoded) {
21296                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21297                            Err(error) => {
21298                                dlg.response_json_decode_error(&encoded, &error);
21299                                return Err(common::Error::JsonDecodeError(
21300                                    encoded.to_string(),
21301                                    error,
21302                                ));
21303                            }
21304                        }
21305                    };
21306
21307                    dlg.finished(true);
21308                    return Ok(response);
21309                }
21310            }
21311        }
21312    }
21313
21314    /// Required. The ID of the advertiser this insertion order belongs to.
21315    ///
21316    /// Sets the *advertiser id* path property to the given value.
21317    ///
21318    /// Even though the property as already been set when instantiating this call,
21319    /// we provide this method for API completeness.
21320    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserInsertionOrderGetCall<'a, C> {
21321        self._advertiser_id = new_value;
21322        self
21323    }
21324    /// Required. The ID of the insertion order to fetch.
21325    ///
21326    /// Sets the *insertion order id* path property to the given value.
21327    ///
21328    /// Even though the property as already been set when instantiating this call,
21329    /// we provide this method for API completeness.
21330    pub fn insertion_order_id(mut self, new_value: i64) -> AdvertiserInsertionOrderGetCall<'a, C> {
21331        self._insertion_order_id = new_value;
21332        self
21333    }
21334    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21335    /// while executing the actual API request.
21336    ///
21337    /// ````text
21338    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21339    /// ````
21340    ///
21341    /// Sets the *delegate* property to the given value.
21342    pub fn delegate(
21343        mut self,
21344        new_value: &'a mut dyn common::Delegate,
21345    ) -> AdvertiserInsertionOrderGetCall<'a, C> {
21346        self._delegate = Some(new_value);
21347        self
21348    }
21349
21350    /// Set any additional parameter of the query string used in the request.
21351    /// It should be used to set parameters which are not yet available through their own
21352    /// setters.
21353    ///
21354    /// Please note that this method must not be used to set any of the known parameters
21355    /// which have their own setter method. If done anyway, the request will fail.
21356    ///
21357    /// # Additional Parameters
21358    ///
21359    /// * *$.xgafv* (query-string) - V1 error format.
21360    /// * *access_token* (query-string) - OAuth access token.
21361    /// * *alt* (query-string) - Data format for response.
21362    /// * *callback* (query-string) - JSONP
21363    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21364    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21365    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21366    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21367    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21368    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21369    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21370    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserInsertionOrderGetCall<'a, C>
21371    where
21372        T: AsRef<str>,
21373    {
21374        self._additional_params
21375            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21376        self
21377    }
21378
21379    /// Identifies the authorization scope for the method you are building.
21380    ///
21381    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21382    /// [`Scope::DisplayVideo`].
21383    ///
21384    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21385    /// tokens for more than one scope.
21386    ///
21387    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21388    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21389    /// sufficient, a read-write scope will do as well.
21390    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserInsertionOrderGetCall<'a, C>
21391    where
21392        St: AsRef<str>,
21393    {
21394        self._scopes.insert(String::from(scope.as_ref()));
21395        self
21396    }
21397    /// Identifies the authorization scope(s) for the method you are building.
21398    ///
21399    /// See [`Self::add_scope()`] for details.
21400    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserInsertionOrderGetCall<'a, C>
21401    where
21402        I: IntoIterator<Item = St>,
21403        St: AsRef<str>,
21404    {
21405        self._scopes
21406            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21407        self
21408    }
21409
21410    /// Removes all scopes, and no default scope will be used either.
21411    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21412    /// for details).
21413    pub fn clear_scopes(mut self) -> AdvertiserInsertionOrderGetCall<'a, C> {
21414        self._scopes.clear();
21415        self
21416    }
21417}
21418
21419/// Lists insertion orders in an advertiser. The order is defined by the order_by parameter. If a filter by entity_status is not specified, insertion orders with `ENTITY_STATUS_ARCHIVED` will not be included in the results.
21420///
21421/// A builder for the *insertionOrders.list* method supported by a *advertiser* resource.
21422/// It is not used directly, but through a [`AdvertiserMethods`] instance.
21423///
21424/// # Example
21425///
21426/// Instantiate a resource method builder
21427///
21428/// ```test_harness,no_run
21429/// # extern crate hyper;
21430/// # extern crate hyper_rustls;
21431/// # extern crate google_displayvideo1 as displayvideo1;
21432/// # async fn dox() {
21433/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21434///
21435/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21436/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21437/// #     secret,
21438/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21439/// # ).build().await.unwrap();
21440///
21441/// # let client = hyper_util::client::legacy::Client::builder(
21442/// #     hyper_util::rt::TokioExecutor::new()
21443/// # )
21444/// # .build(
21445/// #     hyper_rustls::HttpsConnectorBuilder::new()
21446/// #         .with_native_roots()
21447/// #         .unwrap()
21448/// #         .https_or_http()
21449/// #         .enable_http1()
21450/// #         .build()
21451/// # );
21452/// # let mut hub = DisplayVideo::new(client, auth);
21453/// // You can configure optional parameters by calling the respective setters at will, and
21454/// // execute the final call using `doit()`.
21455/// // Values shown here are possibly random and not representative !
21456/// let result = hub.advertisers().insertion_orders_list(-93)
21457///              .page_token("no")
21458///              .page_size(-85)
21459///              .order_by("elitr")
21460///              .filter("sed")
21461///              .doit().await;
21462/// # }
21463/// ```
21464pub struct AdvertiserInsertionOrderListCall<'a, C>
21465where
21466    C: 'a,
21467{
21468    hub: &'a DisplayVideo<C>,
21469    _advertiser_id: i64,
21470    _page_token: Option<String>,
21471    _page_size: Option<i32>,
21472    _order_by: Option<String>,
21473    _filter: Option<String>,
21474    _delegate: Option<&'a mut dyn common::Delegate>,
21475    _additional_params: HashMap<String, String>,
21476    _scopes: BTreeSet<String>,
21477}
21478
21479impl<'a, C> common::CallBuilder for AdvertiserInsertionOrderListCall<'a, C> {}
21480
21481impl<'a, C> AdvertiserInsertionOrderListCall<'a, C>
21482where
21483    C: common::Connector,
21484{
21485    /// Perform the operation you have build so far.
21486    pub async fn doit(mut self) -> common::Result<(common::Response, ListInsertionOrdersResponse)> {
21487        use std::borrow::Cow;
21488        use std::io::{Read, Seek};
21489
21490        use common::{url::Params, ToParts};
21491        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21492
21493        let mut dd = common::DefaultDelegate;
21494        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21495        dlg.begin(common::MethodInfo {
21496            id: "displayvideo.advertisers.insertionOrders.list",
21497            http_method: hyper::Method::GET,
21498        });
21499
21500        for &field in [
21501            "alt",
21502            "advertiserId",
21503            "pageToken",
21504            "pageSize",
21505            "orderBy",
21506            "filter",
21507        ]
21508        .iter()
21509        {
21510            if self._additional_params.contains_key(field) {
21511                dlg.finished(false);
21512                return Err(common::Error::FieldClash(field));
21513            }
21514        }
21515
21516        let mut params = Params::with_capacity(7 + self._additional_params.len());
21517        params.push("advertiserId", self._advertiser_id.to_string());
21518        if let Some(value) = self._page_token.as_ref() {
21519            params.push("pageToken", value);
21520        }
21521        if let Some(value) = self._page_size.as_ref() {
21522            params.push("pageSize", value.to_string());
21523        }
21524        if let Some(value) = self._order_by.as_ref() {
21525            params.push("orderBy", value);
21526        }
21527        if let Some(value) = self._filter.as_ref() {
21528            params.push("filter", value);
21529        }
21530
21531        params.extend(self._additional_params.iter());
21532
21533        params.push("alt", "json");
21534        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/insertionOrders";
21535        if self._scopes.is_empty() {
21536            self._scopes
21537                .insert(Scope::DisplayVideo.as_ref().to_string());
21538        }
21539
21540        #[allow(clippy::single_element_loop)]
21541        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
21542            url = params.uri_replacement(url, param_name, find_this, true);
21543        }
21544        {
21545            let to_remove = ["advertiserId"];
21546            params.remove_params(&to_remove);
21547        }
21548
21549        let url = params.parse_with_url(&url);
21550
21551        loop {
21552            let token = match self
21553                .hub
21554                .auth
21555                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21556                .await
21557            {
21558                Ok(token) => token,
21559                Err(e) => match dlg.token(e) {
21560                    Ok(token) => token,
21561                    Err(e) => {
21562                        dlg.finished(false);
21563                        return Err(common::Error::MissingToken(e));
21564                    }
21565                },
21566            };
21567            let mut req_result = {
21568                let client = &self.hub.client;
21569                dlg.pre_request();
21570                let mut req_builder = hyper::Request::builder()
21571                    .method(hyper::Method::GET)
21572                    .uri(url.as_str())
21573                    .header(USER_AGENT, self.hub._user_agent.clone());
21574
21575                if let Some(token) = token.as_ref() {
21576                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21577                }
21578
21579                let request = req_builder
21580                    .header(CONTENT_LENGTH, 0_u64)
21581                    .body(common::to_body::<String>(None));
21582
21583                client.request(request.unwrap()).await
21584            };
21585
21586            match req_result {
21587                Err(err) => {
21588                    if let common::Retry::After(d) = dlg.http_error(&err) {
21589                        sleep(d).await;
21590                        continue;
21591                    }
21592                    dlg.finished(false);
21593                    return Err(common::Error::HttpError(err));
21594                }
21595                Ok(res) => {
21596                    let (mut parts, body) = res.into_parts();
21597                    let mut body = common::Body::new(body);
21598                    if !parts.status.is_success() {
21599                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21600                        let error = serde_json::from_str(&common::to_string(&bytes));
21601                        let response = common::to_response(parts, bytes.into());
21602
21603                        if let common::Retry::After(d) =
21604                            dlg.http_failure(&response, error.as_ref().ok())
21605                        {
21606                            sleep(d).await;
21607                            continue;
21608                        }
21609
21610                        dlg.finished(false);
21611
21612                        return Err(match error {
21613                            Ok(value) => common::Error::BadRequest(value),
21614                            _ => common::Error::Failure(response),
21615                        });
21616                    }
21617                    let response = {
21618                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21619                        let encoded = common::to_string(&bytes);
21620                        match serde_json::from_str(&encoded) {
21621                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21622                            Err(error) => {
21623                                dlg.response_json_decode_error(&encoded, &error);
21624                                return Err(common::Error::JsonDecodeError(
21625                                    encoded.to_string(),
21626                                    error,
21627                                ));
21628                            }
21629                        }
21630                    };
21631
21632                    dlg.finished(true);
21633                    return Ok(response);
21634                }
21635            }
21636        }
21637    }
21638
21639    /// Required. The ID of the advertiser to list insertion orders for.
21640    ///
21641    /// Sets the *advertiser id* path property to the given value.
21642    ///
21643    /// Even though the property as already been set when instantiating this call,
21644    /// we provide this method for API completeness.
21645    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserInsertionOrderListCall<'a, C> {
21646        self._advertiser_id = new_value;
21647        self
21648    }
21649    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListInsertionOrders` method. If not specified, the first page of results will be returned.
21650    ///
21651    /// Sets the *page token* query property to the given value.
21652    pub fn page_token(mut self, new_value: &str) -> AdvertiserInsertionOrderListCall<'a, C> {
21653        self._page_token = Some(new_value.to_string());
21654        self
21655    }
21656    /// Requested page size. Must be between `1` and `100`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
21657    ///
21658    /// Sets the *page size* query property to the given value.
21659    pub fn page_size(mut self, new_value: i32) -> AdvertiserInsertionOrderListCall<'a, C> {
21660        self._page_size = Some(new_value);
21661        self
21662    }
21663    /// Field by which to sort the list. Acceptable values are: * "displayName" (default) * "entityStatus" * "updateTime" The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `displayName desc`.
21664    ///
21665    /// Sets the *order by* query property to the given value.
21666    pub fn order_by(mut self, new_value: &str) -> AdvertiserInsertionOrderListCall<'a, C> {
21667        self._order_by = Some(new_value.to_string());
21668        self
21669    }
21670    /// Allows filtering by insertion order fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by `AND` or `OR` logical operators. A sequence of restrictions implicitly uses `AND`. * A restriction has the form of `{field} {operator} {value}`. * The `updateTime` field must use the `GREATER THAN OR EQUAL TO (>=)` or `LESS THAN OR EQUAL TO (<=)` operators. * All other fields must use the `EQUALS (=)` operator. Supported fields: * `campaignId` * `displayName` * `entityStatus` * `updateTime` (input in ISO 8601 format, or `YYYY-MM-DDTHH:MM:SSZ`) Examples: * All insertion orders under a campaign: `campaignId="1234"` * All `ENTITY_STATUS_ACTIVE` or `ENTITY_STATUS_PAUSED` insertion orders under an advertiser: `(entityStatus="ENTITY_STATUS_ACTIVE" OR entityStatus="ENTITY_STATUS_PAUSED")` * All insertion orders with an update time less than or equal to 2020-11-04T18:54:47Z (format of ISO 8601): `updateTime<="2020-11-04T18:54:47Z"` * All insertion orders with an update time greater than or equal to 2020-11-04T18:54:47Z (format of ISO 8601): `updateTime>="2020-11-04T18:54:47Z"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
21671    ///
21672    /// Sets the *filter* query property to the given value.
21673    pub fn filter(mut self, new_value: &str) -> AdvertiserInsertionOrderListCall<'a, C> {
21674        self._filter = Some(new_value.to_string());
21675        self
21676    }
21677    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21678    /// while executing the actual API request.
21679    ///
21680    /// ````text
21681    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21682    /// ````
21683    ///
21684    /// Sets the *delegate* property to the given value.
21685    pub fn delegate(
21686        mut self,
21687        new_value: &'a mut dyn common::Delegate,
21688    ) -> AdvertiserInsertionOrderListCall<'a, C> {
21689        self._delegate = Some(new_value);
21690        self
21691    }
21692
21693    /// Set any additional parameter of the query string used in the request.
21694    /// It should be used to set parameters which are not yet available through their own
21695    /// setters.
21696    ///
21697    /// Please note that this method must not be used to set any of the known parameters
21698    /// which have their own setter method. If done anyway, the request will fail.
21699    ///
21700    /// # Additional Parameters
21701    ///
21702    /// * *$.xgafv* (query-string) - V1 error format.
21703    /// * *access_token* (query-string) - OAuth access token.
21704    /// * *alt* (query-string) - Data format for response.
21705    /// * *callback* (query-string) - JSONP
21706    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21707    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21708    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21709    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21710    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21711    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21712    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21713    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserInsertionOrderListCall<'a, C>
21714    where
21715        T: AsRef<str>,
21716    {
21717        self._additional_params
21718            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21719        self
21720    }
21721
21722    /// Identifies the authorization scope for the method you are building.
21723    ///
21724    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21725    /// [`Scope::DisplayVideo`].
21726    ///
21727    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21728    /// tokens for more than one scope.
21729    ///
21730    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21731    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21732    /// sufficient, a read-write scope will do as well.
21733    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserInsertionOrderListCall<'a, C>
21734    where
21735        St: AsRef<str>,
21736    {
21737        self._scopes.insert(String::from(scope.as_ref()));
21738        self
21739    }
21740    /// Identifies the authorization scope(s) for the method you are building.
21741    ///
21742    /// See [`Self::add_scope()`] for details.
21743    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserInsertionOrderListCall<'a, C>
21744    where
21745        I: IntoIterator<Item = St>,
21746        St: AsRef<str>,
21747    {
21748        self._scopes
21749            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21750        self
21751    }
21752
21753    /// Removes all scopes, and no default scope will be used either.
21754    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21755    /// for details).
21756    pub fn clear_scopes(mut self) -> AdvertiserInsertionOrderListCall<'a, C> {
21757        self._scopes.clear();
21758        self
21759    }
21760}
21761
21762/// Updates an existing insertion order. Returns the updated insertion order if successful.
21763///
21764/// A builder for the *insertionOrders.patch* method supported by a *advertiser* resource.
21765/// It is not used directly, but through a [`AdvertiserMethods`] instance.
21766///
21767/// # Example
21768///
21769/// Instantiate a resource method builder
21770///
21771/// ```test_harness,no_run
21772/// # extern crate hyper;
21773/// # extern crate hyper_rustls;
21774/// # extern crate google_displayvideo1 as displayvideo1;
21775/// use displayvideo1::api::InsertionOrder;
21776/// # async fn dox() {
21777/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21778///
21779/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21780/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21781/// #     secret,
21782/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21783/// # ).build().await.unwrap();
21784///
21785/// # let client = hyper_util::client::legacy::Client::builder(
21786/// #     hyper_util::rt::TokioExecutor::new()
21787/// # )
21788/// # .build(
21789/// #     hyper_rustls::HttpsConnectorBuilder::new()
21790/// #         .with_native_roots()
21791/// #         .unwrap()
21792/// #         .https_or_http()
21793/// #         .enable_http1()
21794/// #         .build()
21795/// # );
21796/// # let mut hub = DisplayVideo::new(client, auth);
21797/// // As the method needs a request, you would usually fill it with the desired information
21798/// // into the respective structure. Some of the parts shown here might not be applicable !
21799/// // Values shown here are possibly random and not representative !
21800/// let mut req = InsertionOrder::default();
21801///
21802/// // You can configure optional parameters by calling the respective setters at will, and
21803/// // execute the final call using `doit()`.
21804/// // Values shown here are possibly random and not representative !
21805/// let result = hub.advertisers().insertion_orders_patch(req, -61, -91)
21806///              .update_mask(FieldMask::new::<&str>(&[]))
21807///              .doit().await;
21808/// # }
21809/// ```
21810pub struct AdvertiserInsertionOrderPatchCall<'a, C>
21811where
21812    C: 'a,
21813{
21814    hub: &'a DisplayVideo<C>,
21815    _request: InsertionOrder,
21816    _advertiser_id: i64,
21817    _insertion_order_id: i64,
21818    _update_mask: Option<common::FieldMask>,
21819    _delegate: Option<&'a mut dyn common::Delegate>,
21820    _additional_params: HashMap<String, String>,
21821    _scopes: BTreeSet<String>,
21822}
21823
21824impl<'a, C> common::CallBuilder for AdvertiserInsertionOrderPatchCall<'a, C> {}
21825
21826impl<'a, C> AdvertiserInsertionOrderPatchCall<'a, C>
21827where
21828    C: common::Connector,
21829{
21830    /// Perform the operation you have build so far.
21831    pub async fn doit(mut self) -> common::Result<(common::Response, InsertionOrder)> {
21832        use std::borrow::Cow;
21833        use std::io::{Read, Seek};
21834
21835        use common::{url::Params, ToParts};
21836        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21837
21838        let mut dd = common::DefaultDelegate;
21839        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21840        dlg.begin(common::MethodInfo {
21841            id: "displayvideo.advertisers.insertionOrders.patch",
21842            http_method: hyper::Method::PATCH,
21843        });
21844
21845        for &field in ["alt", "advertiserId", "insertionOrderId", "updateMask"].iter() {
21846            if self._additional_params.contains_key(field) {
21847                dlg.finished(false);
21848                return Err(common::Error::FieldClash(field));
21849            }
21850        }
21851
21852        let mut params = Params::with_capacity(6 + self._additional_params.len());
21853        params.push("advertiserId", self._advertiser_id.to_string());
21854        params.push("insertionOrderId", self._insertion_order_id.to_string());
21855        if let Some(value) = self._update_mask.as_ref() {
21856            params.push("updateMask", value.to_string());
21857        }
21858
21859        params.extend(self._additional_params.iter());
21860
21861        params.push("alt", "json");
21862        let mut url = self.hub._base_url.clone()
21863            + "v1/advertisers/{+advertiserId}/insertionOrders/{+insertionOrderId}";
21864        if self._scopes.is_empty() {
21865            self._scopes
21866                .insert(Scope::DisplayVideo.as_ref().to_string());
21867        }
21868
21869        #[allow(clippy::single_element_loop)]
21870        for &(find_this, param_name) in [
21871            ("{+advertiserId}", "advertiserId"),
21872            ("{+insertionOrderId}", "insertionOrderId"),
21873        ]
21874        .iter()
21875        {
21876            url = params.uri_replacement(url, param_name, find_this, true);
21877        }
21878        {
21879            let to_remove = ["insertionOrderId", "advertiserId"];
21880            params.remove_params(&to_remove);
21881        }
21882
21883        let url = params.parse_with_url(&url);
21884
21885        let mut json_mime_type = mime::APPLICATION_JSON;
21886        let mut request_value_reader = {
21887            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21888            common::remove_json_null_values(&mut value);
21889            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21890            serde_json::to_writer(&mut dst, &value).unwrap();
21891            dst
21892        };
21893        let request_size = request_value_reader
21894            .seek(std::io::SeekFrom::End(0))
21895            .unwrap();
21896        request_value_reader
21897            .seek(std::io::SeekFrom::Start(0))
21898            .unwrap();
21899
21900        loop {
21901            let token = match self
21902                .hub
21903                .auth
21904                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21905                .await
21906            {
21907                Ok(token) => token,
21908                Err(e) => match dlg.token(e) {
21909                    Ok(token) => token,
21910                    Err(e) => {
21911                        dlg.finished(false);
21912                        return Err(common::Error::MissingToken(e));
21913                    }
21914                },
21915            };
21916            request_value_reader
21917                .seek(std::io::SeekFrom::Start(0))
21918                .unwrap();
21919            let mut req_result = {
21920                let client = &self.hub.client;
21921                dlg.pre_request();
21922                let mut req_builder = hyper::Request::builder()
21923                    .method(hyper::Method::PATCH)
21924                    .uri(url.as_str())
21925                    .header(USER_AGENT, self.hub._user_agent.clone());
21926
21927                if let Some(token) = token.as_ref() {
21928                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21929                }
21930
21931                let request = req_builder
21932                    .header(CONTENT_TYPE, json_mime_type.to_string())
21933                    .header(CONTENT_LENGTH, request_size as u64)
21934                    .body(common::to_body(
21935                        request_value_reader.get_ref().clone().into(),
21936                    ));
21937
21938                client.request(request.unwrap()).await
21939            };
21940
21941            match req_result {
21942                Err(err) => {
21943                    if let common::Retry::After(d) = dlg.http_error(&err) {
21944                        sleep(d).await;
21945                        continue;
21946                    }
21947                    dlg.finished(false);
21948                    return Err(common::Error::HttpError(err));
21949                }
21950                Ok(res) => {
21951                    let (mut parts, body) = res.into_parts();
21952                    let mut body = common::Body::new(body);
21953                    if !parts.status.is_success() {
21954                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21955                        let error = serde_json::from_str(&common::to_string(&bytes));
21956                        let response = common::to_response(parts, bytes.into());
21957
21958                        if let common::Retry::After(d) =
21959                            dlg.http_failure(&response, error.as_ref().ok())
21960                        {
21961                            sleep(d).await;
21962                            continue;
21963                        }
21964
21965                        dlg.finished(false);
21966
21967                        return Err(match error {
21968                            Ok(value) => common::Error::BadRequest(value),
21969                            _ => common::Error::Failure(response),
21970                        });
21971                    }
21972                    let response = {
21973                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21974                        let encoded = common::to_string(&bytes);
21975                        match serde_json::from_str(&encoded) {
21976                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21977                            Err(error) => {
21978                                dlg.response_json_decode_error(&encoded, &error);
21979                                return Err(common::Error::JsonDecodeError(
21980                                    encoded.to_string(),
21981                                    error,
21982                                ));
21983                            }
21984                        }
21985                    };
21986
21987                    dlg.finished(true);
21988                    return Ok(response);
21989                }
21990            }
21991        }
21992    }
21993
21994    ///
21995    /// Sets the *request* property to the given value.
21996    ///
21997    /// Even though the property as already been set when instantiating this call,
21998    /// we provide this method for API completeness.
21999    pub fn request(
22000        mut self,
22001        new_value: InsertionOrder,
22002    ) -> AdvertiserInsertionOrderPatchCall<'a, C> {
22003        self._request = new_value;
22004        self
22005    }
22006    /// Output only. The unique ID of the advertiser the insertion order belongs to.
22007    ///
22008    /// Sets the *advertiser id* path property to the given value.
22009    ///
22010    /// Even though the property as already been set when instantiating this call,
22011    /// we provide this method for API completeness.
22012    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserInsertionOrderPatchCall<'a, C> {
22013        self._advertiser_id = new_value;
22014        self
22015    }
22016    /// Output only. The unique ID of the insertion order. Assigned by the system.
22017    ///
22018    /// Sets the *insertion order id* path property to the given value.
22019    ///
22020    /// Even though the property as already been set when instantiating this call,
22021    /// we provide this method for API completeness.
22022    pub fn insertion_order_id(
22023        mut self,
22024        new_value: i64,
22025    ) -> AdvertiserInsertionOrderPatchCall<'a, C> {
22026        self._insertion_order_id = new_value;
22027        self
22028    }
22029    /// Required. The mask to control which fields to update.
22030    ///
22031    /// Sets the *update mask* query property to the given value.
22032    pub fn update_mask(
22033        mut self,
22034        new_value: common::FieldMask,
22035    ) -> AdvertiserInsertionOrderPatchCall<'a, C> {
22036        self._update_mask = Some(new_value);
22037        self
22038    }
22039    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22040    /// while executing the actual API request.
22041    ///
22042    /// ````text
22043    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22044    /// ````
22045    ///
22046    /// Sets the *delegate* property to the given value.
22047    pub fn delegate(
22048        mut self,
22049        new_value: &'a mut dyn common::Delegate,
22050    ) -> AdvertiserInsertionOrderPatchCall<'a, C> {
22051        self._delegate = Some(new_value);
22052        self
22053    }
22054
22055    /// Set any additional parameter of the query string used in the request.
22056    /// It should be used to set parameters which are not yet available through their own
22057    /// setters.
22058    ///
22059    /// Please note that this method must not be used to set any of the known parameters
22060    /// which have their own setter method. If done anyway, the request will fail.
22061    ///
22062    /// # Additional Parameters
22063    ///
22064    /// * *$.xgafv* (query-string) - V1 error format.
22065    /// * *access_token* (query-string) - OAuth access token.
22066    /// * *alt* (query-string) - Data format for response.
22067    /// * *callback* (query-string) - JSONP
22068    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22069    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22070    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22071    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22072    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22073    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22074    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22075    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserInsertionOrderPatchCall<'a, C>
22076    where
22077        T: AsRef<str>,
22078    {
22079        self._additional_params
22080            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22081        self
22082    }
22083
22084    /// Identifies the authorization scope for the method you are building.
22085    ///
22086    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22087    /// [`Scope::DisplayVideo`].
22088    ///
22089    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22090    /// tokens for more than one scope.
22091    ///
22092    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22093    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22094    /// sufficient, a read-write scope will do as well.
22095    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserInsertionOrderPatchCall<'a, C>
22096    where
22097        St: AsRef<str>,
22098    {
22099        self._scopes.insert(String::from(scope.as_ref()));
22100        self
22101    }
22102    /// Identifies the authorization scope(s) for the method you are building.
22103    ///
22104    /// See [`Self::add_scope()`] for details.
22105    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserInsertionOrderPatchCall<'a, C>
22106    where
22107        I: IntoIterator<Item = St>,
22108        St: AsRef<str>,
22109    {
22110        self._scopes
22111            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22112        self
22113    }
22114
22115    /// Removes all scopes, and no default scope will be used either.
22116    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22117    /// for details).
22118    pub fn clear_scopes(mut self) -> AdvertiserInsertionOrderPatchCall<'a, C> {
22119        self._scopes.clear();
22120        self
22121    }
22122}
22123
22124/// Lists invoices posted for an advertiser in a given month. Invoices generated by billing profiles with a "Partner" invoice level are not retrievable through this method.
22125///
22126/// A builder for the *invoices.list* method supported by a *advertiser* resource.
22127/// It is not used directly, but through a [`AdvertiserMethods`] instance.
22128///
22129/// # Example
22130///
22131/// Instantiate a resource method builder
22132///
22133/// ```test_harness,no_run
22134/// # extern crate hyper;
22135/// # extern crate hyper_rustls;
22136/// # extern crate google_displayvideo1 as displayvideo1;
22137/// # async fn dox() {
22138/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22139///
22140/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22141/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22142/// #     secret,
22143/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22144/// # ).build().await.unwrap();
22145///
22146/// # let client = hyper_util::client::legacy::Client::builder(
22147/// #     hyper_util::rt::TokioExecutor::new()
22148/// # )
22149/// # .build(
22150/// #     hyper_rustls::HttpsConnectorBuilder::new()
22151/// #         .with_native_roots()
22152/// #         .unwrap()
22153/// #         .https_or_http()
22154/// #         .enable_http1()
22155/// #         .build()
22156/// # );
22157/// # let mut hub = DisplayVideo::new(client, auth);
22158/// // You can configure optional parameters by calling the respective setters at will, and
22159/// // execute the final call using `doit()`.
22160/// // Values shown here are possibly random and not representative !
22161/// let result = hub.advertisers().invoices_list(-77)
22162///              .page_token("sadipscing")
22163///              .page_size(-32)
22164///              .loi_sapin_invoice_type("dolores")
22165///              .issue_month("sadipscing")
22166///              .doit().await;
22167/// # }
22168/// ```
22169pub struct AdvertiserInvoiceListCall<'a, C>
22170where
22171    C: 'a,
22172{
22173    hub: &'a DisplayVideo<C>,
22174    _advertiser_id: i64,
22175    _page_token: Option<String>,
22176    _page_size: Option<i32>,
22177    _loi_sapin_invoice_type: Option<String>,
22178    _issue_month: Option<String>,
22179    _delegate: Option<&'a mut dyn common::Delegate>,
22180    _additional_params: HashMap<String, String>,
22181    _scopes: BTreeSet<String>,
22182}
22183
22184impl<'a, C> common::CallBuilder for AdvertiserInvoiceListCall<'a, C> {}
22185
22186impl<'a, C> AdvertiserInvoiceListCall<'a, C>
22187where
22188    C: common::Connector,
22189{
22190    /// Perform the operation you have build so far.
22191    pub async fn doit(mut self) -> common::Result<(common::Response, ListInvoicesResponse)> {
22192        use std::borrow::Cow;
22193        use std::io::{Read, Seek};
22194
22195        use common::{url::Params, ToParts};
22196        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22197
22198        let mut dd = common::DefaultDelegate;
22199        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22200        dlg.begin(common::MethodInfo {
22201            id: "displayvideo.advertisers.invoices.list",
22202            http_method: hyper::Method::GET,
22203        });
22204
22205        for &field in [
22206            "alt",
22207            "advertiserId",
22208            "pageToken",
22209            "pageSize",
22210            "loiSapinInvoiceType",
22211            "issueMonth",
22212        ]
22213        .iter()
22214        {
22215            if self._additional_params.contains_key(field) {
22216                dlg.finished(false);
22217                return Err(common::Error::FieldClash(field));
22218            }
22219        }
22220
22221        let mut params = Params::with_capacity(7 + self._additional_params.len());
22222        params.push("advertiserId", self._advertiser_id.to_string());
22223        if let Some(value) = self._page_token.as_ref() {
22224            params.push("pageToken", value);
22225        }
22226        if let Some(value) = self._page_size.as_ref() {
22227            params.push("pageSize", value.to_string());
22228        }
22229        if let Some(value) = self._loi_sapin_invoice_type.as_ref() {
22230            params.push("loiSapinInvoiceType", value);
22231        }
22232        if let Some(value) = self._issue_month.as_ref() {
22233            params.push("issueMonth", value);
22234        }
22235
22236        params.extend(self._additional_params.iter());
22237
22238        params.push("alt", "json");
22239        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/invoices";
22240        if self._scopes.is_empty() {
22241            self._scopes
22242                .insert(Scope::DisplayVideo.as_ref().to_string());
22243        }
22244
22245        #[allow(clippy::single_element_loop)]
22246        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
22247            url = params.uri_replacement(url, param_name, find_this, true);
22248        }
22249        {
22250            let to_remove = ["advertiserId"];
22251            params.remove_params(&to_remove);
22252        }
22253
22254        let url = params.parse_with_url(&url);
22255
22256        loop {
22257            let token = match self
22258                .hub
22259                .auth
22260                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22261                .await
22262            {
22263                Ok(token) => token,
22264                Err(e) => match dlg.token(e) {
22265                    Ok(token) => token,
22266                    Err(e) => {
22267                        dlg.finished(false);
22268                        return Err(common::Error::MissingToken(e));
22269                    }
22270                },
22271            };
22272            let mut req_result = {
22273                let client = &self.hub.client;
22274                dlg.pre_request();
22275                let mut req_builder = hyper::Request::builder()
22276                    .method(hyper::Method::GET)
22277                    .uri(url.as_str())
22278                    .header(USER_AGENT, self.hub._user_agent.clone());
22279
22280                if let Some(token) = token.as_ref() {
22281                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22282                }
22283
22284                let request = req_builder
22285                    .header(CONTENT_LENGTH, 0_u64)
22286                    .body(common::to_body::<String>(None));
22287
22288                client.request(request.unwrap()).await
22289            };
22290
22291            match req_result {
22292                Err(err) => {
22293                    if let common::Retry::After(d) = dlg.http_error(&err) {
22294                        sleep(d).await;
22295                        continue;
22296                    }
22297                    dlg.finished(false);
22298                    return Err(common::Error::HttpError(err));
22299                }
22300                Ok(res) => {
22301                    let (mut parts, body) = res.into_parts();
22302                    let mut body = common::Body::new(body);
22303                    if !parts.status.is_success() {
22304                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22305                        let error = serde_json::from_str(&common::to_string(&bytes));
22306                        let response = common::to_response(parts, bytes.into());
22307
22308                        if let common::Retry::After(d) =
22309                            dlg.http_failure(&response, error.as_ref().ok())
22310                        {
22311                            sleep(d).await;
22312                            continue;
22313                        }
22314
22315                        dlg.finished(false);
22316
22317                        return Err(match error {
22318                            Ok(value) => common::Error::BadRequest(value),
22319                            _ => common::Error::Failure(response),
22320                        });
22321                    }
22322                    let response = {
22323                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22324                        let encoded = common::to_string(&bytes);
22325                        match serde_json::from_str(&encoded) {
22326                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22327                            Err(error) => {
22328                                dlg.response_json_decode_error(&encoded, &error);
22329                                return Err(common::Error::JsonDecodeError(
22330                                    encoded.to_string(),
22331                                    error,
22332                                ));
22333                            }
22334                        }
22335                    };
22336
22337                    dlg.finished(true);
22338                    return Ok(response);
22339                }
22340            }
22341        }
22342    }
22343
22344    /// Required. The ID of the advertiser to list invoices for.
22345    ///
22346    /// Sets the *advertiser id* path property to the given value.
22347    ///
22348    /// Even though the property as already been set when instantiating this call,
22349    /// we provide this method for API completeness.
22350    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserInvoiceListCall<'a, C> {
22351        self._advertiser_id = new_value;
22352        self
22353    }
22354    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListInvoices` method. If not specified, the first page of results will be returned.
22355    ///
22356    /// Sets the *page token* query property to the given value.
22357    pub fn page_token(mut self, new_value: &str) -> AdvertiserInvoiceListCall<'a, C> {
22358        self._page_token = Some(new_value.to_string());
22359        self
22360    }
22361    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
22362    ///
22363    /// Sets the *page size* query property to the given value.
22364    pub fn page_size(mut self, new_value: i32) -> AdvertiserInvoiceListCall<'a, C> {
22365        self._page_size = Some(new_value);
22366        self
22367    }
22368    /// Select type of invoice to retrieve for Loi Sapin advertisers. Only applicable to Loi Sapin advertisers. Will be ignored otherwise.
22369    ///
22370    /// Sets the *loi sapin invoice type* query property to the given value.
22371    pub fn loi_sapin_invoice_type(mut self, new_value: &str) -> AdvertiserInvoiceListCall<'a, C> {
22372        self._loi_sapin_invoice_type = Some(new_value.to_string());
22373        self
22374    }
22375    /// The month to list the invoices for. If not set, the request will retrieve invoices for the previous month. Must be in the format YYYYMM.
22376    ///
22377    /// Sets the *issue month* query property to the given value.
22378    pub fn issue_month(mut self, new_value: &str) -> AdvertiserInvoiceListCall<'a, C> {
22379        self._issue_month = Some(new_value.to_string());
22380        self
22381    }
22382    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22383    /// while executing the actual API request.
22384    ///
22385    /// ````text
22386    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22387    /// ````
22388    ///
22389    /// Sets the *delegate* property to the given value.
22390    pub fn delegate(
22391        mut self,
22392        new_value: &'a mut dyn common::Delegate,
22393    ) -> AdvertiserInvoiceListCall<'a, C> {
22394        self._delegate = Some(new_value);
22395        self
22396    }
22397
22398    /// Set any additional parameter of the query string used in the request.
22399    /// It should be used to set parameters which are not yet available through their own
22400    /// setters.
22401    ///
22402    /// Please note that this method must not be used to set any of the known parameters
22403    /// which have their own setter method. If done anyway, the request will fail.
22404    ///
22405    /// # Additional Parameters
22406    ///
22407    /// * *$.xgafv* (query-string) - V1 error format.
22408    /// * *access_token* (query-string) - OAuth access token.
22409    /// * *alt* (query-string) - Data format for response.
22410    /// * *callback* (query-string) - JSONP
22411    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22412    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22413    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22414    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22415    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22416    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22417    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22418    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserInvoiceListCall<'a, C>
22419    where
22420        T: AsRef<str>,
22421    {
22422        self._additional_params
22423            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22424        self
22425    }
22426
22427    /// Identifies the authorization scope for the method you are building.
22428    ///
22429    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22430    /// [`Scope::DisplayVideo`].
22431    ///
22432    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22433    /// tokens for more than one scope.
22434    ///
22435    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22436    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22437    /// sufficient, a read-write scope will do as well.
22438    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserInvoiceListCall<'a, C>
22439    where
22440        St: AsRef<str>,
22441    {
22442        self._scopes.insert(String::from(scope.as_ref()));
22443        self
22444    }
22445    /// Identifies the authorization scope(s) for the method you are building.
22446    ///
22447    /// See [`Self::add_scope()`] for details.
22448    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserInvoiceListCall<'a, C>
22449    where
22450        I: IntoIterator<Item = St>,
22451        St: AsRef<str>,
22452    {
22453        self._scopes
22454            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22455        self
22456    }
22457
22458    /// Removes all scopes, and no default scope will be used either.
22459    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22460    /// for details).
22461    pub fn clear_scopes(mut self) -> AdvertiserInvoiceListCall<'a, C> {
22462        self._scopes.clear();
22463        self
22464    }
22465}
22466
22467/// Retrieves the invoice currency used by an advertiser in a given month.
22468///
22469/// A builder for the *invoices.lookupInvoiceCurrency* method supported by a *advertiser* resource.
22470/// It is not used directly, but through a [`AdvertiserMethods`] instance.
22471///
22472/// # Example
22473///
22474/// Instantiate a resource method builder
22475///
22476/// ```test_harness,no_run
22477/// # extern crate hyper;
22478/// # extern crate hyper_rustls;
22479/// # extern crate google_displayvideo1 as displayvideo1;
22480/// # async fn dox() {
22481/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22482///
22483/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22484/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22485/// #     secret,
22486/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22487/// # ).build().await.unwrap();
22488///
22489/// # let client = hyper_util::client::legacy::Client::builder(
22490/// #     hyper_util::rt::TokioExecutor::new()
22491/// # )
22492/// # .build(
22493/// #     hyper_rustls::HttpsConnectorBuilder::new()
22494/// #         .with_native_roots()
22495/// #         .unwrap()
22496/// #         .https_or_http()
22497/// #         .enable_http1()
22498/// #         .build()
22499/// # );
22500/// # let mut hub = DisplayVideo::new(client, auth);
22501/// // You can configure optional parameters by calling the respective setters at will, and
22502/// // execute the final call using `doit()`.
22503/// // Values shown here are possibly random and not representative !
22504/// let result = hub.advertisers().invoices_lookup_invoice_currency(-31)
22505///              .invoice_month("aliquyam")
22506///              .doit().await;
22507/// # }
22508/// ```
22509pub struct AdvertiserInvoiceLookupInvoiceCurrencyCall<'a, C>
22510where
22511    C: 'a,
22512{
22513    hub: &'a DisplayVideo<C>,
22514    _advertiser_id: i64,
22515    _invoice_month: Option<String>,
22516    _delegate: Option<&'a mut dyn common::Delegate>,
22517    _additional_params: HashMap<String, String>,
22518    _scopes: BTreeSet<String>,
22519}
22520
22521impl<'a, C> common::CallBuilder for AdvertiserInvoiceLookupInvoiceCurrencyCall<'a, C> {}
22522
22523impl<'a, C> AdvertiserInvoiceLookupInvoiceCurrencyCall<'a, C>
22524where
22525    C: common::Connector,
22526{
22527    /// Perform the operation you have build so far.
22528    pub async fn doit(
22529        mut self,
22530    ) -> common::Result<(common::Response, LookupInvoiceCurrencyResponse)> {
22531        use std::borrow::Cow;
22532        use std::io::{Read, Seek};
22533
22534        use common::{url::Params, ToParts};
22535        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22536
22537        let mut dd = common::DefaultDelegate;
22538        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22539        dlg.begin(common::MethodInfo {
22540            id: "displayvideo.advertisers.invoices.lookupInvoiceCurrency",
22541            http_method: hyper::Method::GET,
22542        });
22543
22544        for &field in ["alt", "advertiserId", "invoiceMonth"].iter() {
22545            if self._additional_params.contains_key(field) {
22546                dlg.finished(false);
22547                return Err(common::Error::FieldClash(field));
22548            }
22549        }
22550
22551        let mut params = Params::with_capacity(4 + self._additional_params.len());
22552        params.push("advertiserId", self._advertiser_id.to_string());
22553        if let Some(value) = self._invoice_month.as_ref() {
22554            params.push("invoiceMonth", value);
22555        }
22556
22557        params.extend(self._additional_params.iter());
22558
22559        params.push("alt", "json");
22560        let mut url = self.hub._base_url.clone()
22561            + "v1/advertisers/{+advertiserId}/invoices:lookupInvoiceCurrency";
22562        if self._scopes.is_empty() {
22563            self._scopes
22564                .insert(Scope::DisplayVideo.as_ref().to_string());
22565        }
22566
22567        #[allow(clippy::single_element_loop)]
22568        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
22569            url = params.uri_replacement(url, param_name, find_this, true);
22570        }
22571        {
22572            let to_remove = ["advertiserId"];
22573            params.remove_params(&to_remove);
22574        }
22575
22576        let url = params.parse_with_url(&url);
22577
22578        loop {
22579            let token = match self
22580                .hub
22581                .auth
22582                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22583                .await
22584            {
22585                Ok(token) => token,
22586                Err(e) => match dlg.token(e) {
22587                    Ok(token) => token,
22588                    Err(e) => {
22589                        dlg.finished(false);
22590                        return Err(common::Error::MissingToken(e));
22591                    }
22592                },
22593            };
22594            let mut req_result = {
22595                let client = &self.hub.client;
22596                dlg.pre_request();
22597                let mut req_builder = hyper::Request::builder()
22598                    .method(hyper::Method::GET)
22599                    .uri(url.as_str())
22600                    .header(USER_AGENT, self.hub._user_agent.clone());
22601
22602                if let Some(token) = token.as_ref() {
22603                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22604                }
22605
22606                let request = req_builder
22607                    .header(CONTENT_LENGTH, 0_u64)
22608                    .body(common::to_body::<String>(None));
22609
22610                client.request(request.unwrap()).await
22611            };
22612
22613            match req_result {
22614                Err(err) => {
22615                    if let common::Retry::After(d) = dlg.http_error(&err) {
22616                        sleep(d).await;
22617                        continue;
22618                    }
22619                    dlg.finished(false);
22620                    return Err(common::Error::HttpError(err));
22621                }
22622                Ok(res) => {
22623                    let (mut parts, body) = res.into_parts();
22624                    let mut body = common::Body::new(body);
22625                    if !parts.status.is_success() {
22626                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22627                        let error = serde_json::from_str(&common::to_string(&bytes));
22628                        let response = common::to_response(parts, bytes.into());
22629
22630                        if let common::Retry::After(d) =
22631                            dlg.http_failure(&response, error.as_ref().ok())
22632                        {
22633                            sleep(d).await;
22634                            continue;
22635                        }
22636
22637                        dlg.finished(false);
22638
22639                        return Err(match error {
22640                            Ok(value) => common::Error::BadRequest(value),
22641                            _ => common::Error::Failure(response),
22642                        });
22643                    }
22644                    let response = {
22645                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22646                        let encoded = common::to_string(&bytes);
22647                        match serde_json::from_str(&encoded) {
22648                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22649                            Err(error) => {
22650                                dlg.response_json_decode_error(&encoded, &error);
22651                                return Err(common::Error::JsonDecodeError(
22652                                    encoded.to_string(),
22653                                    error,
22654                                ));
22655                            }
22656                        }
22657                    };
22658
22659                    dlg.finished(true);
22660                    return Ok(response);
22661                }
22662            }
22663        }
22664    }
22665
22666    /// Required. The ID of the advertiser to lookup currency for.
22667    ///
22668    /// Sets the *advertiser id* path property to the given value.
22669    ///
22670    /// Even though the property as already been set when instantiating this call,
22671    /// we provide this method for API completeness.
22672    pub fn advertiser_id(
22673        mut self,
22674        new_value: i64,
22675    ) -> AdvertiserInvoiceLookupInvoiceCurrencyCall<'a, C> {
22676        self._advertiser_id = new_value;
22677        self
22678    }
22679    /// Month for which the currency is needed. If not set, the request will return existing currency settings for the advertiser. Must be in the format YYYYMM.
22680    ///
22681    /// Sets the *invoice month* query property to the given value.
22682    pub fn invoice_month(
22683        mut self,
22684        new_value: &str,
22685    ) -> AdvertiserInvoiceLookupInvoiceCurrencyCall<'a, C> {
22686        self._invoice_month = Some(new_value.to_string());
22687        self
22688    }
22689    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22690    /// while executing the actual API request.
22691    ///
22692    /// ````text
22693    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22694    /// ````
22695    ///
22696    /// Sets the *delegate* property to the given value.
22697    pub fn delegate(
22698        mut self,
22699        new_value: &'a mut dyn common::Delegate,
22700    ) -> AdvertiserInvoiceLookupInvoiceCurrencyCall<'a, C> {
22701        self._delegate = Some(new_value);
22702        self
22703    }
22704
22705    /// Set any additional parameter of the query string used in the request.
22706    /// It should be used to set parameters which are not yet available through their own
22707    /// setters.
22708    ///
22709    /// Please note that this method must not be used to set any of the known parameters
22710    /// which have their own setter method. If done anyway, the request will fail.
22711    ///
22712    /// # Additional Parameters
22713    ///
22714    /// * *$.xgafv* (query-string) - V1 error format.
22715    /// * *access_token* (query-string) - OAuth access token.
22716    /// * *alt* (query-string) - Data format for response.
22717    /// * *callback* (query-string) - JSONP
22718    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22719    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22720    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22721    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22722    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22723    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22724    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22725    pub fn param<T>(
22726        mut self,
22727        name: T,
22728        value: T,
22729    ) -> AdvertiserInvoiceLookupInvoiceCurrencyCall<'a, C>
22730    where
22731        T: AsRef<str>,
22732    {
22733        self._additional_params
22734            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22735        self
22736    }
22737
22738    /// Identifies the authorization scope for the method you are building.
22739    ///
22740    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22741    /// [`Scope::DisplayVideo`].
22742    ///
22743    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22744    /// tokens for more than one scope.
22745    ///
22746    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22747    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22748    /// sufficient, a read-write scope will do as well.
22749    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserInvoiceLookupInvoiceCurrencyCall<'a, C>
22750    where
22751        St: AsRef<str>,
22752    {
22753        self._scopes.insert(String::from(scope.as_ref()));
22754        self
22755    }
22756    /// Identifies the authorization scope(s) for the method you are building.
22757    ///
22758    /// See [`Self::add_scope()`] for details.
22759    pub fn add_scopes<I, St>(
22760        mut self,
22761        scopes: I,
22762    ) -> AdvertiserInvoiceLookupInvoiceCurrencyCall<'a, C>
22763    where
22764        I: IntoIterator<Item = St>,
22765        St: AsRef<str>,
22766    {
22767        self._scopes
22768            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22769        self
22770    }
22771
22772    /// Removes all scopes, and no default scope will be used either.
22773    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22774    /// for details).
22775    pub fn clear_scopes(mut self) -> AdvertiserInvoiceLookupInvoiceCurrencyCall<'a, C> {
22776        self._scopes.clear();
22777        self
22778    }
22779}
22780
22781/// Assigns a targeting option to a line item. Returns the assigned targeting option if successful. Requests to this endpoint cannot be made concurrently with the following requests updating the same line item: * lineItems.bulkEditAssignedTargetingOptions * lineItems.bulkUpdate * lineItems.patch * DeleteLineItemAssignedTargetingOption YouTube & Partners line items cannot be created or updated using the API.
22782///
22783/// A builder for the *lineItems.targetingTypes.assignedTargetingOptions.create* method supported by a *advertiser* resource.
22784/// It is not used directly, but through a [`AdvertiserMethods`] instance.
22785///
22786/// # Example
22787///
22788/// Instantiate a resource method builder
22789///
22790/// ```test_harness,no_run
22791/// # extern crate hyper;
22792/// # extern crate hyper_rustls;
22793/// # extern crate google_displayvideo1 as displayvideo1;
22794/// use displayvideo1::api::AssignedTargetingOption;
22795/// # async fn dox() {
22796/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22797///
22798/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22799/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22800/// #     secret,
22801/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22802/// # ).build().await.unwrap();
22803///
22804/// # let client = hyper_util::client::legacy::Client::builder(
22805/// #     hyper_util::rt::TokioExecutor::new()
22806/// # )
22807/// # .build(
22808/// #     hyper_rustls::HttpsConnectorBuilder::new()
22809/// #         .with_native_roots()
22810/// #         .unwrap()
22811/// #         .https_or_http()
22812/// #         .enable_http1()
22813/// #         .build()
22814/// # );
22815/// # let mut hub = DisplayVideo::new(client, auth);
22816/// // As the method needs a request, you would usually fill it with the desired information
22817/// // into the respective structure. Some of the parts shown here might not be applicable !
22818/// // Values shown here are possibly random and not representative !
22819/// let mut req = AssignedTargetingOption::default();
22820///
22821/// // You can configure optional parameters by calling the respective setters at will, and
22822/// // execute the final call using `doit()`.
22823/// // Values shown here are possibly random and not representative !
22824/// let result = hub.advertisers().line_items_targeting_types_assigned_targeting_options_create(req, -47, -57, "targetingType")
22825///              .doit().await;
22826/// # }
22827/// ```
22828pub struct AdvertiserLineItemTargetingTypeAssignedTargetingOptionCreateCall<'a, C>
22829where
22830    C: 'a,
22831{
22832    hub: &'a DisplayVideo<C>,
22833    _request: AssignedTargetingOption,
22834    _advertiser_id: i64,
22835    _line_item_id: i64,
22836    _targeting_type: String,
22837    _delegate: Option<&'a mut dyn common::Delegate>,
22838    _additional_params: HashMap<String, String>,
22839    _scopes: BTreeSet<String>,
22840}
22841
22842impl<'a, C> common::CallBuilder
22843    for AdvertiserLineItemTargetingTypeAssignedTargetingOptionCreateCall<'a, C>
22844{
22845}
22846
22847impl<'a, C> AdvertiserLineItemTargetingTypeAssignedTargetingOptionCreateCall<'a, C>
22848where
22849    C: common::Connector,
22850{
22851    /// Perform the operation you have build so far.
22852    pub async fn doit(mut self) -> common::Result<(common::Response, AssignedTargetingOption)> {
22853        use std::borrow::Cow;
22854        use std::io::{Read, Seek};
22855
22856        use common::{url::Params, ToParts};
22857        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22858
22859        let mut dd = common::DefaultDelegate;
22860        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22861        dlg.begin(common::MethodInfo {
22862            id: "displayvideo.advertisers.lineItems.targetingTypes.assignedTargetingOptions.create",
22863            http_method: hyper::Method::POST,
22864        });
22865
22866        for &field in ["alt", "advertiserId", "lineItemId", "targetingType"].iter() {
22867            if self._additional_params.contains_key(field) {
22868                dlg.finished(false);
22869                return Err(common::Error::FieldClash(field));
22870            }
22871        }
22872
22873        let mut params = Params::with_capacity(6 + self._additional_params.len());
22874        params.push("advertiserId", self._advertiser_id.to_string());
22875        params.push("lineItemId", self._line_item_id.to_string());
22876        params.push("targetingType", self._targeting_type);
22877
22878        params.extend(self._additional_params.iter());
22879
22880        params.push("alt", "json");
22881        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/lineItems/{+lineItemId}/targetingTypes/{+targetingType}/assignedTargetingOptions";
22882        if self._scopes.is_empty() {
22883            self._scopes
22884                .insert(Scope::DisplayVideo.as_ref().to_string());
22885        }
22886
22887        #[allow(clippy::single_element_loop)]
22888        for &(find_this, param_name) in [
22889            ("{+advertiserId}", "advertiserId"),
22890            ("{+lineItemId}", "lineItemId"),
22891            ("{+targetingType}", "targetingType"),
22892        ]
22893        .iter()
22894        {
22895            url = params.uri_replacement(url, param_name, find_this, true);
22896        }
22897        {
22898            let to_remove = ["targetingType", "lineItemId", "advertiserId"];
22899            params.remove_params(&to_remove);
22900        }
22901
22902        let url = params.parse_with_url(&url);
22903
22904        let mut json_mime_type = mime::APPLICATION_JSON;
22905        let mut request_value_reader = {
22906            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22907            common::remove_json_null_values(&mut value);
22908            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22909            serde_json::to_writer(&mut dst, &value).unwrap();
22910            dst
22911        };
22912        let request_size = request_value_reader
22913            .seek(std::io::SeekFrom::End(0))
22914            .unwrap();
22915        request_value_reader
22916            .seek(std::io::SeekFrom::Start(0))
22917            .unwrap();
22918
22919        loop {
22920            let token = match self
22921                .hub
22922                .auth
22923                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22924                .await
22925            {
22926                Ok(token) => token,
22927                Err(e) => match dlg.token(e) {
22928                    Ok(token) => token,
22929                    Err(e) => {
22930                        dlg.finished(false);
22931                        return Err(common::Error::MissingToken(e));
22932                    }
22933                },
22934            };
22935            request_value_reader
22936                .seek(std::io::SeekFrom::Start(0))
22937                .unwrap();
22938            let mut req_result = {
22939                let client = &self.hub.client;
22940                dlg.pre_request();
22941                let mut req_builder = hyper::Request::builder()
22942                    .method(hyper::Method::POST)
22943                    .uri(url.as_str())
22944                    .header(USER_AGENT, self.hub._user_agent.clone());
22945
22946                if let Some(token) = token.as_ref() {
22947                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22948                }
22949
22950                let request = req_builder
22951                    .header(CONTENT_TYPE, json_mime_type.to_string())
22952                    .header(CONTENT_LENGTH, request_size as u64)
22953                    .body(common::to_body(
22954                        request_value_reader.get_ref().clone().into(),
22955                    ));
22956
22957                client.request(request.unwrap()).await
22958            };
22959
22960            match req_result {
22961                Err(err) => {
22962                    if let common::Retry::After(d) = dlg.http_error(&err) {
22963                        sleep(d).await;
22964                        continue;
22965                    }
22966                    dlg.finished(false);
22967                    return Err(common::Error::HttpError(err));
22968                }
22969                Ok(res) => {
22970                    let (mut parts, body) = res.into_parts();
22971                    let mut body = common::Body::new(body);
22972                    if !parts.status.is_success() {
22973                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22974                        let error = serde_json::from_str(&common::to_string(&bytes));
22975                        let response = common::to_response(parts, bytes.into());
22976
22977                        if let common::Retry::After(d) =
22978                            dlg.http_failure(&response, error.as_ref().ok())
22979                        {
22980                            sleep(d).await;
22981                            continue;
22982                        }
22983
22984                        dlg.finished(false);
22985
22986                        return Err(match error {
22987                            Ok(value) => common::Error::BadRequest(value),
22988                            _ => common::Error::Failure(response),
22989                        });
22990                    }
22991                    let response = {
22992                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22993                        let encoded = common::to_string(&bytes);
22994                        match serde_json::from_str(&encoded) {
22995                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22996                            Err(error) => {
22997                                dlg.response_json_decode_error(&encoded, &error);
22998                                return Err(common::Error::JsonDecodeError(
22999                                    encoded.to_string(),
23000                                    error,
23001                                ));
23002                            }
23003                        }
23004                    };
23005
23006                    dlg.finished(true);
23007                    return Ok(response);
23008                }
23009            }
23010        }
23011    }
23012
23013    ///
23014    /// Sets the *request* property to the given value.
23015    ///
23016    /// Even though the property as already been set when instantiating this call,
23017    /// we provide this method for API completeness.
23018    pub fn request(
23019        mut self,
23020        new_value: AssignedTargetingOption,
23021    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
23022        self._request = new_value;
23023        self
23024    }
23025    /// Required. The ID of the advertiser the line item belongs to.
23026    ///
23027    /// Sets the *advertiser id* path property to the given value.
23028    ///
23029    /// Even though the property as already been set when instantiating this call,
23030    /// we provide this method for API completeness.
23031    pub fn advertiser_id(
23032        mut self,
23033        new_value: i64,
23034    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
23035        self._advertiser_id = new_value;
23036        self
23037    }
23038    /// Required. The ID of the line item the assigned targeting option will belong to.
23039    ///
23040    /// Sets the *line item id* path property to the given value.
23041    ///
23042    /// Even though the property as already been set when instantiating this call,
23043    /// we provide this method for API completeness.
23044    pub fn line_item_id(
23045        mut self,
23046        new_value: i64,
23047    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
23048        self._line_item_id = new_value;
23049        self
23050    }
23051    /// Required. Identifies the type of this assigned targeting option. Supported targeting types include: * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_APP` * `TARGETING_TYPE_APP_CATEGORY` * `TARGETING_TYPE_AUDIENCE_GROUP` * `TARGETING_TYPE_AUDIO_CONTENT_TYPE` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_BROWSER` * `TARGETING_TYPE_BUSINESS_CHAIN` * `TARGETING_TYPE_CARRIER_AND_ISP` * `TARGETING_TYPE_CATEGORY` * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_CONTENT_DURATION` * `TARGETING_TYPE_CONTENT_GENRE` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_STREAM_TYPE` * `TARGETING_TYPE_DAY_AND_TIME` * `TARGETING_TYPE_DEVICE_MAKE_MODEL` * `TARGETING_TYPE_DEVICE_TYPE` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_INVENTORY_SOURCE` * `TARGETING_TYPE_INVENTORY_SOURCE_GROUP` * `TARGETING_TYPE_KEYWORD` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_NATIVE_CONTENT_POSITION` * `TARGETING_TYPE_NEGATIVE_KEYWORD_LIST` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_OPERATING_SYSTEM` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_POI` * `TARGETING_TYPE_PROXIMITY_LOCATION_LIST` * `TARGETING_TYPE_REGIONAL_LOCATION_LIST` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_THIRD_PARTY_VERIFIER` * `TARGETING_TYPE_URL` * `TARGETING_TYPE_USER_REWARDED_CONTENT` * `TARGETING_TYPE_VIDEO_PLAYER_SIZE` * `TARGETING_TYPE_VIEWABILITY`
23052    ///
23053    /// Sets the *targeting type* path property to the given value.
23054    ///
23055    /// Even though the property as already been set when instantiating this call,
23056    /// we provide this method for API completeness.
23057    pub fn targeting_type(
23058        mut self,
23059        new_value: &str,
23060    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
23061        self._targeting_type = new_value.to_string();
23062        self
23063    }
23064    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23065    /// while executing the actual API request.
23066    ///
23067    /// ````text
23068    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23069    /// ````
23070    ///
23071    /// Sets the *delegate* property to the given value.
23072    pub fn delegate(
23073        mut self,
23074        new_value: &'a mut dyn common::Delegate,
23075    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
23076        self._delegate = Some(new_value);
23077        self
23078    }
23079
23080    /// Set any additional parameter of the query string used in the request.
23081    /// It should be used to set parameters which are not yet available through their own
23082    /// setters.
23083    ///
23084    /// Please note that this method must not be used to set any of the known parameters
23085    /// which have their own setter method. If done anyway, the request will fail.
23086    ///
23087    /// # Additional Parameters
23088    ///
23089    /// * *$.xgafv* (query-string) - V1 error format.
23090    /// * *access_token* (query-string) - OAuth access token.
23091    /// * *alt* (query-string) - Data format for response.
23092    /// * *callback* (query-string) - JSONP
23093    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23094    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23095    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23096    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23097    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23098    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23099    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23100    pub fn param<T>(
23101        mut self,
23102        name: T,
23103        value: T,
23104    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionCreateCall<'a, C>
23105    where
23106        T: AsRef<str>,
23107    {
23108        self._additional_params
23109            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23110        self
23111    }
23112
23113    /// Identifies the authorization scope for the method you are building.
23114    ///
23115    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23116    /// [`Scope::DisplayVideo`].
23117    ///
23118    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23119    /// tokens for more than one scope.
23120    ///
23121    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23122    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23123    /// sufficient, a read-write scope will do as well.
23124    pub fn add_scope<St>(
23125        mut self,
23126        scope: St,
23127    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionCreateCall<'a, C>
23128    where
23129        St: AsRef<str>,
23130    {
23131        self._scopes.insert(String::from(scope.as_ref()));
23132        self
23133    }
23134    /// Identifies the authorization scope(s) for the method you are building.
23135    ///
23136    /// See [`Self::add_scope()`] for details.
23137    pub fn add_scopes<I, St>(
23138        mut self,
23139        scopes: I,
23140    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionCreateCall<'a, C>
23141    where
23142        I: IntoIterator<Item = St>,
23143        St: AsRef<str>,
23144    {
23145        self._scopes
23146            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23147        self
23148    }
23149
23150    /// Removes all scopes, and no default scope will be used either.
23151    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23152    /// for details).
23153    pub fn clear_scopes(
23154        mut self,
23155    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
23156        self._scopes.clear();
23157        self
23158    }
23159}
23160
23161/// Deletes an assigned targeting option from a line item. Requests to this endpoint cannot be made concurrently with the following requests updating the same line item: * lineItems.bulkEditAssignedTargetingOptions * lineItems.bulkUpdate * lineItems.patch * CreateLineItemAssignedTargetingOption YouTube & Partners line items cannot be created or updated using the API.
23162///
23163/// A builder for the *lineItems.targetingTypes.assignedTargetingOptions.delete* method supported by a *advertiser* resource.
23164/// It is not used directly, but through a [`AdvertiserMethods`] instance.
23165///
23166/// # Example
23167///
23168/// Instantiate a resource method builder
23169///
23170/// ```test_harness,no_run
23171/// # extern crate hyper;
23172/// # extern crate hyper_rustls;
23173/// # extern crate google_displayvideo1 as displayvideo1;
23174/// # async fn dox() {
23175/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23176///
23177/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23178/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23179/// #     secret,
23180/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23181/// # ).build().await.unwrap();
23182///
23183/// # let client = hyper_util::client::legacy::Client::builder(
23184/// #     hyper_util::rt::TokioExecutor::new()
23185/// # )
23186/// # .build(
23187/// #     hyper_rustls::HttpsConnectorBuilder::new()
23188/// #         .with_native_roots()
23189/// #         .unwrap()
23190/// #         .https_or_http()
23191/// #         .enable_http1()
23192/// #         .build()
23193/// # );
23194/// # let mut hub = DisplayVideo::new(client, auth);
23195/// // You can configure optional parameters by calling the respective setters at will, and
23196/// // execute the final call using `doit()`.
23197/// // Values shown here are possibly random and not representative !
23198/// let result = hub.advertisers().line_items_targeting_types_assigned_targeting_options_delete(-10, -96, "targetingType", "assignedTargetingOptionId")
23199///              .doit().await;
23200/// # }
23201/// ```
23202pub struct AdvertiserLineItemTargetingTypeAssignedTargetingOptionDeleteCall<'a, C>
23203where
23204    C: 'a,
23205{
23206    hub: &'a DisplayVideo<C>,
23207    _advertiser_id: i64,
23208    _line_item_id: i64,
23209    _targeting_type: String,
23210    _assigned_targeting_option_id: String,
23211    _delegate: Option<&'a mut dyn common::Delegate>,
23212    _additional_params: HashMap<String, String>,
23213    _scopes: BTreeSet<String>,
23214}
23215
23216impl<'a, C> common::CallBuilder
23217    for AdvertiserLineItemTargetingTypeAssignedTargetingOptionDeleteCall<'a, C>
23218{
23219}
23220
23221impl<'a, C> AdvertiserLineItemTargetingTypeAssignedTargetingOptionDeleteCall<'a, C>
23222where
23223    C: common::Connector,
23224{
23225    /// Perform the operation you have build so far.
23226    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
23227        use std::borrow::Cow;
23228        use std::io::{Read, Seek};
23229
23230        use common::{url::Params, ToParts};
23231        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23232
23233        let mut dd = common::DefaultDelegate;
23234        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23235        dlg.begin(common::MethodInfo {
23236            id: "displayvideo.advertisers.lineItems.targetingTypes.assignedTargetingOptions.delete",
23237            http_method: hyper::Method::DELETE,
23238        });
23239
23240        for &field in [
23241            "alt",
23242            "advertiserId",
23243            "lineItemId",
23244            "targetingType",
23245            "assignedTargetingOptionId",
23246        ]
23247        .iter()
23248        {
23249            if self._additional_params.contains_key(field) {
23250                dlg.finished(false);
23251                return Err(common::Error::FieldClash(field));
23252            }
23253        }
23254
23255        let mut params = Params::with_capacity(6 + self._additional_params.len());
23256        params.push("advertiserId", self._advertiser_id.to_string());
23257        params.push("lineItemId", self._line_item_id.to_string());
23258        params.push("targetingType", self._targeting_type);
23259        params.push(
23260            "assignedTargetingOptionId",
23261            self._assigned_targeting_option_id,
23262        );
23263
23264        params.extend(self._additional_params.iter());
23265
23266        params.push("alt", "json");
23267        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/lineItems/{+lineItemId}/targetingTypes/{+targetingType}/assignedTargetingOptions/{+assignedTargetingOptionId}";
23268        if self._scopes.is_empty() {
23269            self._scopes
23270                .insert(Scope::DisplayVideo.as_ref().to_string());
23271        }
23272
23273        #[allow(clippy::single_element_loop)]
23274        for &(find_this, param_name) in [
23275            ("{+advertiserId}", "advertiserId"),
23276            ("{+lineItemId}", "lineItemId"),
23277            ("{+targetingType}", "targetingType"),
23278            ("{+assignedTargetingOptionId}", "assignedTargetingOptionId"),
23279        ]
23280        .iter()
23281        {
23282            url = params.uri_replacement(url, param_name, find_this, true);
23283        }
23284        {
23285            let to_remove = [
23286                "assignedTargetingOptionId",
23287                "targetingType",
23288                "lineItemId",
23289                "advertiserId",
23290            ];
23291            params.remove_params(&to_remove);
23292        }
23293
23294        let url = params.parse_with_url(&url);
23295
23296        loop {
23297            let token = match self
23298                .hub
23299                .auth
23300                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23301                .await
23302            {
23303                Ok(token) => token,
23304                Err(e) => match dlg.token(e) {
23305                    Ok(token) => token,
23306                    Err(e) => {
23307                        dlg.finished(false);
23308                        return Err(common::Error::MissingToken(e));
23309                    }
23310                },
23311            };
23312            let mut req_result = {
23313                let client = &self.hub.client;
23314                dlg.pre_request();
23315                let mut req_builder = hyper::Request::builder()
23316                    .method(hyper::Method::DELETE)
23317                    .uri(url.as_str())
23318                    .header(USER_AGENT, self.hub._user_agent.clone());
23319
23320                if let Some(token) = token.as_ref() {
23321                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23322                }
23323
23324                let request = req_builder
23325                    .header(CONTENT_LENGTH, 0_u64)
23326                    .body(common::to_body::<String>(None));
23327
23328                client.request(request.unwrap()).await
23329            };
23330
23331            match req_result {
23332                Err(err) => {
23333                    if let common::Retry::After(d) = dlg.http_error(&err) {
23334                        sleep(d).await;
23335                        continue;
23336                    }
23337                    dlg.finished(false);
23338                    return Err(common::Error::HttpError(err));
23339                }
23340                Ok(res) => {
23341                    let (mut parts, body) = res.into_parts();
23342                    let mut body = common::Body::new(body);
23343                    if !parts.status.is_success() {
23344                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23345                        let error = serde_json::from_str(&common::to_string(&bytes));
23346                        let response = common::to_response(parts, bytes.into());
23347
23348                        if let common::Retry::After(d) =
23349                            dlg.http_failure(&response, error.as_ref().ok())
23350                        {
23351                            sleep(d).await;
23352                            continue;
23353                        }
23354
23355                        dlg.finished(false);
23356
23357                        return Err(match error {
23358                            Ok(value) => common::Error::BadRequest(value),
23359                            _ => common::Error::Failure(response),
23360                        });
23361                    }
23362                    let response = {
23363                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23364                        let encoded = common::to_string(&bytes);
23365                        match serde_json::from_str(&encoded) {
23366                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23367                            Err(error) => {
23368                                dlg.response_json_decode_error(&encoded, &error);
23369                                return Err(common::Error::JsonDecodeError(
23370                                    encoded.to_string(),
23371                                    error,
23372                                ));
23373                            }
23374                        }
23375                    };
23376
23377                    dlg.finished(true);
23378                    return Ok(response);
23379                }
23380            }
23381        }
23382    }
23383
23384    /// Required. The ID of the advertiser the line item belongs to.
23385    ///
23386    /// Sets the *advertiser id* path property to the given value.
23387    ///
23388    /// Even though the property as already been set when instantiating this call,
23389    /// we provide this method for API completeness.
23390    pub fn advertiser_id(
23391        mut self,
23392        new_value: i64,
23393    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
23394        self._advertiser_id = new_value;
23395        self
23396    }
23397    /// Required. The ID of the line item the assigned targeting option belongs to.
23398    ///
23399    /// Sets the *line item id* path property to the given value.
23400    ///
23401    /// Even though the property as already been set when instantiating this call,
23402    /// we provide this method for API completeness.
23403    pub fn line_item_id(
23404        mut self,
23405        new_value: i64,
23406    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
23407        self._line_item_id = new_value;
23408        self
23409    }
23410    /// Required. Identifies the type of this assigned targeting option. Supported targeting types include: * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_APP` * `TARGETING_TYPE_APP_CATEGORY` * `TARGETING_TYPE_AUDIENCE_GROUP` * `TARGETING_TYPE_AUDIO_CONTENT_TYPE` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_BROWSER` * `TARGETING_TYPE_BUSINESS_CHAIN` * `TARGETING_TYPE_CARRIER_AND_ISP` * `TARGETING_TYPE_CATEGORY` * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_CONTENT_DURATION` * `TARGETING_TYPE_CONTENT_GENRE` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_STREAM_TYPE` * `TARGETING_TYPE_DAY_AND_TIME` * `TARGETING_TYPE_DEVICE_MAKE_MODEL` * `TARGETING_TYPE_DEVICE_TYPE` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_INVENTORY_SOURCE` * `TARGETING_TYPE_INVENTORY_SOURCE_GROUP` * `TARGETING_TYPE_KEYWORD` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_NATIVE_CONTENT_POSITION` * `TARGETING_TYPE_NEGATIVE_KEYWORD_LIST` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_OPERATING_SYSTEM` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_POI` * `TARGETING_TYPE_PROXIMITY_LOCATION_LIST` * `TARGETING_TYPE_REGIONAL_LOCATION_LIST` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_THIRD_PARTY_VERIFIER` * `TARGETING_TYPE_URL` * `TARGETING_TYPE_USER_REWARDED_CONTENT` * `TARGETING_TYPE_VIDEO_PLAYER_SIZE` * `TARGETING_TYPE_VIEWABILITY`
23411    ///
23412    /// Sets the *targeting type* path property to the given value.
23413    ///
23414    /// Even though the property as already been set when instantiating this call,
23415    /// we provide this method for API completeness.
23416    pub fn targeting_type(
23417        mut self,
23418        new_value: &str,
23419    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
23420        self._targeting_type = new_value.to_string();
23421        self
23422    }
23423    /// Required. The ID of the assigned targeting option to delete.
23424    ///
23425    /// Sets the *assigned targeting option id* path property to the given value.
23426    ///
23427    /// Even though the property as already been set when instantiating this call,
23428    /// we provide this method for API completeness.
23429    pub fn assigned_targeting_option_id(
23430        mut self,
23431        new_value: &str,
23432    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
23433        self._assigned_targeting_option_id = new_value.to_string();
23434        self
23435    }
23436    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23437    /// while executing the actual API request.
23438    ///
23439    /// ````text
23440    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23441    /// ````
23442    ///
23443    /// Sets the *delegate* property to the given value.
23444    pub fn delegate(
23445        mut self,
23446        new_value: &'a mut dyn common::Delegate,
23447    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
23448        self._delegate = Some(new_value);
23449        self
23450    }
23451
23452    /// Set any additional parameter of the query string used in the request.
23453    /// It should be used to set parameters which are not yet available through their own
23454    /// setters.
23455    ///
23456    /// Please note that this method must not be used to set any of the known parameters
23457    /// which have their own setter method. If done anyway, the request will fail.
23458    ///
23459    /// # Additional Parameters
23460    ///
23461    /// * *$.xgafv* (query-string) - V1 error format.
23462    /// * *access_token* (query-string) - OAuth access token.
23463    /// * *alt* (query-string) - Data format for response.
23464    /// * *callback* (query-string) - JSONP
23465    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23466    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23467    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23468    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23469    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23470    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23471    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23472    pub fn param<T>(
23473        mut self,
23474        name: T,
23475        value: T,
23476    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionDeleteCall<'a, C>
23477    where
23478        T: AsRef<str>,
23479    {
23480        self._additional_params
23481            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23482        self
23483    }
23484
23485    /// Identifies the authorization scope for the method you are building.
23486    ///
23487    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23488    /// [`Scope::DisplayVideo`].
23489    ///
23490    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23491    /// tokens for more than one scope.
23492    ///
23493    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23494    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23495    /// sufficient, a read-write scope will do as well.
23496    pub fn add_scope<St>(
23497        mut self,
23498        scope: St,
23499    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionDeleteCall<'a, C>
23500    where
23501        St: AsRef<str>,
23502    {
23503        self._scopes.insert(String::from(scope.as_ref()));
23504        self
23505    }
23506    /// Identifies the authorization scope(s) for the method you are building.
23507    ///
23508    /// See [`Self::add_scope()`] for details.
23509    pub fn add_scopes<I, St>(
23510        mut self,
23511        scopes: I,
23512    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionDeleteCall<'a, C>
23513    where
23514        I: IntoIterator<Item = St>,
23515        St: AsRef<str>,
23516    {
23517        self._scopes
23518            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23519        self
23520    }
23521
23522    /// Removes all scopes, and no default scope will be used either.
23523    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23524    /// for details).
23525    pub fn clear_scopes(
23526        mut self,
23527    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
23528        self._scopes.clear();
23529        self
23530    }
23531}
23532
23533/// Gets a single targeting option assigned to a line item.
23534///
23535/// A builder for the *lineItems.targetingTypes.assignedTargetingOptions.get* method supported by a *advertiser* resource.
23536/// It is not used directly, but through a [`AdvertiserMethods`] instance.
23537///
23538/// # Example
23539///
23540/// Instantiate a resource method builder
23541///
23542/// ```test_harness,no_run
23543/// # extern crate hyper;
23544/// # extern crate hyper_rustls;
23545/// # extern crate google_displayvideo1 as displayvideo1;
23546/// # async fn dox() {
23547/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23548///
23549/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23550/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23551/// #     secret,
23552/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23553/// # ).build().await.unwrap();
23554///
23555/// # let client = hyper_util::client::legacy::Client::builder(
23556/// #     hyper_util::rt::TokioExecutor::new()
23557/// # )
23558/// # .build(
23559/// #     hyper_rustls::HttpsConnectorBuilder::new()
23560/// #         .with_native_roots()
23561/// #         .unwrap()
23562/// #         .https_or_http()
23563/// #         .enable_http1()
23564/// #         .build()
23565/// # );
23566/// # let mut hub = DisplayVideo::new(client, auth);
23567/// // You can configure optional parameters by calling the respective setters at will, and
23568/// // execute the final call using `doit()`.
23569/// // Values shown here are possibly random and not representative !
23570/// let result = hub.advertisers().line_items_targeting_types_assigned_targeting_options_get(-7, -82, "targetingType", "assignedTargetingOptionId")
23571///              .doit().await;
23572/// # }
23573/// ```
23574pub struct AdvertiserLineItemTargetingTypeAssignedTargetingOptionGetCall<'a, C>
23575where
23576    C: 'a,
23577{
23578    hub: &'a DisplayVideo<C>,
23579    _advertiser_id: i64,
23580    _line_item_id: i64,
23581    _targeting_type: String,
23582    _assigned_targeting_option_id: String,
23583    _delegate: Option<&'a mut dyn common::Delegate>,
23584    _additional_params: HashMap<String, String>,
23585    _scopes: BTreeSet<String>,
23586}
23587
23588impl<'a, C> common::CallBuilder
23589    for AdvertiserLineItemTargetingTypeAssignedTargetingOptionGetCall<'a, C>
23590{
23591}
23592
23593impl<'a, C> AdvertiserLineItemTargetingTypeAssignedTargetingOptionGetCall<'a, C>
23594where
23595    C: common::Connector,
23596{
23597    /// Perform the operation you have build so far.
23598    pub async fn doit(mut self) -> common::Result<(common::Response, AssignedTargetingOption)> {
23599        use std::borrow::Cow;
23600        use std::io::{Read, Seek};
23601
23602        use common::{url::Params, ToParts};
23603        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23604
23605        let mut dd = common::DefaultDelegate;
23606        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23607        dlg.begin(common::MethodInfo {
23608            id: "displayvideo.advertisers.lineItems.targetingTypes.assignedTargetingOptions.get",
23609            http_method: hyper::Method::GET,
23610        });
23611
23612        for &field in [
23613            "alt",
23614            "advertiserId",
23615            "lineItemId",
23616            "targetingType",
23617            "assignedTargetingOptionId",
23618        ]
23619        .iter()
23620        {
23621            if self._additional_params.contains_key(field) {
23622                dlg.finished(false);
23623                return Err(common::Error::FieldClash(field));
23624            }
23625        }
23626
23627        let mut params = Params::with_capacity(6 + self._additional_params.len());
23628        params.push("advertiserId", self._advertiser_id.to_string());
23629        params.push("lineItemId", self._line_item_id.to_string());
23630        params.push("targetingType", self._targeting_type);
23631        params.push(
23632            "assignedTargetingOptionId",
23633            self._assigned_targeting_option_id,
23634        );
23635
23636        params.extend(self._additional_params.iter());
23637
23638        params.push("alt", "json");
23639        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/lineItems/{+lineItemId}/targetingTypes/{+targetingType}/assignedTargetingOptions/{+assignedTargetingOptionId}";
23640        if self._scopes.is_empty() {
23641            self._scopes
23642                .insert(Scope::DisplayVideo.as_ref().to_string());
23643        }
23644
23645        #[allow(clippy::single_element_loop)]
23646        for &(find_this, param_name) in [
23647            ("{+advertiserId}", "advertiserId"),
23648            ("{+lineItemId}", "lineItemId"),
23649            ("{+targetingType}", "targetingType"),
23650            ("{+assignedTargetingOptionId}", "assignedTargetingOptionId"),
23651        ]
23652        .iter()
23653        {
23654            url = params.uri_replacement(url, param_name, find_this, true);
23655        }
23656        {
23657            let to_remove = [
23658                "assignedTargetingOptionId",
23659                "targetingType",
23660                "lineItemId",
23661                "advertiserId",
23662            ];
23663            params.remove_params(&to_remove);
23664        }
23665
23666        let url = params.parse_with_url(&url);
23667
23668        loop {
23669            let token = match self
23670                .hub
23671                .auth
23672                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23673                .await
23674            {
23675                Ok(token) => token,
23676                Err(e) => match dlg.token(e) {
23677                    Ok(token) => token,
23678                    Err(e) => {
23679                        dlg.finished(false);
23680                        return Err(common::Error::MissingToken(e));
23681                    }
23682                },
23683            };
23684            let mut req_result = {
23685                let client = &self.hub.client;
23686                dlg.pre_request();
23687                let mut req_builder = hyper::Request::builder()
23688                    .method(hyper::Method::GET)
23689                    .uri(url.as_str())
23690                    .header(USER_AGENT, self.hub._user_agent.clone());
23691
23692                if let Some(token) = token.as_ref() {
23693                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23694                }
23695
23696                let request = req_builder
23697                    .header(CONTENT_LENGTH, 0_u64)
23698                    .body(common::to_body::<String>(None));
23699
23700                client.request(request.unwrap()).await
23701            };
23702
23703            match req_result {
23704                Err(err) => {
23705                    if let common::Retry::After(d) = dlg.http_error(&err) {
23706                        sleep(d).await;
23707                        continue;
23708                    }
23709                    dlg.finished(false);
23710                    return Err(common::Error::HttpError(err));
23711                }
23712                Ok(res) => {
23713                    let (mut parts, body) = res.into_parts();
23714                    let mut body = common::Body::new(body);
23715                    if !parts.status.is_success() {
23716                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23717                        let error = serde_json::from_str(&common::to_string(&bytes));
23718                        let response = common::to_response(parts, bytes.into());
23719
23720                        if let common::Retry::After(d) =
23721                            dlg.http_failure(&response, error.as_ref().ok())
23722                        {
23723                            sleep(d).await;
23724                            continue;
23725                        }
23726
23727                        dlg.finished(false);
23728
23729                        return Err(match error {
23730                            Ok(value) => common::Error::BadRequest(value),
23731                            _ => common::Error::Failure(response),
23732                        });
23733                    }
23734                    let response = {
23735                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23736                        let encoded = common::to_string(&bytes);
23737                        match serde_json::from_str(&encoded) {
23738                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23739                            Err(error) => {
23740                                dlg.response_json_decode_error(&encoded, &error);
23741                                return Err(common::Error::JsonDecodeError(
23742                                    encoded.to_string(),
23743                                    error,
23744                                ));
23745                            }
23746                        }
23747                    };
23748
23749                    dlg.finished(true);
23750                    return Ok(response);
23751                }
23752            }
23753        }
23754    }
23755
23756    /// Required. The ID of the advertiser the line item belongs to.
23757    ///
23758    /// Sets the *advertiser id* path property to the given value.
23759    ///
23760    /// Even though the property as already been set when instantiating this call,
23761    /// we provide this method for API completeness.
23762    pub fn advertiser_id(
23763        mut self,
23764        new_value: i64,
23765    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
23766        self._advertiser_id = new_value;
23767        self
23768    }
23769    /// Required. The ID of the line item the assigned targeting option belongs to.
23770    ///
23771    /// Sets the *line item id* path property to the given value.
23772    ///
23773    /// Even though the property as already been set when instantiating this call,
23774    /// we provide this method for API completeness.
23775    pub fn line_item_id(
23776        mut self,
23777        new_value: i64,
23778    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
23779        self._line_item_id = new_value;
23780        self
23781    }
23782    /// Required. Identifies the type of this assigned targeting option. Supported targeting types include: * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_APP` * `TARGETING_TYPE_APP_CATEGORY` * `TARGETING_TYPE_AUDIENCE_GROUP` * `TARGETING_TYPE_AUDIO_CONTENT_TYPE` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_BROWSER` * `TARGETING_TYPE_BUSINESS_CHAIN` * `TARGETING_TYPE_CARRIER_AND_ISP` * `TARGETING_TYPE_CATEGORY` * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_CONTENT_DURATION` * `TARGETING_TYPE_CONTENT_GENRE` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_STREAM_TYPE` * `TARGETING_TYPE_DAY_AND_TIME` * `TARGETING_TYPE_DEVICE_MAKE_MODEL` * `TARGETING_TYPE_DEVICE_TYPE` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_INVENTORY_SOURCE` * `TARGETING_TYPE_INVENTORY_SOURCE_GROUP` * `TARGETING_TYPE_KEYWORD` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_NATIVE_CONTENT_POSITION` * `TARGETING_TYPE_NEGATIVE_KEYWORD_LIST` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_OPERATING_SYSTEM` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_POI` * `TARGETING_TYPE_PROXIMITY_LOCATION_LIST` * `TARGETING_TYPE_REGIONAL_LOCATION_LIST` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_THIRD_PARTY_VERIFIER` * `TARGETING_TYPE_URL` * `TARGETING_TYPE_USER_REWARDED_CONTENT` * `TARGETING_TYPE_VIDEO_PLAYER_SIZE` * `TARGETING_TYPE_VIEWABILITY` * `TARGETING_TYPE_YOUTUBE_CHANNEL` (only for `LINE_ITEM_TYPE_YOUTUBE_AND_PARTNERS_VIDEO_SEQUENCE` line items) * `TARGETING_TYPE_YOUTUBE_VIDEO` (only for `LINE_ITEM_TYPE_YOUTUBE_AND_PARTNERS_VIDEO_SEQUENCE` line items)
23783    ///
23784    /// Sets the *targeting type* path property to the given value.
23785    ///
23786    /// Even though the property as already been set when instantiating this call,
23787    /// we provide this method for API completeness.
23788    pub fn targeting_type(
23789        mut self,
23790        new_value: &str,
23791    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
23792        self._targeting_type = new_value.to_string();
23793        self
23794    }
23795    /// Required. An identifier unique to the targeting type in this line item that identifies the assigned targeting option being requested.
23796    ///
23797    /// Sets the *assigned targeting option id* path property to the given value.
23798    ///
23799    /// Even though the property as already been set when instantiating this call,
23800    /// we provide this method for API completeness.
23801    pub fn assigned_targeting_option_id(
23802        mut self,
23803        new_value: &str,
23804    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
23805        self._assigned_targeting_option_id = new_value.to_string();
23806        self
23807    }
23808    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23809    /// while executing the actual API request.
23810    ///
23811    /// ````text
23812    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23813    /// ````
23814    ///
23815    /// Sets the *delegate* property to the given value.
23816    pub fn delegate(
23817        mut self,
23818        new_value: &'a mut dyn common::Delegate,
23819    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
23820        self._delegate = Some(new_value);
23821        self
23822    }
23823
23824    /// Set any additional parameter of the query string used in the request.
23825    /// It should be used to set parameters which are not yet available through their own
23826    /// setters.
23827    ///
23828    /// Please note that this method must not be used to set any of the known parameters
23829    /// which have their own setter method. If done anyway, the request will fail.
23830    ///
23831    /// # Additional Parameters
23832    ///
23833    /// * *$.xgafv* (query-string) - V1 error format.
23834    /// * *access_token* (query-string) - OAuth access token.
23835    /// * *alt* (query-string) - Data format for response.
23836    /// * *callback* (query-string) - JSONP
23837    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23838    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23839    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23840    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23841    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23842    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23843    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23844    pub fn param<T>(
23845        mut self,
23846        name: T,
23847        value: T,
23848    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionGetCall<'a, C>
23849    where
23850        T: AsRef<str>,
23851    {
23852        self._additional_params
23853            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23854        self
23855    }
23856
23857    /// Identifies the authorization scope for the method you are building.
23858    ///
23859    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23860    /// [`Scope::DisplayVideo`].
23861    ///
23862    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23863    /// tokens for more than one scope.
23864    ///
23865    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23866    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23867    /// sufficient, a read-write scope will do as well.
23868    pub fn add_scope<St>(
23869        mut self,
23870        scope: St,
23871    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionGetCall<'a, C>
23872    where
23873        St: AsRef<str>,
23874    {
23875        self._scopes.insert(String::from(scope.as_ref()));
23876        self
23877    }
23878    /// Identifies the authorization scope(s) for the method you are building.
23879    ///
23880    /// See [`Self::add_scope()`] for details.
23881    pub fn add_scopes<I, St>(
23882        mut self,
23883        scopes: I,
23884    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionGetCall<'a, C>
23885    where
23886        I: IntoIterator<Item = St>,
23887        St: AsRef<str>,
23888    {
23889        self._scopes
23890            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23891        self
23892    }
23893
23894    /// Removes all scopes, and no default scope will be used either.
23895    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23896    /// for details).
23897    pub fn clear_scopes(
23898        mut self,
23899    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
23900        self._scopes.clear();
23901        self
23902    }
23903}
23904
23905/// Lists the targeting options assigned to a line item.
23906///
23907/// A builder for the *lineItems.targetingTypes.assignedTargetingOptions.list* method supported by a *advertiser* resource.
23908/// It is not used directly, but through a [`AdvertiserMethods`] instance.
23909///
23910/// # Example
23911///
23912/// Instantiate a resource method builder
23913///
23914/// ```test_harness,no_run
23915/// # extern crate hyper;
23916/// # extern crate hyper_rustls;
23917/// # extern crate google_displayvideo1 as displayvideo1;
23918/// # async fn dox() {
23919/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23920///
23921/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23922/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23923/// #     secret,
23924/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23925/// # ).build().await.unwrap();
23926///
23927/// # let client = hyper_util::client::legacy::Client::builder(
23928/// #     hyper_util::rt::TokioExecutor::new()
23929/// # )
23930/// # .build(
23931/// #     hyper_rustls::HttpsConnectorBuilder::new()
23932/// #         .with_native_roots()
23933/// #         .unwrap()
23934/// #         .https_or_http()
23935/// #         .enable_http1()
23936/// #         .build()
23937/// # );
23938/// # let mut hub = DisplayVideo::new(client, auth);
23939/// // You can configure optional parameters by calling the respective setters at will, and
23940/// // execute the final call using `doit()`.
23941/// // Values shown here are possibly random and not representative !
23942/// let result = hub.advertisers().line_items_targeting_types_assigned_targeting_options_list(-42, -57, "targetingType")
23943///              .page_token("sed")
23944///              .page_size(-75)
23945///              .order_by("Lorem")
23946///              .filter("ea")
23947///              .doit().await;
23948/// # }
23949/// ```
23950pub struct AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall<'a, C>
23951where
23952    C: 'a,
23953{
23954    hub: &'a DisplayVideo<C>,
23955    _advertiser_id: i64,
23956    _line_item_id: i64,
23957    _targeting_type: String,
23958    _page_token: Option<String>,
23959    _page_size: Option<i32>,
23960    _order_by: Option<String>,
23961    _filter: Option<String>,
23962    _delegate: Option<&'a mut dyn common::Delegate>,
23963    _additional_params: HashMap<String, String>,
23964    _scopes: BTreeSet<String>,
23965}
23966
23967impl<'a, C> common::CallBuilder
23968    for AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall<'a, C>
23969{
23970}
23971
23972impl<'a, C> AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall<'a, C>
23973where
23974    C: common::Connector,
23975{
23976    /// Perform the operation you have build so far.
23977    pub async fn doit(
23978        mut self,
23979    ) -> common::Result<(
23980        common::Response,
23981        ListLineItemAssignedTargetingOptionsResponse,
23982    )> {
23983        use std::borrow::Cow;
23984        use std::io::{Read, Seek};
23985
23986        use common::{url::Params, ToParts};
23987        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23988
23989        let mut dd = common::DefaultDelegate;
23990        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23991        dlg.begin(common::MethodInfo {
23992            id: "displayvideo.advertisers.lineItems.targetingTypes.assignedTargetingOptions.list",
23993            http_method: hyper::Method::GET,
23994        });
23995
23996        for &field in [
23997            "alt",
23998            "advertiserId",
23999            "lineItemId",
24000            "targetingType",
24001            "pageToken",
24002            "pageSize",
24003            "orderBy",
24004            "filter",
24005        ]
24006        .iter()
24007        {
24008            if self._additional_params.contains_key(field) {
24009                dlg.finished(false);
24010                return Err(common::Error::FieldClash(field));
24011            }
24012        }
24013
24014        let mut params = Params::with_capacity(9 + self._additional_params.len());
24015        params.push("advertiserId", self._advertiser_id.to_string());
24016        params.push("lineItemId", self._line_item_id.to_string());
24017        params.push("targetingType", self._targeting_type);
24018        if let Some(value) = self._page_token.as_ref() {
24019            params.push("pageToken", value);
24020        }
24021        if let Some(value) = self._page_size.as_ref() {
24022            params.push("pageSize", value.to_string());
24023        }
24024        if let Some(value) = self._order_by.as_ref() {
24025            params.push("orderBy", value);
24026        }
24027        if let Some(value) = self._filter.as_ref() {
24028            params.push("filter", value);
24029        }
24030
24031        params.extend(self._additional_params.iter());
24032
24033        params.push("alt", "json");
24034        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/lineItems/{+lineItemId}/targetingTypes/{+targetingType}/assignedTargetingOptions";
24035        if self._scopes.is_empty() {
24036            self._scopes
24037                .insert(Scope::DisplayVideo.as_ref().to_string());
24038        }
24039
24040        #[allow(clippy::single_element_loop)]
24041        for &(find_this, param_name) in [
24042            ("{+advertiserId}", "advertiserId"),
24043            ("{+lineItemId}", "lineItemId"),
24044            ("{+targetingType}", "targetingType"),
24045        ]
24046        .iter()
24047        {
24048            url = params.uri_replacement(url, param_name, find_this, true);
24049        }
24050        {
24051            let to_remove = ["targetingType", "lineItemId", "advertiserId"];
24052            params.remove_params(&to_remove);
24053        }
24054
24055        let url = params.parse_with_url(&url);
24056
24057        loop {
24058            let token = match self
24059                .hub
24060                .auth
24061                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24062                .await
24063            {
24064                Ok(token) => token,
24065                Err(e) => match dlg.token(e) {
24066                    Ok(token) => token,
24067                    Err(e) => {
24068                        dlg.finished(false);
24069                        return Err(common::Error::MissingToken(e));
24070                    }
24071                },
24072            };
24073            let mut req_result = {
24074                let client = &self.hub.client;
24075                dlg.pre_request();
24076                let mut req_builder = hyper::Request::builder()
24077                    .method(hyper::Method::GET)
24078                    .uri(url.as_str())
24079                    .header(USER_AGENT, self.hub._user_agent.clone());
24080
24081                if let Some(token) = token.as_ref() {
24082                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24083                }
24084
24085                let request = req_builder
24086                    .header(CONTENT_LENGTH, 0_u64)
24087                    .body(common::to_body::<String>(None));
24088
24089                client.request(request.unwrap()).await
24090            };
24091
24092            match req_result {
24093                Err(err) => {
24094                    if let common::Retry::After(d) = dlg.http_error(&err) {
24095                        sleep(d).await;
24096                        continue;
24097                    }
24098                    dlg.finished(false);
24099                    return Err(common::Error::HttpError(err));
24100                }
24101                Ok(res) => {
24102                    let (mut parts, body) = res.into_parts();
24103                    let mut body = common::Body::new(body);
24104                    if !parts.status.is_success() {
24105                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24106                        let error = serde_json::from_str(&common::to_string(&bytes));
24107                        let response = common::to_response(parts, bytes.into());
24108
24109                        if let common::Retry::After(d) =
24110                            dlg.http_failure(&response, error.as_ref().ok())
24111                        {
24112                            sleep(d).await;
24113                            continue;
24114                        }
24115
24116                        dlg.finished(false);
24117
24118                        return Err(match error {
24119                            Ok(value) => common::Error::BadRequest(value),
24120                            _ => common::Error::Failure(response),
24121                        });
24122                    }
24123                    let response = {
24124                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24125                        let encoded = common::to_string(&bytes);
24126                        match serde_json::from_str(&encoded) {
24127                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24128                            Err(error) => {
24129                                dlg.response_json_decode_error(&encoded, &error);
24130                                return Err(common::Error::JsonDecodeError(
24131                                    encoded.to_string(),
24132                                    error,
24133                                ));
24134                            }
24135                        }
24136                    };
24137
24138                    dlg.finished(true);
24139                    return Ok(response);
24140                }
24141            }
24142        }
24143    }
24144
24145    /// Required. The ID of the advertiser the line item belongs to.
24146    ///
24147    /// Sets the *advertiser id* path property to the given value.
24148    ///
24149    /// Even though the property as already been set when instantiating this call,
24150    /// we provide this method for API completeness.
24151    pub fn advertiser_id(
24152        mut self,
24153        new_value: i64,
24154    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall<'a, C> {
24155        self._advertiser_id = new_value;
24156        self
24157    }
24158    /// Required. The ID of the line item to list assigned targeting options for.
24159    ///
24160    /// Sets the *line item id* path property to the given value.
24161    ///
24162    /// Even though the property as already been set when instantiating this call,
24163    /// we provide this method for API completeness.
24164    pub fn line_item_id(
24165        mut self,
24166        new_value: i64,
24167    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall<'a, C> {
24168        self._line_item_id = new_value;
24169        self
24170    }
24171    /// Required. Identifies the type of assigned targeting options to list. Supported targeting types include: * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_APP` * `TARGETING_TYPE_APP_CATEGORY` * `TARGETING_TYPE_AUDIENCE_GROUP` * `TARGETING_TYPE_AUDIO_CONTENT_TYPE` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_BROWSER` * `TARGETING_TYPE_BUSINESS_CHAIN` * `TARGETING_TYPE_CARRIER_AND_ISP` * `TARGETING_TYPE_CATEGORY` * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_CONTENT_DURATION` * `TARGETING_TYPE_CONTENT_GENRE` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_STREAM_TYPE` * `TARGETING_TYPE_DAY_AND_TIME` * `TARGETING_TYPE_DEVICE_MAKE_MODEL` * `TARGETING_TYPE_DEVICE_TYPE` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_INVENTORY_SOURCE` * `TARGETING_TYPE_INVENTORY_SOURCE_GROUP` * `TARGETING_TYPE_KEYWORD` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_NATIVE_CONTENT_POSITION` * `TARGETING_TYPE_NEGATIVE_KEYWORD_LIST` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_OPERATING_SYSTEM` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_POI` * `TARGETING_TYPE_PROXIMITY_LOCATION_LIST` * `TARGETING_TYPE_REGIONAL_LOCATION_LIST` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_THIRD_PARTY_VERIFIER` * `TARGETING_TYPE_URL` * `TARGETING_TYPE_USER_REWARDED_CONTENT` * `TARGETING_TYPE_VIDEO_PLAYER_SIZE` * `TARGETING_TYPE_VIEWABILITY` * `TARGETING_TYPE_YOUTUBE_CHANNEL` (only for `LINE_ITEM_TYPE_YOUTUBE_AND_PARTNERS_VIDEO_SEQUENCE` line items) * `TARGETING_TYPE_YOUTUBE_VIDEO` (only for `LINE_ITEM_TYPE_YOUTUBE_AND_PARTNERS_VIDEO_SEQUENCE` line items)
24172    ///
24173    /// Sets the *targeting type* path property to the given value.
24174    ///
24175    /// Even though the property as already been set when instantiating this call,
24176    /// we provide this method for API completeness.
24177    pub fn targeting_type(
24178        mut self,
24179        new_value: &str,
24180    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall<'a, C> {
24181        self._targeting_type = new_value.to_string();
24182        self
24183    }
24184    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListLineItemAssignedTargetingOptions` method. If not specified, the first page of results will be returned.
24185    ///
24186    /// Sets the *page token* query property to the given value.
24187    pub fn page_token(
24188        mut self,
24189        new_value: &str,
24190    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall<'a, C> {
24191        self._page_token = Some(new_value.to_string());
24192        self
24193    }
24194    /// Requested page size. Must be between `1` and `5000`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
24195    ///
24196    /// Sets the *page size* query property to the given value.
24197    pub fn page_size(
24198        mut self,
24199        new_value: i32,
24200    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall<'a, C> {
24201        self._page_size = Some(new_value);
24202        self
24203    }
24204    /// Field by which to sort the list. Acceptable values are: * `assignedTargetingOptionId` (default) The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `assignedTargetingOptionId desc`.
24205    ///
24206    /// Sets the *order by* query property to the given value.
24207    pub fn order_by(
24208        mut self,
24209        new_value: &str,
24210    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall<'a, C> {
24211        self._order_by = Some(new_value.to_string());
24212        self
24213    }
24214    /// Allows filtering by assigned targeting option fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by the logical operator `OR`. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `EQUALS (=)` operator. Supported fields: * `assignedTargetingOptionId` * `inheritance` Examples: * `AssignedTargetingOption` resources with ID 1 or 2: `assignedTargetingOptionId="1" OR assignedTargetingOptionId="2"` * `AssignedTargetingOption` resources with inheritance status of `NOT_INHERITED` or `INHERITED_FROM_PARTNER`: `inheritance="NOT_INHERITED" OR inheritance="INHERITED_FROM_PARTNER"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
24215    ///
24216    /// Sets the *filter* query property to the given value.
24217    pub fn filter(
24218        mut self,
24219        new_value: &str,
24220    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall<'a, C> {
24221        self._filter = Some(new_value.to_string());
24222        self
24223    }
24224    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24225    /// while executing the actual API request.
24226    ///
24227    /// ````text
24228    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24229    /// ````
24230    ///
24231    /// Sets the *delegate* property to the given value.
24232    pub fn delegate(
24233        mut self,
24234        new_value: &'a mut dyn common::Delegate,
24235    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall<'a, C> {
24236        self._delegate = Some(new_value);
24237        self
24238    }
24239
24240    /// Set any additional parameter of the query string used in the request.
24241    /// It should be used to set parameters which are not yet available through their own
24242    /// setters.
24243    ///
24244    /// Please note that this method must not be used to set any of the known parameters
24245    /// which have their own setter method. If done anyway, the request will fail.
24246    ///
24247    /// # Additional Parameters
24248    ///
24249    /// * *$.xgafv* (query-string) - V1 error format.
24250    /// * *access_token* (query-string) - OAuth access token.
24251    /// * *alt* (query-string) - Data format for response.
24252    /// * *callback* (query-string) - JSONP
24253    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24254    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24255    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24256    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24257    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24258    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24259    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24260    pub fn param<T>(
24261        mut self,
24262        name: T,
24263        value: T,
24264    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall<'a, C>
24265    where
24266        T: AsRef<str>,
24267    {
24268        self._additional_params
24269            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24270        self
24271    }
24272
24273    /// Identifies the authorization scope for the method you are building.
24274    ///
24275    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24276    /// [`Scope::DisplayVideo`].
24277    ///
24278    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24279    /// tokens for more than one scope.
24280    ///
24281    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24282    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24283    /// sufficient, a read-write scope will do as well.
24284    pub fn add_scope<St>(
24285        mut self,
24286        scope: St,
24287    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall<'a, C>
24288    where
24289        St: AsRef<str>,
24290    {
24291        self._scopes.insert(String::from(scope.as_ref()));
24292        self
24293    }
24294    /// Identifies the authorization scope(s) for the method you are building.
24295    ///
24296    /// See [`Self::add_scope()`] for details.
24297    pub fn add_scopes<I, St>(
24298        mut self,
24299        scopes: I,
24300    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall<'a, C>
24301    where
24302        I: IntoIterator<Item = St>,
24303        St: AsRef<str>,
24304    {
24305        self._scopes
24306            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24307        self
24308    }
24309
24310    /// Removes all scopes, and no default scope will be used either.
24311    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24312    /// for details).
24313    pub fn clear_scopes(
24314        mut self,
24315    ) -> AdvertiserLineItemTargetingTypeAssignedTargetingOptionListCall<'a, C> {
24316        self._scopes.clear();
24317        self
24318    }
24319}
24320
24321/// Bulk edits targeting options under a single line item. The operation will delete the assigned targeting options provided in BulkEditLineItemAssignedTargetingOptionsRequest.delete_requests and then create the assigned targeting options provided in BulkEditLineItemAssignedTargetingOptionsRequest.create_requests. Requests to this endpoint cannot be made concurrently with the following requests updating the same line item: * lineItems.patch * assignedTargetingOptions.create * assignedTargetingOptions.delete YouTube & Partners line items cannot be created or updated using the API.
24322///
24323/// A builder for the *lineItems.bulkEditLineItemAssignedTargetingOptions* method supported by a *advertiser* resource.
24324/// It is not used directly, but through a [`AdvertiserMethods`] instance.
24325///
24326/// # Example
24327///
24328/// Instantiate a resource method builder
24329///
24330/// ```test_harness,no_run
24331/// # extern crate hyper;
24332/// # extern crate hyper_rustls;
24333/// # extern crate google_displayvideo1 as displayvideo1;
24334/// use displayvideo1::api::BulkEditLineItemAssignedTargetingOptionsRequest;
24335/// # async fn dox() {
24336/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24337///
24338/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24339/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24340/// #     secret,
24341/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24342/// # ).build().await.unwrap();
24343///
24344/// # let client = hyper_util::client::legacy::Client::builder(
24345/// #     hyper_util::rt::TokioExecutor::new()
24346/// # )
24347/// # .build(
24348/// #     hyper_rustls::HttpsConnectorBuilder::new()
24349/// #         .with_native_roots()
24350/// #         .unwrap()
24351/// #         .https_or_http()
24352/// #         .enable_http1()
24353/// #         .build()
24354/// # );
24355/// # let mut hub = DisplayVideo::new(client, auth);
24356/// // As the method needs a request, you would usually fill it with the desired information
24357/// // into the respective structure. Some of the parts shown here might not be applicable !
24358/// // Values shown here are possibly random and not representative !
24359/// let mut req = BulkEditLineItemAssignedTargetingOptionsRequest::default();
24360///
24361/// // You can configure optional parameters by calling the respective setters at will, and
24362/// // execute the final call using `doit()`.
24363/// // Values shown here are possibly random and not representative !
24364/// let result = hub.advertisers().line_items_bulk_edit_line_item_assigned_targeting_options(req, -15, -19)
24365///              .doit().await;
24366/// # }
24367/// ```
24368pub struct AdvertiserLineItemBulkEditLineItemAssignedTargetingOptionCall<'a, C>
24369where
24370    C: 'a,
24371{
24372    hub: &'a DisplayVideo<C>,
24373    _request: BulkEditLineItemAssignedTargetingOptionsRequest,
24374    _advertiser_id: i64,
24375    _line_item_id: i64,
24376    _delegate: Option<&'a mut dyn common::Delegate>,
24377    _additional_params: HashMap<String, String>,
24378    _scopes: BTreeSet<String>,
24379}
24380
24381impl<'a, C> common::CallBuilder
24382    for AdvertiserLineItemBulkEditLineItemAssignedTargetingOptionCall<'a, C>
24383{
24384}
24385
24386impl<'a, C> AdvertiserLineItemBulkEditLineItemAssignedTargetingOptionCall<'a, C>
24387where
24388    C: common::Connector,
24389{
24390    /// Perform the operation you have build so far.
24391    pub async fn doit(
24392        mut self,
24393    ) -> common::Result<(
24394        common::Response,
24395        BulkEditLineItemAssignedTargetingOptionsResponse,
24396    )> {
24397        use std::borrow::Cow;
24398        use std::io::{Read, Seek};
24399
24400        use common::{url::Params, ToParts};
24401        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24402
24403        let mut dd = common::DefaultDelegate;
24404        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24405        dlg.begin(common::MethodInfo {
24406            id: "displayvideo.advertisers.lineItems.bulkEditLineItemAssignedTargetingOptions",
24407            http_method: hyper::Method::POST,
24408        });
24409
24410        for &field in ["alt", "advertiserId", "lineItemId"].iter() {
24411            if self._additional_params.contains_key(field) {
24412                dlg.finished(false);
24413                return Err(common::Error::FieldClash(field));
24414            }
24415        }
24416
24417        let mut params = Params::with_capacity(5 + self._additional_params.len());
24418        params.push("advertiserId", self._advertiser_id.to_string());
24419        params.push("lineItemId", self._line_item_id.to_string());
24420
24421        params.extend(self._additional_params.iter());
24422
24423        params.push("alt", "json");
24424        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/lineItems/{+lineItemId}:bulkEditLineItemAssignedTargetingOptions";
24425        if self._scopes.is_empty() {
24426            self._scopes
24427                .insert(Scope::DisplayVideo.as_ref().to_string());
24428        }
24429
24430        #[allow(clippy::single_element_loop)]
24431        for &(find_this, param_name) in [
24432            ("{+advertiserId}", "advertiserId"),
24433            ("{+lineItemId}", "lineItemId"),
24434        ]
24435        .iter()
24436        {
24437            url = params.uri_replacement(url, param_name, find_this, true);
24438        }
24439        {
24440            let to_remove = ["lineItemId", "advertiserId"];
24441            params.remove_params(&to_remove);
24442        }
24443
24444        let url = params.parse_with_url(&url);
24445
24446        let mut json_mime_type = mime::APPLICATION_JSON;
24447        let mut request_value_reader = {
24448            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24449            common::remove_json_null_values(&mut value);
24450            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24451            serde_json::to_writer(&mut dst, &value).unwrap();
24452            dst
24453        };
24454        let request_size = request_value_reader
24455            .seek(std::io::SeekFrom::End(0))
24456            .unwrap();
24457        request_value_reader
24458            .seek(std::io::SeekFrom::Start(0))
24459            .unwrap();
24460
24461        loop {
24462            let token = match self
24463                .hub
24464                .auth
24465                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24466                .await
24467            {
24468                Ok(token) => token,
24469                Err(e) => match dlg.token(e) {
24470                    Ok(token) => token,
24471                    Err(e) => {
24472                        dlg.finished(false);
24473                        return Err(common::Error::MissingToken(e));
24474                    }
24475                },
24476            };
24477            request_value_reader
24478                .seek(std::io::SeekFrom::Start(0))
24479                .unwrap();
24480            let mut req_result = {
24481                let client = &self.hub.client;
24482                dlg.pre_request();
24483                let mut req_builder = hyper::Request::builder()
24484                    .method(hyper::Method::POST)
24485                    .uri(url.as_str())
24486                    .header(USER_AGENT, self.hub._user_agent.clone());
24487
24488                if let Some(token) = token.as_ref() {
24489                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24490                }
24491
24492                let request = req_builder
24493                    .header(CONTENT_TYPE, json_mime_type.to_string())
24494                    .header(CONTENT_LENGTH, request_size as u64)
24495                    .body(common::to_body(
24496                        request_value_reader.get_ref().clone().into(),
24497                    ));
24498
24499                client.request(request.unwrap()).await
24500            };
24501
24502            match req_result {
24503                Err(err) => {
24504                    if let common::Retry::After(d) = dlg.http_error(&err) {
24505                        sleep(d).await;
24506                        continue;
24507                    }
24508                    dlg.finished(false);
24509                    return Err(common::Error::HttpError(err));
24510                }
24511                Ok(res) => {
24512                    let (mut parts, body) = res.into_parts();
24513                    let mut body = common::Body::new(body);
24514                    if !parts.status.is_success() {
24515                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24516                        let error = serde_json::from_str(&common::to_string(&bytes));
24517                        let response = common::to_response(parts, bytes.into());
24518
24519                        if let common::Retry::After(d) =
24520                            dlg.http_failure(&response, error.as_ref().ok())
24521                        {
24522                            sleep(d).await;
24523                            continue;
24524                        }
24525
24526                        dlg.finished(false);
24527
24528                        return Err(match error {
24529                            Ok(value) => common::Error::BadRequest(value),
24530                            _ => common::Error::Failure(response),
24531                        });
24532                    }
24533                    let response = {
24534                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24535                        let encoded = common::to_string(&bytes);
24536                        match serde_json::from_str(&encoded) {
24537                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24538                            Err(error) => {
24539                                dlg.response_json_decode_error(&encoded, &error);
24540                                return Err(common::Error::JsonDecodeError(
24541                                    encoded.to_string(),
24542                                    error,
24543                                ));
24544                            }
24545                        }
24546                    };
24547
24548                    dlg.finished(true);
24549                    return Ok(response);
24550                }
24551            }
24552        }
24553    }
24554
24555    ///
24556    /// Sets the *request* property to the given value.
24557    ///
24558    /// Even though the property as already been set when instantiating this call,
24559    /// we provide this method for API completeness.
24560    pub fn request(
24561        mut self,
24562        new_value: BulkEditLineItemAssignedTargetingOptionsRequest,
24563    ) -> AdvertiserLineItemBulkEditLineItemAssignedTargetingOptionCall<'a, C> {
24564        self._request = new_value;
24565        self
24566    }
24567    /// Required. The ID of the advertiser the line item belongs to.
24568    ///
24569    /// Sets the *advertiser id* path property to the given value.
24570    ///
24571    /// Even though the property as already been set when instantiating this call,
24572    /// we provide this method for API completeness.
24573    pub fn advertiser_id(
24574        mut self,
24575        new_value: i64,
24576    ) -> AdvertiserLineItemBulkEditLineItemAssignedTargetingOptionCall<'a, C> {
24577        self._advertiser_id = new_value;
24578        self
24579    }
24580    /// Required. The ID of the line item the assigned targeting option will belong to.
24581    ///
24582    /// Sets the *line item id* path property to the given value.
24583    ///
24584    /// Even though the property as already been set when instantiating this call,
24585    /// we provide this method for API completeness.
24586    pub fn line_item_id(
24587        mut self,
24588        new_value: i64,
24589    ) -> AdvertiserLineItemBulkEditLineItemAssignedTargetingOptionCall<'a, C> {
24590        self._line_item_id = new_value;
24591        self
24592    }
24593    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24594    /// while executing the actual API request.
24595    ///
24596    /// ````text
24597    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24598    /// ````
24599    ///
24600    /// Sets the *delegate* property to the given value.
24601    pub fn delegate(
24602        mut self,
24603        new_value: &'a mut dyn common::Delegate,
24604    ) -> AdvertiserLineItemBulkEditLineItemAssignedTargetingOptionCall<'a, C> {
24605        self._delegate = Some(new_value);
24606        self
24607    }
24608
24609    /// Set any additional parameter of the query string used in the request.
24610    /// It should be used to set parameters which are not yet available through their own
24611    /// setters.
24612    ///
24613    /// Please note that this method must not be used to set any of the known parameters
24614    /// which have their own setter method. If done anyway, the request will fail.
24615    ///
24616    /// # Additional Parameters
24617    ///
24618    /// * *$.xgafv* (query-string) - V1 error format.
24619    /// * *access_token* (query-string) - OAuth access token.
24620    /// * *alt* (query-string) - Data format for response.
24621    /// * *callback* (query-string) - JSONP
24622    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24623    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24624    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24625    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24626    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24627    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24628    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24629    pub fn param<T>(
24630        mut self,
24631        name: T,
24632        value: T,
24633    ) -> AdvertiserLineItemBulkEditLineItemAssignedTargetingOptionCall<'a, C>
24634    where
24635        T: AsRef<str>,
24636    {
24637        self._additional_params
24638            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24639        self
24640    }
24641
24642    /// Identifies the authorization scope for the method you are building.
24643    ///
24644    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24645    /// [`Scope::DisplayVideo`].
24646    ///
24647    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24648    /// tokens for more than one scope.
24649    ///
24650    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24651    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24652    /// sufficient, a read-write scope will do as well.
24653    pub fn add_scope<St>(
24654        mut self,
24655        scope: St,
24656    ) -> AdvertiserLineItemBulkEditLineItemAssignedTargetingOptionCall<'a, C>
24657    where
24658        St: AsRef<str>,
24659    {
24660        self._scopes.insert(String::from(scope.as_ref()));
24661        self
24662    }
24663    /// Identifies the authorization scope(s) for the method you are building.
24664    ///
24665    /// See [`Self::add_scope()`] for details.
24666    pub fn add_scopes<I, St>(
24667        mut self,
24668        scopes: I,
24669    ) -> AdvertiserLineItemBulkEditLineItemAssignedTargetingOptionCall<'a, C>
24670    where
24671        I: IntoIterator<Item = St>,
24672        St: AsRef<str>,
24673    {
24674        self._scopes
24675            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24676        self
24677    }
24678
24679    /// Removes all scopes, and no default scope will be used either.
24680    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24681    /// for details).
24682    pub fn clear_scopes(
24683        mut self,
24684    ) -> AdvertiserLineItemBulkEditLineItemAssignedTargetingOptionCall<'a, C> {
24685        self._scopes.clear();
24686        self
24687    }
24688}
24689
24690/// Lists assigned targeting options of a line item across targeting types.
24691///
24692/// A builder for the *lineItems.bulkListLineItemAssignedTargetingOptions* method supported by a *advertiser* resource.
24693/// It is not used directly, but through a [`AdvertiserMethods`] instance.
24694///
24695/// # Example
24696///
24697/// Instantiate a resource method builder
24698///
24699/// ```test_harness,no_run
24700/// # extern crate hyper;
24701/// # extern crate hyper_rustls;
24702/// # extern crate google_displayvideo1 as displayvideo1;
24703/// # async fn dox() {
24704/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24705///
24706/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24707/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24708/// #     secret,
24709/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24710/// # ).build().await.unwrap();
24711///
24712/// # let client = hyper_util::client::legacy::Client::builder(
24713/// #     hyper_util::rt::TokioExecutor::new()
24714/// # )
24715/// # .build(
24716/// #     hyper_rustls::HttpsConnectorBuilder::new()
24717/// #         .with_native_roots()
24718/// #         .unwrap()
24719/// #         .https_or_http()
24720/// #         .enable_http1()
24721/// #         .build()
24722/// # );
24723/// # let mut hub = DisplayVideo::new(client, auth);
24724/// // You can configure optional parameters by calling the respective setters at will, and
24725/// // execute the final call using `doit()`.
24726/// // Values shown here are possibly random and not representative !
24727/// let result = hub.advertisers().line_items_bulk_list_line_item_assigned_targeting_options(-25, -68)
24728///              .page_token("sea")
24729///              .page_size(-74)
24730///              .order_by("At")
24731///              .filter("dolore")
24732///              .doit().await;
24733/// # }
24734/// ```
24735pub struct AdvertiserLineItemBulkListLineItemAssignedTargetingOptionCall<'a, C>
24736where
24737    C: 'a,
24738{
24739    hub: &'a DisplayVideo<C>,
24740    _advertiser_id: i64,
24741    _line_item_id: i64,
24742    _page_token: Option<String>,
24743    _page_size: Option<i32>,
24744    _order_by: Option<String>,
24745    _filter: Option<String>,
24746    _delegate: Option<&'a mut dyn common::Delegate>,
24747    _additional_params: HashMap<String, String>,
24748    _scopes: BTreeSet<String>,
24749}
24750
24751impl<'a, C> common::CallBuilder
24752    for AdvertiserLineItemBulkListLineItemAssignedTargetingOptionCall<'a, C>
24753{
24754}
24755
24756impl<'a, C> AdvertiserLineItemBulkListLineItemAssignedTargetingOptionCall<'a, C>
24757where
24758    C: common::Connector,
24759{
24760    /// Perform the operation you have build so far.
24761    pub async fn doit(
24762        mut self,
24763    ) -> common::Result<(
24764        common::Response,
24765        BulkListLineItemAssignedTargetingOptionsResponse,
24766    )> {
24767        use std::borrow::Cow;
24768        use std::io::{Read, Seek};
24769
24770        use common::{url::Params, ToParts};
24771        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24772
24773        let mut dd = common::DefaultDelegate;
24774        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24775        dlg.begin(common::MethodInfo {
24776            id: "displayvideo.advertisers.lineItems.bulkListLineItemAssignedTargetingOptions",
24777            http_method: hyper::Method::GET,
24778        });
24779
24780        for &field in [
24781            "alt",
24782            "advertiserId",
24783            "lineItemId",
24784            "pageToken",
24785            "pageSize",
24786            "orderBy",
24787            "filter",
24788        ]
24789        .iter()
24790        {
24791            if self._additional_params.contains_key(field) {
24792                dlg.finished(false);
24793                return Err(common::Error::FieldClash(field));
24794            }
24795        }
24796
24797        let mut params = Params::with_capacity(8 + self._additional_params.len());
24798        params.push("advertiserId", self._advertiser_id.to_string());
24799        params.push("lineItemId", self._line_item_id.to_string());
24800        if let Some(value) = self._page_token.as_ref() {
24801            params.push("pageToken", value);
24802        }
24803        if let Some(value) = self._page_size.as_ref() {
24804            params.push("pageSize", value.to_string());
24805        }
24806        if let Some(value) = self._order_by.as_ref() {
24807            params.push("orderBy", value);
24808        }
24809        if let Some(value) = self._filter.as_ref() {
24810            params.push("filter", value);
24811        }
24812
24813        params.extend(self._additional_params.iter());
24814
24815        params.push("alt", "json");
24816        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/lineItems/{+lineItemId}:bulkListLineItemAssignedTargetingOptions";
24817        if self._scopes.is_empty() {
24818            self._scopes
24819                .insert(Scope::DisplayVideo.as_ref().to_string());
24820        }
24821
24822        #[allow(clippy::single_element_loop)]
24823        for &(find_this, param_name) in [
24824            ("{+advertiserId}", "advertiserId"),
24825            ("{+lineItemId}", "lineItemId"),
24826        ]
24827        .iter()
24828        {
24829            url = params.uri_replacement(url, param_name, find_this, true);
24830        }
24831        {
24832            let to_remove = ["lineItemId", "advertiserId"];
24833            params.remove_params(&to_remove);
24834        }
24835
24836        let url = params.parse_with_url(&url);
24837
24838        loop {
24839            let token = match self
24840                .hub
24841                .auth
24842                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24843                .await
24844            {
24845                Ok(token) => token,
24846                Err(e) => match dlg.token(e) {
24847                    Ok(token) => token,
24848                    Err(e) => {
24849                        dlg.finished(false);
24850                        return Err(common::Error::MissingToken(e));
24851                    }
24852                },
24853            };
24854            let mut req_result = {
24855                let client = &self.hub.client;
24856                dlg.pre_request();
24857                let mut req_builder = hyper::Request::builder()
24858                    .method(hyper::Method::GET)
24859                    .uri(url.as_str())
24860                    .header(USER_AGENT, self.hub._user_agent.clone());
24861
24862                if let Some(token) = token.as_ref() {
24863                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24864                }
24865
24866                let request = req_builder
24867                    .header(CONTENT_LENGTH, 0_u64)
24868                    .body(common::to_body::<String>(None));
24869
24870                client.request(request.unwrap()).await
24871            };
24872
24873            match req_result {
24874                Err(err) => {
24875                    if let common::Retry::After(d) = dlg.http_error(&err) {
24876                        sleep(d).await;
24877                        continue;
24878                    }
24879                    dlg.finished(false);
24880                    return Err(common::Error::HttpError(err));
24881                }
24882                Ok(res) => {
24883                    let (mut parts, body) = res.into_parts();
24884                    let mut body = common::Body::new(body);
24885                    if !parts.status.is_success() {
24886                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24887                        let error = serde_json::from_str(&common::to_string(&bytes));
24888                        let response = common::to_response(parts, bytes.into());
24889
24890                        if let common::Retry::After(d) =
24891                            dlg.http_failure(&response, error.as_ref().ok())
24892                        {
24893                            sleep(d).await;
24894                            continue;
24895                        }
24896
24897                        dlg.finished(false);
24898
24899                        return Err(match error {
24900                            Ok(value) => common::Error::BadRequest(value),
24901                            _ => common::Error::Failure(response),
24902                        });
24903                    }
24904                    let response = {
24905                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24906                        let encoded = common::to_string(&bytes);
24907                        match serde_json::from_str(&encoded) {
24908                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24909                            Err(error) => {
24910                                dlg.response_json_decode_error(&encoded, &error);
24911                                return Err(common::Error::JsonDecodeError(
24912                                    encoded.to_string(),
24913                                    error,
24914                                ));
24915                            }
24916                        }
24917                    };
24918
24919                    dlg.finished(true);
24920                    return Ok(response);
24921                }
24922            }
24923        }
24924    }
24925
24926    /// Required. The ID of the advertiser the line item belongs to.
24927    ///
24928    /// Sets the *advertiser id* path property to the given value.
24929    ///
24930    /// Even though the property as already been set when instantiating this call,
24931    /// we provide this method for API completeness.
24932    pub fn advertiser_id(
24933        mut self,
24934        new_value: i64,
24935    ) -> AdvertiserLineItemBulkListLineItemAssignedTargetingOptionCall<'a, C> {
24936        self._advertiser_id = new_value;
24937        self
24938    }
24939    /// Required. The ID of the line item to list assigned targeting options for.
24940    ///
24941    /// Sets the *line item id* path property to the given value.
24942    ///
24943    /// Even though the property as already been set when instantiating this call,
24944    /// we provide this method for API completeness.
24945    pub fn line_item_id(
24946        mut self,
24947        new_value: i64,
24948    ) -> AdvertiserLineItemBulkListLineItemAssignedTargetingOptionCall<'a, C> {
24949        self._line_item_id = new_value;
24950        self
24951    }
24952    /// A token that lets the client fetch the next page of results. Typically, this is the value of next_page_token returned from the previous call to `BulkListLineItemAssignedTargetingOptions` method. If not specified, the first page of results will be returned.
24953    ///
24954    /// Sets the *page token* query property to the given value.
24955    pub fn page_token(
24956        mut self,
24957        new_value: &str,
24958    ) -> AdvertiserLineItemBulkListLineItemAssignedTargetingOptionCall<'a, C> {
24959        self._page_token = Some(new_value.to_string());
24960        self
24961    }
24962    /// Requested page size. The size must be an integer between `1` and `5000`. If unspecified, the default is `5000`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
24963    ///
24964    /// Sets the *page size* query property to the given value.
24965    pub fn page_size(
24966        mut self,
24967        new_value: i32,
24968    ) -> AdvertiserLineItemBulkListLineItemAssignedTargetingOptionCall<'a, C> {
24969        self._page_size = Some(new_value);
24970        self
24971    }
24972    /// Field by which to sort the list. Acceptable values are: * `targetingType` (default) The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `targetingType desc`.
24973    ///
24974    /// Sets the *order by* query property to the given value.
24975    pub fn order_by(
24976        mut self,
24977        new_value: &str,
24978    ) -> AdvertiserLineItemBulkListLineItemAssignedTargetingOptionCall<'a, C> {
24979        self._order_by = Some(new_value.to_string());
24980        self
24981    }
24982    /// Allows filtering by assigned targeting option fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by the logical operator `OR`. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `EQUALS (=)` operator. Supported fields: * `targetingType` * `inheritance` Examples: * `AssignedTargetingOption` resources of targeting type `TARGETING_TYPE_PROXIMITY_LOCATION_LIST` or `TARGETING_TYPE_CHANNEL`: `targetingType="TARGETING_TYPE_PROXIMITY_LOCATION_LIST" OR targetingType="TARGETING_TYPE_CHANNEL"` * `AssignedTargetingOption` resources with inheritance status of `NOT_INHERITED` or `INHERITED_FROM_PARTNER`: `inheritance="NOT_INHERITED" OR inheritance="INHERITED_FROM_PARTNER"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
24983    ///
24984    /// Sets the *filter* query property to the given value.
24985    pub fn filter(
24986        mut self,
24987        new_value: &str,
24988    ) -> AdvertiserLineItemBulkListLineItemAssignedTargetingOptionCall<'a, C> {
24989        self._filter = Some(new_value.to_string());
24990        self
24991    }
24992    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24993    /// while executing the actual API request.
24994    ///
24995    /// ````text
24996    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24997    /// ````
24998    ///
24999    /// Sets the *delegate* property to the given value.
25000    pub fn delegate(
25001        mut self,
25002        new_value: &'a mut dyn common::Delegate,
25003    ) -> AdvertiserLineItemBulkListLineItemAssignedTargetingOptionCall<'a, C> {
25004        self._delegate = Some(new_value);
25005        self
25006    }
25007
25008    /// Set any additional parameter of the query string used in the request.
25009    /// It should be used to set parameters which are not yet available through their own
25010    /// setters.
25011    ///
25012    /// Please note that this method must not be used to set any of the known parameters
25013    /// which have their own setter method. If done anyway, the request will fail.
25014    ///
25015    /// # Additional Parameters
25016    ///
25017    /// * *$.xgafv* (query-string) - V1 error format.
25018    /// * *access_token* (query-string) - OAuth access token.
25019    /// * *alt* (query-string) - Data format for response.
25020    /// * *callback* (query-string) - JSONP
25021    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25022    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25023    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25024    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25025    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25026    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25027    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25028    pub fn param<T>(
25029        mut self,
25030        name: T,
25031        value: T,
25032    ) -> AdvertiserLineItemBulkListLineItemAssignedTargetingOptionCall<'a, C>
25033    where
25034        T: AsRef<str>,
25035    {
25036        self._additional_params
25037            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25038        self
25039    }
25040
25041    /// Identifies the authorization scope for the method you are building.
25042    ///
25043    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25044    /// [`Scope::DisplayVideo`].
25045    ///
25046    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25047    /// tokens for more than one scope.
25048    ///
25049    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25050    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25051    /// sufficient, a read-write scope will do as well.
25052    pub fn add_scope<St>(
25053        mut self,
25054        scope: St,
25055    ) -> AdvertiserLineItemBulkListLineItemAssignedTargetingOptionCall<'a, C>
25056    where
25057        St: AsRef<str>,
25058    {
25059        self._scopes.insert(String::from(scope.as_ref()));
25060        self
25061    }
25062    /// Identifies the authorization scope(s) for the method you are building.
25063    ///
25064    /// See [`Self::add_scope()`] for details.
25065    pub fn add_scopes<I, St>(
25066        mut self,
25067        scopes: I,
25068    ) -> AdvertiserLineItemBulkListLineItemAssignedTargetingOptionCall<'a, C>
25069    where
25070        I: IntoIterator<Item = St>,
25071        St: AsRef<str>,
25072    {
25073        self._scopes
25074            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25075        self
25076    }
25077
25078    /// Removes all scopes, and no default scope will be used either.
25079    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25080    /// for details).
25081    pub fn clear_scopes(
25082        mut self,
25083    ) -> AdvertiserLineItemBulkListLineItemAssignedTargetingOptionCall<'a, C> {
25084        self._scopes.clear();
25085        self
25086    }
25087}
25088
25089/// Creates a new line item. Returns the newly created line item if successful. YouTube & Partners line items cannot be created or updated using the API.
25090///
25091/// A builder for the *lineItems.create* method supported by a *advertiser* resource.
25092/// It is not used directly, but through a [`AdvertiserMethods`] instance.
25093///
25094/// # Example
25095///
25096/// Instantiate a resource method builder
25097///
25098/// ```test_harness,no_run
25099/// # extern crate hyper;
25100/// # extern crate hyper_rustls;
25101/// # extern crate google_displayvideo1 as displayvideo1;
25102/// use displayvideo1::api::LineItem;
25103/// # async fn dox() {
25104/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25105///
25106/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25107/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25108/// #     secret,
25109/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25110/// # ).build().await.unwrap();
25111///
25112/// # let client = hyper_util::client::legacy::Client::builder(
25113/// #     hyper_util::rt::TokioExecutor::new()
25114/// # )
25115/// # .build(
25116/// #     hyper_rustls::HttpsConnectorBuilder::new()
25117/// #         .with_native_roots()
25118/// #         .unwrap()
25119/// #         .https_or_http()
25120/// #         .enable_http1()
25121/// #         .build()
25122/// # );
25123/// # let mut hub = DisplayVideo::new(client, auth);
25124/// // As the method needs a request, you would usually fill it with the desired information
25125/// // into the respective structure. Some of the parts shown here might not be applicable !
25126/// // Values shown here are possibly random and not representative !
25127/// let mut req = LineItem::default();
25128///
25129/// // You can configure optional parameters by calling the respective setters at will, and
25130/// // execute the final call using `doit()`.
25131/// // Values shown here are possibly random and not representative !
25132/// let result = hub.advertisers().line_items_create(req, -40)
25133///              .doit().await;
25134/// # }
25135/// ```
25136pub struct AdvertiserLineItemCreateCall<'a, C>
25137where
25138    C: 'a,
25139{
25140    hub: &'a DisplayVideo<C>,
25141    _request: LineItem,
25142    _advertiser_id: i64,
25143    _delegate: Option<&'a mut dyn common::Delegate>,
25144    _additional_params: HashMap<String, String>,
25145    _scopes: BTreeSet<String>,
25146}
25147
25148impl<'a, C> common::CallBuilder for AdvertiserLineItemCreateCall<'a, C> {}
25149
25150impl<'a, C> AdvertiserLineItemCreateCall<'a, C>
25151where
25152    C: common::Connector,
25153{
25154    /// Perform the operation you have build so far.
25155    pub async fn doit(mut self) -> common::Result<(common::Response, LineItem)> {
25156        use std::borrow::Cow;
25157        use std::io::{Read, Seek};
25158
25159        use common::{url::Params, ToParts};
25160        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25161
25162        let mut dd = common::DefaultDelegate;
25163        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25164        dlg.begin(common::MethodInfo {
25165            id: "displayvideo.advertisers.lineItems.create",
25166            http_method: hyper::Method::POST,
25167        });
25168
25169        for &field in ["alt", "advertiserId"].iter() {
25170            if self._additional_params.contains_key(field) {
25171                dlg.finished(false);
25172                return Err(common::Error::FieldClash(field));
25173            }
25174        }
25175
25176        let mut params = Params::with_capacity(4 + self._additional_params.len());
25177        params.push("advertiserId", self._advertiser_id.to_string());
25178
25179        params.extend(self._additional_params.iter());
25180
25181        params.push("alt", "json");
25182        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/lineItems";
25183        if self._scopes.is_empty() {
25184            self._scopes
25185                .insert(Scope::DisplayVideo.as_ref().to_string());
25186        }
25187
25188        #[allow(clippy::single_element_loop)]
25189        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
25190            url = params.uri_replacement(url, param_name, find_this, true);
25191        }
25192        {
25193            let to_remove = ["advertiserId"];
25194            params.remove_params(&to_remove);
25195        }
25196
25197        let url = params.parse_with_url(&url);
25198
25199        let mut json_mime_type = mime::APPLICATION_JSON;
25200        let mut request_value_reader = {
25201            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25202            common::remove_json_null_values(&mut value);
25203            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25204            serde_json::to_writer(&mut dst, &value).unwrap();
25205            dst
25206        };
25207        let request_size = request_value_reader
25208            .seek(std::io::SeekFrom::End(0))
25209            .unwrap();
25210        request_value_reader
25211            .seek(std::io::SeekFrom::Start(0))
25212            .unwrap();
25213
25214        loop {
25215            let token = match self
25216                .hub
25217                .auth
25218                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25219                .await
25220            {
25221                Ok(token) => token,
25222                Err(e) => match dlg.token(e) {
25223                    Ok(token) => token,
25224                    Err(e) => {
25225                        dlg.finished(false);
25226                        return Err(common::Error::MissingToken(e));
25227                    }
25228                },
25229            };
25230            request_value_reader
25231                .seek(std::io::SeekFrom::Start(0))
25232                .unwrap();
25233            let mut req_result = {
25234                let client = &self.hub.client;
25235                dlg.pre_request();
25236                let mut req_builder = hyper::Request::builder()
25237                    .method(hyper::Method::POST)
25238                    .uri(url.as_str())
25239                    .header(USER_AGENT, self.hub._user_agent.clone());
25240
25241                if let Some(token) = token.as_ref() {
25242                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25243                }
25244
25245                let request = req_builder
25246                    .header(CONTENT_TYPE, json_mime_type.to_string())
25247                    .header(CONTENT_LENGTH, request_size as u64)
25248                    .body(common::to_body(
25249                        request_value_reader.get_ref().clone().into(),
25250                    ));
25251
25252                client.request(request.unwrap()).await
25253            };
25254
25255            match req_result {
25256                Err(err) => {
25257                    if let common::Retry::After(d) = dlg.http_error(&err) {
25258                        sleep(d).await;
25259                        continue;
25260                    }
25261                    dlg.finished(false);
25262                    return Err(common::Error::HttpError(err));
25263                }
25264                Ok(res) => {
25265                    let (mut parts, body) = res.into_parts();
25266                    let mut body = common::Body::new(body);
25267                    if !parts.status.is_success() {
25268                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25269                        let error = serde_json::from_str(&common::to_string(&bytes));
25270                        let response = common::to_response(parts, bytes.into());
25271
25272                        if let common::Retry::After(d) =
25273                            dlg.http_failure(&response, error.as_ref().ok())
25274                        {
25275                            sleep(d).await;
25276                            continue;
25277                        }
25278
25279                        dlg.finished(false);
25280
25281                        return Err(match error {
25282                            Ok(value) => common::Error::BadRequest(value),
25283                            _ => common::Error::Failure(response),
25284                        });
25285                    }
25286                    let response = {
25287                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25288                        let encoded = common::to_string(&bytes);
25289                        match serde_json::from_str(&encoded) {
25290                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25291                            Err(error) => {
25292                                dlg.response_json_decode_error(&encoded, &error);
25293                                return Err(common::Error::JsonDecodeError(
25294                                    encoded.to_string(),
25295                                    error,
25296                                ));
25297                            }
25298                        }
25299                    };
25300
25301                    dlg.finished(true);
25302                    return Ok(response);
25303                }
25304            }
25305        }
25306    }
25307
25308    ///
25309    /// Sets the *request* property to the given value.
25310    ///
25311    /// Even though the property as already been set when instantiating this call,
25312    /// we provide this method for API completeness.
25313    pub fn request(mut self, new_value: LineItem) -> AdvertiserLineItemCreateCall<'a, C> {
25314        self._request = new_value;
25315        self
25316    }
25317    /// Output only. The unique ID of the advertiser the line item belongs to.
25318    ///
25319    /// Sets the *advertiser id* path property to the given value.
25320    ///
25321    /// Even though the property as already been set when instantiating this call,
25322    /// we provide this method for API completeness.
25323    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserLineItemCreateCall<'a, C> {
25324        self._advertiser_id = new_value;
25325        self
25326    }
25327    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25328    /// while executing the actual API request.
25329    ///
25330    /// ````text
25331    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25332    /// ````
25333    ///
25334    /// Sets the *delegate* property to the given value.
25335    pub fn delegate(
25336        mut self,
25337        new_value: &'a mut dyn common::Delegate,
25338    ) -> AdvertiserLineItemCreateCall<'a, C> {
25339        self._delegate = Some(new_value);
25340        self
25341    }
25342
25343    /// Set any additional parameter of the query string used in the request.
25344    /// It should be used to set parameters which are not yet available through their own
25345    /// setters.
25346    ///
25347    /// Please note that this method must not be used to set any of the known parameters
25348    /// which have their own setter method. If done anyway, the request will fail.
25349    ///
25350    /// # Additional Parameters
25351    ///
25352    /// * *$.xgafv* (query-string) - V1 error format.
25353    /// * *access_token* (query-string) - OAuth access token.
25354    /// * *alt* (query-string) - Data format for response.
25355    /// * *callback* (query-string) - JSONP
25356    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25357    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25358    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25359    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25360    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25361    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25362    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25363    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserLineItemCreateCall<'a, C>
25364    where
25365        T: AsRef<str>,
25366    {
25367        self._additional_params
25368            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25369        self
25370    }
25371
25372    /// Identifies the authorization scope for the method you are building.
25373    ///
25374    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25375    /// [`Scope::DisplayVideo`].
25376    ///
25377    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25378    /// tokens for more than one scope.
25379    ///
25380    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25381    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25382    /// sufficient, a read-write scope will do as well.
25383    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserLineItemCreateCall<'a, C>
25384    where
25385        St: AsRef<str>,
25386    {
25387        self._scopes.insert(String::from(scope.as_ref()));
25388        self
25389    }
25390    /// Identifies the authorization scope(s) for the method you are building.
25391    ///
25392    /// See [`Self::add_scope()`] for details.
25393    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserLineItemCreateCall<'a, C>
25394    where
25395        I: IntoIterator<Item = St>,
25396        St: AsRef<str>,
25397    {
25398        self._scopes
25399            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25400        self
25401    }
25402
25403    /// Removes all scopes, and no default scope will be used either.
25404    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25405    /// for details).
25406    pub fn clear_scopes(mut self) -> AdvertiserLineItemCreateCall<'a, C> {
25407        self._scopes.clear();
25408        self
25409    }
25410}
25411
25412/// Deletes a line item. Returns error code `NOT_FOUND` if the line item does not exist. The line item should be archived first, i.e. set entity_status to `ENTITY_STATUS_ARCHIVED`, to be able to delete it. YouTube & Partners line items cannot be created or updated using the API.
25413///
25414/// A builder for the *lineItems.delete* method supported by a *advertiser* resource.
25415/// It is not used directly, but through a [`AdvertiserMethods`] instance.
25416///
25417/// # Example
25418///
25419/// Instantiate a resource method builder
25420///
25421/// ```test_harness,no_run
25422/// # extern crate hyper;
25423/// # extern crate hyper_rustls;
25424/// # extern crate google_displayvideo1 as displayvideo1;
25425/// # async fn dox() {
25426/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25427///
25428/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25429/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25430/// #     secret,
25431/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25432/// # ).build().await.unwrap();
25433///
25434/// # let client = hyper_util::client::legacy::Client::builder(
25435/// #     hyper_util::rt::TokioExecutor::new()
25436/// # )
25437/// # .build(
25438/// #     hyper_rustls::HttpsConnectorBuilder::new()
25439/// #         .with_native_roots()
25440/// #         .unwrap()
25441/// #         .https_or_http()
25442/// #         .enable_http1()
25443/// #         .build()
25444/// # );
25445/// # let mut hub = DisplayVideo::new(client, auth);
25446/// // You can configure optional parameters by calling the respective setters at will, and
25447/// // execute the final call using `doit()`.
25448/// // Values shown here are possibly random and not representative !
25449/// let result = hub.advertisers().line_items_delete(-51, -23)
25450///              .doit().await;
25451/// # }
25452/// ```
25453pub struct AdvertiserLineItemDeleteCall<'a, C>
25454where
25455    C: 'a,
25456{
25457    hub: &'a DisplayVideo<C>,
25458    _advertiser_id: i64,
25459    _line_item_id: i64,
25460    _delegate: Option<&'a mut dyn common::Delegate>,
25461    _additional_params: HashMap<String, String>,
25462    _scopes: BTreeSet<String>,
25463}
25464
25465impl<'a, C> common::CallBuilder for AdvertiserLineItemDeleteCall<'a, C> {}
25466
25467impl<'a, C> AdvertiserLineItemDeleteCall<'a, C>
25468where
25469    C: common::Connector,
25470{
25471    /// Perform the operation you have build so far.
25472    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
25473        use std::borrow::Cow;
25474        use std::io::{Read, Seek};
25475
25476        use common::{url::Params, ToParts};
25477        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25478
25479        let mut dd = common::DefaultDelegate;
25480        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25481        dlg.begin(common::MethodInfo {
25482            id: "displayvideo.advertisers.lineItems.delete",
25483            http_method: hyper::Method::DELETE,
25484        });
25485
25486        for &field in ["alt", "advertiserId", "lineItemId"].iter() {
25487            if self._additional_params.contains_key(field) {
25488                dlg.finished(false);
25489                return Err(common::Error::FieldClash(field));
25490            }
25491        }
25492
25493        let mut params = Params::with_capacity(4 + self._additional_params.len());
25494        params.push("advertiserId", self._advertiser_id.to_string());
25495        params.push("lineItemId", self._line_item_id.to_string());
25496
25497        params.extend(self._additional_params.iter());
25498
25499        params.push("alt", "json");
25500        let mut url =
25501            self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/lineItems/{+lineItemId}";
25502        if self._scopes.is_empty() {
25503            self._scopes
25504                .insert(Scope::DisplayVideo.as_ref().to_string());
25505        }
25506
25507        #[allow(clippy::single_element_loop)]
25508        for &(find_this, param_name) in [
25509            ("{+advertiserId}", "advertiserId"),
25510            ("{+lineItemId}", "lineItemId"),
25511        ]
25512        .iter()
25513        {
25514            url = params.uri_replacement(url, param_name, find_this, true);
25515        }
25516        {
25517            let to_remove = ["lineItemId", "advertiserId"];
25518            params.remove_params(&to_remove);
25519        }
25520
25521        let url = params.parse_with_url(&url);
25522
25523        loop {
25524            let token = match self
25525                .hub
25526                .auth
25527                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25528                .await
25529            {
25530                Ok(token) => token,
25531                Err(e) => match dlg.token(e) {
25532                    Ok(token) => token,
25533                    Err(e) => {
25534                        dlg.finished(false);
25535                        return Err(common::Error::MissingToken(e));
25536                    }
25537                },
25538            };
25539            let mut req_result = {
25540                let client = &self.hub.client;
25541                dlg.pre_request();
25542                let mut req_builder = hyper::Request::builder()
25543                    .method(hyper::Method::DELETE)
25544                    .uri(url.as_str())
25545                    .header(USER_AGENT, self.hub._user_agent.clone());
25546
25547                if let Some(token) = token.as_ref() {
25548                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25549                }
25550
25551                let request = req_builder
25552                    .header(CONTENT_LENGTH, 0_u64)
25553                    .body(common::to_body::<String>(None));
25554
25555                client.request(request.unwrap()).await
25556            };
25557
25558            match req_result {
25559                Err(err) => {
25560                    if let common::Retry::After(d) = dlg.http_error(&err) {
25561                        sleep(d).await;
25562                        continue;
25563                    }
25564                    dlg.finished(false);
25565                    return Err(common::Error::HttpError(err));
25566                }
25567                Ok(res) => {
25568                    let (mut parts, body) = res.into_parts();
25569                    let mut body = common::Body::new(body);
25570                    if !parts.status.is_success() {
25571                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25572                        let error = serde_json::from_str(&common::to_string(&bytes));
25573                        let response = common::to_response(parts, bytes.into());
25574
25575                        if let common::Retry::After(d) =
25576                            dlg.http_failure(&response, error.as_ref().ok())
25577                        {
25578                            sleep(d).await;
25579                            continue;
25580                        }
25581
25582                        dlg.finished(false);
25583
25584                        return Err(match error {
25585                            Ok(value) => common::Error::BadRequest(value),
25586                            _ => common::Error::Failure(response),
25587                        });
25588                    }
25589                    let response = {
25590                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25591                        let encoded = common::to_string(&bytes);
25592                        match serde_json::from_str(&encoded) {
25593                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25594                            Err(error) => {
25595                                dlg.response_json_decode_error(&encoded, &error);
25596                                return Err(common::Error::JsonDecodeError(
25597                                    encoded.to_string(),
25598                                    error,
25599                                ));
25600                            }
25601                        }
25602                    };
25603
25604                    dlg.finished(true);
25605                    return Ok(response);
25606                }
25607            }
25608        }
25609    }
25610
25611    /// The ID of the advertiser this line item belongs to.
25612    ///
25613    /// Sets the *advertiser id* path property to the given value.
25614    ///
25615    /// Even though the property as already been set when instantiating this call,
25616    /// we provide this method for API completeness.
25617    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserLineItemDeleteCall<'a, C> {
25618        self._advertiser_id = new_value;
25619        self
25620    }
25621    /// The ID of the line item to delete.
25622    ///
25623    /// Sets the *line item id* path property to the given value.
25624    ///
25625    /// Even though the property as already been set when instantiating this call,
25626    /// we provide this method for API completeness.
25627    pub fn line_item_id(mut self, new_value: i64) -> AdvertiserLineItemDeleteCall<'a, C> {
25628        self._line_item_id = new_value;
25629        self
25630    }
25631    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25632    /// while executing the actual API request.
25633    ///
25634    /// ````text
25635    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25636    /// ````
25637    ///
25638    /// Sets the *delegate* property to the given value.
25639    pub fn delegate(
25640        mut self,
25641        new_value: &'a mut dyn common::Delegate,
25642    ) -> AdvertiserLineItemDeleteCall<'a, C> {
25643        self._delegate = Some(new_value);
25644        self
25645    }
25646
25647    /// Set any additional parameter of the query string used in the request.
25648    /// It should be used to set parameters which are not yet available through their own
25649    /// setters.
25650    ///
25651    /// Please note that this method must not be used to set any of the known parameters
25652    /// which have their own setter method. If done anyway, the request will fail.
25653    ///
25654    /// # Additional Parameters
25655    ///
25656    /// * *$.xgafv* (query-string) - V1 error format.
25657    /// * *access_token* (query-string) - OAuth access token.
25658    /// * *alt* (query-string) - Data format for response.
25659    /// * *callback* (query-string) - JSONP
25660    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25661    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25662    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25663    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25664    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25665    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25666    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25667    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserLineItemDeleteCall<'a, C>
25668    where
25669        T: AsRef<str>,
25670    {
25671        self._additional_params
25672            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25673        self
25674    }
25675
25676    /// Identifies the authorization scope for the method you are building.
25677    ///
25678    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25679    /// [`Scope::DisplayVideo`].
25680    ///
25681    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25682    /// tokens for more than one scope.
25683    ///
25684    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25685    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25686    /// sufficient, a read-write scope will do as well.
25687    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserLineItemDeleteCall<'a, C>
25688    where
25689        St: AsRef<str>,
25690    {
25691        self._scopes.insert(String::from(scope.as_ref()));
25692        self
25693    }
25694    /// Identifies the authorization scope(s) for the method you are building.
25695    ///
25696    /// See [`Self::add_scope()`] for details.
25697    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserLineItemDeleteCall<'a, C>
25698    where
25699        I: IntoIterator<Item = St>,
25700        St: AsRef<str>,
25701    {
25702        self._scopes
25703            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25704        self
25705    }
25706
25707    /// Removes all scopes, and no default scope will be used either.
25708    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25709    /// for details).
25710    pub fn clear_scopes(mut self) -> AdvertiserLineItemDeleteCall<'a, C> {
25711        self._scopes.clear();
25712        self
25713    }
25714}
25715
25716/// Creates a new line item with settings (including targeting) inherited from the insertion order and an `ENTITY_STATUS_DRAFT` entity_status. Returns the newly created line item if successful. There are default values based on the three fields: * The insertion order's insertion_order_type * The insertion order's automation_type * The given line_item_type YouTube & Partners line items cannot be created or updated using the API.
25717///
25718/// A builder for the *lineItems.generateDefault* method supported by a *advertiser* resource.
25719/// It is not used directly, but through a [`AdvertiserMethods`] instance.
25720///
25721/// # Example
25722///
25723/// Instantiate a resource method builder
25724///
25725/// ```test_harness,no_run
25726/// # extern crate hyper;
25727/// # extern crate hyper_rustls;
25728/// # extern crate google_displayvideo1 as displayvideo1;
25729/// use displayvideo1::api::GenerateDefaultLineItemRequest;
25730/// # async fn dox() {
25731/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25732///
25733/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25734/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25735/// #     secret,
25736/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25737/// # ).build().await.unwrap();
25738///
25739/// # let client = hyper_util::client::legacy::Client::builder(
25740/// #     hyper_util::rt::TokioExecutor::new()
25741/// # )
25742/// # .build(
25743/// #     hyper_rustls::HttpsConnectorBuilder::new()
25744/// #         .with_native_roots()
25745/// #         .unwrap()
25746/// #         .https_or_http()
25747/// #         .enable_http1()
25748/// #         .build()
25749/// # );
25750/// # let mut hub = DisplayVideo::new(client, auth);
25751/// // As the method needs a request, you would usually fill it with the desired information
25752/// // into the respective structure. Some of the parts shown here might not be applicable !
25753/// // Values shown here are possibly random and not representative !
25754/// let mut req = GenerateDefaultLineItemRequest::default();
25755///
25756/// // You can configure optional parameters by calling the respective setters at will, and
25757/// // execute the final call using `doit()`.
25758/// // Values shown here are possibly random and not representative !
25759/// let result = hub.advertisers().line_items_generate_default(req, -47)
25760///              .doit().await;
25761/// # }
25762/// ```
25763pub struct AdvertiserLineItemGenerateDefaultCall<'a, C>
25764where
25765    C: 'a,
25766{
25767    hub: &'a DisplayVideo<C>,
25768    _request: GenerateDefaultLineItemRequest,
25769    _advertiser_id: i64,
25770    _delegate: Option<&'a mut dyn common::Delegate>,
25771    _additional_params: HashMap<String, String>,
25772    _scopes: BTreeSet<String>,
25773}
25774
25775impl<'a, C> common::CallBuilder for AdvertiserLineItemGenerateDefaultCall<'a, C> {}
25776
25777impl<'a, C> AdvertiserLineItemGenerateDefaultCall<'a, C>
25778where
25779    C: common::Connector,
25780{
25781    /// Perform the operation you have build so far.
25782    pub async fn doit(mut self) -> common::Result<(common::Response, LineItem)> {
25783        use std::borrow::Cow;
25784        use std::io::{Read, Seek};
25785
25786        use common::{url::Params, ToParts};
25787        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25788
25789        let mut dd = common::DefaultDelegate;
25790        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25791        dlg.begin(common::MethodInfo {
25792            id: "displayvideo.advertisers.lineItems.generateDefault",
25793            http_method: hyper::Method::POST,
25794        });
25795
25796        for &field in ["alt", "advertiserId"].iter() {
25797            if self._additional_params.contains_key(field) {
25798                dlg.finished(false);
25799                return Err(common::Error::FieldClash(field));
25800            }
25801        }
25802
25803        let mut params = Params::with_capacity(4 + self._additional_params.len());
25804        params.push("advertiserId", self._advertiser_id.to_string());
25805
25806        params.extend(self._additional_params.iter());
25807
25808        params.push("alt", "json");
25809        let mut url =
25810            self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/lineItems:generateDefault";
25811        if self._scopes.is_empty() {
25812            self._scopes
25813                .insert(Scope::DisplayVideo.as_ref().to_string());
25814        }
25815
25816        #[allow(clippy::single_element_loop)]
25817        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
25818            url = params.uri_replacement(url, param_name, find_this, true);
25819        }
25820        {
25821            let to_remove = ["advertiserId"];
25822            params.remove_params(&to_remove);
25823        }
25824
25825        let url = params.parse_with_url(&url);
25826
25827        let mut json_mime_type = mime::APPLICATION_JSON;
25828        let mut request_value_reader = {
25829            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25830            common::remove_json_null_values(&mut value);
25831            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25832            serde_json::to_writer(&mut dst, &value).unwrap();
25833            dst
25834        };
25835        let request_size = request_value_reader
25836            .seek(std::io::SeekFrom::End(0))
25837            .unwrap();
25838        request_value_reader
25839            .seek(std::io::SeekFrom::Start(0))
25840            .unwrap();
25841
25842        loop {
25843            let token = match self
25844                .hub
25845                .auth
25846                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25847                .await
25848            {
25849                Ok(token) => token,
25850                Err(e) => match dlg.token(e) {
25851                    Ok(token) => token,
25852                    Err(e) => {
25853                        dlg.finished(false);
25854                        return Err(common::Error::MissingToken(e));
25855                    }
25856                },
25857            };
25858            request_value_reader
25859                .seek(std::io::SeekFrom::Start(0))
25860                .unwrap();
25861            let mut req_result = {
25862                let client = &self.hub.client;
25863                dlg.pre_request();
25864                let mut req_builder = hyper::Request::builder()
25865                    .method(hyper::Method::POST)
25866                    .uri(url.as_str())
25867                    .header(USER_AGENT, self.hub._user_agent.clone());
25868
25869                if let Some(token) = token.as_ref() {
25870                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25871                }
25872
25873                let request = req_builder
25874                    .header(CONTENT_TYPE, json_mime_type.to_string())
25875                    .header(CONTENT_LENGTH, request_size as u64)
25876                    .body(common::to_body(
25877                        request_value_reader.get_ref().clone().into(),
25878                    ));
25879
25880                client.request(request.unwrap()).await
25881            };
25882
25883            match req_result {
25884                Err(err) => {
25885                    if let common::Retry::After(d) = dlg.http_error(&err) {
25886                        sleep(d).await;
25887                        continue;
25888                    }
25889                    dlg.finished(false);
25890                    return Err(common::Error::HttpError(err));
25891                }
25892                Ok(res) => {
25893                    let (mut parts, body) = res.into_parts();
25894                    let mut body = common::Body::new(body);
25895                    if !parts.status.is_success() {
25896                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25897                        let error = serde_json::from_str(&common::to_string(&bytes));
25898                        let response = common::to_response(parts, bytes.into());
25899
25900                        if let common::Retry::After(d) =
25901                            dlg.http_failure(&response, error.as_ref().ok())
25902                        {
25903                            sleep(d).await;
25904                            continue;
25905                        }
25906
25907                        dlg.finished(false);
25908
25909                        return Err(match error {
25910                            Ok(value) => common::Error::BadRequest(value),
25911                            _ => common::Error::Failure(response),
25912                        });
25913                    }
25914                    let response = {
25915                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25916                        let encoded = common::to_string(&bytes);
25917                        match serde_json::from_str(&encoded) {
25918                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25919                            Err(error) => {
25920                                dlg.response_json_decode_error(&encoded, &error);
25921                                return Err(common::Error::JsonDecodeError(
25922                                    encoded.to_string(),
25923                                    error,
25924                                ));
25925                            }
25926                        }
25927                    };
25928
25929                    dlg.finished(true);
25930                    return Ok(response);
25931                }
25932            }
25933        }
25934    }
25935
25936    ///
25937    /// Sets the *request* property to the given value.
25938    ///
25939    /// Even though the property as already been set when instantiating this call,
25940    /// we provide this method for API completeness.
25941    pub fn request(
25942        mut self,
25943        new_value: GenerateDefaultLineItemRequest,
25944    ) -> AdvertiserLineItemGenerateDefaultCall<'a, C> {
25945        self._request = new_value;
25946        self
25947    }
25948    /// Required. The ID of the advertiser this line item belongs to.
25949    ///
25950    /// Sets the *advertiser id* path property to the given value.
25951    ///
25952    /// Even though the property as already been set when instantiating this call,
25953    /// we provide this method for API completeness.
25954    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserLineItemGenerateDefaultCall<'a, C> {
25955        self._advertiser_id = new_value;
25956        self
25957    }
25958    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25959    /// while executing the actual API request.
25960    ///
25961    /// ````text
25962    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25963    /// ````
25964    ///
25965    /// Sets the *delegate* property to the given value.
25966    pub fn delegate(
25967        mut self,
25968        new_value: &'a mut dyn common::Delegate,
25969    ) -> AdvertiserLineItemGenerateDefaultCall<'a, C> {
25970        self._delegate = Some(new_value);
25971        self
25972    }
25973
25974    /// Set any additional parameter of the query string used in the request.
25975    /// It should be used to set parameters which are not yet available through their own
25976    /// setters.
25977    ///
25978    /// Please note that this method must not be used to set any of the known parameters
25979    /// which have their own setter method. If done anyway, the request will fail.
25980    ///
25981    /// # Additional Parameters
25982    ///
25983    /// * *$.xgafv* (query-string) - V1 error format.
25984    /// * *access_token* (query-string) - OAuth access token.
25985    /// * *alt* (query-string) - Data format for response.
25986    /// * *callback* (query-string) - JSONP
25987    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25988    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25989    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25990    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25991    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25992    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25993    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25994    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserLineItemGenerateDefaultCall<'a, C>
25995    where
25996        T: AsRef<str>,
25997    {
25998        self._additional_params
25999            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26000        self
26001    }
26002
26003    /// Identifies the authorization scope for the method you are building.
26004    ///
26005    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26006    /// [`Scope::DisplayVideo`].
26007    ///
26008    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26009    /// tokens for more than one scope.
26010    ///
26011    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26012    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26013    /// sufficient, a read-write scope will do as well.
26014    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserLineItemGenerateDefaultCall<'a, C>
26015    where
26016        St: AsRef<str>,
26017    {
26018        self._scopes.insert(String::from(scope.as_ref()));
26019        self
26020    }
26021    /// Identifies the authorization scope(s) for the method you are building.
26022    ///
26023    /// See [`Self::add_scope()`] for details.
26024    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserLineItemGenerateDefaultCall<'a, C>
26025    where
26026        I: IntoIterator<Item = St>,
26027        St: AsRef<str>,
26028    {
26029        self._scopes
26030            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26031        self
26032    }
26033
26034    /// Removes all scopes, and no default scope will be used either.
26035    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26036    /// for details).
26037    pub fn clear_scopes(mut self) -> AdvertiserLineItemGenerateDefaultCall<'a, C> {
26038        self._scopes.clear();
26039        self
26040    }
26041}
26042
26043/// Gets a line item.
26044///
26045/// A builder for the *lineItems.get* method supported by a *advertiser* resource.
26046/// It is not used directly, but through a [`AdvertiserMethods`] instance.
26047///
26048/// # Example
26049///
26050/// Instantiate a resource method builder
26051///
26052/// ```test_harness,no_run
26053/// # extern crate hyper;
26054/// # extern crate hyper_rustls;
26055/// # extern crate google_displayvideo1 as displayvideo1;
26056/// # async fn dox() {
26057/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26058///
26059/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26060/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26061/// #     secret,
26062/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26063/// # ).build().await.unwrap();
26064///
26065/// # let client = hyper_util::client::legacy::Client::builder(
26066/// #     hyper_util::rt::TokioExecutor::new()
26067/// # )
26068/// # .build(
26069/// #     hyper_rustls::HttpsConnectorBuilder::new()
26070/// #         .with_native_roots()
26071/// #         .unwrap()
26072/// #         .https_or_http()
26073/// #         .enable_http1()
26074/// #         .build()
26075/// # );
26076/// # let mut hub = DisplayVideo::new(client, auth);
26077/// // You can configure optional parameters by calling the respective setters at will, and
26078/// // execute the final call using `doit()`.
26079/// // Values shown here are possibly random and not representative !
26080/// let result = hub.advertisers().line_items_get(-31, -69)
26081///              .doit().await;
26082/// # }
26083/// ```
26084pub struct AdvertiserLineItemGetCall<'a, C>
26085where
26086    C: 'a,
26087{
26088    hub: &'a DisplayVideo<C>,
26089    _advertiser_id: i64,
26090    _line_item_id: i64,
26091    _delegate: Option<&'a mut dyn common::Delegate>,
26092    _additional_params: HashMap<String, String>,
26093    _scopes: BTreeSet<String>,
26094}
26095
26096impl<'a, C> common::CallBuilder for AdvertiserLineItemGetCall<'a, C> {}
26097
26098impl<'a, C> AdvertiserLineItemGetCall<'a, C>
26099where
26100    C: common::Connector,
26101{
26102    /// Perform the operation you have build so far.
26103    pub async fn doit(mut self) -> common::Result<(common::Response, LineItem)> {
26104        use std::borrow::Cow;
26105        use std::io::{Read, Seek};
26106
26107        use common::{url::Params, ToParts};
26108        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26109
26110        let mut dd = common::DefaultDelegate;
26111        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26112        dlg.begin(common::MethodInfo {
26113            id: "displayvideo.advertisers.lineItems.get",
26114            http_method: hyper::Method::GET,
26115        });
26116
26117        for &field in ["alt", "advertiserId", "lineItemId"].iter() {
26118            if self._additional_params.contains_key(field) {
26119                dlg.finished(false);
26120                return Err(common::Error::FieldClash(field));
26121            }
26122        }
26123
26124        let mut params = Params::with_capacity(4 + self._additional_params.len());
26125        params.push("advertiserId", self._advertiser_id.to_string());
26126        params.push("lineItemId", self._line_item_id.to_string());
26127
26128        params.extend(self._additional_params.iter());
26129
26130        params.push("alt", "json");
26131        let mut url =
26132            self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/lineItems/{+lineItemId}";
26133        if self._scopes.is_empty() {
26134            self._scopes
26135                .insert(Scope::DisplayVideo.as_ref().to_string());
26136        }
26137
26138        #[allow(clippy::single_element_loop)]
26139        for &(find_this, param_name) in [
26140            ("{+advertiserId}", "advertiserId"),
26141            ("{+lineItemId}", "lineItemId"),
26142        ]
26143        .iter()
26144        {
26145            url = params.uri_replacement(url, param_name, find_this, true);
26146        }
26147        {
26148            let to_remove = ["lineItemId", "advertiserId"];
26149            params.remove_params(&to_remove);
26150        }
26151
26152        let url = params.parse_with_url(&url);
26153
26154        loop {
26155            let token = match self
26156                .hub
26157                .auth
26158                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26159                .await
26160            {
26161                Ok(token) => token,
26162                Err(e) => match dlg.token(e) {
26163                    Ok(token) => token,
26164                    Err(e) => {
26165                        dlg.finished(false);
26166                        return Err(common::Error::MissingToken(e));
26167                    }
26168                },
26169            };
26170            let mut req_result = {
26171                let client = &self.hub.client;
26172                dlg.pre_request();
26173                let mut req_builder = hyper::Request::builder()
26174                    .method(hyper::Method::GET)
26175                    .uri(url.as_str())
26176                    .header(USER_AGENT, self.hub._user_agent.clone());
26177
26178                if let Some(token) = token.as_ref() {
26179                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26180                }
26181
26182                let request = req_builder
26183                    .header(CONTENT_LENGTH, 0_u64)
26184                    .body(common::to_body::<String>(None));
26185
26186                client.request(request.unwrap()).await
26187            };
26188
26189            match req_result {
26190                Err(err) => {
26191                    if let common::Retry::After(d) = dlg.http_error(&err) {
26192                        sleep(d).await;
26193                        continue;
26194                    }
26195                    dlg.finished(false);
26196                    return Err(common::Error::HttpError(err));
26197                }
26198                Ok(res) => {
26199                    let (mut parts, body) = res.into_parts();
26200                    let mut body = common::Body::new(body);
26201                    if !parts.status.is_success() {
26202                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26203                        let error = serde_json::from_str(&common::to_string(&bytes));
26204                        let response = common::to_response(parts, bytes.into());
26205
26206                        if let common::Retry::After(d) =
26207                            dlg.http_failure(&response, error.as_ref().ok())
26208                        {
26209                            sleep(d).await;
26210                            continue;
26211                        }
26212
26213                        dlg.finished(false);
26214
26215                        return Err(match error {
26216                            Ok(value) => common::Error::BadRequest(value),
26217                            _ => common::Error::Failure(response),
26218                        });
26219                    }
26220                    let response = {
26221                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26222                        let encoded = common::to_string(&bytes);
26223                        match serde_json::from_str(&encoded) {
26224                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26225                            Err(error) => {
26226                                dlg.response_json_decode_error(&encoded, &error);
26227                                return Err(common::Error::JsonDecodeError(
26228                                    encoded.to_string(),
26229                                    error,
26230                                ));
26231                            }
26232                        }
26233                    };
26234
26235                    dlg.finished(true);
26236                    return Ok(response);
26237                }
26238            }
26239        }
26240    }
26241
26242    /// Required. The ID of the advertiser this line item belongs to.
26243    ///
26244    /// Sets the *advertiser id* path property to the given value.
26245    ///
26246    /// Even though the property as already been set when instantiating this call,
26247    /// we provide this method for API completeness.
26248    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserLineItemGetCall<'a, C> {
26249        self._advertiser_id = new_value;
26250        self
26251    }
26252    /// Required. The ID of the line item to fetch.
26253    ///
26254    /// Sets the *line item id* path property to the given value.
26255    ///
26256    /// Even though the property as already been set when instantiating this call,
26257    /// we provide this method for API completeness.
26258    pub fn line_item_id(mut self, new_value: i64) -> AdvertiserLineItemGetCall<'a, C> {
26259        self._line_item_id = new_value;
26260        self
26261    }
26262    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26263    /// while executing the actual API request.
26264    ///
26265    /// ````text
26266    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26267    /// ````
26268    ///
26269    /// Sets the *delegate* property to the given value.
26270    pub fn delegate(
26271        mut self,
26272        new_value: &'a mut dyn common::Delegate,
26273    ) -> AdvertiserLineItemGetCall<'a, C> {
26274        self._delegate = Some(new_value);
26275        self
26276    }
26277
26278    /// Set any additional parameter of the query string used in the request.
26279    /// It should be used to set parameters which are not yet available through their own
26280    /// setters.
26281    ///
26282    /// Please note that this method must not be used to set any of the known parameters
26283    /// which have their own setter method. If done anyway, the request will fail.
26284    ///
26285    /// # Additional Parameters
26286    ///
26287    /// * *$.xgafv* (query-string) - V1 error format.
26288    /// * *access_token* (query-string) - OAuth access token.
26289    /// * *alt* (query-string) - Data format for response.
26290    /// * *callback* (query-string) - JSONP
26291    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26292    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26293    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26294    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26295    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26296    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26297    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26298    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserLineItemGetCall<'a, C>
26299    where
26300        T: AsRef<str>,
26301    {
26302        self._additional_params
26303            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26304        self
26305    }
26306
26307    /// Identifies the authorization scope for the method you are building.
26308    ///
26309    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26310    /// [`Scope::DisplayVideo`].
26311    ///
26312    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26313    /// tokens for more than one scope.
26314    ///
26315    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26316    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26317    /// sufficient, a read-write scope will do as well.
26318    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserLineItemGetCall<'a, C>
26319    where
26320        St: AsRef<str>,
26321    {
26322        self._scopes.insert(String::from(scope.as_ref()));
26323        self
26324    }
26325    /// Identifies the authorization scope(s) for the method you are building.
26326    ///
26327    /// See [`Self::add_scope()`] for details.
26328    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserLineItemGetCall<'a, C>
26329    where
26330        I: IntoIterator<Item = St>,
26331        St: AsRef<str>,
26332    {
26333        self._scopes
26334            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26335        self
26336    }
26337
26338    /// Removes all scopes, and no default scope will be used either.
26339    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26340    /// for details).
26341    pub fn clear_scopes(mut self) -> AdvertiserLineItemGetCall<'a, C> {
26342        self._scopes.clear();
26343        self
26344    }
26345}
26346
26347/// Lists line items in an advertiser. The order is defined by the order_by parameter. If a filter by entity_status is not specified, line items with `ENTITY_STATUS_ARCHIVED` will not be included in the results.
26348///
26349/// A builder for the *lineItems.list* method supported by a *advertiser* resource.
26350/// It is not used directly, but through a [`AdvertiserMethods`] instance.
26351///
26352/// # Example
26353///
26354/// Instantiate a resource method builder
26355///
26356/// ```test_harness,no_run
26357/// # extern crate hyper;
26358/// # extern crate hyper_rustls;
26359/// # extern crate google_displayvideo1 as displayvideo1;
26360/// # async fn dox() {
26361/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26362///
26363/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26364/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26365/// #     secret,
26366/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26367/// # ).build().await.unwrap();
26368///
26369/// # let client = hyper_util::client::legacy::Client::builder(
26370/// #     hyper_util::rt::TokioExecutor::new()
26371/// # )
26372/// # .build(
26373/// #     hyper_rustls::HttpsConnectorBuilder::new()
26374/// #         .with_native_roots()
26375/// #         .unwrap()
26376/// #         .https_or_http()
26377/// #         .enable_http1()
26378/// #         .build()
26379/// # );
26380/// # let mut hub = DisplayVideo::new(client, auth);
26381/// // You can configure optional parameters by calling the respective setters at will, and
26382/// // execute the final call using `doit()`.
26383/// // Values shown here are possibly random and not representative !
26384/// let result = hub.advertisers().line_items_list(-81)
26385///              .page_token("accusam")
26386///              .page_size(-10)
26387///              .order_by("takimata")
26388///              .filter("Lorem")
26389///              .doit().await;
26390/// # }
26391/// ```
26392pub struct AdvertiserLineItemListCall<'a, C>
26393where
26394    C: 'a,
26395{
26396    hub: &'a DisplayVideo<C>,
26397    _advertiser_id: i64,
26398    _page_token: Option<String>,
26399    _page_size: Option<i32>,
26400    _order_by: Option<String>,
26401    _filter: Option<String>,
26402    _delegate: Option<&'a mut dyn common::Delegate>,
26403    _additional_params: HashMap<String, String>,
26404    _scopes: BTreeSet<String>,
26405}
26406
26407impl<'a, C> common::CallBuilder for AdvertiserLineItemListCall<'a, C> {}
26408
26409impl<'a, C> AdvertiserLineItemListCall<'a, C>
26410where
26411    C: common::Connector,
26412{
26413    /// Perform the operation you have build so far.
26414    pub async fn doit(mut self) -> common::Result<(common::Response, ListLineItemsResponse)> {
26415        use std::borrow::Cow;
26416        use std::io::{Read, Seek};
26417
26418        use common::{url::Params, ToParts};
26419        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26420
26421        let mut dd = common::DefaultDelegate;
26422        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26423        dlg.begin(common::MethodInfo {
26424            id: "displayvideo.advertisers.lineItems.list",
26425            http_method: hyper::Method::GET,
26426        });
26427
26428        for &field in [
26429            "alt",
26430            "advertiserId",
26431            "pageToken",
26432            "pageSize",
26433            "orderBy",
26434            "filter",
26435        ]
26436        .iter()
26437        {
26438            if self._additional_params.contains_key(field) {
26439                dlg.finished(false);
26440                return Err(common::Error::FieldClash(field));
26441            }
26442        }
26443
26444        let mut params = Params::with_capacity(7 + self._additional_params.len());
26445        params.push("advertiserId", self._advertiser_id.to_string());
26446        if let Some(value) = self._page_token.as_ref() {
26447            params.push("pageToken", value);
26448        }
26449        if let Some(value) = self._page_size.as_ref() {
26450            params.push("pageSize", value.to_string());
26451        }
26452        if let Some(value) = self._order_by.as_ref() {
26453            params.push("orderBy", value);
26454        }
26455        if let Some(value) = self._filter.as_ref() {
26456            params.push("filter", value);
26457        }
26458
26459        params.extend(self._additional_params.iter());
26460
26461        params.push("alt", "json");
26462        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/lineItems";
26463        if self._scopes.is_empty() {
26464            self._scopes
26465                .insert(Scope::DisplayVideo.as_ref().to_string());
26466        }
26467
26468        #[allow(clippy::single_element_loop)]
26469        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
26470            url = params.uri_replacement(url, param_name, find_this, true);
26471        }
26472        {
26473            let to_remove = ["advertiserId"];
26474            params.remove_params(&to_remove);
26475        }
26476
26477        let url = params.parse_with_url(&url);
26478
26479        loop {
26480            let token = match self
26481                .hub
26482                .auth
26483                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26484                .await
26485            {
26486                Ok(token) => token,
26487                Err(e) => match dlg.token(e) {
26488                    Ok(token) => token,
26489                    Err(e) => {
26490                        dlg.finished(false);
26491                        return Err(common::Error::MissingToken(e));
26492                    }
26493                },
26494            };
26495            let mut req_result = {
26496                let client = &self.hub.client;
26497                dlg.pre_request();
26498                let mut req_builder = hyper::Request::builder()
26499                    .method(hyper::Method::GET)
26500                    .uri(url.as_str())
26501                    .header(USER_AGENT, self.hub._user_agent.clone());
26502
26503                if let Some(token) = token.as_ref() {
26504                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26505                }
26506
26507                let request = req_builder
26508                    .header(CONTENT_LENGTH, 0_u64)
26509                    .body(common::to_body::<String>(None));
26510
26511                client.request(request.unwrap()).await
26512            };
26513
26514            match req_result {
26515                Err(err) => {
26516                    if let common::Retry::After(d) = dlg.http_error(&err) {
26517                        sleep(d).await;
26518                        continue;
26519                    }
26520                    dlg.finished(false);
26521                    return Err(common::Error::HttpError(err));
26522                }
26523                Ok(res) => {
26524                    let (mut parts, body) = res.into_parts();
26525                    let mut body = common::Body::new(body);
26526                    if !parts.status.is_success() {
26527                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26528                        let error = serde_json::from_str(&common::to_string(&bytes));
26529                        let response = common::to_response(parts, bytes.into());
26530
26531                        if let common::Retry::After(d) =
26532                            dlg.http_failure(&response, error.as_ref().ok())
26533                        {
26534                            sleep(d).await;
26535                            continue;
26536                        }
26537
26538                        dlg.finished(false);
26539
26540                        return Err(match error {
26541                            Ok(value) => common::Error::BadRequest(value),
26542                            _ => common::Error::Failure(response),
26543                        });
26544                    }
26545                    let response = {
26546                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26547                        let encoded = common::to_string(&bytes);
26548                        match serde_json::from_str(&encoded) {
26549                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26550                            Err(error) => {
26551                                dlg.response_json_decode_error(&encoded, &error);
26552                                return Err(common::Error::JsonDecodeError(
26553                                    encoded.to_string(),
26554                                    error,
26555                                ));
26556                            }
26557                        }
26558                    };
26559
26560                    dlg.finished(true);
26561                    return Ok(response);
26562                }
26563            }
26564        }
26565    }
26566
26567    /// Required. The ID of the advertiser to list line items for.
26568    ///
26569    /// Sets the *advertiser id* path property to the given value.
26570    ///
26571    /// Even though the property as already been set when instantiating this call,
26572    /// we provide this method for API completeness.
26573    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserLineItemListCall<'a, C> {
26574        self._advertiser_id = new_value;
26575        self
26576    }
26577    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListLineItems` method. If not specified, the first page of results will be returned.
26578    ///
26579    /// Sets the *page token* query property to the given value.
26580    pub fn page_token(mut self, new_value: &str) -> AdvertiserLineItemListCall<'a, C> {
26581        self._page_token = Some(new_value.to_string());
26582        self
26583    }
26584    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
26585    ///
26586    /// Sets the *page size* query property to the given value.
26587    pub fn page_size(mut self, new_value: i32) -> AdvertiserLineItemListCall<'a, C> {
26588        self._page_size = Some(new_value);
26589        self
26590    }
26591    /// Field by which to sort the list. Acceptable values are: * `displayName` (default) * `entityStatus` * `updateTime` The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `displayName desc`.
26592    ///
26593    /// Sets the *order by* query property to the given value.
26594    pub fn order_by(mut self, new_value: &str) -> AdvertiserLineItemListCall<'a, C> {
26595        self._order_by = Some(new_value.to_string());
26596        self
26597    }
26598    /// Allows filtering by line item fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by `AND` or `OR` logical operators. A sequence of restrictions implicitly uses `AND`. * A restriction has the form of `{field} {operator} {value}`. * The `updateTime` field must use the `GREATER THAN OR EQUAL TO (>=)` or `LESS THAN OR EQUAL TO (<=)` operators. * All other fields must use the `EQUALS (=)` operator. Supported fields: * `campaignId` * `displayName` * `entityStatus` * `insertionOrderId` * `lineItemId` * `lineItemType` * `updateTime` (input in ISO 8601 format, or `YYYY-MM-DDTHH:MM:SSZ`) Examples: * All line items under an insertion order: `insertionOrderId="1234"` * All `ENTITY_STATUS_ACTIVE` or `ENTITY_STATUS_PAUSED` and `LINE_ITEM_TYPE_DISPLAY_DEFAULT` line items under an advertiser: `(entityStatus="ENTITY_STATUS_ACTIVE" OR entityStatus="ENTITY_STATUS_PAUSED") AND lineItemType="LINE_ITEM_TYPE_DISPLAY_DEFAULT"` * All line items with an update time less than or equal to 2020-11-04T18:54:47Z (format of ISO 8601): `updateTime<="2020-11-04T18:54:47Z"` * All line items with an update time greater than or equal to 2020-11-04T18:54:47Z (format of ISO 8601): `updateTime>="2020-11-04T18:54:47Z"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
26599    ///
26600    /// Sets the *filter* query property to the given value.
26601    pub fn filter(mut self, new_value: &str) -> AdvertiserLineItemListCall<'a, C> {
26602        self._filter = Some(new_value.to_string());
26603        self
26604    }
26605    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26606    /// while executing the actual API request.
26607    ///
26608    /// ````text
26609    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26610    /// ````
26611    ///
26612    /// Sets the *delegate* property to the given value.
26613    pub fn delegate(
26614        mut self,
26615        new_value: &'a mut dyn common::Delegate,
26616    ) -> AdvertiserLineItemListCall<'a, C> {
26617        self._delegate = Some(new_value);
26618        self
26619    }
26620
26621    /// Set any additional parameter of the query string used in the request.
26622    /// It should be used to set parameters which are not yet available through their own
26623    /// setters.
26624    ///
26625    /// Please note that this method must not be used to set any of the known parameters
26626    /// which have their own setter method. If done anyway, the request will fail.
26627    ///
26628    /// # Additional Parameters
26629    ///
26630    /// * *$.xgafv* (query-string) - V1 error format.
26631    /// * *access_token* (query-string) - OAuth access token.
26632    /// * *alt* (query-string) - Data format for response.
26633    /// * *callback* (query-string) - JSONP
26634    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26635    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26636    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26637    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26638    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26639    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26640    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26641    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserLineItemListCall<'a, C>
26642    where
26643        T: AsRef<str>,
26644    {
26645        self._additional_params
26646            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26647        self
26648    }
26649
26650    /// Identifies the authorization scope for the method you are building.
26651    ///
26652    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26653    /// [`Scope::DisplayVideo`].
26654    ///
26655    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26656    /// tokens for more than one scope.
26657    ///
26658    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26659    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26660    /// sufficient, a read-write scope will do as well.
26661    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserLineItemListCall<'a, C>
26662    where
26663        St: AsRef<str>,
26664    {
26665        self._scopes.insert(String::from(scope.as_ref()));
26666        self
26667    }
26668    /// Identifies the authorization scope(s) for the method you are building.
26669    ///
26670    /// See [`Self::add_scope()`] for details.
26671    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserLineItemListCall<'a, C>
26672    where
26673        I: IntoIterator<Item = St>,
26674        St: AsRef<str>,
26675    {
26676        self._scopes
26677            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26678        self
26679    }
26680
26681    /// Removes all scopes, and no default scope will be used either.
26682    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26683    /// for details).
26684    pub fn clear_scopes(mut self) -> AdvertiserLineItemListCall<'a, C> {
26685        self._scopes.clear();
26686        self
26687    }
26688}
26689
26690/// Updates an existing line item. Returns the updated line item if successful. Requests to this endpoint cannot be made concurrently with the following requests updating the same line item: * BulkEditAssignedTargetingOptions * BulkUpdateLineItems * assignedTargetingOptions.create * assignedTargetingOptions.delete YouTube & Partners line items cannot be created or updated using the API. **This method regularly experiences high latency.** We recommend [increasing your default timeout](https://developers.google.com/display-video/api/guides/best-practices/timeouts#client_library_timeout) to avoid errors.
26691///
26692/// A builder for the *lineItems.patch* method supported by a *advertiser* resource.
26693/// It is not used directly, but through a [`AdvertiserMethods`] instance.
26694///
26695/// # Example
26696///
26697/// Instantiate a resource method builder
26698///
26699/// ```test_harness,no_run
26700/// # extern crate hyper;
26701/// # extern crate hyper_rustls;
26702/// # extern crate google_displayvideo1 as displayvideo1;
26703/// use displayvideo1::api::LineItem;
26704/// # async fn dox() {
26705/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26706///
26707/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26708/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26709/// #     secret,
26710/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26711/// # ).build().await.unwrap();
26712///
26713/// # let client = hyper_util::client::legacy::Client::builder(
26714/// #     hyper_util::rt::TokioExecutor::new()
26715/// # )
26716/// # .build(
26717/// #     hyper_rustls::HttpsConnectorBuilder::new()
26718/// #         .with_native_roots()
26719/// #         .unwrap()
26720/// #         .https_or_http()
26721/// #         .enable_http1()
26722/// #         .build()
26723/// # );
26724/// # let mut hub = DisplayVideo::new(client, auth);
26725/// // As the method needs a request, you would usually fill it with the desired information
26726/// // into the respective structure. Some of the parts shown here might not be applicable !
26727/// // Values shown here are possibly random and not representative !
26728/// let mut req = LineItem::default();
26729///
26730/// // You can configure optional parameters by calling the respective setters at will, and
26731/// // execute the final call using `doit()`.
26732/// // Values shown here are possibly random and not representative !
26733/// let result = hub.advertisers().line_items_patch(req, -22, -77)
26734///              .update_mask(FieldMask::new::<&str>(&[]))
26735///              .doit().await;
26736/// # }
26737/// ```
26738pub struct AdvertiserLineItemPatchCall<'a, C>
26739where
26740    C: 'a,
26741{
26742    hub: &'a DisplayVideo<C>,
26743    _request: LineItem,
26744    _advertiser_id: i64,
26745    _line_item_id: i64,
26746    _update_mask: Option<common::FieldMask>,
26747    _delegate: Option<&'a mut dyn common::Delegate>,
26748    _additional_params: HashMap<String, String>,
26749    _scopes: BTreeSet<String>,
26750}
26751
26752impl<'a, C> common::CallBuilder for AdvertiserLineItemPatchCall<'a, C> {}
26753
26754impl<'a, C> AdvertiserLineItemPatchCall<'a, C>
26755where
26756    C: common::Connector,
26757{
26758    /// Perform the operation you have build so far.
26759    pub async fn doit(mut self) -> common::Result<(common::Response, LineItem)> {
26760        use std::borrow::Cow;
26761        use std::io::{Read, Seek};
26762
26763        use common::{url::Params, ToParts};
26764        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26765
26766        let mut dd = common::DefaultDelegate;
26767        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26768        dlg.begin(common::MethodInfo {
26769            id: "displayvideo.advertisers.lineItems.patch",
26770            http_method: hyper::Method::PATCH,
26771        });
26772
26773        for &field in ["alt", "advertiserId", "lineItemId", "updateMask"].iter() {
26774            if self._additional_params.contains_key(field) {
26775                dlg.finished(false);
26776                return Err(common::Error::FieldClash(field));
26777            }
26778        }
26779
26780        let mut params = Params::with_capacity(6 + self._additional_params.len());
26781        params.push("advertiserId", self._advertiser_id.to_string());
26782        params.push("lineItemId", self._line_item_id.to_string());
26783        if let Some(value) = self._update_mask.as_ref() {
26784            params.push("updateMask", value.to_string());
26785        }
26786
26787        params.extend(self._additional_params.iter());
26788
26789        params.push("alt", "json");
26790        let mut url =
26791            self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/lineItems/{+lineItemId}";
26792        if self._scopes.is_empty() {
26793            self._scopes
26794                .insert(Scope::DisplayVideo.as_ref().to_string());
26795        }
26796
26797        #[allow(clippy::single_element_loop)]
26798        for &(find_this, param_name) in [
26799            ("{+advertiserId}", "advertiserId"),
26800            ("{+lineItemId}", "lineItemId"),
26801        ]
26802        .iter()
26803        {
26804            url = params.uri_replacement(url, param_name, find_this, true);
26805        }
26806        {
26807            let to_remove = ["lineItemId", "advertiserId"];
26808            params.remove_params(&to_remove);
26809        }
26810
26811        let url = params.parse_with_url(&url);
26812
26813        let mut json_mime_type = mime::APPLICATION_JSON;
26814        let mut request_value_reader = {
26815            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26816            common::remove_json_null_values(&mut value);
26817            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26818            serde_json::to_writer(&mut dst, &value).unwrap();
26819            dst
26820        };
26821        let request_size = request_value_reader
26822            .seek(std::io::SeekFrom::End(0))
26823            .unwrap();
26824        request_value_reader
26825            .seek(std::io::SeekFrom::Start(0))
26826            .unwrap();
26827
26828        loop {
26829            let token = match self
26830                .hub
26831                .auth
26832                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26833                .await
26834            {
26835                Ok(token) => token,
26836                Err(e) => match dlg.token(e) {
26837                    Ok(token) => token,
26838                    Err(e) => {
26839                        dlg.finished(false);
26840                        return Err(common::Error::MissingToken(e));
26841                    }
26842                },
26843            };
26844            request_value_reader
26845                .seek(std::io::SeekFrom::Start(0))
26846                .unwrap();
26847            let mut req_result = {
26848                let client = &self.hub.client;
26849                dlg.pre_request();
26850                let mut req_builder = hyper::Request::builder()
26851                    .method(hyper::Method::PATCH)
26852                    .uri(url.as_str())
26853                    .header(USER_AGENT, self.hub._user_agent.clone());
26854
26855                if let Some(token) = token.as_ref() {
26856                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26857                }
26858
26859                let request = req_builder
26860                    .header(CONTENT_TYPE, json_mime_type.to_string())
26861                    .header(CONTENT_LENGTH, request_size as u64)
26862                    .body(common::to_body(
26863                        request_value_reader.get_ref().clone().into(),
26864                    ));
26865
26866                client.request(request.unwrap()).await
26867            };
26868
26869            match req_result {
26870                Err(err) => {
26871                    if let common::Retry::After(d) = dlg.http_error(&err) {
26872                        sleep(d).await;
26873                        continue;
26874                    }
26875                    dlg.finished(false);
26876                    return Err(common::Error::HttpError(err));
26877                }
26878                Ok(res) => {
26879                    let (mut parts, body) = res.into_parts();
26880                    let mut body = common::Body::new(body);
26881                    if !parts.status.is_success() {
26882                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26883                        let error = serde_json::from_str(&common::to_string(&bytes));
26884                        let response = common::to_response(parts, bytes.into());
26885
26886                        if let common::Retry::After(d) =
26887                            dlg.http_failure(&response, error.as_ref().ok())
26888                        {
26889                            sleep(d).await;
26890                            continue;
26891                        }
26892
26893                        dlg.finished(false);
26894
26895                        return Err(match error {
26896                            Ok(value) => common::Error::BadRequest(value),
26897                            _ => common::Error::Failure(response),
26898                        });
26899                    }
26900                    let response = {
26901                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26902                        let encoded = common::to_string(&bytes);
26903                        match serde_json::from_str(&encoded) {
26904                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26905                            Err(error) => {
26906                                dlg.response_json_decode_error(&encoded, &error);
26907                                return Err(common::Error::JsonDecodeError(
26908                                    encoded.to_string(),
26909                                    error,
26910                                ));
26911                            }
26912                        }
26913                    };
26914
26915                    dlg.finished(true);
26916                    return Ok(response);
26917                }
26918            }
26919        }
26920    }
26921
26922    ///
26923    /// Sets the *request* property to the given value.
26924    ///
26925    /// Even though the property as already been set when instantiating this call,
26926    /// we provide this method for API completeness.
26927    pub fn request(mut self, new_value: LineItem) -> AdvertiserLineItemPatchCall<'a, C> {
26928        self._request = new_value;
26929        self
26930    }
26931    /// Output only. The unique ID of the advertiser the line item belongs to.
26932    ///
26933    /// Sets the *advertiser id* path property to the given value.
26934    ///
26935    /// Even though the property as already been set when instantiating this call,
26936    /// we provide this method for API completeness.
26937    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserLineItemPatchCall<'a, C> {
26938        self._advertiser_id = new_value;
26939        self
26940    }
26941    /// Output only. The unique ID of the line item. Assigned by the system.
26942    ///
26943    /// Sets the *line item id* path property to the given value.
26944    ///
26945    /// Even though the property as already been set when instantiating this call,
26946    /// we provide this method for API completeness.
26947    pub fn line_item_id(mut self, new_value: i64) -> AdvertiserLineItemPatchCall<'a, C> {
26948        self._line_item_id = new_value;
26949        self
26950    }
26951    /// Required. The mask to control which fields to update.
26952    ///
26953    /// Sets the *update mask* query property to the given value.
26954    pub fn update_mask(
26955        mut self,
26956        new_value: common::FieldMask,
26957    ) -> AdvertiserLineItemPatchCall<'a, C> {
26958        self._update_mask = Some(new_value);
26959        self
26960    }
26961    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26962    /// while executing the actual API request.
26963    ///
26964    /// ````text
26965    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26966    /// ````
26967    ///
26968    /// Sets the *delegate* property to the given value.
26969    pub fn delegate(
26970        mut self,
26971        new_value: &'a mut dyn common::Delegate,
26972    ) -> AdvertiserLineItemPatchCall<'a, C> {
26973        self._delegate = Some(new_value);
26974        self
26975    }
26976
26977    /// Set any additional parameter of the query string used in the request.
26978    /// It should be used to set parameters which are not yet available through their own
26979    /// setters.
26980    ///
26981    /// Please note that this method must not be used to set any of the known parameters
26982    /// which have their own setter method. If done anyway, the request will fail.
26983    ///
26984    /// # Additional Parameters
26985    ///
26986    /// * *$.xgafv* (query-string) - V1 error format.
26987    /// * *access_token* (query-string) - OAuth access token.
26988    /// * *alt* (query-string) - Data format for response.
26989    /// * *callback* (query-string) - JSONP
26990    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26991    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26992    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26993    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26994    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26995    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26996    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26997    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserLineItemPatchCall<'a, C>
26998    where
26999        T: AsRef<str>,
27000    {
27001        self._additional_params
27002            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27003        self
27004    }
27005
27006    /// Identifies the authorization scope for the method you are building.
27007    ///
27008    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27009    /// [`Scope::DisplayVideo`].
27010    ///
27011    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27012    /// tokens for more than one scope.
27013    ///
27014    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27015    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27016    /// sufficient, a read-write scope will do as well.
27017    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserLineItemPatchCall<'a, C>
27018    where
27019        St: AsRef<str>,
27020    {
27021        self._scopes.insert(String::from(scope.as_ref()));
27022        self
27023    }
27024    /// Identifies the authorization scope(s) for the method you are building.
27025    ///
27026    /// See [`Self::add_scope()`] for details.
27027    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserLineItemPatchCall<'a, C>
27028    where
27029        I: IntoIterator<Item = St>,
27030        St: AsRef<str>,
27031    {
27032        self._scopes
27033            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27034        self
27035    }
27036
27037    /// Removes all scopes, and no default scope will be used either.
27038    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27039    /// for details).
27040    pub fn clear_scopes(mut self) -> AdvertiserLineItemPatchCall<'a, C> {
27041        self._scopes.clear();
27042        self
27043    }
27044}
27045
27046/// Bulk edits multiple assignments between locations and a single location list. The operation will delete the assigned locations provided in deletedAssignedLocations and then create the assigned locations provided in createdAssignedLocations.
27047///
27048/// A builder for the *locationLists.assignedLocations.bulkEdit* method supported by a *advertiser* resource.
27049/// It is not used directly, but through a [`AdvertiserMethods`] instance.
27050///
27051/// # Example
27052///
27053/// Instantiate a resource method builder
27054///
27055/// ```test_harness,no_run
27056/// # extern crate hyper;
27057/// # extern crate hyper_rustls;
27058/// # extern crate google_displayvideo1 as displayvideo1;
27059/// use displayvideo1::api::BulkEditAssignedLocationsRequest;
27060/// # async fn dox() {
27061/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27062///
27063/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27064/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27065/// #     secret,
27066/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27067/// # ).build().await.unwrap();
27068///
27069/// # let client = hyper_util::client::legacy::Client::builder(
27070/// #     hyper_util::rt::TokioExecutor::new()
27071/// # )
27072/// # .build(
27073/// #     hyper_rustls::HttpsConnectorBuilder::new()
27074/// #         .with_native_roots()
27075/// #         .unwrap()
27076/// #         .https_or_http()
27077/// #         .enable_http1()
27078/// #         .build()
27079/// # );
27080/// # let mut hub = DisplayVideo::new(client, auth);
27081/// // As the method needs a request, you would usually fill it with the desired information
27082/// // into the respective structure. Some of the parts shown here might not be applicable !
27083/// // Values shown here are possibly random and not representative !
27084/// let mut req = BulkEditAssignedLocationsRequest::default();
27085///
27086/// // You can configure optional parameters by calling the respective setters at will, and
27087/// // execute the final call using `doit()`.
27088/// // Values shown here are possibly random and not representative !
27089/// let result = hub.advertisers().location_lists_assigned_locations_bulk_edit(req, -4, -22)
27090///              .doit().await;
27091/// # }
27092/// ```
27093pub struct AdvertiserLocationListAssignedLocationBulkEditCall<'a, C>
27094where
27095    C: 'a,
27096{
27097    hub: &'a DisplayVideo<C>,
27098    _request: BulkEditAssignedLocationsRequest,
27099    _advertiser_id: i64,
27100    _location_list_id: i64,
27101    _delegate: Option<&'a mut dyn common::Delegate>,
27102    _additional_params: HashMap<String, String>,
27103    _scopes: BTreeSet<String>,
27104}
27105
27106impl<'a, C> common::CallBuilder for AdvertiserLocationListAssignedLocationBulkEditCall<'a, C> {}
27107
27108impl<'a, C> AdvertiserLocationListAssignedLocationBulkEditCall<'a, C>
27109where
27110    C: common::Connector,
27111{
27112    /// Perform the operation you have build so far.
27113    pub async fn doit(
27114        mut self,
27115    ) -> common::Result<(common::Response, BulkEditAssignedLocationsResponse)> {
27116        use std::borrow::Cow;
27117        use std::io::{Read, Seek};
27118
27119        use common::{url::Params, ToParts};
27120        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27121
27122        let mut dd = common::DefaultDelegate;
27123        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27124        dlg.begin(common::MethodInfo {
27125            id: "displayvideo.advertisers.locationLists.assignedLocations.bulkEdit",
27126            http_method: hyper::Method::POST,
27127        });
27128
27129        for &field in ["alt", "advertiserId", "locationListId"].iter() {
27130            if self._additional_params.contains_key(field) {
27131                dlg.finished(false);
27132                return Err(common::Error::FieldClash(field));
27133            }
27134        }
27135
27136        let mut params = Params::with_capacity(5 + self._additional_params.len());
27137        params.push("advertiserId", self._advertiser_id.to_string());
27138        params.push("locationListId", self._location_list_id.to_string());
27139
27140        params.extend(self._additional_params.iter());
27141
27142        params.push("alt", "json");
27143        let mut url = self.hub._base_url.clone() + "v1/advertisers/{advertiserId}/locationLists/{+locationListId}/assignedLocations:bulkEdit";
27144        if self._scopes.is_empty() {
27145            self._scopes
27146                .insert(Scope::DisplayVideo.as_ref().to_string());
27147        }
27148
27149        #[allow(clippy::single_element_loop)]
27150        for &(find_this, param_name) in [
27151            ("{advertiserId}", "advertiserId"),
27152            ("{+locationListId}", "locationListId"),
27153        ]
27154        .iter()
27155        {
27156            url = params.uri_replacement(url, param_name, find_this, true);
27157        }
27158        {
27159            let to_remove = ["locationListId", "advertiserId"];
27160            params.remove_params(&to_remove);
27161        }
27162
27163        let url = params.parse_with_url(&url);
27164
27165        let mut json_mime_type = mime::APPLICATION_JSON;
27166        let mut request_value_reader = {
27167            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27168            common::remove_json_null_values(&mut value);
27169            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27170            serde_json::to_writer(&mut dst, &value).unwrap();
27171            dst
27172        };
27173        let request_size = request_value_reader
27174            .seek(std::io::SeekFrom::End(0))
27175            .unwrap();
27176        request_value_reader
27177            .seek(std::io::SeekFrom::Start(0))
27178            .unwrap();
27179
27180        loop {
27181            let token = match self
27182                .hub
27183                .auth
27184                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27185                .await
27186            {
27187                Ok(token) => token,
27188                Err(e) => match dlg.token(e) {
27189                    Ok(token) => token,
27190                    Err(e) => {
27191                        dlg.finished(false);
27192                        return Err(common::Error::MissingToken(e));
27193                    }
27194                },
27195            };
27196            request_value_reader
27197                .seek(std::io::SeekFrom::Start(0))
27198                .unwrap();
27199            let mut req_result = {
27200                let client = &self.hub.client;
27201                dlg.pre_request();
27202                let mut req_builder = hyper::Request::builder()
27203                    .method(hyper::Method::POST)
27204                    .uri(url.as_str())
27205                    .header(USER_AGENT, self.hub._user_agent.clone());
27206
27207                if let Some(token) = token.as_ref() {
27208                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27209                }
27210
27211                let request = req_builder
27212                    .header(CONTENT_TYPE, json_mime_type.to_string())
27213                    .header(CONTENT_LENGTH, request_size as u64)
27214                    .body(common::to_body(
27215                        request_value_reader.get_ref().clone().into(),
27216                    ));
27217
27218                client.request(request.unwrap()).await
27219            };
27220
27221            match req_result {
27222                Err(err) => {
27223                    if let common::Retry::After(d) = dlg.http_error(&err) {
27224                        sleep(d).await;
27225                        continue;
27226                    }
27227                    dlg.finished(false);
27228                    return Err(common::Error::HttpError(err));
27229                }
27230                Ok(res) => {
27231                    let (mut parts, body) = res.into_parts();
27232                    let mut body = common::Body::new(body);
27233                    if !parts.status.is_success() {
27234                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27235                        let error = serde_json::from_str(&common::to_string(&bytes));
27236                        let response = common::to_response(parts, bytes.into());
27237
27238                        if let common::Retry::After(d) =
27239                            dlg.http_failure(&response, error.as_ref().ok())
27240                        {
27241                            sleep(d).await;
27242                            continue;
27243                        }
27244
27245                        dlg.finished(false);
27246
27247                        return Err(match error {
27248                            Ok(value) => common::Error::BadRequest(value),
27249                            _ => common::Error::Failure(response),
27250                        });
27251                    }
27252                    let response = {
27253                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27254                        let encoded = common::to_string(&bytes);
27255                        match serde_json::from_str(&encoded) {
27256                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27257                            Err(error) => {
27258                                dlg.response_json_decode_error(&encoded, &error);
27259                                return Err(common::Error::JsonDecodeError(
27260                                    encoded.to_string(),
27261                                    error,
27262                                ));
27263                            }
27264                        }
27265                    };
27266
27267                    dlg.finished(true);
27268                    return Ok(response);
27269                }
27270            }
27271        }
27272    }
27273
27274    ///
27275    /// Sets the *request* property to the given value.
27276    ///
27277    /// Even though the property as already been set when instantiating this call,
27278    /// we provide this method for API completeness.
27279    pub fn request(
27280        mut self,
27281        new_value: BulkEditAssignedLocationsRequest,
27282    ) -> AdvertiserLocationListAssignedLocationBulkEditCall<'a, C> {
27283        self._request = new_value;
27284        self
27285    }
27286    /// Required. The ID of the DV360 advertiser to which the location list belongs.
27287    ///
27288    /// Sets the *advertiser id* path property to the given value.
27289    ///
27290    /// Even though the property as already been set when instantiating this call,
27291    /// we provide this method for API completeness.
27292    pub fn advertiser_id(
27293        mut self,
27294        new_value: i64,
27295    ) -> AdvertiserLocationListAssignedLocationBulkEditCall<'a, C> {
27296        self._advertiser_id = new_value;
27297        self
27298    }
27299    /// Required. The ID of the location list to which these assignments are assigned.
27300    ///
27301    /// Sets the *location list id* path property to the given value.
27302    ///
27303    /// Even though the property as already been set when instantiating this call,
27304    /// we provide this method for API completeness.
27305    pub fn location_list_id(
27306        mut self,
27307        new_value: i64,
27308    ) -> AdvertiserLocationListAssignedLocationBulkEditCall<'a, C> {
27309        self._location_list_id = new_value;
27310        self
27311    }
27312    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27313    /// while executing the actual API request.
27314    ///
27315    /// ````text
27316    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27317    /// ````
27318    ///
27319    /// Sets the *delegate* property to the given value.
27320    pub fn delegate(
27321        mut self,
27322        new_value: &'a mut dyn common::Delegate,
27323    ) -> AdvertiserLocationListAssignedLocationBulkEditCall<'a, C> {
27324        self._delegate = Some(new_value);
27325        self
27326    }
27327
27328    /// Set any additional parameter of the query string used in the request.
27329    /// It should be used to set parameters which are not yet available through their own
27330    /// setters.
27331    ///
27332    /// Please note that this method must not be used to set any of the known parameters
27333    /// which have their own setter method. If done anyway, the request will fail.
27334    ///
27335    /// # Additional Parameters
27336    ///
27337    /// * *$.xgafv* (query-string) - V1 error format.
27338    /// * *access_token* (query-string) - OAuth access token.
27339    /// * *alt* (query-string) - Data format for response.
27340    /// * *callback* (query-string) - JSONP
27341    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27342    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
27343    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27344    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27345    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
27346    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27347    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27348    pub fn param<T>(
27349        mut self,
27350        name: T,
27351        value: T,
27352    ) -> AdvertiserLocationListAssignedLocationBulkEditCall<'a, C>
27353    where
27354        T: AsRef<str>,
27355    {
27356        self._additional_params
27357            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27358        self
27359    }
27360
27361    /// Identifies the authorization scope for the method you are building.
27362    ///
27363    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27364    /// [`Scope::DisplayVideo`].
27365    ///
27366    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27367    /// tokens for more than one scope.
27368    ///
27369    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27370    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27371    /// sufficient, a read-write scope will do as well.
27372    pub fn add_scope<St>(
27373        mut self,
27374        scope: St,
27375    ) -> AdvertiserLocationListAssignedLocationBulkEditCall<'a, C>
27376    where
27377        St: AsRef<str>,
27378    {
27379        self._scopes.insert(String::from(scope.as_ref()));
27380        self
27381    }
27382    /// Identifies the authorization scope(s) for the method you are building.
27383    ///
27384    /// See [`Self::add_scope()`] for details.
27385    pub fn add_scopes<I, St>(
27386        mut self,
27387        scopes: I,
27388    ) -> AdvertiserLocationListAssignedLocationBulkEditCall<'a, C>
27389    where
27390        I: IntoIterator<Item = St>,
27391        St: AsRef<str>,
27392    {
27393        self._scopes
27394            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27395        self
27396    }
27397
27398    /// Removes all scopes, and no default scope will be used either.
27399    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27400    /// for details).
27401    pub fn clear_scopes(mut self) -> AdvertiserLocationListAssignedLocationBulkEditCall<'a, C> {
27402        self._scopes.clear();
27403        self
27404    }
27405}
27406
27407/// Creates an assignment between a location and a location list.
27408///
27409/// A builder for the *locationLists.assignedLocations.create* method supported by a *advertiser* resource.
27410/// It is not used directly, but through a [`AdvertiserMethods`] instance.
27411///
27412/// # Example
27413///
27414/// Instantiate a resource method builder
27415///
27416/// ```test_harness,no_run
27417/// # extern crate hyper;
27418/// # extern crate hyper_rustls;
27419/// # extern crate google_displayvideo1 as displayvideo1;
27420/// use displayvideo1::api::AssignedLocation;
27421/// # async fn dox() {
27422/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27423///
27424/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27425/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27426/// #     secret,
27427/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27428/// # ).build().await.unwrap();
27429///
27430/// # let client = hyper_util::client::legacy::Client::builder(
27431/// #     hyper_util::rt::TokioExecutor::new()
27432/// # )
27433/// # .build(
27434/// #     hyper_rustls::HttpsConnectorBuilder::new()
27435/// #         .with_native_roots()
27436/// #         .unwrap()
27437/// #         .https_or_http()
27438/// #         .enable_http1()
27439/// #         .build()
27440/// # );
27441/// # let mut hub = DisplayVideo::new(client, auth);
27442/// // As the method needs a request, you would usually fill it with the desired information
27443/// // into the respective structure. Some of the parts shown here might not be applicable !
27444/// // Values shown here are possibly random and not representative !
27445/// let mut req = AssignedLocation::default();
27446///
27447/// // You can configure optional parameters by calling the respective setters at will, and
27448/// // execute the final call using `doit()`.
27449/// // Values shown here are possibly random and not representative !
27450/// let result = hub.advertisers().location_lists_assigned_locations_create(req, -48, -81)
27451///              .doit().await;
27452/// # }
27453/// ```
27454pub struct AdvertiserLocationListAssignedLocationCreateCall<'a, C>
27455where
27456    C: 'a,
27457{
27458    hub: &'a DisplayVideo<C>,
27459    _request: AssignedLocation,
27460    _advertiser_id: i64,
27461    _location_list_id: i64,
27462    _delegate: Option<&'a mut dyn common::Delegate>,
27463    _additional_params: HashMap<String, String>,
27464    _scopes: BTreeSet<String>,
27465}
27466
27467impl<'a, C> common::CallBuilder for AdvertiserLocationListAssignedLocationCreateCall<'a, C> {}
27468
27469impl<'a, C> AdvertiserLocationListAssignedLocationCreateCall<'a, C>
27470where
27471    C: common::Connector,
27472{
27473    /// Perform the operation you have build so far.
27474    pub async fn doit(mut self) -> common::Result<(common::Response, AssignedLocation)> {
27475        use std::borrow::Cow;
27476        use std::io::{Read, Seek};
27477
27478        use common::{url::Params, ToParts};
27479        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27480
27481        let mut dd = common::DefaultDelegate;
27482        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27483        dlg.begin(common::MethodInfo {
27484            id: "displayvideo.advertisers.locationLists.assignedLocations.create",
27485            http_method: hyper::Method::POST,
27486        });
27487
27488        for &field in ["alt", "advertiserId", "locationListId"].iter() {
27489            if self._additional_params.contains_key(field) {
27490                dlg.finished(false);
27491                return Err(common::Error::FieldClash(field));
27492            }
27493        }
27494
27495        let mut params = Params::with_capacity(5 + self._additional_params.len());
27496        params.push("advertiserId", self._advertiser_id.to_string());
27497        params.push("locationListId", self._location_list_id.to_string());
27498
27499        params.extend(self._additional_params.iter());
27500
27501        params.push("alt", "json");
27502        let mut url = self.hub._base_url.clone()
27503            + "v1/advertisers/{advertiserId}/locationLists/{locationListId}/assignedLocations";
27504        if self._scopes.is_empty() {
27505            self._scopes
27506                .insert(Scope::DisplayVideo.as_ref().to_string());
27507        }
27508
27509        #[allow(clippy::single_element_loop)]
27510        for &(find_this, param_name) in [
27511            ("{advertiserId}", "advertiserId"),
27512            ("{locationListId}", "locationListId"),
27513        ]
27514        .iter()
27515        {
27516            url = params.uri_replacement(url, param_name, find_this, false);
27517        }
27518        {
27519            let to_remove = ["locationListId", "advertiserId"];
27520            params.remove_params(&to_remove);
27521        }
27522
27523        let url = params.parse_with_url(&url);
27524
27525        let mut json_mime_type = mime::APPLICATION_JSON;
27526        let mut request_value_reader = {
27527            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27528            common::remove_json_null_values(&mut value);
27529            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27530            serde_json::to_writer(&mut dst, &value).unwrap();
27531            dst
27532        };
27533        let request_size = request_value_reader
27534            .seek(std::io::SeekFrom::End(0))
27535            .unwrap();
27536        request_value_reader
27537            .seek(std::io::SeekFrom::Start(0))
27538            .unwrap();
27539
27540        loop {
27541            let token = match self
27542                .hub
27543                .auth
27544                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27545                .await
27546            {
27547                Ok(token) => token,
27548                Err(e) => match dlg.token(e) {
27549                    Ok(token) => token,
27550                    Err(e) => {
27551                        dlg.finished(false);
27552                        return Err(common::Error::MissingToken(e));
27553                    }
27554                },
27555            };
27556            request_value_reader
27557                .seek(std::io::SeekFrom::Start(0))
27558                .unwrap();
27559            let mut req_result = {
27560                let client = &self.hub.client;
27561                dlg.pre_request();
27562                let mut req_builder = hyper::Request::builder()
27563                    .method(hyper::Method::POST)
27564                    .uri(url.as_str())
27565                    .header(USER_AGENT, self.hub._user_agent.clone());
27566
27567                if let Some(token) = token.as_ref() {
27568                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27569                }
27570
27571                let request = req_builder
27572                    .header(CONTENT_TYPE, json_mime_type.to_string())
27573                    .header(CONTENT_LENGTH, request_size as u64)
27574                    .body(common::to_body(
27575                        request_value_reader.get_ref().clone().into(),
27576                    ));
27577
27578                client.request(request.unwrap()).await
27579            };
27580
27581            match req_result {
27582                Err(err) => {
27583                    if let common::Retry::After(d) = dlg.http_error(&err) {
27584                        sleep(d).await;
27585                        continue;
27586                    }
27587                    dlg.finished(false);
27588                    return Err(common::Error::HttpError(err));
27589                }
27590                Ok(res) => {
27591                    let (mut parts, body) = res.into_parts();
27592                    let mut body = common::Body::new(body);
27593                    if !parts.status.is_success() {
27594                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27595                        let error = serde_json::from_str(&common::to_string(&bytes));
27596                        let response = common::to_response(parts, bytes.into());
27597
27598                        if let common::Retry::After(d) =
27599                            dlg.http_failure(&response, error.as_ref().ok())
27600                        {
27601                            sleep(d).await;
27602                            continue;
27603                        }
27604
27605                        dlg.finished(false);
27606
27607                        return Err(match error {
27608                            Ok(value) => common::Error::BadRequest(value),
27609                            _ => common::Error::Failure(response),
27610                        });
27611                    }
27612                    let response = {
27613                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27614                        let encoded = common::to_string(&bytes);
27615                        match serde_json::from_str(&encoded) {
27616                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27617                            Err(error) => {
27618                                dlg.response_json_decode_error(&encoded, &error);
27619                                return Err(common::Error::JsonDecodeError(
27620                                    encoded.to_string(),
27621                                    error,
27622                                ));
27623                            }
27624                        }
27625                    };
27626
27627                    dlg.finished(true);
27628                    return Ok(response);
27629                }
27630            }
27631        }
27632    }
27633
27634    ///
27635    /// Sets the *request* property to the given value.
27636    ///
27637    /// Even though the property as already been set when instantiating this call,
27638    /// we provide this method for API completeness.
27639    pub fn request(
27640        mut self,
27641        new_value: AssignedLocation,
27642    ) -> AdvertiserLocationListAssignedLocationCreateCall<'a, C> {
27643        self._request = new_value;
27644        self
27645    }
27646    /// Required. The ID of the DV360 advertiser to which the location list belongs.
27647    ///
27648    /// Sets the *advertiser id* path property to the given value.
27649    ///
27650    /// Even though the property as already been set when instantiating this call,
27651    /// we provide this method for API completeness.
27652    pub fn advertiser_id(
27653        mut self,
27654        new_value: i64,
27655    ) -> AdvertiserLocationListAssignedLocationCreateCall<'a, C> {
27656        self._advertiser_id = new_value;
27657        self
27658    }
27659    /// Required. The ID of the location list for which the assignment will be created.
27660    ///
27661    /// Sets the *location list id* path property to the given value.
27662    ///
27663    /// Even though the property as already been set when instantiating this call,
27664    /// we provide this method for API completeness.
27665    pub fn location_list_id(
27666        mut self,
27667        new_value: i64,
27668    ) -> AdvertiserLocationListAssignedLocationCreateCall<'a, C> {
27669        self._location_list_id = new_value;
27670        self
27671    }
27672    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27673    /// while executing the actual API request.
27674    ///
27675    /// ````text
27676    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27677    /// ````
27678    ///
27679    /// Sets the *delegate* property to the given value.
27680    pub fn delegate(
27681        mut self,
27682        new_value: &'a mut dyn common::Delegate,
27683    ) -> AdvertiserLocationListAssignedLocationCreateCall<'a, C> {
27684        self._delegate = Some(new_value);
27685        self
27686    }
27687
27688    /// Set any additional parameter of the query string used in the request.
27689    /// It should be used to set parameters which are not yet available through their own
27690    /// setters.
27691    ///
27692    /// Please note that this method must not be used to set any of the known parameters
27693    /// which have their own setter method. If done anyway, the request will fail.
27694    ///
27695    /// # Additional Parameters
27696    ///
27697    /// * *$.xgafv* (query-string) - V1 error format.
27698    /// * *access_token* (query-string) - OAuth access token.
27699    /// * *alt* (query-string) - Data format for response.
27700    /// * *callback* (query-string) - JSONP
27701    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27702    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
27703    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27704    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27705    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
27706    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27707    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27708    pub fn param<T>(
27709        mut self,
27710        name: T,
27711        value: T,
27712    ) -> AdvertiserLocationListAssignedLocationCreateCall<'a, C>
27713    where
27714        T: AsRef<str>,
27715    {
27716        self._additional_params
27717            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27718        self
27719    }
27720
27721    /// Identifies the authorization scope for the method you are building.
27722    ///
27723    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27724    /// [`Scope::DisplayVideo`].
27725    ///
27726    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27727    /// tokens for more than one scope.
27728    ///
27729    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27730    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27731    /// sufficient, a read-write scope will do as well.
27732    pub fn add_scope<St>(
27733        mut self,
27734        scope: St,
27735    ) -> AdvertiserLocationListAssignedLocationCreateCall<'a, C>
27736    where
27737        St: AsRef<str>,
27738    {
27739        self._scopes.insert(String::from(scope.as_ref()));
27740        self
27741    }
27742    /// Identifies the authorization scope(s) for the method you are building.
27743    ///
27744    /// See [`Self::add_scope()`] for details.
27745    pub fn add_scopes<I, St>(
27746        mut self,
27747        scopes: I,
27748    ) -> AdvertiserLocationListAssignedLocationCreateCall<'a, C>
27749    where
27750        I: IntoIterator<Item = St>,
27751        St: AsRef<str>,
27752    {
27753        self._scopes
27754            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27755        self
27756    }
27757
27758    /// Removes all scopes, and no default scope will be used either.
27759    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27760    /// for details).
27761    pub fn clear_scopes(mut self) -> AdvertiserLocationListAssignedLocationCreateCall<'a, C> {
27762        self._scopes.clear();
27763        self
27764    }
27765}
27766
27767/// Deletes the assignment between a location and a location list.
27768///
27769/// A builder for the *locationLists.assignedLocations.delete* method supported by a *advertiser* resource.
27770/// It is not used directly, but through a [`AdvertiserMethods`] instance.
27771///
27772/// # Example
27773///
27774/// Instantiate a resource method builder
27775///
27776/// ```test_harness,no_run
27777/// # extern crate hyper;
27778/// # extern crate hyper_rustls;
27779/// # extern crate google_displayvideo1 as displayvideo1;
27780/// # async fn dox() {
27781/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27782///
27783/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27784/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27785/// #     secret,
27786/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27787/// # ).build().await.unwrap();
27788///
27789/// # let client = hyper_util::client::legacy::Client::builder(
27790/// #     hyper_util::rt::TokioExecutor::new()
27791/// # )
27792/// # .build(
27793/// #     hyper_rustls::HttpsConnectorBuilder::new()
27794/// #         .with_native_roots()
27795/// #         .unwrap()
27796/// #         .https_or_http()
27797/// #         .enable_http1()
27798/// #         .build()
27799/// # );
27800/// # let mut hub = DisplayVideo::new(client, auth);
27801/// // You can configure optional parameters by calling the respective setters at will, and
27802/// // execute the final call using `doit()`.
27803/// // Values shown here are possibly random and not representative !
27804/// let result = hub.advertisers().location_lists_assigned_locations_delete(-10, -41, -22)
27805///              .doit().await;
27806/// # }
27807/// ```
27808pub struct AdvertiserLocationListAssignedLocationDeleteCall<'a, C>
27809where
27810    C: 'a,
27811{
27812    hub: &'a DisplayVideo<C>,
27813    _advertiser_id: i64,
27814    _location_list_id: i64,
27815    _assigned_location_id: i64,
27816    _delegate: Option<&'a mut dyn common::Delegate>,
27817    _additional_params: HashMap<String, String>,
27818    _scopes: BTreeSet<String>,
27819}
27820
27821impl<'a, C> common::CallBuilder for AdvertiserLocationListAssignedLocationDeleteCall<'a, C> {}
27822
27823impl<'a, C> AdvertiserLocationListAssignedLocationDeleteCall<'a, C>
27824where
27825    C: common::Connector,
27826{
27827    /// Perform the operation you have build so far.
27828    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
27829        use std::borrow::Cow;
27830        use std::io::{Read, Seek};
27831
27832        use common::{url::Params, ToParts};
27833        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27834
27835        let mut dd = common::DefaultDelegate;
27836        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27837        dlg.begin(common::MethodInfo {
27838            id: "displayvideo.advertisers.locationLists.assignedLocations.delete",
27839            http_method: hyper::Method::DELETE,
27840        });
27841
27842        for &field in [
27843            "alt",
27844            "advertiserId",
27845            "locationListId",
27846            "assignedLocationId",
27847        ]
27848        .iter()
27849        {
27850            if self._additional_params.contains_key(field) {
27851                dlg.finished(false);
27852                return Err(common::Error::FieldClash(field));
27853            }
27854        }
27855
27856        let mut params = Params::with_capacity(5 + self._additional_params.len());
27857        params.push("advertiserId", self._advertiser_id.to_string());
27858        params.push("locationListId", self._location_list_id.to_string());
27859        params.push("assignedLocationId", self._assigned_location_id.to_string());
27860
27861        params.extend(self._additional_params.iter());
27862
27863        params.push("alt", "json");
27864        let mut url = self.hub._base_url.clone() + "v1/advertisers/{advertiserId}/locationLists/{locationListId}/assignedLocations/{+assignedLocationId}";
27865        if self._scopes.is_empty() {
27866            self._scopes
27867                .insert(Scope::DisplayVideo.as_ref().to_string());
27868        }
27869
27870        #[allow(clippy::single_element_loop)]
27871        for &(find_this, param_name) in [
27872            ("{advertiserId}", "advertiserId"),
27873            ("{locationListId}", "locationListId"),
27874            ("{+assignedLocationId}", "assignedLocationId"),
27875        ]
27876        .iter()
27877        {
27878            url = params.uri_replacement(url, param_name, find_this, true);
27879        }
27880        {
27881            let to_remove = ["assignedLocationId", "locationListId", "advertiserId"];
27882            params.remove_params(&to_remove);
27883        }
27884
27885        let url = params.parse_with_url(&url);
27886
27887        loop {
27888            let token = match self
27889                .hub
27890                .auth
27891                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27892                .await
27893            {
27894                Ok(token) => token,
27895                Err(e) => match dlg.token(e) {
27896                    Ok(token) => token,
27897                    Err(e) => {
27898                        dlg.finished(false);
27899                        return Err(common::Error::MissingToken(e));
27900                    }
27901                },
27902            };
27903            let mut req_result = {
27904                let client = &self.hub.client;
27905                dlg.pre_request();
27906                let mut req_builder = hyper::Request::builder()
27907                    .method(hyper::Method::DELETE)
27908                    .uri(url.as_str())
27909                    .header(USER_AGENT, self.hub._user_agent.clone());
27910
27911                if let Some(token) = token.as_ref() {
27912                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27913                }
27914
27915                let request = req_builder
27916                    .header(CONTENT_LENGTH, 0_u64)
27917                    .body(common::to_body::<String>(None));
27918
27919                client.request(request.unwrap()).await
27920            };
27921
27922            match req_result {
27923                Err(err) => {
27924                    if let common::Retry::After(d) = dlg.http_error(&err) {
27925                        sleep(d).await;
27926                        continue;
27927                    }
27928                    dlg.finished(false);
27929                    return Err(common::Error::HttpError(err));
27930                }
27931                Ok(res) => {
27932                    let (mut parts, body) = res.into_parts();
27933                    let mut body = common::Body::new(body);
27934                    if !parts.status.is_success() {
27935                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27936                        let error = serde_json::from_str(&common::to_string(&bytes));
27937                        let response = common::to_response(parts, bytes.into());
27938
27939                        if let common::Retry::After(d) =
27940                            dlg.http_failure(&response, error.as_ref().ok())
27941                        {
27942                            sleep(d).await;
27943                            continue;
27944                        }
27945
27946                        dlg.finished(false);
27947
27948                        return Err(match error {
27949                            Ok(value) => common::Error::BadRequest(value),
27950                            _ => common::Error::Failure(response),
27951                        });
27952                    }
27953                    let response = {
27954                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27955                        let encoded = common::to_string(&bytes);
27956                        match serde_json::from_str(&encoded) {
27957                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27958                            Err(error) => {
27959                                dlg.response_json_decode_error(&encoded, &error);
27960                                return Err(common::Error::JsonDecodeError(
27961                                    encoded.to_string(),
27962                                    error,
27963                                ));
27964                            }
27965                        }
27966                    };
27967
27968                    dlg.finished(true);
27969                    return Ok(response);
27970                }
27971            }
27972        }
27973    }
27974
27975    /// Required. The ID of the DV360 advertiser to which the location list belongs.
27976    ///
27977    /// Sets the *advertiser id* path property to the given value.
27978    ///
27979    /// Even though the property as already been set when instantiating this call,
27980    /// we provide this method for API completeness.
27981    pub fn advertiser_id(
27982        mut self,
27983        new_value: i64,
27984    ) -> AdvertiserLocationListAssignedLocationDeleteCall<'a, C> {
27985        self._advertiser_id = new_value;
27986        self
27987    }
27988    /// Required. The ID of the location list to which this assignment is assigned.
27989    ///
27990    /// Sets the *location list id* path property to the given value.
27991    ///
27992    /// Even though the property as already been set when instantiating this call,
27993    /// we provide this method for API completeness.
27994    pub fn location_list_id(
27995        mut self,
27996        new_value: i64,
27997    ) -> AdvertiserLocationListAssignedLocationDeleteCall<'a, C> {
27998        self._location_list_id = new_value;
27999        self
28000    }
28001    /// Required. The ID of the assigned location to delete.
28002    ///
28003    /// Sets the *assigned location id* path property to the given value.
28004    ///
28005    /// Even though the property as already been set when instantiating this call,
28006    /// we provide this method for API completeness.
28007    pub fn assigned_location_id(
28008        mut self,
28009        new_value: i64,
28010    ) -> AdvertiserLocationListAssignedLocationDeleteCall<'a, C> {
28011        self._assigned_location_id = new_value;
28012        self
28013    }
28014    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28015    /// while executing the actual API request.
28016    ///
28017    /// ````text
28018    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28019    /// ````
28020    ///
28021    /// Sets the *delegate* property to the given value.
28022    pub fn delegate(
28023        mut self,
28024        new_value: &'a mut dyn common::Delegate,
28025    ) -> AdvertiserLocationListAssignedLocationDeleteCall<'a, C> {
28026        self._delegate = Some(new_value);
28027        self
28028    }
28029
28030    /// Set any additional parameter of the query string used in the request.
28031    /// It should be used to set parameters which are not yet available through their own
28032    /// setters.
28033    ///
28034    /// Please note that this method must not be used to set any of the known parameters
28035    /// which have their own setter method. If done anyway, the request will fail.
28036    ///
28037    /// # Additional Parameters
28038    ///
28039    /// * *$.xgafv* (query-string) - V1 error format.
28040    /// * *access_token* (query-string) - OAuth access token.
28041    /// * *alt* (query-string) - Data format for response.
28042    /// * *callback* (query-string) - JSONP
28043    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28044    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
28045    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28046    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28047    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
28048    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28049    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28050    pub fn param<T>(
28051        mut self,
28052        name: T,
28053        value: T,
28054    ) -> AdvertiserLocationListAssignedLocationDeleteCall<'a, C>
28055    where
28056        T: AsRef<str>,
28057    {
28058        self._additional_params
28059            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28060        self
28061    }
28062
28063    /// Identifies the authorization scope for the method you are building.
28064    ///
28065    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28066    /// [`Scope::DisplayVideo`].
28067    ///
28068    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28069    /// tokens for more than one scope.
28070    ///
28071    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28072    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28073    /// sufficient, a read-write scope will do as well.
28074    pub fn add_scope<St>(
28075        mut self,
28076        scope: St,
28077    ) -> AdvertiserLocationListAssignedLocationDeleteCall<'a, C>
28078    where
28079        St: AsRef<str>,
28080    {
28081        self._scopes.insert(String::from(scope.as_ref()));
28082        self
28083    }
28084    /// Identifies the authorization scope(s) for the method you are building.
28085    ///
28086    /// See [`Self::add_scope()`] for details.
28087    pub fn add_scopes<I, St>(
28088        mut self,
28089        scopes: I,
28090    ) -> AdvertiserLocationListAssignedLocationDeleteCall<'a, C>
28091    where
28092        I: IntoIterator<Item = St>,
28093        St: AsRef<str>,
28094    {
28095        self._scopes
28096            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28097        self
28098    }
28099
28100    /// Removes all scopes, and no default scope will be used either.
28101    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28102    /// for details).
28103    pub fn clear_scopes(mut self) -> AdvertiserLocationListAssignedLocationDeleteCall<'a, C> {
28104        self._scopes.clear();
28105        self
28106    }
28107}
28108
28109/// Lists locations assigned to a location list.
28110///
28111/// A builder for the *locationLists.assignedLocations.list* method supported by a *advertiser* resource.
28112/// It is not used directly, but through a [`AdvertiserMethods`] instance.
28113///
28114/// # Example
28115///
28116/// Instantiate a resource method builder
28117///
28118/// ```test_harness,no_run
28119/// # extern crate hyper;
28120/// # extern crate hyper_rustls;
28121/// # extern crate google_displayvideo1 as displayvideo1;
28122/// # async fn dox() {
28123/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28124///
28125/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28126/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28127/// #     secret,
28128/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28129/// # ).build().await.unwrap();
28130///
28131/// # let client = hyper_util::client::legacy::Client::builder(
28132/// #     hyper_util::rt::TokioExecutor::new()
28133/// # )
28134/// # .build(
28135/// #     hyper_rustls::HttpsConnectorBuilder::new()
28136/// #         .with_native_roots()
28137/// #         .unwrap()
28138/// #         .https_or_http()
28139/// #         .enable_http1()
28140/// #         .build()
28141/// # );
28142/// # let mut hub = DisplayVideo::new(client, auth);
28143/// // You can configure optional parameters by calling the respective setters at will, and
28144/// // execute the final call using `doit()`.
28145/// // Values shown here are possibly random and not representative !
28146/// let result = hub.advertisers().location_lists_assigned_locations_list(-12, -21)
28147///              .page_token("sea")
28148///              .page_size(-96)
28149///              .order_by("sit")
28150///              .filter("aliquyam")
28151///              .doit().await;
28152/// # }
28153/// ```
28154pub struct AdvertiserLocationListAssignedLocationListCall<'a, C>
28155where
28156    C: 'a,
28157{
28158    hub: &'a DisplayVideo<C>,
28159    _advertiser_id: i64,
28160    _location_list_id: i64,
28161    _page_token: Option<String>,
28162    _page_size: Option<i32>,
28163    _order_by: Option<String>,
28164    _filter: Option<String>,
28165    _delegate: Option<&'a mut dyn common::Delegate>,
28166    _additional_params: HashMap<String, String>,
28167    _scopes: BTreeSet<String>,
28168}
28169
28170impl<'a, C> common::CallBuilder for AdvertiserLocationListAssignedLocationListCall<'a, C> {}
28171
28172impl<'a, C> AdvertiserLocationListAssignedLocationListCall<'a, C>
28173where
28174    C: common::Connector,
28175{
28176    /// Perform the operation you have build so far.
28177    pub async fn doit(
28178        mut self,
28179    ) -> common::Result<(common::Response, ListAssignedLocationsResponse)> {
28180        use std::borrow::Cow;
28181        use std::io::{Read, Seek};
28182
28183        use common::{url::Params, ToParts};
28184        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28185
28186        let mut dd = common::DefaultDelegate;
28187        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28188        dlg.begin(common::MethodInfo {
28189            id: "displayvideo.advertisers.locationLists.assignedLocations.list",
28190            http_method: hyper::Method::GET,
28191        });
28192
28193        for &field in [
28194            "alt",
28195            "advertiserId",
28196            "locationListId",
28197            "pageToken",
28198            "pageSize",
28199            "orderBy",
28200            "filter",
28201        ]
28202        .iter()
28203        {
28204            if self._additional_params.contains_key(field) {
28205                dlg.finished(false);
28206                return Err(common::Error::FieldClash(field));
28207            }
28208        }
28209
28210        let mut params = Params::with_capacity(8 + self._additional_params.len());
28211        params.push("advertiserId", self._advertiser_id.to_string());
28212        params.push("locationListId", self._location_list_id.to_string());
28213        if let Some(value) = self._page_token.as_ref() {
28214            params.push("pageToken", value);
28215        }
28216        if let Some(value) = self._page_size.as_ref() {
28217            params.push("pageSize", value.to_string());
28218        }
28219        if let Some(value) = self._order_by.as_ref() {
28220            params.push("orderBy", value);
28221        }
28222        if let Some(value) = self._filter.as_ref() {
28223            params.push("filter", value);
28224        }
28225
28226        params.extend(self._additional_params.iter());
28227
28228        params.push("alt", "json");
28229        let mut url = self.hub._base_url.clone()
28230            + "v1/advertisers/{advertiserId}/locationLists/{locationListId}/assignedLocations";
28231        if self._scopes.is_empty() {
28232            self._scopes
28233                .insert(Scope::DisplayVideo.as_ref().to_string());
28234        }
28235
28236        #[allow(clippy::single_element_loop)]
28237        for &(find_this, param_name) in [
28238            ("{advertiserId}", "advertiserId"),
28239            ("{locationListId}", "locationListId"),
28240        ]
28241        .iter()
28242        {
28243            url = params.uri_replacement(url, param_name, find_this, false);
28244        }
28245        {
28246            let to_remove = ["locationListId", "advertiserId"];
28247            params.remove_params(&to_remove);
28248        }
28249
28250        let url = params.parse_with_url(&url);
28251
28252        loop {
28253            let token = match self
28254                .hub
28255                .auth
28256                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28257                .await
28258            {
28259                Ok(token) => token,
28260                Err(e) => match dlg.token(e) {
28261                    Ok(token) => token,
28262                    Err(e) => {
28263                        dlg.finished(false);
28264                        return Err(common::Error::MissingToken(e));
28265                    }
28266                },
28267            };
28268            let mut req_result = {
28269                let client = &self.hub.client;
28270                dlg.pre_request();
28271                let mut req_builder = hyper::Request::builder()
28272                    .method(hyper::Method::GET)
28273                    .uri(url.as_str())
28274                    .header(USER_AGENT, self.hub._user_agent.clone());
28275
28276                if let Some(token) = token.as_ref() {
28277                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28278                }
28279
28280                let request = req_builder
28281                    .header(CONTENT_LENGTH, 0_u64)
28282                    .body(common::to_body::<String>(None));
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    /// Required. The ID of the DV360 advertiser to which the location list belongs.
28341    ///
28342    /// Sets the *advertiser id* path property to the given value.
28343    ///
28344    /// Even though the property as already been set when instantiating this call,
28345    /// we provide this method for API completeness.
28346    pub fn advertiser_id(
28347        mut self,
28348        new_value: i64,
28349    ) -> AdvertiserLocationListAssignedLocationListCall<'a, C> {
28350        self._advertiser_id = new_value;
28351        self
28352    }
28353    /// Required. The ID of the location list to which these assignments are assigned.
28354    ///
28355    /// Sets the *location list id* path property to the given value.
28356    ///
28357    /// Even though the property as already been set when instantiating this call,
28358    /// we provide this method for API completeness.
28359    pub fn location_list_id(
28360        mut self,
28361        new_value: i64,
28362    ) -> AdvertiserLocationListAssignedLocationListCall<'a, C> {
28363        self._location_list_id = new_value;
28364        self
28365    }
28366    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListAssignedLocations` method. If not specified, the first page of results will be returned.
28367    ///
28368    /// Sets the *page token* query property to the given value.
28369    pub fn page_token(
28370        mut self,
28371        new_value: &str,
28372    ) -> AdvertiserLocationListAssignedLocationListCall<'a, C> {
28373        self._page_token = Some(new_value.to_string());
28374        self
28375    }
28376    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
28377    ///
28378    /// Sets the *page size* query property to the given value.
28379    pub fn page_size(
28380        mut self,
28381        new_value: i32,
28382    ) -> AdvertiserLocationListAssignedLocationListCall<'a, C> {
28383        self._page_size = Some(new_value);
28384        self
28385    }
28386    /// Field by which to sort the list. Acceptable values are: * `assignedLocationId` (default) The default sorting order is ascending. To specify descending order for a field, a suffix " desc" should be added to the field name. Example: `assignedLocationId desc`.
28387    ///
28388    /// Sets the *order by* query property to the given value.
28389    pub fn order_by(
28390        mut self,
28391        new_value: &str,
28392    ) -> AdvertiserLocationListAssignedLocationListCall<'a, C> {
28393        self._order_by = Some(new_value.to_string());
28394        self
28395    }
28396    /// Allows filtering by location list assignment fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by the `OR` logical operator. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `EQUALS (=)` operator. Supported fields: * `assignedLocationId` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
28397    ///
28398    /// Sets the *filter* query property to the given value.
28399    pub fn filter(
28400        mut self,
28401        new_value: &str,
28402    ) -> AdvertiserLocationListAssignedLocationListCall<'a, C> {
28403        self._filter = Some(new_value.to_string());
28404        self
28405    }
28406    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28407    /// while executing the actual API request.
28408    ///
28409    /// ````text
28410    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28411    /// ````
28412    ///
28413    /// Sets the *delegate* property to the given value.
28414    pub fn delegate(
28415        mut self,
28416        new_value: &'a mut dyn common::Delegate,
28417    ) -> AdvertiserLocationListAssignedLocationListCall<'a, C> {
28418        self._delegate = Some(new_value);
28419        self
28420    }
28421
28422    /// Set any additional parameter of the query string used in the request.
28423    /// It should be used to set parameters which are not yet available through their own
28424    /// setters.
28425    ///
28426    /// Please note that this method must not be used to set any of the known parameters
28427    /// which have their own setter method. If done anyway, the request will fail.
28428    ///
28429    /// # Additional Parameters
28430    ///
28431    /// * *$.xgafv* (query-string) - V1 error format.
28432    /// * *access_token* (query-string) - OAuth access token.
28433    /// * *alt* (query-string) - Data format for response.
28434    /// * *callback* (query-string) - JSONP
28435    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28436    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
28437    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28438    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28439    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
28440    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28441    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28442    pub fn param<T>(
28443        mut self,
28444        name: T,
28445        value: T,
28446    ) -> AdvertiserLocationListAssignedLocationListCall<'a, C>
28447    where
28448        T: AsRef<str>,
28449    {
28450        self._additional_params
28451            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28452        self
28453    }
28454
28455    /// Identifies the authorization scope for the method you are building.
28456    ///
28457    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28458    /// [`Scope::DisplayVideo`].
28459    ///
28460    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28461    /// tokens for more than one scope.
28462    ///
28463    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28464    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28465    /// sufficient, a read-write scope will do as well.
28466    pub fn add_scope<St>(
28467        mut self,
28468        scope: St,
28469    ) -> AdvertiserLocationListAssignedLocationListCall<'a, C>
28470    where
28471        St: AsRef<str>,
28472    {
28473        self._scopes.insert(String::from(scope.as_ref()));
28474        self
28475    }
28476    /// Identifies the authorization scope(s) for the method you are building.
28477    ///
28478    /// See [`Self::add_scope()`] for details.
28479    pub fn add_scopes<I, St>(
28480        mut self,
28481        scopes: I,
28482    ) -> AdvertiserLocationListAssignedLocationListCall<'a, C>
28483    where
28484        I: IntoIterator<Item = St>,
28485        St: AsRef<str>,
28486    {
28487        self._scopes
28488            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28489        self
28490    }
28491
28492    /// Removes all scopes, and no default scope will be used either.
28493    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28494    /// for details).
28495    pub fn clear_scopes(mut self) -> AdvertiserLocationListAssignedLocationListCall<'a, C> {
28496        self._scopes.clear();
28497        self
28498    }
28499}
28500
28501/// Creates a new location list. Returns the newly created location list if successful.
28502///
28503/// A builder for the *locationLists.create* method supported by a *advertiser* resource.
28504/// It is not used directly, but through a [`AdvertiserMethods`] instance.
28505///
28506/// # Example
28507///
28508/// Instantiate a resource method builder
28509///
28510/// ```test_harness,no_run
28511/// # extern crate hyper;
28512/// # extern crate hyper_rustls;
28513/// # extern crate google_displayvideo1 as displayvideo1;
28514/// use displayvideo1::api::LocationList;
28515/// # async fn dox() {
28516/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28517///
28518/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28519/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28520/// #     secret,
28521/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28522/// # ).build().await.unwrap();
28523///
28524/// # let client = hyper_util::client::legacy::Client::builder(
28525/// #     hyper_util::rt::TokioExecutor::new()
28526/// # )
28527/// # .build(
28528/// #     hyper_rustls::HttpsConnectorBuilder::new()
28529/// #         .with_native_roots()
28530/// #         .unwrap()
28531/// #         .https_or_http()
28532/// #         .enable_http1()
28533/// #         .build()
28534/// # );
28535/// # let mut hub = DisplayVideo::new(client, auth);
28536/// // As the method needs a request, you would usually fill it with the desired information
28537/// // into the respective structure. Some of the parts shown here might not be applicable !
28538/// // Values shown here are possibly random and not representative !
28539/// let mut req = LocationList::default();
28540///
28541/// // You can configure optional parameters by calling the respective setters at will, and
28542/// // execute the final call using `doit()`.
28543/// // Values shown here are possibly random and not representative !
28544/// let result = hub.advertisers().location_lists_create(req, -25)
28545///              .doit().await;
28546/// # }
28547/// ```
28548pub struct AdvertiserLocationListCreateCall<'a, C>
28549where
28550    C: 'a,
28551{
28552    hub: &'a DisplayVideo<C>,
28553    _request: LocationList,
28554    _advertiser_id: i64,
28555    _delegate: Option<&'a mut dyn common::Delegate>,
28556    _additional_params: HashMap<String, String>,
28557    _scopes: BTreeSet<String>,
28558}
28559
28560impl<'a, C> common::CallBuilder for AdvertiserLocationListCreateCall<'a, C> {}
28561
28562impl<'a, C> AdvertiserLocationListCreateCall<'a, C>
28563where
28564    C: common::Connector,
28565{
28566    /// Perform the operation you have build so far.
28567    pub async fn doit(mut self) -> common::Result<(common::Response, LocationList)> {
28568        use std::borrow::Cow;
28569        use std::io::{Read, Seek};
28570
28571        use common::{url::Params, ToParts};
28572        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28573
28574        let mut dd = common::DefaultDelegate;
28575        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28576        dlg.begin(common::MethodInfo {
28577            id: "displayvideo.advertisers.locationLists.create",
28578            http_method: hyper::Method::POST,
28579        });
28580
28581        for &field in ["alt", "advertiserId"].iter() {
28582            if self._additional_params.contains_key(field) {
28583                dlg.finished(false);
28584                return Err(common::Error::FieldClash(field));
28585            }
28586        }
28587
28588        let mut params = Params::with_capacity(4 + self._additional_params.len());
28589        params.push("advertiserId", self._advertiser_id.to_string());
28590
28591        params.extend(self._additional_params.iter());
28592
28593        params.push("alt", "json");
28594        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/locationLists";
28595        if self._scopes.is_empty() {
28596            self._scopes
28597                .insert(Scope::DisplayVideo.as_ref().to_string());
28598        }
28599
28600        #[allow(clippy::single_element_loop)]
28601        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
28602            url = params.uri_replacement(url, param_name, find_this, true);
28603        }
28604        {
28605            let to_remove = ["advertiserId"];
28606            params.remove_params(&to_remove);
28607        }
28608
28609        let url = params.parse_with_url(&url);
28610
28611        let mut json_mime_type = mime::APPLICATION_JSON;
28612        let mut request_value_reader = {
28613            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28614            common::remove_json_null_values(&mut value);
28615            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28616            serde_json::to_writer(&mut dst, &value).unwrap();
28617            dst
28618        };
28619        let request_size = request_value_reader
28620            .seek(std::io::SeekFrom::End(0))
28621            .unwrap();
28622        request_value_reader
28623            .seek(std::io::SeekFrom::Start(0))
28624            .unwrap();
28625
28626        loop {
28627            let token = match self
28628                .hub
28629                .auth
28630                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28631                .await
28632            {
28633                Ok(token) => token,
28634                Err(e) => match dlg.token(e) {
28635                    Ok(token) => token,
28636                    Err(e) => {
28637                        dlg.finished(false);
28638                        return Err(common::Error::MissingToken(e));
28639                    }
28640                },
28641            };
28642            request_value_reader
28643                .seek(std::io::SeekFrom::Start(0))
28644                .unwrap();
28645            let mut req_result = {
28646                let client = &self.hub.client;
28647                dlg.pre_request();
28648                let mut req_builder = hyper::Request::builder()
28649                    .method(hyper::Method::POST)
28650                    .uri(url.as_str())
28651                    .header(USER_AGENT, self.hub._user_agent.clone());
28652
28653                if let Some(token) = token.as_ref() {
28654                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28655                }
28656
28657                let request = req_builder
28658                    .header(CONTENT_TYPE, json_mime_type.to_string())
28659                    .header(CONTENT_LENGTH, request_size as u64)
28660                    .body(common::to_body(
28661                        request_value_reader.get_ref().clone().into(),
28662                    ));
28663
28664                client.request(request.unwrap()).await
28665            };
28666
28667            match req_result {
28668                Err(err) => {
28669                    if let common::Retry::After(d) = dlg.http_error(&err) {
28670                        sleep(d).await;
28671                        continue;
28672                    }
28673                    dlg.finished(false);
28674                    return Err(common::Error::HttpError(err));
28675                }
28676                Ok(res) => {
28677                    let (mut parts, body) = res.into_parts();
28678                    let mut body = common::Body::new(body);
28679                    if !parts.status.is_success() {
28680                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28681                        let error = serde_json::from_str(&common::to_string(&bytes));
28682                        let response = common::to_response(parts, bytes.into());
28683
28684                        if let common::Retry::After(d) =
28685                            dlg.http_failure(&response, error.as_ref().ok())
28686                        {
28687                            sleep(d).await;
28688                            continue;
28689                        }
28690
28691                        dlg.finished(false);
28692
28693                        return Err(match error {
28694                            Ok(value) => common::Error::BadRequest(value),
28695                            _ => common::Error::Failure(response),
28696                        });
28697                    }
28698                    let response = {
28699                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28700                        let encoded = common::to_string(&bytes);
28701                        match serde_json::from_str(&encoded) {
28702                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28703                            Err(error) => {
28704                                dlg.response_json_decode_error(&encoded, &error);
28705                                return Err(common::Error::JsonDecodeError(
28706                                    encoded.to_string(),
28707                                    error,
28708                                ));
28709                            }
28710                        }
28711                    };
28712
28713                    dlg.finished(true);
28714                    return Ok(response);
28715                }
28716            }
28717        }
28718    }
28719
28720    ///
28721    /// Sets the *request* property to the given value.
28722    ///
28723    /// Even though the property as already been set when instantiating this call,
28724    /// we provide this method for API completeness.
28725    pub fn request(mut self, new_value: LocationList) -> AdvertiserLocationListCreateCall<'a, C> {
28726        self._request = new_value;
28727        self
28728    }
28729    /// Required. The ID of the DV360 advertiser to which the location list belongs.
28730    ///
28731    /// Sets the *advertiser id* path property to the given value.
28732    ///
28733    /// Even though the property as already been set when instantiating this call,
28734    /// we provide this method for API completeness.
28735    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserLocationListCreateCall<'a, C> {
28736        self._advertiser_id = new_value;
28737        self
28738    }
28739    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28740    /// while executing the actual API request.
28741    ///
28742    /// ````text
28743    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28744    /// ````
28745    ///
28746    /// Sets the *delegate* property to the given value.
28747    pub fn delegate(
28748        mut self,
28749        new_value: &'a mut dyn common::Delegate,
28750    ) -> AdvertiserLocationListCreateCall<'a, C> {
28751        self._delegate = Some(new_value);
28752        self
28753    }
28754
28755    /// Set any additional parameter of the query string used in the request.
28756    /// It should be used to set parameters which are not yet available through their own
28757    /// setters.
28758    ///
28759    /// Please note that this method must not be used to set any of the known parameters
28760    /// which have their own setter method. If done anyway, the request will fail.
28761    ///
28762    /// # Additional Parameters
28763    ///
28764    /// * *$.xgafv* (query-string) - V1 error format.
28765    /// * *access_token* (query-string) - OAuth access token.
28766    /// * *alt* (query-string) - Data format for response.
28767    /// * *callback* (query-string) - JSONP
28768    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28769    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
28770    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28771    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28772    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
28773    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28774    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28775    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserLocationListCreateCall<'a, C>
28776    where
28777        T: AsRef<str>,
28778    {
28779        self._additional_params
28780            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28781        self
28782    }
28783
28784    /// Identifies the authorization scope for the method you are building.
28785    ///
28786    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28787    /// [`Scope::DisplayVideo`].
28788    ///
28789    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28790    /// tokens for more than one scope.
28791    ///
28792    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28793    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28794    /// sufficient, a read-write scope will do as well.
28795    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserLocationListCreateCall<'a, C>
28796    where
28797        St: AsRef<str>,
28798    {
28799        self._scopes.insert(String::from(scope.as_ref()));
28800        self
28801    }
28802    /// Identifies the authorization scope(s) for the method you are building.
28803    ///
28804    /// See [`Self::add_scope()`] for details.
28805    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserLocationListCreateCall<'a, C>
28806    where
28807        I: IntoIterator<Item = St>,
28808        St: AsRef<str>,
28809    {
28810        self._scopes
28811            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28812        self
28813    }
28814
28815    /// Removes all scopes, and no default scope will be used either.
28816    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28817    /// for details).
28818    pub fn clear_scopes(mut self) -> AdvertiserLocationListCreateCall<'a, C> {
28819        self._scopes.clear();
28820        self
28821    }
28822}
28823
28824/// Gets a location list.
28825///
28826/// A builder for the *locationLists.get* method supported by a *advertiser* resource.
28827/// It is not used directly, but through a [`AdvertiserMethods`] instance.
28828///
28829/// # Example
28830///
28831/// Instantiate a resource method builder
28832///
28833/// ```test_harness,no_run
28834/// # extern crate hyper;
28835/// # extern crate hyper_rustls;
28836/// # extern crate google_displayvideo1 as displayvideo1;
28837/// # async fn dox() {
28838/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28839///
28840/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28841/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28842/// #     secret,
28843/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28844/// # ).build().await.unwrap();
28845///
28846/// # let client = hyper_util::client::legacy::Client::builder(
28847/// #     hyper_util::rt::TokioExecutor::new()
28848/// # )
28849/// # .build(
28850/// #     hyper_rustls::HttpsConnectorBuilder::new()
28851/// #         .with_native_roots()
28852/// #         .unwrap()
28853/// #         .https_or_http()
28854/// #         .enable_http1()
28855/// #         .build()
28856/// # );
28857/// # let mut hub = DisplayVideo::new(client, auth);
28858/// // You can configure optional parameters by calling the respective setters at will, and
28859/// // execute the final call using `doit()`.
28860/// // Values shown here are possibly random and not representative !
28861/// let result = hub.advertisers().location_lists_get(-77, -19)
28862///              .doit().await;
28863/// # }
28864/// ```
28865pub struct AdvertiserLocationListGetCall<'a, C>
28866where
28867    C: 'a,
28868{
28869    hub: &'a DisplayVideo<C>,
28870    _advertiser_id: i64,
28871    _location_list_id: i64,
28872    _delegate: Option<&'a mut dyn common::Delegate>,
28873    _additional_params: HashMap<String, String>,
28874    _scopes: BTreeSet<String>,
28875}
28876
28877impl<'a, C> common::CallBuilder for AdvertiserLocationListGetCall<'a, C> {}
28878
28879impl<'a, C> AdvertiserLocationListGetCall<'a, C>
28880where
28881    C: common::Connector,
28882{
28883    /// Perform the operation you have build so far.
28884    pub async fn doit(mut self) -> common::Result<(common::Response, LocationList)> {
28885        use std::borrow::Cow;
28886        use std::io::{Read, Seek};
28887
28888        use common::{url::Params, ToParts};
28889        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28890
28891        let mut dd = common::DefaultDelegate;
28892        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28893        dlg.begin(common::MethodInfo {
28894            id: "displayvideo.advertisers.locationLists.get",
28895            http_method: hyper::Method::GET,
28896        });
28897
28898        for &field in ["alt", "advertiserId", "locationListId"].iter() {
28899            if self._additional_params.contains_key(field) {
28900                dlg.finished(false);
28901                return Err(common::Error::FieldClash(field));
28902            }
28903        }
28904
28905        let mut params = Params::with_capacity(4 + self._additional_params.len());
28906        params.push("advertiserId", self._advertiser_id.to_string());
28907        params.push("locationListId", self._location_list_id.to_string());
28908
28909        params.extend(self._additional_params.iter());
28910
28911        params.push("alt", "json");
28912        let mut url = self.hub._base_url.clone()
28913            + "v1/advertisers/{+advertiserId}/locationLists/{+locationListId}";
28914        if self._scopes.is_empty() {
28915            self._scopes
28916                .insert(Scope::DisplayVideo.as_ref().to_string());
28917        }
28918
28919        #[allow(clippy::single_element_loop)]
28920        for &(find_this, param_name) in [
28921            ("{+advertiserId}", "advertiserId"),
28922            ("{+locationListId}", "locationListId"),
28923        ]
28924        .iter()
28925        {
28926            url = params.uri_replacement(url, param_name, find_this, true);
28927        }
28928        {
28929            let to_remove = ["locationListId", "advertiserId"];
28930            params.remove_params(&to_remove);
28931        }
28932
28933        let url = params.parse_with_url(&url);
28934
28935        loop {
28936            let token = match self
28937                .hub
28938                .auth
28939                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28940                .await
28941            {
28942                Ok(token) => token,
28943                Err(e) => match dlg.token(e) {
28944                    Ok(token) => token,
28945                    Err(e) => {
28946                        dlg.finished(false);
28947                        return Err(common::Error::MissingToken(e));
28948                    }
28949                },
28950            };
28951            let mut req_result = {
28952                let client = &self.hub.client;
28953                dlg.pre_request();
28954                let mut req_builder = hyper::Request::builder()
28955                    .method(hyper::Method::GET)
28956                    .uri(url.as_str())
28957                    .header(USER_AGENT, self.hub._user_agent.clone());
28958
28959                if let Some(token) = token.as_ref() {
28960                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28961                }
28962
28963                let request = req_builder
28964                    .header(CONTENT_LENGTH, 0_u64)
28965                    .body(common::to_body::<String>(None));
28966
28967                client.request(request.unwrap()).await
28968            };
28969
28970            match req_result {
28971                Err(err) => {
28972                    if let common::Retry::After(d) = dlg.http_error(&err) {
28973                        sleep(d).await;
28974                        continue;
28975                    }
28976                    dlg.finished(false);
28977                    return Err(common::Error::HttpError(err));
28978                }
28979                Ok(res) => {
28980                    let (mut parts, body) = res.into_parts();
28981                    let mut body = common::Body::new(body);
28982                    if !parts.status.is_success() {
28983                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28984                        let error = serde_json::from_str(&common::to_string(&bytes));
28985                        let response = common::to_response(parts, bytes.into());
28986
28987                        if let common::Retry::After(d) =
28988                            dlg.http_failure(&response, error.as_ref().ok())
28989                        {
28990                            sleep(d).await;
28991                            continue;
28992                        }
28993
28994                        dlg.finished(false);
28995
28996                        return Err(match error {
28997                            Ok(value) => common::Error::BadRequest(value),
28998                            _ => common::Error::Failure(response),
28999                        });
29000                    }
29001                    let response = {
29002                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29003                        let encoded = common::to_string(&bytes);
29004                        match serde_json::from_str(&encoded) {
29005                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29006                            Err(error) => {
29007                                dlg.response_json_decode_error(&encoded, &error);
29008                                return Err(common::Error::JsonDecodeError(
29009                                    encoded.to_string(),
29010                                    error,
29011                                ));
29012                            }
29013                        }
29014                    };
29015
29016                    dlg.finished(true);
29017                    return Ok(response);
29018                }
29019            }
29020        }
29021    }
29022
29023    /// Required. The ID of the DV360 advertiser to which the fetched location list belongs.
29024    ///
29025    /// Sets the *advertiser id* path property to the given value.
29026    ///
29027    /// Even though the property as already been set when instantiating this call,
29028    /// we provide this method for API completeness.
29029    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserLocationListGetCall<'a, C> {
29030        self._advertiser_id = new_value;
29031        self
29032    }
29033    /// Required. The ID of the location list to fetch.
29034    ///
29035    /// Sets the *location list id* path property to the given value.
29036    ///
29037    /// Even though the property as already been set when instantiating this call,
29038    /// we provide this method for API completeness.
29039    pub fn location_list_id(mut self, new_value: i64) -> AdvertiserLocationListGetCall<'a, C> {
29040        self._location_list_id = new_value;
29041        self
29042    }
29043    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29044    /// while executing the actual API request.
29045    ///
29046    /// ````text
29047    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29048    /// ````
29049    ///
29050    /// Sets the *delegate* property to the given value.
29051    pub fn delegate(
29052        mut self,
29053        new_value: &'a mut dyn common::Delegate,
29054    ) -> AdvertiserLocationListGetCall<'a, C> {
29055        self._delegate = Some(new_value);
29056        self
29057    }
29058
29059    /// Set any additional parameter of the query string used in the request.
29060    /// It should be used to set parameters which are not yet available through their own
29061    /// setters.
29062    ///
29063    /// Please note that this method must not be used to set any of the known parameters
29064    /// which have their own setter method. If done anyway, the request will fail.
29065    ///
29066    /// # Additional Parameters
29067    ///
29068    /// * *$.xgafv* (query-string) - V1 error format.
29069    /// * *access_token* (query-string) - OAuth access token.
29070    /// * *alt* (query-string) - Data format for response.
29071    /// * *callback* (query-string) - JSONP
29072    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29073    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
29074    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29075    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29076    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
29077    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29078    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29079    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserLocationListGetCall<'a, C>
29080    where
29081        T: AsRef<str>,
29082    {
29083        self._additional_params
29084            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29085        self
29086    }
29087
29088    /// Identifies the authorization scope for the method you are building.
29089    ///
29090    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29091    /// [`Scope::DisplayVideo`].
29092    ///
29093    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29094    /// tokens for more than one scope.
29095    ///
29096    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29097    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29098    /// sufficient, a read-write scope will do as well.
29099    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserLocationListGetCall<'a, C>
29100    where
29101        St: AsRef<str>,
29102    {
29103        self._scopes.insert(String::from(scope.as_ref()));
29104        self
29105    }
29106    /// Identifies the authorization scope(s) for the method you are building.
29107    ///
29108    /// See [`Self::add_scope()`] for details.
29109    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserLocationListGetCall<'a, C>
29110    where
29111        I: IntoIterator<Item = St>,
29112        St: AsRef<str>,
29113    {
29114        self._scopes
29115            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29116        self
29117    }
29118
29119    /// Removes all scopes, and no default scope will be used either.
29120    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29121    /// for details).
29122    pub fn clear_scopes(mut self) -> AdvertiserLocationListGetCall<'a, C> {
29123        self._scopes.clear();
29124        self
29125    }
29126}
29127
29128/// Lists location lists based on a given advertiser id.
29129///
29130/// A builder for the *locationLists.list* method supported by a *advertiser* resource.
29131/// It is not used directly, but through a [`AdvertiserMethods`] instance.
29132///
29133/// # Example
29134///
29135/// Instantiate a resource method builder
29136///
29137/// ```test_harness,no_run
29138/// # extern crate hyper;
29139/// # extern crate hyper_rustls;
29140/// # extern crate google_displayvideo1 as displayvideo1;
29141/// # async fn dox() {
29142/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29143///
29144/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29145/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29146/// #     secret,
29147/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29148/// # ).build().await.unwrap();
29149///
29150/// # let client = hyper_util::client::legacy::Client::builder(
29151/// #     hyper_util::rt::TokioExecutor::new()
29152/// # )
29153/// # .build(
29154/// #     hyper_rustls::HttpsConnectorBuilder::new()
29155/// #         .with_native_roots()
29156/// #         .unwrap()
29157/// #         .https_or_http()
29158/// #         .enable_http1()
29159/// #         .build()
29160/// # );
29161/// # let mut hub = DisplayVideo::new(client, auth);
29162/// // You can configure optional parameters by calling the respective setters at will, and
29163/// // execute the final call using `doit()`.
29164/// // Values shown here are possibly random and not representative !
29165/// let result = hub.advertisers().location_lists_list(-46)
29166///              .page_token("gubergren")
29167///              .page_size(-4)
29168///              .order_by("aliquyam")
29169///              .filter("no")
29170///              .doit().await;
29171/// # }
29172/// ```
29173pub struct AdvertiserLocationListListCall<'a, C>
29174where
29175    C: 'a,
29176{
29177    hub: &'a DisplayVideo<C>,
29178    _advertiser_id: i64,
29179    _page_token: Option<String>,
29180    _page_size: Option<i32>,
29181    _order_by: Option<String>,
29182    _filter: Option<String>,
29183    _delegate: Option<&'a mut dyn common::Delegate>,
29184    _additional_params: HashMap<String, String>,
29185    _scopes: BTreeSet<String>,
29186}
29187
29188impl<'a, C> common::CallBuilder for AdvertiserLocationListListCall<'a, C> {}
29189
29190impl<'a, C> AdvertiserLocationListListCall<'a, C>
29191where
29192    C: common::Connector,
29193{
29194    /// Perform the operation you have build so far.
29195    pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationListsResponse)> {
29196        use std::borrow::Cow;
29197        use std::io::{Read, Seek};
29198
29199        use common::{url::Params, ToParts};
29200        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29201
29202        let mut dd = common::DefaultDelegate;
29203        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29204        dlg.begin(common::MethodInfo {
29205            id: "displayvideo.advertisers.locationLists.list",
29206            http_method: hyper::Method::GET,
29207        });
29208
29209        for &field in [
29210            "alt",
29211            "advertiserId",
29212            "pageToken",
29213            "pageSize",
29214            "orderBy",
29215            "filter",
29216        ]
29217        .iter()
29218        {
29219            if self._additional_params.contains_key(field) {
29220                dlg.finished(false);
29221                return Err(common::Error::FieldClash(field));
29222            }
29223        }
29224
29225        let mut params = Params::with_capacity(7 + self._additional_params.len());
29226        params.push("advertiserId", self._advertiser_id.to_string());
29227        if let Some(value) = self._page_token.as_ref() {
29228            params.push("pageToken", value);
29229        }
29230        if let Some(value) = self._page_size.as_ref() {
29231            params.push("pageSize", value.to_string());
29232        }
29233        if let Some(value) = self._order_by.as_ref() {
29234            params.push("orderBy", value);
29235        }
29236        if let Some(value) = self._filter.as_ref() {
29237            params.push("filter", value);
29238        }
29239
29240        params.extend(self._additional_params.iter());
29241
29242        params.push("alt", "json");
29243        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/locationLists";
29244        if self._scopes.is_empty() {
29245            self._scopes
29246                .insert(Scope::DisplayVideo.as_ref().to_string());
29247        }
29248
29249        #[allow(clippy::single_element_loop)]
29250        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
29251            url = params.uri_replacement(url, param_name, find_this, true);
29252        }
29253        {
29254            let to_remove = ["advertiserId"];
29255            params.remove_params(&to_remove);
29256        }
29257
29258        let url = params.parse_with_url(&url);
29259
29260        loop {
29261            let token = match self
29262                .hub
29263                .auth
29264                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29265                .await
29266            {
29267                Ok(token) => token,
29268                Err(e) => match dlg.token(e) {
29269                    Ok(token) => token,
29270                    Err(e) => {
29271                        dlg.finished(false);
29272                        return Err(common::Error::MissingToken(e));
29273                    }
29274                },
29275            };
29276            let mut req_result = {
29277                let client = &self.hub.client;
29278                dlg.pre_request();
29279                let mut req_builder = hyper::Request::builder()
29280                    .method(hyper::Method::GET)
29281                    .uri(url.as_str())
29282                    .header(USER_AGENT, self.hub._user_agent.clone());
29283
29284                if let Some(token) = token.as_ref() {
29285                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29286                }
29287
29288                let request = req_builder
29289                    .header(CONTENT_LENGTH, 0_u64)
29290                    .body(common::to_body::<String>(None));
29291
29292                client.request(request.unwrap()).await
29293            };
29294
29295            match req_result {
29296                Err(err) => {
29297                    if let common::Retry::After(d) = dlg.http_error(&err) {
29298                        sleep(d).await;
29299                        continue;
29300                    }
29301                    dlg.finished(false);
29302                    return Err(common::Error::HttpError(err));
29303                }
29304                Ok(res) => {
29305                    let (mut parts, body) = res.into_parts();
29306                    let mut body = common::Body::new(body);
29307                    if !parts.status.is_success() {
29308                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29309                        let error = serde_json::from_str(&common::to_string(&bytes));
29310                        let response = common::to_response(parts, bytes.into());
29311
29312                        if let common::Retry::After(d) =
29313                            dlg.http_failure(&response, error.as_ref().ok())
29314                        {
29315                            sleep(d).await;
29316                            continue;
29317                        }
29318
29319                        dlg.finished(false);
29320
29321                        return Err(match error {
29322                            Ok(value) => common::Error::BadRequest(value),
29323                            _ => common::Error::Failure(response),
29324                        });
29325                    }
29326                    let response = {
29327                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29328                        let encoded = common::to_string(&bytes);
29329                        match serde_json::from_str(&encoded) {
29330                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29331                            Err(error) => {
29332                                dlg.response_json_decode_error(&encoded, &error);
29333                                return Err(common::Error::JsonDecodeError(
29334                                    encoded.to_string(),
29335                                    error,
29336                                ));
29337                            }
29338                        }
29339                    };
29340
29341                    dlg.finished(true);
29342                    return Ok(response);
29343                }
29344            }
29345        }
29346    }
29347
29348    /// Required. The ID of the DV360 advertiser to which the fetched location lists belong.
29349    ///
29350    /// Sets the *advertiser id* path property to the given value.
29351    ///
29352    /// Even though the property as already been set when instantiating this call,
29353    /// we provide this method for API completeness.
29354    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserLocationListListCall<'a, C> {
29355        self._advertiser_id = new_value;
29356        self
29357    }
29358    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListLocationLists` method. If not specified, the first page of results will be returned.
29359    ///
29360    /// Sets the *page token* query property to the given value.
29361    pub fn page_token(mut self, new_value: &str) -> AdvertiserLocationListListCall<'a, C> {
29362        self._page_token = Some(new_value.to_string());
29363        self
29364    }
29365    /// Requested page size. Must be between `1` and `200`. Defaults to `100` if not set. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
29366    ///
29367    /// Sets the *page size* query property to the given value.
29368    pub fn page_size(mut self, new_value: i32) -> AdvertiserLocationListListCall<'a, C> {
29369        self._page_size = Some(new_value);
29370        self
29371    }
29372    /// Field by which to sort the list. Acceptable values are: * `locationListId` (default) * `displayName` The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `displayName desc`.
29373    ///
29374    /// Sets the *order by* query property to the given value.
29375    pub fn order_by(mut self, new_value: &str) -> AdvertiserLocationListListCall<'a, C> {
29376        self._order_by = Some(new_value.to_string());
29377        self
29378    }
29379    /// Allows filtering by location list fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by `AND` or `OR` logical operators. A sequence of restrictions implicitly uses `AND`. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `EQUALS (=)` operator. Supported fields: * `locationType` Examples: * All regional location list: `locationType="TARGETING_LOCATION_TYPE_REGIONAL"` * All proximity location list: `locationType="TARGETING_LOCATION_TYPE_PROXIMITY"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
29380    ///
29381    /// Sets the *filter* query property to the given value.
29382    pub fn filter(mut self, new_value: &str) -> AdvertiserLocationListListCall<'a, C> {
29383        self._filter = Some(new_value.to_string());
29384        self
29385    }
29386    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29387    /// while executing the actual API request.
29388    ///
29389    /// ````text
29390    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29391    /// ````
29392    ///
29393    /// Sets the *delegate* property to the given value.
29394    pub fn delegate(
29395        mut self,
29396        new_value: &'a mut dyn common::Delegate,
29397    ) -> AdvertiserLocationListListCall<'a, C> {
29398        self._delegate = Some(new_value);
29399        self
29400    }
29401
29402    /// Set any additional parameter of the query string used in the request.
29403    /// It should be used to set parameters which are not yet available through their own
29404    /// setters.
29405    ///
29406    /// Please note that this method must not be used to set any of the known parameters
29407    /// which have their own setter method. If done anyway, the request will fail.
29408    ///
29409    /// # Additional Parameters
29410    ///
29411    /// * *$.xgafv* (query-string) - V1 error format.
29412    /// * *access_token* (query-string) - OAuth access token.
29413    /// * *alt* (query-string) - Data format for response.
29414    /// * *callback* (query-string) - JSONP
29415    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29416    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
29417    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29418    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29419    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
29420    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29421    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29422    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserLocationListListCall<'a, C>
29423    where
29424        T: AsRef<str>,
29425    {
29426        self._additional_params
29427            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29428        self
29429    }
29430
29431    /// Identifies the authorization scope for the method you are building.
29432    ///
29433    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29434    /// [`Scope::DisplayVideo`].
29435    ///
29436    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29437    /// tokens for more than one scope.
29438    ///
29439    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29440    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29441    /// sufficient, a read-write scope will do as well.
29442    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserLocationListListCall<'a, C>
29443    where
29444        St: AsRef<str>,
29445    {
29446        self._scopes.insert(String::from(scope.as_ref()));
29447        self
29448    }
29449    /// Identifies the authorization scope(s) for the method you are building.
29450    ///
29451    /// See [`Self::add_scope()`] for details.
29452    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserLocationListListCall<'a, C>
29453    where
29454        I: IntoIterator<Item = St>,
29455        St: AsRef<str>,
29456    {
29457        self._scopes
29458            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29459        self
29460    }
29461
29462    /// Removes all scopes, and no default scope will be used either.
29463    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29464    /// for details).
29465    pub fn clear_scopes(mut self) -> AdvertiserLocationListListCall<'a, C> {
29466        self._scopes.clear();
29467        self
29468    }
29469}
29470
29471/// Updates a location list. Returns the updated location list if successful.
29472///
29473/// A builder for the *locationLists.patch* method supported by a *advertiser* resource.
29474/// It is not used directly, but through a [`AdvertiserMethods`] instance.
29475///
29476/// # Example
29477///
29478/// Instantiate a resource method builder
29479///
29480/// ```test_harness,no_run
29481/// # extern crate hyper;
29482/// # extern crate hyper_rustls;
29483/// # extern crate google_displayvideo1 as displayvideo1;
29484/// use displayvideo1::api::LocationList;
29485/// # async fn dox() {
29486/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29487///
29488/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29489/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29490/// #     secret,
29491/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29492/// # ).build().await.unwrap();
29493///
29494/// # let client = hyper_util::client::legacy::Client::builder(
29495/// #     hyper_util::rt::TokioExecutor::new()
29496/// # )
29497/// # .build(
29498/// #     hyper_rustls::HttpsConnectorBuilder::new()
29499/// #         .with_native_roots()
29500/// #         .unwrap()
29501/// #         .https_or_http()
29502/// #         .enable_http1()
29503/// #         .build()
29504/// # );
29505/// # let mut hub = DisplayVideo::new(client, auth);
29506/// // As the method needs a request, you would usually fill it with the desired information
29507/// // into the respective structure. Some of the parts shown here might not be applicable !
29508/// // Values shown here are possibly random and not representative !
29509/// let mut req = LocationList::default();
29510///
29511/// // You can configure optional parameters by calling the respective setters at will, and
29512/// // execute the final call using `doit()`.
29513/// // Values shown here are possibly random and not representative !
29514/// let result = hub.advertisers().location_lists_patch(req, -2, -50)
29515///              .update_mask(FieldMask::new::<&str>(&[]))
29516///              .doit().await;
29517/// # }
29518/// ```
29519pub struct AdvertiserLocationListPatchCall<'a, C>
29520where
29521    C: 'a,
29522{
29523    hub: &'a DisplayVideo<C>,
29524    _request: LocationList,
29525    _advertiser_id: i64,
29526    _location_list_id: i64,
29527    _update_mask: Option<common::FieldMask>,
29528    _delegate: Option<&'a mut dyn common::Delegate>,
29529    _additional_params: HashMap<String, String>,
29530    _scopes: BTreeSet<String>,
29531}
29532
29533impl<'a, C> common::CallBuilder for AdvertiserLocationListPatchCall<'a, C> {}
29534
29535impl<'a, C> AdvertiserLocationListPatchCall<'a, C>
29536where
29537    C: common::Connector,
29538{
29539    /// Perform the operation you have build so far.
29540    pub async fn doit(mut self) -> common::Result<(common::Response, LocationList)> {
29541        use std::borrow::Cow;
29542        use std::io::{Read, Seek};
29543
29544        use common::{url::Params, ToParts};
29545        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29546
29547        let mut dd = common::DefaultDelegate;
29548        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29549        dlg.begin(common::MethodInfo {
29550            id: "displayvideo.advertisers.locationLists.patch",
29551            http_method: hyper::Method::PATCH,
29552        });
29553
29554        for &field in ["alt", "advertiserId", "locationListId", "updateMask"].iter() {
29555            if self._additional_params.contains_key(field) {
29556                dlg.finished(false);
29557                return Err(common::Error::FieldClash(field));
29558            }
29559        }
29560
29561        let mut params = Params::with_capacity(6 + self._additional_params.len());
29562        params.push("advertiserId", self._advertiser_id.to_string());
29563        params.push("locationListId", self._location_list_id.to_string());
29564        if let Some(value) = self._update_mask.as_ref() {
29565            params.push("updateMask", value.to_string());
29566        }
29567
29568        params.extend(self._additional_params.iter());
29569
29570        params.push("alt", "json");
29571        let mut url = self.hub._base_url.clone()
29572            + "v1/advertisers/{+advertiserId}/locationLists/{locationListId}";
29573        if self._scopes.is_empty() {
29574            self._scopes
29575                .insert(Scope::DisplayVideo.as_ref().to_string());
29576        }
29577
29578        #[allow(clippy::single_element_loop)]
29579        for &(find_this, param_name) in [
29580            ("{+advertiserId}", "advertiserId"),
29581            ("{locationListId}", "locationListId"),
29582        ]
29583        .iter()
29584        {
29585            url = params.uri_replacement(url, param_name, find_this, true);
29586        }
29587        {
29588            let to_remove = ["locationListId", "advertiserId"];
29589            params.remove_params(&to_remove);
29590        }
29591
29592        let url = params.parse_with_url(&url);
29593
29594        let mut json_mime_type = mime::APPLICATION_JSON;
29595        let mut request_value_reader = {
29596            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29597            common::remove_json_null_values(&mut value);
29598            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29599            serde_json::to_writer(&mut dst, &value).unwrap();
29600            dst
29601        };
29602        let request_size = request_value_reader
29603            .seek(std::io::SeekFrom::End(0))
29604            .unwrap();
29605        request_value_reader
29606            .seek(std::io::SeekFrom::Start(0))
29607            .unwrap();
29608
29609        loop {
29610            let token = match self
29611                .hub
29612                .auth
29613                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29614                .await
29615            {
29616                Ok(token) => token,
29617                Err(e) => match dlg.token(e) {
29618                    Ok(token) => token,
29619                    Err(e) => {
29620                        dlg.finished(false);
29621                        return Err(common::Error::MissingToken(e));
29622                    }
29623                },
29624            };
29625            request_value_reader
29626                .seek(std::io::SeekFrom::Start(0))
29627                .unwrap();
29628            let mut req_result = {
29629                let client = &self.hub.client;
29630                dlg.pre_request();
29631                let mut req_builder = hyper::Request::builder()
29632                    .method(hyper::Method::PATCH)
29633                    .uri(url.as_str())
29634                    .header(USER_AGENT, self.hub._user_agent.clone());
29635
29636                if let Some(token) = token.as_ref() {
29637                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29638                }
29639
29640                let request = req_builder
29641                    .header(CONTENT_TYPE, json_mime_type.to_string())
29642                    .header(CONTENT_LENGTH, request_size as u64)
29643                    .body(common::to_body(
29644                        request_value_reader.get_ref().clone().into(),
29645                    ));
29646
29647                client.request(request.unwrap()).await
29648            };
29649
29650            match req_result {
29651                Err(err) => {
29652                    if let common::Retry::After(d) = dlg.http_error(&err) {
29653                        sleep(d).await;
29654                        continue;
29655                    }
29656                    dlg.finished(false);
29657                    return Err(common::Error::HttpError(err));
29658                }
29659                Ok(res) => {
29660                    let (mut parts, body) = res.into_parts();
29661                    let mut body = common::Body::new(body);
29662                    if !parts.status.is_success() {
29663                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29664                        let error = serde_json::from_str(&common::to_string(&bytes));
29665                        let response = common::to_response(parts, bytes.into());
29666
29667                        if let common::Retry::After(d) =
29668                            dlg.http_failure(&response, error.as_ref().ok())
29669                        {
29670                            sleep(d).await;
29671                            continue;
29672                        }
29673
29674                        dlg.finished(false);
29675
29676                        return Err(match error {
29677                            Ok(value) => common::Error::BadRequest(value),
29678                            _ => common::Error::Failure(response),
29679                        });
29680                    }
29681                    let response = {
29682                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29683                        let encoded = common::to_string(&bytes);
29684                        match serde_json::from_str(&encoded) {
29685                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29686                            Err(error) => {
29687                                dlg.response_json_decode_error(&encoded, &error);
29688                                return Err(common::Error::JsonDecodeError(
29689                                    encoded.to_string(),
29690                                    error,
29691                                ));
29692                            }
29693                        }
29694                    };
29695
29696                    dlg.finished(true);
29697                    return Ok(response);
29698                }
29699            }
29700        }
29701    }
29702
29703    ///
29704    /// Sets the *request* property to the given value.
29705    ///
29706    /// Even though the property as already been set when instantiating this call,
29707    /// we provide this method for API completeness.
29708    pub fn request(mut self, new_value: LocationList) -> AdvertiserLocationListPatchCall<'a, C> {
29709        self._request = new_value;
29710        self
29711    }
29712    /// Required. The ID of the DV360 advertiser to which the location lists belongs.
29713    ///
29714    /// Sets the *advertiser id* path property to the given value.
29715    ///
29716    /// Even though the property as already been set when instantiating this call,
29717    /// we provide this method for API completeness.
29718    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserLocationListPatchCall<'a, C> {
29719        self._advertiser_id = new_value;
29720        self
29721    }
29722    /// Output only. The unique ID of the location list. Assigned by the system.
29723    ///
29724    /// Sets the *location list id* path property to the given value.
29725    ///
29726    /// Even though the property as already been set when instantiating this call,
29727    /// we provide this method for API completeness.
29728    pub fn location_list_id(mut self, new_value: i64) -> AdvertiserLocationListPatchCall<'a, C> {
29729        self._location_list_id = new_value;
29730        self
29731    }
29732    /// Required. The mask to control which fields to update.
29733    ///
29734    /// Sets the *update mask* query property to the given value.
29735    pub fn update_mask(
29736        mut self,
29737        new_value: common::FieldMask,
29738    ) -> AdvertiserLocationListPatchCall<'a, C> {
29739        self._update_mask = Some(new_value);
29740        self
29741    }
29742    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29743    /// while executing the actual API request.
29744    ///
29745    /// ````text
29746    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29747    /// ````
29748    ///
29749    /// Sets the *delegate* property to the given value.
29750    pub fn delegate(
29751        mut self,
29752        new_value: &'a mut dyn common::Delegate,
29753    ) -> AdvertiserLocationListPatchCall<'a, C> {
29754        self._delegate = Some(new_value);
29755        self
29756    }
29757
29758    /// Set any additional parameter of the query string used in the request.
29759    /// It should be used to set parameters which are not yet available through their own
29760    /// setters.
29761    ///
29762    /// Please note that this method must not be used to set any of the known parameters
29763    /// which have their own setter method. If done anyway, the request will fail.
29764    ///
29765    /// # Additional Parameters
29766    ///
29767    /// * *$.xgafv* (query-string) - V1 error format.
29768    /// * *access_token* (query-string) - OAuth access token.
29769    /// * *alt* (query-string) - Data format for response.
29770    /// * *callback* (query-string) - JSONP
29771    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29772    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
29773    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29774    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29775    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
29776    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29777    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29778    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserLocationListPatchCall<'a, C>
29779    where
29780        T: AsRef<str>,
29781    {
29782        self._additional_params
29783            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29784        self
29785    }
29786
29787    /// Identifies the authorization scope for the method you are building.
29788    ///
29789    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29790    /// [`Scope::DisplayVideo`].
29791    ///
29792    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29793    /// tokens for more than one scope.
29794    ///
29795    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29796    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29797    /// sufficient, a read-write scope will do as well.
29798    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserLocationListPatchCall<'a, C>
29799    where
29800        St: AsRef<str>,
29801    {
29802        self._scopes.insert(String::from(scope.as_ref()));
29803        self
29804    }
29805    /// Identifies the authorization scope(s) for the method you are building.
29806    ///
29807    /// See [`Self::add_scope()`] for details.
29808    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserLocationListPatchCall<'a, C>
29809    where
29810        I: IntoIterator<Item = St>,
29811        St: AsRef<str>,
29812    {
29813        self._scopes
29814            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29815        self
29816    }
29817
29818    /// Removes all scopes, and no default scope will be used either.
29819    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29820    /// for details).
29821    pub fn clear_scopes(mut self) -> AdvertiserLocationListPatchCall<'a, C> {
29822        self._scopes.clear();
29823        self
29824    }
29825}
29826
29827/// Activates a manual trigger. Each activation of the manual trigger must be at least 5 minutes apart, otherwise an error will be returned. **Warning:** Line Items using manual triggers no longer serve in Display & Video 360. This method will sunset on August 1, 2023. Read our [feature deprecation announcement](https://developers.google.com/display-video/api/deprecations#features.manual_triggers) for more information.
29828///
29829/// A builder for the *manualTriggers.activate* method supported by a *advertiser* resource.
29830/// It is not used directly, but through a [`AdvertiserMethods`] instance.
29831///
29832/// # Example
29833///
29834/// Instantiate a resource method builder
29835///
29836/// ```test_harness,no_run
29837/// # extern crate hyper;
29838/// # extern crate hyper_rustls;
29839/// # extern crate google_displayvideo1 as displayvideo1;
29840/// use displayvideo1::api::ActivateManualTriggerRequest;
29841/// # async fn dox() {
29842/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29843///
29844/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29845/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29846/// #     secret,
29847/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29848/// # ).build().await.unwrap();
29849///
29850/// # let client = hyper_util::client::legacy::Client::builder(
29851/// #     hyper_util::rt::TokioExecutor::new()
29852/// # )
29853/// # .build(
29854/// #     hyper_rustls::HttpsConnectorBuilder::new()
29855/// #         .with_native_roots()
29856/// #         .unwrap()
29857/// #         .https_or_http()
29858/// #         .enable_http1()
29859/// #         .build()
29860/// # );
29861/// # let mut hub = DisplayVideo::new(client, auth);
29862/// // As the method needs a request, you would usually fill it with the desired information
29863/// // into the respective structure. Some of the parts shown here might not be applicable !
29864/// // Values shown here are possibly random and not representative !
29865/// let mut req = ActivateManualTriggerRequest::default();
29866///
29867/// // You can configure optional parameters by calling the respective setters at will, and
29868/// // execute the final call using `doit()`.
29869/// // Values shown here are possibly random and not representative !
29870/// let result = hub.advertisers().manual_triggers_activate(req, -56, -73)
29871///              .doit().await;
29872/// # }
29873/// ```
29874pub struct AdvertiserManualTriggerActivateCall<'a, C>
29875where
29876    C: 'a,
29877{
29878    hub: &'a DisplayVideo<C>,
29879    _request: ActivateManualTriggerRequest,
29880    _advertiser_id: i64,
29881    _trigger_id: i64,
29882    _delegate: Option<&'a mut dyn common::Delegate>,
29883    _additional_params: HashMap<String, String>,
29884    _scopes: BTreeSet<String>,
29885}
29886
29887impl<'a, C> common::CallBuilder for AdvertiserManualTriggerActivateCall<'a, C> {}
29888
29889impl<'a, C> AdvertiserManualTriggerActivateCall<'a, C>
29890where
29891    C: common::Connector,
29892{
29893    /// Perform the operation you have build so far.
29894    pub async fn doit(mut self) -> common::Result<(common::Response, ManualTrigger)> {
29895        use std::borrow::Cow;
29896        use std::io::{Read, Seek};
29897
29898        use common::{url::Params, ToParts};
29899        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29900
29901        let mut dd = common::DefaultDelegate;
29902        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29903        dlg.begin(common::MethodInfo {
29904            id: "displayvideo.advertisers.manualTriggers.activate",
29905            http_method: hyper::Method::POST,
29906        });
29907
29908        for &field in ["alt", "advertiserId", "triggerId"].iter() {
29909            if self._additional_params.contains_key(field) {
29910                dlg.finished(false);
29911                return Err(common::Error::FieldClash(field));
29912            }
29913        }
29914
29915        let mut params = Params::with_capacity(5 + self._additional_params.len());
29916        params.push("advertiserId", self._advertiser_id.to_string());
29917        params.push("triggerId", self._trigger_id.to_string());
29918
29919        params.extend(self._additional_params.iter());
29920
29921        params.push("alt", "json");
29922        let mut url = self.hub._base_url.clone()
29923            + "v1/advertisers/{+advertiserId}/manualTriggers/{+triggerId}:activate";
29924        if self._scopes.is_empty() {
29925            self._scopes
29926                .insert(Scope::DisplayVideo.as_ref().to_string());
29927        }
29928
29929        #[allow(clippy::single_element_loop)]
29930        for &(find_this, param_name) in [
29931            ("{+advertiserId}", "advertiserId"),
29932            ("{+triggerId}", "triggerId"),
29933        ]
29934        .iter()
29935        {
29936            url = params.uri_replacement(url, param_name, find_this, true);
29937        }
29938        {
29939            let to_remove = ["triggerId", "advertiserId"];
29940            params.remove_params(&to_remove);
29941        }
29942
29943        let url = params.parse_with_url(&url);
29944
29945        let mut json_mime_type = mime::APPLICATION_JSON;
29946        let mut request_value_reader = {
29947            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29948            common::remove_json_null_values(&mut value);
29949            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29950            serde_json::to_writer(&mut dst, &value).unwrap();
29951            dst
29952        };
29953        let request_size = request_value_reader
29954            .seek(std::io::SeekFrom::End(0))
29955            .unwrap();
29956        request_value_reader
29957            .seek(std::io::SeekFrom::Start(0))
29958            .unwrap();
29959
29960        loop {
29961            let token = match self
29962                .hub
29963                .auth
29964                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29965                .await
29966            {
29967                Ok(token) => token,
29968                Err(e) => match dlg.token(e) {
29969                    Ok(token) => token,
29970                    Err(e) => {
29971                        dlg.finished(false);
29972                        return Err(common::Error::MissingToken(e));
29973                    }
29974                },
29975            };
29976            request_value_reader
29977                .seek(std::io::SeekFrom::Start(0))
29978                .unwrap();
29979            let mut req_result = {
29980                let client = &self.hub.client;
29981                dlg.pre_request();
29982                let mut req_builder = hyper::Request::builder()
29983                    .method(hyper::Method::POST)
29984                    .uri(url.as_str())
29985                    .header(USER_AGENT, self.hub._user_agent.clone());
29986
29987                if let Some(token) = token.as_ref() {
29988                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29989                }
29990
29991                let request = req_builder
29992                    .header(CONTENT_TYPE, json_mime_type.to_string())
29993                    .header(CONTENT_LENGTH, request_size as u64)
29994                    .body(common::to_body(
29995                        request_value_reader.get_ref().clone().into(),
29996                    ));
29997
29998                client.request(request.unwrap()).await
29999            };
30000
30001            match req_result {
30002                Err(err) => {
30003                    if let common::Retry::After(d) = dlg.http_error(&err) {
30004                        sleep(d).await;
30005                        continue;
30006                    }
30007                    dlg.finished(false);
30008                    return Err(common::Error::HttpError(err));
30009                }
30010                Ok(res) => {
30011                    let (mut parts, body) = res.into_parts();
30012                    let mut body = common::Body::new(body);
30013                    if !parts.status.is_success() {
30014                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30015                        let error = serde_json::from_str(&common::to_string(&bytes));
30016                        let response = common::to_response(parts, bytes.into());
30017
30018                        if let common::Retry::After(d) =
30019                            dlg.http_failure(&response, error.as_ref().ok())
30020                        {
30021                            sleep(d).await;
30022                            continue;
30023                        }
30024
30025                        dlg.finished(false);
30026
30027                        return Err(match error {
30028                            Ok(value) => common::Error::BadRequest(value),
30029                            _ => common::Error::Failure(response),
30030                        });
30031                    }
30032                    let response = {
30033                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30034                        let encoded = common::to_string(&bytes);
30035                        match serde_json::from_str(&encoded) {
30036                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30037                            Err(error) => {
30038                                dlg.response_json_decode_error(&encoded, &error);
30039                                return Err(common::Error::JsonDecodeError(
30040                                    encoded.to_string(),
30041                                    error,
30042                                ));
30043                            }
30044                        }
30045                    };
30046
30047                    dlg.finished(true);
30048                    return Ok(response);
30049                }
30050            }
30051        }
30052    }
30053
30054    ///
30055    /// Sets the *request* property to the given value.
30056    ///
30057    /// Even though the property as already been set when instantiating this call,
30058    /// we provide this method for API completeness.
30059    pub fn request(
30060        mut self,
30061        new_value: ActivateManualTriggerRequest,
30062    ) -> AdvertiserManualTriggerActivateCall<'a, C> {
30063        self._request = new_value;
30064        self
30065    }
30066    /// Required. The ID of the advertiser that the manual trigger belongs.
30067    ///
30068    /// Sets the *advertiser id* path property to the given value.
30069    ///
30070    /// Even though the property as already been set when instantiating this call,
30071    /// we provide this method for API completeness.
30072    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserManualTriggerActivateCall<'a, C> {
30073        self._advertiser_id = new_value;
30074        self
30075    }
30076    /// Required. The ID of the manual trigger to activate.
30077    ///
30078    /// Sets the *trigger id* path property to the given value.
30079    ///
30080    /// Even though the property as already been set when instantiating this call,
30081    /// we provide this method for API completeness.
30082    pub fn trigger_id(mut self, new_value: i64) -> AdvertiserManualTriggerActivateCall<'a, C> {
30083        self._trigger_id = new_value;
30084        self
30085    }
30086    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30087    /// while executing the actual API request.
30088    ///
30089    /// ````text
30090    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30091    /// ````
30092    ///
30093    /// Sets the *delegate* property to the given value.
30094    pub fn delegate(
30095        mut self,
30096        new_value: &'a mut dyn common::Delegate,
30097    ) -> AdvertiserManualTriggerActivateCall<'a, C> {
30098        self._delegate = Some(new_value);
30099        self
30100    }
30101
30102    /// Set any additional parameter of the query string used in the request.
30103    /// It should be used to set parameters which are not yet available through their own
30104    /// setters.
30105    ///
30106    /// Please note that this method must not be used to set any of the known parameters
30107    /// which have their own setter method. If done anyway, the request will fail.
30108    ///
30109    /// # Additional Parameters
30110    ///
30111    /// * *$.xgafv* (query-string) - V1 error format.
30112    /// * *access_token* (query-string) - OAuth access token.
30113    /// * *alt* (query-string) - Data format for response.
30114    /// * *callback* (query-string) - JSONP
30115    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30116    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
30117    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30118    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30119    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
30120    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30121    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30122    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserManualTriggerActivateCall<'a, C>
30123    where
30124        T: AsRef<str>,
30125    {
30126        self._additional_params
30127            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30128        self
30129    }
30130
30131    /// Identifies the authorization scope for the method you are building.
30132    ///
30133    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30134    /// [`Scope::DisplayVideo`].
30135    ///
30136    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30137    /// tokens for more than one scope.
30138    ///
30139    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30140    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30141    /// sufficient, a read-write scope will do as well.
30142    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserManualTriggerActivateCall<'a, C>
30143    where
30144        St: AsRef<str>,
30145    {
30146        self._scopes.insert(String::from(scope.as_ref()));
30147        self
30148    }
30149    /// Identifies the authorization scope(s) for the method you are building.
30150    ///
30151    /// See [`Self::add_scope()`] for details.
30152    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserManualTriggerActivateCall<'a, C>
30153    where
30154        I: IntoIterator<Item = St>,
30155        St: AsRef<str>,
30156    {
30157        self._scopes
30158            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30159        self
30160    }
30161
30162    /// Removes all scopes, and no default scope will be used either.
30163    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30164    /// for details).
30165    pub fn clear_scopes(mut self) -> AdvertiserManualTriggerActivateCall<'a, C> {
30166        self._scopes.clear();
30167        self
30168    }
30169}
30170
30171/// Creates a new manual trigger. Returns the newly created manual trigger if successful. **Warning:** Line Items using manual triggers no longer serve in Display & Video 360. This method will sunset on August 1, 2023. Read our [feature deprecation announcement](https://developers.google.com/display-video/api/deprecations#features.manual_triggers) for more information.
30172///
30173/// A builder for the *manualTriggers.create* method supported by a *advertiser* resource.
30174/// It is not used directly, but through a [`AdvertiserMethods`] instance.
30175///
30176/// # Example
30177///
30178/// Instantiate a resource method builder
30179///
30180/// ```test_harness,no_run
30181/// # extern crate hyper;
30182/// # extern crate hyper_rustls;
30183/// # extern crate google_displayvideo1 as displayvideo1;
30184/// use displayvideo1::api::ManualTrigger;
30185/// # async fn dox() {
30186/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30187///
30188/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30189/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30190/// #     secret,
30191/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30192/// # ).build().await.unwrap();
30193///
30194/// # let client = hyper_util::client::legacy::Client::builder(
30195/// #     hyper_util::rt::TokioExecutor::new()
30196/// # )
30197/// # .build(
30198/// #     hyper_rustls::HttpsConnectorBuilder::new()
30199/// #         .with_native_roots()
30200/// #         .unwrap()
30201/// #         .https_or_http()
30202/// #         .enable_http1()
30203/// #         .build()
30204/// # );
30205/// # let mut hub = DisplayVideo::new(client, auth);
30206/// // As the method needs a request, you would usually fill it with the desired information
30207/// // into the respective structure. Some of the parts shown here might not be applicable !
30208/// // Values shown here are possibly random and not representative !
30209/// let mut req = ManualTrigger::default();
30210///
30211/// // You can configure optional parameters by calling the respective setters at will, and
30212/// // execute the final call using `doit()`.
30213/// // Values shown here are possibly random and not representative !
30214/// let result = hub.advertisers().manual_triggers_create(req, -62)
30215///              .doit().await;
30216/// # }
30217/// ```
30218pub struct AdvertiserManualTriggerCreateCall<'a, C>
30219where
30220    C: 'a,
30221{
30222    hub: &'a DisplayVideo<C>,
30223    _request: ManualTrigger,
30224    _advertiser_id: i64,
30225    _delegate: Option<&'a mut dyn common::Delegate>,
30226    _additional_params: HashMap<String, String>,
30227    _scopes: BTreeSet<String>,
30228}
30229
30230impl<'a, C> common::CallBuilder for AdvertiserManualTriggerCreateCall<'a, C> {}
30231
30232impl<'a, C> AdvertiserManualTriggerCreateCall<'a, C>
30233where
30234    C: common::Connector,
30235{
30236    /// Perform the operation you have build so far.
30237    pub async fn doit(mut self) -> common::Result<(common::Response, ManualTrigger)> {
30238        use std::borrow::Cow;
30239        use std::io::{Read, Seek};
30240
30241        use common::{url::Params, ToParts};
30242        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30243
30244        let mut dd = common::DefaultDelegate;
30245        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30246        dlg.begin(common::MethodInfo {
30247            id: "displayvideo.advertisers.manualTriggers.create",
30248            http_method: hyper::Method::POST,
30249        });
30250
30251        for &field in ["alt", "advertiserId"].iter() {
30252            if self._additional_params.contains_key(field) {
30253                dlg.finished(false);
30254                return Err(common::Error::FieldClash(field));
30255            }
30256        }
30257
30258        let mut params = Params::with_capacity(4 + self._additional_params.len());
30259        params.push("advertiserId", self._advertiser_id.to_string());
30260
30261        params.extend(self._additional_params.iter());
30262
30263        params.push("alt", "json");
30264        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/manualTriggers";
30265        if self._scopes.is_empty() {
30266            self._scopes
30267                .insert(Scope::DisplayVideo.as_ref().to_string());
30268        }
30269
30270        #[allow(clippy::single_element_loop)]
30271        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
30272            url = params.uri_replacement(url, param_name, find_this, true);
30273        }
30274        {
30275            let to_remove = ["advertiserId"];
30276            params.remove_params(&to_remove);
30277        }
30278
30279        let url = params.parse_with_url(&url);
30280
30281        let mut json_mime_type = mime::APPLICATION_JSON;
30282        let mut request_value_reader = {
30283            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30284            common::remove_json_null_values(&mut value);
30285            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30286            serde_json::to_writer(&mut dst, &value).unwrap();
30287            dst
30288        };
30289        let request_size = request_value_reader
30290            .seek(std::io::SeekFrom::End(0))
30291            .unwrap();
30292        request_value_reader
30293            .seek(std::io::SeekFrom::Start(0))
30294            .unwrap();
30295
30296        loop {
30297            let token = match self
30298                .hub
30299                .auth
30300                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30301                .await
30302            {
30303                Ok(token) => token,
30304                Err(e) => match dlg.token(e) {
30305                    Ok(token) => token,
30306                    Err(e) => {
30307                        dlg.finished(false);
30308                        return Err(common::Error::MissingToken(e));
30309                    }
30310                },
30311            };
30312            request_value_reader
30313                .seek(std::io::SeekFrom::Start(0))
30314                .unwrap();
30315            let mut req_result = {
30316                let client = &self.hub.client;
30317                dlg.pre_request();
30318                let mut req_builder = hyper::Request::builder()
30319                    .method(hyper::Method::POST)
30320                    .uri(url.as_str())
30321                    .header(USER_AGENT, self.hub._user_agent.clone());
30322
30323                if let Some(token) = token.as_ref() {
30324                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30325                }
30326
30327                let request = req_builder
30328                    .header(CONTENT_TYPE, json_mime_type.to_string())
30329                    .header(CONTENT_LENGTH, request_size as u64)
30330                    .body(common::to_body(
30331                        request_value_reader.get_ref().clone().into(),
30332                    ));
30333
30334                client.request(request.unwrap()).await
30335            };
30336
30337            match req_result {
30338                Err(err) => {
30339                    if let common::Retry::After(d) = dlg.http_error(&err) {
30340                        sleep(d).await;
30341                        continue;
30342                    }
30343                    dlg.finished(false);
30344                    return Err(common::Error::HttpError(err));
30345                }
30346                Ok(res) => {
30347                    let (mut parts, body) = res.into_parts();
30348                    let mut body = common::Body::new(body);
30349                    if !parts.status.is_success() {
30350                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30351                        let error = serde_json::from_str(&common::to_string(&bytes));
30352                        let response = common::to_response(parts, bytes.into());
30353
30354                        if let common::Retry::After(d) =
30355                            dlg.http_failure(&response, error.as_ref().ok())
30356                        {
30357                            sleep(d).await;
30358                            continue;
30359                        }
30360
30361                        dlg.finished(false);
30362
30363                        return Err(match error {
30364                            Ok(value) => common::Error::BadRequest(value),
30365                            _ => common::Error::Failure(response),
30366                        });
30367                    }
30368                    let response = {
30369                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30370                        let encoded = common::to_string(&bytes);
30371                        match serde_json::from_str(&encoded) {
30372                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30373                            Err(error) => {
30374                                dlg.response_json_decode_error(&encoded, &error);
30375                                return Err(common::Error::JsonDecodeError(
30376                                    encoded.to_string(),
30377                                    error,
30378                                ));
30379                            }
30380                        }
30381                    };
30382
30383                    dlg.finished(true);
30384                    return Ok(response);
30385                }
30386            }
30387        }
30388    }
30389
30390    ///
30391    /// Sets the *request* property to the given value.
30392    ///
30393    /// Even though the property as already been set when instantiating this call,
30394    /// we provide this method for API completeness.
30395    pub fn request(mut self, new_value: ManualTrigger) -> AdvertiserManualTriggerCreateCall<'a, C> {
30396        self._request = new_value;
30397        self
30398    }
30399    /// Required. Immutable. The unique ID of the advertiser that the manual trigger belongs to.
30400    ///
30401    /// Sets the *advertiser id* path property to the given value.
30402    ///
30403    /// Even though the property as already been set when instantiating this call,
30404    /// we provide this method for API completeness.
30405    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserManualTriggerCreateCall<'a, C> {
30406        self._advertiser_id = new_value;
30407        self
30408    }
30409    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30410    /// while executing the actual API request.
30411    ///
30412    /// ````text
30413    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30414    /// ````
30415    ///
30416    /// Sets the *delegate* property to the given value.
30417    pub fn delegate(
30418        mut self,
30419        new_value: &'a mut dyn common::Delegate,
30420    ) -> AdvertiserManualTriggerCreateCall<'a, C> {
30421        self._delegate = Some(new_value);
30422        self
30423    }
30424
30425    /// Set any additional parameter of the query string used in the request.
30426    /// It should be used to set parameters which are not yet available through their own
30427    /// setters.
30428    ///
30429    /// Please note that this method must not be used to set any of the known parameters
30430    /// which have their own setter method. If done anyway, the request will fail.
30431    ///
30432    /// # Additional Parameters
30433    ///
30434    /// * *$.xgafv* (query-string) - V1 error format.
30435    /// * *access_token* (query-string) - OAuth access token.
30436    /// * *alt* (query-string) - Data format for response.
30437    /// * *callback* (query-string) - JSONP
30438    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30439    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
30440    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30441    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30442    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
30443    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30444    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30445    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserManualTriggerCreateCall<'a, C>
30446    where
30447        T: AsRef<str>,
30448    {
30449        self._additional_params
30450            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30451        self
30452    }
30453
30454    /// Identifies the authorization scope for the method you are building.
30455    ///
30456    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30457    /// [`Scope::DisplayVideo`].
30458    ///
30459    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30460    /// tokens for more than one scope.
30461    ///
30462    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30463    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30464    /// sufficient, a read-write scope will do as well.
30465    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserManualTriggerCreateCall<'a, C>
30466    where
30467        St: AsRef<str>,
30468    {
30469        self._scopes.insert(String::from(scope.as_ref()));
30470        self
30471    }
30472    /// Identifies the authorization scope(s) for the method you are building.
30473    ///
30474    /// See [`Self::add_scope()`] for details.
30475    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserManualTriggerCreateCall<'a, C>
30476    where
30477        I: IntoIterator<Item = St>,
30478        St: AsRef<str>,
30479    {
30480        self._scopes
30481            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30482        self
30483    }
30484
30485    /// Removes all scopes, and no default scope will be used either.
30486    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30487    /// for details).
30488    pub fn clear_scopes(mut self) -> AdvertiserManualTriggerCreateCall<'a, C> {
30489        self._scopes.clear();
30490        self
30491    }
30492}
30493
30494/// Deactivates a manual trigger. **Warning:** Line Items using manual triggers no longer serve in Display & Video 360. This method will sunset on August 1, 2023. Read our [feature deprecation announcement](https://developers.google.com/display-video/api/deprecations#features.manual_triggers) for more information.
30495///
30496/// A builder for the *manualTriggers.deactivate* method supported by a *advertiser* resource.
30497/// It is not used directly, but through a [`AdvertiserMethods`] instance.
30498///
30499/// # Example
30500///
30501/// Instantiate a resource method builder
30502///
30503/// ```test_harness,no_run
30504/// # extern crate hyper;
30505/// # extern crate hyper_rustls;
30506/// # extern crate google_displayvideo1 as displayvideo1;
30507/// use displayvideo1::api::DeactivateManualTriggerRequest;
30508/// # async fn dox() {
30509/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30510///
30511/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30512/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30513/// #     secret,
30514/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30515/// # ).build().await.unwrap();
30516///
30517/// # let client = hyper_util::client::legacy::Client::builder(
30518/// #     hyper_util::rt::TokioExecutor::new()
30519/// # )
30520/// # .build(
30521/// #     hyper_rustls::HttpsConnectorBuilder::new()
30522/// #         .with_native_roots()
30523/// #         .unwrap()
30524/// #         .https_or_http()
30525/// #         .enable_http1()
30526/// #         .build()
30527/// # );
30528/// # let mut hub = DisplayVideo::new(client, auth);
30529/// // As the method needs a request, you would usually fill it with the desired information
30530/// // into the respective structure. Some of the parts shown here might not be applicable !
30531/// // Values shown here are possibly random and not representative !
30532/// let mut req = DeactivateManualTriggerRequest::default();
30533///
30534/// // You can configure optional parameters by calling the respective setters at will, and
30535/// // execute the final call using `doit()`.
30536/// // Values shown here are possibly random and not representative !
30537/// let result = hub.advertisers().manual_triggers_deactivate(req, -45, -27)
30538///              .doit().await;
30539/// # }
30540/// ```
30541pub struct AdvertiserManualTriggerDeactivateCall<'a, C>
30542where
30543    C: 'a,
30544{
30545    hub: &'a DisplayVideo<C>,
30546    _request: DeactivateManualTriggerRequest,
30547    _advertiser_id: i64,
30548    _trigger_id: i64,
30549    _delegate: Option<&'a mut dyn common::Delegate>,
30550    _additional_params: HashMap<String, String>,
30551    _scopes: BTreeSet<String>,
30552}
30553
30554impl<'a, C> common::CallBuilder for AdvertiserManualTriggerDeactivateCall<'a, C> {}
30555
30556impl<'a, C> AdvertiserManualTriggerDeactivateCall<'a, C>
30557where
30558    C: common::Connector,
30559{
30560    /// Perform the operation you have build so far.
30561    pub async fn doit(mut self) -> common::Result<(common::Response, ManualTrigger)> {
30562        use std::borrow::Cow;
30563        use std::io::{Read, Seek};
30564
30565        use common::{url::Params, ToParts};
30566        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30567
30568        let mut dd = common::DefaultDelegate;
30569        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30570        dlg.begin(common::MethodInfo {
30571            id: "displayvideo.advertisers.manualTriggers.deactivate",
30572            http_method: hyper::Method::POST,
30573        });
30574
30575        for &field in ["alt", "advertiserId", "triggerId"].iter() {
30576            if self._additional_params.contains_key(field) {
30577                dlg.finished(false);
30578                return Err(common::Error::FieldClash(field));
30579            }
30580        }
30581
30582        let mut params = Params::with_capacity(5 + self._additional_params.len());
30583        params.push("advertiserId", self._advertiser_id.to_string());
30584        params.push("triggerId", self._trigger_id.to_string());
30585
30586        params.extend(self._additional_params.iter());
30587
30588        params.push("alt", "json");
30589        let mut url = self.hub._base_url.clone()
30590            + "v1/advertisers/{+advertiserId}/manualTriggers/{+triggerId}:deactivate";
30591        if self._scopes.is_empty() {
30592            self._scopes
30593                .insert(Scope::DisplayVideo.as_ref().to_string());
30594        }
30595
30596        #[allow(clippy::single_element_loop)]
30597        for &(find_this, param_name) in [
30598            ("{+advertiserId}", "advertiserId"),
30599            ("{+triggerId}", "triggerId"),
30600        ]
30601        .iter()
30602        {
30603            url = params.uri_replacement(url, param_name, find_this, true);
30604        }
30605        {
30606            let to_remove = ["triggerId", "advertiserId"];
30607            params.remove_params(&to_remove);
30608        }
30609
30610        let url = params.parse_with_url(&url);
30611
30612        let mut json_mime_type = mime::APPLICATION_JSON;
30613        let mut request_value_reader = {
30614            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30615            common::remove_json_null_values(&mut value);
30616            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30617            serde_json::to_writer(&mut dst, &value).unwrap();
30618            dst
30619        };
30620        let request_size = request_value_reader
30621            .seek(std::io::SeekFrom::End(0))
30622            .unwrap();
30623        request_value_reader
30624            .seek(std::io::SeekFrom::Start(0))
30625            .unwrap();
30626
30627        loop {
30628            let token = match self
30629                .hub
30630                .auth
30631                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30632                .await
30633            {
30634                Ok(token) => token,
30635                Err(e) => match dlg.token(e) {
30636                    Ok(token) => token,
30637                    Err(e) => {
30638                        dlg.finished(false);
30639                        return Err(common::Error::MissingToken(e));
30640                    }
30641                },
30642            };
30643            request_value_reader
30644                .seek(std::io::SeekFrom::Start(0))
30645                .unwrap();
30646            let mut req_result = {
30647                let client = &self.hub.client;
30648                dlg.pre_request();
30649                let mut req_builder = hyper::Request::builder()
30650                    .method(hyper::Method::POST)
30651                    .uri(url.as_str())
30652                    .header(USER_AGENT, self.hub._user_agent.clone());
30653
30654                if let Some(token) = token.as_ref() {
30655                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30656                }
30657
30658                let request = req_builder
30659                    .header(CONTENT_TYPE, json_mime_type.to_string())
30660                    .header(CONTENT_LENGTH, request_size as u64)
30661                    .body(common::to_body(
30662                        request_value_reader.get_ref().clone().into(),
30663                    ));
30664
30665                client.request(request.unwrap()).await
30666            };
30667
30668            match req_result {
30669                Err(err) => {
30670                    if let common::Retry::After(d) = dlg.http_error(&err) {
30671                        sleep(d).await;
30672                        continue;
30673                    }
30674                    dlg.finished(false);
30675                    return Err(common::Error::HttpError(err));
30676                }
30677                Ok(res) => {
30678                    let (mut parts, body) = res.into_parts();
30679                    let mut body = common::Body::new(body);
30680                    if !parts.status.is_success() {
30681                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30682                        let error = serde_json::from_str(&common::to_string(&bytes));
30683                        let response = common::to_response(parts, bytes.into());
30684
30685                        if let common::Retry::After(d) =
30686                            dlg.http_failure(&response, error.as_ref().ok())
30687                        {
30688                            sleep(d).await;
30689                            continue;
30690                        }
30691
30692                        dlg.finished(false);
30693
30694                        return Err(match error {
30695                            Ok(value) => common::Error::BadRequest(value),
30696                            _ => common::Error::Failure(response),
30697                        });
30698                    }
30699                    let response = {
30700                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30701                        let encoded = common::to_string(&bytes);
30702                        match serde_json::from_str(&encoded) {
30703                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30704                            Err(error) => {
30705                                dlg.response_json_decode_error(&encoded, &error);
30706                                return Err(common::Error::JsonDecodeError(
30707                                    encoded.to_string(),
30708                                    error,
30709                                ));
30710                            }
30711                        }
30712                    };
30713
30714                    dlg.finished(true);
30715                    return Ok(response);
30716                }
30717            }
30718        }
30719    }
30720
30721    ///
30722    /// Sets the *request* property to the given value.
30723    ///
30724    /// Even though the property as already been set when instantiating this call,
30725    /// we provide this method for API completeness.
30726    pub fn request(
30727        mut self,
30728        new_value: DeactivateManualTriggerRequest,
30729    ) -> AdvertiserManualTriggerDeactivateCall<'a, C> {
30730        self._request = new_value;
30731        self
30732    }
30733    /// Required. The ID of the advertiser that the manual trigger belongs.
30734    ///
30735    /// Sets the *advertiser id* path property to the given value.
30736    ///
30737    /// Even though the property as already been set when instantiating this call,
30738    /// we provide this method for API completeness.
30739    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserManualTriggerDeactivateCall<'a, C> {
30740        self._advertiser_id = new_value;
30741        self
30742    }
30743    /// Required. The ID of the manual trigger to deactivate.
30744    ///
30745    /// Sets the *trigger id* path property to the given value.
30746    ///
30747    /// Even though the property as already been set when instantiating this call,
30748    /// we provide this method for API completeness.
30749    pub fn trigger_id(mut self, new_value: i64) -> AdvertiserManualTriggerDeactivateCall<'a, C> {
30750        self._trigger_id = new_value;
30751        self
30752    }
30753    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30754    /// while executing the actual API request.
30755    ///
30756    /// ````text
30757    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30758    /// ````
30759    ///
30760    /// Sets the *delegate* property to the given value.
30761    pub fn delegate(
30762        mut self,
30763        new_value: &'a mut dyn common::Delegate,
30764    ) -> AdvertiserManualTriggerDeactivateCall<'a, C> {
30765        self._delegate = Some(new_value);
30766        self
30767    }
30768
30769    /// Set any additional parameter of the query string used in the request.
30770    /// It should be used to set parameters which are not yet available through their own
30771    /// setters.
30772    ///
30773    /// Please note that this method must not be used to set any of the known parameters
30774    /// which have their own setter method. If done anyway, the request will fail.
30775    ///
30776    /// # Additional Parameters
30777    ///
30778    /// * *$.xgafv* (query-string) - V1 error format.
30779    /// * *access_token* (query-string) - OAuth access token.
30780    /// * *alt* (query-string) - Data format for response.
30781    /// * *callback* (query-string) - JSONP
30782    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30783    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
30784    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30785    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30786    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
30787    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30788    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30789    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserManualTriggerDeactivateCall<'a, C>
30790    where
30791        T: AsRef<str>,
30792    {
30793        self._additional_params
30794            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30795        self
30796    }
30797
30798    /// Identifies the authorization scope for the method you are building.
30799    ///
30800    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30801    /// [`Scope::DisplayVideo`].
30802    ///
30803    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30804    /// tokens for more than one scope.
30805    ///
30806    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30807    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30808    /// sufficient, a read-write scope will do as well.
30809    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserManualTriggerDeactivateCall<'a, C>
30810    where
30811        St: AsRef<str>,
30812    {
30813        self._scopes.insert(String::from(scope.as_ref()));
30814        self
30815    }
30816    /// Identifies the authorization scope(s) for the method you are building.
30817    ///
30818    /// See [`Self::add_scope()`] for details.
30819    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserManualTriggerDeactivateCall<'a, C>
30820    where
30821        I: IntoIterator<Item = St>,
30822        St: AsRef<str>,
30823    {
30824        self._scopes
30825            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30826        self
30827    }
30828
30829    /// Removes all scopes, and no default scope will be used either.
30830    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30831    /// for details).
30832    pub fn clear_scopes(mut self) -> AdvertiserManualTriggerDeactivateCall<'a, C> {
30833        self._scopes.clear();
30834        self
30835    }
30836}
30837
30838/// Gets a manual trigger. **Warning:** Line Items using manual triggers no longer serve in Display & Video 360. This method will sunset on August 1, 2023. Read our [feature deprecation announcement](https://developers.google.com/display-video/api/deprecations#features.manual_triggers) for more information.
30839///
30840/// A builder for the *manualTriggers.get* method supported by a *advertiser* resource.
30841/// It is not used directly, but through a [`AdvertiserMethods`] instance.
30842///
30843/// # Example
30844///
30845/// Instantiate a resource method builder
30846///
30847/// ```test_harness,no_run
30848/// # extern crate hyper;
30849/// # extern crate hyper_rustls;
30850/// # extern crate google_displayvideo1 as displayvideo1;
30851/// # async fn dox() {
30852/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30853///
30854/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30855/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30856/// #     secret,
30857/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30858/// # ).build().await.unwrap();
30859///
30860/// # let client = hyper_util::client::legacy::Client::builder(
30861/// #     hyper_util::rt::TokioExecutor::new()
30862/// # )
30863/// # .build(
30864/// #     hyper_rustls::HttpsConnectorBuilder::new()
30865/// #         .with_native_roots()
30866/// #         .unwrap()
30867/// #         .https_or_http()
30868/// #         .enable_http1()
30869/// #         .build()
30870/// # );
30871/// # let mut hub = DisplayVideo::new(client, auth);
30872/// // You can configure optional parameters by calling the respective setters at will, and
30873/// // execute the final call using `doit()`.
30874/// // Values shown here are possibly random and not representative !
30875/// let result = hub.advertisers().manual_triggers_get(-53, -20)
30876///              .doit().await;
30877/// # }
30878/// ```
30879pub struct AdvertiserManualTriggerGetCall<'a, C>
30880where
30881    C: 'a,
30882{
30883    hub: &'a DisplayVideo<C>,
30884    _advertiser_id: i64,
30885    _trigger_id: i64,
30886    _delegate: Option<&'a mut dyn common::Delegate>,
30887    _additional_params: HashMap<String, String>,
30888    _scopes: BTreeSet<String>,
30889}
30890
30891impl<'a, C> common::CallBuilder for AdvertiserManualTriggerGetCall<'a, C> {}
30892
30893impl<'a, C> AdvertiserManualTriggerGetCall<'a, C>
30894where
30895    C: common::Connector,
30896{
30897    /// Perform the operation you have build so far.
30898    pub async fn doit(mut self) -> common::Result<(common::Response, ManualTrigger)> {
30899        use std::borrow::Cow;
30900        use std::io::{Read, Seek};
30901
30902        use common::{url::Params, ToParts};
30903        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30904
30905        let mut dd = common::DefaultDelegate;
30906        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30907        dlg.begin(common::MethodInfo {
30908            id: "displayvideo.advertisers.manualTriggers.get",
30909            http_method: hyper::Method::GET,
30910        });
30911
30912        for &field in ["alt", "advertiserId", "triggerId"].iter() {
30913            if self._additional_params.contains_key(field) {
30914                dlg.finished(false);
30915                return Err(common::Error::FieldClash(field));
30916            }
30917        }
30918
30919        let mut params = Params::with_capacity(4 + self._additional_params.len());
30920        params.push("advertiserId", self._advertiser_id.to_string());
30921        params.push("triggerId", self._trigger_id.to_string());
30922
30923        params.extend(self._additional_params.iter());
30924
30925        params.push("alt", "json");
30926        let mut url = self.hub._base_url.clone()
30927            + "v1/advertisers/{+advertiserId}/manualTriggers/{+triggerId}";
30928        if self._scopes.is_empty() {
30929            self._scopes
30930                .insert(Scope::DisplayVideo.as_ref().to_string());
30931        }
30932
30933        #[allow(clippy::single_element_loop)]
30934        for &(find_this, param_name) in [
30935            ("{+advertiserId}", "advertiserId"),
30936            ("{+triggerId}", "triggerId"),
30937        ]
30938        .iter()
30939        {
30940            url = params.uri_replacement(url, param_name, find_this, true);
30941        }
30942        {
30943            let to_remove = ["triggerId", "advertiserId"];
30944            params.remove_params(&to_remove);
30945        }
30946
30947        let url = params.parse_with_url(&url);
30948
30949        loop {
30950            let token = match self
30951                .hub
30952                .auth
30953                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30954                .await
30955            {
30956                Ok(token) => token,
30957                Err(e) => match dlg.token(e) {
30958                    Ok(token) => token,
30959                    Err(e) => {
30960                        dlg.finished(false);
30961                        return Err(common::Error::MissingToken(e));
30962                    }
30963                },
30964            };
30965            let mut req_result = {
30966                let client = &self.hub.client;
30967                dlg.pre_request();
30968                let mut req_builder = hyper::Request::builder()
30969                    .method(hyper::Method::GET)
30970                    .uri(url.as_str())
30971                    .header(USER_AGENT, self.hub._user_agent.clone());
30972
30973                if let Some(token) = token.as_ref() {
30974                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30975                }
30976
30977                let request = req_builder
30978                    .header(CONTENT_LENGTH, 0_u64)
30979                    .body(common::to_body::<String>(None));
30980
30981                client.request(request.unwrap()).await
30982            };
30983
30984            match req_result {
30985                Err(err) => {
30986                    if let common::Retry::After(d) = dlg.http_error(&err) {
30987                        sleep(d).await;
30988                        continue;
30989                    }
30990                    dlg.finished(false);
30991                    return Err(common::Error::HttpError(err));
30992                }
30993                Ok(res) => {
30994                    let (mut parts, body) = res.into_parts();
30995                    let mut body = common::Body::new(body);
30996                    if !parts.status.is_success() {
30997                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30998                        let error = serde_json::from_str(&common::to_string(&bytes));
30999                        let response = common::to_response(parts, bytes.into());
31000
31001                        if let common::Retry::After(d) =
31002                            dlg.http_failure(&response, error.as_ref().ok())
31003                        {
31004                            sleep(d).await;
31005                            continue;
31006                        }
31007
31008                        dlg.finished(false);
31009
31010                        return Err(match error {
31011                            Ok(value) => common::Error::BadRequest(value),
31012                            _ => common::Error::Failure(response),
31013                        });
31014                    }
31015                    let response = {
31016                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31017                        let encoded = common::to_string(&bytes);
31018                        match serde_json::from_str(&encoded) {
31019                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31020                            Err(error) => {
31021                                dlg.response_json_decode_error(&encoded, &error);
31022                                return Err(common::Error::JsonDecodeError(
31023                                    encoded.to_string(),
31024                                    error,
31025                                ));
31026                            }
31027                        }
31028                    };
31029
31030                    dlg.finished(true);
31031                    return Ok(response);
31032                }
31033            }
31034        }
31035    }
31036
31037    /// Required. The ID of the advertiser this manual trigger belongs to.
31038    ///
31039    /// Sets the *advertiser id* path property to the given value.
31040    ///
31041    /// Even though the property as already been set when instantiating this call,
31042    /// we provide this method for API completeness.
31043    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserManualTriggerGetCall<'a, C> {
31044        self._advertiser_id = new_value;
31045        self
31046    }
31047    /// Required. The ID of the manual trigger to fetch.
31048    ///
31049    /// Sets the *trigger id* path property to the given value.
31050    ///
31051    /// Even though the property as already been set when instantiating this call,
31052    /// we provide this method for API completeness.
31053    pub fn trigger_id(mut self, new_value: i64) -> AdvertiserManualTriggerGetCall<'a, C> {
31054        self._trigger_id = new_value;
31055        self
31056    }
31057    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31058    /// while executing the actual API request.
31059    ///
31060    /// ````text
31061    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31062    /// ````
31063    ///
31064    /// Sets the *delegate* property to the given value.
31065    pub fn delegate(
31066        mut self,
31067        new_value: &'a mut dyn common::Delegate,
31068    ) -> AdvertiserManualTriggerGetCall<'a, C> {
31069        self._delegate = Some(new_value);
31070        self
31071    }
31072
31073    /// Set any additional parameter of the query string used in the request.
31074    /// It should be used to set parameters which are not yet available through their own
31075    /// setters.
31076    ///
31077    /// Please note that this method must not be used to set any of the known parameters
31078    /// which have their own setter method. If done anyway, the request will fail.
31079    ///
31080    /// # Additional Parameters
31081    ///
31082    /// * *$.xgafv* (query-string) - V1 error format.
31083    /// * *access_token* (query-string) - OAuth access token.
31084    /// * *alt* (query-string) - Data format for response.
31085    /// * *callback* (query-string) - JSONP
31086    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31087    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
31088    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31089    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31090    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
31091    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31092    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31093    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserManualTriggerGetCall<'a, C>
31094    where
31095        T: AsRef<str>,
31096    {
31097        self._additional_params
31098            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31099        self
31100    }
31101
31102    /// Identifies the authorization scope for the method you are building.
31103    ///
31104    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31105    /// [`Scope::DisplayVideo`].
31106    ///
31107    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31108    /// tokens for more than one scope.
31109    ///
31110    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31111    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31112    /// sufficient, a read-write scope will do as well.
31113    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserManualTriggerGetCall<'a, C>
31114    where
31115        St: AsRef<str>,
31116    {
31117        self._scopes.insert(String::from(scope.as_ref()));
31118        self
31119    }
31120    /// Identifies the authorization scope(s) for the method you are building.
31121    ///
31122    /// See [`Self::add_scope()`] for details.
31123    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserManualTriggerGetCall<'a, C>
31124    where
31125        I: IntoIterator<Item = St>,
31126        St: AsRef<str>,
31127    {
31128        self._scopes
31129            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31130        self
31131    }
31132
31133    /// Removes all scopes, and no default scope will be used either.
31134    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31135    /// for details).
31136    pub fn clear_scopes(mut self) -> AdvertiserManualTriggerGetCall<'a, C> {
31137        self._scopes.clear();
31138        self
31139    }
31140}
31141
31142/// Lists manual triggers that are accessible to the current user for a given advertiser ID. The order is defined by the order_by parameter. A single advertiser_id is required. **Warning:** Line Items using manual triggers no longer serve in Display & Video 360. This method will sunset on August 1, 2023. Read our [feature deprecation announcement](https://developers.google.com/display-video/api/deprecations#features.manual_triggers) for more information.
31143///
31144/// A builder for the *manualTriggers.list* method supported by a *advertiser* resource.
31145/// It is not used directly, but through a [`AdvertiserMethods`] instance.
31146///
31147/// # Example
31148///
31149/// Instantiate a resource method builder
31150///
31151/// ```test_harness,no_run
31152/// # extern crate hyper;
31153/// # extern crate hyper_rustls;
31154/// # extern crate google_displayvideo1 as displayvideo1;
31155/// # async fn dox() {
31156/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31157///
31158/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31159/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31160/// #     secret,
31161/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31162/// # ).build().await.unwrap();
31163///
31164/// # let client = hyper_util::client::legacy::Client::builder(
31165/// #     hyper_util::rt::TokioExecutor::new()
31166/// # )
31167/// # .build(
31168/// #     hyper_rustls::HttpsConnectorBuilder::new()
31169/// #         .with_native_roots()
31170/// #         .unwrap()
31171/// #         .https_or_http()
31172/// #         .enable_http1()
31173/// #         .build()
31174/// # );
31175/// # let mut hub = DisplayVideo::new(client, auth);
31176/// // You can configure optional parameters by calling the respective setters at will, and
31177/// // execute the final call using `doit()`.
31178/// // Values shown here are possibly random and not representative !
31179/// let result = hub.advertisers().manual_triggers_list(-53)
31180///              .page_token("magna")
31181///              .page_size(-22)
31182///              .order_by("rebum.")
31183///              .filter("dolor")
31184///              .doit().await;
31185/// # }
31186/// ```
31187pub struct AdvertiserManualTriggerListCall<'a, C>
31188where
31189    C: 'a,
31190{
31191    hub: &'a DisplayVideo<C>,
31192    _advertiser_id: i64,
31193    _page_token: Option<String>,
31194    _page_size: Option<i32>,
31195    _order_by: Option<String>,
31196    _filter: Option<String>,
31197    _delegate: Option<&'a mut dyn common::Delegate>,
31198    _additional_params: HashMap<String, String>,
31199    _scopes: BTreeSet<String>,
31200}
31201
31202impl<'a, C> common::CallBuilder for AdvertiserManualTriggerListCall<'a, C> {}
31203
31204impl<'a, C> AdvertiserManualTriggerListCall<'a, C>
31205where
31206    C: common::Connector,
31207{
31208    /// Perform the operation you have build so far.
31209    pub async fn doit(mut self) -> common::Result<(common::Response, ListManualTriggersResponse)> {
31210        use std::borrow::Cow;
31211        use std::io::{Read, Seek};
31212
31213        use common::{url::Params, ToParts};
31214        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31215
31216        let mut dd = common::DefaultDelegate;
31217        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31218        dlg.begin(common::MethodInfo {
31219            id: "displayvideo.advertisers.manualTriggers.list",
31220            http_method: hyper::Method::GET,
31221        });
31222
31223        for &field in [
31224            "alt",
31225            "advertiserId",
31226            "pageToken",
31227            "pageSize",
31228            "orderBy",
31229            "filter",
31230        ]
31231        .iter()
31232        {
31233            if self._additional_params.contains_key(field) {
31234                dlg.finished(false);
31235                return Err(common::Error::FieldClash(field));
31236            }
31237        }
31238
31239        let mut params = Params::with_capacity(7 + self._additional_params.len());
31240        params.push("advertiserId", self._advertiser_id.to_string());
31241        if let Some(value) = self._page_token.as_ref() {
31242            params.push("pageToken", value);
31243        }
31244        if let Some(value) = self._page_size.as_ref() {
31245            params.push("pageSize", value.to_string());
31246        }
31247        if let Some(value) = self._order_by.as_ref() {
31248            params.push("orderBy", value);
31249        }
31250        if let Some(value) = self._filter.as_ref() {
31251            params.push("filter", value);
31252        }
31253
31254        params.extend(self._additional_params.iter());
31255
31256        params.push("alt", "json");
31257        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/manualTriggers";
31258        if self._scopes.is_empty() {
31259            self._scopes
31260                .insert(Scope::DisplayVideo.as_ref().to_string());
31261        }
31262
31263        #[allow(clippy::single_element_loop)]
31264        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
31265            url = params.uri_replacement(url, param_name, find_this, true);
31266        }
31267        {
31268            let to_remove = ["advertiserId"];
31269            params.remove_params(&to_remove);
31270        }
31271
31272        let url = params.parse_with_url(&url);
31273
31274        loop {
31275            let token = match self
31276                .hub
31277                .auth
31278                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31279                .await
31280            {
31281                Ok(token) => token,
31282                Err(e) => match dlg.token(e) {
31283                    Ok(token) => token,
31284                    Err(e) => {
31285                        dlg.finished(false);
31286                        return Err(common::Error::MissingToken(e));
31287                    }
31288                },
31289            };
31290            let mut req_result = {
31291                let client = &self.hub.client;
31292                dlg.pre_request();
31293                let mut req_builder = hyper::Request::builder()
31294                    .method(hyper::Method::GET)
31295                    .uri(url.as_str())
31296                    .header(USER_AGENT, self.hub._user_agent.clone());
31297
31298                if let Some(token) = token.as_ref() {
31299                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31300                }
31301
31302                let request = req_builder
31303                    .header(CONTENT_LENGTH, 0_u64)
31304                    .body(common::to_body::<String>(None));
31305
31306                client.request(request.unwrap()).await
31307            };
31308
31309            match req_result {
31310                Err(err) => {
31311                    if let common::Retry::After(d) = dlg.http_error(&err) {
31312                        sleep(d).await;
31313                        continue;
31314                    }
31315                    dlg.finished(false);
31316                    return Err(common::Error::HttpError(err));
31317                }
31318                Ok(res) => {
31319                    let (mut parts, body) = res.into_parts();
31320                    let mut body = common::Body::new(body);
31321                    if !parts.status.is_success() {
31322                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31323                        let error = serde_json::from_str(&common::to_string(&bytes));
31324                        let response = common::to_response(parts, bytes.into());
31325
31326                        if let common::Retry::After(d) =
31327                            dlg.http_failure(&response, error.as_ref().ok())
31328                        {
31329                            sleep(d).await;
31330                            continue;
31331                        }
31332
31333                        dlg.finished(false);
31334
31335                        return Err(match error {
31336                            Ok(value) => common::Error::BadRequest(value),
31337                            _ => common::Error::Failure(response),
31338                        });
31339                    }
31340                    let response = {
31341                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31342                        let encoded = common::to_string(&bytes);
31343                        match serde_json::from_str(&encoded) {
31344                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31345                            Err(error) => {
31346                                dlg.response_json_decode_error(&encoded, &error);
31347                                return Err(common::Error::JsonDecodeError(
31348                                    encoded.to_string(),
31349                                    error,
31350                                ));
31351                            }
31352                        }
31353                    };
31354
31355                    dlg.finished(true);
31356                    return Ok(response);
31357                }
31358            }
31359        }
31360    }
31361
31362    /// Required. The ID of the advertiser that the fetched manual triggers belong to.
31363    ///
31364    /// Sets the *advertiser id* path property to the given value.
31365    ///
31366    /// Even though the property as already been set when instantiating this call,
31367    /// we provide this method for API completeness.
31368    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserManualTriggerListCall<'a, C> {
31369        self._advertiser_id = new_value;
31370        self
31371    }
31372    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListManualTriggers` method. If not specified, the first page of results will be returned.
31373    ///
31374    /// Sets the *page token* query property to the given value.
31375    pub fn page_token(mut self, new_value: &str) -> AdvertiserManualTriggerListCall<'a, C> {
31376        self._page_token = Some(new_value.to_string());
31377        self
31378    }
31379    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`.
31380    ///
31381    /// Sets the *page size* query property to the given value.
31382    pub fn page_size(mut self, new_value: i32) -> AdvertiserManualTriggerListCall<'a, C> {
31383        self._page_size = Some(new_value);
31384        self
31385    }
31386    /// Field by which to sort the list. Acceptable values are: * `displayName` (default) * `state` The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. For example, `displayName desc`.
31387    ///
31388    /// Sets the *order by* query property to the given value.
31389    pub fn order_by(mut self, new_value: &str) -> AdvertiserManualTriggerListCall<'a, C> {
31390        self._order_by = Some(new_value.to_string());
31391        self
31392    }
31393    /// Allows filtering by manual trigger fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by `AND` or `OR` logical operators. A sequence of restrictions implicitly uses `AND`. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `EQUALS (=)` operator. Supported fields: * `displayName` * `state` Examples: * All active manual triggers under an advertiser: `state="ACTIVE"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
31394    ///
31395    /// Sets the *filter* query property to the given value.
31396    pub fn filter(mut self, new_value: &str) -> AdvertiserManualTriggerListCall<'a, C> {
31397        self._filter = Some(new_value.to_string());
31398        self
31399    }
31400    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31401    /// while executing the actual API request.
31402    ///
31403    /// ````text
31404    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31405    /// ````
31406    ///
31407    /// Sets the *delegate* property to the given value.
31408    pub fn delegate(
31409        mut self,
31410        new_value: &'a mut dyn common::Delegate,
31411    ) -> AdvertiserManualTriggerListCall<'a, C> {
31412        self._delegate = Some(new_value);
31413        self
31414    }
31415
31416    /// Set any additional parameter of the query string used in the request.
31417    /// It should be used to set parameters which are not yet available through their own
31418    /// setters.
31419    ///
31420    /// Please note that this method must not be used to set any of the known parameters
31421    /// which have their own setter method. If done anyway, the request will fail.
31422    ///
31423    /// # Additional Parameters
31424    ///
31425    /// * *$.xgafv* (query-string) - V1 error format.
31426    /// * *access_token* (query-string) - OAuth access token.
31427    /// * *alt* (query-string) - Data format for response.
31428    /// * *callback* (query-string) - JSONP
31429    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31430    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
31431    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31432    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31433    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
31434    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31435    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31436    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserManualTriggerListCall<'a, C>
31437    where
31438        T: AsRef<str>,
31439    {
31440        self._additional_params
31441            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31442        self
31443    }
31444
31445    /// Identifies the authorization scope for the method you are building.
31446    ///
31447    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31448    /// [`Scope::DisplayVideo`].
31449    ///
31450    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31451    /// tokens for more than one scope.
31452    ///
31453    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31454    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31455    /// sufficient, a read-write scope will do as well.
31456    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserManualTriggerListCall<'a, C>
31457    where
31458        St: AsRef<str>,
31459    {
31460        self._scopes.insert(String::from(scope.as_ref()));
31461        self
31462    }
31463    /// Identifies the authorization scope(s) for the method you are building.
31464    ///
31465    /// See [`Self::add_scope()`] for details.
31466    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserManualTriggerListCall<'a, C>
31467    where
31468        I: IntoIterator<Item = St>,
31469        St: AsRef<str>,
31470    {
31471        self._scopes
31472            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31473        self
31474    }
31475
31476    /// Removes all scopes, and no default scope will be used either.
31477    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31478    /// for details).
31479    pub fn clear_scopes(mut self) -> AdvertiserManualTriggerListCall<'a, C> {
31480        self._scopes.clear();
31481        self
31482    }
31483}
31484
31485/// Updates a manual trigger. Returns the updated manual trigger if successful. **Warning:** Line Items using manual triggers no longer serve in Display & Video 360. This method will sunset on August 1, 2023. Read our [feature deprecation announcement](https://developers.google.com/display-video/api/deprecations#features.manual_triggers) for more information.
31486///
31487/// A builder for the *manualTriggers.patch* method supported by a *advertiser* resource.
31488/// It is not used directly, but through a [`AdvertiserMethods`] instance.
31489///
31490/// # Example
31491///
31492/// Instantiate a resource method builder
31493///
31494/// ```test_harness,no_run
31495/// # extern crate hyper;
31496/// # extern crate hyper_rustls;
31497/// # extern crate google_displayvideo1 as displayvideo1;
31498/// use displayvideo1::api::ManualTrigger;
31499/// # async fn dox() {
31500/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31501///
31502/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31503/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31504/// #     secret,
31505/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31506/// # ).build().await.unwrap();
31507///
31508/// # let client = hyper_util::client::legacy::Client::builder(
31509/// #     hyper_util::rt::TokioExecutor::new()
31510/// # )
31511/// # .build(
31512/// #     hyper_rustls::HttpsConnectorBuilder::new()
31513/// #         .with_native_roots()
31514/// #         .unwrap()
31515/// #         .https_or_http()
31516/// #         .enable_http1()
31517/// #         .build()
31518/// # );
31519/// # let mut hub = DisplayVideo::new(client, auth);
31520/// // As the method needs a request, you would usually fill it with the desired information
31521/// // into the respective structure. Some of the parts shown here might not be applicable !
31522/// // Values shown here are possibly random and not representative !
31523/// let mut req = ManualTrigger::default();
31524///
31525/// // You can configure optional parameters by calling the respective setters at will, and
31526/// // execute the final call using `doit()`.
31527/// // Values shown here are possibly random and not representative !
31528/// let result = hub.advertisers().manual_triggers_patch(req, -6, -71)
31529///              .update_mask(FieldMask::new::<&str>(&[]))
31530///              .doit().await;
31531/// # }
31532/// ```
31533pub struct AdvertiserManualTriggerPatchCall<'a, C>
31534where
31535    C: 'a,
31536{
31537    hub: &'a DisplayVideo<C>,
31538    _request: ManualTrigger,
31539    _advertiser_id: i64,
31540    _trigger_id: i64,
31541    _update_mask: Option<common::FieldMask>,
31542    _delegate: Option<&'a mut dyn common::Delegate>,
31543    _additional_params: HashMap<String, String>,
31544    _scopes: BTreeSet<String>,
31545}
31546
31547impl<'a, C> common::CallBuilder for AdvertiserManualTriggerPatchCall<'a, C> {}
31548
31549impl<'a, C> AdvertiserManualTriggerPatchCall<'a, C>
31550where
31551    C: common::Connector,
31552{
31553    /// Perform the operation you have build so far.
31554    pub async fn doit(mut self) -> common::Result<(common::Response, ManualTrigger)> {
31555        use std::borrow::Cow;
31556        use std::io::{Read, Seek};
31557
31558        use common::{url::Params, ToParts};
31559        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31560
31561        let mut dd = common::DefaultDelegate;
31562        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31563        dlg.begin(common::MethodInfo {
31564            id: "displayvideo.advertisers.manualTriggers.patch",
31565            http_method: hyper::Method::PATCH,
31566        });
31567
31568        for &field in ["alt", "advertiserId", "triggerId", "updateMask"].iter() {
31569            if self._additional_params.contains_key(field) {
31570                dlg.finished(false);
31571                return Err(common::Error::FieldClash(field));
31572            }
31573        }
31574
31575        let mut params = Params::with_capacity(6 + self._additional_params.len());
31576        params.push("advertiserId", self._advertiser_id.to_string());
31577        params.push("triggerId", self._trigger_id.to_string());
31578        if let Some(value) = self._update_mask.as_ref() {
31579            params.push("updateMask", value.to_string());
31580        }
31581
31582        params.extend(self._additional_params.iter());
31583
31584        params.push("alt", "json");
31585        let mut url = self.hub._base_url.clone()
31586            + "v1/advertisers/{+advertiserId}/manualTriggers/{+triggerId}";
31587        if self._scopes.is_empty() {
31588            self._scopes
31589                .insert(Scope::DisplayVideo.as_ref().to_string());
31590        }
31591
31592        #[allow(clippy::single_element_loop)]
31593        for &(find_this, param_name) in [
31594            ("{+advertiserId}", "advertiserId"),
31595            ("{+triggerId}", "triggerId"),
31596        ]
31597        .iter()
31598        {
31599            url = params.uri_replacement(url, param_name, find_this, true);
31600        }
31601        {
31602            let to_remove = ["triggerId", "advertiserId"];
31603            params.remove_params(&to_remove);
31604        }
31605
31606        let url = params.parse_with_url(&url);
31607
31608        let mut json_mime_type = mime::APPLICATION_JSON;
31609        let mut request_value_reader = {
31610            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31611            common::remove_json_null_values(&mut value);
31612            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31613            serde_json::to_writer(&mut dst, &value).unwrap();
31614            dst
31615        };
31616        let request_size = request_value_reader
31617            .seek(std::io::SeekFrom::End(0))
31618            .unwrap();
31619        request_value_reader
31620            .seek(std::io::SeekFrom::Start(0))
31621            .unwrap();
31622
31623        loop {
31624            let token = match self
31625                .hub
31626                .auth
31627                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31628                .await
31629            {
31630                Ok(token) => token,
31631                Err(e) => match dlg.token(e) {
31632                    Ok(token) => token,
31633                    Err(e) => {
31634                        dlg.finished(false);
31635                        return Err(common::Error::MissingToken(e));
31636                    }
31637                },
31638            };
31639            request_value_reader
31640                .seek(std::io::SeekFrom::Start(0))
31641                .unwrap();
31642            let mut req_result = {
31643                let client = &self.hub.client;
31644                dlg.pre_request();
31645                let mut req_builder = hyper::Request::builder()
31646                    .method(hyper::Method::PATCH)
31647                    .uri(url.as_str())
31648                    .header(USER_AGENT, self.hub._user_agent.clone());
31649
31650                if let Some(token) = token.as_ref() {
31651                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31652                }
31653
31654                let request = req_builder
31655                    .header(CONTENT_TYPE, json_mime_type.to_string())
31656                    .header(CONTENT_LENGTH, request_size as u64)
31657                    .body(common::to_body(
31658                        request_value_reader.get_ref().clone().into(),
31659                    ));
31660
31661                client.request(request.unwrap()).await
31662            };
31663
31664            match req_result {
31665                Err(err) => {
31666                    if let common::Retry::After(d) = dlg.http_error(&err) {
31667                        sleep(d).await;
31668                        continue;
31669                    }
31670                    dlg.finished(false);
31671                    return Err(common::Error::HttpError(err));
31672                }
31673                Ok(res) => {
31674                    let (mut parts, body) = res.into_parts();
31675                    let mut body = common::Body::new(body);
31676                    if !parts.status.is_success() {
31677                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31678                        let error = serde_json::from_str(&common::to_string(&bytes));
31679                        let response = common::to_response(parts, bytes.into());
31680
31681                        if let common::Retry::After(d) =
31682                            dlg.http_failure(&response, error.as_ref().ok())
31683                        {
31684                            sleep(d).await;
31685                            continue;
31686                        }
31687
31688                        dlg.finished(false);
31689
31690                        return Err(match error {
31691                            Ok(value) => common::Error::BadRequest(value),
31692                            _ => common::Error::Failure(response),
31693                        });
31694                    }
31695                    let response = {
31696                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31697                        let encoded = common::to_string(&bytes);
31698                        match serde_json::from_str(&encoded) {
31699                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31700                            Err(error) => {
31701                                dlg.response_json_decode_error(&encoded, &error);
31702                                return Err(common::Error::JsonDecodeError(
31703                                    encoded.to_string(),
31704                                    error,
31705                                ));
31706                            }
31707                        }
31708                    };
31709
31710                    dlg.finished(true);
31711                    return Ok(response);
31712                }
31713            }
31714        }
31715    }
31716
31717    ///
31718    /// Sets the *request* property to the given value.
31719    ///
31720    /// Even though the property as already been set when instantiating this call,
31721    /// we provide this method for API completeness.
31722    pub fn request(mut self, new_value: ManualTrigger) -> AdvertiserManualTriggerPatchCall<'a, C> {
31723        self._request = new_value;
31724        self
31725    }
31726    /// Required. Immutable. The unique ID of the advertiser that the manual trigger belongs to.
31727    ///
31728    /// Sets the *advertiser id* path property to the given value.
31729    ///
31730    /// Even though the property as already been set when instantiating this call,
31731    /// we provide this method for API completeness.
31732    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserManualTriggerPatchCall<'a, C> {
31733        self._advertiser_id = new_value;
31734        self
31735    }
31736    /// Output only. The unique ID of the manual trigger.
31737    ///
31738    /// Sets the *trigger id* path property to the given value.
31739    ///
31740    /// Even though the property as already been set when instantiating this call,
31741    /// we provide this method for API completeness.
31742    pub fn trigger_id(mut self, new_value: i64) -> AdvertiserManualTriggerPatchCall<'a, C> {
31743        self._trigger_id = new_value;
31744        self
31745    }
31746    /// Required. The mask to control which fields to update.
31747    ///
31748    /// Sets the *update mask* query property to the given value.
31749    pub fn update_mask(
31750        mut self,
31751        new_value: common::FieldMask,
31752    ) -> AdvertiserManualTriggerPatchCall<'a, C> {
31753        self._update_mask = Some(new_value);
31754        self
31755    }
31756    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31757    /// while executing the actual API request.
31758    ///
31759    /// ````text
31760    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31761    /// ````
31762    ///
31763    /// Sets the *delegate* property to the given value.
31764    pub fn delegate(
31765        mut self,
31766        new_value: &'a mut dyn common::Delegate,
31767    ) -> AdvertiserManualTriggerPatchCall<'a, C> {
31768        self._delegate = Some(new_value);
31769        self
31770    }
31771
31772    /// Set any additional parameter of the query string used in the request.
31773    /// It should be used to set parameters which are not yet available through their own
31774    /// setters.
31775    ///
31776    /// Please note that this method must not be used to set any of the known parameters
31777    /// which have their own setter method. If done anyway, the request will fail.
31778    ///
31779    /// # Additional Parameters
31780    ///
31781    /// * *$.xgafv* (query-string) - V1 error format.
31782    /// * *access_token* (query-string) - OAuth access token.
31783    /// * *alt* (query-string) - Data format for response.
31784    /// * *callback* (query-string) - JSONP
31785    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31786    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
31787    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31788    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31789    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
31790    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31791    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31792    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserManualTriggerPatchCall<'a, C>
31793    where
31794        T: AsRef<str>,
31795    {
31796        self._additional_params
31797            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31798        self
31799    }
31800
31801    /// Identifies the authorization scope for the method you are building.
31802    ///
31803    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31804    /// [`Scope::DisplayVideo`].
31805    ///
31806    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31807    /// tokens for more than one scope.
31808    ///
31809    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31810    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31811    /// sufficient, a read-write scope will do as well.
31812    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserManualTriggerPatchCall<'a, C>
31813    where
31814        St: AsRef<str>,
31815    {
31816        self._scopes.insert(String::from(scope.as_ref()));
31817        self
31818    }
31819    /// Identifies the authorization scope(s) for the method you are building.
31820    ///
31821    /// See [`Self::add_scope()`] for details.
31822    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserManualTriggerPatchCall<'a, C>
31823    where
31824        I: IntoIterator<Item = St>,
31825        St: AsRef<str>,
31826    {
31827        self._scopes
31828            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31829        self
31830    }
31831
31832    /// Removes all scopes, and no default scope will be used either.
31833    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31834    /// for details).
31835    pub fn clear_scopes(mut self) -> AdvertiserManualTriggerPatchCall<'a, C> {
31836        self._scopes.clear();
31837        self
31838    }
31839}
31840
31841/// Bulk edits negative keywords in a single negative keyword list. The operation will delete the negative keywords provided in BulkEditNegativeKeywordsRequest.deleted_negative_keywords and then create the negative keywords provided in BulkEditNegativeKeywordsRequest.created_negative_keywords. This operation is guaranteed to be atomic and will never result in a partial success or partial failure.
31842///
31843/// A builder for the *negativeKeywordLists.negativeKeywords.bulkEdit* method supported by a *advertiser* resource.
31844/// It is not used directly, but through a [`AdvertiserMethods`] instance.
31845///
31846/// # Example
31847///
31848/// Instantiate a resource method builder
31849///
31850/// ```test_harness,no_run
31851/// # extern crate hyper;
31852/// # extern crate hyper_rustls;
31853/// # extern crate google_displayvideo1 as displayvideo1;
31854/// use displayvideo1::api::BulkEditNegativeKeywordsRequest;
31855/// # async fn dox() {
31856/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31857///
31858/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31859/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31860/// #     secret,
31861/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31862/// # ).build().await.unwrap();
31863///
31864/// # let client = hyper_util::client::legacy::Client::builder(
31865/// #     hyper_util::rt::TokioExecutor::new()
31866/// # )
31867/// # .build(
31868/// #     hyper_rustls::HttpsConnectorBuilder::new()
31869/// #         .with_native_roots()
31870/// #         .unwrap()
31871/// #         .https_or_http()
31872/// #         .enable_http1()
31873/// #         .build()
31874/// # );
31875/// # let mut hub = DisplayVideo::new(client, auth);
31876/// // As the method needs a request, you would usually fill it with the desired information
31877/// // into the respective structure. Some of the parts shown here might not be applicable !
31878/// // Values shown here are possibly random and not representative !
31879/// let mut req = BulkEditNegativeKeywordsRequest::default();
31880///
31881/// // You can configure optional parameters by calling the respective setters at will, and
31882/// // execute the final call using `doit()`.
31883/// // Values shown here are possibly random and not representative !
31884/// let result = hub.advertisers().negative_keyword_lists_negative_keywords_bulk_edit(req, -52, -11)
31885///              .doit().await;
31886/// # }
31887/// ```
31888pub struct AdvertiserNegativeKeywordListNegativeKeywordBulkEditCall<'a, C>
31889where
31890    C: 'a,
31891{
31892    hub: &'a DisplayVideo<C>,
31893    _request: BulkEditNegativeKeywordsRequest,
31894    _advertiser_id: i64,
31895    _negative_keyword_list_id: i64,
31896    _delegate: Option<&'a mut dyn common::Delegate>,
31897    _additional_params: HashMap<String, String>,
31898    _scopes: BTreeSet<String>,
31899}
31900
31901impl<'a, C> common::CallBuilder
31902    for AdvertiserNegativeKeywordListNegativeKeywordBulkEditCall<'a, C>
31903{
31904}
31905
31906impl<'a, C> AdvertiserNegativeKeywordListNegativeKeywordBulkEditCall<'a, C>
31907where
31908    C: common::Connector,
31909{
31910    /// Perform the operation you have build so far.
31911    pub async fn doit(
31912        mut self,
31913    ) -> common::Result<(common::Response, BulkEditNegativeKeywordsResponse)> {
31914        use std::borrow::Cow;
31915        use std::io::{Read, Seek};
31916
31917        use common::{url::Params, ToParts};
31918        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31919
31920        let mut dd = common::DefaultDelegate;
31921        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31922        dlg.begin(common::MethodInfo {
31923            id: "displayvideo.advertisers.negativeKeywordLists.negativeKeywords.bulkEdit",
31924            http_method: hyper::Method::POST,
31925        });
31926
31927        for &field in ["alt", "advertiserId", "negativeKeywordListId"].iter() {
31928            if self._additional_params.contains_key(field) {
31929                dlg.finished(false);
31930                return Err(common::Error::FieldClash(field));
31931            }
31932        }
31933
31934        let mut params = Params::with_capacity(5 + self._additional_params.len());
31935        params.push("advertiserId", self._advertiser_id.to_string());
31936        params.push(
31937            "negativeKeywordListId",
31938            self._negative_keyword_list_id.to_string(),
31939        );
31940
31941        params.extend(self._additional_params.iter());
31942
31943        params.push("alt", "json");
31944        let mut url = self.hub._base_url.clone() + "v1/advertisers/{advertiserId}/negativeKeywordLists/{+negativeKeywordListId}/negativeKeywords:bulkEdit";
31945        if self._scopes.is_empty() {
31946            self._scopes
31947                .insert(Scope::DisplayVideo.as_ref().to_string());
31948        }
31949
31950        #[allow(clippy::single_element_loop)]
31951        for &(find_this, param_name) in [
31952            ("{advertiserId}", "advertiserId"),
31953            ("{+negativeKeywordListId}", "negativeKeywordListId"),
31954        ]
31955        .iter()
31956        {
31957            url = params.uri_replacement(url, param_name, find_this, true);
31958        }
31959        {
31960            let to_remove = ["negativeKeywordListId", "advertiserId"];
31961            params.remove_params(&to_remove);
31962        }
31963
31964        let url = params.parse_with_url(&url);
31965
31966        let mut json_mime_type = mime::APPLICATION_JSON;
31967        let mut request_value_reader = {
31968            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31969            common::remove_json_null_values(&mut value);
31970            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31971            serde_json::to_writer(&mut dst, &value).unwrap();
31972            dst
31973        };
31974        let request_size = request_value_reader
31975            .seek(std::io::SeekFrom::End(0))
31976            .unwrap();
31977        request_value_reader
31978            .seek(std::io::SeekFrom::Start(0))
31979            .unwrap();
31980
31981        loop {
31982            let token = match self
31983                .hub
31984                .auth
31985                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31986                .await
31987            {
31988                Ok(token) => token,
31989                Err(e) => match dlg.token(e) {
31990                    Ok(token) => token,
31991                    Err(e) => {
31992                        dlg.finished(false);
31993                        return Err(common::Error::MissingToken(e));
31994                    }
31995                },
31996            };
31997            request_value_reader
31998                .seek(std::io::SeekFrom::Start(0))
31999                .unwrap();
32000            let mut req_result = {
32001                let client = &self.hub.client;
32002                dlg.pre_request();
32003                let mut req_builder = hyper::Request::builder()
32004                    .method(hyper::Method::POST)
32005                    .uri(url.as_str())
32006                    .header(USER_AGENT, self.hub._user_agent.clone());
32007
32008                if let Some(token) = token.as_ref() {
32009                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32010                }
32011
32012                let request = req_builder
32013                    .header(CONTENT_TYPE, json_mime_type.to_string())
32014                    .header(CONTENT_LENGTH, request_size as u64)
32015                    .body(common::to_body(
32016                        request_value_reader.get_ref().clone().into(),
32017                    ));
32018
32019                client.request(request.unwrap()).await
32020            };
32021
32022            match req_result {
32023                Err(err) => {
32024                    if let common::Retry::After(d) = dlg.http_error(&err) {
32025                        sleep(d).await;
32026                        continue;
32027                    }
32028                    dlg.finished(false);
32029                    return Err(common::Error::HttpError(err));
32030                }
32031                Ok(res) => {
32032                    let (mut parts, body) = res.into_parts();
32033                    let mut body = common::Body::new(body);
32034                    if !parts.status.is_success() {
32035                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32036                        let error = serde_json::from_str(&common::to_string(&bytes));
32037                        let response = common::to_response(parts, bytes.into());
32038
32039                        if let common::Retry::After(d) =
32040                            dlg.http_failure(&response, error.as_ref().ok())
32041                        {
32042                            sleep(d).await;
32043                            continue;
32044                        }
32045
32046                        dlg.finished(false);
32047
32048                        return Err(match error {
32049                            Ok(value) => common::Error::BadRequest(value),
32050                            _ => common::Error::Failure(response),
32051                        });
32052                    }
32053                    let response = {
32054                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32055                        let encoded = common::to_string(&bytes);
32056                        match serde_json::from_str(&encoded) {
32057                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32058                            Err(error) => {
32059                                dlg.response_json_decode_error(&encoded, &error);
32060                                return Err(common::Error::JsonDecodeError(
32061                                    encoded.to_string(),
32062                                    error,
32063                                ));
32064                            }
32065                        }
32066                    };
32067
32068                    dlg.finished(true);
32069                    return Ok(response);
32070                }
32071            }
32072        }
32073    }
32074
32075    ///
32076    /// Sets the *request* property to the given value.
32077    ///
32078    /// Even though the property as already been set when instantiating this call,
32079    /// we provide this method for API completeness.
32080    pub fn request(
32081        mut self,
32082        new_value: BulkEditNegativeKeywordsRequest,
32083    ) -> AdvertiserNegativeKeywordListNegativeKeywordBulkEditCall<'a, C> {
32084        self._request = new_value;
32085        self
32086    }
32087    /// Required. The ID of the DV360 advertiser to which the parent negative keyword list belongs.
32088    ///
32089    /// Sets the *advertiser id* path property to the given value.
32090    ///
32091    /// Even though the property as already been set when instantiating this call,
32092    /// we provide this method for API completeness.
32093    pub fn advertiser_id(
32094        mut self,
32095        new_value: i64,
32096    ) -> AdvertiserNegativeKeywordListNegativeKeywordBulkEditCall<'a, C> {
32097        self._advertiser_id = new_value;
32098        self
32099    }
32100    /// Required. The ID of the parent negative keyword list to which the negative keywords belong.
32101    ///
32102    /// Sets the *negative keyword list id* path property to the given value.
32103    ///
32104    /// Even though the property as already been set when instantiating this call,
32105    /// we provide this method for API completeness.
32106    pub fn negative_keyword_list_id(
32107        mut self,
32108        new_value: i64,
32109    ) -> AdvertiserNegativeKeywordListNegativeKeywordBulkEditCall<'a, C> {
32110        self._negative_keyword_list_id = new_value;
32111        self
32112    }
32113    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32114    /// while executing the actual API request.
32115    ///
32116    /// ````text
32117    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32118    /// ````
32119    ///
32120    /// Sets the *delegate* property to the given value.
32121    pub fn delegate(
32122        mut self,
32123        new_value: &'a mut dyn common::Delegate,
32124    ) -> AdvertiserNegativeKeywordListNegativeKeywordBulkEditCall<'a, C> {
32125        self._delegate = Some(new_value);
32126        self
32127    }
32128
32129    /// Set any additional parameter of the query string used in the request.
32130    /// It should be used to set parameters which are not yet available through their own
32131    /// setters.
32132    ///
32133    /// Please note that this method must not be used to set any of the known parameters
32134    /// which have their own setter method. If done anyway, the request will fail.
32135    ///
32136    /// # Additional Parameters
32137    ///
32138    /// * *$.xgafv* (query-string) - V1 error format.
32139    /// * *access_token* (query-string) - OAuth access token.
32140    /// * *alt* (query-string) - Data format for response.
32141    /// * *callback* (query-string) - JSONP
32142    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32143    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
32144    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32145    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32146    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
32147    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32148    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32149    pub fn param<T>(
32150        mut self,
32151        name: T,
32152        value: T,
32153    ) -> AdvertiserNegativeKeywordListNegativeKeywordBulkEditCall<'a, C>
32154    where
32155        T: AsRef<str>,
32156    {
32157        self._additional_params
32158            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32159        self
32160    }
32161
32162    /// Identifies the authorization scope for the method you are building.
32163    ///
32164    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32165    /// [`Scope::DisplayVideo`].
32166    ///
32167    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32168    /// tokens for more than one scope.
32169    ///
32170    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32171    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32172    /// sufficient, a read-write scope will do as well.
32173    pub fn add_scope<St>(
32174        mut self,
32175        scope: St,
32176    ) -> AdvertiserNegativeKeywordListNegativeKeywordBulkEditCall<'a, C>
32177    where
32178        St: AsRef<str>,
32179    {
32180        self._scopes.insert(String::from(scope.as_ref()));
32181        self
32182    }
32183    /// Identifies the authorization scope(s) for the method you are building.
32184    ///
32185    /// See [`Self::add_scope()`] for details.
32186    pub fn add_scopes<I, St>(
32187        mut self,
32188        scopes: I,
32189    ) -> AdvertiserNegativeKeywordListNegativeKeywordBulkEditCall<'a, C>
32190    where
32191        I: IntoIterator<Item = St>,
32192        St: AsRef<str>,
32193    {
32194        self._scopes
32195            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32196        self
32197    }
32198
32199    /// Removes all scopes, and no default scope will be used either.
32200    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32201    /// for details).
32202    pub fn clear_scopes(
32203        mut self,
32204    ) -> AdvertiserNegativeKeywordListNegativeKeywordBulkEditCall<'a, C> {
32205        self._scopes.clear();
32206        self
32207    }
32208}
32209
32210/// Creates a negative keyword in a negative keyword list.
32211///
32212/// A builder for the *negativeKeywordLists.negativeKeywords.create* method supported by a *advertiser* resource.
32213/// It is not used directly, but through a [`AdvertiserMethods`] instance.
32214///
32215/// # Example
32216///
32217/// Instantiate a resource method builder
32218///
32219/// ```test_harness,no_run
32220/// # extern crate hyper;
32221/// # extern crate hyper_rustls;
32222/// # extern crate google_displayvideo1 as displayvideo1;
32223/// use displayvideo1::api::NegativeKeyword;
32224/// # async fn dox() {
32225/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32226///
32227/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32228/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32229/// #     secret,
32230/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32231/// # ).build().await.unwrap();
32232///
32233/// # let client = hyper_util::client::legacy::Client::builder(
32234/// #     hyper_util::rt::TokioExecutor::new()
32235/// # )
32236/// # .build(
32237/// #     hyper_rustls::HttpsConnectorBuilder::new()
32238/// #         .with_native_roots()
32239/// #         .unwrap()
32240/// #         .https_or_http()
32241/// #         .enable_http1()
32242/// #         .build()
32243/// # );
32244/// # let mut hub = DisplayVideo::new(client, auth);
32245/// // As the method needs a request, you would usually fill it with the desired information
32246/// // into the respective structure. Some of the parts shown here might not be applicable !
32247/// // Values shown here are possibly random and not representative !
32248/// let mut req = NegativeKeyword::default();
32249///
32250/// // You can configure optional parameters by calling the respective setters at will, and
32251/// // execute the final call using `doit()`.
32252/// // Values shown here are possibly random and not representative !
32253/// let result = hub.advertisers().negative_keyword_lists_negative_keywords_create(req, -91, -43)
32254///              .doit().await;
32255/// # }
32256/// ```
32257pub struct AdvertiserNegativeKeywordListNegativeKeywordCreateCall<'a, C>
32258where
32259    C: 'a,
32260{
32261    hub: &'a DisplayVideo<C>,
32262    _request: NegativeKeyword,
32263    _advertiser_id: i64,
32264    _negative_keyword_list_id: i64,
32265    _delegate: Option<&'a mut dyn common::Delegate>,
32266    _additional_params: HashMap<String, String>,
32267    _scopes: BTreeSet<String>,
32268}
32269
32270impl<'a, C> common::CallBuilder for AdvertiserNegativeKeywordListNegativeKeywordCreateCall<'a, C> {}
32271
32272impl<'a, C> AdvertiserNegativeKeywordListNegativeKeywordCreateCall<'a, C>
32273where
32274    C: common::Connector,
32275{
32276    /// Perform the operation you have build so far.
32277    pub async fn doit(mut self) -> common::Result<(common::Response, NegativeKeyword)> {
32278        use std::borrow::Cow;
32279        use std::io::{Read, Seek};
32280
32281        use common::{url::Params, ToParts};
32282        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32283
32284        let mut dd = common::DefaultDelegate;
32285        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32286        dlg.begin(common::MethodInfo {
32287            id: "displayvideo.advertisers.negativeKeywordLists.negativeKeywords.create",
32288            http_method: hyper::Method::POST,
32289        });
32290
32291        for &field in ["alt", "advertiserId", "negativeKeywordListId"].iter() {
32292            if self._additional_params.contains_key(field) {
32293                dlg.finished(false);
32294                return Err(common::Error::FieldClash(field));
32295            }
32296        }
32297
32298        let mut params = Params::with_capacity(5 + self._additional_params.len());
32299        params.push("advertiserId", self._advertiser_id.to_string());
32300        params.push(
32301            "negativeKeywordListId",
32302            self._negative_keyword_list_id.to_string(),
32303        );
32304
32305        params.extend(self._additional_params.iter());
32306
32307        params.push("alt", "json");
32308        let mut url = self.hub._base_url.clone() + "v1/advertisers/{advertiserId}/negativeKeywordLists/{+negativeKeywordListId}/negativeKeywords";
32309        if self._scopes.is_empty() {
32310            self._scopes
32311                .insert(Scope::DisplayVideo.as_ref().to_string());
32312        }
32313
32314        #[allow(clippy::single_element_loop)]
32315        for &(find_this, param_name) in [
32316            ("{advertiserId}", "advertiserId"),
32317            ("{+negativeKeywordListId}", "negativeKeywordListId"),
32318        ]
32319        .iter()
32320        {
32321            url = params.uri_replacement(url, param_name, find_this, true);
32322        }
32323        {
32324            let to_remove = ["negativeKeywordListId", "advertiserId"];
32325            params.remove_params(&to_remove);
32326        }
32327
32328        let url = params.parse_with_url(&url);
32329
32330        let mut json_mime_type = mime::APPLICATION_JSON;
32331        let mut request_value_reader = {
32332            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32333            common::remove_json_null_values(&mut value);
32334            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32335            serde_json::to_writer(&mut dst, &value).unwrap();
32336            dst
32337        };
32338        let request_size = request_value_reader
32339            .seek(std::io::SeekFrom::End(0))
32340            .unwrap();
32341        request_value_reader
32342            .seek(std::io::SeekFrom::Start(0))
32343            .unwrap();
32344
32345        loop {
32346            let token = match self
32347                .hub
32348                .auth
32349                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32350                .await
32351            {
32352                Ok(token) => token,
32353                Err(e) => match dlg.token(e) {
32354                    Ok(token) => token,
32355                    Err(e) => {
32356                        dlg.finished(false);
32357                        return Err(common::Error::MissingToken(e));
32358                    }
32359                },
32360            };
32361            request_value_reader
32362                .seek(std::io::SeekFrom::Start(0))
32363                .unwrap();
32364            let mut req_result = {
32365                let client = &self.hub.client;
32366                dlg.pre_request();
32367                let mut req_builder = hyper::Request::builder()
32368                    .method(hyper::Method::POST)
32369                    .uri(url.as_str())
32370                    .header(USER_AGENT, self.hub._user_agent.clone());
32371
32372                if let Some(token) = token.as_ref() {
32373                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32374                }
32375
32376                let request = req_builder
32377                    .header(CONTENT_TYPE, json_mime_type.to_string())
32378                    .header(CONTENT_LENGTH, request_size as u64)
32379                    .body(common::to_body(
32380                        request_value_reader.get_ref().clone().into(),
32381                    ));
32382
32383                client.request(request.unwrap()).await
32384            };
32385
32386            match req_result {
32387                Err(err) => {
32388                    if let common::Retry::After(d) = dlg.http_error(&err) {
32389                        sleep(d).await;
32390                        continue;
32391                    }
32392                    dlg.finished(false);
32393                    return Err(common::Error::HttpError(err));
32394                }
32395                Ok(res) => {
32396                    let (mut parts, body) = res.into_parts();
32397                    let mut body = common::Body::new(body);
32398                    if !parts.status.is_success() {
32399                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32400                        let error = serde_json::from_str(&common::to_string(&bytes));
32401                        let response = common::to_response(parts, bytes.into());
32402
32403                        if let common::Retry::After(d) =
32404                            dlg.http_failure(&response, error.as_ref().ok())
32405                        {
32406                            sleep(d).await;
32407                            continue;
32408                        }
32409
32410                        dlg.finished(false);
32411
32412                        return Err(match error {
32413                            Ok(value) => common::Error::BadRequest(value),
32414                            _ => common::Error::Failure(response),
32415                        });
32416                    }
32417                    let response = {
32418                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32419                        let encoded = common::to_string(&bytes);
32420                        match serde_json::from_str(&encoded) {
32421                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32422                            Err(error) => {
32423                                dlg.response_json_decode_error(&encoded, &error);
32424                                return Err(common::Error::JsonDecodeError(
32425                                    encoded.to_string(),
32426                                    error,
32427                                ));
32428                            }
32429                        }
32430                    };
32431
32432                    dlg.finished(true);
32433                    return Ok(response);
32434                }
32435            }
32436        }
32437    }
32438
32439    ///
32440    /// Sets the *request* property to the given value.
32441    ///
32442    /// Even though the property as already been set when instantiating this call,
32443    /// we provide this method for API completeness.
32444    pub fn request(
32445        mut self,
32446        new_value: NegativeKeyword,
32447    ) -> AdvertiserNegativeKeywordListNegativeKeywordCreateCall<'a, C> {
32448        self._request = new_value;
32449        self
32450    }
32451    /// Required. The ID of the DV360 advertiser to which the parent negative keyword list belongs.
32452    ///
32453    /// Sets the *advertiser id* path property to the given value.
32454    ///
32455    /// Even though the property as already been set when instantiating this call,
32456    /// we provide this method for API completeness.
32457    pub fn advertiser_id(
32458        mut self,
32459        new_value: i64,
32460    ) -> AdvertiserNegativeKeywordListNegativeKeywordCreateCall<'a, C> {
32461        self._advertiser_id = new_value;
32462        self
32463    }
32464    /// Required. The ID of the parent negative keyword list in which the negative keyword will be created.
32465    ///
32466    /// Sets the *negative keyword list id* path property to the given value.
32467    ///
32468    /// Even though the property as already been set when instantiating this call,
32469    /// we provide this method for API completeness.
32470    pub fn negative_keyword_list_id(
32471        mut self,
32472        new_value: i64,
32473    ) -> AdvertiserNegativeKeywordListNegativeKeywordCreateCall<'a, C> {
32474        self._negative_keyword_list_id = new_value;
32475        self
32476    }
32477    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32478    /// while executing the actual API request.
32479    ///
32480    /// ````text
32481    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32482    /// ````
32483    ///
32484    /// Sets the *delegate* property to the given value.
32485    pub fn delegate(
32486        mut self,
32487        new_value: &'a mut dyn common::Delegate,
32488    ) -> AdvertiserNegativeKeywordListNegativeKeywordCreateCall<'a, C> {
32489        self._delegate = Some(new_value);
32490        self
32491    }
32492
32493    /// Set any additional parameter of the query string used in the request.
32494    /// It should be used to set parameters which are not yet available through their own
32495    /// setters.
32496    ///
32497    /// Please note that this method must not be used to set any of the known parameters
32498    /// which have their own setter method. If done anyway, the request will fail.
32499    ///
32500    /// # Additional Parameters
32501    ///
32502    /// * *$.xgafv* (query-string) - V1 error format.
32503    /// * *access_token* (query-string) - OAuth access token.
32504    /// * *alt* (query-string) - Data format for response.
32505    /// * *callback* (query-string) - JSONP
32506    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32507    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
32508    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32509    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32510    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
32511    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32512    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32513    pub fn param<T>(
32514        mut self,
32515        name: T,
32516        value: T,
32517    ) -> AdvertiserNegativeKeywordListNegativeKeywordCreateCall<'a, C>
32518    where
32519        T: AsRef<str>,
32520    {
32521        self._additional_params
32522            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32523        self
32524    }
32525
32526    /// Identifies the authorization scope for the method you are building.
32527    ///
32528    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32529    /// [`Scope::DisplayVideo`].
32530    ///
32531    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32532    /// tokens for more than one scope.
32533    ///
32534    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32535    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32536    /// sufficient, a read-write scope will do as well.
32537    pub fn add_scope<St>(
32538        mut self,
32539        scope: St,
32540    ) -> AdvertiserNegativeKeywordListNegativeKeywordCreateCall<'a, C>
32541    where
32542        St: AsRef<str>,
32543    {
32544        self._scopes.insert(String::from(scope.as_ref()));
32545        self
32546    }
32547    /// Identifies the authorization scope(s) for the method you are building.
32548    ///
32549    /// See [`Self::add_scope()`] for details.
32550    pub fn add_scopes<I, St>(
32551        mut self,
32552        scopes: I,
32553    ) -> AdvertiserNegativeKeywordListNegativeKeywordCreateCall<'a, C>
32554    where
32555        I: IntoIterator<Item = St>,
32556        St: AsRef<str>,
32557    {
32558        self._scopes
32559            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32560        self
32561    }
32562
32563    /// Removes all scopes, and no default scope will be used either.
32564    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32565    /// for details).
32566    pub fn clear_scopes(mut self) -> AdvertiserNegativeKeywordListNegativeKeywordCreateCall<'a, C> {
32567        self._scopes.clear();
32568        self
32569    }
32570}
32571
32572/// Deletes a negative keyword from a negative keyword list.
32573///
32574/// A builder for the *negativeKeywordLists.negativeKeywords.delete* method supported by a *advertiser* resource.
32575/// It is not used directly, but through a [`AdvertiserMethods`] instance.
32576///
32577/// # Example
32578///
32579/// Instantiate a resource method builder
32580///
32581/// ```test_harness,no_run
32582/// # extern crate hyper;
32583/// # extern crate hyper_rustls;
32584/// # extern crate google_displayvideo1 as displayvideo1;
32585/// # async fn dox() {
32586/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32587///
32588/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32589/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32590/// #     secret,
32591/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32592/// # ).build().await.unwrap();
32593///
32594/// # let client = hyper_util::client::legacy::Client::builder(
32595/// #     hyper_util::rt::TokioExecutor::new()
32596/// # )
32597/// # .build(
32598/// #     hyper_rustls::HttpsConnectorBuilder::new()
32599/// #         .with_native_roots()
32600/// #         .unwrap()
32601/// #         .https_or_http()
32602/// #         .enable_http1()
32603/// #         .build()
32604/// # );
32605/// # let mut hub = DisplayVideo::new(client, auth);
32606/// // You can configure optional parameters by calling the respective setters at will, and
32607/// // execute the final call using `doit()`.
32608/// // Values shown here are possibly random and not representative !
32609/// let result = hub.advertisers().negative_keyword_lists_negative_keywords_delete(-13, -101, "keywordValue")
32610///              .doit().await;
32611/// # }
32612/// ```
32613pub struct AdvertiserNegativeKeywordListNegativeKeywordDeleteCall<'a, C>
32614where
32615    C: 'a,
32616{
32617    hub: &'a DisplayVideo<C>,
32618    _advertiser_id: i64,
32619    _negative_keyword_list_id: i64,
32620    _keyword_value: String,
32621    _delegate: Option<&'a mut dyn common::Delegate>,
32622    _additional_params: HashMap<String, String>,
32623    _scopes: BTreeSet<String>,
32624}
32625
32626impl<'a, C> common::CallBuilder for AdvertiserNegativeKeywordListNegativeKeywordDeleteCall<'a, C> {}
32627
32628impl<'a, C> AdvertiserNegativeKeywordListNegativeKeywordDeleteCall<'a, C>
32629where
32630    C: common::Connector,
32631{
32632    /// Perform the operation you have build so far.
32633    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
32634        use std::borrow::Cow;
32635        use std::io::{Read, Seek};
32636
32637        use common::{url::Params, ToParts};
32638        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32639
32640        let mut dd = common::DefaultDelegate;
32641        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32642        dlg.begin(common::MethodInfo {
32643            id: "displayvideo.advertisers.negativeKeywordLists.negativeKeywords.delete",
32644            http_method: hyper::Method::DELETE,
32645        });
32646
32647        for &field in [
32648            "alt",
32649            "advertiserId",
32650            "negativeKeywordListId",
32651            "keywordValue",
32652        ]
32653        .iter()
32654        {
32655            if self._additional_params.contains_key(field) {
32656                dlg.finished(false);
32657                return Err(common::Error::FieldClash(field));
32658            }
32659        }
32660
32661        let mut params = Params::with_capacity(5 + self._additional_params.len());
32662        params.push("advertiserId", self._advertiser_id.to_string());
32663        params.push(
32664            "negativeKeywordListId",
32665            self._negative_keyword_list_id.to_string(),
32666        );
32667        params.push("keywordValue", self._keyword_value);
32668
32669        params.extend(self._additional_params.iter());
32670
32671        params.push("alt", "json");
32672        let mut url = self.hub._base_url.clone() + "v1/advertisers/{advertiserId}/negativeKeywordLists/{+negativeKeywordListId}/negativeKeywords/{+keywordValue}";
32673        if self._scopes.is_empty() {
32674            self._scopes
32675                .insert(Scope::DisplayVideo.as_ref().to_string());
32676        }
32677
32678        #[allow(clippy::single_element_loop)]
32679        for &(find_this, param_name) in [
32680            ("{advertiserId}", "advertiserId"),
32681            ("{+negativeKeywordListId}", "negativeKeywordListId"),
32682            ("{+keywordValue}", "keywordValue"),
32683        ]
32684        .iter()
32685        {
32686            url = params.uri_replacement(url, param_name, find_this, true);
32687        }
32688        {
32689            let to_remove = ["keywordValue", "negativeKeywordListId", "advertiserId"];
32690            params.remove_params(&to_remove);
32691        }
32692
32693        let url = params.parse_with_url(&url);
32694
32695        loop {
32696            let token = match self
32697                .hub
32698                .auth
32699                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32700                .await
32701            {
32702                Ok(token) => token,
32703                Err(e) => match dlg.token(e) {
32704                    Ok(token) => token,
32705                    Err(e) => {
32706                        dlg.finished(false);
32707                        return Err(common::Error::MissingToken(e));
32708                    }
32709                },
32710            };
32711            let mut req_result = {
32712                let client = &self.hub.client;
32713                dlg.pre_request();
32714                let mut req_builder = hyper::Request::builder()
32715                    .method(hyper::Method::DELETE)
32716                    .uri(url.as_str())
32717                    .header(USER_AGENT, self.hub._user_agent.clone());
32718
32719                if let Some(token) = token.as_ref() {
32720                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32721                }
32722
32723                let request = req_builder
32724                    .header(CONTENT_LENGTH, 0_u64)
32725                    .body(common::to_body::<String>(None));
32726
32727                client.request(request.unwrap()).await
32728            };
32729
32730            match req_result {
32731                Err(err) => {
32732                    if let common::Retry::After(d) = dlg.http_error(&err) {
32733                        sleep(d).await;
32734                        continue;
32735                    }
32736                    dlg.finished(false);
32737                    return Err(common::Error::HttpError(err));
32738                }
32739                Ok(res) => {
32740                    let (mut parts, body) = res.into_parts();
32741                    let mut body = common::Body::new(body);
32742                    if !parts.status.is_success() {
32743                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32744                        let error = serde_json::from_str(&common::to_string(&bytes));
32745                        let response = common::to_response(parts, bytes.into());
32746
32747                        if let common::Retry::After(d) =
32748                            dlg.http_failure(&response, error.as_ref().ok())
32749                        {
32750                            sleep(d).await;
32751                            continue;
32752                        }
32753
32754                        dlg.finished(false);
32755
32756                        return Err(match error {
32757                            Ok(value) => common::Error::BadRequest(value),
32758                            _ => common::Error::Failure(response),
32759                        });
32760                    }
32761                    let response = {
32762                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32763                        let encoded = common::to_string(&bytes);
32764                        match serde_json::from_str(&encoded) {
32765                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32766                            Err(error) => {
32767                                dlg.response_json_decode_error(&encoded, &error);
32768                                return Err(common::Error::JsonDecodeError(
32769                                    encoded.to_string(),
32770                                    error,
32771                                ));
32772                            }
32773                        }
32774                    };
32775
32776                    dlg.finished(true);
32777                    return Ok(response);
32778                }
32779            }
32780        }
32781    }
32782
32783    /// Required. The ID of the DV360 advertiser to which the parent negative keyword list belongs.
32784    ///
32785    /// Sets the *advertiser id* path property to the given value.
32786    ///
32787    /// Even though the property as already been set when instantiating this call,
32788    /// we provide this method for API completeness.
32789    pub fn advertiser_id(
32790        mut self,
32791        new_value: i64,
32792    ) -> AdvertiserNegativeKeywordListNegativeKeywordDeleteCall<'a, C> {
32793        self._advertiser_id = new_value;
32794        self
32795    }
32796    /// Required. The ID of the parent negative keyword list to which the negative keyword belongs.
32797    ///
32798    /// Sets the *negative keyword list id* path property to the given value.
32799    ///
32800    /// Even though the property as already been set when instantiating this call,
32801    /// we provide this method for API completeness.
32802    pub fn negative_keyword_list_id(
32803        mut self,
32804        new_value: i64,
32805    ) -> AdvertiserNegativeKeywordListNegativeKeywordDeleteCall<'a, C> {
32806        self._negative_keyword_list_id = new_value;
32807        self
32808    }
32809    /// Required. The keyword value of the negative keyword to delete.
32810    ///
32811    /// Sets the *keyword value* path property to the given value.
32812    ///
32813    /// Even though the property as already been set when instantiating this call,
32814    /// we provide this method for API completeness.
32815    pub fn keyword_value(
32816        mut self,
32817        new_value: &str,
32818    ) -> AdvertiserNegativeKeywordListNegativeKeywordDeleteCall<'a, C> {
32819        self._keyword_value = new_value.to_string();
32820        self
32821    }
32822    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32823    /// while executing the actual API request.
32824    ///
32825    /// ````text
32826    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32827    /// ````
32828    ///
32829    /// Sets the *delegate* property to the given value.
32830    pub fn delegate(
32831        mut self,
32832        new_value: &'a mut dyn common::Delegate,
32833    ) -> AdvertiserNegativeKeywordListNegativeKeywordDeleteCall<'a, C> {
32834        self._delegate = Some(new_value);
32835        self
32836    }
32837
32838    /// Set any additional parameter of the query string used in the request.
32839    /// It should be used to set parameters which are not yet available through their own
32840    /// setters.
32841    ///
32842    /// Please note that this method must not be used to set any of the known parameters
32843    /// which have their own setter method. If done anyway, the request will fail.
32844    ///
32845    /// # Additional Parameters
32846    ///
32847    /// * *$.xgafv* (query-string) - V1 error format.
32848    /// * *access_token* (query-string) - OAuth access token.
32849    /// * *alt* (query-string) - Data format for response.
32850    /// * *callback* (query-string) - JSONP
32851    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32852    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
32853    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32854    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32855    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
32856    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32857    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32858    pub fn param<T>(
32859        mut self,
32860        name: T,
32861        value: T,
32862    ) -> AdvertiserNegativeKeywordListNegativeKeywordDeleteCall<'a, C>
32863    where
32864        T: AsRef<str>,
32865    {
32866        self._additional_params
32867            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32868        self
32869    }
32870
32871    /// Identifies the authorization scope for the method you are building.
32872    ///
32873    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32874    /// [`Scope::DisplayVideo`].
32875    ///
32876    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32877    /// tokens for more than one scope.
32878    ///
32879    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32880    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32881    /// sufficient, a read-write scope will do as well.
32882    pub fn add_scope<St>(
32883        mut self,
32884        scope: St,
32885    ) -> AdvertiserNegativeKeywordListNegativeKeywordDeleteCall<'a, C>
32886    where
32887        St: AsRef<str>,
32888    {
32889        self._scopes.insert(String::from(scope.as_ref()));
32890        self
32891    }
32892    /// Identifies the authorization scope(s) for the method you are building.
32893    ///
32894    /// See [`Self::add_scope()`] for details.
32895    pub fn add_scopes<I, St>(
32896        mut self,
32897        scopes: I,
32898    ) -> AdvertiserNegativeKeywordListNegativeKeywordDeleteCall<'a, C>
32899    where
32900        I: IntoIterator<Item = St>,
32901        St: AsRef<str>,
32902    {
32903        self._scopes
32904            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32905        self
32906    }
32907
32908    /// Removes all scopes, and no default scope will be used either.
32909    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32910    /// for details).
32911    pub fn clear_scopes(mut self) -> AdvertiserNegativeKeywordListNegativeKeywordDeleteCall<'a, C> {
32912        self._scopes.clear();
32913        self
32914    }
32915}
32916
32917/// Lists negative keywords in a negative keyword list.
32918///
32919/// A builder for the *negativeKeywordLists.negativeKeywords.list* method supported by a *advertiser* resource.
32920/// It is not used directly, but through a [`AdvertiserMethods`] instance.
32921///
32922/// # Example
32923///
32924/// Instantiate a resource method builder
32925///
32926/// ```test_harness,no_run
32927/// # extern crate hyper;
32928/// # extern crate hyper_rustls;
32929/// # extern crate google_displayvideo1 as displayvideo1;
32930/// # async fn dox() {
32931/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32932///
32933/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32934/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32935/// #     secret,
32936/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32937/// # ).build().await.unwrap();
32938///
32939/// # let client = hyper_util::client::legacy::Client::builder(
32940/// #     hyper_util::rt::TokioExecutor::new()
32941/// # )
32942/// # .build(
32943/// #     hyper_rustls::HttpsConnectorBuilder::new()
32944/// #         .with_native_roots()
32945/// #         .unwrap()
32946/// #         .https_or_http()
32947/// #         .enable_http1()
32948/// #         .build()
32949/// # );
32950/// # let mut hub = DisplayVideo::new(client, auth);
32951/// // You can configure optional parameters by calling the respective setters at will, and
32952/// // execute the final call using `doit()`.
32953/// // Values shown here are possibly random and not representative !
32954/// let result = hub.advertisers().negative_keyword_lists_negative_keywords_list(-91, -66)
32955///              .page_token("tempor")
32956///              .page_size(-34)
32957///              .order_by("eos")
32958///              .filter("amet.")
32959///              .doit().await;
32960/// # }
32961/// ```
32962pub struct AdvertiserNegativeKeywordListNegativeKeywordListCall<'a, C>
32963where
32964    C: 'a,
32965{
32966    hub: &'a DisplayVideo<C>,
32967    _advertiser_id: i64,
32968    _negative_keyword_list_id: i64,
32969    _page_token: Option<String>,
32970    _page_size: Option<i32>,
32971    _order_by: Option<String>,
32972    _filter: Option<String>,
32973    _delegate: Option<&'a mut dyn common::Delegate>,
32974    _additional_params: HashMap<String, String>,
32975    _scopes: BTreeSet<String>,
32976}
32977
32978impl<'a, C> common::CallBuilder for AdvertiserNegativeKeywordListNegativeKeywordListCall<'a, C> {}
32979
32980impl<'a, C> AdvertiserNegativeKeywordListNegativeKeywordListCall<'a, C>
32981where
32982    C: common::Connector,
32983{
32984    /// Perform the operation you have build so far.
32985    pub async fn doit(
32986        mut self,
32987    ) -> common::Result<(common::Response, ListNegativeKeywordsResponse)> {
32988        use std::borrow::Cow;
32989        use std::io::{Read, Seek};
32990
32991        use common::{url::Params, ToParts};
32992        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32993
32994        let mut dd = common::DefaultDelegate;
32995        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32996        dlg.begin(common::MethodInfo {
32997            id: "displayvideo.advertisers.negativeKeywordLists.negativeKeywords.list",
32998            http_method: hyper::Method::GET,
32999        });
33000
33001        for &field in [
33002            "alt",
33003            "advertiserId",
33004            "negativeKeywordListId",
33005            "pageToken",
33006            "pageSize",
33007            "orderBy",
33008            "filter",
33009        ]
33010        .iter()
33011        {
33012            if self._additional_params.contains_key(field) {
33013                dlg.finished(false);
33014                return Err(common::Error::FieldClash(field));
33015            }
33016        }
33017
33018        let mut params = Params::with_capacity(8 + self._additional_params.len());
33019        params.push("advertiserId", self._advertiser_id.to_string());
33020        params.push(
33021            "negativeKeywordListId",
33022            self._negative_keyword_list_id.to_string(),
33023        );
33024        if let Some(value) = self._page_token.as_ref() {
33025            params.push("pageToken", value);
33026        }
33027        if let Some(value) = self._page_size.as_ref() {
33028            params.push("pageSize", value.to_string());
33029        }
33030        if let Some(value) = self._order_by.as_ref() {
33031            params.push("orderBy", value);
33032        }
33033        if let Some(value) = self._filter.as_ref() {
33034            params.push("filter", value);
33035        }
33036
33037        params.extend(self._additional_params.iter());
33038
33039        params.push("alt", "json");
33040        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/negativeKeywordLists/{+negativeKeywordListId}/negativeKeywords";
33041        if self._scopes.is_empty() {
33042            self._scopes
33043                .insert(Scope::DisplayVideo.as_ref().to_string());
33044        }
33045
33046        #[allow(clippy::single_element_loop)]
33047        for &(find_this, param_name) in [
33048            ("{+advertiserId}", "advertiserId"),
33049            ("{+negativeKeywordListId}", "negativeKeywordListId"),
33050        ]
33051        .iter()
33052        {
33053            url = params.uri_replacement(url, param_name, find_this, true);
33054        }
33055        {
33056            let to_remove = ["negativeKeywordListId", "advertiserId"];
33057            params.remove_params(&to_remove);
33058        }
33059
33060        let url = params.parse_with_url(&url);
33061
33062        loop {
33063            let token = match self
33064                .hub
33065                .auth
33066                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33067                .await
33068            {
33069                Ok(token) => token,
33070                Err(e) => match dlg.token(e) {
33071                    Ok(token) => token,
33072                    Err(e) => {
33073                        dlg.finished(false);
33074                        return Err(common::Error::MissingToken(e));
33075                    }
33076                },
33077            };
33078            let mut req_result = {
33079                let client = &self.hub.client;
33080                dlg.pre_request();
33081                let mut req_builder = hyper::Request::builder()
33082                    .method(hyper::Method::GET)
33083                    .uri(url.as_str())
33084                    .header(USER_AGENT, self.hub._user_agent.clone());
33085
33086                if let Some(token) = token.as_ref() {
33087                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33088                }
33089
33090                let request = req_builder
33091                    .header(CONTENT_LENGTH, 0_u64)
33092                    .body(common::to_body::<String>(None));
33093
33094                client.request(request.unwrap()).await
33095            };
33096
33097            match req_result {
33098                Err(err) => {
33099                    if let common::Retry::After(d) = dlg.http_error(&err) {
33100                        sleep(d).await;
33101                        continue;
33102                    }
33103                    dlg.finished(false);
33104                    return Err(common::Error::HttpError(err));
33105                }
33106                Ok(res) => {
33107                    let (mut parts, body) = res.into_parts();
33108                    let mut body = common::Body::new(body);
33109                    if !parts.status.is_success() {
33110                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33111                        let error = serde_json::from_str(&common::to_string(&bytes));
33112                        let response = common::to_response(parts, bytes.into());
33113
33114                        if let common::Retry::After(d) =
33115                            dlg.http_failure(&response, error.as_ref().ok())
33116                        {
33117                            sleep(d).await;
33118                            continue;
33119                        }
33120
33121                        dlg.finished(false);
33122
33123                        return Err(match error {
33124                            Ok(value) => common::Error::BadRequest(value),
33125                            _ => common::Error::Failure(response),
33126                        });
33127                    }
33128                    let response = {
33129                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33130                        let encoded = common::to_string(&bytes);
33131                        match serde_json::from_str(&encoded) {
33132                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33133                            Err(error) => {
33134                                dlg.response_json_decode_error(&encoded, &error);
33135                                return Err(common::Error::JsonDecodeError(
33136                                    encoded.to_string(),
33137                                    error,
33138                                ));
33139                            }
33140                        }
33141                    };
33142
33143                    dlg.finished(true);
33144                    return Ok(response);
33145                }
33146            }
33147        }
33148    }
33149
33150    /// Required. The ID of the DV360 advertiser to which the parent negative keyword list belongs.
33151    ///
33152    /// Sets the *advertiser id* path property to the given value.
33153    ///
33154    /// Even though the property as already been set when instantiating this call,
33155    /// we provide this method for API completeness.
33156    pub fn advertiser_id(
33157        mut self,
33158        new_value: i64,
33159    ) -> AdvertiserNegativeKeywordListNegativeKeywordListCall<'a, C> {
33160        self._advertiser_id = new_value;
33161        self
33162    }
33163    /// Required. The ID of the parent negative keyword list to which the requested negative keywords belong.
33164    ///
33165    /// Sets the *negative keyword list id* path property to the given value.
33166    ///
33167    /// Even though the property as already been set when instantiating this call,
33168    /// we provide this method for API completeness.
33169    pub fn negative_keyword_list_id(
33170        mut self,
33171        new_value: i64,
33172    ) -> AdvertiserNegativeKeywordListNegativeKeywordListCall<'a, C> {
33173        self._negative_keyword_list_id = new_value;
33174        self
33175    }
33176    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListNegativeKeywords` method. If not specified, the first page of results will be returned.
33177    ///
33178    /// Sets the *page token* query property to the given value.
33179    pub fn page_token(
33180        mut self,
33181        new_value: &str,
33182    ) -> AdvertiserNegativeKeywordListNegativeKeywordListCall<'a, C> {
33183        self._page_token = Some(new_value.to_string());
33184        self
33185    }
33186    /// Requested page size. Must be between `1` and `1000`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
33187    ///
33188    /// Sets the *page size* query property to the given value.
33189    pub fn page_size(
33190        mut self,
33191        new_value: i32,
33192    ) -> AdvertiserNegativeKeywordListNegativeKeywordListCall<'a, C> {
33193        self._page_size = Some(new_value);
33194        self
33195    }
33196    /// Field by which to sort the list. Acceptable values are: * `keywordValue` (default) The default sorting order is ascending. To specify descending order for a field, a suffix " desc" should be added to the field name. Example: `keywordValue desc`.
33197    ///
33198    /// Sets the *order by* query property to the given value.
33199    pub fn order_by(
33200        mut self,
33201        new_value: &str,
33202    ) -> AdvertiserNegativeKeywordListNegativeKeywordListCall<'a, C> {
33203        self._order_by = Some(new_value.to_string());
33204        self
33205    }
33206    /// Allows filtering by negative keyword fields. Supported syntax: * Filter expressions for negative keywords can only contain at most one restriction. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `HAS (:)` operator. Supported fields: * `keywordValue` Examples: * All negative keywords for which the keyword value contains “google”: `keywordValue : "google"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
33207    ///
33208    /// Sets the *filter* query property to the given value.
33209    pub fn filter(
33210        mut self,
33211        new_value: &str,
33212    ) -> AdvertiserNegativeKeywordListNegativeKeywordListCall<'a, C> {
33213        self._filter = Some(new_value.to_string());
33214        self
33215    }
33216    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33217    /// while executing the actual API request.
33218    ///
33219    /// ````text
33220    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33221    /// ````
33222    ///
33223    /// Sets the *delegate* property to the given value.
33224    pub fn delegate(
33225        mut self,
33226        new_value: &'a mut dyn common::Delegate,
33227    ) -> AdvertiserNegativeKeywordListNegativeKeywordListCall<'a, C> {
33228        self._delegate = Some(new_value);
33229        self
33230    }
33231
33232    /// Set any additional parameter of the query string used in the request.
33233    /// It should be used to set parameters which are not yet available through their own
33234    /// setters.
33235    ///
33236    /// Please note that this method must not be used to set any of the known parameters
33237    /// which have their own setter method. If done anyway, the request will fail.
33238    ///
33239    /// # Additional Parameters
33240    ///
33241    /// * *$.xgafv* (query-string) - V1 error format.
33242    /// * *access_token* (query-string) - OAuth access token.
33243    /// * *alt* (query-string) - Data format for response.
33244    /// * *callback* (query-string) - JSONP
33245    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33246    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
33247    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33248    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33249    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
33250    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33251    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33252    pub fn param<T>(
33253        mut self,
33254        name: T,
33255        value: T,
33256    ) -> AdvertiserNegativeKeywordListNegativeKeywordListCall<'a, C>
33257    where
33258        T: AsRef<str>,
33259    {
33260        self._additional_params
33261            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33262        self
33263    }
33264
33265    /// Identifies the authorization scope for the method you are building.
33266    ///
33267    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33268    /// [`Scope::DisplayVideo`].
33269    ///
33270    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33271    /// tokens for more than one scope.
33272    ///
33273    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33274    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33275    /// sufficient, a read-write scope will do as well.
33276    pub fn add_scope<St>(
33277        mut self,
33278        scope: St,
33279    ) -> AdvertiserNegativeKeywordListNegativeKeywordListCall<'a, C>
33280    where
33281        St: AsRef<str>,
33282    {
33283        self._scopes.insert(String::from(scope.as_ref()));
33284        self
33285    }
33286    /// Identifies the authorization scope(s) for the method you are building.
33287    ///
33288    /// See [`Self::add_scope()`] for details.
33289    pub fn add_scopes<I, St>(
33290        mut self,
33291        scopes: I,
33292    ) -> AdvertiserNegativeKeywordListNegativeKeywordListCall<'a, C>
33293    where
33294        I: IntoIterator<Item = St>,
33295        St: AsRef<str>,
33296    {
33297        self._scopes
33298            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33299        self
33300    }
33301
33302    /// Removes all scopes, and no default scope will be used either.
33303    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33304    /// for details).
33305    pub fn clear_scopes(mut self) -> AdvertiserNegativeKeywordListNegativeKeywordListCall<'a, C> {
33306        self._scopes.clear();
33307        self
33308    }
33309}
33310
33311/// Replaces all negative keywords in a single negative keyword list. The operation will replace the keywords in a negative keyword list with keywords provided in ReplaceNegativeKeywordsRequest.new_negative_keywords.
33312///
33313/// A builder for the *negativeKeywordLists.negativeKeywords.replace* method supported by a *advertiser* resource.
33314/// It is not used directly, but through a [`AdvertiserMethods`] instance.
33315///
33316/// # Example
33317///
33318/// Instantiate a resource method builder
33319///
33320/// ```test_harness,no_run
33321/// # extern crate hyper;
33322/// # extern crate hyper_rustls;
33323/// # extern crate google_displayvideo1 as displayvideo1;
33324/// use displayvideo1::api::ReplaceNegativeKeywordsRequest;
33325/// # async fn dox() {
33326/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33327///
33328/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33329/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33330/// #     secret,
33331/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33332/// # ).build().await.unwrap();
33333///
33334/// # let client = hyper_util::client::legacy::Client::builder(
33335/// #     hyper_util::rt::TokioExecutor::new()
33336/// # )
33337/// # .build(
33338/// #     hyper_rustls::HttpsConnectorBuilder::new()
33339/// #         .with_native_roots()
33340/// #         .unwrap()
33341/// #         .https_or_http()
33342/// #         .enable_http1()
33343/// #         .build()
33344/// # );
33345/// # let mut hub = DisplayVideo::new(client, auth);
33346/// // As the method needs a request, you would usually fill it with the desired information
33347/// // into the respective structure. Some of the parts shown here might not be applicable !
33348/// // Values shown here are possibly random and not representative !
33349/// let mut req = ReplaceNegativeKeywordsRequest::default();
33350///
33351/// // You can configure optional parameters by calling the respective setters at will, and
33352/// // execute the final call using `doit()`.
33353/// // Values shown here are possibly random and not representative !
33354/// let result = hub.advertisers().negative_keyword_lists_negative_keywords_replace(req, -84, -97)
33355///              .doit().await;
33356/// # }
33357/// ```
33358pub struct AdvertiserNegativeKeywordListNegativeKeywordReplaceCall<'a, C>
33359where
33360    C: 'a,
33361{
33362    hub: &'a DisplayVideo<C>,
33363    _request: ReplaceNegativeKeywordsRequest,
33364    _advertiser_id: i64,
33365    _negative_keyword_list_id: i64,
33366    _delegate: Option<&'a mut dyn common::Delegate>,
33367    _additional_params: HashMap<String, String>,
33368    _scopes: BTreeSet<String>,
33369}
33370
33371impl<'a, C> common::CallBuilder for AdvertiserNegativeKeywordListNegativeKeywordReplaceCall<'a, C> {}
33372
33373impl<'a, C> AdvertiserNegativeKeywordListNegativeKeywordReplaceCall<'a, C>
33374where
33375    C: common::Connector,
33376{
33377    /// Perform the operation you have build so far.
33378    pub async fn doit(
33379        mut self,
33380    ) -> common::Result<(common::Response, ReplaceNegativeKeywordsResponse)> {
33381        use std::borrow::Cow;
33382        use std::io::{Read, Seek};
33383
33384        use common::{url::Params, ToParts};
33385        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33386
33387        let mut dd = common::DefaultDelegate;
33388        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33389        dlg.begin(common::MethodInfo {
33390            id: "displayvideo.advertisers.negativeKeywordLists.negativeKeywords.replace",
33391            http_method: hyper::Method::POST,
33392        });
33393
33394        for &field in ["alt", "advertiserId", "negativeKeywordListId"].iter() {
33395            if self._additional_params.contains_key(field) {
33396                dlg.finished(false);
33397                return Err(common::Error::FieldClash(field));
33398            }
33399        }
33400
33401        let mut params = Params::with_capacity(5 + self._additional_params.len());
33402        params.push("advertiserId", self._advertiser_id.to_string());
33403        params.push(
33404            "negativeKeywordListId",
33405            self._negative_keyword_list_id.to_string(),
33406        );
33407
33408        params.extend(self._additional_params.iter());
33409
33410        params.push("alt", "json");
33411        let mut url = self.hub._base_url.clone() + "v1/advertisers/{advertiserId}/negativeKeywordLists/{+negativeKeywordListId}/negativeKeywords:replace";
33412        if self._scopes.is_empty() {
33413            self._scopes
33414                .insert(Scope::DisplayVideo.as_ref().to_string());
33415        }
33416
33417        #[allow(clippy::single_element_loop)]
33418        for &(find_this, param_name) in [
33419            ("{advertiserId}", "advertiserId"),
33420            ("{+negativeKeywordListId}", "negativeKeywordListId"),
33421        ]
33422        .iter()
33423        {
33424            url = params.uri_replacement(url, param_name, find_this, true);
33425        }
33426        {
33427            let to_remove = ["negativeKeywordListId", "advertiserId"];
33428            params.remove_params(&to_remove);
33429        }
33430
33431        let url = params.parse_with_url(&url);
33432
33433        let mut json_mime_type = mime::APPLICATION_JSON;
33434        let mut request_value_reader = {
33435            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33436            common::remove_json_null_values(&mut value);
33437            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33438            serde_json::to_writer(&mut dst, &value).unwrap();
33439            dst
33440        };
33441        let request_size = request_value_reader
33442            .seek(std::io::SeekFrom::End(0))
33443            .unwrap();
33444        request_value_reader
33445            .seek(std::io::SeekFrom::Start(0))
33446            .unwrap();
33447
33448        loop {
33449            let token = match self
33450                .hub
33451                .auth
33452                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33453                .await
33454            {
33455                Ok(token) => token,
33456                Err(e) => match dlg.token(e) {
33457                    Ok(token) => token,
33458                    Err(e) => {
33459                        dlg.finished(false);
33460                        return Err(common::Error::MissingToken(e));
33461                    }
33462                },
33463            };
33464            request_value_reader
33465                .seek(std::io::SeekFrom::Start(0))
33466                .unwrap();
33467            let mut req_result = {
33468                let client = &self.hub.client;
33469                dlg.pre_request();
33470                let mut req_builder = hyper::Request::builder()
33471                    .method(hyper::Method::POST)
33472                    .uri(url.as_str())
33473                    .header(USER_AGENT, self.hub._user_agent.clone());
33474
33475                if let Some(token) = token.as_ref() {
33476                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33477                }
33478
33479                let request = req_builder
33480                    .header(CONTENT_TYPE, json_mime_type.to_string())
33481                    .header(CONTENT_LENGTH, request_size as u64)
33482                    .body(common::to_body(
33483                        request_value_reader.get_ref().clone().into(),
33484                    ));
33485
33486                client.request(request.unwrap()).await
33487            };
33488
33489            match req_result {
33490                Err(err) => {
33491                    if let common::Retry::After(d) = dlg.http_error(&err) {
33492                        sleep(d).await;
33493                        continue;
33494                    }
33495                    dlg.finished(false);
33496                    return Err(common::Error::HttpError(err));
33497                }
33498                Ok(res) => {
33499                    let (mut parts, body) = res.into_parts();
33500                    let mut body = common::Body::new(body);
33501                    if !parts.status.is_success() {
33502                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33503                        let error = serde_json::from_str(&common::to_string(&bytes));
33504                        let response = common::to_response(parts, bytes.into());
33505
33506                        if let common::Retry::After(d) =
33507                            dlg.http_failure(&response, error.as_ref().ok())
33508                        {
33509                            sleep(d).await;
33510                            continue;
33511                        }
33512
33513                        dlg.finished(false);
33514
33515                        return Err(match error {
33516                            Ok(value) => common::Error::BadRequest(value),
33517                            _ => common::Error::Failure(response),
33518                        });
33519                    }
33520                    let response = {
33521                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33522                        let encoded = common::to_string(&bytes);
33523                        match serde_json::from_str(&encoded) {
33524                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33525                            Err(error) => {
33526                                dlg.response_json_decode_error(&encoded, &error);
33527                                return Err(common::Error::JsonDecodeError(
33528                                    encoded.to_string(),
33529                                    error,
33530                                ));
33531                            }
33532                        }
33533                    };
33534
33535                    dlg.finished(true);
33536                    return Ok(response);
33537                }
33538            }
33539        }
33540    }
33541
33542    ///
33543    /// Sets the *request* property to the given value.
33544    ///
33545    /// Even though the property as already been set when instantiating this call,
33546    /// we provide this method for API completeness.
33547    pub fn request(
33548        mut self,
33549        new_value: ReplaceNegativeKeywordsRequest,
33550    ) -> AdvertiserNegativeKeywordListNegativeKeywordReplaceCall<'a, C> {
33551        self._request = new_value;
33552        self
33553    }
33554    /// Required. The ID of the DV360 advertiser to which the parent negative keyword list belongs.
33555    ///
33556    /// Sets the *advertiser id* path property to the given value.
33557    ///
33558    /// Even though the property as already been set when instantiating this call,
33559    /// we provide this method for API completeness.
33560    pub fn advertiser_id(
33561        mut self,
33562        new_value: i64,
33563    ) -> AdvertiserNegativeKeywordListNegativeKeywordReplaceCall<'a, C> {
33564        self._advertiser_id = new_value;
33565        self
33566    }
33567    /// Required. The ID of the parent negative keyword list to which the negative keywords belong.
33568    ///
33569    /// Sets the *negative keyword list id* path property to the given value.
33570    ///
33571    /// Even though the property as already been set when instantiating this call,
33572    /// we provide this method for API completeness.
33573    pub fn negative_keyword_list_id(
33574        mut self,
33575        new_value: i64,
33576    ) -> AdvertiserNegativeKeywordListNegativeKeywordReplaceCall<'a, C> {
33577        self._negative_keyword_list_id = new_value;
33578        self
33579    }
33580    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33581    /// while executing the actual API request.
33582    ///
33583    /// ````text
33584    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33585    /// ````
33586    ///
33587    /// Sets the *delegate* property to the given value.
33588    pub fn delegate(
33589        mut self,
33590        new_value: &'a mut dyn common::Delegate,
33591    ) -> AdvertiserNegativeKeywordListNegativeKeywordReplaceCall<'a, C> {
33592        self._delegate = Some(new_value);
33593        self
33594    }
33595
33596    /// Set any additional parameter of the query string used in the request.
33597    /// It should be used to set parameters which are not yet available through their own
33598    /// setters.
33599    ///
33600    /// Please note that this method must not be used to set any of the known parameters
33601    /// which have their own setter method. If done anyway, the request will fail.
33602    ///
33603    /// # Additional Parameters
33604    ///
33605    /// * *$.xgafv* (query-string) - V1 error format.
33606    /// * *access_token* (query-string) - OAuth access token.
33607    /// * *alt* (query-string) - Data format for response.
33608    /// * *callback* (query-string) - JSONP
33609    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33610    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
33611    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33612    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33613    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
33614    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33615    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33616    pub fn param<T>(
33617        mut self,
33618        name: T,
33619        value: T,
33620    ) -> AdvertiserNegativeKeywordListNegativeKeywordReplaceCall<'a, C>
33621    where
33622        T: AsRef<str>,
33623    {
33624        self._additional_params
33625            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33626        self
33627    }
33628
33629    /// Identifies the authorization scope for the method you are building.
33630    ///
33631    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33632    /// [`Scope::DisplayVideo`].
33633    ///
33634    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33635    /// tokens for more than one scope.
33636    ///
33637    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33638    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33639    /// sufficient, a read-write scope will do as well.
33640    pub fn add_scope<St>(
33641        mut self,
33642        scope: St,
33643    ) -> AdvertiserNegativeKeywordListNegativeKeywordReplaceCall<'a, C>
33644    where
33645        St: AsRef<str>,
33646    {
33647        self._scopes.insert(String::from(scope.as_ref()));
33648        self
33649    }
33650    /// Identifies the authorization scope(s) for the method you are building.
33651    ///
33652    /// See [`Self::add_scope()`] for details.
33653    pub fn add_scopes<I, St>(
33654        mut self,
33655        scopes: I,
33656    ) -> AdvertiserNegativeKeywordListNegativeKeywordReplaceCall<'a, C>
33657    where
33658        I: IntoIterator<Item = St>,
33659        St: AsRef<str>,
33660    {
33661        self._scopes
33662            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33663        self
33664    }
33665
33666    /// Removes all scopes, and no default scope will be used either.
33667    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33668    /// for details).
33669    pub fn clear_scopes(
33670        mut self,
33671    ) -> AdvertiserNegativeKeywordListNegativeKeywordReplaceCall<'a, C> {
33672        self._scopes.clear();
33673        self
33674    }
33675}
33676
33677/// Creates a new negative keyword list. Returns the newly created negative keyword list if successful.
33678///
33679/// A builder for the *negativeKeywordLists.create* method supported by a *advertiser* resource.
33680/// It is not used directly, but through a [`AdvertiserMethods`] instance.
33681///
33682/// # Example
33683///
33684/// Instantiate a resource method builder
33685///
33686/// ```test_harness,no_run
33687/// # extern crate hyper;
33688/// # extern crate hyper_rustls;
33689/// # extern crate google_displayvideo1 as displayvideo1;
33690/// use displayvideo1::api::NegativeKeywordList;
33691/// # async fn dox() {
33692/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33693///
33694/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33695/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33696/// #     secret,
33697/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33698/// # ).build().await.unwrap();
33699///
33700/// # let client = hyper_util::client::legacy::Client::builder(
33701/// #     hyper_util::rt::TokioExecutor::new()
33702/// # )
33703/// # .build(
33704/// #     hyper_rustls::HttpsConnectorBuilder::new()
33705/// #         .with_native_roots()
33706/// #         .unwrap()
33707/// #         .https_or_http()
33708/// #         .enable_http1()
33709/// #         .build()
33710/// # );
33711/// # let mut hub = DisplayVideo::new(client, auth);
33712/// // As the method needs a request, you would usually fill it with the desired information
33713/// // into the respective structure. Some of the parts shown here might not be applicable !
33714/// // Values shown here are possibly random and not representative !
33715/// let mut req = NegativeKeywordList::default();
33716///
33717/// // You can configure optional parameters by calling the respective setters at will, and
33718/// // execute the final call using `doit()`.
33719/// // Values shown here are possibly random and not representative !
33720/// let result = hub.advertisers().negative_keyword_lists_create(req, -37)
33721///              .doit().await;
33722/// # }
33723/// ```
33724pub struct AdvertiserNegativeKeywordListCreateCall<'a, C>
33725where
33726    C: 'a,
33727{
33728    hub: &'a DisplayVideo<C>,
33729    _request: NegativeKeywordList,
33730    _advertiser_id: i64,
33731    _delegate: Option<&'a mut dyn common::Delegate>,
33732    _additional_params: HashMap<String, String>,
33733    _scopes: BTreeSet<String>,
33734}
33735
33736impl<'a, C> common::CallBuilder for AdvertiserNegativeKeywordListCreateCall<'a, C> {}
33737
33738impl<'a, C> AdvertiserNegativeKeywordListCreateCall<'a, C>
33739where
33740    C: common::Connector,
33741{
33742    /// Perform the operation you have build so far.
33743    pub async fn doit(mut self) -> common::Result<(common::Response, NegativeKeywordList)> {
33744        use std::borrow::Cow;
33745        use std::io::{Read, Seek};
33746
33747        use common::{url::Params, ToParts};
33748        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33749
33750        let mut dd = common::DefaultDelegate;
33751        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33752        dlg.begin(common::MethodInfo {
33753            id: "displayvideo.advertisers.negativeKeywordLists.create",
33754            http_method: hyper::Method::POST,
33755        });
33756
33757        for &field in ["alt", "advertiserId"].iter() {
33758            if self._additional_params.contains_key(field) {
33759                dlg.finished(false);
33760                return Err(common::Error::FieldClash(field));
33761            }
33762        }
33763
33764        let mut params = Params::with_capacity(4 + self._additional_params.len());
33765        params.push("advertiserId", self._advertiser_id.to_string());
33766
33767        params.extend(self._additional_params.iter());
33768
33769        params.push("alt", "json");
33770        let mut url =
33771            self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/negativeKeywordLists";
33772        if self._scopes.is_empty() {
33773            self._scopes
33774                .insert(Scope::DisplayVideo.as_ref().to_string());
33775        }
33776
33777        #[allow(clippy::single_element_loop)]
33778        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
33779            url = params.uri_replacement(url, param_name, find_this, true);
33780        }
33781        {
33782            let to_remove = ["advertiserId"];
33783            params.remove_params(&to_remove);
33784        }
33785
33786        let url = params.parse_with_url(&url);
33787
33788        let mut json_mime_type = mime::APPLICATION_JSON;
33789        let mut request_value_reader = {
33790            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33791            common::remove_json_null_values(&mut value);
33792            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33793            serde_json::to_writer(&mut dst, &value).unwrap();
33794            dst
33795        };
33796        let request_size = request_value_reader
33797            .seek(std::io::SeekFrom::End(0))
33798            .unwrap();
33799        request_value_reader
33800            .seek(std::io::SeekFrom::Start(0))
33801            .unwrap();
33802
33803        loop {
33804            let token = match self
33805                .hub
33806                .auth
33807                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33808                .await
33809            {
33810                Ok(token) => token,
33811                Err(e) => match dlg.token(e) {
33812                    Ok(token) => token,
33813                    Err(e) => {
33814                        dlg.finished(false);
33815                        return Err(common::Error::MissingToken(e));
33816                    }
33817                },
33818            };
33819            request_value_reader
33820                .seek(std::io::SeekFrom::Start(0))
33821                .unwrap();
33822            let mut req_result = {
33823                let client = &self.hub.client;
33824                dlg.pre_request();
33825                let mut req_builder = hyper::Request::builder()
33826                    .method(hyper::Method::POST)
33827                    .uri(url.as_str())
33828                    .header(USER_AGENT, self.hub._user_agent.clone());
33829
33830                if let Some(token) = token.as_ref() {
33831                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33832                }
33833
33834                let request = req_builder
33835                    .header(CONTENT_TYPE, json_mime_type.to_string())
33836                    .header(CONTENT_LENGTH, request_size as u64)
33837                    .body(common::to_body(
33838                        request_value_reader.get_ref().clone().into(),
33839                    ));
33840
33841                client.request(request.unwrap()).await
33842            };
33843
33844            match req_result {
33845                Err(err) => {
33846                    if let common::Retry::After(d) = dlg.http_error(&err) {
33847                        sleep(d).await;
33848                        continue;
33849                    }
33850                    dlg.finished(false);
33851                    return Err(common::Error::HttpError(err));
33852                }
33853                Ok(res) => {
33854                    let (mut parts, body) = res.into_parts();
33855                    let mut body = common::Body::new(body);
33856                    if !parts.status.is_success() {
33857                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33858                        let error = serde_json::from_str(&common::to_string(&bytes));
33859                        let response = common::to_response(parts, bytes.into());
33860
33861                        if let common::Retry::After(d) =
33862                            dlg.http_failure(&response, error.as_ref().ok())
33863                        {
33864                            sleep(d).await;
33865                            continue;
33866                        }
33867
33868                        dlg.finished(false);
33869
33870                        return Err(match error {
33871                            Ok(value) => common::Error::BadRequest(value),
33872                            _ => common::Error::Failure(response),
33873                        });
33874                    }
33875                    let response = {
33876                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33877                        let encoded = common::to_string(&bytes);
33878                        match serde_json::from_str(&encoded) {
33879                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33880                            Err(error) => {
33881                                dlg.response_json_decode_error(&encoded, &error);
33882                                return Err(common::Error::JsonDecodeError(
33883                                    encoded.to_string(),
33884                                    error,
33885                                ));
33886                            }
33887                        }
33888                    };
33889
33890                    dlg.finished(true);
33891                    return Ok(response);
33892                }
33893            }
33894        }
33895    }
33896
33897    ///
33898    /// Sets the *request* property to the given value.
33899    ///
33900    /// Even though the property as already been set when instantiating this call,
33901    /// we provide this method for API completeness.
33902    pub fn request(
33903        mut self,
33904        new_value: NegativeKeywordList,
33905    ) -> AdvertiserNegativeKeywordListCreateCall<'a, C> {
33906        self._request = new_value;
33907        self
33908    }
33909    /// Required. The ID of the DV360 advertiser to which the negative keyword list will belong.
33910    ///
33911    /// Sets the *advertiser id* path property to the given value.
33912    ///
33913    /// Even though the property as already been set when instantiating this call,
33914    /// we provide this method for API completeness.
33915    pub fn advertiser_id(
33916        mut self,
33917        new_value: i64,
33918    ) -> AdvertiserNegativeKeywordListCreateCall<'a, C> {
33919        self._advertiser_id = new_value;
33920        self
33921    }
33922    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33923    /// while executing the actual API request.
33924    ///
33925    /// ````text
33926    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33927    /// ````
33928    ///
33929    /// Sets the *delegate* property to the given value.
33930    pub fn delegate(
33931        mut self,
33932        new_value: &'a mut dyn common::Delegate,
33933    ) -> AdvertiserNegativeKeywordListCreateCall<'a, C> {
33934        self._delegate = Some(new_value);
33935        self
33936    }
33937
33938    /// Set any additional parameter of the query string used in the request.
33939    /// It should be used to set parameters which are not yet available through their own
33940    /// setters.
33941    ///
33942    /// Please note that this method must not be used to set any of the known parameters
33943    /// which have their own setter method. If done anyway, the request will fail.
33944    ///
33945    /// # Additional Parameters
33946    ///
33947    /// * *$.xgafv* (query-string) - V1 error format.
33948    /// * *access_token* (query-string) - OAuth access token.
33949    /// * *alt* (query-string) - Data format for response.
33950    /// * *callback* (query-string) - JSONP
33951    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33952    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
33953    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33954    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33955    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
33956    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33957    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33958    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserNegativeKeywordListCreateCall<'a, C>
33959    where
33960        T: AsRef<str>,
33961    {
33962        self._additional_params
33963            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33964        self
33965    }
33966
33967    /// Identifies the authorization scope for the method you are building.
33968    ///
33969    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33970    /// [`Scope::DisplayVideo`].
33971    ///
33972    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33973    /// tokens for more than one scope.
33974    ///
33975    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33976    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33977    /// sufficient, a read-write scope will do as well.
33978    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserNegativeKeywordListCreateCall<'a, C>
33979    where
33980        St: AsRef<str>,
33981    {
33982        self._scopes.insert(String::from(scope.as_ref()));
33983        self
33984    }
33985    /// Identifies the authorization scope(s) for the method you are building.
33986    ///
33987    /// See [`Self::add_scope()`] for details.
33988    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserNegativeKeywordListCreateCall<'a, C>
33989    where
33990        I: IntoIterator<Item = St>,
33991        St: AsRef<str>,
33992    {
33993        self._scopes
33994            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33995        self
33996    }
33997
33998    /// Removes all scopes, and no default scope will be used either.
33999    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34000    /// for details).
34001    pub fn clear_scopes(mut self) -> AdvertiserNegativeKeywordListCreateCall<'a, C> {
34002        self._scopes.clear();
34003        self
34004    }
34005}
34006
34007/// Deletes a negative keyword list given an advertiser ID and a negative keyword list ID.
34008///
34009/// A builder for the *negativeKeywordLists.delete* method supported by a *advertiser* resource.
34010/// It is not used directly, but through a [`AdvertiserMethods`] instance.
34011///
34012/// # Example
34013///
34014/// Instantiate a resource method builder
34015///
34016/// ```test_harness,no_run
34017/// # extern crate hyper;
34018/// # extern crate hyper_rustls;
34019/// # extern crate google_displayvideo1 as displayvideo1;
34020/// # async fn dox() {
34021/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34022///
34023/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34024/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34025/// #     secret,
34026/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34027/// # ).build().await.unwrap();
34028///
34029/// # let client = hyper_util::client::legacy::Client::builder(
34030/// #     hyper_util::rt::TokioExecutor::new()
34031/// # )
34032/// # .build(
34033/// #     hyper_rustls::HttpsConnectorBuilder::new()
34034/// #         .with_native_roots()
34035/// #         .unwrap()
34036/// #         .https_or_http()
34037/// #         .enable_http1()
34038/// #         .build()
34039/// # );
34040/// # let mut hub = DisplayVideo::new(client, auth);
34041/// // You can configure optional parameters by calling the respective setters at will, and
34042/// // execute the final call using `doit()`.
34043/// // Values shown here are possibly random and not representative !
34044/// let result = hub.advertisers().negative_keyword_lists_delete(-27, -53)
34045///              .doit().await;
34046/// # }
34047/// ```
34048pub struct AdvertiserNegativeKeywordListDeleteCall<'a, C>
34049where
34050    C: 'a,
34051{
34052    hub: &'a DisplayVideo<C>,
34053    _advertiser_id: i64,
34054    _negative_keyword_list_id: i64,
34055    _delegate: Option<&'a mut dyn common::Delegate>,
34056    _additional_params: HashMap<String, String>,
34057    _scopes: BTreeSet<String>,
34058}
34059
34060impl<'a, C> common::CallBuilder for AdvertiserNegativeKeywordListDeleteCall<'a, C> {}
34061
34062impl<'a, C> AdvertiserNegativeKeywordListDeleteCall<'a, C>
34063where
34064    C: common::Connector,
34065{
34066    /// Perform the operation you have build so far.
34067    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
34068        use std::borrow::Cow;
34069        use std::io::{Read, Seek};
34070
34071        use common::{url::Params, ToParts};
34072        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34073
34074        let mut dd = common::DefaultDelegate;
34075        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34076        dlg.begin(common::MethodInfo {
34077            id: "displayvideo.advertisers.negativeKeywordLists.delete",
34078            http_method: hyper::Method::DELETE,
34079        });
34080
34081        for &field in ["alt", "advertiserId", "negativeKeywordListId"].iter() {
34082            if self._additional_params.contains_key(field) {
34083                dlg.finished(false);
34084                return Err(common::Error::FieldClash(field));
34085            }
34086        }
34087
34088        let mut params = Params::with_capacity(4 + self._additional_params.len());
34089        params.push("advertiserId", self._advertiser_id.to_string());
34090        params.push(
34091            "negativeKeywordListId",
34092            self._negative_keyword_list_id.to_string(),
34093        );
34094
34095        params.extend(self._additional_params.iter());
34096
34097        params.push("alt", "json");
34098        let mut url = self.hub._base_url.clone()
34099            + "v1/advertisers/{+advertiserId}/negativeKeywordLists/{+negativeKeywordListId}";
34100        if self._scopes.is_empty() {
34101            self._scopes
34102                .insert(Scope::DisplayVideo.as_ref().to_string());
34103        }
34104
34105        #[allow(clippy::single_element_loop)]
34106        for &(find_this, param_name) in [
34107            ("{+advertiserId}", "advertiserId"),
34108            ("{+negativeKeywordListId}", "negativeKeywordListId"),
34109        ]
34110        .iter()
34111        {
34112            url = params.uri_replacement(url, param_name, find_this, true);
34113        }
34114        {
34115            let to_remove = ["negativeKeywordListId", "advertiserId"];
34116            params.remove_params(&to_remove);
34117        }
34118
34119        let url = params.parse_with_url(&url);
34120
34121        loop {
34122            let token = match self
34123                .hub
34124                .auth
34125                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34126                .await
34127            {
34128                Ok(token) => token,
34129                Err(e) => match dlg.token(e) {
34130                    Ok(token) => token,
34131                    Err(e) => {
34132                        dlg.finished(false);
34133                        return Err(common::Error::MissingToken(e));
34134                    }
34135                },
34136            };
34137            let mut req_result = {
34138                let client = &self.hub.client;
34139                dlg.pre_request();
34140                let mut req_builder = hyper::Request::builder()
34141                    .method(hyper::Method::DELETE)
34142                    .uri(url.as_str())
34143                    .header(USER_AGENT, self.hub._user_agent.clone());
34144
34145                if let Some(token) = token.as_ref() {
34146                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34147                }
34148
34149                let request = req_builder
34150                    .header(CONTENT_LENGTH, 0_u64)
34151                    .body(common::to_body::<String>(None));
34152
34153                client.request(request.unwrap()).await
34154            };
34155
34156            match req_result {
34157                Err(err) => {
34158                    if let common::Retry::After(d) = dlg.http_error(&err) {
34159                        sleep(d).await;
34160                        continue;
34161                    }
34162                    dlg.finished(false);
34163                    return Err(common::Error::HttpError(err));
34164                }
34165                Ok(res) => {
34166                    let (mut parts, body) = res.into_parts();
34167                    let mut body = common::Body::new(body);
34168                    if !parts.status.is_success() {
34169                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34170                        let error = serde_json::from_str(&common::to_string(&bytes));
34171                        let response = common::to_response(parts, bytes.into());
34172
34173                        if let common::Retry::After(d) =
34174                            dlg.http_failure(&response, error.as_ref().ok())
34175                        {
34176                            sleep(d).await;
34177                            continue;
34178                        }
34179
34180                        dlg.finished(false);
34181
34182                        return Err(match error {
34183                            Ok(value) => common::Error::BadRequest(value),
34184                            _ => common::Error::Failure(response),
34185                        });
34186                    }
34187                    let response = {
34188                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34189                        let encoded = common::to_string(&bytes);
34190                        match serde_json::from_str(&encoded) {
34191                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34192                            Err(error) => {
34193                                dlg.response_json_decode_error(&encoded, &error);
34194                                return Err(common::Error::JsonDecodeError(
34195                                    encoded.to_string(),
34196                                    error,
34197                                ));
34198                            }
34199                        }
34200                    };
34201
34202                    dlg.finished(true);
34203                    return Ok(response);
34204                }
34205            }
34206        }
34207    }
34208
34209    /// Required. The ID of the DV360 advertiser to which the negative keyword list belongs.
34210    ///
34211    /// Sets the *advertiser id* path property to the given value.
34212    ///
34213    /// Even though the property as already been set when instantiating this call,
34214    /// we provide this method for API completeness.
34215    pub fn advertiser_id(
34216        mut self,
34217        new_value: i64,
34218    ) -> AdvertiserNegativeKeywordListDeleteCall<'a, C> {
34219        self._advertiser_id = new_value;
34220        self
34221    }
34222    /// Required. The ID of the negative keyword list to delete.
34223    ///
34224    /// Sets the *negative keyword list id* path property to the given value.
34225    ///
34226    /// Even though the property as already been set when instantiating this call,
34227    /// we provide this method for API completeness.
34228    pub fn negative_keyword_list_id(
34229        mut self,
34230        new_value: i64,
34231    ) -> AdvertiserNegativeKeywordListDeleteCall<'a, C> {
34232        self._negative_keyword_list_id = new_value;
34233        self
34234    }
34235    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34236    /// while executing the actual API request.
34237    ///
34238    /// ````text
34239    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34240    /// ````
34241    ///
34242    /// Sets the *delegate* property to the given value.
34243    pub fn delegate(
34244        mut self,
34245        new_value: &'a mut dyn common::Delegate,
34246    ) -> AdvertiserNegativeKeywordListDeleteCall<'a, C> {
34247        self._delegate = Some(new_value);
34248        self
34249    }
34250
34251    /// Set any additional parameter of the query string used in the request.
34252    /// It should be used to set parameters which are not yet available through their own
34253    /// setters.
34254    ///
34255    /// Please note that this method must not be used to set any of the known parameters
34256    /// which have their own setter method. If done anyway, the request will fail.
34257    ///
34258    /// # Additional Parameters
34259    ///
34260    /// * *$.xgafv* (query-string) - V1 error format.
34261    /// * *access_token* (query-string) - OAuth access token.
34262    /// * *alt* (query-string) - Data format for response.
34263    /// * *callback* (query-string) - JSONP
34264    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34265    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
34266    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34267    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34268    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
34269    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34270    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34271    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserNegativeKeywordListDeleteCall<'a, C>
34272    where
34273        T: AsRef<str>,
34274    {
34275        self._additional_params
34276            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34277        self
34278    }
34279
34280    /// Identifies the authorization scope for the method you are building.
34281    ///
34282    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34283    /// [`Scope::DisplayVideo`].
34284    ///
34285    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34286    /// tokens for more than one scope.
34287    ///
34288    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34289    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34290    /// sufficient, a read-write scope will do as well.
34291    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserNegativeKeywordListDeleteCall<'a, C>
34292    where
34293        St: AsRef<str>,
34294    {
34295        self._scopes.insert(String::from(scope.as_ref()));
34296        self
34297    }
34298    /// Identifies the authorization scope(s) for the method you are building.
34299    ///
34300    /// See [`Self::add_scope()`] for details.
34301    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserNegativeKeywordListDeleteCall<'a, C>
34302    where
34303        I: IntoIterator<Item = St>,
34304        St: AsRef<str>,
34305    {
34306        self._scopes
34307            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34308        self
34309    }
34310
34311    /// Removes all scopes, and no default scope will be used either.
34312    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34313    /// for details).
34314    pub fn clear_scopes(mut self) -> AdvertiserNegativeKeywordListDeleteCall<'a, C> {
34315        self._scopes.clear();
34316        self
34317    }
34318}
34319
34320/// Gets a negative keyword list given an advertiser ID and a negative keyword list ID.
34321///
34322/// A builder for the *negativeKeywordLists.get* method supported by a *advertiser* resource.
34323/// It is not used directly, but through a [`AdvertiserMethods`] instance.
34324///
34325/// # Example
34326///
34327/// Instantiate a resource method builder
34328///
34329/// ```test_harness,no_run
34330/// # extern crate hyper;
34331/// # extern crate hyper_rustls;
34332/// # extern crate google_displayvideo1 as displayvideo1;
34333/// # async fn dox() {
34334/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34335///
34336/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34337/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34338/// #     secret,
34339/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34340/// # ).build().await.unwrap();
34341///
34342/// # let client = hyper_util::client::legacy::Client::builder(
34343/// #     hyper_util::rt::TokioExecutor::new()
34344/// # )
34345/// # .build(
34346/// #     hyper_rustls::HttpsConnectorBuilder::new()
34347/// #         .with_native_roots()
34348/// #         .unwrap()
34349/// #         .https_or_http()
34350/// #         .enable_http1()
34351/// #         .build()
34352/// # );
34353/// # let mut hub = DisplayVideo::new(client, auth);
34354/// // You can configure optional parameters by calling the respective setters at will, and
34355/// // execute the final call using `doit()`.
34356/// // Values shown here are possibly random and not representative !
34357/// let result = hub.advertisers().negative_keyword_lists_get(-76, -20)
34358///              .doit().await;
34359/// # }
34360/// ```
34361pub struct AdvertiserNegativeKeywordListGetCall<'a, C>
34362where
34363    C: 'a,
34364{
34365    hub: &'a DisplayVideo<C>,
34366    _advertiser_id: i64,
34367    _negative_keyword_list_id: i64,
34368    _delegate: Option<&'a mut dyn common::Delegate>,
34369    _additional_params: HashMap<String, String>,
34370    _scopes: BTreeSet<String>,
34371}
34372
34373impl<'a, C> common::CallBuilder for AdvertiserNegativeKeywordListGetCall<'a, C> {}
34374
34375impl<'a, C> AdvertiserNegativeKeywordListGetCall<'a, C>
34376where
34377    C: common::Connector,
34378{
34379    /// Perform the operation you have build so far.
34380    pub async fn doit(mut self) -> common::Result<(common::Response, NegativeKeywordList)> {
34381        use std::borrow::Cow;
34382        use std::io::{Read, Seek};
34383
34384        use common::{url::Params, ToParts};
34385        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34386
34387        let mut dd = common::DefaultDelegate;
34388        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34389        dlg.begin(common::MethodInfo {
34390            id: "displayvideo.advertisers.negativeKeywordLists.get",
34391            http_method: hyper::Method::GET,
34392        });
34393
34394        for &field in ["alt", "advertiserId", "negativeKeywordListId"].iter() {
34395            if self._additional_params.contains_key(field) {
34396                dlg.finished(false);
34397                return Err(common::Error::FieldClash(field));
34398            }
34399        }
34400
34401        let mut params = Params::with_capacity(4 + self._additional_params.len());
34402        params.push("advertiserId", self._advertiser_id.to_string());
34403        params.push(
34404            "negativeKeywordListId",
34405            self._negative_keyword_list_id.to_string(),
34406        );
34407
34408        params.extend(self._additional_params.iter());
34409
34410        params.push("alt", "json");
34411        let mut url = self.hub._base_url.clone()
34412            + "v1/advertisers/{+advertiserId}/negativeKeywordLists/{+negativeKeywordListId}";
34413        if self._scopes.is_empty() {
34414            self._scopes
34415                .insert(Scope::DisplayVideo.as_ref().to_string());
34416        }
34417
34418        #[allow(clippy::single_element_loop)]
34419        for &(find_this, param_name) in [
34420            ("{+advertiserId}", "advertiserId"),
34421            ("{+negativeKeywordListId}", "negativeKeywordListId"),
34422        ]
34423        .iter()
34424        {
34425            url = params.uri_replacement(url, param_name, find_this, true);
34426        }
34427        {
34428            let to_remove = ["negativeKeywordListId", "advertiserId"];
34429            params.remove_params(&to_remove);
34430        }
34431
34432        let url = params.parse_with_url(&url);
34433
34434        loop {
34435            let token = match self
34436                .hub
34437                .auth
34438                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34439                .await
34440            {
34441                Ok(token) => token,
34442                Err(e) => match dlg.token(e) {
34443                    Ok(token) => token,
34444                    Err(e) => {
34445                        dlg.finished(false);
34446                        return Err(common::Error::MissingToken(e));
34447                    }
34448                },
34449            };
34450            let mut req_result = {
34451                let client = &self.hub.client;
34452                dlg.pre_request();
34453                let mut req_builder = hyper::Request::builder()
34454                    .method(hyper::Method::GET)
34455                    .uri(url.as_str())
34456                    .header(USER_AGENT, self.hub._user_agent.clone());
34457
34458                if let Some(token) = token.as_ref() {
34459                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34460                }
34461
34462                let request = req_builder
34463                    .header(CONTENT_LENGTH, 0_u64)
34464                    .body(common::to_body::<String>(None));
34465
34466                client.request(request.unwrap()).await
34467            };
34468
34469            match req_result {
34470                Err(err) => {
34471                    if let common::Retry::After(d) = dlg.http_error(&err) {
34472                        sleep(d).await;
34473                        continue;
34474                    }
34475                    dlg.finished(false);
34476                    return Err(common::Error::HttpError(err));
34477                }
34478                Ok(res) => {
34479                    let (mut parts, body) = res.into_parts();
34480                    let mut body = common::Body::new(body);
34481                    if !parts.status.is_success() {
34482                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34483                        let error = serde_json::from_str(&common::to_string(&bytes));
34484                        let response = common::to_response(parts, bytes.into());
34485
34486                        if let common::Retry::After(d) =
34487                            dlg.http_failure(&response, error.as_ref().ok())
34488                        {
34489                            sleep(d).await;
34490                            continue;
34491                        }
34492
34493                        dlg.finished(false);
34494
34495                        return Err(match error {
34496                            Ok(value) => common::Error::BadRequest(value),
34497                            _ => common::Error::Failure(response),
34498                        });
34499                    }
34500                    let response = {
34501                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34502                        let encoded = common::to_string(&bytes);
34503                        match serde_json::from_str(&encoded) {
34504                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34505                            Err(error) => {
34506                                dlg.response_json_decode_error(&encoded, &error);
34507                                return Err(common::Error::JsonDecodeError(
34508                                    encoded.to_string(),
34509                                    error,
34510                                ));
34511                            }
34512                        }
34513                    };
34514
34515                    dlg.finished(true);
34516                    return Ok(response);
34517                }
34518            }
34519        }
34520    }
34521
34522    /// Required. The ID of the DV360 advertiser to which the fetched negative keyword list belongs.
34523    ///
34524    /// Sets the *advertiser id* path property to the given value.
34525    ///
34526    /// Even though the property as already been set when instantiating this call,
34527    /// we provide this method for API completeness.
34528    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserNegativeKeywordListGetCall<'a, C> {
34529        self._advertiser_id = new_value;
34530        self
34531    }
34532    /// Required. The ID of the negative keyword list to fetch.
34533    ///
34534    /// Sets the *negative keyword list id* path property to the given value.
34535    ///
34536    /// Even though the property as already been set when instantiating this call,
34537    /// we provide this method for API completeness.
34538    pub fn negative_keyword_list_id(
34539        mut self,
34540        new_value: i64,
34541    ) -> AdvertiserNegativeKeywordListGetCall<'a, C> {
34542        self._negative_keyword_list_id = new_value;
34543        self
34544    }
34545    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34546    /// while executing the actual API request.
34547    ///
34548    /// ````text
34549    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34550    /// ````
34551    ///
34552    /// Sets the *delegate* property to the given value.
34553    pub fn delegate(
34554        mut self,
34555        new_value: &'a mut dyn common::Delegate,
34556    ) -> AdvertiserNegativeKeywordListGetCall<'a, C> {
34557        self._delegate = Some(new_value);
34558        self
34559    }
34560
34561    /// Set any additional parameter of the query string used in the request.
34562    /// It should be used to set parameters which are not yet available through their own
34563    /// setters.
34564    ///
34565    /// Please note that this method must not be used to set any of the known parameters
34566    /// which have their own setter method. If done anyway, the request will fail.
34567    ///
34568    /// # Additional Parameters
34569    ///
34570    /// * *$.xgafv* (query-string) - V1 error format.
34571    /// * *access_token* (query-string) - OAuth access token.
34572    /// * *alt* (query-string) - Data format for response.
34573    /// * *callback* (query-string) - JSONP
34574    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34575    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
34576    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34577    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34578    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
34579    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34580    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34581    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserNegativeKeywordListGetCall<'a, C>
34582    where
34583        T: AsRef<str>,
34584    {
34585        self._additional_params
34586            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34587        self
34588    }
34589
34590    /// Identifies the authorization scope for the method you are building.
34591    ///
34592    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34593    /// [`Scope::DisplayVideo`].
34594    ///
34595    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34596    /// tokens for more than one scope.
34597    ///
34598    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34599    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34600    /// sufficient, a read-write scope will do as well.
34601    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserNegativeKeywordListGetCall<'a, C>
34602    where
34603        St: AsRef<str>,
34604    {
34605        self._scopes.insert(String::from(scope.as_ref()));
34606        self
34607    }
34608    /// Identifies the authorization scope(s) for the method you are building.
34609    ///
34610    /// See [`Self::add_scope()`] for details.
34611    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserNegativeKeywordListGetCall<'a, C>
34612    where
34613        I: IntoIterator<Item = St>,
34614        St: AsRef<str>,
34615    {
34616        self._scopes
34617            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34618        self
34619    }
34620
34621    /// Removes all scopes, and no default scope will be used either.
34622    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34623    /// for details).
34624    pub fn clear_scopes(mut self) -> AdvertiserNegativeKeywordListGetCall<'a, C> {
34625        self._scopes.clear();
34626        self
34627    }
34628}
34629
34630/// Lists negative keyword lists based on a given advertiser id.
34631///
34632/// A builder for the *negativeKeywordLists.list* method supported by a *advertiser* resource.
34633/// It is not used directly, but through a [`AdvertiserMethods`] instance.
34634///
34635/// # Example
34636///
34637/// Instantiate a resource method builder
34638///
34639/// ```test_harness,no_run
34640/// # extern crate hyper;
34641/// # extern crate hyper_rustls;
34642/// # extern crate google_displayvideo1 as displayvideo1;
34643/// # async fn dox() {
34644/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34645///
34646/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34647/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34648/// #     secret,
34649/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34650/// # ).build().await.unwrap();
34651///
34652/// # let client = hyper_util::client::legacy::Client::builder(
34653/// #     hyper_util::rt::TokioExecutor::new()
34654/// # )
34655/// # .build(
34656/// #     hyper_rustls::HttpsConnectorBuilder::new()
34657/// #         .with_native_roots()
34658/// #         .unwrap()
34659/// #         .https_or_http()
34660/// #         .enable_http1()
34661/// #         .build()
34662/// # );
34663/// # let mut hub = DisplayVideo::new(client, auth);
34664/// // You can configure optional parameters by calling the respective setters at will, and
34665/// // execute the final call using `doit()`.
34666/// // Values shown here are possibly random and not representative !
34667/// let result = hub.advertisers().negative_keyword_lists_list(-45)
34668///              .page_token("ut")
34669///              .page_size(-16)
34670///              .doit().await;
34671/// # }
34672/// ```
34673pub struct AdvertiserNegativeKeywordListListCall<'a, C>
34674where
34675    C: 'a,
34676{
34677    hub: &'a DisplayVideo<C>,
34678    _advertiser_id: i64,
34679    _page_token: Option<String>,
34680    _page_size: Option<i32>,
34681    _delegate: Option<&'a mut dyn common::Delegate>,
34682    _additional_params: HashMap<String, String>,
34683    _scopes: BTreeSet<String>,
34684}
34685
34686impl<'a, C> common::CallBuilder for AdvertiserNegativeKeywordListListCall<'a, C> {}
34687
34688impl<'a, C> AdvertiserNegativeKeywordListListCall<'a, C>
34689where
34690    C: common::Connector,
34691{
34692    /// Perform the operation you have build so far.
34693    pub async fn doit(
34694        mut self,
34695    ) -> common::Result<(common::Response, ListNegativeKeywordListsResponse)> {
34696        use std::borrow::Cow;
34697        use std::io::{Read, Seek};
34698
34699        use common::{url::Params, ToParts};
34700        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34701
34702        let mut dd = common::DefaultDelegate;
34703        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34704        dlg.begin(common::MethodInfo {
34705            id: "displayvideo.advertisers.negativeKeywordLists.list",
34706            http_method: hyper::Method::GET,
34707        });
34708
34709        for &field in ["alt", "advertiserId", "pageToken", "pageSize"].iter() {
34710            if self._additional_params.contains_key(field) {
34711                dlg.finished(false);
34712                return Err(common::Error::FieldClash(field));
34713            }
34714        }
34715
34716        let mut params = Params::with_capacity(5 + self._additional_params.len());
34717        params.push("advertiserId", self._advertiser_id.to_string());
34718        if let Some(value) = self._page_token.as_ref() {
34719            params.push("pageToken", value);
34720        }
34721        if let Some(value) = self._page_size.as_ref() {
34722            params.push("pageSize", value.to_string());
34723        }
34724
34725        params.extend(self._additional_params.iter());
34726
34727        params.push("alt", "json");
34728        let mut url =
34729            self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/negativeKeywordLists";
34730        if self._scopes.is_empty() {
34731            self._scopes
34732                .insert(Scope::DisplayVideo.as_ref().to_string());
34733        }
34734
34735        #[allow(clippy::single_element_loop)]
34736        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
34737            url = params.uri_replacement(url, param_name, find_this, true);
34738        }
34739        {
34740            let to_remove = ["advertiserId"];
34741            params.remove_params(&to_remove);
34742        }
34743
34744        let url = params.parse_with_url(&url);
34745
34746        loop {
34747            let token = match self
34748                .hub
34749                .auth
34750                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34751                .await
34752            {
34753                Ok(token) => token,
34754                Err(e) => match dlg.token(e) {
34755                    Ok(token) => token,
34756                    Err(e) => {
34757                        dlg.finished(false);
34758                        return Err(common::Error::MissingToken(e));
34759                    }
34760                },
34761            };
34762            let mut req_result = {
34763                let client = &self.hub.client;
34764                dlg.pre_request();
34765                let mut req_builder = hyper::Request::builder()
34766                    .method(hyper::Method::GET)
34767                    .uri(url.as_str())
34768                    .header(USER_AGENT, self.hub._user_agent.clone());
34769
34770                if let Some(token) = token.as_ref() {
34771                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34772                }
34773
34774                let request = req_builder
34775                    .header(CONTENT_LENGTH, 0_u64)
34776                    .body(common::to_body::<String>(None));
34777
34778                client.request(request.unwrap()).await
34779            };
34780
34781            match req_result {
34782                Err(err) => {
34783                    if let common::Retry::After(d) = dlg.http_error(&err) {
34784                        sleep(d).await;
34785                        continue;
34786                    }
34787                    dlg.finished(false);
34788                    return Err(common::Error::HttpError(err));
34789                }
34790                Ok(res) => {
34791                    let (mut parts, body) = res.into_parts();
34792                    let mut body = common::Body::new(body);
34793                    if !parts.status.is_success() {
34794                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34795                        let error = serde_json::from_str(&common::to_string(&bytes));
34796                        let response = common::to_response(parts, bytes.into());
34797
34798                        if let common::Retry::After(d) =
34799                            dlg.http_failure(&response, error.as_ref().ok())
34800                        {
34801                            sleep(d).await;
34802                            continue;
34803                        }
34804
34805                        dlg.finished(false);
34806
34807                        return Err(match error {
34808                            Ok(value) => common::Error::BadRequest(value),
34809                            _ => common::Error::Failure(response),
34810                        });
34811                    }
34812                    let response = {
34813                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34814                        let encoded = common::to_string(&bytes);
34815                        match serde_json::from_str(&encoded) {
34816                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34817                            Err(error) => {
34818                                dlg.response_json_decode_error(&encoded, &error);
34819                                return Err(common::Error::JsonDecodeError(
34820                                    encoded.to_string(),
34821                                    error,
34822                                ));
34823                            }
34824                        }
34825                    };
34826
34827                    dlg.finished(true);
34828                    return Ok(response);
34829                }
34830            }
34831        }
34832    }
34833
34834    /// Required. The ID of the DV360 advertiser to which the fetched negative keyword lists belong.
34835    ///
34836    /// Sets the *advertiser id* path property to the given value.
34837    ///
34838    /// Even though the property as already been set when instantiating this call,
34839    /// we provide this method for API completeness.
34840    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserNegativeKeywordListListCall<'a, C> {
34841        self._advertiser_id = new_value;
34842        self
34843    }
34844    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListNegativeKeywordLists` method. If not specified, the first page of results will be returned.
34845    ///
34846    /// Sets the *page token* query property to the given value.
34847    pub fn page_token(mut self, new_value: &str) -> AdvertiserNegativeKeywordListListCall<'a, C> {
34848        self._page_token = Some(new_value.to_string());
34849        self
34850    }
34851    /// Requested page size. Must be between `1` and `200`. Defaults to `100` if not set. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
34852    ///
34853    /// Sets the *page size* query property to the given value.
34854    pub fn page_size(mut self, new_value: i32) -> AdvertiserNegativeKeywordListListCall<'a, C> {
34855        self._page_size = Some(new_value);
34856        self
34857    }
34858    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34859    /// while executing the actual API request.
34860    ///
34861    /// ````text
34862    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34863    /// ````
34864    ///
34865    /// Sets the *delegate* property to the given value.
34866    pub fn delegate(
34867        mut self,
34868        new_value: &'a mut dyn common::Delegate,
34869    ) -> AdvertiserNegativeKeywordListListCall<'a, C> {
34870        self._delegate = Some(new_value);
34871        self
34872    }
34873
34874    /// Set any additional parameter of the query string used in the request.
34875    /// It should be used to set parameters which are not yet available through their own
34876    /// setters.
34877    ///
34878    /// Please note that this method must not be used to set any of the known parameters
34879    /// which have their own setter method. If done anyway, the request will fail.
34880    ///
34881    /// # Additional Parameters
34882    ///
34883    /// * *$.xgafv* (query-string) - V1 error format.
34884    /// * *access_token* (query-string) - OAuth access token.
34885    /// * *alt* (query-string) - Data format for response.
34886    /// * *callback* (query-string) - JSONP
34887    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34888    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
34889    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34890    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34891    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
34892    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34893    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34894    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserNegativeKeywordListListCall<'a, C>
34895    where
34896        T: AsRef<str>,
34897    {
34898        self._additional_params
34899            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34900        self
34901    }
34902
34903    /// Identifies the authorization scope for the method you are building.
34904    ///
34905    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34906    /// [`Scope::DisplayVideo`].
34907    ///
34908    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34909    /// tokens for more than one scope.
34910    ///
34911    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34912    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34913    /// sufficient, a read-write scope will do as well.
34914    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserNegativeKeywordListListCall<'a, C>
34915    where
34916        St: AsRef<str>,
34917    {
34918        self._scopes.insert(String::from(scope.as_ref()));
34919        self
34920    }
34921    /// Identifies the authorization scope(s) for the method you are building.
34922    ///
34923    /// See [`Self::add_scope()`] for details.
34924    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserNegativeKeywordListListCall<'a, C>
34925    where
34926        I: IntoIterator<Item = St>,
34927        St: AsRef<str>,
34928    {
34929        self._scopes
34930            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34931        self
34932    }
34933
34934    /// Removes all scopes, and no default scope will be used either.
34935    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34936    /// for details).
34937    pub fn clear_scopes(mut self) -> AdvertiserNegativeKeywordListListCall<'a, C> {
34938        self._scopes.clear();
34939        self
34940    }
34941}
34942
34943/// Updates a negative keyword list. Returns the updated negative keyword list if successful.
34944///
34945/// A builder for the *negativeKeywordLists.patch* method supported by a *advertiser* resource.
34946/// It is not used directly, but through a [`AdvertiserMethods`] instance.
34947///
34948/// # Example
34949///
34950/// Instantiate a resource method builder
34951///
34952/// ```test_harness,no_run
34953/// # extern crate hyper;
34954/// # extern crate hyper_rustls;
34955/// # extern crate google_displayvideo1 as displayvideo1;
34956/// use displayvideo1::api::NegativeKeywordList;
34957/// # async fn dox() {
34958/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34959///
34960/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34961/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34962/// #     secret,
34963/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34964/// # ).build().await.unwrap();
34965///
34966/// # let client = hyper_util::client::legacy::Client::builder(
34967/// #     hyper_util::rt::TokioExecutor::new()
34968/// # )
34969/// # .build(
34970/// #     hyper_rustls::HttpsConnectorBuilder::new()
34971/// #         .with_native_roots()
34972/// #         .unwrap()
34973/// #         .https_or_http()
34974/// #         .enable_http1()
34975/// #         .build()
34976/// # );
34977/// # let mut hub = DisplayVideo::new(client, auth);
34978/// // As the method needs a request, you would usually fill it with the desired information
34979/// // into the respective structure. Some of the parts shown here might not be applicable !
34980/// // Values shown here are possibly random and not representative !
34981/// let mut req = NegativeKeywordList::default();
34982///
34983/// // You can configure optional parameters by calling the respective setters at will, and
34984/// // execute the final call using `doit()`.
34985/// // Values shown here are possibly random and not representative !
34986/// let result = hub.advertisers().negative_keyword_lists_patch(req, -70, -63)
34987///              .update_mask(FieldMask::new::<&str>(&[]))
34988///              .doit().await;
34989/// # }
34990/// ```
34991pub struct AdvertiserNegativeKeywordListPatchCall<'a, C>
34992where
34993    C: 'a,
34994{
34995    hub: &'a DisplayVideo<C>,
34996    _request: NegativeKeywordList,
34997    _advertiser_id: i64,
34998    _negative_keyword_list_id: i64,
34999    _update_mask: Option<common::FieldMask>,
35000    _delegate: Option<&'a mut dyn common::Delegate>,
35001    _additional_params: HashMap<String, String>,
35002    _scopes: BTreeSet<String>,
35003}
35004
35005impl<'a, C> common::CallBuilder for AdvertiserNegativeKeywordListPatchCall<'a, C> {}
35006
35007impl<'a, C> AdvertiserNegativeKeywordListPatchCall<'a, C>
35008where
35009    C: common::Connector,
35010{
35011    /// Perform the operation you have build so far.
35012    pub async fn doit(mut self) -> common::Result<(common::Response, NegativeKeywordList)> {
35013        use std::borrow::Cow;
35014        use std::io::{Read, Seek};
35015
35016        use common::{url::Params, ToParts};
35017        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35018
35019        let mut dd = common::DefaultDelegate;
35020        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35021        dlg.begin(common::MethodInfo {
35022            id: "displayvideo.advertisers.negativeKeywordLists.patch",
35023            http_method: hyper::Method::PATCH,
35024        });
35025
35026        for &field in ["alt", "advertiserId", "negativeKeywordListId", "updateMask"].iter() {
35027            if self._additional_params.contains_key(field) {
35028                dlg.finished(false);
35029                return Err(common::Error::FieldClash(field));
35030            }
35031        }
35032
35033        let mut params = Params::with_capacity(6 + self._additional_params.len());
35034        params.push("advertiserId", self._advertiser_id.to_string());
35035        params.push(
35036            "negativeKeywordListId",
35037            self._negative_keyword_list_id.to_string(),
35038        );
35039        if let Some(value) = self._update_mask.as_ref() {
35040            params.push("updateMask", value.to_string());
35041        }
35042
35043        params.extend(self._additional_params.iter());
35044
35045        params.push("alt", "json");
35046        let mut url = self.hub._base_url.clone()
35047            + "v1/advertisers/{+advertiserId}/negativeKeywordLists/{negativeKeywordListId}";
35048        if self._scopes.is_empty() {
35049            self._scopes
35050                .insert(Scope::DisplayVideo.as_ref().to_string());
35051        }
35052
35053        #[allow(clippy::single_element_loop)]
35054        for &(find_this, param_name) in [
35055            ("{+advertiserId}", "advertiserId"),
35056            ("{negativeKeywordListId}", "negativeKeywordListId"),
35057        ]
35058        .iter()
35059        {
35060            url = params.uri_replacement(url, param_name, find_this, true);
35061        }
35062        {
35063            let to_remove = ["negativeKeywordListId", "advertiserId"];
35064            params.remove_params(&to_remove);
35065        }
35066
35067        let url = params.parse_with_url(&url);
35068
35069        let mut json_mime_type = mime::APPLICATION_JSON;
35070        let mut request_value_reader = {
35071            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
35072            common::remove_json_null_values(&mut value);
35073            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
35074            serde_json::to_writer(&mut dst, &value).unwrap();
35075            dst
35076        };
35077        let request_size = request_value_reader
35078            .seek(std::io::SeekFrom::End(0))
35079            .unwrap();
35080        request_value_reader
35081            .seek(std::io::SeekFrom::Start(0))
35082            .unwrap();
35083
35084        loop {
35085            let token = match self
35086                .hub
35087                .auth
35088                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35089                .await
35090            {
35091                Ok(token) => token,
35092                Err(e) => match dlg.token(e) {
35093                    Ok(token) => token,
35094                    Err(e) => {
35095                        dlg.finished(false);
35096                        return Err(common::Error::MissingToken(e));
35097                    }
35098                },
35099            };
35100            request_value_reader
35101                .seek(std::io::SeekFrom::Start(0))
35102                .unwrap();
35103            let mut req_result = {
35104                let client = &self.hub.client;
35105                dlg.pre_request();
35106                let mut req_builder = hyper::Request::builder()
35107                    .method(hyper::Method::PATCH)
35108                    .uri(url.as_str())
35109                    .header(USER_AGENT, self.hub._user_agent.clone());
35110
35111                if let Some(token) = token.as_ref() {
35112                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35113                }
35114
35115                let request = req_builder
35116                    .header(CONTENT_TYPE, json_mime_type.to_string())
35117                    .header(CONTENT_LENGTH, request_size as u64)
35118                    .body(common::to_body(
35119                        request_value_reader.get_ref().clone().into(),
35120                    ));
35121
35122                client.request(request.unwrap()).await
35123            };
35124
35125            match req_result {
35126                Err(err) => {
35127                    if let common::Retry::After(d) = dlg.http_error(&err) {
35128                        sleep(d).await;
35129                        continue;
35130                    }
35131                    dlg.finished(false);
35132                    return Err(common::Error::HttpError(err));
35133                }
35134                Ok(res) => {
35135                    let (mut parts, body) = res.into_parts();
35136                    let mut body = common::Body::new(body);
35137                    if !parts.status.is_success() {
35138                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35139                        let error = serde_json::from_str(&common::to_string(&bytes));
35140                        let response = common::to_response(parts, bytes.into());
35141
35142                        if let common::Retry::After(d) =
35143                            dlg.http_failure(&response, error.as_ref().ok())
35144                        {
35145                            sleep(d).await;
35146                            continue;
35147                        }
35148
35149                        dlg.finished(false);
35150
35151                        return Err(match error {
35152                            Ok(value) => common::Error::BadRequest(value),
35153                            _ => common::Error::Failure(response),
35154                        });
35155                    }
35156                    let response = {
35157                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35158                        let encoded = common::to_string(&bytes);
35159                        match serde_json::from_str(&encoded) {
35160                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35161                            Err(error) => {
35162                                dlg.response_json_decode_error(&encoded, &error);
35163                                return Err(common::Error::JsonDecodeError(
35164                                    encoded.to_string(),
35165                                    error,
35166                                ));
35167                            }
35168                        }
35169                    };
35170
35171                    dlg.finished(true);
35172                    return Ok(response);
35173                }
35174            }
35175        }
35176    }
35177
35178    ///
35179    /// Sets the *request* property to the given value.
35180    ///
35181    /// Even though the property as already been set when instantiating this call,
35182    /// we provide this method for API completeness.
35183    pub fn request(
35184        mut self,
35185        new_value: NegativeKeywordList,
35186    ) -> AdvertiserNegativeKeywordListPatchCall<'a, C> {
35187        self._request = new_value;
35188        self
35189    }
35190    /// Required. The ID of the DV360 advertiser to which the negative keyword list belongs.
35191    ///
35192    /// Sets the *advertiser id* path property to the given value.
35193    ///
35194    /// Even though the property as already been set when instantiating this call,
35195    /// we provide this method for API completeness.
35196    pub fn advertiser_id(
35197        mut self,
35198        new_value: i64,
35199    ) -> AdvertiserNegativeKeywordListPatchCall<'a, C> {
35200        self._advertiser_id = new_value;
35201        self
35202    }
35203    /// Output only. The unique ID of the negative keyword list. Assigned by the system.
35204    ///
35205    /// Sets the *negative keyword list id* path property to the given value.
35206    ///
35207    /// Even though the property as already been set when instantiating this call,
35208    /// we provide this method for API completeness.
35209    pub fn negative_keyword_list_id(
35210        mut self,
35211        new_value: i64,
35212    ) -> AdvertiserNegativeKeywordListPatchCall<'a, C> {
35213        self._negative_keyword_list_id = new_value;
35214        self
35215    }
35216    /// Required. The mask to control which fields to update.
35217    ///
35218    /// Sets the *update mask* query property to the given value.
35219    pub fn update_mask(
35220        mut self,
35221        new_value: common::FieldMask,
35222    ) -> AdvertiserNegativeKeywordListPatchCall<'a, C> {
35223        self._update_mask = Some(new_value);
35224        self
35225    }
35226    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35227    /// while executing the actual API request.
35228    ///
35229    /// ````text
35230    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
35231    /// ````
35232    ///
35233    /// Sets the *delegate* property to the given value.
35234    pub fn delegate(
35235        mut self,
35236        new_value: &'a mut dyn common::Delegate,
35237    ) -> AdvertiserNegativeKeywordListPatchCall<'a, C> {
35238        self._delegate = Some(new_value);
35239        self
35240    }
35241
35242    /// Set any additional parameter of the query string used in the request.
35243    /// It should be used to set parameters which are not yet available through their own
35244    /// setters.
35245    ///
35246    /// Please note that this method must not be used to set any of the known parameters
35247    /// which have their own setter method. If done anyway, the request will fail.
35248    ///
35249    /// # Additional Parameters
35250    ///
35251    /// * *$.xgafv* (query-string) - V1 error format.
35252    /// * *access_token* (query-string) - OAuth access token.
35253    /// * *alt* (query-string) - Data format for response.
35254    /// * *callback* (query-string) - JSONP
35255    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35256    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
35257    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35258    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35259    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
35260    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35261    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35262    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserNegativeKeywordListPatchCall<'a, C>
35263    where
35264        T: AsRef<str>,
35265    {
35266        self._additional_params
35267            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35268        self
35269    }
35270
35271    /// Identifies the authorization scope for the method you are building.
35272    ///
35273    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35274    /// [`Scope::DisplayVideo`].
35275    ///
35276    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35277    /// tokens for more than one scope.
35278    ///
35279    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35280    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35281    /// sufficient, a read-write scope will do as well.
35282    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserNegativeKeywordListPatchCall<'a, C>
35283    where
35284        St: AsRef<str>,
35285    {
35286        self._scopes.insert(String::from(scope.as_ref()));
35287        self
35288    }
35289    /// Identifies the authorization scope(s) for the method you are building.
35290    ///
35291    /// See [`Self::add_scope()`] for details.
35292    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserNegativeKeywordListPatchCall<'a, C>
35293    where
35294        I: IntoIterator<Item = St>,
35295        St: AsRef<str>,
35296    {
35297        self._scopes
35298            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35299        self
35300    }
35301
35302    /// Removes all scopes, and no default scope will be used either.
35303    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35304    /// for details).
35305    pub fn clear_scopes(mut self) -> AdvertiserNegativeKeywordListPatchCall<'a, C> {
35306        self._scopes.clear();
35307        self
35308    }
35309}
35310
35311/// Assigns a targeting option to an advertiser. Returns the assigned targeting option if successful.
35312///
35313/// A builder for the *targetingTypes.assignedTargetingOptions.create* method supported by a *advertiser* resource.
35314/// It is not used directly, but through a [`AdvertiserMethods`] instance.
35315///
35316/// # Example
35317///
35318/// Instantiate a resource method builder
35319///
35320/// ```test_harness,no_run
35321/// # extern crate hyper;
35322/// # extern crate hyper_rustls;
35323/// # extern crate google_displayvideo1 as displayvideo1;
35324/// use displayvideo1::api::AssignedTargetingOption;
35325/// # async fn dox() {
35326/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35327///
35328/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35329/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
35330/// #     secret,
35331/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35332/// # ).build().await.unwrap();
35333///
35334/// # let client = hyper_util::client::legacy::Client::builder(
35335/// #     hyper_util::rt::TokioExecutor::new()
35336/// # )
35337/// # .build(
35338/// #     hyper_rustls::HttpsConnectorBuilder::new()
35339/// #         .with_native_roots()
35340/// #         .unwrap()
35341/// #         .https_or_http()
35342/// #         .enable_http1()
35343/// #         .build()
35344/// # );
35345/// # let mut hub = DisplayVideo::new(client, auth);
35346/// // As the method needs a request, you would usually fill it with the desired information
35347/// // into the respective structure. Some of the parts shown here might not be applicable !
35348/// // Values shown here are possibly random and not representative !
35349/// let mut req = AssignedTargetingOption::default();
35350///
35351/// // You can configure optional parameters by calling the respective setters at will, and
35352/// // execute the final call using `doit()`.
35353/// // Values shown here are possibly random and not representative !
35354/// let result = hub.advertisers().targeting_types_assigned_targeting_options_create(req, -95, "targetingType")
35355///              .doit().await;
35356/// # }
35357/// ```
35358pub struct AdvertiserTargetingTypeAssignedTargetingOptionCreateCall<'a, C>
35359where
35360    C: 'a,
35361{
35362    hub: &'a DisplayVideo<C>,
35363    _request: AssignedTargetingOption,
35364    _advertiser_id: i64,
35365    _targeting_type: String,
35366    _delegate: Option<&'a mut dyn common::Delegate>,
35367    _additional_params: HashMap<String, String>,
35368    _scopes: BTreeSet<String>,
35369}
35370
35371impl<'a, C> common::CallBuilder
35372    for AdvertiserTargetingTypeAssignedTargetingOptionCreateCall<'a, C>
35373{
35374}
35375
35376impl<'a, C> AdvertiserTargetingTypeAssignedTargetingOptionCreateCall<'a, C>
35377where
35378    C: common::Connector,
35379{
35380    /// Perform the operation you have build so far.
35381    pub async fn doit(mut self) -> common::Result<(common::Response, AssignedTargetingOption)> {
35382        use std::borrow::Cow;
35383        use std::io::{Read, Seek};
35384
35385        use common::{url::Params, ToParts};
35386        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35387
35388        let mut dd = common::DefaultDelegate;
35389        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35390        dlg.begin(common::MethodInfo {
35391            id: "displayvideo.advertisers.targetingTypes.assignedTargetingOptions.create",
35392            http_method: hyper::Method::POST,
35393        });
35394
35395        for &field in ["alt", "advertiserId", "targetingType"].iter() {
35396            if self._additional_params.contains_key(field) {
35397                dlg.finished(false);
35398                return Err(common::Error::FieldClash(field));
35399            }
35400        }
35401
35402        let mut params = Params::with_capacity(5 + self._additional_params.len());
35403        params.push("advertiserId", self._advertiser_id.to_string());
35404        params.push("targetingType", self._targeting_type);
35405
35406        params.extend(self._additional_params.iter());
35407
35408        params.push("alt", "json");
35409        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/targetingTypes/{+targetingType}/assignedTargetingOptions";
35410        if self._scopes.is_empty() {
35411            self._scopes
35412                .insert(Scope::DisplayVideo.as_ref().to_string());
35413        }
35414
35415        #[allow(clippy::single_element_loop)]
35416        for &(find_this, param_name) in [
35417            ("{+advertiserId}", "advertiserId"),
35418            ("{+targetingType}", "targetingType"),
35419        ]
35420        .iter()
35421        {
35422            url = params.uri_replacement(url, param_name, find_this, true);
35423        }
35424        {
35425            let to_remove = ["targetingType", "advertiserId"];
35426            params.remove_params(&to_remove);
35427        }
35428
35429        let url = params.parse_with_url(&url);
35430
35431        let mut json_mime_type = mime::APPLICATION_JSON;
35432        let mut request_value_reader = {
35433            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
35434            common::remove_json_null_values(&mut value);
35435            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
35436            serde_json::to_writer(&mut dst, &value).unwrap();
35437            dst
35438        };
35439        let request_size = request_value_reader
35440            .seek(std::io::SeekFrom::End(0))
35441            .unwrap();
35442        request_value_reader
35443            .seek(std::io::SeekFrom::Start(0))
35444            .unwrap();
35445
35446        loop {
35447            let token = match self
35448                .hub
35449                .auth
35450                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35451                .await
35452            {
35453                Ok(token) => token,
35454                Err(e) => match dlg.token(e) {
35455                    Ok(token) => token,
35456                    Err(e) => {
35457                        dlg.finished(false);
35458                        return Err(common::Error::MissingToken(e));
35459                    }
35460                },
35461            };
35462            request_value_reader
35463                .seek(std::io::SeekFrom::Start(0))
35464                .unwrap();
35465            let mut req_result = {
35466                let client = &self.hub.client;
35467                dlg.pre_request();
35468                let mut req_builder = hyper::Request::builder()
35469                    .method(hyper::Method::POST)
35470                    .uri(url.as_str())
35471                    .header(USER_AGENT, self.hub._user_agent.clone());
35472
35473                if let Some(token) = token.as_ref() {
35474                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35475                }
35476
35477                let request = req_builder
35478                    .header(CONTENT_TYPE, json_mime_type.to_string())
35479                    .header(CONTENT_LENGTH, request_size as u64)
35480                    .body(common::to_body(
35481                        request_value_reader.get_ref().clone().into(),
35482                    ));
35483
35484                client.request(request.unwrap()).await
35485            };
35486
35487            match req_result {
35488                Err(err) => {
35489                    if let common::Retry::After(d) = dlg.http_error(&err) {
35490                        sleep(d).await;
35491                        continue;
35492                    }
35493                    dlg.finished(false);
35494                    return Err(common::Error::HttpError(err));
35495                }
35496                Ok(res) => {
35497                    let (mut parts, body) = res.into_parts();
35498                    let mut body = common::Body::new(body);
35499                    if !parts.status.is_success() {
35500                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35501                        let error = serde_json::from_str(&common::to_string(&bytes));
35502                        let response = common::to_response(parts, bytes.into());
35503
35504                        if let common::Retry::After(d) =
35505                            dlg.http_failure(&response, error.as_ref().ok())
35506                        {
35507                            sleep(d).await;
35508                            continue;
35509                        }
35510
35511                        dlg.finished(false);
35512
35513                        return Err(match error {
35514                            Ok(value) => common::Error::BadRequest(value),
35515                            _ => common::Error::Failure(response),
35516                        });
35517                    }
35518                    let response = {
35519                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35520                        let encoded = common::to_string(&bytes);
35521                        match serde_json::from_str(&encoded) {
35522                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35523                            Err(error) => {
35524                                dlg.response_json_decode_error(&encoded, &error);
35525                                return Err(common::Error::JsonDecodeError(
35526                                    encoded.to_string(),
35527                                    error,
35528                                ));
35529                            }
35530                        }
35531                    };
35532
35533                    dlg.finished(true);
35534                    return Ok(response);
35535                }
35536            }
35537        }
35538    }
35539
35540    ///
35541    /// Sets the *request* property to the given value.
35542    ///
35543    /// Even though the property as already been set when instantiating this call,
35544    /// we provide this method for API completeness.
35545    pub fn request(
35546        mut self,
35547        new_value: AssignedTargetingOption,
35548    ) -> AdvertiserTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
35549        self._request = new_value;
35550        self
35551    }
35552    /// Required. The ID of the advertiser.
35553    ///
35554    /// Sets the *advertiser id* path property to the given value.
35555    ///
35556    /// Even though the property as already been set when instantiating this call,
35557    /// we provide this method for API completeness.
35558    pub fn advertiser_id(
35559        mut self,
35560        new_value: i64,
35561    ) -> AdvertiserTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
35562        self._advertiser_id = new_value;
35563        self
35564    }
35565    /// Required. Identifies the type of this assigned targeting option. Supported targeting types: * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_KEYWORD`
35566    ///
35567    /// Sets the *targeting type* path property to the given value.
35568    ///
35569    /// Even though the property as already been set when instantiating this call,
35570    /// we provide this method for API completeness.
35571    pub fn targeting_type(
35572        mut self,
35573        new_value: &str,
35574    ) -> AdvertiserTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
35575        self._targeting_type = new_value.to_string();
35576        self
35577    }
35578    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35579    /// while executing the actual API request.
35580    ///
35581    /// ````text
35582    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
35583    /// ````
35584    ///
35585    /// Sets the *delegate* property to the given value.
35586    pub fn delegate(
35587        mut self,
35588        new_value: &'a mut dyn common::Delegate,
35589    ) -> AdvertiserTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
35590        self._delegate = Some(new_value);
35591        self
35592    }
35593
35594    /// Set any additional parameter of the query string used in the request.
35595    /// It should be used to set parameters which are not yet available through their own
35596    /// setters.
35597    ///
35598    /// Please note that this method must not be used to set any of the known parameters
35599    /// which have their own setter method. If done anyway, the request will fail.
35600    ///
35601    /// # Additional Parameters
35602    ///
35603    /// * *$.xgafv* (query-string) - V1 error format.
35604    /// * *access_token* (query-string) - OAuth access token.
35605    /// * *alt* (query-string) - Data format for response.
35606    /// * *callback* (query-string) - JSONP
35607    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35608    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
35609    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35610    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35611    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
35612    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35613    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35614    pub fn param<T>(
35615        mut self,
35616        name: T,
35617        value: T,
35618    ) -> AdvertiserTargetingTypeAssignedTargetingOptionCreateCall<'a, C>
35619    where
35620        T: AsRef<str>,
35621    {
35622        self._additional_params
35623            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35624        self
35625    }
35626
35627    /// Identifies the authorization scope for the method you are building.
35628    ///
35629    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35630    /// [`Scope::DisplayVideo`].
35631    ///
35632    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35633    /// tokens for more than one scope.
35634    ///
35635    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35636    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35637    /// sufficient, a read-write scope will do as well.
35638    pub fn add_scope<St>(
35639        mut self,
35640        scope: St,
35641    ) -> AdvertiserTargetingTypeAssignedTargetingOptionCreateCall<'a, C>
35642    where
35643        St: AsRef<str>,
35644    {
35645        self._scopes.insert(String::from(scope.as_ref()));
35646        self
35647    }
35648    /// Identifies the authorization scope(s) for the method you are building.
35649    ///
35650    /// See [`Self::add_scope()`] for details.
35651    pub fn add_scopes<I, St>(
35652        mut self,
35653        scopes: I,
35654    ) -> AdvertiserTargetingTypeAssignedTargetingOptionCreateCall<'a, C>
35655    where
35656        I: IntoIterator<Item = St>,
35657        St: AsRef<str>,
35658    {
35659        self._scopes
35660            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35661        self
35662    }
35663
35664    /// Removes all scopes, and no default scope will be used either.
35665    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35666    /// for details).
35667    pub fn clear_scopes(
35668        mut self,
35669    ) -> AdvertiserTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
35670        self._scopes.clear();
35671        self
35672    }
35673}
35674
35675/// Deletes an assigned targeting option from an advertiser.
35676///
35677/// A builder for the *targetingTypes.assignedTargetingOptions.delete* method supported by a *advertiser* resource.
35678/// It is not used directly, but through a [`AdvertiserMethods`] instance.
35679///
35680/// # Example
35681///
35682/// Instantiate a resource method builder
35683///
35684/// ```test_harness,no_run
35685/// # extern crate hyper;
35686/// # extern crate hyper_rustls;
35687/// # extern crate google_displayvideo1 as displayvideo1;
35688/// # async fn dox() {
35689/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35690///
35691/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35692/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
35693/// #     secret,
35694/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35695/// # ).build().await.unwrap();
35696///
35697/// # let client = hyper_util::client::legacy::Client::builder(
35698/// #     hyper_util::rt::TokioExecutor::new()
35699/// # )
35700/// # .build(
35701/// #     hyper_rustls::HttpsConnectorBuilder::new()
35702/// #         .with_native_roots()
35703/// #         .unwrap()
35704/// #         .https_or_http()
35705/// #         .enable_http1()
35706/// #         .build()
35707/// # );
35708/// # let mut hub = DisplayVideo::new(client, auth);
35709/// // You can configure optional parameters by calling the respective setters at will, and
35710/// // execute the final call using `doit()`.
35711/// // Values shown here are possibly random and not representative !
35712/// let result = hub.advertisers().targeting_types_assigned_targeting_options_delete(-10, "targetingType", "assignedTargetingOptionId")
35713///              .doit().await;
35714/// # }
35715/// ```
35716pub struct AdvertiserTargetingTypeAssignedTargetingOptionDeleteCall<'a, C>
35717where
35718    C: 'a,
35719{
35720    hub: &'a DisplayVideo<C>,
35721    _advertiser_id: i64,
35722    _targeting_type: String,
35723    _assigned_targeting_option_id: String,
35724    _delegate: Option<&'a mut dyn common::Delegate>,
35725    _additional_params: HashMap<String, String>,
35726    _scopes: BTreeSet<String>,
35727}
35728
35729impl<'a, C> common::CallBuilder
35730    for AdvertiserTargetingTypeAssignedTargetingOptionDeleteCall<'a, C>
35731{
35732}
35733
35734impl<'a, C> AdvertiserTargetingTypeAssignedTargetingOptionDeleteCall<'a, C>
35735where
35736    C: common::Connector,
35737{
35738    /// Perform the operation you have build so far.
35739    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
35740        use std::borrow::Cow;
35741        use std::io::{Read, Seek};
35742
35743        use common::{url::Params, ToParts};
35744        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35745
35746        let mut dd = common::DefaultDelegate;
35747        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35748        dlg.begin(common::MethodInfo {
35749            id: "displayvideo.advertisers.targetingTypes.assignedTargetingOptions.delete",
35750            http_method: hyper::Method::DELETE,
35751        });
35752
35753        for &field in [
35754            "alt",
35755            "advertiserId",
35756            "targetingType",
35757            "assignedTargetingOptionId",
35758        ]
35759        .iter()
35760        {
35761            if self._additional_params.contains_key(field) {
35762                dlg.finished(false);
35763                return Err(common::Error::FieldClash(field));
35764            }
35765        }
35766
35767        let mut params = Params::with_capacity(5 + self._additional_params.len());
35768        params.push("advertiserId", self._advertiser_id.to_string());
35769        params.push("targetingType", self._targeting_type);
35770        params.push(
35771            "assignedTargetingOptionId",
35772            self._assigned_targeting_option_id,
35773        );
35774
35775        params.extend(self._additional_params.iter());
35776
35777        params.push("alt", "json");
35778        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/targetingTypes/{+targetingType}/assignedTargetingOptions/{+assignedTargetingOptionId}";
35779        if self._scopes.is_empty() {
35780            self._scopes
35781                .insert(Scope::DisplayVideo.as_ref().to_string());
35782        }
35783
35784        #[allow(clippy::single_element_loop)]
35785        for &(find_this, param_name) in [
35786            ("{+advertiserId}", "advertiserId"),
35787            ("{+targetingType}", "targetingType"),
35788            ("{+assignedTargetingOptionId}", "assignedTargetingOptionId"),
35789        ]
35790        .iter()
35791        {
35792            url = params.uri_replacement(url, param_name, find_this, true);
35793        }
35794        {
35795            let to_remove = ["assignedTargetingOptionId", "targetingType", "advertiserId"];
35796            params.remove_params(&to_remove);
35797        }
35798
35799        let url = params.parse_with_url(&url);
35800
35801        loop {
35802            let token = match self
35803                .hub
35804                .auth
35805                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35806                .await
35807            {
35808                Ok(token) => token,
35809                Err(e) => match dlg.token(e) {
35810                    Ok(token) => token,
35811                    Err(e) => {
35812                        dlg.finished(false);
35813                        return Err(common::Error::MissingToken(e));
35814                    }
35815                },
35816            };
35817            let mut req_result = {
35818                let client = &self.hub.client;
35819                dlg.pre_request();
35820                let mut req_builder = hyper::Request::builder()
35821                    .method(hyper::Method::DELETE)
35822                    .uri(url.as_str())
35823                    .header(USER_AGENT, self.hub._user_agent.clone());
35824
35825                if let Some(token) = token.as_ref() {
35826                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35827                }
35828
35829                let request = req_builder
35830                    .header(CONTENT_LENGTH, 0_u64)
35831                    .body(common::to_body::<String>(None));
35832
35833                client.request(request.unwrap()).await
35834            };
35835
35836            match req_result {
35837                Err(err) => {
35838                    if let common::Retry::After(d) = dlg.http_error(&err) {
35839                        sleep(d).await;
35840                        continue;
35841                    }
35842                    dlg.finished(false);
35843                    return Err(common::Error::HttpError(err));
35844                }
35845                Ok(res) => {
35846                    let (mut parts, body) = res.into_parts();
35847                    let mut body = common::Body::new(body);
35848                    if !parts.status.is_success() {
35849                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35850                        let error = serde_json::from_str(&common::to_string(&bytes));
35851                        let response = common::to_response(parts, bytes.into());
35852
35853                        if let common::Retry::After(d) =
35854                            dlg.http_failure(&response, error.as_ref().ok())
35855                        {
35856                            sleep(d).await;
35857                            continue;
35858                        }
35859
35860                        dlg.finished(false);
35861
35862                        return Err(match error {
35863                            Ok(value) => common::Error::BadRequest(value),
35864                            _ => common::Error::Failure(response),
35865                        });
35866                    }
35867                    let response = {
35868                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35869                        let encoded = common::to_string(&bytes);
35870                        match serde_json::from_str(&encoded) {
35871                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35872                            Err(error) => {
35873                                dlg.response_json_decode_error(&encoded, &error);
35874                                return Err(common::Error::JsonDecodeError(
35875                                    encoded.to_string(),
35876                                    error,
35877                                ));
35878                            }
35879                        }
35880                    };
35881
35882                    dlg.finished(true);
35883                    return Ok(response);
35884                }
35885            }
35886        }
35887    }
35888
35889    /// Required. The ID of the advertiser.
35890    ///
35891    /// Sets the *advertiser id* path property to the given value.
35892    ///
35893    /// Even though the property as already been set when instantiating this call,
35894    /// we provide this method for API completeness.
35895    pub fn advertiser_id(
35896        mut self,
35897        new_value: i64,
35898    ) -> AdvertiserTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
35899        self._advertiser_id = new_value;
35900        self
35901    }
35902    /// Required. Identifies the type of this assigned targeting option. Supported targeting types: * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_KEYWORD`
35903    ///
35904    /// Sets the *targeting type* path property to the given value.
35905    ///
35906    /// Even though the property as already been set when instantiating this call,
35907    /// we provide this method for API completeness.
35908    pub fn targeting_type(
35909        mut self,
35910        new_value: &str,
35911    ) -> AdvertiserTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
35912        self._targeting_type = new_value.to_string();
35913        self
35914    }
35915    /// Required. The ID of the assigned targeting option to delete.
35916    ///
35917    /// Sets the *assigned targeting option id* path property to the given value.
35918    ///
35919    /// Even though the property as already been set when instantiating this call,
35920    /// we provide this method for API completeness.
35921    pub fn assigned_targeting_option_id(
35922        mut self,
35923        new_value: &str,
35924    ) -> AdvertiserTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
35925        self._assigned_targeting_option_id = new_value.to_string();
35926        self
35927    }
35928    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35929    /// while executing the actual API request.
35930    ///
35931    /// ````text
35932    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
35933    /// ````
35934    ///
35935    /// Sets the *delegate* property to the given value.
35936    pub fn delegate(
35937        mut self,
35938        new_value: &'a mut dyn common::Delegate,
35939    ) -> AdvertiserTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
35940        self._delegate = Some(new_value);
35941        self
35942    }
35943
35944    /// Set any additional parameter of the query string used in the request.
35945    /// It should be used to set parameters which are not yet available through their own
35946    /// setters.
35947    ///
35948    /// Please note that this method must not be used to set any of the known parameters
35949    /// which have their own setter method. If done anyway, the request will fail.
35950    ///
35951    /// # Additional Parameters
35952    ///
35953    /// * *$.xgafv* (query-string) - V1 error format.
35954    /// * *access_token* (query-string) - OAuth access token.
35955    /// * *alt* (query-string) - Data format for response.
35956    /// * *callback* (query-string) - JSONP
35957    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35958    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
35959    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35960    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35961    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
35962    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35963    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35964    pub fn param<T>(
35965        mut self,
35966        name: T,
35967        value: T,
35968    ) -> AdvertiserTargetingTypeAssignedTargetingOptionDeleteCall<'a, C>
35969    where
35970        T: AsRef<str>,
35971    {
35972        self._additional_params
35973            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35974        self
35975    }
35976
35977    /// Identifies the authorization scope for the method you are building.
35978    ///
35979    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35980    /// [`Scope::DisplayVideo`].
35981    ///
35982    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35983    /// tokens for more than one scope.
35984    ///
35985    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35986    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35987    /// sufficient, a read-write scope will do as well.
35988    pub fn add_scope<St>(
35989        mut self,
35990        scope: St,
35991    ) -> AdvertiserTargetingTypeAssignedTargetingOptionDeleteCall<'a, C>
35992    where
35993        St: AsRef<str>,
35994    {
35995        self._scopes.insert(String::from(scope.as_ref()));
35996        self
35997    }
35998    /// Identifies the authorization scope(s) for the method you are building.
35999    ///
36000    /// See [`Self::add_scope()`] for details.
36001    pub fn add_scopes<I, St>(
36002        mut self,
36003        scopes: I,
36004    ) -> AdvertiserTargetingTypeAssignedTargetingOptionDeleteCall<'a, C>
36005    where
36006        I: IntoIterator<Item = St>,
36007        St: AsRef<str>,
36008    {
36009        self._scopes
36010            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36011        self
36012    }
36013
36014    /// Removes all scopes, and no default scope will be used either.
36015    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36016    /// for details).
36017    pub fn clear_scopes(
36018        mut self,
36019    ) -> AdvertiserTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
36020        self._scopes.clear();
36021        self
36022    }
36023}
36024
36025/// Gets a single targeting option assigned to an advertiser.
36026///
36027/// A builder for the *targetingTypes.assignedTargetingOptions.get* method supported by a *advertiser* resource.
36028/// It is not used directly, but through a [`AdvertiserMethods`] instance.
36029///
36030/// # Example
36031///
36032/// Instantiate a resource method builder
36033///
36034/// ```test_harness,no_run
36035/// # extern crate hyper;
36036/// # extern crate hyper_rustls;
36037/// # extern crate google_displayvideo1 as displayvideo1;
36038/// # async fn dox() {
36039/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36040///
36041/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36042/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
36043/// #     secret,
36044/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36045/// # ).build().await.unwrap();
36046///
36047/// # let client = hyper_util::client::legacy::Client::builder(
36048/// #     hyper_util::rt::TokioExecutor::new()
36049/// # )
36050/// # .build(
36051/// #     hyper_rustls::HttpsConnectorBuilder::new()
36052/// #         .with_native_roots()
36053/// #         .unwrap()
36054/// #         .https_or_http()
36055/// #         .enable_http1()
36056/// #         .build()
36057/// # );
36058/// # let mut hub = DisplayVideo::new(client, auth);
36059/// // You can configure optional parameters by calling the respective setters at will, and
36060/// // execute the final call using `doit()`.
36061/// // Values shown here are possibly random and not representative !
36062/// let result = hub.advertisers().targeting_types_assigned_targeting_options_get(-33, "targetingType", "assignedTargetingOptionId")
36063///              .doit().await;
36064/// # }
36065/// ```
36066pub struct AdvertiserTargetingTypeAssignedTargetingOptionGetCall<'a, C>
36067where
36068    C: 'a,
36069{
36070    hub: &'a DisplayVideo<C>,
36071    _advertiser_id: i64,
36072    _targeting_type: String,
36073    _assigned_targeting_option_id: String,
36074    _delegate: Option<&'a mut dyn common::Delegate>,
36075    _additional_params: HashMap<String, String>,
36076    _scopes: BTreeSet<String>,
36077}
36078
36079impl<'a, C> common::CallBuilder for AdvertiserTargetingTypeAssignedTargetingOptionGetCall<'a, C> {}
36080
36081impl<'a, C> AdvertiserTargetingTypeAssignedTargetingOptionGetCall<'a, C>
36082where
36083    C: common::Connector,
36084{
36085    /// Perform the operation you have build so far.
36086    pub async fn doit(mut self) -> common::Result<(common::Response, AssignedTargetingOption)> {
36087        use std::borrow::Cow;
36088        use std::io::{Read, Seek};
36089
36090        use common::{url::Params, ToParts};
36091        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36092
36093        let mut dd = common::DefaultDelegate;
36094        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36095        dlg.begin(common::MethodInfo {
36096            id: "displayvideo.advertisers.targetingTypes.assignedTargetingOptions.get",
36097            http_method: hyper::Method::GET,
36098        });
36099
36100        for &field in [
36101            "alt",
36102            "advertiserId",
36103            "targetingType",
36104            "assignedTargetingOptionId",
36105        ]
36106        .iter()
36107        {
36108            if self._additional_params.contains_key(field) {
36109                dlg.finished(false);
36110                return Err(common::Error::FieldClash(field));
36111            }
36112        }
36113
36114        let mut params = Params::with_capacity(5 + self._additional_params.len());
36115        params.push("advertiserId", self._advertiser_id.to_string());
36116        params.push("targetingType", self._targeting_type);
36117        params.push(
36118            "assignedTargetingOptionId",
36119            self._assigned_targeting_option_id,
36120        );
36121
36122        params.extend(self._additional_params.iter());
36123
36124        params.push("alt", "json");
36125        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/targetingTypes/{+targetingType}/assignedTargetingOptions/{+assignedTargetingOptionId}";
36126        if self._scopes.is_empty() {
36127            self._scopes
36128                .insert(Scope::DisplayVideo.as_ref().to_string());
36129        }
36130
36131        #[allow(clippy::single_element_loop)]
36132        for &(find_this, param_name) in [
36133            ("{+advertiserId}", "advertiserId"),
36134            ("{+targetingType}", "targetingType"),
36135            ("{+assignedTargetingOptionId}", "assignedTargetingOptionId"),
36136        ]
36137        .iter()
36138        {
36139            url = params.uri_replacement(url, param_name, find_this, true);
36140        }
36141        {
36142            let to_remove = ["assignedTargetingOptionId", "targetingType", "advertiserId"];
36143            params.remove_params(&to_remove);
36144        }
36145
36146        let url = params.parse_with_url(&url);
36147
36148        loop {
36149            let token = match self
36150                .hub
36151                .auth
36152                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36153                .await
36154            {
36155                Ok(token) => token,
36156                Err(e) => match dlg.token(e) {
36157                    Ok(token) => token,
36158                    Err(e) => {
36159                        dlg.finished(false);
36160                        return Err(common::Error::MissingToken(e));
36161                    }
36162                },
36163            };
36164            let mut req_result = {
36165                let client = &self.hub.client;
36166                dlg.pre_request();
36167                let mut req_builder = hyper::Request::builder()
36168                    .method(hyper::Method::GET)
36169                    .uri(url.as_str())
36170                    .header(USER_AGENT, self.hub._user_agent.clone());
36171
36172                if let Some(token) = token.as_ref() {
36173                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36174                }
36175
36176                let request = req_builder
36177                    .header(CONTENT_LENGTH, 0_u64)
36178                    .body(common::to_body::<String>(None));
36179
36180                client.request(request.unwrap()).await
36181            };
36182
36183            match req_result {
36184                Err(err) => {
36185                    if let common::Retry::After(d) = dlg.http_error(&err) {
36186                        sleep(d).await;
36187                        continue;
36188                    }
36189                    dlg.finished(false);
36190                    return Err(common::Error::HttpError(err));
36191                }
36192                Ok(res) => {
36193                    let (mut parts, body) = res.into_parts();
36194                    let mut body = common::Body::new(body);
36195                    if !parts.status.is_success() {
36196                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36197                        let error = serde_json::from_str(&common::to_string(&bytes));
36198                        let response = common::to_response(parts, bytes.into());
36199
36200                        if let common::Retry::After(d) =
36201                            dlg.http_failure(&response, error.as_ref().ok())
36202                        {
36203                            sleep(d).await;
36204                            continue;
36205                        }
36206
36207                        dlg.finished(false);
36208
36209                        return Err(match error {
36210                            Ok(value) => common::Error::BadRequest(value),
36211                            _ => common::Error::Failure(response),
36212                        });
36213                    }
36214                    let response = {
36215                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36216                        let encoded = common::to_string(&bytes);
36217                        match serde_json::from_str(&encoded) {
36218                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36219                            Err(error) => {
36220                                dlg.response_json_decode_error(&encoded, &error);
36221                                return Err(common::Error::JsonDecodeError(
36222                                    encoded.to_string(),
36223                                    error,
36224                                ));
36225                            }
36226                        }
36227                    };
36228
36229                    dlg.finished(true);
36230                    return Ok(response);
36231                }
36232            }
36233        }
36234    }
36235
36236    /// Required. The ID of the advertiser.
36237    ///
36238    /// Sets the *advertiser id* path property to the given value.
36239    ///
36240    /// Even though the property as already been set when instantiating this call,
36241    /// we provide this method for API completeness.
36242    pub fn advertiser_id(
36243        mut self,
36244        new_value: i64,
36245    ) -> AdvertiserTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
36246        self._advertiser_id = new_value;
36247        self
36248    }
36249    /// Required. Identifies the type of this assigned targeting option. Supported targeting types: * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_YOUTUBE_VIDEO` * `TARGETING_TYPE_YOUTUBE_CHANNEL` * `TARGETING_TYPE_KEYWORD`
36250    ///
36251    /// Sets the *targeting type* path property to the given value.
36252    ///
36253    /// Even though the property as already been set when instantiating this call,
36254    /// we provide this method for API completeness.
36255    pub fn targeting_type(
36256        mut self,
36257        new_value: &str,
36258    ) -> AdvertiserTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
36259        self._targeting_type = new_value.to_string();
36260        self
36261    }
36262    /// Required. An identifier unique to the targeting type in this advertiser that identifies the assigned targeting option being requested.
36263    ///
36264    /// Sets the *assigned targeting option id* path property to the given value.
36265    ///
36266    /// Even though the property as already been set when instantiating this call,
36267    /// we provide this method for API completeness.
36268    pub fn assigned_targeting_option_id(
36269        mut self,
36270        new_value: &str,
36271    ) -> AdvertiserTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
36272        self._assigned_targeting_option_id = new_value.to_string();
36273        self
36274    }
36275    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36276    /// while executing the actual API request.
36277    ///
36278    /// ````text
36279    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
36280    /// ````
36281    ///
36282    /// Sets the *delegate* property to the given value.
36283    pub fn delegate(
36284        mut self,
36285        new_value: &'a mut dyn common::Delegate,
36286    ) -> AdvertiserTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
36287        self._delegate = Some(new_value);
36288        self
36289    }
36290
36291    /// Set any additional parameter of the query string used in the request.
36292    /// It should be used to set parameters which are not yet available through their own
36293    /// setters.
36294    ///
36295    /// Please note that this method must not be used to set any of the known parameters
36296    /// which have their own setter method. If done anyway, the request will fail.
36297    ///
36298    /// # Additional Parameters
36299    ///
36300    /// * *$.xgafv* (query-string) - V1 error format.
36301    /// * *access_token* (query-string) - OAuth access token.
36302    /// * *alt* (query-string) - Data format for response.
36303    /// * *callback* (query-string) - JSONP
36304    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36305    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
36306    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36307    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36308    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
36309    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36310    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36311    pub fn param<T>(
36312        mut self,
36313        name: T,
36314        value: T,
36315    ) -> AdvertiserTargetingTypeAssignedTargetingOptionGetCall<'a, C>
36316    where
36317        T: AsRef<str>,
36318    {
36319        self._additional_params
36320            .insert(name.as_ref().to_string(), value.as_ref().to_string());
36321        self
36322    }
36323
36324    /// Identifies the authorization scope for the method you are building.
36325    ///
36326    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36327    /// [`Scope::DisplayVideo`].
36328    ///
36329    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36330    /// tokens for more than one scope.
36331    ///
36332    /// Usually there is more than one suitable scope to authorize an operation, some of which may
36333    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36334    /// sufficient, a read-write scope will do as well.
36335    pub fn add_scope<St>(
36336        mut self,
36337        scope: St,
36338    ) -> AdvertiserTargetingTypeAssignedTargetingOptionGetCall<'a, C>
36339    where
36340        St: AsRef<str>,
36341    {
36342        self._scopes.insert(String::from(scope.as_ref()));
36343        self
36344    }
36345    /// Identifies the authorization scope(s) for the method you are building.
36346    ///
36347    /// See [`Self::add_scope()`] for details.
36348    pub fn add_scopes<I, St>(
36349        mut self,
36350        scopes: I,
36351    ) -> AdvertiserTargetingTypeAssignedTargetingOptionGetCall<'a, C>
36352    where
36353        I: IntoIterator<Item = St>,
36354        St: AsRef<str>,
36355    {
36356        self._scopes
36357            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36358        self
36359    }
36360
36361    /// Removes all scopes, and no default scope will be used either.
36362    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36363    /// for details).
36364    pub fn clear_scopes(mut self) -> AdvertiserTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
36365        self._scopes.clear();
36366        self
36367    }
36368}
36369
36370/// Lists the targeting options assigned to an advertiser.
36371///
36372/// A builder for the *targetingTypes.assignedTargetingOptions.list* method supported by a *advertiser* resource.
36373/// It is not used directly, but through a [`AdvertiserMethods`] instance.
36374///
36375/// # Example
36376///
36377/// Instantiate a resource method builder
36378///
36379/// ```test_harness,no_run
36380/// # extern crate hyper;
36381/// # extern crate hyper_rustls;
36382/// # extern crate google_displayvideo1 as displayvideo1;
36383/// # async fn dox() {
36384/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36385///
36386/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36387/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
36388/// #     secret,
36389/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36390/// # ).build().await.unwrap();
36391///
36392/// # let client = hyper_util::client::legacy::Client::builder(
36393/// #     hyper_util::rt::TokioExecutor::new()
36394/// # )
36395/// # .build(
36396/// #     hyper_rustls::HttpsConnectorBuilder::new()
36397/// #         .with_native_roots()
36398/// #         .unwrap()
36399/// #         .https_or_http()
36400/// #         .enable_http1()
36401/// #         .build()
36402/// # );
36403/// # let mut hub = DisplayVideo::new(client, auth);
36404/// // You can configure optional parameters by calling the respective setters at will, and
36405/// // execute the final call using `doit()`.
36406/// // Values shown here are possibly random and not representative !
36407/// let result = hub.advertisers().targeting_types_assigned_targeting_options_list(-27, "targetingType")
36408///              .page_token("clita")
36409///              .page_size(-15)
36410///              .order_by("aliquyam")
36411///              .filter("ut")
36412///              .doit().await;
36413/// # }
36414/// ```
36415pub struct AdvertiserTargetingTypeAssignedTargetingOptionListCall<'a, C>
36416where
36417    C: 'a,
36418{
36419    hub: &'a DisplayVideo<C>,
36420    _advertiser_id: i64,
36421    _targeting_type: String,
36422    _page_token: Option<String>,
36423    _page_size: Option<i32>,
36424    _order_by: Option<String>,
36425    _filter: Option<String>,
36426    _delegate: Option<&'a mut dyn common::Delegate>,
36427    _additional_params: HashMap<String, String>,
36428    _scopes: BTreeSet<String>,
36429}
36430
36431impl<'a, C> common::CallBuilder for AdvertiserTargetingTypeAssignedTargetingOptionListCall<'a, C> {}
36432
36433impl<'a, C> AdvertiserTargetingTypeAssignedTargetingOptionListCall<'a, C>
36434where
36435    C: common::Connector,
36436{
36437    /// Perform the operation you have build so far.
36438    pub async fn doit(
36439        mut self,
36440    ) -> common::Result<(
36441        common::Response,
36442        ListAdvertiserAssignedTargetingOptionsResponse,
36443    )> {
36444        use std::borrow::Cow;
36445        use std::io::{Read, Seek};
36446
36447        use common::{url::Params, ToParts};
36448        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36449
36450        let mut dd = common::DefaultDelegate;
36451        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36452        dlg.begin(common::MethodInfo {
36453            id: "displayvideo.advertisers.targetingTypes.assignedTargetingOptions.list",
36454            http_method: hyper::Method::GET,
36455        });
36456
36457        for &field in [
36458            "alt",
36459            "advertiserId",
36460            "targetingType",
36461            "pageToken",
36462            "pageSize",
36463            "orderBy",
36464            "filter",
36465        ]
36466        .iter()
36467        {
36468            if self._additional_params.contains_key(field) {
36469                dlg.finished(false);
36470                return Err(common::Error::FieldClash(field));
36471            }
36472        }
36473
36474        let mut params = Params::with_capacity(8 + self._additional_params.len());
36475        params.push("advertiserId", self._advertiser_id.to_string());
36476        params.push("targetingType", self._targeting_type);
36477        if let Some(value) = self._page_token.as_ref() {
36478            params.push("pageToken", value);
36479        }
36480        if let Some(value) = self._page_size.as_ref() {
36481            params.push("pageSize", value.to_string());
36482        }
36483        if let Some(value) = self._order_by.as_ref() {
36484            params.push("orderBy", value);
36485        }
36486        if let Some(value) = self._filter.as_ref() {
36487            params.push("filter", value);
36488        }
36489
36490        params.extend(self._additional_params.iter());
36491
36492        params.push("alt", "json");
36493        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}/targetingTypes/{+targetingType}/assignedTargetingOptions";
36494        if self._scopes.is_empty() {
36495            self._scopes
36496                .insert(Scope::DisplayVideo.as_ref().to_string());
36497        }
36498
36499        #[allow(clippy::single_element_loop)]
36500        for &(find_this, param_name) in [
36501            ("{+advertiserId}", "advertiserId"),
36502            ("{+targetingType}", "targetingType"),
36503        ]
36504        .iter()
36505        {
36506            url = params.uri_replacement(url, param_name, find_this, true);
36507        }
36508        {
36509            let to_remove = ["targetingType", "advertiserId"];
36510            params.remove_params(&to_remove);
36511        }
36512
36513        let url = params.parse_with_url(&url);
36514
36515        loop {
36516            let token = match self
36517                .hub
36518                .auth
36519                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36520                .await
36521            {
36522                Ok(token) => token,
36523                Err(e) => match dlg.token(e) {
36524                    Ok(token) => token,
36525                    Err(e) => {
36526                        dlg.finished(false);
36527                        return Err(common::Error::MissingToken(e));
36528                    }
36529                },
36530            };
36531            let mut req_result = {
36532                let client = &self.hub.client;
36533                dlg.pre_request();
36534                let mut req_builder = hyper::Request::builder()
36535                    .method(hyper::Method::GET)
36536                    .uri(url.as_str())
36537                    .header(USER_AGENT, self.hub._user_agent.clone());
36538
36539                if let Some(token) = token.as_ref() {
36540                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36541                }
36542
36543                let request = req_builder
36544                    .header(CONTENT_LENGTH, 0_u64)
36545                    .body(common::to_body::<String>(None));
36546
36547                client.request(request.unwrap()).await
36548            };
36549
36550            match req_result {
36551                Err(err) => {
36552                    if let common::Retry::After(d) = dlg.http_error(&err) {
36553                        sleep(d).await;
36554                        continue;
36555                    }
36556                    dlg.finished(false);
36557                    return Err(common::Error::HttpError(err));
36558                }
36559                Ok(res) => {
36560                    let (mut parts, body) = res.into_parts();
36561                    let mut body = common::Body::new(body);
36562                    if !parts.status.is_success() {
36563                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36564                        let error = serde_json::from_str(&common::to_string(&bytes));
36565                        let response = common::to_response(parts, bytes.into());
36566
36567                        if let common::Retry::After(d) =
36568                            dlg.http_failure(&response, error.as_ref().ok())
36569                        {
36570                            sleep(d).await;
36571                            continue;
36572                        }
36573
36574                        dlg.finished(false);
36575
36576                        return Err(match error {
36577                            Ok(value) => common::Error::BadRequest(value),
36578                            _ => common::Error::Failure(response),
36579                        });
36580                    }
36581                    let response = {
36582                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36583                        let encoded = common::to_string(&bytes);
36584                        match serde_json::from_str(&encoded) {
36585                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36586                            Err(error) => {
36587                                dlg.response_json_decode_error(&encoded, &error);
36588                                return Err(common::Error::JsonDecodeError(
36589                                    encoded.to_string(),
36590                                    error,
36591                                ));
36592                            }
36593                        }
36594                    };
36595
36596                    dlg.finished(true);
36597                    return Ok(response);
36598                }
36599            }
36600        }
36601    }
36602
36603    /// Required. The ID of the advertiser.
36604    ///
36605    /// Sets the *advertiser id* path property to the given value.
36606    ///
36607    /// Even though the property as already been set when instantiating this call,
36608    /// we provide this method for API completeness.
36609    pub fn advertiser_id(
36610        mut self,
36611        new_value: i64,
36612    ) -> AdvertiserTargetingTypeAssignedTargetingOptionListCall<'a, C> {
36613        self._advertiser_id = new_value;
36614        self
36615    }
36616    /// Required. Identifies the type of assigned targeting options to list. Supported targeting types: * `TARGETING_TYPE_CHANNEL` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_OMID` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_YOUTUBE_VIDEO` * `TARGETING_TYPE_YOUTUBE_CHANNEL` * `TARGETING_TYPE_KEYWORD`
36617    ///
36618    /// Sets the *targeting type* path property to the given value.
36619    ///
36620    /// Even though the property as already been set when instantiating this call,
36621    /// we provide this method for API completeness.
36622    pub fn targeting_type(
36623        mut self,
36624        new_value: &str,
36625    ) -> AdvertiserTargetingTypeAssignedTargetingOptionListCall<'a, C> {
36626        self._targeting_type = new_value.to_string();
36627        self
36628    }
36629    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListAdvertiserAssignedTargetingOptions` method. If not specified, the first page of results will be returned.
36630    ///
36631    /// Sets the *page token* query property to the given value.
36632    pub fn page_token(
36633        mut self,
36634        new_value: &str,
36635    ) -> AdvertiserTargetingTypeAssignedTargetingOptionListCall<'a, C> {
36636        self._page_token = Some(new_value.to_string());
36637        self
36638    }
36639    /// Requested page size. Must be between `1` and `5000`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
36640    ///
36641    /// Sets the *page size* query property to the given value.
36642    pub fn page_size(
36643        mut self,
36644        new_value: i32,
36645    ) -> AdvertiserTargetingTypeAssignedTargetingOptionListCall<'a, C> {
36646        self._page_size = Some(new_value);
36647        self
36648    }
36649    /// Field by which to sort the list. Acceptable values are: * `assignedTargetingOptionId` (default) The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `assignedTargetingOptionId desc`.
36650    ///
36651    /// Sets the *order by* query property to the given value.
36652    pub fn order_by(
36653        mut self,
36654        new_value: &str,
36655    ) -> AdvertiserTargetingTypeAssignedTargetingOptionListCall<'a, C> {
36656        self._order_by = Some(new_value.to_string());
36657        self
36658    }
36659    /// Allows filtering by assigned targeting option fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by the `OR` logical operator. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `EQUALS (=)` operator. Supported fields: * `assignedTargetingOptionId` Examples: * `AssignedTargetingOption` with ID 123456: `assignedTargetingOptionId="123456"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
36660    ///
36661    /// Sets the *filter* query property to the given value.
36662    pub fn filter(
36663        mut self,
36664        new_value: &str,
36665    ) -> AdvertiserTargetingTypeAssignedTargetingOptionListCall<'a, C> {
36666        self._filter = Some(new_value.to_string());
36667        self
36668    }
36669    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36670    /// while executing the actual API request.
36671    ///
36672    /// ````text
36673    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
36674    /// ````
36675    ///
36676    /// Sets the *delegate* property to the given value.
36677    pub fn delegate(
36678        mut self,
36679        new_value: &'a mut dyn common::Delegate,
36680    ) -> AdvertiserTargetingTypeAssignedTargetingOptionListCall<'a, C> {
36681        self._delegate = Some(new_value);
36682        self
36683    }
36684
36685    /// Set any additional parameter of the query string used in the request.
36686    /// It should be used to set parameters which are not yet available through their own
36687    /// setters.
36688    ///
36689    /// Please note that this method must not be used to set any of the known parameters
36690    /// which have their own setter method. If done anyway, the request will fail.
36691    ///
36692    /// # Additional Parameters
36693    ///
36694    /// * *$.xgafv* (query-string) - V1 error format.
36695    /// * *access_token* (query-string) - OAuth access token.
36696    /// * *alt* (query-string) - Data format for response.
36697    /// * *callback* (query-string) - JSONP
36698    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36699    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
36700    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36701    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36702    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
36703    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36704    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36705    pub fn param<T>(
36706        mut self,
36707        name: T,
36708        value: T,
36709    ) -> AdvertiserTargetingTypeAssignedTargetingOptionListCall<'a, C>
36710    where
36711        T: AsRef<str>,
36712    {
36713        self._additional_params
36714            .insert(name.as_ref().to_string(), value.as_ref().to_string());
36715        self
36716    }
36717
36718    /// Identifies the authorization scope for the method you are building.
36719    ///
36720    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36721    /// [`Scope::DisplayVideo`].
36722    ///
36723    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36724    /// tokens for more than one scope.
36725    ///
36726    /// Usually there is more than one suitable scope to authorize an operation, some of which may
36727    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36728    /// sufficient, a read-write scope will do as well.
36729    pub fn add_scope<St>(
36730        mut self,
36731        scope: St,
36732    ) -> AdvertiserTargetingTypeAssignedTargetingOptionListCall<'a, C>
36733    where
36734        St: AsRef<str>,
36735    {
36736        self._scopes.insert(String::from(scope.as_ref()));
36737        self
36738    }
36739    /// Identifies the authorization scope(s) for the method you are building.
36740    ///
36741    /// See [`Self::add_scope()`] for details.
36742    pub fn add_scopes<I, St>(
36743        mut self,
36744        scopes: I,
36745    ) -> AdvertiserTargetingTypeAssignedTargetingOptionListCall<'a, C>
36746    where
36747        I: IntoIterator<Item = St>,
36748        St: AsRef<str>,
36749    {
36750        self._scopes
36751            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36752        self
36753    }
36754
36755    /// Removes all scopes, and no default scope will be used either.
36756    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36757    /// for details).
36758    pub fn clear_scopes(mut self) -> AdvertiserTargetingTypeAssignedTargetingOptionListCall<'a, C> {
36759        self._scopes.clear();
36760        self
36761    }
36762}
36763
36764/// Audits an advertiser. Returns the counts of used entities per resource type under the advertiser provided. Used entities count towards their respective resource limit. See https://support.google.com/displayvideo/answer/6071450.
36765///
36766/// A builder for the *audit* method supported by a *advertiser* resource.
36767/// It is not used directly, but through a [`AdvertiserMethods`] instance.
36768///
36769/// # Example
36770///
36771/// Instantiate a resource method builder
36772///
36773/// ```test_harness,no_run
36774/// # extern crate hyper;
36775/// # extern crate hyper_rustls;
36776/// # extern crate google_displayvideo1 as displayvideo1;
36777/// # async fn dox() {
36778/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36779///
36780/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36781/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
36782/// #     secret,
36783/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36784/// # ).build().await.unwrap();
36785///
36786/// # let client = hyper_util::client::legacy::Client::builder(
36787/// #     hyper_util::rt::TokioExecutor::new()
36788/// # )
36789/// # .build(
36790/// #     hyper_rustls::HttpsConnectorBuilder::new()
36791/// #         .with_native_roots()
36792/// #         .unwrap()
36793/// #         .https_or_http()
36794/// #         .enable_http1()
36795/// #         .build()
36796/// # );
36797/// # let mut hub = DisplayVideo::new(client, auth);
36798/// // You can configure optional parameters by calling the respective setters at will, and
36799/// // execute the final call using `doit()`.
36800/// // Values shown here are possibly random and not representative !
36801/// let result = hub.advertisers().audit(-3)
36802///              .read_mask(FieldMask::new::<&str>(&[]))
36803///              .doit().await;
36804/// # }
36805/// ```
36806pub struct AdvertiserAuditCall<'a, C>
36807where
36808    C: 'a,
36809{
36810    hub: &'a DisplayVideo<C>,
36811    _advertiser_id: i64,
36812    _read_mask: Option<common::FieldMask>,
36813    _delegate: Option<&'a mut dyn common::Delegate>,
36814    _additional_params: HashMap<String, String>,
36815    _scopes: BTreeSet<String>,
36816}
36817
36818impl<'a, C> common::CallBuilder for AdvertiserAuditCall<'a, C> {}
36819
36820impl<'a, C> AdvertiserAuditCall<'a, C>
36821where
36822    C: common::Connector,
36823{
36824    /// Perform the operation you have build so far.
36825    pub async fn doit(mut self) -> common::Result<(common::Response, AuditAdvertiserResponse)> {
36826        use std::borrow::Cow;
36827        use std::io::{Read, Seek};
36828
36829        use common::{url::Params, ToParts};
36830        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36831
36832        let mut dd = common::DefaultDelegate;
36833        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36834        dlg.begin(common::MethodInfo {
36835            id: "displayvideo.advertisers.audit",
36836            http_method: hyper::Method::GET,
36837        });
36838
36839        for &field in ["alt", "advertiserId", "readMask"].iter() {
36840            if self._additional_params.contains_key(field) {
36841                dlg.finished(false);
36842                return Err(common::Error::FieldClash(field));
36843            }
36844        }
36845
36846        let mut params = Params::with_capacity(4 + self._additional_params.len());
36847        params.push("advertiserId", self._advertiser_id.to_string());
36848        if let Some(value) = self._read_mask.as_ref() {
36849            params.push("readMask", value.to_string());
36850        }
36851
36852        params.extend(self._additional_params.iter());
36853
36854        params.push("alt", "json");
36855        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}:audit";
36856        if self._scopes.is_empty() {
36857            self._scopes
36858                .insert(Scope::DisplayVideo.as_ref().to_string());
36859        }
36860
36861        #[allow(clippy::single_element_loop)]
36862        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
36863            url = params.uri_replacement(url, param_name, find_this, true);
36864        }
36865        {
36866            let to_remove = ["advertiserId"];
36867            params.remove_params(&to_remove);
36868        }
36869
36870        let url = params.parse_with_url(&url);
36871
36872        loop {
36873            let token = match self
36874                .hub
36875                .auth
36876                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36877                .await
36878            {
36879                Ok(token) => token,
36880                Err(e) => match dlg.token(e) {
36881                    Ok(token) => token,
36882                    Err(e) => {
36883                        dlg.finished(false);
36884                        return Err(common::Error::MissingToken(e));
36885                    }
36886                },
36887            };
36888            let mut req_result = {
36889                let client = &self.hub.client;
36890                dlg.pre_request();
36891                let mut req_builder = hyper::Request::builder()
36892                    .method(hyper::Method::GET)
36893                    .uri(url.as_str())
36894                    .header(USER_AGENT, self.hub._user_agent.clone());
36895
36896                if let Some(token) = token.as_ref() {
36897                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36898                }
36899
36900                let request = req_builder
36901                    .header(CONTENT_LENGTH, 0_u64)
36902                    .body(common::to_body::<String>(None));
36903
36904                client.request(request.unwrap()).await
36905            };
36906
36907            match req_result {
36908                Err(err) => {
36909                    if let common::Retry::After(d) = dlg.http_error(&err) {
36910                        sleep(d).await;
36911                        continue;
36912                    }
36913                    dlg.finished(false);
36914                    return Err(common::Error::HttpError(err));
36915                }
36916                Ok(res) => {
36917                    let (mut parts, body) = res.into_parts();
36918                    let mut body = common::Body::new(body);
36919                    if !parts.status.is_success() {
36920                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36921                        let error = serde_json::from_str(&common::to_string(&bytes));
36922                        let response = common::to_response(parts, bytes.into());
36923
36924                        if let common::Retry::After(d) =
36925                            dlg.http_failure(&response, error.as_ref().ok())
36926                        {
36927                            sleep(d).await;
36928                            continue;
36929                        }
36930
36931                        dlg.finished(false);
36932
36933                        return Err(match error {
36934                            Ok(value) => common::Error::BadRequest(value),
36935                            _ => common::Error::Failure(response),
36936                        });
36937                    }
36938                    let response = {
36939                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36940                        let encoded = common::to_string(&bytes);
36941                        match serde_json::from_str(&encoded) {
36942                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36943                            Err(error) => {
36944                                dlg.response_json_decode_error(&encoded, &error);
36945                                return Err(common::Error::JsonDecodeError(
36946                                    encoded.to_string(),
36947                                    error,
36948                                ));
36949                            }
36950                        }
36951                    };
36952
36953                    dlg.finished(true);
36954                    return Ok(response);
36955                }
36956            }
36957        }
36958    }
36959
36960    /// Required. The ID of the advertiser to audit.
36961    ///
36962    /// Sets the *advertiser id* path property to the given value.
36963    ///
36964    /// Even though the property as already been set when instantiating this call,
36965    /// we provide this method for API completeness.
36966    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserAuditCall<'a, C> {
36967        self._advertiser_id = new_value;
36968        self
36969    }
36970    /// Optional. The specific fields to return. If no mask is specified, all fields in the response proto will be filled. Valid values are: * usedLineItemsCount * usedInsertionOrdersCount * usedCampaignsCount * channelsCount * negativelyTargetedChannelsCount * negativeKeywordListsCount * adGroupCriteriaCount * campaignCriteriaCount
36971    ///
36972    /// Sets the *read mask* query property to the given value.
36973    pub fn read_mask(mut self, new_value: common::FieldMask) -> AdvertiserAuditCall<'a, C> {
36974        self._read_mask = Some(new_value);
36975        self
36976    }
36977    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36978    /// while executing the actual API request.
36979    ///
36980    /// ````text
36981    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
36982    /// ````
36983    ///
36984    /// Sets the *delegate* property to the given value.
36985    pub fn delegate(
36986        mut self,
36987        new_value: &'a mut dyn common::Delegate,
36988    ) -> AdvertiserAuditCall<'a, C> {
36989        self._delegate = Some(new_value);
36990        self
36991    }
36992
36993    /// Set any additional parameter of the query string used in the request.
36994    /// It should be used to set parameters which are not yet available through their own
36995    /// setters.
36996    ///
36997    /// Please note that this method must not be used to set any of the known parameters
36998    /// which have their own setter method. If done anyway, the request will fail.
36999    ///
37000    /// # Additional Parameters
37001    ///
37002    /// * *$.xgafv* (query-string) - V1 error format.
37003    /// * *access_token* (query-string) - OAuth access token.
37004    /// * *alt* (query-string) - Data format for response.
37005    /// * *callback* (query-string) - JSONP
37006    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37007    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
37008    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37009    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37010    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
37011    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37012    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37013    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserAuditCall<'a, C>
37014    where
37015        T: AsRef<str>,
37016    {
37017        self._additional_params
37018            .insert(name.as_ref().to_string(), value.as_ref().to_string());
37019        self
37020    }
37021
37022    /// Identifies the authorization scope for the method you are building.
37023    ///
37024    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37025    /// [`Scope::DisplayVideo`].
37026    ///
37027    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37028    /// tokens for more than one scope.
37029    ///
37030    /// Usually there is more than one suitable scope to authorize an operation, some of which may
37031    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37032    /// sufficient, a read-write scope will do as well.
37033    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserAuditCall<'a, C>
37034    where
37035        St: AsRef<str>,
37036    {
37037        self._scopes.insert(String::from(scope.as_ref()));
37038        self
37039    }
37040    /// Identifies the authorization scope(s) for the method you are building.
37041    ///
37042    /// See [`Self::add_scope()`] for details.
37043    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserAuditCall<'a, C>
37044    where
37045        I: IntoIterator<Item = St>,
37046        St: AsRef<str>,
37047    {
37048        self._scopes
37049            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37050        self
37051    }
37052
37053    /// Removes all scopes, and no default scope will be used either.
37054    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37055    /// for details).
37056    pub fn clear_scopes(mut self) -> AdvertiserAuditCall<'a, C> {
37057        self._scopes.clear();
37058        self
37059    }
37060}
37061
37062/// Bulk edits targeting options under a single advertiser. The operation will delete the assigned targeting options provided in BulkEditAdvertiserAssignedTargetingOptionsRequest.delete_requests and then create the assigned targeting options provided in BulkEditAdvertiserAssignedTargetingOptionsRequest.create_requests .
37063///
37064/// A builder for the *bulkEditAdvertiserAssignedTargetingOptions* method supported by a *advertiser* resource.
37065/// It is not used directly, but through a [`AdvertiserMethods`] instance.
37066///
37067/// # Example
37068///
37069/// Instantiate a resource method builder
37070///
37071/// ```test_harness,no_run
37072/// # extern crate hyper;
37073/// # extern crate hyper_rustls;
37074/// # extern crate google_displayvideo1 as displayvideo1;
37075/// use displayvideo1::api::BulkEditAdvertiserAssignedTargetingOptionsRequest;
37076/// # async fn dox() {
37077/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37078///
37079/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37080/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
37081/// #     secret,
37082/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37083/// # ).build().await.unwrap();
37084///
37085/// # let client = hyper_util::client::legacy::Client::builder(
37086/// #     hyper_util::rt::TokioExecutor::new()
37087/// # )
37088/// # .build(
37089/// #     hyper_rustls::HttpsConnectorBuilder::new()
37090/// #         .with_native_roots()
37091/// #         .unwrap()
37092/// #         .https_or_http()
37093/// #         .enable_http1()
37094/// #         .build()
37095/// # );
37096/// # let mut hub = DisplayVideo::new(client, auth);
37097/// // As the method needs a request, you would usually fill it with the desired information
37098/// // into the respective structure. Some of the parts shown here might not be applicable !
37099/// // Values shown here are possibly random and not representative !
37100/// let mut req = BulkEditAdvertiserAssignedTargetingOptionsRequest::default();
37101///
37102/// // You can configure optional parameters by calling the respective setters at will, and
37103/// // execute the final call using `doit()`.
37104/// // Values shown here are possibly random and not representative !
37105/// let result = hub.advertisers().bulk_edit_advertiser_assigned_targeting_options(req, -26)
37106///              .doit().await;
37107/// # }
37108/// ```
37109pub struct AdvertiserBulkEditAdvertiserAssignedTargetingOptionCall<'a, C>
37110where
37111    C: 'a,
37112{
37113    hub: &'a DisplayVideo<C>,
37114    _request: BulkEditAdvertiserAssignedTargetingOptionsRequest,
37115    _advertiser_id: i64,
37116    _delegate: Option<&'a mut dyn common::Delegate>,
37117    _additional_params: HashMap<String, String>,
37118    _scopes: BTreeSet<String>,
37119}
37120
37121impl<'a, C> common::CallBuilder for AdvertiserBulkEditAdvertiserAssignedTargetingOptionCall<'a, C> {}
37122
37123impl<'a, C> AdvertiserBulkEditAdvertiserAssignedTargetingOptionCall<'a, C>
37124where
37125    C: common::Connector,
37126{
37127    /// Perform the operation you have build so far.
37128    pub async fn doit(
37129        mut self,
37130    ) -> common::Result<(
37131        common::Response,
37132        BulkEditAdvertiserAssignedTargetingOptionsResponse,
37133    )> {
37134        use std::borrow::Cow;
37135        use std::io::{Read, Seek};
37136
37137        use common::{url::Params, ToParts};
37138        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37139
37140        let mut dd = common::DefaultDelegate;
37141        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37142        dlg.begin(common::MethodInfo {
37143            id: "displayvideo.advertisers.bulkEditAdvertiserAssignedTargetingOptions",
37144            http_method: hyper::Method::POST,
37145        });
37146
37147        for &field in ["alt", "advertiserId"].iter() {
37148            if self._additional_params.contains_key(field) {
37149                dlg.finished(false);
37150                return Err(common::Error::FieldClash(field));
37151            }
37152        }
37153
37154        let mut params = Params::with_capacity(4 + self._additional_params.len());
37155        params.push("advertiserId", self._advertiser_id.to_string());
37156
37157        params.extend(self._additional_params.iter());
37158
37159        params.push("alt", "json");
37160        let mut url = self.hub._base_url.clone()
37161            + "v1/advertisers/{+advertiserId}:bulkEditAdvertiserAssignedTargetingOptions";
37162        if self._scopes.is_empty() {
37163            self._scopes
37164                .insert(Scope::DisplayVideo.as_ref().to_string());
37165        }
37166
37167        #[allow(clippy::single_element_loop)]
37168        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
37169            url = params.uri_replacement(url, param_name, find_this, true);
37170        }
37171        {
37172            let to_remove = ["advertiserId"];
37173            params.remove_params(&to_remove);
37174        }
37175
37176        let url = params.parse_with_url(&url);
37177
37178        let mut json_mime_type = mime::APPLICATION_JSON;
37179        let mut request_value_reader = {
37180            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
37181            common::remove_json_null_values(&mut value);
37182            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
37183            serde_json::to_writer(&mut dst, &value).unwrap();
37184            dst
37185        };
37186        let request_size = request_value_reader
37187            .seek(std::io::SeekFrom::End(0))
37188            .unwrap();
37189        request_value_reader
37190            .seek(std::io::SeekFrom::Start(0))
37191            .unwrap();
37192
37193        loop {
37194            let token = match self
37195                .hub
37196                .auth
37197                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37198                .await
37199            {
37200                Ok(token) => token,
37201                Err(e) => match dlg.token(e) {
37202                    Ok(token) => token,
37203                    Err(e) => {
37204                        dlg.finished(false);
37205                        return Err(common::Error::MissingToken(e));
37206                    }
37207                },
37208            };
37209            request_value_reader
37210                .seek(std::io::SeekFrom::Start(0))
37211                .unwrap();
37212            let mut req_result = {
37213                let client = &self.hub.client;
37214                dlg.pre_request();
37215                let mut req_builder = hyper::Request::builder()
37216                    .method(hyper::Method::POST)
37217                    .uri(url.as_str())
37218                    .header(USER_AGENT, self.hub._user_agent.clone());
37219
37220                if let Some(token) = token.as_ref() {
37221                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37222                }
37223
37224                let request = req_builder
37225                    .header(CONTENT_TYPE, json_mime_type.to_string())
37226                    .header(CONTENT_LENGTH, request_size as u64)
37227                    .body(common::to_body(
37228                        request_value_reader.get_ref().clone().into(),
37229                    ));
37230
37231                client.request(request.unwrap()).await
37232            };
37233
37234            match req_result {
37235                Err(err) => {
37236                    if let common::Retry::After(d) = dlg.http_error(&err) {
37237                        sleep(d).await;
37238                        continue;
37239                    }
37240                    dlg.finished(false);
37241                    return Err(common::Error::HttpError(err));
37242                }
37243                Ok(res) => {
37244                    let (mut parts, body) = res.into_parts();
37245                    let mut body = common::Body::new(body);
37246                    if !parts.status.is_success() {
37247                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37248                        let error = serde_json::from_str(&common::to_string(&bytes));
37249                        let response = common::to_response(parts, bytes.into());
37250
37251                        if let common::Retry::After(d) =
37252                            dlg.http_failure(&response, error.as_ref().ok())
37253                        {
37254                            sleep(d).await;
37255                            continue;
37256                        }
37257
37258                        dlg.finished(false);
37259
37260                        return Err(match error {
37261                            Ok(value) => common::Error::BadRequest(value),
37262                            _ => common::Error::Failure(response),
37263                        });
37264                    }
37265                    let response = {
37266                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37267                        let encoded = common::to_string(&bytes);
37268                        match serde_json::from_str(&encoded) {
37269                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37270                            Err(error) => {
37271                                dlg.response_json_decode_error(&encoded, &error);
37272                                return Err(common::Error::JsonDecodeError(
37273                                    encoded.to_string(),
37274                                    error,
37275                                ));
37276                            }
37277                        }
37278                    };
37279
37280                    dlg.finished(true);
37281                    return Ok(response);
37282                }
37283            }
37284        }
37285    }
37286
37287    ///
37288    /// Sets the *request* property to the given value.
37289    ///
37290    /// Even though the property as already been set when instantiating this call,
37291    /// we provide this method for API completeness.
37292    pub fn request(
37293        mut self,
37294        new_value: BulkEditAdvertiserAssignedTargetingOptionsRequest,
37295    ) -> AdvertiserBulkEditAdvertiserAssignedTargetingOptionCall<'a, C> {
37296        self._request = new_value;
37297        self
37298    }
37299    /// Required. The ID of the advertiser.
37300    ///
37301    /// Sets the *advertiser id* path property to the given value.
37302    ///
37303    /// Even though the property as already been set when instantiating this call,
37304    /// we provide this method for API completeness.
37305    pub fn advertiser_id(
37306        mut self,
37307        new_value: i64,
37308    ) -> AdvertiserBulkEditAdvertiserAssignedTargetingOptionCall<'a, C> {
37309        self._advertiser_id = new_value;
37310        self
37311    }
37312    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37313    /// while executing the actual API request.
37314    ///
37315    /// ````text
37316    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
37317    /// ````
37318    ///
37319    /// Sets the *delegate* property to the given value.
37320    pub fn delegate(
37321        mut self,
37322        new_value: &'a mut dyn common::Delegate,
37323    ) -> AdvertiserBulkEditAdvertiserAssignedTargetingOptionCall<'a, C> {
37324        self._delegate = Some(new_value);
37325        self
37326    }
37327
37328    /// Set any additional parameter of the query string used in the request.
37329    /// It should be used to set parameters which are not yet available through their own
37330    /// setters.
37331    ///
37332    /// Please note that this method must not be used to set any of the known parameters
37333    /// which have their own setter method. If done anyway, the request will fail.
37334    ///
37335    /// # Additional Parameters
37336    ///
37337    /// * *$.xgafv* (query-string) - V1 error format.
37338    /// * *access_token* (query-string) - OAuth access token.
37339    /// * *alt* (query-string) - Data format for response.
37340    /// * *callback* (query-string) - JSONP
37341    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37342    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
37343    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37344    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37345    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
37346    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37347    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37348    pub fn param<T>(
37349        mut self,
37350        name: T,
37351        value: T,
37352    ) -> AdvertiserBulkEditAdvertiserAssignedTargetingOptionCall<'a, C>
37353    where
37354        T: AsRef<str>,
37355    {
37356        self._additional_params
37357            .insert(name.as_ref().to_string(), value.as_ref().to_string());
37358        self
37359    }
37360
37361    /// Identifies the authorization scope for the method you are building.
37362    ///
37363    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37364    /// [`Scope::DisplayVideo`].
37365    ///
37366    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37367    /// tokens for more than one scope.
37368    ///
37369    /// Usually there is more than one suitable scope to authorize an operation, some of which may
37370    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37371    /// sufficient, a read-write scope will do as well.
37372    pub fn add_scope<St>(
37373        mut self,
37374        scope: St,
37375    ) -> AdvertiserBulkEditAdvertiserAssignedTargetingOptionCall<'a, C>
37376    where
37377        St: AsRef<str>,
37378    {
37379        self._scopes.insert(String::from(scope.as_ref()));
37380        self
37381    }
37382    /// Identifies the authorization scope(s) for the method you are building.
37383    ///
37384    /// See [`Self::add_scope()`] for details.
37385    pub fn add_scopes<I, St>(
37386        mut self,
37387        scopes: I,
37388    ) -> AdvertiserBulkEditAdvertiserAssignedTargetingOptionCall<'a, C>
37389    where
37390        I: IntoIterator<Item = St>,
37391        St: AsRef<str>,
37392    {
37393        self._scopes
37394            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37395        self
37396    }
37397
37398    /// Removes all scopes, and no default scope will be used either.
37399    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37400    /// for details).
37401    pub fn clear_scopes(
37402        mut self,
37403    ) -> AdvertiserBulkEditAdvertiserAssignedTargetingOptionCall<'a, C> {
37404        self._scopes.clear();
37405        self
37406    }
37407}
37408
37409/// Lists assigned targeting options of an advertiser across targeting types.
37410///
37411/// A builder for the *bulkListAdvertiserAssignedTargetingOptions* method supported by a *advertiser* resource.
37412/// It is not used directly, but through a [`AdvertiserMethods`] instance.
37413///
37414/// # Example
37415///
37416/// Instantiate a resource method builder
37417///
37418/// ```test_harness,no_run
37419/// # extern crate hyper;
37420/// # extern crate hyper_rustls;
37421/// # extern crate google_displayvideo1 as displayvideo1;
37422/// # async fn dox() {
37423/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37424///
37425/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37426/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
37427/// #     secret,
37428/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37429/// # ).build().await.unwrap();
37430///
37431/// # let client = hyper_util::client::legacy::Client::builder(
37432/// #     hyper_util::rt::TokioExecutor::new()
37433/// # )
37434/// # .build(
37435/// #     hyper_rustls::HttpsConnectorBuilder::new()
37436/// #         .with_native_roots()
37437/// #         .unwrap()
37438/// #         .https_or_http()
37439/// #         .enable_http1()
37440/// #         .build()
37441/// # );
37442/// # let mut hub = DisplayVideo::new(client, auth);
37443/// // You can configure optional parameters by calling the respective setters at will, and
37444/// // execute the final call using `doit()`.
37445/// // Values shown here are possibly random and not representative !
37446/// let result = hub.advertisers().bulk_list_advertiser_assigned_targeting_options(-16)
37447///              .page_token("dolores")
37448///              .page_size(-96)
37449///              .order_by("dolores")
37450///              .filter("sed")
37451///              .doit().await;
37452/// # }
37453/// ```
37454pub struct AdvertiserBulkListAdvertiserAssignedTargetingOptionCall<'a, C>
37455where
37456    C: 'a,
37457{
37458    hub: &'a DisplayVideo<C>,
37459    _advertiser_id: i64,
37460    _page_token: Option<String>,
37461    _page_size: Option<i32>,
37462    _order_by: Option<String>,
37463    _filter: Option<String>,
37464    _delegate: Option<&'a mut dyn common::Delegate>,
37465    _additional_params: HashMap<String, String>,
37466    _scopes: BTreeSet<String>,
37467}
37468
37469impl<'a, C> common::CallBuilder for AdvertiserBulkListAdvertiserAssignedTargetingOptionCall<'a, C> {}
37470
37471impl<'a, C> AdvertiserBulkListAdvertiserAssignedTargetingOptionCall<'a, C>
37472where
37473    C: common::Connector,
37474{
37475    /// Perform the operation you have build so far.
37476    pub async fn doit(
37477        mut self,
37478    ) -> common::Result<(
37479        common::Response,
37480        BulkListAdvertiserAssignedTargetingOptionsResponse,
37481    )> {
37482        use std::borrow::Cow;
37483        use std::io::{Read, Seek};
37484
37485        use common::{url::Params, ToParts};
37486        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37487
37488        let mut dd = common::DefaultDelegate;
37489        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37490        dlg.begin(common::MethodInfo {
37491            id: "displayvideo.advertisers.bulkListAdvertiserAssignedTargetingOptions",
37492            http_method: hyper::Method::GET,
37493        });
37494
37495        for &field in [
37496            "alt",
37497            "advertiserId",
37498            "pageToken",
37499            "pageSize",
37500            "orderBy",
37501            "filter",
37502        ]
37503        .iter()
37504        {
37505            if self._additional_params.contains_key(field) {
37506                dlg.finished(false);
37507                return Err(common::Error::FieldClash(field));
37508            }
37509        }
37510
37511        let mut params = Params::with_capacity(7 + self._additional_params.len());
37512        params.push("advertiserId", self._advertiser_id.to_string());
37513        if let Some(value) = self._page_token.as_ref() {
37514            params.push("pageToken", value);
37515        }
37516        if let Some(value) = self._page_size.as_ref() {
37517            params.push("pageSize", value.to_string());
37518        }
37519        if let Some(value) = self._order_by.as_ref() {
37520            params.push("orderBy", value);
37521        }
37522        if let Some(value) = self._filter.as_ref() {
37523            params.push("filter", value);
37524        }
37525
37526        params.extend(self._additional_params.iter());
37527
37528        params.push("alt", "json");
37529        let mut url = self.hub._base_url.clone()
37530            + "v1/advertisers/{+advertiserId}:bulkListAdvertiserAssignedTargetingOptions";
37531        if self._scopes.is_empty() {
37532            self._scopes
37533                .insert(Scope::DisplayVideo.as_ref().to_string());
37534        }
37535
37536        #[allow(clippy::single_element_loop)]
37537        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
37538            url = params.uri_replacement(url, param_name, find_this, true);
37539        }
37540        {
37541            let to_remove = ["advertiserId"];
37542            params.remove_params(&to_remove);
37543        }
37544
37545        let url = params.parse_with_url(&url);
37546
37547        loop {
37548            let token = match self
37549                .hub
37550                .auth
37551                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37552                .await
37553            {
37554                Ok(token) => token,
37555                Err(e) => match dlg.token(e) {
37556                    Ok(token) => token,
37557                    Err(e) => {
37558                        dlg.finished(false);
37559                        return Err(common::Error::MissingToken(e));
37560                    }
37561                },
37562            };
37563            let mut req_result = {
37564                let client = &self.hub.client;
37565                dlg.pre_request();
37566                let mut req_builder = hyper::Request::builder()
37567                    .method(hyper::Method::GET)
37568                    .uri(url.as_str())
37569                    .header(USER_AGENT, self.hub._user_agent.clone());
37570
37571                if let Some(token) = token.as_ref() {
37572                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37573                }
37574
37575                let request = req_builder
37576                    .header(CONTENT_LENGTH, 0_u64)
37577                    .body(common::to_body::<String>(None));
37578
37579                client.request(request.unwrap()).await
37580            };
37581
37582            match req_result {
37583                Err(err) => {
37584                    if let common::Retry::After(d) = dlg.http_error(&err) {
37585                        sleep(d).await;
37586                        continue;
37587                    }
37588                    dlg.finished(false);
37589                    return Err(common::Error::HttpError(err));
37590                }
37591                Ok(res) => {
37592                    let (mut parts, body) = res.into_parts();
37593                    let mut body = common::Body::new(body);
37594                    if !parts.status.is_success() {
37595                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37596                        let error = serde_json::from_str(&common::to_string(&bytes));
37597                        let response = common::to_response(parts, bytes.into());
37598
37599                        if let common::Retry::After(d) =
37600                            dlg.http_failure(&response, error.as_ref().ok())
37601                        {
37602                            sleep(d).await;
37603                            continue;
37604                        }
37605
37606                        dlg.finished(false);
37607
37608                        return Err(match error {
37609                            Ok(value) => common::Error::BadRequest(value),
37610                            _ => common::Error::Failure(response),
37611                        });
37612                    }
37613                    let response = {
37614                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37615                        let encoded = common::to_string(&bytes);
37616                        match serde_json::from_str(&encoded) {
37617                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37618                            Err(error) => {
37619                                dlg.response_json_decode_error(&encoded, &error);
37620                                return Err(common::Error::JsonDecodeError(
37621                                    encoded.to_string(),
37622                                    error,
37623                                ));
37624                            }
37625                        }
37626                    };
37627
37628                    dlg.finished(true);
37629                    return Ok(response);
37630                }
37631            }
37632        }
37633    }
37634
37635    /// Required. The ID of the advertiser the line item belongs to.
37636    ///
37637    /// Sets the *advertiser id* path property to the given value.
37638    ///
37639    /// Even though the property as already been set when instantiating this call,
37640    /// we provide this method for API completeness.
37641    pub fn advertiser_id(
37642        mut self,
37643        new_value: i64,
37644    ) -> AdvertiserBulkListAdvertiserAssignedTargetingOptionCall<'a, C> {
37645        self._advertiser_id = new_value;
37646        self
37647    }
37648    /// A token that lets the client fetch the next page of results. Typically, this is the value of next_page_token returned from the previous call to `BulkListAdvertiserAssignedTargetingOptions` method. If not specified, the first page of results will be returned.
37649    ///
37650    /// Sets the *page token* query property to the given value.
37651    pub fn page_token(
37652        mut self,
37653        new_value: &str,
37654    ) -> AdvertiserBulkListAdvertiserAssignedTargetingOptionCall<'a, C> {
37655        self._page_token = Some(new_value.to_string());
37656        self
37657    }
37658    /// Requested page size. The size must be an integer between `1` and `5000`. If unspecified, the default is '5000'. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
37659    ///
37660    /// Sets the *page size* query property to the given value.
37661    pub fn page_size(
37662        mut self,
37663        new_value: i32,
37664    ) -> AdvertiserBulkListAdvertiserAssignedTargetingOptionCall<'a, C> {
37665        self._page_size = Some(new_value);
37666        self
37667    }
37668    /// Field by which to sort the list. Acceptable values are: * `targetingType` (default) The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `targetingType desc`.
37669    ///
37670    /// Sets the *order by* query property to the given value.
37671    pub fn order_by(
37672        mut self,
37673        new_value: &str,
37674    ) -> AdvertiserBulkListAdvertiserAssignedTargetingOptionCall<'a, C> {
37675        self._order_by = Some(new_value.to_string());
37676        self
37677    }
37678    /// Allows filtering by assigned targeting option fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by the `OR` logical operator. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `EQUALS (=) operator`. Supported fields: * `targetingType` Examples: * targetingType with value TARGETING_TYPE_CHANNEL `targetingType="TARGETING_TYPE_CHANNEL"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
37679    ///
37680    /// Sets the *filter* query property to the given value.
37681    pub fn filter(
37682        mut self,
37683        new_value: &str,
37684    ) -> AdvertiserBulkListAdvertiserAssignedTargetingOptionCall<'a, C> {
37685        self._filter = Some(new_value.to_string());
37686        self
37687    }
37688    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37689    /// while executing the actual API request.
37690    ///
37691    /// ````text
37692    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
37693    /// ````
37694    ///
37695    /// Sets the *delegate* property to the given value.
37696    pub fn delegate(
37697        mut self,
37698        new_value: &'a mut dyn common::Delegate,
37699    ) -> AdvertiserBulkListAdvertiserAssignedTargetingOptionCall<'a, C> {
37700        self._delegate = Some(new_value);
37701        self
37702    }
37703
37704    /// Set any additional parameter of the query string used in the request.
37705    /// It should be used to set parameters which are not yet available through their own
37706    /// setters.
37707    ///
37708    /// Please note that this method must not be used to set any of the known parameters
37709    /// which have their own setter method. If done anyway, the request will fail.
37710    ///
37711    /// # Additional Parameters
37712    ///
37713    /// * *$.xgafv* (query-string) - V1 error format.
37714    /// * *access_token* (query-string) - OAuth access token.
37715    /// * *alt* (query-string) - Data format for response.
37716    /// * *callback* (query-string) - JSONP
37717    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37718    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
37719    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37720    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37721    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
37722    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37723    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37724    pub fn param<T>(
37725        mut self,
37726        name: T,
37727        value: T,
37728    ) -> AdvertiserBulkListAdvertiserAssignedTargetingOptionCall<'a, C>
37729    where
37730        T: AsRef<str>,
37731    {
37732        self._additional_params
37733            .insert(name.as_ref().to_string(), value.as_ref().to_string());
37734        self
37735    }
37736
37737    /// Identifies the authorization scope for the method you are building.
37738    ///
37739    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37740    /// [`Scope::DisplayVideo`].
37741    ///
37742    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37743    /// tokens for more than one scope.
37744    ///
37745    /// Usually there is more than one suitable scope to authorize an operation, some of which may
37746    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37747    /// sufficient, a read-write scope will do as well.
37748    pub fn add_scope<St>(
37749        mut self,
37750        scope: St,
37751    ) -> AdvertiserBulkListAdvertiserAssignedTargetingOptionCall<'a, C>
37752    where
37753        St: AsRef<str>,
37754    {
37755        self._scopes.insert(String::from(scope.as_ref()));
37756        self
37757    }
37758    /// Identifies the authorization scope(s) for the method you are building.
37759    ///
37760    /// See [`Self::add_scope()`] for details.
37761    pub fn add_scopes<I, St>(
37762        mut self,
37763        scopes: I,
37764    ) -> AdvertiserBulkListAdvertiserAssignedTargetingOptionCall<'a, C>
37765    where
37766        I: IntoIterator<Item = St>,
37767        St: AsRef<str>,
37768    {
37769        self._scopes
37770            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37771        self
37772    }
37773
37774    /// Removes all scopes, and no default scope will be used either.
37775    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37776    /// for details).
37777    pub fn clear_scopes(
37778        mut self,
37779    ) -> AdvertiserBulkListAdvertiserAssignedTargetingOptionCall<'a, C> {
37780        self._scopes.clear();
37781        self
37782    }
37783}
37784
37785/// Creates a new advertiser. Returns the newly created advertiser if successful. **This method regularly experiences high latency.** We recommend [increasing your default timeout](https://developers.google.com/display-video/api/guides/best-practices/timeouts#client_library_timeout) to avoid errors.
37786///
37787/// A builder for the *create* method supported by a *advertiser* resource.
37788/// It is not used directly, but through a [`AdvertiserMethods`] instance.
37789///
37790/// # Example
37791///
37792/// Instantiate a resource method builder
37793///
37794/// ```test_harness,no_run
37795/// # extern crate hyper;
37796/// # extern crate hyper_rustls;
37797/// # extern crate google_displayvideo1 as displayvideo1;
37798/// use displayvideo1::api::Advertiser;
37799/// # async fn dox() {
37800/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37801///
37802/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37803/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
37804/// #     secret,
37805/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37806/// # ).build().await.unwrap();
37807///
37808/// # let client = hyper_util::client::legacy::Client::builder(
37809/// #     hyper_util::rt::TokioExecutor::new()
37810/// # )
37811/// # .build(
37812/// #     hyper_rustls::HttpsConnectorBuilder::new()
37813/// #         .with_native_roots()
37814/// #         .unwrap()
37815/// #         .https_or_http()
37816/// #         .enable_http1()
37817/// #         .build()
37818/// # );
37819/// # let mut hub = DisplayVideo::new(client, auth);
37820/// // As the method needs a request, you would usually fill it with the desired information
37821/// // into the respective structure. Some of the parts shown here might not be applicable !
37822/// // Values shown here are possibly random and not representative !
37823/// let mut req = Advertiser::default();
37824///
37825/// // You can configure optional parameters by calling the respective setters at will, and
37826/// // execute the final call using `doit()`.
37827/// // Values shown here are possibly random and not representative !
37828/// let result = hub.advertisers().create(req)
37829///              .doit().await;
37830/// # }
37831/// ```
37832pub struct AdvertiserCreateCall<'a, C>
37833where
37834    C: 'a,
37835{
37836    hub: &'a DisplayVideo<C>,
37837    _request: Advertiser,
37838    _delegate: Option<&'a mut dyn common::Delegate>,
37839    _additional_params: HashMap<String, String>,
37840    _scopes: BTreeSet<String>,
37841}
37842
37843impl<'a, C> common::CallBuilder for AdvertiserCreateCall<'a, C> {}
37844
37845impl<'a, C> AdvertiserCreateCall<'a, C>
37846where
37847    C: common::Connector,
37848{
37849    /// Perform the operation you have build so far.
37850    pub async fn doit(mut self) -> common::Result<(common::Response, Advertiser)> {
37851        use std::borrow::Cow;
37852        use std::io::{Read, Seek};
37853
37854        use common::{url::Params, ToParts};
37855        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37856
37857        let mut dd = common::DefaultDelegate;
37858        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37859        dlg.begin(common::MethodInfo {
37860            id: "displayvideo.advertisers.create",
37861            http_method: hyper::Method::POST,
37862        });
37863
37864        for &field in ["alt"].iter() {
37865            if self._additional_params.contains_key(field) {
37866                dlg.finished(false);
37867                return Err(common::Error::FieldClash(field));
37868            }
37869        }
37870
37871        let mut params = Params::with_capacity(3 + self._additional_params.len());
37872
37873        params.extend(self._additional_params.iter());
37874
37875        params.push("alt", "json");
37876        let mut url = self.hub._base_url.clone() + "v1/advertisers";
37877        if self._scopes.is_empty() {
37878            self._scopes
37879                .insert(Scope::DisplayVideo.as_ref().to_string());
37880        }
37881
37882        let url = params.parse_with_url(&url);
37883
37884        let mut json_mime_type = mime::APPLICATION_JSON;
37885        let mut request_value_reader = {
37886            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
37887            common::remove_json_null_values(&mut value);
37888            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
37889            serde_json::to_writer(&mut dst, &value).unwrap();
37890            dst
37891        };
37892        let request_size = request_value_reader
37893            .seek(std::io::SeekFrom::End(0))
37894            .unwrap();
37895        request_value_reader
37896            .seek(std::io::SeekFrom::Start(0))
37897            .unwrap();
37898
37899        loop {
37900            let token = match self
37901                .hub
37902                .auth
37903                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37904                .await
37905            {
37906                Ok(token) => token,
37907                Err(e) => match dlg.token(e) {
37908                    Ok(token) => token,
37909                    Err(e) => {
37910                        dlg.finished(false);
37911                        return Err(common::Error::MissingToken(e));
37912                    }
37913                },
37914            };
37915            request_value_reader
37916                .seek(std::io::SeekFrom::Start(0))
37917                .unwrap();
37918            let mut req_result = {
37919                let client = &self.hub.client;
37920                dlg.pre_request();
37921                let mut req_builder = hyper::Request::builder()
37922                    .method(hyper::Method::POST)
37923                    .uri(url.as_str())
37924                    .header(USER_AGENT, self.hub._user_agent.clone());
37925
37926                if let Some(token) = token.as_ref() {
37927                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37928                }
37929
37930                let request = req_builder
37931                    .header(CONTENT_TYPE, json_mime_type.to_string())
37932                    .header(CONTENT_LENGTH, request_size as u64)
37933                    .body(common::to_body(
37934                        request_value_reader.get_ref().clone().into(),
37935                    ));
37936
37937                client.request(request.unwrap()).await
37938            };
37939
37940            match req_result {
37941                Err(err) => {
37942                    if let common::Retry::After(d) = dlg.http_error(&err) {
37943                        sleep(d).await;
37944                        continue;
37945                    }
37946                    dlg.finished(false);
37947                    return Err(common::Error::HttpError(err));
37948                }
37949                Ok(res) => {
37950                    let (mut parts, body) = res.into_parts();
37951                    let mut body = common::Body::new(body);
37952                    if !parts.status.is_success() {
37953                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37954                        let error = serde_json::from_str(&common::to_string(&bytes));
37955                        let response = common::to_response(parts, bytes.into());
37956
37957                        if let common::Retry::After(d) =
37958                            dlg.http_failure(&response, error.as_ref().ok())
37959                        {
37960                            sleep(d).await;
37961                            continue;
37962                        }
37963
37964                        dlg.finished(false);
37965
37966                        return Err(match error {
37967                            Ok(value) => common::Error::BadRequest(value),
37968                            _ => common::Error::Failure(response),
37969                        });
37970                    }
37971                    let response = {
37972                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37973                        let encoded = common::to_string(&bytes);
37974                        match serde_json::from_str(&encoded) {
37975                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37976                            Err(error) => {
37977                                dlg.response_json_decode_error(&encoded, &error);
37978                                return Err(common::Error::JsonDecodeError(
37979                                    encoded.to_string(),
37980                                    error,
37981                                ));
37982                            }
37983                        }
37984                    };
37985
37986                    dlg.finished(true);
37987                    return Ok(response);
37988                }
37989            }
37990        }
37991    }
37992
37993    ///
37994    /// Sets the *request* property to the given value.
37995    ///
37996    /// Even though the property as already been set when instantiating this call,
37997    /// we provide this method for API completeness.
37998    pub fn request(mut self, new_value: Advertiser) -> AdvertiserCreateCall<'a, C> {
37999        self._request = new_value;
38000        self
38001    }
38002    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38003    /// while executing the actual API request.
38004    ///
38005    /// ````text
38006    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
38007    /// ````
38008    ///
38009    /// Sets the *delegate* property to the given value.
38010    pub fn delegate(
38011        mut self,
38012        new_value: &'a mut dyn common::Delegate,
38013    ) -> AdvertiserCreateCall<'a, C> {
38014        self._delegate = Some(new_value);
38015        self
38016    }
38017
38018    /// Set any additional parameter of the query string used in the request.
38019    /// It should be used to set parameters which are not yet available through their own
38020    /// setters.
38021    ///
38022    /// Please note that this method must not be used to set any of the known parameters
38023    /// which have their own setter method. If done anyway, the request will fail.
38024    ///
38025    /// # Additional Parameters
38026    ///
38027    /// * *$.xgafv* (query-string) - V1 error format.
38028    /// * *access_token* (query-string) - OAuth access token.
38029    /// * *alt* (query-string) - Data format for response.
38030    /// * *callback* (query-string) - JSONP
38031    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38032    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
38033    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38034    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38035    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
38036    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38037    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38038    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserCreateCall<'a, C>
38039    where
38040        T: AsRef<str>,
38041    {
38042        self._additional_params
38043            .insert(name.as_ref().to_string(), value.as_ref().to_string());
38044        self
38045    }
38046
38047    /// Identifies the authorization scope for the method you are building.
38048    ///
38049    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38050    /// [`Scope::DisplayVideo`].
38051    ///
38052    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38053    /// tokens for more than one scope.
38054    ///
38055    /// Usually there is more than one suitable scope to authorize an operation, some of which may
38056    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38057    /// sufficient, a read-write scope will do as well.
38058    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserCreateCall<'a, C>
38059    where
38060        St: AsRef<str>,
38061    {
38062        self._scopes.insert(String::from(scope.as_ref()));
38063        self
38064    }
38065    /// Identifies the authorization scope(s) for the method you are building.
38066    ///
38067    /// See [`Self::add_scope()`] for details.
38068    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserCreateCall<'a, C>
38069    where
38070        I: IntoIterator<Item = St>,
38071        St: AsRef<str>,
38072    {
38073        self._scopes
38074            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38075        self
38076    }
38077
38078    /// Removes all scopes, and no default scope will be used either.
38079    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38080    /// for details).
38081    pub fn clear_scopes(mut self) -> AdvertiserCreateCall<'a, C> {
38082        self._scopes.clear();
38083        self
38084    }
38085}
38086
38087/// Deletes an advertiser. Deleting an advertiser will delete all of its child resources, for example, campaigns, insertion orders and line items. A deleted advertiser cannot be recovered.
38088///
38089/// A builder for the *delete* method supported by a *advertiser* resource.
38090/// It is not used directly, but through a [`AdvertiserMethods`] instance.
38091///
38092/// # Example
38093///
38094/// Instantiate a resource method builder
38095///
38096/// ```test_harness,no_run
38097/// # extern crate hyper;
38098/// # extern crate hyper_rustls;
38099/// # extern crate google_displayvideo1 as displayvideo1;
38100/// # async fn dox() {
38101/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
38102///
38103/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
38104/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
38105/// #     secret,
38106/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
38107/// # ).build().await.unwrap();
38108///
38109/// # let client = hyper_util::client::legacy::Client::builder(
38110/// #     hyper_util::rt::TokioExecutor::new()
38111/// # )
38112/// # .build(
38113/// #     hyper_rustls::HttpsConnectorBuilder::new()
38114/// #         .with_native_roots()
38115/// #         .unwrap()
38116/// #         .https_or_http()
38117/// #         .enable_http1()
38118/// #         .build()
38119/// # );
38120/// # let mut hub = DisplayVideo::new(client, auth);
38121/// // You can configure optional parameters by calling the respective setters at will, and
38122/// // execute the final call using `doit()`.
38123/// // Values shown here are possibly random and not representative !
38124/// let result = hub.advertisers().delete(-38)
38125///              .doit().await;
38126/// # }
38127/// ```
38128pub struct AdvertiserDeleteCall<'a, C>
38129where
38130    C: 'a,
38131{
38132    hub: &'a DisplayVideo<C>,
38133    _advertiser_id: i64,
38134    _delegate: Option<&'a mut dyn common::Delegate>,
38135    _additional_params: HashMap<String, String>,
38136    _scopes: BTreeSet<String>,
38137}
38138
38139impl<'a, C> common::CallBuilder for AdvertiserDeleteCall<'a, C> {}
38140
38141impl<'a, C> AdvertiserDeleteCall<'a, C>
38142where
38143    C: common::Connector,
38144{
38145    /// Perform the operation you have build so far.
38146    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
38147        use std::borrow::Cow;
38148        use std::io::{Read, Seek};
38149
38150        use common::{url::Params, ToParts};
38151        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
38152
38153        let mut dd = common::DefaultDelegate;
38154        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
38155        dlg.begin(common::MethodInfo {
38156            id: "displayvideo.advertisers.delete",
38157            http_method: hyper::Method::DELETE,
38158        });
38159
38160        for &field in ["alt", "advertiserId"].iter() {
38161            if self._additional_params.contains_key(field) {
38162                dlg.finished(false);
38163                return Err(common::Error::FieldClash(field));
38164            }
38165        }
38166
38167        let mut params = Params::with_capacity(3 + self._additional_params.len());
38168        params.push("advertiserId", self._advertiser_id.to_string());
38169
38170        params.extend(self._additional_params.iter());
38171
38172        params.push("alt", "json");
38173        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}";
38174        if self._scopes.is_empty() {
38175            self._scopes
38176                .insert(Scope::DisplayVideo.as_ref().to_string());
38177        }
38178
38179        #[allow(clippy::single_element_loop)]
38180        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
38181            url = params.uri_replacement(url, param_name, find_this, true);
38182        }
38183        {
38184            let to_remove = ["advertiserId"];
38185            params.remove_params(&to_remove);
38186        }
38187
38188        let url = params.parse_with_url(&url);
38189
38190        loop {
38191            let token = match self
38192                .hub
38193                .auth
38194                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
38195                .await
38196            {
38197                Ok(token) => token,
38198                Err(e) => match dlg.token(e) {
38199                    Ok(token) => token,
38200                    Err(e) => {
38201                        dlg.finished(false);
38202                        return Err(common::Error::MissingToken(e));
38203                    }
38204                },
38205            };
38206            let mut req_result = {
38207                let client = &self.hub.client;
38208                dlg.pre_request();
38209                let mut req_builder = hyper::Request::builder()
38210                    .method(hyper::Method::DELETE)
38211                    .uri(url.as_str())
38212                    .header(USER_AGENT, self.hub._user_agent.clone());
38213
38214                if let Some(token) = token.as_ref() {
38215                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
38216                }
38217
38218                let request = req_builder
38219                    .header(CONTENT_LENGTH, 0_u64)
38220                    .body(common::to_body::<String>(None));
38221
38222                client.request(request.unwrap()).await
38223            };
38224
38225            match req_result {
38226                Err(err) => {
38227                    if let common::Retry::After(d) = dlg.http_error(&err) {
38228                        sleep(d).await;
38229                        continue;
38230                    }
38231                    dlg.finished(false);
38232                    return Err(common::Error::HttpError(err));
38233                }
38234                Ok(res) => {
38235                    let (mut parts, body) = res.into_parts();
38236                    let mut body = common::Body::new(body);
38237                    if !parts.status.is_success() {
38238                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38239                        let error = serde_json::from_str(&common::to_string(&bytes));
38240                        let response = common::to_response(parts, bytes.into());
38241
38242                        if let common::Retry::After(d) =
38243                            dlg.http_failure(&response, error.as_ref().ok())
38244                        {
38245                            sleep(d).await;
38246                            continue;
38247                        }
38248
38249                        dlg.finished(false);
38250
38251                        return Err(match error {
38252                            Ok(value) => common::Error::BadRequest(value),
38253                            _ => common::Error::Failure(response),
38254                        });
38255                    }
38256                    let response = {
38257                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38258                        let encoded = common::to_string(&bytes);
38259                        match serde_json::from_str(&encoded) {
38260                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
38261                            Err(error) => {
38262                                dlg.response_json_decode_error(&encoded, &error);
38263                                return Err(common::Error::JsonDecodeError(
38264                                    encoded.to_string(),
38265                                    error,
38266                                ));
38267                            }
38268                        }
38269                    };
38270
38271                    dlg.finished(true);
38272                    return Ok(response);
38273                }
38274            }
38275        }
38276    }
38277
38278    /// The ID of the advertiser we need to delete.
38279    ///
38280    /// Sets the *advertiser id* path property to the given value.
38281    ///
38282    /// Even though the property as already been set when instantiating this call,
38283    /// we provide this method for API completeness.
38284    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserDeleteCall<'a, C> {
38285        self._advertiser_id = new_value;
38286        self
38287    }
38288    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38289    /// while executing the actual API request.
38290    ///
38291    /// ````text
38292    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
38293    /// ````
38294    ///
38295    /// Sets the *delegate* property to the given value.
38296    pub fn delegate(
38297        mut self,
38298        new_value: &'a mut dyn common::Delegate,
38299    ) -> AdvertiserDeleteCall<'a, C> {
38300        self._delegate = Some(new_value);
38301        self
38302    }
38303
38304    /// Set any additional parameter of the query string used in the request.
38305    /// It should be used to set parameters which are not yet available through their own
38306    /// setters.
38307    ///
38308    /// Please note that this method must not be used to set any of the known parameters
38309    /// which have their own setter method. If done anyway, the request will fail.
38310    ///
38311    /// # Additional Parameters
38312    ///
38313    /// * *$.xgafv* (query-string) - V1 error format.
38314    /// * *access_token* (query-string) - OAuth access token.
38315    /// * *alt* (query-string) - Data format for response.
38316    /// * *callback* (query-string) - JSONP
38317    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38318    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
38319    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38320    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38321    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
38322    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38323    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38324    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserDeleteCall<'a, C>
38325    where
38326        T: AsRef<str>,
38327    {
38328        self._additional_params
38329            .insert(name.as_ref().to_string(), value.as_ref().to_string());
38330        self
38331    }
38332
38333    /// Identifies the authorization scope for the method you are building.
38334    ///
38335    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38336    /// [`Scope::DisplayVideo`].
38337    ///
38338    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38339    /// tokens for more than one scope.
38340    ///
38341    /// Usually there is more than one suitable scope to authorize an operation, some of which may
38342    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38343    /// sufficient, a read-write scope will do as well.
38344    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserDeleteCall<'a, C>
38345    where
38346        St: AsRef<str>,
38347    {
38348        self._scopes.insert(String::from(scope.as_ref()));
38349        self
38350    }
38351    /// Identifies the authorization scope(s) for the method you are building.
38352    ///
38353    /// See [`Self::add_scope()`] for details.
38354    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserDeleteCall<'a, C>
38355    where
38356        I: IntoIterator<Item = St>,
38357        St: AsRef<str>,
38358    {
38359        self._scopes
38360            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38361        self
38362    }
38363
38364    /// Removes all scopes, and no default scope will be used either.
38365    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38366    /// for details).
38367    pub fn clear_scopes(mut self) -> AdvertiserDeleteCall<'a, C> {
38368        self._scopes.clear();
38369        self
38370    }
38371}
38372
38373/// Gets an advertiser.
38374///
38375/// A builder for the *get* method supported by a *advertiser* resource.
38376/// It is not used directly, but through a [`AdvertiserMethods`] instance.
38377///
38378/// # Example
38379///
38380/// Instantiate a resource method builder
38381///
38382/// ```test_harness,no_run
38383/// # extern crate hyper;
38384/// # extern crate hyper_rustls;
38385/// # extern crate google_displayvideo1 as displayvideo1;
38386/// # async fn dox() {
38387/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
38388///
38389/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
38390/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
38391/// #     secret,
38392/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
38393/// # ).build().await.unwrap();
38394///
38395/// # let client = hyper_util::client::legacy::Client::builder(
38396/// #     hyper_util::rt::TokioExecutor::new()
38397/// # )
38398/// # .build(
38399/// #     hyper_rustls::HttpsConnectorBuilder::new()
38400/// #         .with_native_roots()
38401/// #         .unwrap()
38402/// #         .https_or_http()
38403/// #         .enable_http1()
38404/// #         .build()
38405/// # );
38406/// # let mut hub = DisplayVideo::new(client, auth);
38407/// // You can configure optional parameters by calling the respective setters at will, and
38408/// // execute the final call using `doit()`.
38409/// // Values shown here are possibly random and not representative !
38410/// let result = hub.advertisers().get(-64)
38411///              .doit().await;
38412/// # }
38413/// ```
38414pub struct AdvertiserGetCall<'a, C>
38415where
38416    C: 'a,
38417{
38418    hub: &'a DisplayVideo<C>,
38419    _advertiser_id: i64,
38420    _delegate: Option<&'a mut dyn common::Delegate>,
38421    _additional_params: HashMap<String, String>,
38422    _scopes: BTreeSet<String>,
38423}
38424
38425impl<'a, C> common::CallBuilder for AdvertiserGetCall<'a, C> {}
38426
38427impl<'a, C> AdvertiserGetCall<'a, C>
38428where
38429    C: common::Connector,
38430{
38431    /// Perform the operation you have build so far.
38432    pub async fn doit(mut self) -> common::Result<(common::Response, Advertiser)> {
38433        use std::borrow::Cow;
38434        use std::io::{Read, Seek};
38435
38436        use common::{url::Params, ToParts};
38437        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
38438
38439        let mut dd = common::DefaultDelegate;
38440        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
38441        dlg.begin(common::MethodInfo {
38442            id: "displayvideo.advertisers.get",
38443            http_method: hyper::Method::GET,
38444        });
38445
38446        for &field in ["alt", "advertiserId"].iter() {
38447            if self._additional_params.contains_key(field) {
38448                dlg.finished(false);
38449                return Err(common::Error::FieldClash(field));
38450            }
38451        }
38452
38453        let mut params = Params::with_capacity(3 + self._additional_params.len());
38454        params.push("advertiserId", self._advertiser_id.to_string());
38455
38456        params.extend(self._additional_params.iter());
38457
38458        params.push("alt", "json");
38459        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}";
38460        if self._scopes.is_empty() {
38461            self._scopes
38462                .insert(Scope::DisplayVideo.as_ref().to_string());
38463        }
38464
38465        #[allow(clippy::single_element_loop)]
38466        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
38467            url = params.uri_replacement(url, param_name, find_this, true);
38468        }
38469        {
38470            let to_remove = ["advertiserId"];
38471            params.remove_params(&to_remove);
38472        }
38473
38474        let url = params.parse_with_url(&url);
38475
38476        loop {
38477            let token = match self
38478                .hub
38479                .auth
38480                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
38481                .await
38482            {
38483                Ok(token) => token,
38484                Err(e) => match dlg.token(e) {
38485                    Ok(token) => token,
38486                    Err(e) => {
38487                        dlg.finished(false);
38488                        return Err(common::Error::MissingToken(e));
38489                    }
38490                },
38491            };
38492            let mut req_result = {
38493                let client = &self.hub.client;
38494                dlg.pre_request();
38495                let mut req_builder = hyper::Request::builder()
38496                    .method(hyper::Method::GET)
38497                    .uri(url.as_str())
38498                    .header(USER_AGENT, self.hub._user_agent.clone());
38499
38500                if let Some(token) = token.as_ref() {
38501                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
38502                }
38503
38504                let request = req_builder
38505                    .header(CONTENT_LENGTH, 0_u64)
38506                    .body(common::to_body::<String>(None));
38507
38508                client.request(request.unwrap()).await
38509            };
38510
38511            match req_result {
38512                Err(err) => {
38513                    if let common::Retry::After(d) = dlg.http_error(&err) {
38514                        sleep(d).await;
38515                        continue;
38516                    }
38517                    dlg.finished(false);
38518                    return Err(common::Error::HttpError(err));
38519                }
38520                Ok(res) => {
38521                    let (mut parts, body) = res.into_parts();
38522                    let mut body = common::Body::new(body);
38523                    if !parts.status.is_success() {
38524                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38525                        let error = serde_json::from_str(&common::to_string(&bytes));
38526                        let response = common::to_response(parts, bytes.into());
38527
38528                        if let common::Retry::After(d) =
38529                            dlg.http_failure(&response, error.as_ref().ok())
38530                        {
38531                            sleep(d).await;
38532                            continue;
38533                        }
38534
38535                        dlg.finished(false);
38536
38537                        return Err(match error {
38538                            Ok(value) => common::Error::BadRequest(value),
38539                            _ => common::Error::Failure(response),
38540                        });
38541                    }
38542                    let response = {
38543                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38544                        let encoded = common::to_string(&bytes);
38545                        match serde_json::from_str(&encoded) {
38546                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
38547                            Err(error) => {
38548                                dlg.response_json_decode_error(&encoded, &error);
38549                                return Err(common::Error::JsonDecodeError(
38550                                    encoded.to_string(),
38551                                    error,
38552                                ));
38553                            }
38554                        }
38555                    };
38556
38557                    dlg.finished(true);
38558                    return Ok(response);
38559                }
38560            }
38561        }
38562    }
38563
38564    /// Required. The ID of the advertiser to fetch.
38565    ///
38566    /// Sets the *advertiser id* path property to the given value.
38567    ///
38568    /// Even though the property as already been set when instantiating this call,
38569    /// we provide this method for API completeness.
38570    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserGetCall<'a, C> {
38571        self._advertiser_id = new_value;
38572        self
38573    }
38574    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38575    /// while executing the actual API request.
38576    ///
38577    /// ````text
38578    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
38579    /// ````
38580    ///
38581    /// Sets the *delegate* property to the given value.
38582    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AdvertiserGetCall<'a, C> {
38583        self._delegate = Some(new_value);
38584        self
38585    }
38586
38587    /// Set any additional parameter of the query string used in the request.
38588    /// It should be used to set parameters which are not yet available through their own
38589    /// setters.
38590    ///
38591    /// Please note that this method must not be used to set any of the known parameters
38592    /// which have their own setter method. If done anyway, the request will fail.
38593    ///
38594    /// # Additional Parameters
38595    ///
38596    /// * *$.xgafv* (query-string) - V1 error format.
38597    /// * *access_token* (query-string) - OAuth access token.
38598    /// * *alt* (query-string) - Data format for response.
38599    /// * *callback* (query-string) - JSONP
38600    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38601    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
38602    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38603    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38604    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
38605    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38606    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38607    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserGetCall<'a, C>
38608    where
38609        T: AsRef<str>,
38610    {
38611        self._additional_params
38612            .insert(name.as_ref().to_string(), value.as_ref().to_string());
38613        self
38614    }
38615
38616    /// Identifies the authorization scope for the method you are building.
38617    ///
38618    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38619    /// [`Scope::DisplayVideo`].
38620    ///
38621    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38622    /// tokens for more than one scope.
38623    ///
38624    /// Usually there is more than one suitable scope to authorize an operation, some of which may
38625    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38626    /// sufficient, a read-write scope will do as well.
38627    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserGetCall<'a, C>
38628    where
38629        St: AsRef<str>,
38630    {
38631        self._scopes.insert(String::from(scope.as_ref()));
38632        self
38633    }
38634    /// Identifies the authorization scope(s) for the method you are building.
38635    ///
38636    /// See [`Self::add_scope()`] for details.
38637    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserGetCall<'a, C>
38638    where
38639        I: IntoIterator<Item = St>,
38640        St: AsRef<str>,
38641    {
38642        self._scopes
38643            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38644        self
38645    }
38646
38647    /// Removes all scopes, and no default scope will be used either.
38648    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38649    /// for details).
38650    pub fn clear_scopes(mut self) -> AdvertiserGetCall<'a, C> {
38651        self._scopes.clear();
38652        self
38653    }
38654}
38655
38656/// Lists advertisers that are accessible to the current user. The order is defined by the order_by parameter. A single partner_id is required. Cross-partner listing is not supported.
38657///
38658/// A builder for the *list* method supported by a *advertiser* resource.
38659/// It is not used directly, but through a [`AdvertiserMethods`] instance.
38660///
38661/// # Example
38662///
38663/// Instantiate a resource method builder
38664///
38665/// ```test_harness,no_run
38666/// # extern crate hyper;
38667/// # extern crate hyper_rustls;
38668/// # extern crate google_displayvideo1 as displayvideo1;
38669/// # async fn dox() {
38670/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
38671///
38672/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
38673/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
38674/// #     secret,
38675/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
38676/// # ).build().await.unwrap();
38677///
38678/// # let client = hyper_util::client::legacy::Client::builder(
38679/// #     hyper_util::rt::TokioExecutor::new()
38680/// # )
38681/// # .build(
38682/// #     hyper_rustls::HttpsConnectorBuilder::new()
38683/// #         .with_native_roots()
38684/// #         .unwrap()
38685/// #         .https_or_http()
38686/// #         .enable_http1()
38687/// #         .build()
38688/// # );
38689/// # let mut hub = DisplayVideo::new(client, auth);
38690/// // You can configure optional parameters by calling the respective setters at will, and
38691/// // execute the final call using `doit()`.
38692/// // Values shown here are possibly random and not representative !
38693/// let result = hub.advertisers().list()
38694///              .partner_id(-99)
38695///              .page_token("aliquyam")
38696///              .page_size(-83)
38697///              .order_by("diam")
38698///              .filter("nonumy")
38699///              .doit().await;
38700/// # }
38701/// ```
38702pub struct AdvertiserListCall<'a, C>
38703where
38704    C: 'a,
38705{
38706    hub: &'a DisplayVideo<C>,
38707    _partner_id: Option<i64>,
38708    _page_token: Option<String>,
38709    _page_size: Option<i32>,
38710    _order_by: Option<String>,
38711    _filter: Option<String>,
38712    _delegate: Option<&'a mut dyn common::Delegate>,
38713    _additional_params: HashMap<String, String>,
38714    _scopes: BTreeSet<String>,
38715}
38716
38717impl<'a, C> common::CallBuilder for AdvertiserListCall<'a, C> {}
38718
38719impl<'a, C> AdvertiserListCall<'a, C>
38720where
38721    C: common::Connector,
38722{
38723    /// Perform the operation you have build so far.
38724    pub async fn doit(mut self) -> common::Result<(common::Response, ListAdvertisersResponse)> {
38725        use std::borrow::Cow;
38726        use std::io::{Read, Seek};
38727
38728        use common::{url::Params, ToParts};
38729        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
38730
38731        let mut dd = common::DefaultDelegate;
38732        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
38733        dlg.begin(common::MethodInfo {
38734            id: "displayvideo.advertisers.list",
38735            http_method: hyper::Method::GET,
38736        });
38737
38738        for &field in [
38739            "alt",
38740            "partnerId",
38741            "pageToken",
38742            "pageSize",
38743            "orderBy",
38744            "filter",
38745        ]
38746        .iter()
38747        {
38748            if self._additional_params.contains_key(field) {
38749                dlg.finished(false);
38750                return Err(common::Error::FieldClash(field));
38751            }
38752        }
38753
38754        let mut params = Params::with_capacity(7 + self._additional_params.len());
38755        if let Some(value) = self._partner_id.as_ref() {
38756            params.push("partnerId", value.to_string());
38757        }
38758        if let Some(value) = self._page_token.as_ref() {
38759            params.push("pageToken", value);
38760        }
38761        if let Some(value) = self._page_size.as_ref() {
38762            params.push("pageSize", value.to_string());
38763        }
38764        if let Some(value) = self._order_by.as_ref() {
38765            params.push("orderBy", value);
38766        }
38767        if let Some(value) = self._filter.as_ref() {
38768            params.push("filter", value);
38769        }
38770
38771        params.extend(self._additional_params.iter());
38772
38773        params.push("alt", "json");
38774        let mut url = self.hub._base_url.clone() + "v1/advertisers";
38775        if self._scopes.is_empty() {
38776            self._scopes
38777                .insert(Scope::DisplayVideo.as_ref().to_string());
38778        }
38779
38780        let url = params.parse_with_url(&url);
38781
38782        loop {
38783            let token = match self
38784                .hub
38785                .auth
38786                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
38787                .await
38788            {
38789                Ok(token) => token,
38790                Err(e) => match dlg.token(e) {
38791                    Ok(token) => token,
38792                    Err(e) => {
38793                        dlg.finished(false);
38794                        return Err(common::Error::MissingToken(e));
38795                    }
38796                },
38797            };
38798            let mut req_result = {
38799                let client = &self.hub.client;
38800                dlg.pre_request();
38801                let mut req_builder = hyper::Request::builder()
38802                    .method(hyper::Method::GET)
38803                    .uri(url.as_str())
38804                    .header(USER_AGENT, self.hub._user_agent.clone());
38805
38806                if let Some(token) = token.as_ref() {
38807                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
38808                }
38809
38810                let request = req_builder
38811                    .header(CONTENT_LENGTH, 0_u64)
38812                    .body(common::to_body::<String>(None));
38813
38814                client.request(request.unwrap()).await
38815            };
38816
38817            match req_result {
38818                Err(err) => {
38819                    if let common::Retry::After(d) = dlg.http_error(&err) {
38820                        sleep(d).await;
38821                        continue;
38822                    }
38823                    dlg.finished(false);
38824                    return Err(common::Error::HttpError(err));
38825                }
38826                Ok(res) => {
38827                    let (mut parts, body) = res.into_parts();
38828                    let mut body = common::Body::new(body);
38829                    if !parts.status.is_success() {
38830                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38831                        let error = serde_json::from_str(&common::to_string(&bytes));
38832                        let response = common::to_response(parts, bytes.into());
38833
38834                        if let common::Retry::After(d) =
38835                            dlg.http_failure(&response, error.as_ref().ok())
38836                        {
38837                            sleep(d).await;
38838                            continue;
38839                        }
38840
38841                        dlg.finished(false);
38842
38843                        return Err(match error {
38844                            Ok(value) => common::Error::BadRequest(value),
38845                            _ => common::Error::Failure(response),
38846                        });
38847                    }
38848                    let response = {
38849                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38850                        let encoded = common::to_string(&bytes);
38851                        match serde_json::from_str(&encoded) {
38852                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
38853                            Err(error) => {
38854                                dlg.response_json_decode_error(&encoded, &error);
38855                                return Err(common::Error::JsonDecodeError(
38856                                    encoded.to_string(),
38857                                    error,
38858                                ));
38859                            }
38860                        }
38861                    };
38862
38863                    dlg.finished(true);
38864                    return Ok(response);
38865                }
38866            }
38867        }
38868    }
38869
38870    /// Required. The ID of the partner that the fetched advertisers should all belong to. The system only supports listing advertisers for one partner at a time.
38871    ///
38872    /// Sets the *partner id* query property to the given value.
38873    pub fn partner_id(mut self, new_value: i64) -> AdvertiserListCall<'a, C> {
38874        self._partner_id = Some(new_value);
38875        self
38876    }
38877    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListAdvertisers` method. If not specified, the first page of results will be returned.
38878    ///
38879    /// Sets the *page token* query property to the given value.
38880    pub fn page_token(mut self, new_value: &str) -> AdvertiserListCall<'a, C> {
38881        self._page_token = Some(new_value.to_string());
38882        self
38883    }
38884    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`.
38885    ///
38886    /// Sets the *page size* query property to the given value.
38887    pub fn page_size(mut self, new_value: i32) -> AdvertiserListCall<'a, C> {
38888        self._page_size = Some(new_value);
38889        self
38890    }
38891    /// Field by which to sort the list. Acceptable values are: * `displayName` (default) * `entityStatus` * `updateTime` The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. For example, `displayName desc`.
38892    ///
38893    /// Sets the *order by* query property to the given value.
38894    pub fn order_by(mut self, new_value: &str) -> AdvertiserListCall<'a, C> {
38895        self._order_by = Some(new_value.to_string());
38896        self
38897    }
38898    /// Allows filtering by advertiser fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by `AND` or `OR` logical operators. * A restriction has the form of `{field} {operator} {value}`. * The `updateTime` field must use the `GREATER THAN OR EQUAL TO (>=)` or `LESS THAN OR EQUAL TO (<=)` operators. * All other fields must use the `EQUALS (=)` operator. Supported fields: * `advertiserId` * `displayName` * `entityStatus` * `updateTime` (input in ISO 8601 format, or `YYYY-MM-DDTHH:MM:SSZ`) Examples: * All active advertisers under a partner: `entityStatus="ENTITY_STATUS_ACTIVE"` * All advertisers with an update time less than or equal to 2020-11-04T18:54:47Z (format of ISO 8601): `updateTime<="2020-11-04T18:54:47Z"` * All advertisers with an update time greater than or equal to 2020-11-04T18:54:47Z (format of ISO 8601): `updateTime>="2020-11-04T18:54:47Z"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
38899    ///
38900    /// Sets the *filter* query property to the given value.
38901    pub fn filter(mut self, new_value: &str) -> AdvertiserListCall<'a, C> {
38902        self._filter = Some(new_value.to_string());
38903        self
38904    }
38905    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38906    /// while executing the actual API request.
38907    ///
38908    /// ````text
38909    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
38910    /// ````
38911    ///
38912    /// Sets the *delegate* property to the given value.
38913    pub fn delegate(
38914        mut self,
38915        new_value: &'a mut dyn common::Delegate,
38916    ) -> AdvertiserListCall<'a, C> {
38917        self._delegate = Some(new_value);
38918        self
38919    }
38920
38921    /// Set any additional parameter of the query string used in the request.
38922    /// It should be used to set parameters which are not yet available through their own
38923    /// setters.
38924    ///
38925    /// Please note that this method must not be used to set any of the known parameters
38926    /// which have their own setter method. If done anyway, the request will fail.
38927    ///
38928    /// # Additional Parameters
38929    ///
38930    /// * *$.xgafv* (query-string) - V1 error format.
38931    /// * *access_token* (query-string) - OAuth access token.
38932    /// * *alt* (query-string) - Data format for response.
38933    /// * *callback* (query-string) - JSONP
38934    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38935    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
38936    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38937    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38938    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
38939    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38940    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38941    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserListCall<'a, C>
38942    where
38943        T: AsRef<str>,
38944    {
38945        self._additional_params
38946            .insert(name.as_ref().to_string(), value.as_ref().to_string());
38947        self
38948    }
38949
38950    /// Identifies the authorization scope for the method you are building.
38951    ///
38952    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38953    /// [`Scope::DisplayVideo`].
38954    ///
38955    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38956    /// tokens for more than one scope.
38957    ///
38958    /// Usually there is more than one suitable scope to authorize an operation, some of which may
38959    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38960    /// sufficient, a read-write scope will do as well.
38961    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserListCall<'a, C>
38962    where
38963        St: AsRef<str>,
38964    {
38965        self._scopes.insert(String::from(scope.as_ref()));
38966        self
38967    }
38968    /// Identifies the authorization scope(s) for the method you are building.
38969    ///
38970    /// See [`Self::add_scope()`] for details.
38971    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserListCall<'a, C>
38972    where
38973        I: IntoIterator<Item = St>,
38974        St: AsRef<str>,
38975    {
38976        self._scopes
38977            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38978        self
38979    }
38980
38981    /// Removes all scopes, and no default scope will be used either.
38982    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38983    /// for details).
38984    pub fn clear_scopes(mut self) -> AdvertiserListCall<'a, C> {
38985        self._scopes.clear();
38986        self
38987    }
38988}
38989
38990/// Updates an existing advertiser. Returns the updated advertiser if successful.
38991///
38992/// A builder for the *patch* method supported by a *advertiser* resource.
38993/// It is not used directly, but through a [`AdvertiserMethods`] instance.
38994///
38995/// # Example
38996///
38997/// Instantiate a resource method builder
38998///
38999/// ```test_harness,no_run
39000/// # extern crate hyper;
39001/// # extern crate hyper_rustls;
39002/// # extern crate google_displayvideo1 as displayvideo1;
39003/// use displayvideo1::api::Advertiser;
39004/// # async fn dox() {
39005/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
39006///
39007/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
39008/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
39009/// #     secret,
39010/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
39011/// # ).build().await.unwrap();
39012///
39013/// # let client = hyper_util::client::legacy::Client::builder(
39014/// #     hyper_util::rt::TokioExecutor::new()
39015/// # )
39016/// # .build(
39017/// #     hyper_rustls::HttpsConnectorBuilder::new()
39018/// #         .with_native_roots()
39019/// #         .unwrap()
39020/// #         .https_or_http()
39021/// #         .enable_http1()
39022/// #         .build()
39023/// # );
39024/// # let mut hub = DisplayVideo::new(client, auth);
39025/// // As the method needs a request, you would usually fill it with the desired information
39026/// // into the respective structure. Some of the parts shown here might not be applicable !
39027/// // Values shown here are possibly random and not representative !
39028/// let mut req = Advertiser::default();
39029///
39030/// // You can configure optional parameters by calling the respective setters at will, and
39031/// // execute the final call using `doit()`.
39032/// // Values shown here are possibly random and not representative !
39033/// let result = hub.advertisers().patch(req, -18)
39034///              .update_mask(FieldMask::new::<&str>(&[]))
39035///              .doit().await;
39036/// # }
39037/// ```
39038pub struct AdvertiserPatchCall<'a, C>
39039where
39040    C: 'a,
39041{
39042    hub: &'a DisplayVideo<C>,
39043    _request: Advertiser,
39044    _advertiser_id: i64,
39045    _update_mask: Option<common::FieldMask>,
39046    _delegate: Option<&'a mut dyn common::Delegate>,
39047    _additional_params: HashMap<String, String>,
39048    _scopes: BTreeSet<String>,
39049}
39050
39051impl<'a, C> common::CallBuilder for AdvertiserPatchCall<'a, C> {}
39052
39053impl<'a, C> AdvertiserPatchCall<'a, C>
39054where
39055    C: common::Connector,
39056{
39057    /// Perform the operation you have build so far.
39058    pub async fn doit(mut self) -> common::Result<(common::Response, Advertiser)> {
39059        use std::borrow::Cow;
39060        use std::io::{Read, Seek};
39061
39062        use common::{url::Params, ToParts};
39063        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
39064
39065        let mut dd = common::DefaultDelegate;
39066        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
39067        dlg.begin(common::MethodInfo {
39068            id: "displayvideo.advertisers.patch",
39069            http_method: hyper::Method::PATCH,
39070        });
39071
39072        for &field in ["alt", "advertiserId", "updateMask"].iter() {
39073            if self._additional_params.contains_key(field) {
39074                dlg.finished(false);
39075                return Err(common::Error::FieldClash(field));
39076            }
39077        }
39078
39079        let mut params = Params::with_capacity(5 + self._additional_params.len());
39080        params.push("advertiserId", self._advertiser_id.to_string());
39081        if let Some(value) = self._update_mask.as_ref() {
39082            params.push("updateMask", value.to_string());
39083        }
39084
39085        params.extend(self._additional_params.iter());
39086
39087        params.push("alt", "json");
39088        let mut url = self.hub._base_url.clone() + "v1/advertisers/{+advertiserId}";
39089        if self._scopes.is_empty() {
39090            self._scopes
39091                .insert(Scope::DisplayVideo.as_ref().to_string());
39092        }
39093
39094        #[allow(clippy::single_element_loop)]
39095        for &(find_this, param_name) in [("{+advertiserId}", "advertiserId")].iter() {
39096            url = params.uri_replacement(url, param_name, find_this, true);
39097        }
39098        {
39099            let to_remove = ["advertiserId"];
39100            params.remove_params(&to_remove);
39101        }
39102
39103        let url = params.parse_with_url(&url);
39104
39105        let mut json_mime_type = mime::APPLICATION_JSON;
39106        let mut request_value_reader = {
39107            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
39108            common::remove_json_null_values(&mut value);
39109            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
39110            serde_json::to_writer(&mut dst, &value).unwrap();
39111            dst
39112        };
39113        let request_size = request_value_reader
39114            .seek(std::io::SeekFrom::End(0))
39115            .unwrap();
39116        request_value_reader
39117            .seek(std::io::SeekFrom::Start(0))
39118            .unwrap();
39119
39120        loop {
39121            let token = match self
39122                .hub
39123                .auth
39124                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
39125                .await
39126            {
39127                Ok(token) => token,
39128                Err(e) => match dlg.token(e) {
39129                    Ok(token) => token,
39130                    Err(e) => {
39131                        dlg.finished(false);
39132                        return Err(common::Error::MissingToken(e));
39133                    }
39134                },
39135            };
39136            request_value_reader
39137                .seek(std::io::SeekFrom::Start(0))
39138                .unwrap();
39139            let mut req_result = {
39140                let client = &self.hub.client;
39141                dlg.pre_request();
39142                let mut req_builder = hyper::Request::builder()
39143                    .method(hyper::Method::PATCH)
39144                    .uri(url.as_str())
39145                    .header(USER_AGENT, self.hub._user_agent.clone());
39146
39147                if let Some(token) = token.as_ref() {
39148                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
39149                }
39150
39151                let request = req_builder
39152                    .header(CONTENT_TYPE, json_mime_type.to_string())
39153                    .header(CONTENT_LENGTH, request_size as u64)
39154                    .body(common::to_body(
39155                        request_value_reader.get_ref().clone().into(),
39156                    ));
39157
39158                client.request(request.unwrap()).await
39159            };
39160
39161            match req_result {
39162                Err(err) => {
39163                    if let common::Retry::After(d) = dlg.http_error(&err) {
39164                        sleep(d).await;
39165                        continue;
39166                    }
39167                    dlg.finished(false);
39168                    return Err(common::Error::HttpError(err));
39169                }
39170                Ok(res) => {
39171                    let (mut parts, body) = res.into_parts();
39172                    let mut body = common::Body::new(body);
39173                    if !parts.status.is_success() {
39174                        let bytes = common::to_bytes(body).await.unwrap_or_default();
39175                        let error = serde_json::from_str(&common::to_string(&bytes));
39176                        let response = common::to_response(parts, bytes.into());
39177
39178                        if let common::Retry::After(d) =
39179                            dlg.http_failure(&response, error.as_ref().ok())
39180                        {
39181                            sleep(d).await;
39182                            continue;
39183                        }
39184
39185                        dlg.finished(false);
39186
39187                        return Err(match error {
39188                            Ok(value) => common::Error::BadRequest(value),
39189                            _ => common::Error::Failure(response),
39190                        });
39191                    }
39192                    let response = {
39193                        let bytes = common::to_bytes(body).await.unwrap_or_default();
39194                        let encoded = common::to_string(&bytes);
39195                        match serde_json::from_str(&encoded) {
39196                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
39197                            Err(error) => {
39198                                dlg.response_json_decode_error(&encoded, &error);
39199                                return Err(common::Error::JsonDecodeError(
39200                                    encoded.to_string(),
39201                                    error,
39202                                ));
39203                            }
39204                        }
39205                    };
39206
39207                    dlg.finished(true);
39208                    return Ok(response);
39209                }
39210            }
39211        }
39212    }
39213
39214    ///
39215    /// Sets the *request* property to the given value.
39216    ///
39217    /// Even though the property as already been set when instantiating this call,
39218    /// we provide this method for API completeness.
39219    pub fn request(mut self, new_value: Advertiser) -> AdvertiserPatchCall<'a, C> {
39220        self._request = new_value;
39221        self
39222    }
39223    /// Output only. The unique ID of the advertiser. Assigned by the system.
39224    ///
39225    /// Sets the *advertiser id* path property to the given value.
39226    ///
39227    /// Even though the property as already been set when instantiating this call,
39228    /// we provide this method for API completeness.
39229    pub fn advertiser_id(mut self, new_value: i64) -> AdvertiserPatchCall<'a, C> {
39230        self._advertiser_id = new_value;
39231        self
39232    }
39233    /// Required. The mask to control which fields to update.
39234    ///
39235    /// Sets the *update mask* query property to the given value.
39236    pub fn update_mask(mut self, new_value: common::FieldMask) -> AdvertiserPatchCall<'a, C> {
39237        self._update_mask = Some(new_value);
39238        self
39239    }
39240    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
39241    /// while executing the actual API request.
39242    ///
39243    /// ````text
39244    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
39245    /// ````
39246    ///
39247    /// Sets the *delegate* property to the given value.
39248    pub fn delegate(
39249        mut self,
39250        new_value: &'a mut dyn common::Delegate,
39251    ) -> AdvertiserPatchCall<'a, C> {
39252        self._delegate = Some(new_value);
39253        self
39254    }
39255
39256    /// Set any additional parameter of the query string used in the request.
39257    /// It should be used to set parameters which are not yet available through their own
39258    /// setters.
39259    ///
39260    /// Please note that this method must not be used to set any of the known parameters
39261    /// which have their own setter method. If done anyway, the request will fail.
39262    ///
39263    /// # Additional Parameters
39264    ///
39265    /// * *$.xgafv* (query-string) - V1 error format.
39266    /// * *access_token* (query-string) - OAuth access token.
39267    /// * *alt* (query-string) - Data format for response.
39268    /// * *callback* (query-string) - JSONP
39269    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
39270    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
39271    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
39272    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
39273    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
39274    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
39275    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
39276    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserPatchCall<'a, C>
39277    where
39278        T: AsRef<str>,
39279    {
39280        self._additional_params
39281            .insert(name.as_ref().to_string(), value.as_ref().to_string());
39282        self
39283    }
39284
39285    /// Identifies the authorization scope for the method you are building.
39286    ///
39287    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
39288    /// [`Scope::DisplayVideo`].
39289    ///
39290    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
39291    /// tokens for more than one scope.
39292    ///
39293    /// Usually there is more than one suitable scope to authorize an operation, some of which may
39294    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
39295    /// sufficient, a read-write scope will do as well.
39296    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserPatchCall<'a, C>
39297    where
39298        St: AsRef<str>,
39299    {
39300        self._scopes.insert(String::from(scope.as_ref()));
39301        self
39302    }
39303    /// Identifies the authorization scope(s) for the method you are building.
39304    ///
39305    /// See [`Self::add_scope()`] for details.
39306    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserPatchCall<'a, C>
39307    where
39308        I: IntoIterator<Item = St>,
39309        St: AsRef<str>,
39310    {
39311        self._scopes
39312            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
39313        self
39314    }
39315
39316    /// Removes all scopes, and no default scope will be used either.
39317    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
39318    /// for details).
39319    pub fn clear_scopes(mut self) -> AdvertiserPatchCall<'a, C> {
39320        self._scopes.clear();
39321        self
39322    }
39323}
39324
39325/// Gets a combined audience.
39326///
39327/// A builder for the *get* method supported by a *combinedAudience* resource.
39328/// It is not used directly, but through a [`CombinedAudienceMethods`] instance.
39329///
39330/// # Example
39331///
39332/// Instantiate a resource method builder
39333///
39334/// ```test_harness,no_run
39335/// # extern crate hyper;
39336/// # extern crate hyper_rustls;
39337/// # extern crate google_displayvideo1 as displayvideo1;
39338/// # async fn dox() {
39339/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
39340///
39341/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
39342/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
39343/// #     secret,
39344/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
39345/// # ).build().await.unwrap();
39346///
39347/// # let client = hyper_util::client::legacy::Client::builder(
39348/// #     hyper_util::rt::TokioExecutor::new()
39349/// # )
39350/// # .build(
39351/// #     hyper_rustls::HttpsConnectorBuilder::new()
39352/// #         .with_native_roots()
39353/// #         .unwrap()
39354/// #         .https_or_http()
39355/// #         .enable_http1()
39356/// #         .build()
39357/// # );
39358/// # let mut hub = DisplayVideo::new(client, auth);
39359/// // You can configure optional parameters by calling the respective setters at will, and
39360/// // execute the final call using `doit()`.
39361/// // Values shown here are possibly random and not representative !
39362/// let result = hub.combined_audiences().get(-8)
39363///              .partner_id(-23)
39364///              .advertiser_id(-39)
39365///              .doit().await;
39366/// # }
39367/// ```
39368pub struct CombinedAudienceGetCall<'a, C>
39369where
39370    C: 'a,
39371{
39372    hub: &'a DisplayVideo<C>,
39373    _combined_audience_id: i64,
39374    _partner_id: Option<i64>,
39375    _advertiser_id: Option<i64>,
39376    _delegate: Option<&'a mut dyn common::Delegate>,
39377    _additional_params: HashMap<String, String>,
39378    _scopes: BTreeSet<String>,
39379}
39380
39381impl<'a, C> common::CallBuilder for CombinedAudienceGetCall<'a, C> {}
39382
39383impl<'a, C> CombinedAudienceGetCall<'a, C>
39384where
39385    C: common::Connector,
39386{
39387    /// Perform the operation you have build so far.
39388    pub async fn doit(mut self) -> common::Result<(common::Response, CombinedAudience)> {
39389        use std::borrow::Cow;
39390        use std::io::{Read, Seek};
39391
39392        use common::{url::Params, ToParts};
39393        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
39394
39395        let mut dd = common::DefaultDelegate;
39396        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
39397        dlg.begin(common::MethodInfo {
39398            id: "displayvideo.combinedAudiences.get",
39399            http_method: hyper::Method::GET,
39400        });
39401
39402        for &field in ["alt", "combinedAudienceId", "partnerId", "advertiserId"].iter() {
39403            if self._additional_params.contains_key(field) {
39404                dlg.finished(false);
39405                return Err(common::Error::FieldClash(field));
39406            }
39407        }
39408
39409        let mut params = Params::with_capacity(5 + self._additional_params.len());
39410        params.push("combinedAudienceId", self._combined_audience_id.to_string());
39411        if let Some(value) = self._partner_id.as_ref() {
39412            params.push("partnerId", value.to_string());
39413        }
39414        if let Some(value) = self._advertiser_id.as_ref() {
39415            params.push("advertiserId", value.to_string());
39416        }
39417
39418        params.extend(self._additional_params.iter());
39419
39420        params.push("alt", "json");
39421        let mut url = self.hub._base_url.clone() + "v1/combinedAudiences/{+combinedAudienceId}";
39422        if self._scopes.is_empty() {
39423            self._scopes
39424                .insert(Scope::DisplayVideo.as_ref().to_string());
39425        }
39426
39427        #[allow(clippy::single_element_loop)]
39428        for &(find_this, param_name) in [("{+combinedAudienceId}", "combinedAudienceId")].iter() {
39429            url = params.uri_replacement(url, param_name, find_this, true);
39430        }
39431        {
39432            let to_remove = ["combinedAudienceId"];
39433            params.remove_params(&to_remove);
39434        }
39435
39436        let url = params.parse_with_url(&url);
39437
39438        loop {
39439            let token = match self
39440                .hub
39441                .auth
39442                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
39443                .await
39444            {
39445                Ok(token) => token,
39446                Err(e) => match dlg.token(e) {
39447                    Ok(token) => token,
39448                    Err(e) => {
39449                        dlg.finished(false);
39450                        return Err(common::Error::MissingToken(e));
39451                    }
39452                },
39453            };
39454            let mut req_result = {
39455                let client = &self.hub.client;
39456                dlg.pre_request();
39457                let mut req_builder = hyper::Request::builder()
39458                    .method(hyper::Method::GET)
39459                    .uri(url.as_str())
39460                    .header(USER_AGENT, self.hub._user_agent.clone());
39461
39462                if let Some(token) = token.as_ref() {
39463                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
39464                }
39465
39466                let request = req_builder
39467                    .header(CONTENT_LENGTH, 0_u64)
39468                    .body(common::to_body::<String>(None));
39469
39470                client.request(request.unwrap()).await
39471            };
39472
39473            match req_result {
39474                Err(err) => {
39475                    if let common::Retry::After(d) = dlg.http_error(&err) {
39476                        sleep(d).await;
39477                        continue;
39478                    }
39479                    dlg.finished(false);
39480                    return Err(common::Error::HttpError(err));
39481                }
39482                Ok(res) => {
39483                    let (mut parts, body) = res.into_parts();
39484                    let mut body = common::Body::new(body);
39485                    if !parts.status.is_success() {
39486                        let bytes = common::to_bytes(body).await.unwrap_or_default();
39487                        let error = serde_json::from_str(&common::to_string(&bytes));
39488                        let response = common::to_response(parts, bytes.into());
39489
39490                        if let common::Retry::After(d) =
39491                            dlg.http_failure(&response, error.as_ref().ok())
39492                        {
39493                            sleep(d).await;
39494                            continue;
39495                        }
39496
39497                        dlg.finished(false);
39498
39499                        return Err(match error {
39500                            Ok(value) => common::Error::BadRequest(value),
39501                            _ => common::Error::Failure(response),
39502                        });
39503                    }
39504                    let response = {
39505                        let bytes = common::to_bytes(body).await.unwrap_or_default();
39506                        let encoded = common::to_string(&bytes);
39507                        match serde_json::from_str(&encoded) {
39508                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
39509                            Err(error) => {
39510                                dlg.response_json_decode_error(&encoded, &error);
39511                                return Err(common::Error::JsonDecodeError(
39512                                    encoded.to_string(),
39513                                    error,
39514                                ));
39515                            }
39516                        }
39517                    };
39518
39519                    dlg.finished(true);
39520                    return Ok(response);
39521                }
39522            }
39523        }
39524    }
39525
39526    /// Required. The ID of the combined audience to fetch.
39527    ///
39528    /// Sets the *combined audience id* path property to the given value.
39529    ///
39530    /// Even though the property as already been set when instantiating this call,
39531    /// we provide this method for API completeness.
39532    pub fn combined_audience_id(mut self, new_value: i64) -> CombinedAudienceGetCall<'a, C> {
39533        self._combined_audience_id = new_value;
39534        self
39535    }
39536    /// The ID of the partner that has access to the fetched combined audience.
39537    ///
39538    /// Sets the *partner id* query property to the given value.
39539    pub fn partner_id(mut self, new_value: i64) -> CombinedAudienceGetCall<'a, C> {
39540        self._partner_id = Some(new_value);
39541        self
39542    }
39543    /// The ID of the advertiser that has access to the fetched combined audience.
39544    ///
39545    /// Sets the *advertiser id* query property to the given value.
39546    pub fn advertiser_id(mut self, new_value: i64) -> CombinedAudienceGetCall<'a, C> {
39547        self._advertiser_id = Some(new_value);
39548        self
39549    }
39550    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
39551    /// while executing the actual API request.
39552    ///
39553    /// ````text
39554    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
39555    /// ````
39556    ///
39557    /// Sets the *delegate* property to the given value.
39558    pub fn delegate(
39559        mut self,
39560        new_value: &'a mut dyn common::Delegate,
39561    ) -> CombinedAudienceGetCall<'a, C> {
39562        self._delegate = Some(new_value);
39563        self
39564    }
39565
39566    /// Set any additional parameter of the query string used in the request.
39567    /// It should be used to set parameters which are not yet available through their own
39568    /// setters.
39569    ///
39570    /// Please note that this method must not be used to set any of the known parameters
39571    /// which have their own setter method. If done anyway, the request will fail.
39572    ///
39573    /// # Additional Parameters
39574    ///
39575    /// * *$.xgafv* (query-string) - V1 error format.
39576    /// * *access_token* (query-string) - OAuth access token.
39577    /// * *alt* (query-string) - Data format for response.
39578    /// * *callback* (query-string) - JSONP
39579    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
39580    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
39581    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
39582    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
39583    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
39584    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
39585    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
39586    pub fn param<T>(mut self, name: T, value: T) -> CombinedAudienceGetCall<'a, C>
39587    where
39588        T: AsRef<str>,
39589    {
39590        self._additional_params
39591            .insert(name.as_ref().to_string(), value.as_ref().to_string());
39592        self
39593    }
39594
39595    /// Identifies the authorization scope for the method you are building.
39596    ///
39597    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
39598    /// [`Scope::DisplayVideo`].
39599    ///
39600    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
39601    /// tokens for more than one scope.
39602    ///
39603    /// Usually there is more than one suitable scope to authorize an operation, some of which may
39604    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
39605    /// sufficient, a read-write scope will do as well.
39606    pub fn add_scope<St>(mut self, scope: St) -> CombinedAudienceGetCall<'a, C>
39607    where
39608        St: AsRef<str>,
39609    {
39610        self._scopes.insert(String::from(scope.as_ref()));
39611        self
39612    }
39613    /// Identifies the authorization scope(s) for the method you are building.
39614    ///
39615    /// See [`Self::add_scope()`] for details.
39616    pub fn add_scopes<I, St>(mut self, scopes: I) -> CombinedAudienceGetCall<'a, C>
39617    where
39618        I: IntoIterator<Item = St>,
39619        St: AsRef<str>,
39620    {
39621        self._scopes
39622            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
39623        self
39624    }
39625
39626    /// Removes all scopes, and no default scope will be used either.
39627    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
39628    /// for details).
39629    pub fn clear_scopes(mut self) -> CombinedAudienceGetCall<'a, C> {
39630        self._scopes.clear();
39631        self
39632    }
39633}
39634
39635/// Lists combined audiences. The order is defined by the order_by parameter.
39636///
39637/// A builder for the *list* method supported by a *combinedAudience* resource.
39638/// It is not used directly, but through a [`CombinedAudienceMethods`] instance.
39639///
39640/// # Example
39641///
39642/// Instantiate a resource method builder
39643///
39644/// ```test_harness,no_run
39645/// # extern crate hyper;
39646/// # extern crate hyper_rustls;
39647/// # extern crate google_displayvideo1 as displayvideo1;
39648/// # async fn dox() {
39649/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
39650///
39651/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
39652/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
39653/// #     secret,
39654/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
39655/// # ).build().await.unwrap();
39656///
39657/// # let client = hyper_util::client::legacy::Client::builder(
39658/// #     hyper_util::rt::TokioExecutor::new()
39659/// # )
39660/// # .build(
39661/// #     hyper_rustls::HttpsConnectorBuilder::new()
39662/// #         .with_native_roots()
39663/// #         .unwrap()
39664/// #         .https_or_http()
39665/// #         .enable_http1()
39666/// #         .build()
39667/// # );
39668/// # let mut hub = DisplayVideo::new(client, auth);
39669/// // You can configure optional parameters by calling the respective setters at will, and
39670/// // execute the final call using `doit()`.
39671/// // Values shown here are possibly random and not representative !
39672/// let result = hub.combined_audiences().list()
39673///              .partner_id(-43)
39674///              .page_token("est")
39675///              .page_size(-9)
39676///              .order_by("dolor")
39677///              .filter("diam")
39678///              .advertiser_id(-77)
39679///              .doit().await;
39680/// # }
39681/// ```
39682pub struct CombinedAudienceListCall<'a, C>
39683where
39684    C: 'a,
39685{
39686    hub: &'a DisplayVideo<C>,
39687    _partner_id: Option<i64>,
39688    _page_token: Option<String>,
39689    _page_size: Option<i32>,
39690    _order_by: Option<String>,
39691    _filter: Option<String>,
39692    _advertiser_id: Option<i64>,
39693    _delegate: Option<&'a mut dyn common::Delegate>,
39694    _additional_params: HashMap<String, String>,
39695    _scopes: BTreeSet<String>,
39696}
39697
39698impl<'a, C> common::CallBuilder for CombinedAudienceListCall<'a, C> {}
39699
39700impl<'a, C> CombinedAudienceListCall<'a, C>
39701where
39702    C: common::Connector,
39703{
39704    /// Perform the operation you have build so far.
39705    pub async fn doit(
39706        mut self,
39707    ) -> common::Result<(common::Response, ListCombinedAudiencesResponse)> {
39708        use std::borrow::Cow;
39709        use std::io::{Read, Seek};
39710
39711        use common::{url::Params, ToParts};
39712        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
39713
39714        let mut dd = common::DefaultDelegate;
39715        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
39716        dlg.begin(common::MethodInfo {
39717            id: "displayvideo.combinedAudiences.list",
39718            http_method: hyper::Method::GET,
39719        });
39720
39721        for &field in [
39722            "alt",
39723            "partnerId",
39724            "pageToken",
39725            "pageSize",
39726            "orderBy",
39727            "filter",
39728            "advertiserId",
39729        ]
39730        .iter()
39731        {
39732            if self._additional_params.contains_key(field) {
39733                dlg.finished(false);
39734                return Err(common::Error::FieldClash(field));
39735            }
39736        }
39737
39738        let mut params = Params::with_capacity(8 + self._additional_params.len());
39739        if let Some(value) = self._partner_id.as_ref() {
39740            params.push("partnerId", value.to_string());
39741        }
39742        if let Some(value) = self._page_token.as_ref() {
39743            params.push("pageToken", value);
39744        }
39745        if let Some(value) = self._page_size.as_ref() {
39746            params.push("pageSize", value.to_string());
39747        }
39748        if let Some(value) = self._order_by.as_ref() {
39749            params.push("orderBy", value);
39750        }
39751        if let Some(value) = self._filter.as_ref() {
39752            params.push("filter", value);
39753        }
39754        if let Some(value) = self._advertiser_id.as_ref() {
39755            params.push("advertiserId", value.to_string());
39756        }
39757
39758        params.extend(self._additional_params.iter());
39759
39760        params.push("alt", "json");
39761        let mut url = self.hub._base_url.clone() + "v1/combinedAudiences";
39762        if self._scopes.is_empty() {
39763            self._scopes
39764                .insert(Scope::DisplayVideo.as_ref().to_string());
39765        }
39766
39767        let url = params.parse_with_url(&url);
39768
39769        loop {
39770            let token = match self
39771                .hub
39772                .auth
39773                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
39774                .await
39775            {
39776                Ok(token) => token,
39777                Err(e) => match dlg.token(e) {
39778                    Ok(token) => token,
39779                    Err(e) => {
39780                        dlg.finished(false);
39781                        return Err(common::Error::MissingToken(e));
39782                    }
39783                },
39784            };
39785            let mut req_result = {
39786                let client = &self.hub.client;
39787                dlg.pre_request();
39788                let mut req_builder = hyper::Request::builder()
39789                    .method(hyper::Method::GET)
39790                    .uri(url.as_str())
39791                    .header(USER_AGENT, self.hub._user_agent.clone());
39792
39793                if let Some(token) = token.as_ref() {
39794                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
39795                }
39796
39797                let request = req_builder
39798                    .header(CONTENT_LENGTH, 0_u64)
39799                    .body(common::to_body::<String>(None));
39800
39801                client.request(request.unwrap()).await
39802            };
39803
39804            match req_result {
39805                Err(err) => {
39806                    if let common::Retry::After(d) = dlg.http_error(&err) {
39807                        sleep(d).await;
39808                        continue;
39809                    }
39810                    dlg.finished(false);
39811                    return Err(common::Error::HttpError(err));
39812                }
39813                Ok(res) => {
39814                    let (mut parts, body) = res.into_parts();
39815                    let mut body = common::Body::new(body);
39816                    if !parts.status.is_success() {
39817                        let bytes = common::to_bytes(body).await.unwrap_or_default();
39818                        let error = serde_json::from_str(&common::to_string(&bytes));
39819                        let response = common::to_response(parts, bytes.into());
39820
39821                        if let common::Retry::After(d) =
39822                            dlg.http_failure(&response, error.as_ref().ok())
39823                        {
39824                            sleep(d).await;
39825                            continue;
39826                        }
39827
39828                        dlg.finished(false);
39829
39830                        return Err(match error {
39831                            Ok(value) => common::Error::BadRequest(value),
39832                            _ => common::Error::Failure(response),
39833                        });
39834                    }
39835                    let response = {
39836                        let bytes = common::to_bytes(body).await.unwrap_or_default();
39837                        let encoded = common::to_string(&bytes);
39838                        match serde_json::from_str(&encoded) {
39839                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
39840                            Err(error) => {
39841                                dlg.response_json_decode_error(&encoded, &error);
39842                                return Err(common::Error::JsonDecodeError(
39843                                    encoded.to_string(),
39844                                    error,
39845                                ));
39846                            }
39847                        }
39848                    };
39849
39850                    dlg.finished(true);
39851                    return Ok(response);
39852                }
39853            }
39854        }
39855    }
39856
39857    /// The ID of the partner that has access to the fetched combined audiences.
39858    ///
39859    /// Sets the *partner id* query property to the given value.
39860    pub fn partner_id(mut self, new_value: i64) -> CombinedAudienceListCall<'a, C> {
39861        self._partner_id = Some(new_value);
39862        self
39863    }
39864    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListCombinedAudiences` method. If not specified, the first page of results will be returned.
39865    ///
39866    /// Sets the *page token* query property to the given value.
39867    pub fn page_token(mut self, new_value: &str) -> CombinedAudienceListCall<'a, C> {
39868        self._page_token = Some(new_value.to_string());
39869        self
39870    }
39871    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
39872    ///
39873    /// Sets the *page size* query property to the given value.
39874    pub fn page_size(mut self, new_value: i32) -> CombinedAudienceListCall<'a, C> {
39875        self._page_size = Some(new_value);
39876        self
39877    }
39878    /// Field by which to sort the list. Acceptable values are: * `combinedAudienceId` (default) * `displayName` The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `displayName desc`.
39879    ///
39880    /// Sets the *order by* query property to the given value.
39881    pub fn order_by(mut self, new_value: &str) -> CombinedAudienceListCall<'a, C> {
39882        self._order_by = Some(new_value.to_string());
39883        self
39884    }
39885    /// Allows filtering by combined audience fields. Supported syntax: * Filter expressions for combined audiences can only contain at most one restriction. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `HAS (:)` operator. Supported fields: * `displayName` Examples: * All combined audiences for which the display name contains “Google”: `displayName : "Google"`. The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
39886    ///
39887    /// Sets the *filter* query property to the given value.
39888    pub fn filter(mut self, new_value: &str) -> CombinedAudienceListCall<'a, C> {
39889        self._filter = Some(new_value.to_string());
39890        self
39891    }
39892    /// The ID of the advertiser that has access to the fetched combined audiences.
39893    ///
39894    /// Sets the *advertiser id* query property to the given value.
39895    pub fn advertiser_id(mut self, new_value: i64) -> CombinedAudienceListCall<'a, C> {
39896        self._advertiser_id = Some(new_value);
39897        self
39898    }
39899    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
39900    /// while executing the actual API request.
39901    ///
39902    /// ````text
39903    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
39904    /// ````
39905    ///
39906    /// Sets the *delegate* property to the given value.
39907    pub fn delegate(
39908        mut self,
39909        new_value: &'a mut dyn common::Delegate,
39910    ) -> CombinedAudienceListCall<'a, C> {
39911        self._delegate = Some(new_value);
39912        self
39913    }
39914
39915    /// Set any additional parameter of the query string used in the request.
39916    /// It should be used to set parameters which are not yet available through their own
39917    /// setters.
39918    ///
39919    /// Please note that this method must not be used to set any of the known parameters
39920    /// which have their own setter method. If done anyway, the request will fail.
39921    ///
39922    /// # Additional Parameters
39923    ///
39924    /// * *$.xgafv* (query-string) - V1 error format.
39925    /// * *access_token* (query-string) - OAuth access token.
39926    /// * *alt* (query-string) - Data format for response.
39927    /// * *callback* (query-string) - JSONP
39928    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
39929    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
39930    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
39931    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
39932    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
39933    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
39934    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
39935    pub fn param<T>(mut self, name: T, value: T) -> CombinedAudienceListCall<'a, C>
39936    where
39937        T: AsRef<str>,
39938    {
39939        self._additional_params
39940            .insert(name.as_ref().to_string(), value.as_ref().to_string());
39941        self
39942    }
39943
39944    /// Identifies the authorization scope for the method you are building.
39945    ///
39946    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
39947    /// [`Scope::DisplayVideo`].
39948    ///
39949    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
39950    /// tokens for more than one scope.
39951    ///
39952    /// Usually there is more than one suitable scope to authorize an operation, some of which may
39953    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
39954    /// sufficient, a read-write scope will do as well.
39955    pub fn add_scope<St>(mut self, scope: St) -> CombinedAudienceListCall<'a, C>
39956    where
39957        St: AsRef<str>,
39958    {
39959        self._scopes.insert(String::from(scope.as_ref()));
39960        self
39961    }
39962    /// Identifies the authorization scope(s) for the method you are building.
39963    ///
39964    /// See [`Self::add_scope()`] for details.
39965    pub fn add_scopes<I, St>(mut self, scopes: I) -> CombinedAudienceListCall<'a, C>
39966    where
39967        I: IntoIterator<Item = St>,
39968        St: AsRef<str>,
39969    {
39970        self._scopes
39971            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
39972        self
39973    }
39974
39975    /// Removes all scopes, and no default scope will be used either.
39976    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
39977    /// for details).
39978    pub fn clear_scopes(mut self) -> CombinedAudienceListCall<'a, C> {
39979        self._scopes.clear();
39980        self
39981    }
39982}
39983
39984/// Creates a new custom bidding script. Returns the newly created script if successful.
39985///
39986/// A builder for the *scripts.create* method supported by a *customBiddingAlgorithm* resource.
39987/// It is not used directly, but through a [`CustomBiddingAlgorithmMethods`] instance.
39988///
39989/// # Example
39990///
39991/// Instantiate a resource method builder
39992///
39993/// ```test_harness,no_run
39994/// # extern crate hyper;
39995/// # extern crate hyper_rustls;
39996/// # extern crate google_displayvideo1 as displayvideo1;
39997/// use displayvideo1::api::CustomBiddingScript;
39998/// # async fn dox() {
39999/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
40000///
40001/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
40002/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
40003/// #     secret,
40004/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
40005/// # ).build().await.unwrap();
40006///
40007/// # let client = hyper_util::client::legacy::Client::builder(
40008/// #     hyper_util::rt::TokioExecutor::new()
40009/// # )
40010/// # .build(
40011/// #     hyper_rustls::HttpsConnectorBuilder::new()
40012/// #         .with_native_roots()
40013/// #         .unwrap()
40014/// #         .https_or_http()
40015/// #         .enable_http1()
40016/// #         .build()
40017/// # );
40018/// # let mut hub = DisplayVideo::new(client, auth);
40019/// // As the method needs a request, you would usually fill it with the desired information
40020/// // into the respective structure. Some of the parts shown here might not be applicable !
40021/// // Values shown here are possibly random and not representative !
40022/// let mut req = CustomBiddingScript::default();
40023///
40024/// // You can configure optional parameters by calling the respective setters at will, and
40025/// // execute the final call using `doit()`.
40026/// // Values shown here are possibly random and not representative !
40027/// let result = hub.custom_bidding_algorithms().scripts_create(req, -81)
40028///              .partner_id(-71)
40029///              .advertiser_id(-5)
40030///              .doit().await;
40031/// # }
40032/// ```
40033pub struct CustomBiddingAlgorithmScriptCreateCall<'a, C>
40034where
40035    C: 'a,
40036{
40037    hub: &'a DisplayVideo<C>,
40038    _request: CustomBiddingScript,
40039    _custom_bidding_algorithm_id: i64,
40040    _partner_id: Option<i64>,
40041    _advertiser_id: Option<i64>,
40042    _delegate: Option<&'a mut dyn common::Delegate>,
40043    _additional_params: HashMap<String, String>,
40044    _scopes: BTreeSet<String>,
40045}
40046
40047impl<'a, C> common::CallBuilder for CustomBiddingAlgorithmScriptCreateCall<'a, C> {}
40048
40049impl<'a, C> CustomBiddingAlgorithmScriptCreateCall<'a, C>
40050where
40051    C: common::Connector,
40052{
40053    /// Perform the operation you have build so far.
40054    pub async fn doit(mut self) -> common::Result<(common::Response, CustomBiddingScript)> {
40055        use std::borrow::Cow;
40056        use std::io::{Read, Seek};
40057
40058        use common::{url::Params, ToParts};
40059        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
40060
40061        let mut dd = common::DefaultDelegate;
40062        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
40063        dlg.begin(common::MethodInfo {
40064            id: "displayvideo.customBiddingAlgorithms.scripts.create",
40065            http_method: hyper::Method::POST,
40066        });
40067
40068        for &field in [
40069            "alt",
40070            "customBiddingAlgorithmId",
40071            "partnerId",
40072            "advertiserId",
40073        ]
40074        .iter()
40075        {
40076            if self._additional_params.contains_key(field) {
40077                dlg.finished(false);
40078                return Err(common::Error::FieldClash(field));
40079            }
40080        }
40081
40082        let mut params = Params::with_capacity(6 + self._additional_params.len());
40083        params.push(
40084            "customBiddingAlgorithmId",
40085            self._custom_bidding_algorithm_id.to_string(),
40086        );
40087        if let Some(value) = self._partner_id.as_ref() {
40088            params.push("partnerId", value.to_string());
40089        }
40090        if let Some(value) = self._advertiser_id.as_ref() {
40091            params.push("advertiserId", value.to_string());
40092        }
40093
40094        params.extend(self._additional_params.iter());
40095
40096        params.push("alt", "json");
40097        let mut url = self.hub._base_url.clone()
40098            + "v1/customBiddingAlgorithms/{+customBiddingAlgorithmId}/scripts";
40099        if self._scopes.is_empty() {
40100            self._scopes
40101                .insert(Scope::DisplayVideo.as_ref().to_string());
40102        }
40103
40104        #[allow(clippy::single_element_loop)]
40105        for &(find_this, param_name) in
40106            [("{+customBiddingAlgorithmId}", "customBiddingAlgorithmId")].iter()
40107        {
40108            url = params.uri_replacement(url, param_name, find_this, true);
40109        }
40110        {
40111            let to_remove = ["customBiddingAlgorithmId"];
40112            params.remove_params(&to_remove);
40113        }
40114
40115        let url = params.parse_with_url(&url);
40116
40117        let mut json_mime_type = mime::APPLICATION_JSON;
40118        let mut request_value_reader = {
40119            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
40120            common::remove_json_null_values(&mut value);
40121            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
40122            serde_json::to_writer(&mut dst, &value).unwrap();
40123            dst
40124        };
40125        let request_size = request_value_reader
40126            .seek(std::io::SeekFrom::End(0))
40127            .unwrap();
40128        request_value_reader
40129            .seek(std::io::SeekFrom::Start(0))
40130            .unwrap();
40131
40132        loop {
40133            let token = match self
40134                .hub
40135                .auth
40136                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
40137                .await
40138            {
40139                Ok(token) => token,
40140                Err(e) => match dlg.token(e) {
40141                    Ok(token) => token,
40142                    Err(e) => {
40143                        dlg.finished(false);
40144                        return Err(common::Error::MissingToken(e));
40145                    }
40146                },
40147            };
40148            request_value_reader
40149                .seek(std::io::SeekFrom::Start(0))
40150                .unwrap();
40151            let mut req_result = {
40152                let client = &self.hub.client;
40153                dlg.pre_request();
40154                let mut req_builder = hyper::Request::builder()
40155                    .method(hyper::Method::POST)
40156                    .uri(url.as_str())
40157                    .header(USER_AGENT, self.hub._user_agent.clone());
40158
40159                if let Some(token) = token.as_ref() {
40160                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
40161                }
40162
40163                let request = req_builder
40164                    .header(CONTENT_TYPE, json_mime_type.to_string())
40165                    .header(CONTENT_LENGTH, request_size as u64)
40166                    .body(common::to_body(
40167                        request_value_reader.get_ref().clone().into(),
40168                    ));
40169
40170                client.request(request.unwrap()).await
40171            };
40172
40173            match req_result {
40174                Err(err) => {
40175                    if let common::Retry::After(d) = dlg.http_error(&err) {
40176                        sleep(d).await;
40177                        continue;
40178                    }
40179                    dlg.finished(false);
40180                    return Err(common::Error::HttpError(err));
40181                }
40182                Ok(res) => {
40183                    let (mut parts, body) = res.into_parts();
40184                    let mut body = common::Body::new(body);
40185                    if !parts.status.is_success() {
40186                        let bytes = common::to_bytes(body).await.unwrap_or_default();
40187                        let error = serde_json::from_str(&common::to_string(&bytes));
40188                        let response = common::to_response(parts, bytes.into());
40189
40190                        if let common::Retry::After(d) =
40191                            dlg.http_failure(&response, error.as_ref().ok())
40192                        {
40193                            sleep(d).await;
40194                            continue;
40195                        }
40196
40197                        dlg.finished(false);
40198
40199                        return Err(match error {
40200                            Ok(value) => common::Error::BadRequest(value),
40201                            _ => common::Error::Failure(response),
40202                        });
40203                    }
40204                    let response = {
40205                        let bytes = common::to_bytes(body).await.unwrap_or_default();
40206                        let encoded = common::to_string(&bytes);
40207                        match serde_json::from_str(&encoded) {
40208                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
40209                            Err(error) => {
40210                                dlg.response_json_decode_error(&encoded, &error);
40211                                return Err(common::Error::JsonDecodeError(
40212                                    encoded.to_string(),
40213                                    error,
40214                                ));
40215                            }
40216                        }
40217                    };
40218
40219                    dlg.finished(true);
40220                    return Ok(response);
40221                }
40222            }
40223        }
40224    }
40225
40226    ///
40227    /// Sets the *request* property to the given value.
40228    ///
40229    /// Even though the property as already been set when instantiating this call,
40230    /// we provide this method for API completeness.
40231    pub fn request(
40232        mut self,
40233        new_value: CustomBiddingScript,
40234    ) -> CustomBiddingAlgorithmScriptCreateCall<'a, C> {
40235        self._request = new_value;
40236        self
40237    }
40238    /// Required. The ID of the custom bidding algorithm that owns the script.
40239    ///
40240    /// Sets the *custom bidding algorithm id* path property to the given value.
40241    ///
40242    /// Even though the property as already been set when instantiating this call,
40243    /// we provide this method for API completeness.
40244    pub fn custom_bidding_algorithm_id(
40245        mut self,
40246        new_value: i64,
40247    ) -> CustomBiddingAlgorithmScriptCreateCall<'a, C> {
40248        self._custom_bidding_algorithm_id = new_value;
40249        self
40250    }
40251    /// The ID of the partner that owns the parent custom bidding algorithm. Only this partner will have write access to this custom bidding script.
40252    ///
40253    /// Sets the *partner id* query property to the given value.
40254    pub fn partner_id(mut self, new_value: i64) -> CustomBiddingAlgorithmScriptCreateCall<'a, C> {
40255        self._partner_id = Some(new_value);
40256        self
40257    }
40258    /// The ID of the advertiser that owns the parent custom bidding algorithm.
40259    ///
40260    /// Sets the *advertiser id* query property to the given value.
40261    pub fn advertiser_id(
40262        mut self,
40263        new_value: i64,
40264    ) -> CustomBiddingAlgorithmScriptCreateCall<'a, C> {
40265        self._advertiser_id = Some(new_value);
40266        self
40267    }
40268    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
40269    /// while executing the actual API request.
40270    ///
40271    /// ````text
40272    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
40273    /// ````
40274    ///
40275    /// Sets the *delegate* property to the given value.
40276    pub fn delegate(
40277        mut self,
40278        new_value: &'a mut dyn common::Delegate,
40279    ) -> CustomBiddingAlgorithmScriptCreateCall<'a, C> {
40280        self._delegate = Some(new_value);
40281        self
40282    }
40283
40284    /// Set any additional parameter of the query string used in the request.
40285    /// It should be used to set parameters which are not yet available through their own
40286    /// setters.
40287    ///
40288    /// Please note that this method must not be used to set any of the known parameters
40289    /// which have their own setter method. If done anyway, the request will fail.
40290    ///
40291    /// # Additional Parameters
40292    ///
40293    /// * *$.xgafv* (query-string) - V1 error format.
40294    /// * *access_token* (query-string) - OAuth access token.
40295    /// * *alt* (query-string) - Data format for response.
40296    /// * *callback* (query-string) - JSONP
40297    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
40298    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
40299    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
40300    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
40301    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
40302    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
40303    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
40304    pub fn param<T>(mut self, name: T, value: T) -> CustomBiddingAlgorithmScriptCreateCall<'a, C>
40305    where
40306        T: AsRef<str>,
40307    {
40308        self._additional_params
40309            .insert(name.as_ref().to_string(), value.as_ref().to_string());
40310        self
40311    }
40312
40313    /// Identifies the authorization scope for the method you are building.
40314    ///
40315    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
40316    /// [`Scope::DisplayVideo`].
40317    ///
40318    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
40319    /// tokens for more than one scope.
40320    ///
40321    /// Usually there is more than one suitable scope to authorize an operation, some of which may
40322    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
40323    /// sufficient, a read-write scope will do as well.
40324    pub fn add_scope<St>(mut self, scope: St) -> CustomBiddingAlgorithmScriptCreateCall<'a, C>
40325    where
40326        St: AsRef<str>,
40327    {
40328        self._scopes.insert(String::from(scope.as_ref()));
40329        self
40330    }
40331    /// Identifies the authorization scope(s) for the method you are building.
40332    ///
40333    /// See [`Self::add_scope()`] for details.
40334    pub fn add_scopes<I, St>(mut self, scopes: I) -> CustomBiddingAlgorithmScriptCreateCall<'a, C>
40335    where
40336        I: IntoIterator<Item = St>,
40337        St: AsRef<str>,
40338    {
40339        self._scopes
40340            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
40341        self
40342    }
40343
40344    /// Removes all scopes, and no default scope will be used either.
40345    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
40346    /// for details).
40347    pub fn clear_scopes(mut self) -> CustomBiddingAlgorithmScriptCreateCall<'a, C> {
40348        self._scopes.clear();
40349        self
40350    }
40351}
40352
40353/// Gets a custom bidding script.
40354///
40355/// A builder for the *scripts.get* method supported by a *customBiddingAlgorithm* resource.
40356/// It is not used directly, but through a [`CustomBiddingAlgorithmMethods`] instance.
40357///
40358/// # Example
40359///
40360/// Instantiate a resource method builder
40361///
40362/// ```test_harness,no_run
40363/// # extern crate hyper;
40364/// # extern crate hyper_rustls;
40365/// # extern crate google_displayvideo1 as displayvideo1;
40366/// # async fn dox() {
40367/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
40368///
40369/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
40370/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
40371/// #     secret,
40372/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
40373/// # ).build().await.unwrap();
40374///
40375/// # let client = hyper_util::client::legacy::Client::builder(
40376/// #     hyper_util::rt::TokioExecutor::new()
40377/// # )
40378/// # .build(
40379/// #     hyper_rustls::HttpsConnectorBuilder::new()
40380/// #         .with_native_roots()
40381/// #         .unwrap()
40382/// #         .https_or_http()
40383/// #         .enable_http1()
40384/// #         .build()
40385/// # );
40386/// # let mut hub = DisplayVideo::new(client, auth);
40387/// // You can configure optional parameters by calling the respective setters at will, and
40388/// // execute the final call using `doit()`.
40389/// // Values shown here are possibly random and not representative !
40390/// let result = hub.custom_bidding_algorithms().scripts_get(-73, -19)
40391///              .partner_id(-96)
40392///              .advertiser_id(-11)
40393///              .doit().await;
40394/// # }
40395/// ```
40396pub struct CustomBiddingAlgorithmScriptGetCall<'a, C>
40397where
40398    C: 'a,
40399{
40400    hub: &'a DisplayVideo<C>,
40401    _custom_bidding_algorithm_id: i64,
40402    _custom_bidding_script_id: i64,
40403    _partner_id: Option<i64>,
40404    _advertiser_id: Option<i64>,
40405    _delegate: Option<&'a mut dyn common::Delegate>,
40406    _additional_params: HashMap<String, String>,
40407    _scopes: BTreeSet<String>,
40408}
40409
40410impl<'a, C> common::CallBuilder for CustomBiddingAlgorithmScriptGetCall<'a, C> {}
40411
40412impl<'a, C> CustomBiddingAlgorithmScriptGetCall<'a, C>
40413where
40414    C: common::Connector,
40415{
40416    /// Perform the operation you have build so far.
40417    pub async fn doit(mut self) -> common::Result<(common::Response, CustomBiddingScript)> {
40418        use std::borrow::Cow;
40419        use std::io::{Read, Seek};
40420
40421        use common::{url::Params, ToParts};
40422        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
40423
40424        let mut dd = common::DefaultDelegate;
40425        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
40426        dlg.begin(common::MethodInfo {
40427            id: "displayvideo.customBiddingAlgorithms.scripts.get",
40428            http_method: hyper::Method::GET,
40429        });
40430
40431        for &field in [
40432            "alt",
40433            "customBiddingAlgorithmId",
40434            "customBiddingScriptId",
40435            "partnerId",
40436            "advertiserId",
40437        ]
40438        .iter()
40439        {
40440            if self._additional_params.contains_key(field) {
40441                dlg.finished(false);
40442                return Err(common::Error::FieldClash(field));
40443            }
40444        }
40445
40446        let mut params = Params::with_capacity(6 + self._additional_params.len());
40447        params.push(
40448            "customBiddingAlgorithmId",
40449            self._custom_bidding_algorithm_id.to_string(),
40450        );
40451        params.push(
40452            "customBiddingScriptId",
40453            self._custom_bidding_script_id.to_string(),
40454        );
40455        if let Some(value) = self._partner_id.as_ref() {
40456            params.push("partnerId", value.to_string());
40457        }
40458        if let Some(value) = self._advertiser_id.as_ref() {
40459            params.push("advertiserId", value.to_string());
40460        }
40461
40462        params.extend(self._additional_params.iter());
40463
40464        params.push("alt", "json");
40465        let mut url = self.hub._base_url.clone() + "v1/customBiddingAlgorithms/{+customBiddingAlgorithmId}/scripts/{+customBiddingScriptId}";
40466        if self._scopes.is_empty() {
40467            self._scopes
40468                .insert(Scope::DisplayVideo.as_ref().to_string());
40469        }
40470
40471        #[allow(clippy::single_element_loop)]
40472        for &(find_this, param_name) in [
40473            ("{+customBiddingAlgorithmId}", "customBiddingAlgorithmId"),
40474            ("{+customBiddingScriptId}", "customBiddingScriptId"),
40475        ]
40476        .iter()
40477        {
40478            url = params.uri_replacement(url, param_name, find_this, true);
40479        }
40480        {
40481            let to_remove = ["customBiddingScriptId", "customBiddingAlgorithmId"];
40482            params.remove_params(&to_remove);
40483        }
40484
40485        let url = params.parse_with_url(&url);
40486
40487        loop {
40488            let token = match self
40489                .hub
40490                .auth
40491                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
40492                .await
40493            {
40494                Ok(token) => token,
40495                Err(e) => match dlg.token(e) {
40496                    Ok(token) => token,
40497                    Err(e) => {
40498                        dlg.finished(false);
40499                        return Err(common::Error::MissingToken(e));
40500                    }
40501                },
40502            };
40503            let mut req_result = {
40504                let client = &self.hub.client;
40505                dlg.pre_request();
40506                let mut req_builder = hyper::Request::builder()
40507                    .method(hyper::Method::GET)
40508                    .uri(url.as_str())
40509                    .header(USER_AGENT, self.hub._user_agent.clone());
40510
40511                if let Some(token) = token.as_ref() {
40512                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
40513                }
40514
40515                let request = req_builder
40516                    .header(CONTENT_LENGTH, 0_u64)
40517                    .body(common::to_body::<String>(None));
40518
40519                client.request(request.unwrap()).await
40520            };
40521
40522            match req_result {
40523                Err(err) => {
40524                    if let common::Retry::After(d) = dlg.http_error(&err) {
40525                        sleep(d).await;
40526                        continue;
40527                    }
40528                    dlg.finished(false);
40529                    return Err(common::Error::HttpError(err));
40530                }
40531                Ok(res) => {
40532                    let (mut parts, body) = res.into_parts();
40533                    let mut body = common::Body::new(body);
40534                    if !parts.status.is_success() {
40535                        let bytes = common::to_bytes(body).await.unwrap_or_default();
40536                        let error = serde_json::from_str(&common::to_string(&bytes));
40537                        let response = common::to_response(parts, bytes.into());
40538
40539                        if let common::Retry::After(d) =
40540                            dlg.http_failure(&response, error.as_ref().ok())
40541                        {
40542                            sleep(d).await;
40543                            continue;
40544                        }
40545
40546                        dlg.finished(false);
40547
40548                        return Err(match error {
40549                            Ok(value) => common::Error::BadRequest(value),
40550                            _ => common::Error::Failure(response),
40551                        });
40552                    }
40553                    let response = {
40554                        let bytes = common::to_bytes(body).await.unwrap_or_default();
40555                        let encoded = common::to_string(&bytes);
40556                        match serde_json::from_str(&encoded) {
40557                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
40558                            Err(error) => {
40559                                dlg.response_json_decode_error(&encoded, &error);
40560                                return Err(common::Error::JsonDecodeError(
40561                                    encoded.to_string(),
40562                                    error,
40563                                ));
40564                            }
40565                        }
40566                    };
40567
40568                    dlg.finished(true);
40569                    return Ok(response);
40570                }
40571            }
40572        }
40573    }
40574
40575    /// Required. The ID of the custom bidding algorithm owns the script.
40576    ///
40577    /// Sets the *custom bidding algorithm id* path property to the given value.
40578    ///
40579    /// Even though the property as already been set when instantiating this call,
40580    /// we provide this method for API completeness.
40581    pub fn custom_bidding_algorithm_id(
40582        mut self,
40583        new_value: i64,
40584    ) -> CustomBiddingAlgorithmScriptGetCall<'a, C> {
40585        self._custom_bidding_algorithm_id = new_value;
40586        self
40587    }
40588    /// Required. The ID of the custom bidding script to fetch.
40589    ///
40590    /// Sets the *custom bidding script id* path property to the given value.
40591    ///
40592    /// Even though the property as already been set when instantiating this call,
40593    /// we provide this method for API completeness.
40594    pub fn custom_bidding_script_id(
40595        mut self,
40596        new_value: i64,
40597    ) -> CustomBiddingAlgorithmScriptGetCall<'a, C> {
40598        self._custom_bidding_script_id = new_value;
40599        self
40600    }
40601    /// The ID of the partner that owns the parent custom bidding algorithm. Only this partner will have write access to this custom bidding script.
40602    ///
40603    /// Sets the *partner id* query property to the given value.
40604    pub fn partner_id(mut self, new_value: i64) -> CustomBiddingAlgorithmScriptGetCall<'a, C> {
40605        self._partner_id = Some(new_value);
40606        self
40607    }
40608    /// The ID of the advertiser that owns the parent custom bidding algorithm.
40609    ///
40610    /// Sets the *advertiser id* query property to the given value.
40611    pub fn advertiser_id(mut self, new_value: i64) -> CustomBiddingAlgorithmScriptGetCall<'a, C> {
40612        self._advertiser_id = Some(new_value);
40613        self
40614    }
40615    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
40616    /// while executing the actual API request.
40617    ///
40618    /// ````text
40619    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
40620    /// ````
40621    ///
40622    /// Sets the *delegate* property to the given value.
40623    pub fn delegate(
40624        mut self,
40625        new_value: &'a mut dyn common::Delegate,
40626    ) -> CustomBiddingAlgorithmScriptGetCall<'a, C> {
40627        self._delegate = Some(new_value);
40628        self
40629    }
40630
40631    /// Set any additional parameter of the query string used in the request.
40632    /// It should be used to set parameters which are not yet available through their own
40633    /// setters.
40634    ///
40635    /// Please note that this method must not be used to set any of the known parameters
40636    /// which have their own setter method. If done anyway, the request will fail.
40637    ///
40638    /// # Additional Parameters
40639    ///
40640    /// * *$.xgafv* (query-string) - V1 error format.
40641    /// * *access_token* (query-string) - OAuth access token.
40642    /// * *alt* (query-string) - Data format for response.
40643    /// * *callback* (query-string) - JSONP
40644    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
40645    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
40646    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
40647    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
40648    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
40649    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
40650    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
40651    pub fn param<T>(mut self, name: T, value: T) -> CustomBiddingAlgorithmScriptGetCall<'a, C>
40652    where
40653        T: AsRef<str>,
40654    {
40655        self._additional_params
40656            .insert(name.as_ref().to_string(), value.as_ref().to_string());
40657        self
40658    }
40659
40660    /// Identifies the authorization scope for the method you are building.
40661    ///
40662    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
40663    /// [`Scope::DisplayVideo`].
40664    ///
40665    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
40666    /// tokens for more than one scope.
40667    ///
40668    /// Usually there is more than one suitable scope to authorize an operation, some of which may
40669    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
40670    /// sufficient, a read-write scope will do as well.
40671    pub fn add_scope<St>(mut self, scope: St) -> CustomBiddingAlgorithmScriptGetCall<'a, C>
40672    where
40673        St: AsRef<str>,
40674    {
40675        self._scopes.insert(String::from(scope.as_ref()));
40676        self
40677    }
40678    /// Identifies the authorization scope(s) for the method you are building.
40679    ///
40680    /// See [`Self::add_scope()`] for details.
40681    pub fn add_scopes<I, St>(mut self, scopes: I) -> CustomBiddingAlgorithmScriptGetCall<'a, C>
40682    where
40683        I: IntoIterator<Item = St>,
40684        St: AsRef<str>,
40685    {
40686        self._scopes
40687            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
40688        self
40689    }
40690
40691    /// Removes all scopes, and no default scope will be used either.
40692    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
40693    /// for details).
40694    pub fn clear_scopes(mut self) -> CustomBiddingAlgorithmScriptGetCall<'a, C> {
40695        self._scopes.clear();
40696        self
40697    }
40698}
40699
40700/// Lists custom bidding scripts that belong to the given algorithm. The order is defined by the order_by parameter.
40701///
40702/// A builder for the *scripts.list* method supported by a *customBiddingAlgorithm* resource.
40703/// It is not used directly, but through a [`CustomBiddingAlgorithmMethods`] instance.
40704///
40705/// # Example
40706///
40707/// Instantiate a resource method builder
40708///
40709/// ```test_harness,no_run
40710/// # extern crate hyper;
40711/// # extern crate hyper_rustls;
40712/// # extern crate google_displayvideo1 as displayvideo1;
40713/// # async fn dox() {
40714/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
40715///
40716/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
40717/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
40718/// #     secret,
40719/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
40720/// # ).build().await.unwrap();
40721///
40722/// # let client = hyper_util::client::legacy::Client::builder(
40723/// #     hyper_util::rt::TokioExecutor::new()
40724/// # )
40725/// # .build(
40726/// #     hyper_rustls::HttpsConnectorBuilder::new()
40727/// #         .with_native_roots()
40728/// #         .unwrap()
40729/// #         .https_or_http()
40730/// #         .enable_http1()
40731/// #         .build()
40732/// # );
40733/// # let mut hub = DisplayVideo::new(client, auth);
40734/// // You can configure optional parameters by calling the respective setters at will, and
40735/// // execute the final call using `doit()`.
40736/// // Values shown here are possibly random and not representative !
40737/// let result = hub.custom_bidding_algorithms().scripts_list(-21)
40738///              .partner_id(-45)
40739///              .page_token("diam")
40740///              .page_size(-10)
40741///              .order_by("ipsum")
40742///              .advertiser_id(-15)
40743///              .doit().await;
40744/// # }
40745/// ```
40746pub struct CustomBiddingAlgorithmScriptListCall<'a, C>
40747where
40748    C: 'a,
40749{
40750    hub: &'a DisplayVideo<C>,
40751    _custom_bidding_algorithm_id: i64,
40752    _partner_id: Option<i64>,
40753    _page_token: Option<String>,
40754    _page_size: Option<i32>,
40755    _order_by: Option<String>,
40756    _advertiser_id: Option<i64>,
40757    _delegate: Option<&'a mut dyn common::Delegate>,
40758    _additional_params: HashMap<String, String>,
40759    _scopes: BTreeSet<String>,
40760}
40761
40762impl<'a, C> common::CallBuilder for CustomBiddingAlgorithmScriptListCall<'a, C> {}
40763
40764impl<'a, C> CustomBiddingAlgorithmScriptListCall<'a, C>
40765where
40766    C: common::Connector,
40767{
40768    /// Perform the operation you have build so far.
40769    pub async fn doit(
40770        mut self,
40771    ) -> common::Result<(common::Response, ListCustomBiddingScriptsResponse)> {
40772        use std::borrow::Cow;
40773        use std::io::{Read, Seek};
40774
40775        use common::{url::Params, ToParts};
40776        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
40777
40778        let mut dd = common::DefaultDelegate;
40779        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
40780        dlg.begin(common::MethodInfo {
40781            id: "displayvideo.customBiddingAlgorithms.scripts.list",
40782            http_method: hyper::Method::GET,
40783        });
40784
40785        for &field in [
40786            "alt",
40787            "customBiddingAlgorithmId",
40788            "partnerId",
40789            "pageToken",
40790            "pageSize",
40791            "orderBy",
40792            "advertiserId",
40793        ]
40794        .iter()
40795        {
40796            if self._additional_params.contains_key(field) {
40797                dlg.finished(false);
40798                return Err(common::Error::FieldClash(field));
40799            }
40800        }
40801
40802        let mut params = Params::with_capacity(8 + self._additional_params.len());
40803        params.push(
40804            "customBiddingAlgorithmId",
40805            self._custom_bidding_algorithm_id.to_string(),
40806        );
40807        if let Some(value) = self._partner_id.as_ref() {
40808            params.push("partnerId", value.to_string());
40809        }
40810        if let Some(value) = self._page_token.as_ref() {
40811            params.push("pageToken", value);
40812        }
40813        if let Some(value) = self._page_size.as_ref() {
40814            params.push("pageSize", value.to_string());
40815        }
40816        if let Some(value) = self._order_by.as_ref() {
40817            params.push("orderBy", value);
40818        }
40819        if let Some(value) = self._advertiser_id.as_ref() {
40820            params.push("advertiserId", value.to_string());
40821        }
40822
40823        params.extend(self._additional_params.iter());
40824
40825        params.push("alt", "json");
40826        let mut url = self.hub._base_url.clone()
40827            + "v1/customBiddingAlgorithms/{+customBiddingAlgorithmId}/scripts";
40828        if self._scopes.is_empty() {
40829            self._scopes
40830                .insert(Scope::DisplayVideo.as_ref().to_string());
40831        }
40832
40833        #[allow(clippy::single_element_loop)]
40834        for &(find_this, param_name) in
40835            [("{+customBiddingAlgorithmId}", "customBiddingAlgorithmId")].iter()
40836        {
40837            url = params.uri_replacement(url, param_name, find_this, true);
40838        }
40839        {
40840            let to_remove = ["customBiddingAlgorithmId"];
40841            params.remove_params(&to_remove);
40842        }
40843
40844        let url = params.parse_with_url(&url);
40845
40846        loop {
40847            let token = match self
40848                .hub
40849                .auth
40850                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
40851                .await
40852            {
40853                Ok(token) => token,
40854                Err(e) => match dlg.token(e) {
40855                    Ok(token) => token,
40856                    Err(e) => {
40857                        dlg.finished(false);
40858                        return Err(common::Error::MissingToken(e));
40859                    }
40860                },
40861            };
40862            let mut req_result = {
40863                let client = &self.hub.client;
40864                dlg.pre_request();
40865                let mut req_builder = hyper::Request::builder()
40866                    .method(hyper::Method::GET)
40867                    .uri(url.as_str())
40868                    .header(USER_AGENT, self.hub._user_agent.clone());
40869
40870                if let Some(token) = token.as_ref() {
40871                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
40872                }
40873
40874                let request = req_builder
40875                    .header(CONTENT_LENGTH, 0_u64)
40876                    .body(common::to_body::<String>(None));
40877
40878                client.request(request.unwrap()).await
40879            };
40880
40881            match req_result {
40882                Err(err) => {
40883                    if let common::Retry::After(d) = dlg.http_error(&err) {
40884                        sleep(d).await;
40885                        continue;
40886                    }
40887                    dlg.finished(false);
40888                    return Err(common::Error::HttpError(err));
40889                }
40890                Ok(res) => {
40891                    let (mut parts, body) = res.into_parts();
40892                    let mut body = common::Body::new(body);
40893                    if !parts.status.is_success() {
40894                        let bytes = common::to_bytes(body).await.unwrap_or_default();
40895                        let error = serde_json::from_str(&common::to_string(&bytes));
40896                        let response = common::to_response(parts, bytes.into());
40897
40898                        if let common::Retry::After(d) =
40899                            dlg.http_failure(&response, error.as_ref().ok())
40900                        {
40901                            sleep(d).await;
40902                            continue;
40903                        }
40904
40905                        dlg.finished(false);
40906
40907                        return Err(match error {
40908                            Ok(value) => common::Error::BadRequest(value),
40909                            _ => common::Error::Failure(response),
40910                        });
40911                    }
40912                    let response = {
40913                        let bytes = common::to_bytes(body).await.unwrap_or_default();
40914                        let encoded = common::to_string(&bytes);
40915                        match serde_json::from_str(&encoded) {
40916                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
40917                            Err(error) => {
40918                                dlg.response_json_decode_error(&encoded, &error);
40919                                return Err(common::Error::JsonDecodeError(
40920                                    encoded.to_string(),
40921                                    error,
40922                                ));
40923                            }
40924                        }
40925                    };
40926
40927                    dlg.finished(true);
40928                    return Ok(response);
40929                }
40930            }
40931        }
40932    }
40933
40934    /// Required. The ID of the custom bidding algorithm owns the script.
40935    ///
40936    /// Sets the *custom bidding algorithm id* path property to the given value.
40937    ///
40938    /// Even though the property as already been set when instantiating this call,
40939    /// we provide this method for API completeness.
40940    pub fn custom_bidding_algorithm_id(
40941        mut self,
40942        new_value: i64,
40943    ) -> CustomBiddingAlgorithmScriptListCall<'a, C> {
40944        self._custom_bidding_algorithm_id = new_value;
40945        self
40946    }
40947    /// The ID of the partner that owns the parent custom bidding algorithm. Only this partner will have write access to this custom bidding script.
40948    ///
40949    /// Sets the *partner id* query property to the given value.
40950    pub fn partner_id(mut self, new_value: i64) -> CustomBiddingAlgorithmScriptListCall<'a, C> {
40951        self._partner_id = Some(new_value);
40952        self
40953    }
40954    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListCustomBiddingScripts` method. If not specified, the first page of results will be returned.
40955    ///
40956    /// Sets the *page token* query property to the given value.
40957    pub fn page_token(mut self, new_value: &str) -> CustomBiddingAlgorithmScriptListCall<'a, C> {
40958        self._page_token = Some(new_value.to_string());
40959        self
40960    }
40961    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
40962    ///
40963    /// Sets the *page size* query property to the given value.
40964    pub fn page_size(mut self, new_value: i32) -> CustomBiddingAlgorithmScriptListCall<'a, C> {
40965        self._page_size = Some(new_value);
40966        self
40967    }
40968    /// Field by which to sort the list. Acceptable values are: * `createTime desc` (default) The default sorting order is descending. To specify ascending order for a field, the suffix "desc" should be removed. Example: `createTime`.
40969    ///
40970    /// Sets the *order by* query property to the given value.
40971    pub fn order_by(mut self, new_value: &str) -> CustomBiddingAlgorithmScriptListCall<'a, C> {
40972        self._order_by = Some(new_value.to_string());
40973        self
40974    }
40975    /// The ID of the advertiser that owns the parent custom bidding algorithm.
40976    ///
40977    /// Sets the *advertiser id* query property to the given value.
40978    pub fn advertiser_id(mut self, new_value: i64) -> CustomBiddingAlgorithmScriptListCall<'a, C> {
40979        self._advertiser_id = Some(new_value);
40980        self
40981    }
40982    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
40983    /// while executing the actual API request.
40984    ///
40985    /// ````text
40986    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
40987    /// ````
40988    ///
40989    /// Sets the *delegate* property to the given value.
40990    pub fn delegate(
40991        mut self,
40992        new_value: &'a mut dyn common::Delegate,
40993    ) -> CustomBiddingAlgorithmScriptListCall<'a, C> {
40994        self._delegate = Some(new_value);
40995        self
40996    }
40997
40998    /// Set any additional parameter of the query string used in the request.
40999    /// It should be used to set parameters which are not yet available through their own
41000    /// setters.
41001    ///
41002    /// Please note that this method must not be used to set any of the known parameters
41003    /// which have their own setter method. If done anyway, the request will fail.
41004    ///
41005    /// # Additional Parameters
41006    ///
41007    /// * *$.xgafv* (query-string) - V1 error format.
41008    /// * *access_token* (query-string) - OAuth access token.
41009    /// * *alt* (query-string) - Data format for response.
41010    /// * *callback* (query-string) - JSONP
41011    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
41012    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
41013    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
41014    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
41015    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
41016    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
41017    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
41018    pub fn param<T>(mut self, name: T, value: T) -> CustomBiddingAlgorithmScriptListCall<'a, C>
41019    where
41020        T: AsRef<str>,
41021    {
41022        self._additional_params
41023            .insert(name.as_ref().to_string(), value.as_ref().to_string());
41024        self
41025    }
41026
41027    /// Identifies the authorization scope for the method you are building.
41028    ///
41029    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
41030    /// [`Scope::DisplayVideo`].
41031    ///
41032    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
41033    /// tokens for more than one scope.
41034    ///
41035    /// Usually there is more than one suitable scope to authorize an operation, some of which may
41036    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
41037    /// sufficient, a read-write scope will do as well.
41038    pub fn add_scope<St>(mut self, scope: St) -> CustomBiddingAlgorithmScriptListCall<'a, C>
41039    where
41040        St: AsRef<str>,
41041    {
41042        self._scopes.insert(String::from(scope.as_ref()));
41043        self
41044    }
41045    /// Identifies the authorization scope(s) for the method you are building.
41046    ///
41047    /// See [`Self::add_scope()`] for details.
41048    pub fn add_scopes<I, St>(mut self, scopes: I) -> CustomBiddingAlgorithmScriptListCall<'a, C>
41049    where
41050        I: IntoIterator<Item = St>,
41051        St: AsRef<str>,
41052    {
41053        self._scopes
41054            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
41055        self
41056    }
41057
41058    /// Removes all scopes, and no default scope will be used either.
41059    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
41060    /// for details).
41061    pub fn clear_scopes(mut self) -> CustomBiddingAlgorithmScriptListCall<'a, C> {
41062        self._scopes.clear();
41063        self
41064    }
41065}
41066
41067/// Creates a new custom bidding algorithm. Returns the newly created custom bidding algorithm if successful.
41068///
41069/// A builder for the *create* method supported by a *customBiddingAlgorithm* resource.
41070/// It is not used directly, but through a [`CustomBiddingAlgorithmMethods`] instance.
41071///
41072/// # Example
41073///
41074/// Instantiate a resource method builder
41075///
41076/// ```test_harness,no_run
41077/// # extern crate hyper;
41078/// # extern crate hyper_rustls;
41079/// # extern crate google_displayvideo1 as displayvideo1;
41080/// use displayvideo1::api::CustomBiddingAlgorithm;
41081/// # async fn dox() {
41082/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
41083///
41084/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
41085/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
41086/// #     secret,
41087/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
41088/// # ).build().await.unwrap();
41089///
41090/// # let client = hyper_util::client::legacy::Client::builder(
41091/// #     hyper_util::rt::TokioExecutor::new()
41092/// # )
41093/// # .build(
41094/// #     hyper_rustls::HttpsConnectorBuilder::new()
41095/// #         .with_native_roots()
41096/// #         .unwrap()
41097/// #         .https_or_http()
41098/// #         .enable_http1()
41099/// #         .build()
41100/// # );
41101/// # let mut hub = DisplayVideo::new(client, auth);
41102/// // As the method needs a request, you would usually fill it with the desired information
41103/// // into the respective structure. Some of the parts shown here might not be applicable !
41104/// // Values shown here are possibly random and not representative !
41105/// let mut req = CustomBiddingAlgorithm::default();
41106///
41107/// // You can configure optional parameters by calling the respective setters at will, and
41108/// // execute the final call using `doit()`.
41109/// // Values shown here are possibly random and not representative !
41110/// let result = hub.custom_bidding_algorithms().create(req)
41111///              .doit().await;
41112/// # }
41113/// ```
41114pub struct CustomBiddingAlgorithmCreateCall<'a, C>
41115where
41116    C: 'a,
41117{
41118    hub: &'a DisplayVideo<C>,
41119    _request: CustomBiddingAlgorithm,
41120    _delegate: Option<&'a mut dyn common::Delegate>,
41121    _additional_params: HashMap<String, String>,
41122    _scopes: BTreeSet<String>,
41123}
41124
41125impl<'a, C> common::CallBuilder for CustomBiddingAlgorithmCreateCall<'a, C> {}
41126
41127impl<'a, C> CustomBiddingAlgorithmCreateCall<'a, C>
41128where
41129    C: common::Connector,
41130{
41131    /// Perform the operation you have build so far.
41132    pub async fn doit(mut self) -> common::Result<(common::Response, CustomBiddingAlgorithm)> {
41133        use std::borrow::Cow;
41134        use std::io::{Read, Seek};
41135
41136        use common::{url::Params, ToParts};
41137        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
41138
41139        let mut dd = common::DefaultDelegate;
41140        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
41141        dlg.begin(common::MethodInfo {
41142            id: "displayvideo.customBiddingAlgorithms.create",
41143            http_method: hyper::Method::POST,
41144        });
41145
41146        for &field in ["alt"].iter() {
41147            if self._additional_params.contains_key(field) {
41148                dlg.finished(false);
41149                return Err(common::Error::FieldClash(field));
41150            }
41151        }
41152
41153        let mut params = Params::with_capacity(3 + self._additional_params.len());
41154
41155        params.extend(self._additional_params.iter());
41156
41157        params.push("alt", "json");
41158        let mut url = self.hub._base_url.clone() + "v1/customBiddingAlgorithms";
41159        if self._scopes.is_empty() {
41160            self._scopes
41161                .insert(Scope::DisplayVideo.as_ref().to_string());
41162        }
41163
41164        let url = params.parse_with_url(&url);
41165
41166        let mut json_mime_type = mime::APPLICATION_JSON;
41167        let mut request_value_reader = {
41168            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
41169            common::remove_json_null_values(&mut value);
41170            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
41171            serde_json::to_writer(&mut dst, &value).unwrap();
41172            dst
41173        };
41174        let request_size = request_value_reader
41175            .seek(std::io::SeekFrom::End(0))
41176            .unwrap();
41177        request_value_reader
41178            .seek(std::io::SeekFrom::Start(0))
41179            .unwrap();
41180
41181        loop {
41182            let token = match self
41183                .hub
41184                .auth
41185                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
41186                .await
41187            {
41188                Ok(token) => token,
41189                Err(e) => match dlg.token(e) {
41190                    Ok(token) => token,
41191                    Err(e) => {
41192                        dlg.finished(false);
41193                        return Err(common::Error::MissingToken(e));
41194                    }
41195                },
41196            };
41197            request_value_reader
41198                .seek(std::io::SeekFrom::Start(0))
41199                .unwrap();
41200            let mut req_result = {
41201                let client = &self.hub.client;
41202                dlg.pre_request();
41203                let mut req_builder = hyper::Request::builder()
41204                    .method(hyper::Method::POST)
41205                    .uri(url.as_str())
41206                    .header(USER_AGENT, self.hub._user_agent.clone());
41207
41208                if let Some(token) = token.as_ref() {
41209                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
41210                }
41211
41212                let request = req_builder
41213                    .header(CONTENT_TYPE, json_mime_type.to_string())
41214                    .header(CONTENT_LENGTH, request_size as u64)
41215                    .body(common::to_body(
41216                        request_value_reader.get_ref().clone().into(),
41217                    ));
41218
41219                client.request(request.unwrap()).await
41220            };
41221
41222            match req_result {
41223                Err(err) => {
41224                    if let common::Retry::After(d) = dlg.http_error(&err) {
41225                        sleep(d).await;
41226                        continue;
41227                    }
41228                    dlg.finished(false);
41229                    return Err(common::Error::HttpError(err));
41230                }
41231                Ok(res) => {
41232                    let (mut parts, body) = res.into_parts();
41233                    let mut body = common::Body::new(body);
41234                    if !parts.status.is_success() {
41235                        let bytes = common::to_bytes(body).await.unwrap_or_default();
41236                        let error = serde_json::from_str(&common::to_string(&bytes));
41237                        let response = common::to_response(parts, bytes.into());
41238
41239                        if let common::Retry::After(d) =
41240                            dlg.http_failure(&response, error.as_ref().ok())
41241                        {
41242                            sleep(d).await;
41243                            continue;
41244                        }
41245
41246                        dlg.finished(false);
41247
41248                        return Err(match error {
41249                            Ok(value) => common::Error::BadRequest(value),
41250                            _ => common::Error::Failure(response),
41251                        });
41252                    }
41253                    let response = {
41254                        let bytes = common::to_bytes(body).await.unwrap_or_default();
41255                        let encoded = common::to_string(&bytes);
41256                        match serde_json::from_str(&encoded) {
41257                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
41258                            Err(error) => {
41259                                dlg.response_json_decode_error(&encoded, &error);
41260                                return Err(common::Error::JsonDecodeError(
41261                                    encoded.to_string(),
41262                                    error,
41263                                ));
41264                            }
41265                        }
41266                    };
41267
41268                    dlg.finished(true);
41269                    return Ok(response);
41270                }
41271            }
41272        }
41273    }
41274
41275    ///
41276    /// Sets the *request* property to the given value.
41277    ///
41278    /// Even though the property as already been set when instantiating this call,
41279    /// we provide this method for API completeness.
41280    pub fn request(
41281        mut self,
41282        new_value: CustomBiddingAlgorithm,
41283    ) -> CustomBiddingAlgorithmCreateCall<'a, C> {
41284        self._request = new_value;
41285        self
41286    }
41287    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
41288    /// while executing the actual API request.
41289    ///
41290    /// ````text
41291    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
41292    /// ````
41293    ///
41294    /// Sets the *delegate* property to the given value.
41295    pub fn delegate(
41296        mut self,
41297        new_value: &'a mut dyn common::Delegate,
41298    ) -> CustomBiddingAlgorithmCreateCall<'a, C> {
41299        self._delegate = Some(new_value);
41300        self
41301    }
41302
41303    /// Set any additional parameter of the query string used in the request.
41304    /// It should be used to set parameters which are not yet available through their own
41305    /// setters.
41306    ///
41307    /// Please note that this method must not be used to set any of the known parameters
41308    /// which have their own setter method. If done anyway, the request will fail.
41309    ///
41310    /// # Additional Parameters
41311    ///
41312    /// * *$.xgafv* (query-string) - V1 error format.
41313    /// * *access_token* (query-string) - OAuth access token.
41314    /// * *alt* (query-string) - Data format for response.
41315    /// * *callback* (query-string) - JSONP
41316    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
41317    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
41318    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
41319    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
41320    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
41321    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
41322    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
41323    pub fn param<T>(mut self, name: T, value: T) -> CustomBiddingAlgorithmCreateCall<'a, C>
41324    where
41325        T: AsRef<str>,
41326    {
41327        self._additional_params
41328            .insert(name.as_ref().to_string(), value.as_ref().to_string());
41329        self
41330    }
41331
41332    /// Identifies the authorization scope for the method you are building.
41333    ///
41334    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
41335    /// [`Scope::DisplayVideo`].
41336    ///
41337    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
41338    /// tokens for more than one scope.
41339    ///
41340    /// Usually there is more than one suitable scope to authorize an operation, some of which may
41341    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
41342    /// sufficient, a read-write scope will do as well.
41343    pub fn add_scope<St>(mut self, scope: St) -> CustomBiddingAlgorithmCreateCall<'a, C>
41344    where
41345        St: AsRef<str>,
41346    {
41347        self._scopes.insert(String::from(scope.as_ref()));
41348        self
41349    }
41350    /// Identifies the authorization scope(s) for the method you are building.
41351    ///
41352    /// See [`Self::add_scope()`] for details.
41353    pub fn add_scopes<I, St>(mut self, scopes: I) -> CustomBiddingAlgorithmCreateCall<'a, C>
41354    where
41355        I: IntoIterator<Item = St>,
41356        St: AsRef<str>,
41357    {
41358        self._scopes
41359            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
41360        self
41361    }
41362
41363    /// Removes all scopes, and no default scope will be used either.
41364    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
41365    /// for details).
41366    pub fn clear_scopes(mut self) -> CustomBiddingAlgorithmCreateCall<'a, C> {
41367        self._scopes.clear();
41368        self
41369    }
41370}
41371
41372/// Gets a custom bidding algorithm.
41373///
41374/// A builder for the *get* method supported by a *customBiddingAlgorithm* resource.
41375/// It is not used directly, but through a [`CustomBiddingAlgorithmMethods`] instance.
41376///
41377/// # Example
41378///
41379/// Instantiate a resource method builder
41380///
41381/// ```test_harness,no_run
41382/// # extern crate hyper;
41383/// # extern crate hyper_rustls;
41384/// # extern crate google_displayvideo1 as displayvideo1;
41385/// # async fn dox() {
41386/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
41387///
41388/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
41389/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
41390/// #     secret,
41391/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
41392/// # ).build().await.unwrap();
41393///
41394/// # let client = hyper_util::client::legacy::Client::builder(
41395/// #     hyper_util::rt::TokioExecutor::new()
41396/// # )
41397/// # .build(
41398/// #     hyper_rustls::HttpsConnectorBuilder::new()
41399/// #         .with_native_roots()
41400/// #         .unwrap()
41401/// #         .https_or_http()
41402/// #         .enable_http1()
41403/// #         .build()
41404/// # );
41405/// # let mut hub = DisplayVideo::new(client, auth);
41406/// // You can configure optional parameters by calling the respective setters at will, and
41407/// // execute the final call using `doit()`.
41408/// // Values shown here are possibly random and not representative !
41409/// let result = hub.custom_bidding_algorithms().get(-62)
41410///              .partner_id(-5)
41411///              .advertiser_id(-61)
41412///              .doit().await;
41413/// # }
41414/// ```
41415pub struct CustomBiddingAlgorithmGetCall<'a, C>
41416where
41417    C: 'a,
41418{
41419    hub: &'a DisplayVideo<C>,
41420    _custom_bidding_algorithm_id: i64,
41421    _partner_id: Option<i64>,
41422    _advertiser_id: Option<i64>,
41423    _delegate: Option<&'a mut dyn common::Delegate>,
41424    _additional_params: HashMap<String, String>,
41425    _scopes: BTreeSet<String>,
41426}
41427
41428impl<'a, C> common::CallBuilder for CustomBiddingAlgorithmGetCall<'a, C> {}
41429
41430impl<'a, C> CustomBiddingAlgorithmGetCall<'a, C>
41431where
41432    C: common::Connector,
41433{
41434    /// Perform the operation you have build so far.
41435    pub async fn doit(mut self) -> common::Result<(common::Response, CustomBiddingAlgorithm)> {
41436        use std::borrow::Cow;
41437        use std::io::{Read, Seek};
41438
41439        use common::{url::Params, ToParts};
41440        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
41441
41442        let mut dd = common::DefaultDelegate;
41443        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
41444        dlg.begin(common::MethodInfo {
41445            id: "displayvideo.customBiddingAlgorithms.get",
41446            http_method: hyper::Method::GET,
41447        });
41448
41449        for &field in [
41450            "alt",
41451            "customBiddingAlgorithmId",
41452            "partnerId",
41453            "advertiserId",
41454        ]
41455        .iter()
41456        {
41457            if self._additional_params.contains_key(field) {
41458                dlg.finished(false);
41459                return Err(common::Error::FieldClash(field));
41460            }
41461        }
41462
41463        let mut params = Params::with_capacity(5 + self._additional_params.len());
41464        params.push(
41465            "customBiddingAlgorithmId",
41466            self._custom_bidding_algorithm_id.to_string(),
41467        );
41468        if let Some(value) = self._partner_id.as_ref() {
41469            params.push("partnerId", value.to_string());
41470        }
41471        if let Some(value) = self._advertiser_id.as_ref() {
41472            params.push("advertiserId", value.to_string());
41473        }
41474
41475        params.extend(self._additional_params.iter());
41476
41477        params.push("alt", "json");
41478        let mut url =
41479            self.hub._base_url.clone() + "v1/customBiddingAlgorithms/{+customBiddingAlgorithmId}";
41480        if self._scopes.is_empty() {
41481            self._scopes
41482                .insert(Scope::DisplayVideo.as_ref().to_string());
41483        }
41484
41485        #[allow(clippy::single_element_loop)]
41486        for &(find_this, param_name) in
41487            [("{+customBiddingAlgorithmId}", "customBiddingAlgorithmId")].iter()
41488        {
41489            url = params.uri_replacement(url, param_name, find_this, true);
41490        }
41491        {
41492            let to_remove = ["customBiddingAlgorithmId"];
41493            params.remove_params(&to_remove);
41494        }
41495
41496        let url = params.parse_with_url(&url);
41497
41498        loop {
41499            let token = match self
41500                .hub
41501                .auth
41502                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
41503                .await
41504            {
41505                Ok(token) => token,
41506                Err(e) => match dlg.token(e) {
41507                    Ok(token) => token,
41508                    Err(e) => {
41509                        dlg.finished(false);
41510                        return Err(common::Error::MissingToken(e));
41511                    }
41512                },
41513            };
41514            let mut req_result = {
41515                let client = &self.hub.client;
41516                dlg.pre_request();
41517                let mut req_builder = hyper::Request::builder()
41518                    .method(hyper::Method::GET)
41519                    .uri(url.as_str())
41520                    .header(USER_AGENT, self.hub._user_agent.clone());
41521
41522                if let Some(token) = token.as_ref() {
41523                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
41524                }
41525
41526                let request = req_builder
41527                    .header(CONTENT_LENGTH, 0_u64)
41528                    .body(common::to_body::<String>(None));
41529
41530                client.request(request.unwrap()).await
41531            };
41532
41533            match req_result {
41534                Err(err) => {
41535                    if let common::Retry::After(d) = dlg.http_error(&err) {
41536                        sleep(d).await;
41537                        continue;
41538                    }
41539                    dlg.finished(false);
41540                    return Err(common::Error::HttpError(err));
41541                }
41542                Ok(res) => {
41543                    let (mut parts, body) = res.into_parts();
41544                    let mut body = common::Body::new(body);
41545                    if !parts.status.is_success() {
41546                        let bytes = common::to_bytes(body).await.unwrap_or_default();
41547                        let error = serde_json::from_str(&common::to_string(&bytes));
41548                        let response = common::to_response(parts, bytes.into());
41549
41550                        if let common::Retry::After(d) =
41551                            dlg.http_failure(&response, error.as_ref().ok())
41552                        {
41553                            sleep(d).await;
41554                            continue;
41555                        }
41556
41557                        dlg.finished(false);
41558
41559                        return Err(match error {
41560                            Ok(value) => common::Error::BadRequest(value),
41561                            _ => common::Error::Failure(response),
41562                        });
41563                    }
41564                    let response = {
41565                        let bytes = common::to_bytes(body).await.unwrap_or_default();
41566                        let encoded = common::to_string(&bytes);
41567                        match serde_json::from_str(&encoded) {
41568                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
41569                            Err(error) => {
41570                                dlg.response_json_decode_error(&encoded, &error);
41571                                return Err(common::Error::JsonDecodeError(
41572                                    encoded.to_string(),
41573                                    error,
41574                                ));
41575                            }
41576                        }
41577                    };
41578
41579                    dlg.finished(true);
41580                    return Ok(response);
41581                }
41582            }
41583        }
41584    }
41585
41586    /// Required. The ID of the custom bidding algorithm to fetch.
41587    ///
41588    /// Sets the *custom bidding algorithm id* path property to the given value.
41589    ///
41590    /// Even though the property as already been set when instantiating this call,
41591    /// we provide this method for API completeness.
41592    pub fn custom_bidding_algorithm_id(
41593        mut self,
41594        new_value: i64,
41595    ) -> CustomBiddingAlgorithmGetCall<'a, C> {
41596        self._custom_bidding_algorithm_id = new_value;
41597        self
41598    }
41599    /// The ID of the DV360 partner that has access to the custom bidding algorithm.
41600    ///
41601    /// Sets the *partner id* query property to the given value.
41602    pub fn partner_id(mut self, new_value: i64) -> CustomBiddingAlgorithmGetCall<'a, C> {
41603        self._partner_id = Some(new_value);
41604        self
41605    }
41606    /// The ID of the DV360 partner that has access to the custom bidding algorithm.
41607    ///
41608    /// Sets the *advertiser id* query property to the given value.
41609    pub fn advertiser_id(mut self, new_value: i64) -> CustomBiddingAlgorithmGetCall<'a, C> {
41610        self._advertiser_id = Some(new_value);
41611        self
41612    }
41613    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
41614    /// while executing the actual API request.
41615    ///
41616    /// ````text
41617    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
41618    /// ````
41619    ///
41620    /// Sets the *delegate* property to the given value.
41621    pub fn delegate(
41622        mut self,
41623        new_value: &'a mut dyn common::Delegate,
41624    ) -> CustomBiddingAlgorithmGetCall<'a, C> {
41625        self._delegate = Some(new_value);
41626        self
41627    }
41628
41629    /// Set any additional parameter of the query string used in the request.
41630    /// It should be used to set parameters which are not yet available through their own
41631    /// setters.
41632    ///
41633    /// Please note that this method must not be used to set any of the known parameters
41634    /// which have their own setter method. If done anyway, the request will fail.
41635    ///
41636    /// # Additional Parameters
41637    ///
41638    /// * *$.xgafv* (query-string) - V1 error format.
41639    /// * *access_token* (query-string) - OAuth access token.
41640    /// * *alt* (query-string) - Data format for response.
41641    /// * *callback* (query-string) - JSONP
41642    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
41643    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
41644    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
41645    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
41646    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
41647    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
41648    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
41649    pub fn param<T>(mut self, name: T, value: T) -> CustomBiddingAlgorithmGetCall<'a, C>
41650    where
41651        T: AsRef<str>,
41652    {
41653        self._additional_params
41654            .insert(name.as_ref().to_string(), value.as_ref().to_string());
41655        self
41656    }
41657
41658    /// Identifies the authorization scope for the method you are building.
41659    ///
41660    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
41661    /// [`Scope::DisplayVideo`].
41662    ///
41663    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
41664    /// tokens for more than one scope.
41665    ///
41666    /// Usually there is more than one suitable scope to authorize an operation, some of which may
41667    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
41668    /// sufficient, a read-write scope will do as well.
41669    pub fn add_scope<St>(mut self, scope: St) -> CustomBiddingAlgorithmGetCall<'a, C>
41670    where
41671        St: AsRef<str>,
41672    {
41673        self._scopes.insert(String::from(scope.as_ref()));
41674        self
41675    }
41676    /// Identifies the authorization scope(s) for the method you are building.
41677    ///
41678    /// See [`Self::add_scope()`] for details.
41679    pub fn add_scopes<I, St>(mut self, scopes: I) -> CustomBiddingAlgorithmGetCall<'a, C>
41680    where
41681        I: IntoIterator<Item = St>,
41682        St: AsRef<str>,
41683    {
41684        self._scopes
41685            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
41686        self
41687    }
41688
41689    /// Removes all scopes, and no default scope will be used either.
41690    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
41691    /// for details).
41692    pub fn clear_scopes(mut self) -> CustomBiddingAlgorithmGetCall<'a, C> {
41693        self._scopes.clear();
41694        self
41695    }
41696}
41697
41698/// Lists custom bidding algorithms that are accessible to the current user and can be used in bidding stratgies. The order is defined by the order_by parameter.
41699///
41700/// A builder for the *list* method supported by a *customBiddingAlgorithm* resource.
41701/// It is not used directly, but through a [`CustomBiddingAlgorithmMethods`] instance.
41702///
41703/// # Example
41704///
41705/// Instantiate a resource method builder
41706///
41707/// ```test_harness,no_run
41708/// # extern crate hyper;
41709/// # extern crate hyper_rustls;
41710/// # extern crate google_displayvideo1 as displayvideo1;
41711/// # async fn dox() {
41712/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
41713///
41714/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
41715/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
41716/// #     secret,
41717/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
41718/// # ).build().await.unwrap();
41719///
41720/// # let client = hyper_util::client::legacy::Client::builder(
41721/// #     hyper_util::rt::TokioExecutor::new()
41722/// # )
41723/// # .build(
41724/// #     hyper_rustls::HttpsConnectorBuilder::new()
41725/// #         .with_native_roots()
41726/// #         .unwrap()
41727/// #         .https_or_http()
41728/// #         .enable_http1()
41729/// #         .build()
41730/// # );
41731/// # let mut hub = DisplayVideo::new(client, auth);
41732/// // You can configure optional parameters by calling the respective setters at will, and
41733/// // execute the final call using `doit()`.
41734/// // Values shown here are possibly random and not representative !
41735/// let result = hub.custom_bidding_algorithms().list()
41736///              .partner_id(-98)
41737///              .page_token("kasd")
41738///              .page_size(-47)
41739///              .order_by("Lorem")
41740///              .filter("justo")
41741///              .advertiser_id(-88)
41742///              .doit().await;
41743/// # }
41744/// ```
41745pub struct CustomBiddingAlgorithmListCall<'a, C>
41746where
41747    C: 'a,
41748{
41749    hub: &'a DisplayVideo<C>,
41750    _partner_id: Option<i64>,
41751    _page_token: Option<String>,
41752    _page_size: Option<i32>,
41753    _order_by: Option<String>,
41754    _filter: Option<String>,
41755    _advertiser_id: Option<i64>,
41756    _delegate: Option<&'a mut dyn common::Delegate>,
41757    _additional_params: HashMap<String, String>,
41758    _scopes: BTreeSet<String>,
41759}
41760
41761impl<'a, C> common::CallBuilder for CustomBiddingAlgorithmListCall<'a, C> {}
41762
41763impl<'a, C> CustomBiddingAlgorithmListCall<'a, C>
41764where
41765    C: common::Connector,
41766{
41767    /// Perform the operation you have build so far.
41768    pub async fn doit(
41769        mut self,
41770    ) -> common::Result<(common::Response, ListCustomBiddingAlgorithmsResponse)> {
41771        use std::borrow::Cow;
41772        use std::io::{Read, Seek};
41773
41774        use common::{url::Params, ToParts};
41775        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
41776
41777        let mut dd = common::DefaultDelegate;
41778        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
41779        dlg.begin(common::MethodInfo {
41780            id: "displayvideo.customBiddingAlgorithms.list",
41781            http_method: hyper::Method::GET,
41782        });
41783
41784        for &field in [
41785            "alt",
41786            "partnerId",
41787            "pageToken",
41788            "pageSize",
41789            "orderBy",
41790            "filter",
41791            "advertiserId",
41792        ]
41793        .iter()
41794        {
41795            if self._additional_params.contains_key(field) {
41796                dlg.finished(false);
41797                return Err(common::Error::FieldClash(field));
41798            }
41799        }
41800
41801        let mut params = Params::with_capacity(8 + self._additional_params.len());
41802        if let Some(value) = self._partner_id.as_ref() {
41803            params.push("partnerId", value.to_string());
41804        }
41805        if let Some(value) = self._page_token.as_ref() {
41806            params.push("pageToken", value);
41807        }
41808        if let Some(value) = self._page_size.as_ref() {
41809            params.push("pageSize", value.to_string());
41810        }
41811        if let Some(value) = self._order_by.as_ref() {
41812            params.push("orderBy", value);
41813        }
41814        if let Some(value) = self._filter.as_ref() {
41815            params.push("filter", value);
41816        }
41817        if let Some(value) = self._advertiser_id.as_ref() {
41818            params.push("advertiserId", value.to_string());
41819        }
41820
41821        params.extend(self._additional_params.iter());
41822
41823        params.push("alt", "json");
41824        let mut url = self.hub._base_url.clone() + "v1/customBiddingAlgorithms";
41825        if self._scopes.is_empty() {
41826            self._scopes
41827                .insert(Scope::DisplayVideo.as_ref().to_string());
41828        }
41829
41830        let url = params.parse_with_url(&url);
41831
41832        loop {
41833            let token = match self
41834                .hub
41835                .auth
41836                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
41837                .await
41838            {
41839                Ok(token) => token,
41840                Err(e) => match dlg.token(e) {
41841                    Ok(token) => token,
41842                    Err(e) => {
41843                        dlg.finished(false);
41844                        return Err(common::Error::MissingToken(e));
41845                    }
41846                },
41847            };
41848            let mut req_result = {
41849                let client = &self.hub.client;
41850                dlg.pre_request();
41851                let mut req_builder = hyper::Request::builder()
41852                    .method(hyper::Method::GET)
41853                    .uri(url.as_str())
41854                    .header(USER_AGENT, self.hub._user_agent.clone());
41855
41856                if let Some(token) = token.as_ref() {
41857                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
41858                }
41859
41860                let request = req_builder
41861                    .header(CONTENT_LENGTH, 0_u64)
41862                    .body(common::to_body::<String>(None));
41863
41864                client.request(request.unwrap()).await
41865            };
41866
41867            match req_result {
41868                Err(err) => {
41869                    if let common::Retry::After(d) = dlg.http_error(&err) {
41870                        sleep(d).await;
41871                        continue;
41872                    }
41873                    dlg.finished(false);
41874                    return Err(common::Error::HttpError(err));
41875                }
41876                Ok(res) => {
41877                    let (mut parts, body) = res.into_parts();
41878                    let mut body = common::Body::new(body);
41879                    if !parts.status.is_success() {
41880                        let bytes = common::to_bytes(body).await.unwrap_or_default();
41881                        let error = serde_json::from_str(&common::to_string(&bytes));
41882                        let response = common::to_response(parts, bytes.into());
41883
41884                        if let common::Retry::After(d) =
41885                            dlg.http_failure(&response, error.as_ref().ok())
41886                        {
41887                            sleep(d).await;
41888                            continue;
41889                        }
41890
41891                        dlg.finished(false);
41892
41893                        return Err(match error {
41894                            Ok(value) => common::Error::BadRequest(value),
41895                            _ => common::Error::Failure(response),
41896                        });
41897                    }
41898                    let response = {
41899                        let bytes = common::to_bytes(body).await.unwrap_or_default();
41900                        let encoded = common::to_string(&bytes);
41901                        match serde_json::from_str(&encoded) {
41902                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
41903                            Err(error) => {
41904                                dlg.response_json_decode_error(&encoded, &error);
41905                                return Err(common::Error::JsonDecodeError(
41906                                    encoded.to_string(),
41907                                    error,
41908                                ));
41909                            }
41910                        }
41911                    };
41912
41913                    dlg.finished(true);
41914                    return Ok(response);
41915                }
41916            }
41917        }
41918    }
41919
41920    /// The ID of the DV360 partner that has access to the custom bidding algorithm.
41921    ///
41922    /// Sets the *partner id* query property to the given value.
41923    pub fn partner_id(mut self, new_value: i64) -> CustomBiddingAlgorithmListCall<'a, C> {
41924        self._partner_id = Some(new_value);
41925        self
41926    }
41927    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListCustomBiddingAlgorithms` method. If not specified, the first page of results will be returned.
41928    ///
41929    /// Sets the *page token* query property to the given value.
41930    pub fn page_token(mut self, new_value: &str) -> CustomBiddingAlgorithmListCall<'a, C> {
41931        self._page_token = Some(new_value.to_string());
41932        self
41933    }
41934    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
41935    ///
41936    /// Sets the *page size* query property to the given value.
41937    pub fn page_size(mut self, new_value: i32) -> CustomBiddingAlgorithmListCall<'a, C> {
41938        self._page_size = Some(new_value);
41939        self
41940    }
41941    /// Field by which to sort the list. Acceptable values are: * `displayName` (default) The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `displayName desc`.
41942    ///
41943    /// Sets the *order by* query property to the given value.
41944    pub fn order_by(mut self, new_value: &str) -> CustomBiddingAlgorithmListCall<'a, C> {
41945        self._order_by = Some(new_value.to_string());
41946        self
41947    }
41948    /// Allows filtering by custom bidding algorithm fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by `AND`. A sequence of restrictions implicitly uses `AND`. * A restriction has the form of `{field} {operator} {value}`. * The `customBiddingAlgorithmType` field must use the `EQUALS (=)` operator. * The `displayName` field must use the `HAS (:)` operator. Supported fields: * `customBiddingAlgorithmType` * `displayName` Examples: * All custom bidding algorithms for which the display name contains “politics”: `displayName:"politics"`. * All custom bidding algorithms for which the type is “SCRIPT_BASED”: `customBiddingAlgorithmType=SCRIPT_BASED` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
41949    ///
41950    /// Sets the *filter* query property to the given value.
41951    pub fn filter(mut self, new_value: &str) -> CustomBiddingAlgorithmListCall<'a, C> {
41952        self._filter = Some(new_value.to_string());
41953        self
41954    }
41955    /// The ID of the DV360 advertiser that has access to the custom bidding algorithm.
41956    ///
41957    /// Sets the *advertiser id* query property to the given value.
41958    pub fn advertiser_id(mut self, new_value: i64) -> CustomBiddingAlgorithmListCall<'a, C> {
41959        self._advertiser_id = Some(new_value);
41960        self
41961    }
41962    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
41963    /// while executing the actual API request.
41964    ///
41965    /// ````text
41966    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
41967    /// ````
41968    ///
41969    /// Sets the *delegate* property to the given value.
41970    pub fn delegate(
41971        mut self,
41972        new_value: &'a mut dyn common::Delegate,
41973    ) -> CustomBiddingAlgorithmListCall<'a, C> {
41974        self._delegate = Some(new_value);
41975        self
41976    }
41977
41978    /// Set any additional parameter of the query string used in the request.
41979    /// It should be used to set parameters which are not yet available through their own
41980    /// setters.
41981    ///
41982    /// Please note that this method must not be used to set any of the known parameters
41983    /// which have their own setter method. If done anyway, the request will fail.
41984    ///
41985    /// # Additional Parameters
41986    ///
41987    /// * *$.xgafv* (query-string) - V1 error format.
41988    /// * *access_token* (query-string) - OAuth access token.
41989    /// * *alt* (query-string) - Data format for response.
41990    /// * *callback* (query-string) - JSONP
41991    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
41992    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
41993    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
41994    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
41995    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
41996    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
41997    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
41998    pub fn param<T>(mut self, name: T, value: T) -> CustomBiddingAlgorithmListCall<'a, C>
41999    where
42000        T: AsRef<str>,
42001    {
42002        self._additional_params
42003            .insert(name.as_ref().to_string(), value.as_ref().to_string());
42004        self
42005    }
42006
42007    /// Identifies the authorization scope for the method you are building.
42008    ///
42009    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
42010    /// [`Scope::DisplayVideo`].
42011    ///
42012    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
42013    /// tokens for more than one scope.
42014    ///
42015    /// Usually there is more than one suitable scope to authorize an operation, some of which may
42016    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
42017    /// sufficient, a read-write scope will do as well.
42018    pub fn add_scope<St>(mut self, scope: St) -> CustomBiddingAlgorithmListCall<'a, C>
42019    where
42020        St: AsRef<str>,
42021    {
42022        self._scopes.insert(String::from(scope.as_ref()));
42023        self
42024    }
42025    /// Identifies the authorization scope(s) for the method you are building.
42026    ///
42027    /// See [`Self::add_scope()`] for details.
42028    pub fn add_scopes<I, St>(mut self, scopes: I) -> CustomBiddingAlgorithmListCall<'a, C>
42029    where
42030        I: IntoIterator<Item = St>,
42031        St: AsRef<str>,
42032    {
42033        self._scopes
42034            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
42035        self
42036    }
42037
42038    /// Removes all scopes, and no default scope will be used either.
42039    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
42040    /// for details).
42041    pub fn clear_scopes(mut self) -> CustomBiddingAlgorithmListCall<'a, C> {
42042        self._scopes.clear();
42043        self
42044    }
42045}
42046
42047/// Updates an existing custom bidding algorithm. Returns the updated custom bidding algorithm if successful.
42048///
42049/// A builder for the *patch* method supported by a *customBiddingAlgorithm* resource.
42050/// It is not used directly, but through a [`CustomBiddingAlgorithmMethods`] instance.
42051///
42052/// # Example
42053///
42054/// Instantiate a resource method builder
42055///
42056/// ```test_harness,no_run
42057/// # extern crate hyper;
42058/// # extern crate hyper_rustls;
42059/// # extern crate google_displayvideo1 as displayvideo1;
42060/// use displayvideo1::api::CustomBiddingAlgorithm;
42061/// # async fn dox() {
42062/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
42063///
42064/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
42065/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
42066/// #     secret,
42067/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
42068/// # ).build().await.unwrap();
42069///
42070/// # let client = hyper_util::client::legacy::Client::builder(
42071/// #     hyper_util::rt::TokioExecutor::new()
42072/// # )
42073/// # .build(
42074/// #     hyper_rustls::HttpsConnectorBuilder::new()
42075/// #         .with_native_roots()
42076/// #         .unwrap()
42077/// #         .https_or_http()
42078/// #         .enable_http1()
42079/// #         .build()
42080/// # );
42081/// # let mut hub = DisplayVideo::new(client, auth);
42082/// // As the method needs a request, you would usually fill it with the desired information
42083/// // into the respective structure. Some of the parts shown here might not be applicable !
42084/// // Values shown here are possibly random and not representative !
42085/// let mut req = CustomBiddingAlgorithm::default();
42086///
42087/// // You can configure optional parameters by calling the respective setters at will, and
42088/// // execute the final call using `doit()`.
42089/// // Values shown here are possibly random and not representative !
42090/// let result = hub.custom_bidding_algorithms().patch(req, -1)
42091///              .update_mask(FieldMask::new::<&str>(&[]))
42092///              .doit().await;
42093/// # }
42094/// ```
42095pub struct CustomBiddingAlgorithmPatchCall<'a, C>
42096where
42097    C: 'a,
42098{
42099    hub: &'a DisplayVideo<C>,
42100    _request: CustomBiddingAlgorithm,
42101    _custom_bidding_algorithm_id: i64,
42102    _update_mask: Option<common::FieldMask>,
42103    _delegate: Option<&'a mut dyn common::Delegate>,
42104    _additional_params: HashMap<String, String>,
42105    _scopes: BTreeSet<String>,
42106}
42107
42108impl<'a, C> common::CallBuilder for CustomBiddingAlgorithmPatchCall<'a, C> {}
42109
42110impl<'a, C> CustomBiddingAlgorithmPatchCall<'a, C>
42111where
42112    C: common::Connector,
42113{
42114    /// Perform the operation you have build so far.
42115    pub async fn doit(mut self) -> common::Result<(common::Response, CustomBiddingAlgorithm)> {
42116        use std::borrow::Cow;
42117        use std::io::{Read, Seek};
42118
42119        use common::{url::Params, ToParts};
42120        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
42121
42122        let mut dd = common::DefaultDelegate;
42123        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
42124        dlg.begin(common::MethodInfo {
42125            id: "displayvideo.customBiddingAlgorithms.patch",
42126            http_method: hyper::Method::PATCH,
42127        });
42128
42129        for &field in ["alt", "customBiddingAlgorithmId", "updateMask"].iter() {
42130            if self._additional_params.contains_key(field) {
42131                dlg.finished(false);
42132                return Err(common::Error::FieldClash(field));
42133            }
42134        }
42135
42136        let mut params = Params::with_capacity(5 + self._additional_params.len());
42137        params.push(
42138            "customBiddingAlgorithmId",
42139            self._custom_bidding_algorithm_id.to_string(),
42140        );
42141        if let Some(value) = self._update_mask.as_ref() {
42142            params.push("updateMask", value.to_string());
42143        }
42144
42145        params.extend(self._additional_params.iter());
42146
42147        params.push("alt", "json");
42148        let mut url =
42149            self.hub._base_url.clone() + "v1/customBiddingAlgorithms/{+customBiddingAlgorithmId}";
42150        if self._scopes.is_empty() {
42151            self._scopes
42152                .insert(Scope::DisplayVideo.as_ref().to_string());
42153        }
42154
42155        #[allow(clippy::single_element_loop)]
42156        for &(find_this, param_name) in
42157            [("{+customBiddingAlgorithmId}", "customBiddingAlgorithmId")].iter()
42158        {
42159            url = params.uri_replacement(url, param_name, find_this, true);
42160        }
42161        {
42162            let to_remove = ["customBiddingAlgorithmId"];
42163            params.remove_params(&to_remove);
42164        }
42165
42166        let url = params.parse_with_url(&url);
42167
42168        let mut json_mime_type = mime::APPLICATION_JSON;
42169        let mut request_value_reader = {
42170            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
42171            common::remove_json_null_values(&mut value);
42172            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
42173            serde_json::to_writer(&mut dst, &value).unwrap();
42174            dst
42175        };
42176        let request_size = request_value_reader
42177            .seek(std::io::SeekFrom::End(0))
42178            .unwrap();
42179        request_value_reader
42180            .seek(std::io::SeekFrom::Start(0))
42181            .unwrap();
42182
42183        loop {
42184            let token = match self
42185                .hub
42186                .auth
42187                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
42188                .await
42189            {
42190                Ok(token) => token,
42191                Err(e) => match dlg.token(e) {
42192                    Ok(token) => token,
42193                    Err(e) => {
42194                        dlg.finished(false);
42195                        return Err(common::Error::MissingToken(e));
42196                    }
42197                },
42198            };
42199            request_value_reader
42200                .seek(std::io::SeekFrom::Start(0))
42201                .unwrap();
42202            let mut req_result = {
42203                let client = &self.hub.client;
42204                dlg.pre_request();
42205                let mut req_builder = hyper::Request::builder()
42206                    .method(hyper::Method::PATCH)
42207                    .uri(url.as_str())
42208                    .header(USER_AGENT, self.hub._user_agent.clone());
42209
42210                if let Some(token) = token.as_ref() {
42211                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
42212                }
42213
42214                let request = req_builder
42215                    .header(CONTENT_TYPE, json_mime_type.to_string())
42216                    .header(CONTENT_LENGTH, request_size as u64)
42217                    .body(common::to_body(
42218                        request_value_reader.get_ref().clone().into(),
42219                    ));
42220
42221                client.request(request.unwrap()).await
42222            };
42223
42224            match req_result {
42225                Err(err) => {
42226                    if let common::Retry::After(d) = dlg.http_error(&err) {
42227                        sleep(d).await;
42228                        continue;
42229                    }
42230                    dlg.finished(false);
42231                    return Err(common::Error::HttpError(err));
42232                }
42233                Ok(res) => {
42234                    let (mut parts, body) = res.into_parts();
42235                    let mut body = common::Body::new(body);
42236                    if !parts.status.is_success() {
42237                        let bytes = common::to_bytes(body).await.unwrap_or_default();
42238                        let error = serde_json::from_str(&common::to_string(&bytes));
42239                        let response = common::to_response(parts, bytes.into());
42240
42241                        if let common::Retry::After(d) =
42242                            dlg.http_failure(&response, error.as_ref().ok())
42243                        {
42244                            sleep(d).await;
42245                            continue;
42246                        }
42247
42248                        dlg.finished(false);
42249
42250                        return Err(match error {
42251                            Ok(value) => common::Error::BadRequest(value),
42252                            _ => common::Error::Failure(response),
42253                        });
42254                    }
42255                    let response = {
42256                        let bytes = common::to_bytes(body).await.unwrap_or_default();
42257                        let encoded = common::to_string(&bytes);
42258                        match serde_json::from_str(&encoded) {
42259                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
42260                            Err(error) => {
42261                                dlg.response_json_decode_error(&encoded, &error);
42262                                return Err(common::Error::JsonDecodeError(
42263                                    encoded.to_string(),
42264                                    error,
42265                                ));
42266                            }
42267                        }
42268                    };
42269
42270                    dlg.finished(true);
42271                    return Ok(response);
42272                }
42273            }
42274        }
42275    }
42276
42277    ///
42278    /// Sets the *request* property to the given value.
42279    ///
42280    /// Even though the property as already been set when instantiating this call,
42281    /// we provide this method for API completeness.
42282    pub fn request(
42283        mut self,
42284        new_value: CustomBiddingAlgorithm,
42285    ) -> CustomBiddingAlgorithmPatchCall<'a, C> {
42286        self._request = new_value;
42287        self
42288    }
42289    /// Output only. The unique ID of the custom bidding algorithm. Assigned by the system.
42290    ///
42291    /// Sets the *custom bidding algorithm id* path property to the given value.
42292    ///
42293    /// Even though the property as already been set when instantiating this call,
42294    /// we provide this method for API completeness.
42295    pub fn custom_bidding_algorithm_id(
42296        mut self,
42297        new_value: i64,
42298    ) -> CustomBiddingAlgorithmPatchCall<'a, C> {
42299        self._custom_bidding_algorithm_id = new_value;
42300        self
42301    }
42302    /// Required. The mask to control which fields to update.
42303    ///
42304    /// Sets the *update mask* query property to the given value.
42305    pub fn update_mask(
42306        mut self,
42307        new_value: common::FieldMask,
42308    ) -> CustomBiddingAlgorithmPatchCall<'a, C> {
42309        self._update_mask = Some(new_value);
42310        self
42311    }
42312    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
42313    /// while executing the actual API request.
42314    ///
42315    /// ````text
42316    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
42317    /// ````
42318    ///
42319    /// Sets the *delegate* property to the given value.
42320    pub fn delegate(
42321        mut self,
42322        new_value: &'a mut dyn common::Delegate,
42323    ) -> CustomBiddingAlgorithmPatchCall<'a, C> {
42324        self._delegate = Some(new_value);
42325        self
42326    }
42327
42328    /// Set any additional parameter of the query string used in the request.
42329    /// It should be used to set parameters which are not yet available through their own
42330    /// setters.
42331    ///
42332    /// Please note that this method must not be used to set any of the known parameters
42333    /// which have their own setter method. If done anyway, the request will fail.
42334    ///
42335    /// # Additional Parameters
42336    ///
42337    /// * *$.xgafv* (query-string) - V1 error format.
42338    /// * *access_token* (query-string) - OAuth access token.
42339    /// * *alt* (query-string) - Data format for response.
42340    /// * *callback* (query-string) - JSONP
42341    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
42342    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
42343    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
42344    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
42345    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
42346    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
42347    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
42348    pub fn param<T>(mut self, name: T, value: T) -> CustomBiddingAlgorithmPatchCall<'a, C>
42349    where
42350        T: AsRef<str>,
42351    {
42352        self._additional_params
42353            .insert(name.as_ref().to_string(), value.as_ref().to_string());
42354        self
42355    }
42356
42357    /// Identifies the authorization scope for the method you are building.
42358    ///
42359    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
42360    /// [`Scope::DisplayVideo`].
42361    ///
42362    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
42363    /// tokens for more than one scope.
42364    ///
42365    /// Usually there is more than one suitable scope to authorize an operation, some of which may
42366    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
42367    /// sufficient, a read-write scope will do as well.
42368    pub fn add_scope<St>(mut self, scope: St) -> CustomBiddingAlgorithmPatchCall<'a, C>
42369    where
42370        St: AsRef<str>,
42371    {
42372        self._scopes.insert(String::from(scope.as_ref()));
42373        self
42374    }
42375    /// Identifies the authorization scope(s) for the method you are building.
42376    ///
42377    /// See [`Self::add_scope()`] for details.
42378    pub fn add_scopes<I, St>(mut self, scopes: I) -> CustomBiddingAlgorithmPatchCall<'a, C>
42379    where
42380        I: IntoIterator<Item = St>,
42381        St: AsRef<str>,
42382    {
42383        self._scopes
42384            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
42385        self
42386    }
42387
42388    /// Removes all scopes, and no default scope will be used either.
42389    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
42390    /// for details).
42391    pub fn clear_scopes(mut self) -> CustomBiddingAlgorithmPatchCall<'a, C> {
42392        self._scopes.clear();
42393        self
42394    }
42395}
42396
42397/// Creates a custom bidding script reference object for a script file. The resulting reference object provides a resource path to which the script file should be uploaded. This reference object should be included in when creating a new custom bidding script object.
42398///
42399/// A builder for the *uploadScript* method supported by a *customBiddingAlgorithm* resource.
42400/// It is not used directly, but through a [`CustomBiddingAlgorithmMethods`] instance.
42401///
42402/// # Example
42403///
42404/// Instantiate a resource method builder
42405///
42406/// ```test_harness,no_run
42407/// # extern crate hyper;
42408/// # extern crate hyper_rustls;
42409/// # extern crate google_displayvideo1 as displayvideo1;
42410/// # async fn dox() {
42411/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
42412///
42413/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
42414/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
42415/// #     secret,
42416/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
42417/// # ).build().await.unwrap();
42418///
42419/// # let client = hyper_util::client::legacy::Client::builder(
42420/// #     hyper_util::rt::TokioExecutor::new()
42421/// # )
42422/// # .build(
42423/// #     hyper_rustls::HttpsConnectorBuilder::new()
42424/// #         .with_native_roots()
42425/// #         .unwrap()
42426/// #         .https_or_http()
42427/// #         .enable_http1()
42428/// #         .build()
42429/// # );
42430/// # let mut hub = DisplayVideo::new(client, auth);
42431/// // You can configure optional parameters by calling the respective setters at will, and
42432/// // execute the final call using `doit()`.
42433/// // Values shown here are possibly random and not representative !
42434/// let result = hub.custom_bidding_algorithms().upload_script(-80)
42435///              .partner_id(-91)
42436///              .advertiser_id(-10)
42437///              .doit().await;
42438/// # }
42439/// ```
42440pub struct CustomBiddingAlgorithmUploadScriptCall<'a, C>
42441where
42442    C: 'a,
42443{
42444    hub: &'a DisplayVideo<C>,
42445    _custom_bidding_algorithm_id: i64,
42446    _partner_id: Option<i64>,
42447    _advertiser_id: Option<i64>,
42448    _delegate: Option<&'a mut dyn common::Delegate>,
42449    _additional_params: HashMap<String, String>,
42450    _scopes: BTreeSet<String>,
42451}
42452
42453impl<'a, C> common::CallBuilder for CustomBiddingAlgorithmUploadScriptCall<'a, C> {}
42454
42455impl<'a, C> CustomBiddingAlgorithmUploadScriptCall<'a, C>
42456where
42457    C: common::Connector,
42458{
42459    /// Perform the operation you have build so far.
42460    pub async fn doit(mut self) -> common::Result<(common::Response, CustomBiddingScriptRef)> {
42461        use std::borrow::Cow;
42462        use std::io::{Read, Seek};
42463
42464        use common::{url::Params, ToParts};
42465        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
42466
42467        let mut dd = common::DefaultDelegate;
42468        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
42469        dlg.begin(common::MethodInfo {
42470            id: "displayvideo.customBiddingAlgorithms.uploadScript",
42471            http_method: hyper::Method::GET,
42472        });
42473
42474        for &field in [
42475            "alt",
42476            "customBiddingAlgorithmId",
42477            "partnerId",
42478            "advertiserId",
42479        ]
42480        .iter()
42481        {
42482            if self._additional_params.contains_key(field) {
42483                dlg.finished(false);
42484                return Err(common::Error::FieldClash(field));
42485            }
42486        }
42487
42488        let mut params = Params::with_capacity(5 + self._additional_params.len());
42489        params.push(
42490            "customBiddingAlgorithmId",
42491            self._custom_bidding_algorithm_id.to_string(),
42492        );
42493        if let Some(value) = self._partner_id.as_ref() {
42494            params.push("partnerId", value.to_string());
42495        }
42496        if let Some(value) = self._advertiser_id.as_ref() {
42497            params.push("advertiserId", value.to_string());
42498        }
42499
42500        params.extend(self._additional_params.iter());
42501
42502        params.push("alt", "json");
42503        let mut url = self.hub._base_url.clone()
42504            + "v1/customBiddingAlgorithms/{+customBiddingAlgorithmId}:uploadScript";
42505        if self._scopes.is_empty() {
42506            self._scopes
42507                .insert(Scope::DisplayVideo.as_ref().to_string());
42508        }
42509
42510        #[allow(clippy::single_element_loop)]
42511        for &(find_this, param_name) in
42512            [("{+customBiddingAlgorithmId}", "customBiddingAlgorithmId")].iter()
42513        {
42514            url = params.uri_replacement(url, param_name, find_this, true);
42515        }
42516        {
42517            let to_remove = ["customBiddingAlgorithmId"];
42518            params.remove_params(&to_remove);
42519        }
42520
42521        let url = params.parse_with_url(&url);
42522
42523        loop {
42524            let token = match self
42525                .hub
42526                .auth
42527                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
42528                .await
42529            {
42530                Ok(token) => token,
42531                Err(e) => match dlg.token(e) {
42532                    Ok(token) => token,
42533                    Err(e) => {
42534                        dlg.finished(false);
42535                        return Err(common::Error::MissingToken(e));
42536                    }
42537                },
42538            };
42539            let mut req_result = {
42540                let client = &self.hub.client;
42541                dlg.pre_request();
42542                let mut req_builder = hyper::Request::builder()
42543                    .method(hyper::Method::GET)
42544                    .uri(url.as_str())
42545                    .header(USER_AGENT, self.hub._user_agent.clone());
42546
42547                if let Some(token) = token.as_ref() {
42548                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
42549                }
42550
42551                let request = req_builder
42552                    .header(CONTENT_LENGTH, 0_u64)
42553                    .body(common::to_body::<String>(None));
42554
42555                client.request(request.unwrap()).await
42556            };
42557
42558            match req_result {
42559                Err(err) => {
42560                    if let common::Retry::After(d) = dlg.http_error(&err) {
42561                        sleep(d).await;
42562                        continue;
42563                    }
42564                    dlg.finished(false);
42565                    return Err(common::Error::HttpError(err));
42566                }
42567                Ok(res) => {
42568                    let (mut parts, body) = res.into_parts();
42569                    let mut body = common::Body::new(body);
42570                    if !parts.status.is_success() {
42571                        let bytes = common::to_bytes(body).await.unwrap_or_default();
42572                        let error = serde_json::from_str(&common::to_string(&bytes));
42573                        let response = common::to_response(parts, bytes.into());
42574
42575                        if let common::Retry::After(d) =
42576                            dlg.http_failure(&response, error.as_ref().ok())
42577                        {
42578                            sleep(d).await;
42579                            continue;
42580                        }
42581
42582                        dlg.finished(false);
42583
42584                        return Err(match error {
42585                            Ok(value) => common::Error::BadRequest(value),
42586                            _ => common::Error::Failure(response),
42587                        });
42588                    }
42589                    let response = {
42590                        let bytes = common::to_bytes(body).await.unwrap_or_default();
42591                        let encoded = common::to_string(&bytes);
42592                        match serde_json::from_str(&encoded) {
42593                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
42594                            Err(error) => {
42595                                dlg.response_json_decode_error(&encoded, &error);
42596                                return Err(common::Error::JsonDecodeError(
42597                                    encoded.to_string(),
42598                                    error,
42599                                ));
42600                            }
42601                        }
42602                    };
42603
42604                    dlg.finished(true);
42605                    return Ok(response);
42606                }
42607            }
42608        }
42609    }
42610
42611    /// Required. The ID of the custom bidding algorithm owns the script.
42612    ///
42613    /// Sets the *custom bidding algorithm id* path property to the given value.
42614    ///
42615    /// Even though the property as already been set when instantiating this call,
42616    /// we provide this method for API completeness.
42617    pub fn custom_bidding_algorithm_id(
42618        mut self,
42619        new_value: i64,
42620    ) -> CustomBiddingAlgorithmUploadScriptCall<'a, C> {
42621        self._custom_bidding_algorithm_id = new_value;
42622        self
42623    }
42624    /// The ID of the partner that owns the parent custom bidding algorithm. Only this partner will have write access to this custom bidding script.
42625    ///
42626    /// Sets the *partner id* query property to the given value.
42627    pub fn partner_id(mut self, new_value: i64) -> CustomBiddingAlgorithmUploadScriptCall<'a, C> {
42628        self._partner_id = Some(new_value);
42629        self
42630    }
42631    /// The ID of the advertiser that owns the parent custom bidding algorithm.
42632    ///
42633    /// Sets the *advertiser id* query property to the given value.
42634    pub fn advertiser_id(
42635        mut self,
42636        new_value: i64,
42637    ) -> CustomBiddingAlgorithmUploadScriptCall<'a, C> {
42638        self._advertiser_id = Some(new_value);
42639        self
42640    }
42641    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
42642    /// while executing the actual API request.
42643    ///
42644    /// ````text
42645    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
42646    /// ````
42647    ///
42648    /// Sets the *delegate* property to the given value.
42649    pub fn delegate(
42650        mut self,
42651        new_value: &'a mut dyn common::Delegate,
42652    ) -> CustomBiddingAlgorithmUploadScriptCall<'a, C> {
42653        self._delegate = Some(new_value);
42654        self
42655    }
42656
42657    /// Set any additional parameter of the query string used in the request.
42658    /// It should be used to set parameters which are not yet available through their own
42659    /// setters.
42660    ///
42661    /// Please note that this method must not be used to set any of the known parameters
42662    /// which have their own setter method. If done anyway, the request will fail.
42663    ///
42664    /// # Additional Parameters
42665    ///
42666    /// * *$.xgafv* (query-string) - V1 error format.
42667    /// * *access_token* (query-string) - OAuth access token.
42668    /// * *alt* (query-string) - Data format for response.
42669    /// * *callback* (query-string) - JSONP
42670    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
42671    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
42672    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
42673    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
42674    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
42675    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
42676    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
42677    pub fn param<T>(mut self, name: T, value: T) -> CustomBiddingAlgorithmUploadScriptCall<'a, C>
42678    where
42679        T: AsRef<str>,
42680    {
42681        self._additional_params
42682            .insert(name.as_ref().to_string(), value.as_ref().to_string());
42683        self
42684    }
42685
42686    /// Identifies the authorization scope for the method you are building.
42687    ///
42688    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
42689    /// [`Scope::DisplayVideo`].
42690    ///
42691    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
42692    /// tokens for more than one scope.
42693    ///
42694    /// Usually there is more than one suitable scope to authorize an operation, some of which may
42695    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
42696    /// sufficient, a read-write scope will do as well.
42697    pub fn add_scope<St>(mut self, scope: St) -> CustomBiddingAlgorithmUploadScriptCall<'a, C>
42698    where
42699        St: AsRef<str>,
42700    {
42701        self._scopes.insert(String::from(scope.as_ref()));
42702        self
42703    }
42704    /// Identifies the authorization scope(s) for the method you are building.
42705    ///
42706    /// See [`Self::add_scope()`] for details.
42707    pub fn add_scopes<I, St>(mut self, scopes: I) -> CustomBiddingAlgorithmUploadScriptCall<'a, C>
42708    where
42709        I: IntoIterator<Item = St>,
42710        St: AsRef<str>,
42711    {
42712        self._scopes
42713            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
42714        self
42715    }
42716
42717    /// Removes all scopes, and no default scope will be used either.
42718    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
42719    /// for details).
42720    pub fn clear_scopes(mut self) -> CustomBiddingAlgorithmUploadScriptCall<'a, C> {
42721        self._scopes.clear();
42722        self
42723    }
42724}
42725
42726/// Gets a custom list.
42727///
42728/// A builder for the *get* method supported by a *customList* resource.
42729/// It is not used directly, but through a [`CustomListMethods`] instance.
42730///
42731/// # Example
42732///
42733/// Instantiate a resource method builder
42734///
42735/// ```test_harness,no_run
42736/// # extern crate hyper;
42737/// # extern crate hyper_rustls;
42738/// # extern crate google_displayvideo1 as displayvideo1;
42739/// # async fn dox() {
42740/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
42741///
42742/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
42743/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
42744/// #     secret,
42745/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
42746/// # ).build().await.unwrap();
42747///
42748/// # let client = hyper_util::client::legacy::Client::builder(
42749/// #     hyper_util::rt::TokioExecutor::new()
42750/// # )
42751/// # .build(
42752/// #     hyper_rustls::HttpsConnectorBuilder::new()
42753/// #         .with_native_roots()
42754/// #         .unwrap()
42755/// #         .https_or_http()
42756/// #         .enable_http1()
42757/// #         .build()
42758/// # );
42759/// # let mut hub = DisplayVideo::new(client, auth);
42760/// // You can configure optional parameters by calling the respective setters at will, and
42761/// // execute the final call using `doit()`.
42762/// // Values shown here are possibly random and not representative !
42763/// let result = hub.custom_lists().get(-100)
42764///              .advertiser_id(-63)
42765///              .doit().await;
42766/// # }
42767/// ```
42768pub struct CustomListGetCall<'a, C>
42769where
42770    C: 'a,
42771{
42772    hub: &'a DisplayVideo<C>,
42773    _custom_list_id: i64,
42774    _advertiser_id: Option<i64>,
42775    _delegate: Option<&'a mut dyn common::Delegate>,
42776    _additional_params: HashMap<String, String>,
42777    _scopes: BTreeSet<String>,
42778}
42779
42780impl<'a, C> common::CallBuilder for CustomListGetCall<'a, C> {}
42781
42782impl<'a, C> CustomListGetCall<'a, C>
42783where
42784    C: common::Connector,
42785{
42786    /// Perform the operation you have build so far.
42787    pub async fn doit(mut self) -> common::Result<(common::Response, CustomList)> {
42788        use std::borrow::Cow;
42789        use std::io::{Read, Seek};
42790
42791        use common::{url::Params, ToParts};
42792        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
42793
42794        let mut dd = common::DefaultDelegate;
42795        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
42796        dlg.begin(common::MethodInfo {
42797            id: "displayvideo.customLists.get",
42798            http_method: hyper::Method::GET,
42799        });
42800
42801        for &field in ["alt", "customListId", "advertiserId"].iter() {
42802            if self._additional_params.contains_key(field) {
42803                dlg.finished(false);
42804                return Err(common::Error::FieldClash(field));
42805            }
42806        }
42807
42808        let mut params = Params::with_capacity(4 + self._additional_params.len());
42809        params.push("customListId", self._custom_list_id.to_string());
42810        if let Some(value) = self._advertiser_id.as_ref() {
42811            params.push("advertiserId", value.to_string());
42812        }
42813
42814        params.extend(self._additional_params.iter());
42815
42816        params.push("alt", "json");
42817        let mut url = self.hub._base_url.clone() + "v1/customLists/{+customListId}";
42818        if self._scopes.is_empty() {
42819            self._scopes
42820                .insert(Scope::DisplayVideo.as_ref().to_string());
42821        }
42822
42823        #[allow(clippy::single_element_loop)]
42824        for &(find_this, param_name) in [("{+customListId}", "customListId")].iter() {
42825            url = params.uri_replacement(url, param_name, find_this, true);
42826        }
42827        {
42828            let to_remove = ["customListId"];
42829            params.remove_params(&to_remove);
42830        }
42831
42832        let url = params.parse_with_url(&url);
42833
42834        loop {
42835            let token = match self
42836                .hub
42837                .auth
42838                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
42839                .await
42840            {
42841                Ok(token) => token,
42842                Err(e) => match dlg.token(e) {
42843                    Ok(token) => token,
42844                    Err(e) => {
42845                        dlg.finished(false);
42846                        return Err(common::Error::MissingToken(e));
42847                    }
42848                },
42849            };
42850            let mut req_result = {
42851                let client = &self.hub.client;
42852                dlg.pre_request();
42853                let mut req_builder = hyper::Request::builder()
42854                    .method(hyper::Method::GET)
42855                    .uri(url.as_str())
42856                    .header(USER_AGENT, self.hub._user_agent.clone());
42857
42858                if let Some(token) = token.as_ref() {
42859                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
42860                }
42861
42862                let request = req_builder
42863                    .header(CONTENT_LENGTH, 0_u64)
42864                    .body(common::to_body::<String>(None));
42865
42866                client.request(request.unwrap()).await
42867            };
42868
42869            match req_result {
42870                Err(err) => {
42871                    if let common::Retry::After(d) = dlg.http_error(&err) {
42872                        sleep(d).await;
42873                        continue;
42874                    }
42875                    dlg.finished(false);
42876                    return Err(common::Error::HttpError(err));
42877                }
42878                Ok(res) => {
42879                    let (mut parts, body) = res.into_parts();
42880                    let mut body = common::Body::new(body);
42881                    if !parts.status.is_success() {
42882                        let bytes = common::to_bytes(body).await.unwrap_or_default();
42883                        let error = serde_json::from_str(&common::to_string(&bytes));
42884                        let response = common::to_response(parts, bytes.into());
42885
42886                        if let common::Retry::After(d) =
42887                            dlg.http_failure(&response, error.as_ref().ok())
42888                        {
42889                            sleep(d).await;
42890                            continue;
42891                        }
42892
42893                        dlg.finished(false);
42894
42895                        return Err(match error {
42896                            Ok(value) => common::Error::BadRequest(value),
42897                            _ => common::Error::Failure(response),
42898                        });
42899                    }
42900                    let response = {
42901                        let bytes = common::to_bytes(body).await.unwrap_or_default();
42902                        let encoded = common::to_string(&bytes);
42903                        match serde_json::from_str(&encoded) {
42904                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
42905                            Err(error) => {
42906                                dlg.response_json_decode_error(&encoded, &error);
42907                                return Err(common::Error::JsonDecodeError(
42908                                    encoded.to_string(),
42909                                    error,
42910                                ));
42911                            }
42912                        }
42913                    };
42914
42915                    dlg.finished(true);
42916                    return Ok(response);
42917                }
42918            }
42919        }
42920    }
42921
42922    /// Required. The ID of the custom list to fetch.
42923    ///
42924    /// Sets the *custom list id* path property to the given value.
42925    ///
42926    /// Even though the property as already been set when instantiating this call,
42927    /// we provide this method for API completeness.
42928    pub fn custom_list_id(mut self, new_value: i64) -> CustomListGetCall<'a, C> {
42929        self._custom_list_id = new_value;
42930        self
42931    }
42932    /// The ID of the DV360 advertiser that has access to the fetched custom lists.
42933    ///
42934    /// Sets the *advertiser id* query property to the given value.
42935    pub fn advertiser_id(mut self, new_value: i64) -> CustomListGetCall<'a, C> {
42936        self._advertiser_id = Some(new_value);
42937        self
42938    }
42939    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
42940    /// while executing the actual API request.
42941    ///
42942    /// ````text
42943    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
42944    /// ````
42945    ///
42946    /// Sets the *delegate* property to the given value.
42947    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> CustomListGetCall<'a, C> {
42948        self._delegate = Some(new_value);
42949        self
42950    }
42951
42952    /// Set any additional parameter of the query string used in the request.
42953    /// It should be used to set parameters which are not yet available through their own
42954    /// setters.
42955    ///
42956    /// Please note that this method must not be used to set any of the known parameters
42957    /// which have their own setter method. If done anyway, the request will fail.
42958    ///
42959    /// # Additional Parameters
42960    ///
42961    /// * *$.xgafv* (query-string) - V1 error format.
42962    /// * *access_token* (query-string) - OAuth access token.
42963    /// * *alt* (query-string) - Data format for response.
42964    /// * *callback* (query-string) - JSONP
42965    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
42966    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
42967    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
42968    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
42969    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
42970    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
42971    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
42972    pub fn param<T>(mut self, name: T, value: T) -> CustomListGetCall<'a, C>
42973    where
42974        T: AsRef<str>,
42975    {
42976        self._additional_params
42977            .insert(name.as_ref().to_string(), value.as_ref().to_string());
42978        self
42979    }
42980
42981    /// Identifies the authorization scope for the method you are building.
42982    ///
42983    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
42984    /// [`Scope::DisplayVideo`].
42985    ///
42986    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
42987    /// tokens for more than one scope.
42988    ///
42989    /// Usually there is more than one suitable scope to authorize an operation, some of which may
42990    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
42991    /// sufficient, a read-write scope will do as well.
42992    pub fn add_scope<St>(mut self, scope: St) -> CustomListGetCall<'a, C>
42993    where
42994        St: AsRef<str>,
42995    {
42996        self._scopes.insert(String::from(scope.as_ref()));
42997        self
42998    }
42999    /// Identifies the authorization scope(s) for the method you are building.
43000    ///
43001    /// See [`Self::add_scope()`] for details.
43002    pub fn add_scopes<I, St>(mut self, scopes: I) -> CustomListGetCall<'a, C>
43003    where
43004        I: IntoIterator<Item = St>,
43005        St: AsRef<str>,
43006    {
43007        self._scopes
43008            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
43009        self
43010    }
43011
43012    /// Removes all scopes, and no default scope will be used either.
43013    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
43014    /// for details).
43015    pub fn clear_scopes(mut self) -> CustomListGetCall<'a, C> {
43016        self._scopes.clear();
43017        self
43018    }
43019}
43020
43021/// Lists custom lists. The order is defined by the order_by parameter.
43022///
43023/// A builder for the *list* method supported by a *customList* resource.
43024/// It is not used directly, but through a [`CustomListMethods`] instance.
43025///
43026/// # Example
43027///
43028/// Instantiate a resource method builder
43029///
43030/// ```test_harness,no_run
43031/// # extern crate hyper;
43032/// # extern crate hyper_rustls;
43033/// # extern crate google_displayvideo1 as displayvideo1;
43034/// # async fn dox() {
43035/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
43036///
43037/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
43038/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
43039/// #     secret,
43040/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
43041/// # ).build().await.unwrap();
43042///
43043/// # let client = hyper_util::client::legacy::Client::builder(
43044/// #     hyper_util::rt::TokioExecutor::new()
43045/// # )
43046/// # .build(
43047/// #     hyper_rustls::HttpsConnectorBuilder::new()
43048/// #         .with_native_roots()
43049/// #         .unwrap()
43050/// #         .https_or_http()
43051/// #         .enable_http1()
43052/// #         .build()
43053/// # );
43054/// # let mut hub = DisplayVideo::new(client, auth);
43055/// // You can configure optional parameters by calling the respective setters at will, and
43056/// // execute the final call using `doit()`.
43057/// // Values shown here are possibly random and not representative !
43058/// let result = hub.custom_lists().list()
43059///              .page_token("justo")
43060///              .page_size(-17)
43061///              .order_by("At")
43062///              .filter("erat")
43063///              .advertiser_id(-14)
43064///              .doit().await;
43065/// # }
43066/// ```
43067pub struct CustomListListCall<'a, C>
43068where
43069    C: 'a,
43070{
43071    hub: &'a DisplayVideo<C>,
43072    _page_token: Option<String>,
43073    _page_size: Option<i32>,
43074    _order_by: Option<String>,
43075    _filter: Option<String>,
43076    _advertiser_id: Option<i64>,
43077    _delegate: Option<&'a mut dyn common::Delegate>,
43078    _additional_params: HashMap<String, String>,
43079    _scopes: BTreeSet<String>,
43080}
43081
43082impl<'a, C> common::CallBuilder for CustomListListCall<'a, C> {}
43083
43084impl<'a, C> CustomListListCall<'a, C>
43085where
43086    C: common::Connector,
43087{
43088    /// Perform the operation you have build so far.
43089    pub async fn doit(mut self) -> common::Result<(common::Response, ListCustomListsResponse)> {
43090        use std::borrow::Cow;
43091        use std::io::{Read, Seek};
43092
43093        use common::{url::Params, ToParts};
43094        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
43095
43096        let mut dd = common::DefaultDelegate;
43097        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
43098        dlg.begin(common::MethodInfo {
43099            id: "displayvideo.customLists.list",
43100            http_method: hyper::Method::GET,
43101        });
43102
43103        for &field in [
43104            "alt",
43105            "pageToken",
43106            "pageSize",
43107            "orderBy",
43108            "filter",
43109            "advertiserId",
43110        ]
43111        .iter()
43112        {
43113            if self._additional_params.contains_key(field) {
43114                dlg.finished(false);
43115                return Err(common::Error::FieldClash(field));
43116            }
43117        }
43118
43119        let mut params = Params::with_capacity(7 + self._additional_params.len());
43120        if let Some(value) = self._page_token.as_ref() {
43121            params.push("pageToken", value);
43122        }
43123        if let Some(value) = self._page_size.as_ref() {
43124            params.push("pageSize", value.to_string());
43125        }
43126        if let Some(value) = self._order_by.as_ref() {
43127            params.push("orderBy", value);
43128        }
43129        if let Some(value) = self._filter.as_ref() {
43130            params.push("filter", value);
43131        }
43132        if let Some(value) = self._advertiser_id.as_ref() {
43133            params.push("advertiserId", value.to_string());
43134        }
43135
43136        params.extend(self._additional_params.iter());
43137
43138        params.push("alt", "json");
43139        let mut url = self.hub._base_url.clone() + "v1/customLists";
43140        if self._scopes.is_empty() {
43141            self._scopes
43142                .insert(Scope::DisplayVideo.as_ref().to_string());
43143        }
43144
43145        let url = params.parse_with_url(&url);
43146
43147        loop {
43148            let token = match self
43149                .hub
43150                .auth
43151                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
43152                .await
43153            {
43154                Ok(token) => token,
43155                Err(e) => match dlg.token(e) {
43156                    Ok(token) => token,
43157                    Err(e) => {
43158                        dlg.finished(false);
43159                        return Err(common::Error::MissingToken(e));
43160                    }
43161                },
43162            };
43163            let mut req_result = {
43164                let client = &self.hub.client;
43165                dlg.pre_request();
43166                let mut req_builder = hyper::Request::builder()
43167                    .method(hyper::Method::GET)
43168                    .uri(url.as_str())
43169                    .header(USER_AGENT, self.hub._user_agent.clone());
43170
43171                if let Some(token) = token.as_ref() {
43172                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
43173                }
43174
43175                let request = req_builder
43176                    .header(CONTENT_LENGTH, 0_u64)
43177                    .body(common::to_body::<String>(None));
43178
43179                client.request(request.unwrap()).await
43180            };
43181
43182            match req_result {
43183                Err(err) => {
43184                    if let common::Retry::After(d) = dlg.http_error(&err) {
43185                        sleep(d).await;
43186                        continue;
43187                    }
43188                    dlg.finished(false);
43189                    return Err(common::Error::HttpError(err));
43190                }
43191                Ok(res) => {
43192                    let (mut parts, body) = res.into_parts();
43193                    let mut body = common::Body::new(body);
43194                    if !parts.status.is_success() {
43195                        let bytes = common::to_bytes(body).await.unwrap_or_default();
43196                        let error = serde_json::from_str(&common::to_string(&bytes));
43197                        let response = common::to_response(parts, bytes.into());
43198
43199                        if let common::Retry::After(d) =
43200                            dlg.http_failure(&response, error.as_ref().ok())
43201                        {
43202                            sleep(d).await;
43203                            continue;
43204                        }
43205
43206                        dlg.finished(false);
43207
43208                        return Err(match error {
43209                            Ok(value) => common::Error::BadRequest(value),
43210                            _ => common::Error::Failure(response),
43211                        });
43212                    }
43213                    let response = {
43214                        let bytes = common::to_bytes(body).await.unwrap_or_default();
43215                        let encoded = common::to_string(&bytes);
43216                        match serde_json::from_str(&encoded) {
43217                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
43218                            Err(error) => {
43219                                dlg.response_json_decode_error(&encoded, &error);
43220                                return Err(common::Error::JsonDecodeError(
43221                                    encoded.to_string(),
43222                                    error,
43223                                ));
43224                            }
43225                        }
43226                    };
43227
43228                    dlg.finished(true);
43229                    return Ok(response);
43230                }
43231            }
43232        }
43233    }
43234
43235    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListCustomLists` method. If not specified, the first page of results will be returned.
43236    ///
43237    /// Sets the *page token* query property to the given value.
43238    pub fn page_token(mut self, new_value: &str) -> CustomListListCall<'a, C> {
43239        self._page_token = Some(new_value.to_string());
43240        self
43241    }
43242    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
43243    ///
43244    /// Sets the *page size* query property to the given value.
43245    pub fn page_size(mut self, new_value: i32) -> CustomListListCall<'a, C> {
43246        self._page_size = Some(new_value);
43247        self
43248    }
43249    /// Field by which to sort the list. Acceptable values are: * `customListId` (default) * `displayName` The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `displayName desc`.
43250    ///
43251    /// Sets the *order by* query property to the given value.
43252    pub fn order_by(mut self, new_value: &str) -> CustomListListCall<'a, C> {
43253        self._order_by = Some(new_value.to_string());
43254        self
43255    }
43256    /// Allows filtering by custom list fields. Supported syntax: * Filter expressions for custom lists can only contain at most one restriction. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `HAS (:)` operator. Supported fields: * `displayName` Examples: * All custom lists for which the display name contains “Google”: `displayName:"Google"`. The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
43257    ///
43258    /// Sets the *filter* query property to the given value.
43259    pub fn filter(mut self, new_value: &str) -> CustomListListCall<'a, C> {
43260        self._filter = Some(new_value.to_string());
43261        self
43262    }
43263    /// The ID of the DV360 advertiser that has access to the fetched custom lists.
43264    ///
43265    /// Sets the *advertiser id* query property to the given value.
43266    pub fn advertiser_id(mut self, new_value: i64) -> CustomListListCall<'a, C> {
43267        self._advertiser_id = Some(new_value);
43268        self
43269    }
43270    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
43271    /// while executing the actual API request.
43272    ///
43273    /// ````text
43274    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
43275    /// ````
43276    ///
43277    /// Sets the *delegate* property to the given value.
43278    pub fn delegate(
43279        mut self,
43280        new_value: &'a mut dyn common::Delegate,
43281    ) -> CustomListListCall<'a, C> {
43282        self._delegate = Some(new_value);
43283        self
43284    }
43285
43286    /// Set any additional parameter of the query string used in the request.
43287    /// It should be used to set parameters which are not yet available through their own
43288    /// setters.
43289    ///
43290    /// Please note that this method must not be used to set any of the known parameters
43291    /// which have their own setter method. If done anyway, the request will fail.
43292    ///
43293    /// # Additional Parameters
43294    ///
43295    /// * *$.xgafv* (query-string) - V1 error format.
43296    /// * *access_token* (query-string) - OAuth access token.
43297    /// * *alt* (query-string) - Data format for response.
43298    /// * *callback* (query-string) - JSONP
43299    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
43300    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
43301    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
43302    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
43303    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
43304    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
43305    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
43306    pub fn param<T>(mut self, name: T, value: T) -> CustomListListCall<'a, C>
43307    where
43308        T: AsRef<str>,
43309    {
43310        self._additional_params
43311            .insert(name.as_ref().to_string(), value.as_ref().to_string());
43312        self
43313    }
43314
43315    /// Identifies the authorization scope for the method you are building.
43316    ///
43317    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
43318    /// [`Scope::DisplayVideo`].
43319    ///
43320    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
43321    /// tokens for more than one scope.
43322    ///
43323    /// Usually there is more than one suitable scope to authorize an operation, some of which may
43324    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
43325    /// sufficient, a read-write scope will do as well.
43326    pub fn add_scope<St>(mut self, scope: St) -> CustomListListCall<'a, C>
43327    where
43328        St: AsRef<str>,
43329    {
43330        self._scopes.insert(String::from(scope.as_ref()));
43331        self
43332    }
43333    /// Identifies the authorization scope(s) for the method you are building.
43334    ///
43335    /// See [`Self::add_scope()`] for details.
43336    pub fn add_scopes<I, St>(mut self, scopes: I) -> CustomListListCall<'a, C>
43337    where
43338        I: IntoIterator<Item = St>,
43339        St: AsRef<str>,
43340    {
43341        self._scopes
43342            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
43343        self
43344    }
43345
43346    /// Removes all scopes, and no default scope will be used either.
43347    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
43348    /// for details).
43349    pub fn clear_scopes(mut self) -> CustomListListCall<'a, C> {
43350        self._scopes.clear();
43351        self
43352    }
43353}
43354
43355/// Creates a FirstAndThirdPartyAudience. Only supported for the following audience_type: * `CUSTOMER_MATCH_CONTACT_INFO` * `CUSTOMER_MATCH_DEVICE_ID`
43356///
43357/// A builder for the *create* method supported by a *firstAndThirdPartyAudience* resource.
43358/// It is not used directly, but through a [`FirstAndThirdPartyAudienceMethods`] instance.
43359///
43360/// # Example
43361///
43362/// Instantiate a resource method builder
43363///
43364/// ```test_harness,no_run
43365/// # extern crate hyper;
43366/// # extern crate hyper_rustls;
43367/// # extern crate google_displayvideo1 as displayvideo1;
43368/// use displayvideo1::api::FirstAndThirdPartyAudience;
43369/// # async fn dox() {
43370/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
43371///
43372/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
43373/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
43374/// #     secret,
43375/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
43376/// # ).build().await.unwrap();
43377///
43378/// # let client = hyper_util::client::legacy::Client::builder(
43379/// #     hyper_util::rt::TokioExecutor::new()
43380/// # )
43381/// # .build(
43382/// #     hyper_rustls::HttpsConnectorBuilder::new()
43383/// #         .with_native_roots()
43384/// #         .unwrap()
43385/// #         .https_or_http()
43386/// #         .enable_http1()
43387/// #         .build()
43388/// # );
43389/// # let mut hub = DisplayVideo::new(client, auth);
43390/// // As the method needs a request, you would usually fill it with the desired information
43391/// // into the respective structure. Some of the parts shown here might not be applicable !
43392/// // Values shown here are possibly random and not representative !
43393/// let mut req = FirstAndThirdPartyAudience::default();
43394///
43395/// // You can configure optional parameters by calling the respective setters at will, and
43396/// // execute the final call using `doit()`.
43397/// // Values shown here are possibly random and not representative !
43398/// let result = hub.first_and_third_party_audiences().create(req)
43399///              .advertiser_id(-76)
43400///              .doit().await;
43401/// # }
43402/// ```
43403pub struct FirstAndThirdPartyAudienceCreateCall<'a, C>
43404where
43405    C: 'a,
43406{
43407    hub: &'a DisplayVideo<C>,
43408    _request: FirstAndThirdPartyAudience,
43409    _advertiser_id: Option<i64>,
43410    _delegate: Option<&'a mut dyn common::Delegate>,
43411    _additional_params: HashMap<String, String>,
43412    _scopes: BTreeSet<String>,
43413}
43414
43415impl<'a, C> common::CallBuilder for FirstAndThirdPartyAudienceCreateCall<'a, C> {}
43416
43417impl<'a, C> FirstAndThirdPartyAudienceCreateCall<'a, C>
43418where
43419    C: common::Connector,
43420{
43421    /// Perform the operation you have build so far.
43422    pub async fn doit(mut self) -> common::Result<(common::Response, FirstAndThirdPartyAudience)> {
43423        use std::borrow::Cow;
43424        use std::io::{Read, Seek};
43425
43426        use common::{url::Params, ToParts};
43427        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
43428
43429        let mut dd = common::DefaultDelegate;
43430        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
43431        dlg.begin(common::MethodInfo {
43432            id: "displayvideo.firstAndThirdPartyAudiences.create",
43433            http_method: hyper::Method::POST,
43434        });
43435
43436        for &field in ["alt", "advertiserId"].iter() {
43437            if self._additional_params.contains_key(field) {
43438                dlg.finished(false);
43439                return Err(common::Error::FieldClash(field));
43440            }
43441        }
43442
43443        let mut params = Params::with_capacity(4 + self._additional_params.len());
43444        if let Some(value) = self._advertiser_id.as_ref() {
43445            params.push("advertiserId", value.to_string());
43446        }
43447
43448        params.extend(self._additional_params.iter());
43449
43450        params.push("alt", "json");
43451        let mut url = self.hub._base_url.clone() + "v1/firstAndThirdPartyAudiences";
43452        if self._scopes.is_empty() {
43453            self._scopes
43454                .insert(Scope::DisplayVideo.as_ref().to_string());
43455        }
43456
43457        let url = params.parse_with_url(&url);
43458
43459        let mut json_mime_type = mime::APPLICATION_JSON;
43460        let mut request_value_reader = {
43461            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
43462            common::remove_json_null_values(&mut value);
43463            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
43464            serde_json::to_writer(&mut dst, &value).unwrap();
43465            dst
43466        };
43467        let request_size = request_value_reader
43468            .seek(std::io::SeekFrom::End(0))
43469            .unwrap();
43470        request_value_reader
43471            .seek(std::io::SeekFrom::Start(0))
43472            .unwrap();
43473
43474        loop {
43475            let token = match self
43476                .hub
43477                .auth
43478                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
43479                .await
43480            {
43481                Ok(token) => token,
43482                Err(e) => match dlg.token(e) {
43483                    Ok(token) => token,
43484                    Err(e) => {
43485                        dlg.finished(false);
43486                        return Err(common::Error::MissingToken(e));
43487                    }
43488                },
43489            };
43490            request_value_reader
43491                .seek(std::io::SeekFrom::Start(0))
43492                .unwrap();
43493            let mut req_result = {
43494                let client = &self.hub.client;
43495                dlg.pre_request();
43496                let mut req_builder = hyper::Request::builder()
43497                    .method(hyper::Method::POST)
43498                    .uri(url.as_str())
43499                    .header(USER_AGENT, self.hub._user_agent.clone());
43500
43501                if let Some(token) = token.as_ref() {
43502                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
43503                }
43504
43505                let request = req_builder
43506                    .header(CONTENT_TYPE, json_mime_type.to_string())
43507                    .header(CONTENT_LENGTH, request_size as u64)
43508                    .body(common::to_body(
43509                        request_value_reader.get_ref().clone().into(),
43510                    ));
43511
43512                client.request(request.unwrap()).await
43513            };
43514
43515            match req_result {
43516                Err(err) => {
43517                    if let common::Retry::After(d) = dlg.http_error(&err) {
43518                        sleep(d).await;
43519                        continue;
43520                    }
43521                    dlg.finished(false);
43522                    return Err(common::Error::HttpError(err));
43523                }
43524                Ok(res) => {
43525                    let (mut parts, body) = res.into_parts();
43526                    let mut body = common::Body::new(body);
43527                    if !parts.status.is_success() {
43528                        let bytes = common::to_bytes(body).await.unwrap_or_default();
43529                        let error = serde_json::from_str(&common::to_string(&bytes));
43530                        let response = common::to_response(parts, bytes.into());
43531
43532                        if let common::Retry::After(d) =
43533                            dlg.http_failure(&response, error.as_ref().ok())
43534                        {
43535                            sleep(d).await;
43536                            continue;
43537                        }
43538
43539                        dlg.finished(false);
43540
43541                        return Err(match error {
43542                            Ok(value) => common::Error::BadRequest(value),
43543                            _ => common::Error::Failure(response),
43544                        });
43545                    }
43546                    let response = {
43547                        let bytes = common::to_bytes(body).await.unwrap_or_default();
43548                        let encoded = common::to_string(&bytes);
43549                        match serde_json::from_str(&encoded) {
43550                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
43551                            Err(error) => {
43552                                dlg.response_json_decode_error(&encoded, &error);
43553                                return Err(common::Error::JsonDecodeError(
43554                                    encoded.to_string(),
43555                                    error,
43556                                ));
43557                            }
43558                        }
43559                    };
43560
43561                    dlg.finished(true);
43562                    return Ok(response);
43563                }
43564            }
43565        }
43566    }
43567
43568    ///
43569    /// Sets the *request* property to the given value.
43570    ///
43571    /// Even though the property as already been set when instantiating this call,
43572    /// we provide this method for API completeness.
43573    pub fn request(
43574        mut self,
43575        new_value: FirstAndThirdPartyAudience,
43576    ) -> FirstAndThirdPartyAudienceCreateCall<'a, C> {
43577        self._request = new_value;
43578        self
43579    }
43580    /// Required. The ID of the advertiser under whom the FirstAndThirdPartyAudience will be created.
43581    ///
43582    /// Sets the *advertiser id* query property to the given value.
43583    pub fn advertiser_id(mut self, new_value: i64) -> FirstAndThirdPartyAudienceCreateCall<'a, C> {
43584        self._advertiser_id = Some(new_value);
43585        self
43586    }
43587    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
43588    /// while executing the actual API request.
43589    ///
43590    /// ````text
43591    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
43592    /// ````
43593    ///
43594    /// Sets the *delegate* property to the given value.
43595    pub fn delegate(
43596        mut self,
43597        new_value: &'a mut dyn common::Delegate,
43598    ) -> FirstAndThirdPartyAudienceCreateCall<'a, C> {
43599        self._delegate = Some(new_value);
43600        self
43601    }
43602
43603    /// Set any additional parameter of the query string used in the request.
43604    /// It should be used to set parameters which are not yet available through their own
43605    /// setters.
43606    ///
43607    /// Please note that this method must not be used to set any of the known parameters
43608    /// which have their own setter method. If done anyway, the request will fail.
43609    ///
43610    /// # Additional Parameters
43611    ///
43612    /// * *$.xgafv* (query-string) - V1 error format.
43613    /// * *access_token* (query-string) - OAuth access token.
43614    /// * *alt* (query-string) - Data format for response.
43615    /// * *callback* (query-string) - JSONP
43616    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
43617    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
43618    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
43619    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
43620    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
43621    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
43622    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
43623    pub fn param<T>(mut self, name: T, value: T) -> FirstAndThirdPartyAudienceCreateCall<'a, C>
43624    where
43625        T: AsRef<str>,
43626    {
43627        self._additional_params
43628            .insert(name.as_ref().to_string(), value.as_ref().to_string());
43629        self
43630    }
43631
43632    /// Identifies the authorization scope for the method you are building.
43633    ///
43634    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
43635    /// [`Scope::DisplayVideo`].
43636    ///
43637    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
43638    /// tokens for more than one scope.
43639    ///
43640    /// Usually there is more than one suitable scope to authorize an operation, some of which may
43641    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
43642    /// sufficient, a read-write scope will do as well.
43643    pub fn add_scope<St>(mut self, scope: St) -> FirstAndThirdPartyAudienceCreateCall<'a, C>
43644    where
43645        St: AsRef<str>,
43646    {
43647        self._scopes.insert(String::from(scope.as_ref()));
43648        self
43649    }
43650    /// Identifies the authorization scope(s) for the method you are building.
43651    ///
43652    /// See [`Self::add_scope()`] for details.
43653    pub fn add_scopes<I, St>(mut self, scopes: I) -> FirstAndThirdPartyAudienceCreateCall<'a, C>
43654    where
43655        I: IntoIterator<Item = St>,
43656        St: AsRef<str>,
43657    {
43658        self._scopes
43659            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
43660        self
43661    }
43662
43663    /// Removes all scopes, and no default scope will be used either.
43664    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
43665    /// for details).
43666    pub fn clear_scopes(mut self) -> FirstAndThirdPartyAudienceCreateCall<'a, C> {
43667        self._scopes.clear();
43668        self
43669    }
43670}
43671
43672/// Updates the member list of a Customer Match audience. Only supported for the following audience_type: * `CUSTOMER_MATCH_CONTACT_INFO` * `CUSTOMER_MATCH_DEVICE_ID`
43673///
43674/// A builder for the *editCustomerMatchMembers* method supported by a *firstAndThirdPartyAudience* resource.
43675/// It is not used directly, but through a [`FirstAndThirdPartyAudienceMethods`] instance.
43676///
43677/// # Example
43678///
43679/// Instantiate a resource method builder
43680///
43681/// ```test_harness,no_run
43682/// # extern crate hyper;
43683/// # extern crate hyper_rustls;
43684/// # extern crate google_displayvideo1 as displayvideo1;
43685/// use displayvideo1::api::EditCustomerMatchMembersRequest;
43686/// # async fn dox() {
43687/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
43688///
43689/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
43690/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
43691/// #     secret,
43692/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
43693/// # ).build().await.unwrap();
43694///
43695/// # let client = hyper_util::client::legacy::Client::builder(
43696/// #     hyper_util::rt::TokioExecutor::new()
43697/// # )
43698/// # .build(
43699/// #     hyper_rustls::HttpsConnectorBuilder::new()
43700/// #         .with_native_roots()
43701/// #         .unwrap()
43702/// #         .https_or_http()
43703/// #         .enable_http1()
43704/// #         .build()
43705/// # );
43706/// # let mut hub = DisplayVideo::new(client, auth);
43707/// // As the method needs a request, you would usually fill it with the desired information
43708/// // into the respective structure. Some of the parts shown here might not be applicable !
43709/// // Values shown here are possibly random and not representative !
43710/// let mut req = EditCustomerMatchMembersRequest::default();
43711///
43712/// // You can configure optional parameters by calling the respective setters at will, and
43713/// // execute the final call using `doit()`.
43714/// // Values shown here are possibly random and not representative !
43715/// let result = hub.first_and_third_party_audiences().edit_customer_match_members(req, -88)
43716///              .doit().await;
43717/// # }
43718/// ```
43719pub struct FirstAndThirdPartyAudienceEditCustomerMatchMemberCall<'a, C>
43720where
43721    C: 'a,
43722{
43723    hub: &'a DisplayVideo<C>,
43724    _request: EditCustomerMatchMembersRequest,
43725    _first_and_third_party_audience_id: i64,
43726    _delegate: Option<&'a mut dyn common::Delegate>,
43727    _additional_params: HashMap<String, String>,
43728    _scopes: BTreeSet<String>,
43729}
43730
43731impl<'a, C> common::CallBuilder for FirstAndThirdPartyAudienceEditCustomerMatchMemberCall<'a, C> {}
43732
43733impl<'a, C> FirstAndThirdPartyAudienceEditCustomerMatchMemberCall<'a, C>
43734where
43735    C: common::Connector,
43736{
43737    /// Perform the operation you have build so far.
43738    pub async fn doit(
43739        mut self,
43740    ) -> common::Result<(common::Response, EditCustomerMatchMembersResponse)> {
43741        use std::borrow::Cow;
43742        use std::io::{Read, Seek};
43743
43744        use common::{url::Params, ToParts};
43745        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
43746
43747        let mut dd = common::DefaultDelegate;
43748        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
43749        dlg.begin(common::MethodInfo {
43750            id: "displayvideo.firstAndThirdPartyAudiences.editCustomerMatchMembers",
43751            http_method: hyper::Method::POST,
43752        });
43753
43754        for &field in ["alt", "firstAndThirdPartyAudienceId"].iter() {
43755            if self._additional_params.contains_key(field) {
43756                dlg.finished(false);
43757                return Err(common::Error::FieldClash(field));
43758            }
43759        }
43760
43761        let mut params = Params::with_capacity(4 + self._additional_params.len());
43762        params.push(
43763            "firstAndThirdPartyAudienceId",
43764            self._first_and_third_party_audience_id.to_string(),
43765        );
43766
43767        params.extend(self._additional_params.iter());
43768
43769        params.push("alt", "json");
43770        let mut url = self.hub._base_url.clone() + "v1/firstAndThirdPartyAudiences/{+firstAndThirdPartyAudienceId}:editCustomerMatchMembers";
43771        if self._scopes.is_empty() {
43772            self._scopes
43773                .insert(Scope::DisplayVideo.as_ref().to_string());
43774        }
43775
43776        #[allow(clippy::single_element_loop)]
43777        for &(find_this, param_name) in [(
43778            "{+firstAndThirdPartyAudienceId}",
43779            "firstAndThirdPartyAudienceId",
43780        )]
43781        .iter()
43782        {
43783            url = params.uri_replacement(url, param_name, find_this, true);
43784        }
43785        {
43786            let to_remove = ["firstAndThirdPartyAudienceId"];
43787            params.remove_params(&to_remove);
43788        }
43789
43790        let url = params.parse_with_url(&url);
43791
43792        let mut json_mime_type = mime::APPLICATION_JSON;
43793        let mut request_value_reader = {
43794            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
43795            common::remove_json_null_values(&mut value);
43796            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
43797            serde_json::to_writer(&mut dst, &value).unwrap();
43798            dst
43799        };
43800        let request_size = request_value_reader
43801            .seek(std::io::SeekFrom::End(0))
43802            .unwrap();
43803        request_value_reader
43804            .seek(std::io::SeekFrom::Start(0))
43805            .unwrap();
43806
43807        loop {
43808            let token = match self
43809                .hub
43810                .auth
43811                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
43812                .await
43813            {
43814                Ok(token) => token,
43815                Err(e) => match dlg.token(e) {
43816                    Ok(token) => token,
43817                    Err(e) => {
43818                        dlg.finished(false);
43819                        return Err(common::Error::MissingToken(e));
43820                    }
43821                },
43822            };
43823            request_value_reader
43824                .seek(std::io::SeekFrom::Start(0))
43825                .unwrap();
43826            let mut req_result = {
43827                let client = &self.hub.client;
43828                dlg.pre_request();
43829                let mut req_builder = hyper::Request::builder()
43830                    .method(hyper::Method::POST)
43831                    .uri(url.as_str())
43832                    .header(USER_AGENT, self.hub._user_agent.clone());
43833
43834                if let Some(token) = token.as_ref() {
43835                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
43836                }
43837
43838                let request = req_builder
43839                    .header(CONTENT_TYPE, json_mime_type.to_string())
43840                    .header(CONTENT_LENGTH, request_size as u64)
43841                    .body(common::to_body(
43842                        request_value_reader.get_ref().clone().into(),
43843                    ));
43844
43845                client.request(request.unwrap()).await
43846            };
43847
43848            match req_result {
43849                Err(err) => {
43850                    if let common::Retry::After(d) = dlg.http_error(&err) {
43851                        sleep(d).await;
43852                        continue;
43853                    }
43854                    dlg.finished(false);
43855                    return Err(common::Error::HttpError(err));
43856                }
43857                Ok(res) => {
43858                    let (mut parts, body) = res.into_parts();
43859                    let mut body = common::Body::new(body);
43860                    if !parts.status.is_success() {
43861                        let bytes = common::to_bytes(body).await.unwrap_or_default();
43862                        let error = serde_json::from_str(&common::to_string(&bytes));
43863                        let response = common::to_response(parts, bytes.into());
43864
43865                        if let common::Retry::After(d) =
43866                            dlg.http_failure(&response, error.as_ref().ok())
43867                        {
43868                            sleep(d).await;
43869                            continue;
43870                        }
43871
43872                        dlg.finished(false);
43873
43874                        return Err(match error {
43875                            Ok(value) => common::Error::BadRequest(value),
43876                            _ => common::Error::Failure(response),
43877                        });
43878                    }
43879                    let response = {
43880                        let bytes = common::to_bytes(body).await.unwrap_or_default();
43881                        let encoded = common::to_string(&bytes);
43882                        match serde_json::from_str(&encoded) {
43883                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
43884                            Err(error) => {
43885                                dlg.response_json_decode_error(&encoded, &error);
43886                                return Err(common::Error::JsonDecodeError(
43887                                    encoded.to_string(),
43888                                    error,
43889                                ));
43890                            }
43891                        }
43892                    };
43893
43894                    dlg.finished(true);
43895                    return Ok(response);
43896                }
43897            }
43898        }
43899    }
43900
43901    ///
43902    /// Sets the *request* property to the given value.
43903    ///
43904    /// Even though the property as already been set when instantiating this call,
43905    /// we provide this method for API completeness.
43906    pub fn request(
43907        mut self,
43908        new_value: EditCustomerMatchMembersRequest,
43909    ) -> FirstAndThirdPartyAudienceEditCustomerMatchMemberCall<'a, C> {
43910        self._request = new_value;
43911        self
43912    }
43913    /// Required. The ID of the Customer Match FirstAndThirdPartyAudience whose members will be edited.
43914    ///
43915    /// Sets the *first and third party audience id* path property to the given value.
43916    ///
43917    /// Even though the property as already been set when instantiating this call,
43918    /// we provide this method for API completeness.
43919    pub fn first_and_third_party_audience_id(
43920        mut self,
43921        new_value: i64,
43922    ) -> FirstAndThirdPartyAudienceEditCustomerMatchMemberCall<'a, C> {
43923        self._first_and_third_party_audience_id = new_value;
43924        self
43925    }
43926    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
43927    /// while executing the actual API request.
43928    ///
43929    /// ````text
43930    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
43931    /// ````
43932    ///
43933    /// Sets the *delegate* property to the given value.
43934    pub fn delegate(
43935        mut self,
43936        new_value: &'a mut dyn common::Delegate,
43937    ) -> FirstAndThirdPartyAudienceEditCustomerMatchMemberCall<'a, C> {
43938        self._delegate = Some(new_value);
43939        self
43940    }
43941
43942    /// Set any additional parameter of the query string used in the request.
43943    /// It should be used to set parameters which are not yet available through their own
43944    /// setters.
43945    ///
43946    /// Please note that this method must not be used to set any of the known parameters
43947    /// which have their own setter method. If done anyway, the request will fail.
43948    ///
43949    /// # Additional Parameters
43950    ///
43951    /// * *$.xgafv* (query-string) - V1 error format.
43952    /// * *access_token* (query-string) - OAuth access token.
43953    /// * *alt* (query-string) - Data format for response.
43954    /// * *callback* (query-string) - JSONP
43955    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
43956    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
43957    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
43958    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
43959    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
43960    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
43961    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
43962    pub fn param<T>(
43963        mut self,
43964        name: T,
43965        value: T,
43966    ) -> FirstAndThirdPartyAudienceEditCustomerMatchMemberCall<'a, C>
43967    where
43968        T: AsRef<str>,
43969    {
43970        self._additional_params
43971            .insert(name.as_ref().to_string(), value.as_ref().to_string());
43972        self
43973    }
43974
43975    /// Identifies the authorization scope for the method you are building.
43976    ///
43977    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
43978    /// [`Scope::DisplayVideo`].
43979    ///
43980    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
43981    /// tokens for more than one scope.
43982    ///
43983    /// Usually there is more than one suitable scope to authorize an operation, some of which may
43984    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
43985    /// sufficient, a read-write scope will do as well.
43986    pub fn add_scope<St>(
43987        mut self,
43988        scope: St,
43989    ) -> FirstAndThirdPartyAudienceEditCustomerMatchMemberCall<'a, C>
43990    where
43991        St: AsRef<str>,
43992    {
43993        self._scopes.insert(String::from(scope.as_ref()));
43994        self
43995    }
43996    /// Identifies the authorization scope(s) for the method you are building.
43997    ///
43998    /// See [`Self::add_scope()`] for details.
43999    pub fn add_scopes<I, St>(
44000        mut self,
44001        scopes: I,
44002    ) -> FirstAndThirdPartyAudienceEditCustomerMatchMemberCall<'a, C>
44003    where
44004        I: IntoIterator<Item = St>,
44005        St: AsRef<str>,
44006    {
44007        self._scopes
44008            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
44009        self
44010    }
44011
44012    /// Removes all scopes, and no default scope will be used either.
44013    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
44014    /// for details).
44015    pub fn clear_scopes(mut self) -> FirstAndThirdPartyAudienceEditCustomerMatchMemberCall<'a, C> {
44016        self._scopes.clear();
44017        self
44018    }
44019}
44020
44021/// Gets a first and third party audience.
44022///
44023/// A builder for the *get* method supported by a *firstAndThirdPartyAudience* resource.
44024/// It is not used directly, but through a [`FirstAndThirdPartyAudienceMethods`] instance.
44025///
44026/// # Example
44027///
44028/// Instantiate a resource method builder
44029///
44030/// ```test_harness,no_run
44031/// # extern crate hyper;
44032/// # extern crate hyper_rustls;
44033/// # extern crate google_displayvideo1 as displayvideo1;
44034/// # async fn dox() {
44035/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
44036///
44037/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
44038/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
44039/// #     secret,
44040/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
44041/// # ).build().await.unwrap();
44042///
44043/// # let client = hyper_util::client::legacy::Client::builder(
44044/// #     hyper_util::rt::TokioExecutor::new()
44045/// # )
44046/// # .build(
44047/// #     hyper_rustls::HttpsConnectorBuilder::new()
44048/// #         .with_native_roots()
44049/// #         .unwrap()
44050/// #         .https_or_http()
44051/// #         .enable_http1()
44052/// #         .build()
44053/// # );
44054/// # let mut hub = DisplayVideo::new(client, auth);
44055/// // You can configure optional parameters by calling the respective setters at will, and
44056/// // execute the final call using `doit()`.
44057/// // Values shown here are possibly random and not representative !
44058/// let result = hub.first_and_third_party_audiences().get(-91)
44059///              .partner_id(-81)
44060///              .advertiser_id(-31)
44061///              .doit().await;
44062/// # }
44063/// ```
44064pub struct FirstAndThirdPartyAudienceGetCall<'a, C>
44065where
44066    C: 'a,
44067{
44068    hub: &'a DisplayVideo<C>,
44069    _first_and_third_party_audience_id: i64,
44070    _partner_id: Option<i64>,
44071    _advertiser_id: Option<i64>,
44072    _delegate: Option<&'a mut dyn common::Delegate>,
44073    _additional_params: HashMap<String, String>,
44074    _scopes: BTreeSet<String>,
44075}
44076
44077impl<'a, C> common::CallBuilder for FirstAndThirdPartyAudienceGetCall<'a, C> {}
44078
44079impl<'a, C> FirstAndThirdPartyAudienceGetCall<'a, C>
44080where
44081    C: common::Connector,
44082{
44083    /// Perform the operation you have build so far.
44084    pub async fn doit(mut self) -> common::Result<(common::Response, FirstAndThirdPartyAudience)> {
44085        use std::borrow::Cow;
44086        use std::io::{Read, Seek};
44087
44088        use common::{url::Params, ToParts};
44089        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
44090
44091        let mut dd = common::DefaultDelegate;
44092        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
44093        dlg.begin(common::MethodInfo {
44094            id: "displayvideo.firstAndThirdPartyAudiences.get",
44095            http_method: hyper::Method::GET,
44096        });
44097
44098        for &field in [
44099            "alt",
44100            "firstAndThirdPartyAudienceId",
44101            "partnerId",
44102            "advertiserId",
44103        ]
44104        .iter()
44105        {
44106            if self._additional_params.contains_key(field) {
44107                dlg.finished(false);
44108                return Err(common::Error::FieldClash(field));
44109            }
44110        }
44111
44112        let mut params = Params::with_capacity(5 + self._additional_params.len());
44113        params.push(
44114            "firstAndThirdPartyAudienceId",
44115            self._first_and_third_party_audience_id.to_string(),
44116        );
44117        if let Some(value) = self._partner_id.as_ref() {
44118            params.push("partnerId", value.to_string());
44119        }
44120        if let Some(value) = self._advertiser_id.as_ref() {
44121            params.push("advertiserId", value.to_string());
44122        }
44123
44124        params.extend(self._additional_params.iter());
44125
44126        params.push("alt", "json");
44127        let mut url = self.hub._base_url.clone()
44128            + "v1/firstAndThirdPartyAudiences/{+firstAndThirdPartyAudienceId}";
44129        if self._scopes.is_empty() {
44130            self._scopes
44131                .insert(Scope::DisplayVideo.as_ref().to_string());
44132        }
44133
44134        #[allow(clippy::single_element_loop)]
44135        for &(find_this, param_name) in [(
44136            "{+firstAndThirdPartyAudienceId}",
44137            "firstAndThirdPartyAudienceId",
44138        )]
44139        .iter()
44140        {
44141            url = params.uri_replacement(url, param_name, find_this, true);
44142        }
44143        {
44144            let to_remove = ["firstAndThirdPartyAudienceId"];
44145            params.remove_params(&to_remove);
44146        }
44147
44148        let url = params.parse_with_url(&url);
44149
44150        loop {
44151            let token = match self
44152                .hub
44153                .auth
44154                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
44155                .await
44156            {
44157                Ok(token) => token,
44158                Err(e) => match dlg.token(e) {
44159                    Ok(token) => token,
44160                    Err(e) => {
44161                        dlg.finished(false);
44162                        return Err(common::Error::MissingToken(e));
44163                    }
44164                },
44165            };
44166            let mut req_result = {
44167                let client = &self.hub.client;
44168                dlg.pre_request();
44169                let mut req_builder = hyper::Request::builder()
44170                    .method(hyper::Method::GET)
44171                    .uri(url.as_str())
44172                    .header(USER_AGENT, self.hub._user_agent.clone());
44173
44174                if let Some(token) = token.as_ref() {
44175                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
44176                }
44177
44178                let request = req_builder
44179                    .header(CONTENT_LENGTH, 0_u64)
44180                    .body(common::to_body::<String>(None));
44181
44182                client.request(request.unwrap()).await
44183            };
44184
44185            match req_result {
44186                Err(err) => {
44187                    if let common::Retry::After(d) = dlg.http_error(&err) {
44188                        sleep(d).await;
44189                        continue;
44190                    }
44191                    dlg.finished(false);
44192                    return Err(common::Error::HttpError(err));
44193                }
44194                Ok(res) => {
44195                    let (mut parts, body) = res.into_parts();
44196                    let mut body = common::Body::new(body);
44197                    if !parts.status.is_success() {
44198                        let bytes = common::to_bytes(body).await.unwrap_or_default();
44199                        let error = serde_json::from_str(&common::to_string(&bytes));
44200                        let response = common::to_response(parts, bytes.into());
44201
44202                        if let common::Retry::After(d) =
44203                            dlg.http_failure(&response, error.as_ref().ok())
44204                        {
44205                            sleep(d).await;
44206                            continue;
44207                        }
44208
44209                        dlg.finished(false);
44210
44211                        return Err(match error {
44212                            Ok(value) => common::Error::BadRequest(value),
44213                            _ => common::Error::Failure(response),
44214                        });
44215                    }
44216                    let response = {
44217                        let bytes = common::to_bytes(body).await.unwrap_or_default();
44218                        let encoded = common::to_string(&bytes);
44219                        match serde_json::from_str(&encoded) {
44220                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
44221                            Err(error) => {
44222                                dlg.response_json_decode_error(&encoded, &error);
44223                                return Err(common::Error::JsonDecodeError(
44224                                    encoded.to_string(),
44225                                    error,
44226                                ));
44227                            }
44228                        }
44229                    };
44230
44231                    dlg.finished(true);
44232                    return Ok(response);
44233                }
44234            }
44235        }
44236    }
44237
44238    /// Required. The ID of the first and third party audience to fetch.
44239    ///
44240    /// Sets the *first and third party audience id* path property to the given value.
44241    ///
44242    /// Even though the property as already been set when instantiating this call,
44243    /// we provide this method for API completeness.
44244    pub fn first_and_third_party_audience_id(
44245        mut self,
44246        new_value: i64,
44247    ) -> FirstAndThirdPartyAudienceGetCall<'a, C> {
44248        self._first_and_third_party_audience_id = new_value;
44249        self
44250    }
44251    /// The ID of the partner that has access to the fetched first and third party audience.
44252    ///
44253    /// Sets the *partner id* query property to the given value.
44254    pub fn partner_id(mut self, new_value: i64) -> FirstAndThirdPartyAudienceGetCall<'a, C> {
44255        self._partner_id = Some(new_value);
44256        self
44257    }
44258    /// The ID of the advertiser that has access to the fetched first and third party audience.
44259    ///
44260    /// Sets the *advertiser id* query property to the given value.
44261    pub fn advertiser_id(mut self, new_value: i64) -> FirstAndThirdPartyAudienceGetCall<'a, C> {
44262        self._advertiser_id = Some(new_value);
44263        self
44264    }
44265    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
44266    /// while executing the actual API request.
44267    ///
44268    /// ````text
44269    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
44270    /// ````
44271    ///
44272    /// Sets the *delegate* property to the given value.
44273    pub fn delegate(
44274        mut self,
44275        new_value: &'a mut dyn common::Delegate,
44276    ) -> FirstAndThirdPartyAudienceGetCall<'a, C> {
44277        self._delegate = Some(new_value);
44278        self
44279    }
44280
44281    /// Set any additional parameter of the query string used in the request.
44282    /// It should be used to set parameters which are not yet available through their own
44283    /// setters.
44284    ///
44285    /// Please note that this method must not be used to set any of the known parameters
44286    /// which have their own setter method. If done anyway, the request will fail.
44287    ///
44288    /// # Additional Parameters
44289    ///
44290    /// * *$.xgafv* (query-string) - V1 error format.
44291    /// * *access_token* (query-string) - OAuth access token.
44292    /// * *alt* (query-string) - Data format for response.
44293    /// * *callback* (query-string) - JSONP
44294    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
44295    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
44296    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
44297    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
44298    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
44299    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
44300    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
44301    pub fn param<T>(mut self, name: T, value: T) -> FirstAndThirdPartyAudienceGetCall<'a, C>
44302    where
44303        T: AsRef<str>,
44304    {
44305        self._additional_params
44306            .insert(name.as_ref().to_string(), value.as_ref().to_string());
44307        self
44308    }
44309
44310    /// Identifies the authorization scope for the method you are building.
44311    ///
44312    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
44313    /// [`Scope::DisplayVideo`].
44314    ///
44315    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
44316    /// tokens for more than one scope.
44317    ///
44318    /// Usually there is more than one suitable scope to authorize an operation, some of which may
44319    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
44320    /// sufficient, a read-write scope will do as well.
44321    pub fn add_scope<St>(mut self, scope: St) -> FirstAndThirdPartyAudienceGetCall<'a, C>
44322    where
44323        St: AsRef<str>,
44324    {
44325        self._scopes.insert(String::from(scope.as_ref()));
44326        self
44327    }
44328    /// Identifies the authorization scope(s) for the method you are building.
44329    ///
44330    /// See [`Self::add_scope()`] for details.
44331    pub fn add_scopes<I, St>(mut self, scopes: I) -> FirstAndThirdPartyAudienceGetCall<'a, C>
44332    where
44333        I: IntoIterator<Item = St>,
44334        St: AsRef<str>,
44335    {
44336        self._scopes
44337            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
44338        self
44339    }
44340
44341    /// Removes all scopes, and no default scope will be used either.
44342    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
44343    /// for details).
44344    pub fn clear_scopes(mut self) -> FirstAndThirdPartyAudienceGetCall<'a, C> {
44345        self._scopes.clear();
44346        self
44347    }
44348}
44349
44350/// Lists first and third party audiences. The order is defined by the order_by parameter.
44351///
44352/// A builder for the *list* method supported by a *firstAndThirdPartyAudience* resource.
44353/// It is not used directly, but through a [`FirstAndThirdPartyAudienceMethods`] instance.
44354///
44355/// # Example
44356///
44357/// Instantiate a resource method builder
44358///
44359/// ```test_harness,no_run
44360/// # extern crate hyper;
44361/// # extern crate hyper_rustls;
44362/// # extern crate google_displayvideo1 as displayvideo1;
44363/// # async fn dox() {
44364/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
44365///
44366/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
44367/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
44368/// #     secret,
44369/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
44370/// # ).build().await.unwrap();
44371///
44372/// # let client = hyper_util::client::legacy::Client::builder(
44373/// #     hyper_util::rt::TokioExecutor::new()
44374/// # )
44375/// # .build(
44376/// #     hyper_rustls::HttpsConnectorBuilder::new()
44377/// #         .with_native_roots()
44378/// #         .unwrap()
44379/// #         .https_or_http()
44380/// #         .enable_http1()
44381/// #         .build()
44382/// # );
44383/// # let mut hub = DisplayVideo::new(client, auth);
44384/// // You can configure optional parameters by calling the respective setters at will, and
44385/// // execute the final call using `doit()`.
44386/// // Values shown here are possibly random and not representative !
44387/// let result = hub.first_and_third_party_audiences().list()
44388///              .partner_id(-19)
44389///              .page_token("ipsum")
44390///              .page_size(-28)
44391///              .order_by("eos")
44392///              .filter("duo")
44393///              .advertiser_id(-94)
44394///              .doit().await;
44395/// # }
44396/// ```
44397pub struct FirstAndThirdPartyAudienceListCall<'a, C>
44398where
44399    C: 'a,
44400{
44401    hub: &'a DisplayVideo<C>,
44402    _partner_id: Option<i64>,
44403    _page_token: Option<String>,
44404    _page_size: Option<i32>,
44405    _order_by: Option<String>,
44406    _filter: Option<String>,
44407    _advertiser_id: Option<i64>,
44408    _delegate: Option<&'a mut dyn common::Delegate>,
44409    _additional_params: HashMap<String, String>,
44410    _scopes: BTreeSet<String>,
44411}
44412
44413impl<'a, C> common::CallBuilder for FirstAndThirdPartyAudienceListCall<'a, C> {}
44414
44415impl<'a, C> FirstAndThirdPartyAudienceListCall<'a, C>
44416where
44417    C: common::Connector,
44418{
44419    /// Perform the operation you have build so far.
44420    pub async fn doit(
44421        mut self,
44422    ) -> common::Result<(common::Response, ListFirstAndThirdPartyAudiencesResponse)> {
44423        use std::borrow::Cow;
44424        use std::io::{Read, Seek};
44425
44426        use common::{url::Params, ToParts};
44427        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
44428
44429        let mut dd = common::DefaultDelegate;
44430        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
44431        dlg.begin(common::MethodInfo {
44432            id: "displayvideo.firstAndThirdPartyAudiences.list",
44433            http_method: hyper::Method::GET,
44434        });
44435
44436        for &field in [
44437            "alt",
44438            "partnerId",
44439            "pageToken",
44440            "pageSize",
44441            "orderBy",
44442            "filter",
44443            "advertiserId",
44444        ]
44445        .iter()
44446        {
44447            if self._additional_params.contains_key(field) {
44448                dlg.finished(false);
44449                return Err(common::Error::FieldClash(field));
44450            }
44451        }
44452
44453        let mut params = Params::with_capacity(8 + self._additional_params.len());
44454        if let Some(value) = self._partner_id.as_ref() {
44455            params.push("partnerId", value.to_string());
44456        }
44457        if let Some(value) = self._page_token.as_ref() {
44458            params.push("pageToken", value);
44459        }
44460        if let Some(value) = self._page_size.as_ref() {
44461            params.push("pageSize", value.to_string());
44462        }
44463        if let Some(value) = self._order_by.as_ref() {
44464            params.push("orderBy", value);
44465        }
44466        if let Some(value) = self._filter.as_ref() {
44467            params.push("filter", value);
44468        }
44469        if let Some(value) = self._advertiser_id.as_ref() {
44470            params.push("advertiserId", value.to_string());
44471        }
44472
44473        params.extend(self._additional_params.iter());
44474
44475        params.push("alt", "json");
44476        let mut url = self.hub._base_url.clone() + "v1/firstAndThirdPartyAudiences";
44477        if self._scopes.is_empty() {
44478            self._scopes
44479                .insert(Scope::DisplayVideo.as_ref().to_string());
44480        }
44481
44482        let url = params.parse_with_url(&url);
44483
44484        loop {
44485            let token = match self
44486                .hub
44487                .auth
44488                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
44489                .await
44490            {
44491                Ok(token) => token,
44492                Err(e) => match dlg.token(e) {
44493                    Ok(token) => token,
44494                    Err(e) => {
44495                        dlg.finished(false);
44496                        return Err(common::Error::MissingToken(e));
44497                    }
44498                },
44499            };
44500            let mut req_result = {
44501                let client = &self.hub.client;
44502                dlg.pre_request();
44503                let mut req_builder = hyper::Request::builder()
44504                    .method(hyper::Method::GET)
44505                    .uri(url.as_str())
44506                    .header(USER_AGENT, self.hub._user_agent.clone());
44507
44508                if let Some(token) = token.as_ref() {
44509                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
44510                }
44511
44512                let request = req_builder
44513                    .header(CONTENT_LENGTH, 0_u64)
44514                    .body(common::to_body::<String>(None));
44515
44516                client.request(request.unwrap()).await
44517            };
44518
44519            match req_result {
44520                Err(err) => {
44521                    if let common::Retry::After(d) = dlg.http_error(&err) {
44522                        sleep(d).await;
44523                        continue;
44524                    }
44525                    dlg.finished(false);
44526                    return Err(common::Error::HttpError(err));
44527                }
44528                Ok(res) => {
44529                    let (mut parts, body) = res.into_parts();
44530                    let mut body = common::Body::new(body);
44531                    if !parts.status.is_success() {
44532                        let bytes = common::to_bytes(body).await.unwrap_or_default();
44533                        let error = serde_json::from_str(&common::to_string(&bytes));
44534                        let response = common::to_response(parts, bytes.into());
44535
44536                        if let common::Retry::After(d) =
44537                            dlg.http_failure(&response, error.as_ref().ok())
44538                        {
44539                            sleep(d).await;
44540                            continue;
44541                        }
44542
44543                        dlg.finished(false);
44544
44545                        return Err(match error {
44546                            Ok(value) => common::Error::BadRequest(value),
44547                            _ => common::Error::Failure(response),
44548                        });
44549                    }
44550                    let response = {
44551                        let bytes = common::to_bytes(body).await.unwrap_or_default();
44552                        let encoded = common::to_string(&bytes);
44553                        match serde_json::from_str(&encoded) {
44554                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
44555                            Err(error) => {
44556                                dlg.response_json_decode_error(&encoded, &error);
44557                                return Err(common::Error::JsonDecodeError(
44558                                    encoded.to_string(),
44559                                    error,
44560                                ));
44561                            }
44562                        }
44563                    };
44564
44565                    dlg.finished(true);
44566                    return Ok(response);
44567                }
44568            }
44569        }
44570    }
44571
44572    /// The ID of the partner that has access to the fetched first and third party audiences.
44573    ///
44574    /// Sets the *partner id* query property to the given value.
44575    pub fn partner_id(mut self, new_value: i64) -> FirstAndThirdPartyAudienceListCall<'a, C> {
44576        self._partner_id = Some(new_value);
44577        self
44578    }
44579    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListFirstAndThirdPartyAudiences` method. If not specified, the first page of results will be returned.
44580    ///
44581    /// Sets the *page token* query property to the given value.
44582    pub fn page_token(mut self, new_value: &str) -> FirstAndThirdPartyAudienceListCall<'a, C> {
44583        self._page_token = Some(new_value.to_string());
44584        self
44585    }
44586    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
44587    ///
44588    /// Sets the *page size* query property to the given value.
44589    pub fn page_size(mut self, new_value: i32) -> FirstAndThirdPartyAudienceListCall<'a, C> {
44590        self._page_size = Some(new_value);
44591        self
44592    }
44593    /// Field by which to sort the list. Acceptable values are: * `firstAndThirdPartyAudienceId` (default) * `displayName` The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `displayName desc`.
44594    ///
44595    /// Sets the *order by* query property to the given value.
44596    pub fn order_by(mut self, new_value: &str) -> FirstAndThirdPartyAudienceListCall<'a, C> {
44597        self._order_by = Some(new_value.to_string());
44598        self
44599    }
44600    /// Allows filtering by first and third party audience fields. Supported syntax: * Filter expressions for first and third party audiences can only contain at most one restriction. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `HAS (:)` operator. Supported fields: * `displayName` Examples: * All first and third party audiences for which the display name contains “Google”: `displayName:"Google"`. The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
44601    ///
44602    /// Sets the *filter* query property to the given value.
44603    pub fn filter(mut self, new_value: &str) -> FirstAndThirdPartyAudienceListCall<'a, C> {
44604        self._filter = Some(new_value.to_string());
44605        self
44606    }
44607    /// The ID of the advertiser that has access to the fetched first and third party audiences.
44608    ///
44609    /// Sets the *advertiser id* query property to the given value.
44610    pub fn advertiser_id(mut self, new_value: i64) -> FirstAndThirdPartyAudienceListCall<'a, C> {
44611        self._advertiser_id = Some(new_value);
44612        self
44613    }
44614    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
44615    /// while executing the actual API request.
44616    ///
44617    /// ````text
44618    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
44619    /// ````
44620    ///
44621    /// Sets the *delegate* property to the given value.
44622    pub fn delegate(
44623        mut self,
44624        new_value: &'a mut dyn common::Delegate,
44625    ) -> FirstAndThirdPartyAudienceListCall<'a, C> {
44626        self._delegate = Some(new_value);
44627        self
44628    }
44629
44630    /// Set any additional parameter of the query string used in the request.
44631    /// It should be used to set parameters which are not yet available through their own
44632    /// setters.
44633    ///
44634    /// Please note that this method must not be used to set any of the known parameters
44635    /// which have their own setter method. If done anyway, the request will fail.
44636    ///
44637    /// # Additional Parameters
44638    ///
44639    /// * *$.xgafv* (query-string) - V1 error format.
44640    /// * *access_token* (query-string) - OAuth access token.
44641    /// * *alt* (query-string) - Data format for response.
44642    /// * *callback* (query-string) - JSONP
44643    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
44644    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
44645    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
44646    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
44647    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
44648    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
44649    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
44650    pub fn param<T>(mut self, name: T, value: T) -> FirstAndThirdPartyAudienceListCall<'a, C>
44651    where
44652        T: AsRef<str>,
44653    {
44654        self._additional_params
44655            .insert(name.as_ref().to_string(), value.as_ref().to_string());
44656        self
44657    }
44658
44659    /// Identifies the authorization scope for the method you are building.
44660    ///
44661    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
44662    /// [`Scope::DisplayVideo`].
44663    ///
44664    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
44665    /// tokens for more than one scope.
44666    ///
44667    /// Usually there is more than one suitable scope to authorize an operation, some of which may
44668    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
44669    /// sufficient, a read-write scope will do as well.
44670    pub fn add_scope<St>(mut self, scope: St) -> FirstAndThirdPartyAudienceListCall<'a, C>
44671    where
44672        St: AsRef<str>,
44673    {
44674        self._scopes.insert(String::from(scope.as_ref()));
44675        self
44676    }
44677    /// Identifies the authorization scope(s) for the method you are building.
44678    ///
44679    /// See [`Self::add_scope()`] for details.
44680    pub fn add_scopes<I, St>(mut self, scopes: I) -> FirstAndThirdPartyAudienceListCall<'a, C>
44681    where
44682        I: IntoIterator<Item = St>,
44683        St: AsRef<str>,
44684    {
44685        self._scopes
44686            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
44687        self
44688    }
44689
44690    /// Removes all scopes, and no default scope will be used either.
44691    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
44692    /// for details).
44693    pub fn clear_scopes(mut self) -> FirstAndThirdPartyAudienceListCall<'a, C> {
44694        self._scopes.clear();
44695        self
44696    }
44697}
44698
44699/// Updates an existing FirstAndThirdPartyAudience. Only supported for the following audience_type: * `CUSTOMER_MATCH_CONTACT_INFO` * `CUSTOMER_MATCH_DEVICE_ID`
44700///
44701/// A builder for the *patch* method supported by a *firstAndThirdPartyAudience* resource.
44702/// It is not used directly, but through a [`FirstAndThirdPartyAudienceMethods`] instance.
44703///
44704/// # Example
44705///
44706/// Instantiate a resource method builder
44707///
44708/// ```test_harness,no_run
44709/// # extern crate hyper;
44710/// # extern crate hyper_rustls;
44711/// # extern crate google_displayvideo1 as displayvideo1;
44712/// use displayvideo1::api::FirstAndThirdPartyAudience;
44713/// # async fn dox() {
44714/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
44715///
44716/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
44717/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
44718/// #     secret,
44719/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
44720/// # ).build().await.unwrap();
44721///
44722/// # let client = hyper_util::client::legacy::Client::builder(
44723/// #     hyper_util::rt::TokioExecutor::new()
44724/// # )
44725/// # .build(
44726/// #     hyper_rustls::HttpsConnectorBuilder::new()
44727/// #         .with_native_roots()
44728/// #         .unwrap()
44729/// #         .https_or_http()
44730/// #         .enable_http1()
44731/// #         .build()
44732/// # );
44733/// # let mut hub = DisplayVideo::new(client, auth);
44734/// // As the method needs a request, you would usually fill it with the desired information
44735/// // into the respective structure. Some of the parts shown here might not be applicable !
44736/// // Values shown here are possibly random and not representative !
44737/// let mut req = FirstAndThirdPartyAudience::default();
44738///
44739/// // You can configure optional parameters by calling the respective setters at will, and
44740/// // execute the final call using `doit()`.
44741/// // Values shown here are possibly random and not representative !
44742/// let result = hub.first_and_third_party_audiences().patch(req, -46)
44743///              .update_mask(FieldMask::new::<&str>(&[]))
44744///              .advertiser_id(-72)
44745///              .doit().await;
44746/// # }
44747/// ```
44748pub struct FirstAndThirdPartyAudiencePatchCall<'a, C>
44749where
44750    C: 'a,
44751{
44752    hub: &'a DisplayVideo<C>,
44753    _request: FirstAndThirdPartyAudience,
44754    _first_and_third_party_audience_id: i64,
44755    _update_mask: Option<common::FieldMask>,
44756    _advertiser_id: Option<i64>,
44757    _delegate: Option<&'a mut dyn common::Delegate>,
44758    _additional_params: HashMap<String, String>,
44759    _scopes: BTreeSet<String>,
44760}
44761
44762impl<'a, C> common::CallBuilder for FirstAndThirdPartyAudiencePatchCall<'a, C> {}
44763
44764impl<'a, C> FirstAndThirdPartyAudiencePatchCall<'a, C>
44765where
44766    C: common::Connector,
44767{
44768    /// Perform the operation you have build so far.
44769    pub async fn doit(mut self) -> common::Result<(common::Response, FirstAndThirdPartyAudience)> {
44770        use std::borrow::Cow;
44771        use std::io::{Read, Seek};
44772
44773        use common::{url::Params, ToParts};
44774        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
44775
44776        let mut dd = common::DefaultDelegate;
44777        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
44778        dlg.begin(common::MethodInfo {
44779            id: "displayvideo.firstAndThirdPartyAudiences.patch",
44780            http_method: hyper::Method::PATCH,
44781        });
44782
44783        for &field in [
44784            "alt",
44785            "firstAndThirdPartyAudienceId",
44786            "updateMask",
44787            "advertiserId",
44788        ]
44789        .iter()
44790        {
44791            if self._additional_params.contains_key(field) {
44792                dlg.finished(false);
44793                return Err(common::Error::FieldClash(field));
44794            }
44795        }
44796
44797        let mut params = Params::with_capacity(6 + self._additional_params.len());
44798        params.push(
44799            "firstAndThirdPartyAudienceId",
44800            self._first_and_third_party_audience_id.to_string(),
44801        );
44802        if let Some(value) = self._update_mask.as_ref() {
44803            params.push("updateMask", value.to_string());
44804        }
44805        if let Some(value) = self._advertiser_id.as_ref() {
44806            params.push("advertiserId", value.to_string());
44807        }
44808
44809        params.extend(self._additional_params.iter());
44810
44811        params.push("alt", "json");
44812        let mut url = self.hub._base_url.clone()
44813            + "v1/firstAndThirdPartyAudiences/{+firstAndThirdPartyAudienceId}";
44814        if self._scopes.is_empty() {
44815            self._scopes
44816                .insert(Scope::DisplayVideo.as_ref().to_string());
44817        }
44818
44819        #[allow(clippy::single_element_loop)]
44820        for &(find_this, param_name) in [(
44821            "{+firstAndThirdPartyAudienceId}",
44822            "firstAndThirdPartyAudienceId",
44823        )]
44824        .iter()
44825        {
44826            url = params.uri_replacement(url, param_name, find_this, true);
44827        }
44828        {
44829            let to_remove = ["firstAndThirdPartyAudienceId"];
44830            params.remove_params(&to_remove);
44831        }
44832
44833        let url = params.parse_with_url(&url);
44834
44835        let mut json_mime_type = mime::APPLICATION_JSON;
44836        let mut request_value_reader = {
44837            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
44838            common::remove_json_null_values(&mut value);
44839            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
44840            serde_json::to_writer(&mut dst, &value).unwrap();
44841            dst
44842        };
44843        let request_size = request_value_reader
44844            .seek(std::io::SeekFrom::End(0))
44845            .unwrap();
44846        request_value_reader
44847            .seek(std::io::SeekFrom::Start(0))
44848            .unwrap();
44849
44850        loop {
44851            let token = match self
44852                .hub
44853                .auth
44854                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
44855                .await
44856            {
44857                Ok(token) => token,
44858                Err(e) => match dlg.token(e) {
44859                    Ok(token) => token,
44860                    Err(e) => {
44861                        dlg.finished(false);
44862                        return Err(common::Error::MissingToken(e));
44863                    }
44864                },
44865            };
44866            request_value_reader
44867                .seek(std::io::SeekFrom::Start(0))
44868                .unwrap();
44869            let mut req_result = {
44870                let client = &self.hub.client;
44871                dlg.pre_request();
44872                let mut req_builder = hyper::Request::builder()
44873                    .method(hyper::Method::PATCH)
44874                    .uri(url.as_str())
44875                    .header(USER_AGENT, self.hub._user_agent.clone());
44876
44877                if let Some(token) = token.as_ref() {
44878                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
44879                }
44880
44881                let request = req_builder
44882                    .header(CONTENT_TYPE, json_mime_type.to_string())
44883                    .header(CONTENT_LENGTH, request_size as u64)
44884                    .body(common::to_body(
44885                        request_value_reader.get_ref().clone().into(),
44886                    ));
44887
44888                client.request(request.unwrap()).await
44889            };
44890
44891            match req_result {
44892                Err(err) => {
44893                    if let common::Retry::After(d) = dlg.http_error(&err) {
44894                        sleep(d).await;
44895                        continue;
44896                    }
44897                    dlg.finished(false);
44898                    return Err(common::Error::HttpError(err));
44899                }
44900                Ok(res) => {
44901                    let (mut parts, body) = res.into_parts();
44902                    let mut body = common::Body::new(body);
44903                    if !parts.status.is_success() {
44904                        let bytes = common::to_bytes(body).await.unwrap_or_default();
44905                        let error = serde_json::from_str(&common::to_string(&bytes));
44906                        let response = common::to_response(parts, bytes.into());
44907
44908                        if let common::Retry::After(d) =
44909                            dlg.http_failure(&response, error.as_ref().ok())
44910                        {
44911                            sleep(d).await;
44912                            continue;
44913                        }
44914
44915                        dlg.finished(false);
44916
44917                        return Err(match error {
44918                            Ok(value) => common::Error::BadRequest(value),
44919                            _ => common::Error::Failure(response),
44920                        });
44921                    }
44922                    let response = {
44923                        let bytes = common::to_bytes(body).await.unwrap_or_default();
44924                        let encoded = common::to_string(&bytes);
44925                        match serde_json::from_str(&encoded) {
44926                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
44927                            Err(error) => {
44928                                dlg.response_json_decode_error(&encoded, &error);
44929                                return Err(common::Error::JsonDecodeError(
44930                                    encoded.to_string(),
44931                                    error,
44932                                ));
44933                            }
44934                        }
44935                    };
44936
44937                    dlg.finished(true);
44938                    return Ok(response);
44939                }
44940            }
44941        }
44942    }
44943
44944    ///
44945    /// Sets the *request* property to the given value.
44946    ///
44947    /// Even though the property as already been set when instantiating this call,
44948    /// we provide this method for API completeness.
44949    pub fn request(
44950        mut self,
44951        new_value: FirstAndThirdPartyAudience,
44952    ) -> FirstAndThirdPartyAudiencePatchCall<'a, C> {
44953        self._request = new_value;
44954        self
44955    }
44956    /// Output only. The unique ID of the first and third party audience. Assigned by the system.
44957    ///
44958    /// Sets the *first and third party audience id* path property to the given value.
44959    ///
44960    /// Even though the property as already been set when instantiating this call,
44961    /// we provide this method for API completeness.
44962    pub fn first_and_third_party_audience_id(
44963        mut self,
44964        new_value: i64,
44965    ) -> FirstAndThirdPartyAudiencePatchCall<'a, C> {
44966        self._first_and_third_party_audience_id = new_value;
44967        self
44968    }
44969    /// Required. The mask to control which fields to update. Updates are only supported for the following fields: * `displayName` * `description` * `membershipDurationDays`
44970    ///
44971    /// Sets the *update mask* query property to the given value.
44972    pub fn update_mask(
44973        mut self,
44974        new_value: common::FieldMask,
44975    ) -> FirstAndThirdPartyAudiencePatchCall<'a, C> {
44976        self._update_mask = Some(new_value);
44977        self
44978    }
44979    /// Required. The ID of the owner advertiser of the updated FirstAndThirdPartyAudience.
44980    ///
44981    /// Sets the *advertiser id* query property to the given value.
44982    pub fn advertiser_id(mut self, new_value: i64) -> FirstAndThirdPartyAudiencePatchCall<'a, C> {
44983        self._advertiser_id = Some(new_value);
44984        self
44985    }
44986    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
44987    /// while executing the actual API request.
44988    ///
44989    /// ````text
44990    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
44991    /// ````
44992    ///
44993    /// Sets the *delegate* property to the given value.
44994    pub fn delegate(
44995        mut self,
44996        new_value: &'a mut dyn common::Delegate,
44997    ) -> FirstAndThirdPartyAudiencePatchCall<'a, C> {
44998        self._delegate = Some(new_value);
44999        self
45000    }
45001
45002    /// Set any additional parameter of the query string used in the request.
45003    /// It should be used to set parameters which are not yet available through their own
45004    /// setters.
45005    ///
45006    /// Please note that this method must not be used to set any of the known parameters
45007    /// which have their own setter method. If done anyway, the request will fail.
45008    ///
45009    /// # Additional Parameters
45010    ///
45011    /// * *$.xgafv* (query-string) - V1 error format.
45012    /// * *access_token* (query-string) - OAuth access token.
45013    /// * *alt* (query-string) - Data format for response.
45014    /// * *callback* (query-string) - JSONP
45015    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
45016    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
45017    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
45018    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
45019    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
45020    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
45021    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
45022    pub fn param<T>(mut self, name: T, value: T) -> FirstAndThirdPartyAudiencePatchCall<'a, C>
45023    where
45024        T: AsRef<str>,
45025    {
45026        self._additional_params
45027            .insert(name.as_ref().to_string(), value.as_ref().to_string());
45028        self
45029    }
45030
45031    /// Identifies the authorization scope for the method you are building.
45032    ///
45033    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
45034    /// [`Scope::DisplayVideo`].
45035    ///
45036    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
45037    /// tokens for more than one scope.
45038    ///
45039    /// Usually there is more than one suitable scope to authorize an operation, some of which may
45040    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
45041    /// sufficient, a read-write scope will do as well.
45042    pub fn add_scope<St>(mut self, scope: St) -> FirstAndThirdPartyAudiencePatchCall<'a, C>
45043    where
45044        St: AsRef<str>,
45045    {
45046        self._scopes.insert(String::from(scope.as_ref()));
45047        self
45048    }
45049    /// Identifies the authorization scope(s) for the method you are building.
45050    ///
45051    /// See [`Self::add_scope()`] for details.
45052    pub fn add_scopes<I, St>(mut self, scopes: I) -> FirstAndThirdPartyAudiencePatchCall<'a, C>
45053    where
45054        I: IntoIterator<Item = St>,
45055        St: AsRef<str>,
45056    {
45057        self._scopes
45058            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
45059        self
45060    }
45061
45062    /// Removes all scopes, and no default scope will be used either.
45063    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
45064    /// for details).
45065    pub fn clear_scopes(mut self) -> FirstAndThirdPartyAudiencePatchCall<'a, C> {
45066        self._scopes.clear();
45067        self
45068    }
45069}
45070
45071/// Gets a Floodlight group.
45072///
45073/// A builder for the *get* method supported by a *floodlightGroup* resource.
45074/// It is not used directly, but through a [`FloodlightGroupMethods`] instance.
45075///
45076/// # Example
45077///
45078/// Instantiate a resource method builder
45079///
45080/// ```test_harness,no_run
45081/// # extern crate hyper;
45082/// # extern crate hyper_rustls;
45083/// # extern crate google_displayvideo1 as displayvideo1;
45084/// # async fn dox() {
45085/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
45086///
45087/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
45088/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
45089/// #     secret,
45090/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
45091/// # ).build().await.unwrap();
45092///
45093/// # let client = hyper_util::client::legacy::Client::builder(
45094/// #     hyper_util::rt::TokioExecutor::new()
45095/// # )
45096/// # .build(
45097/// #     hyper_rustls::HttpsConnectorBuilder::new()
45098/// #         .with_native_roots()
45099/// #         .unwrap()
45100/// #         .https_or_http()
45101/// #         .enable_http1()
45102/// #         .build()
45103/// # );
45104/// # let mut hub = DisplayVideo::new(client, auth);
45105/// // You can configure optional parameters by calling the respective setters at will, and
45106/// // execute the final call using `doit()`.
45107/// // Values shown here are possibly random and not representative !
45108/// let result = hub.floodlight_groups().get(-14)
45109///              .partner_id(-1)
45110///              .doit().await;
45111/// # }
45112/// ```
45113pub struct FloodlightGroupGetCall<'a, C>
45114where
45115    C: 'a,
45116{
45117    hub: &'a DisplayVideo<C>,
45118    _floodlight_group_id: i64,
45119    _partner_id: Option<i64>,
45120    _delegate: Option<&'a mut dyn common::Delegate>,
45121    _additional_params: HashMap<String, String>,
45122    _scopes: BTreeSet<String>,
45123}
45124
45125impl<'a, C> common::CallBuilder for FloodlightGroupGetCall<'a, C> {}
45126
45127impl<'a, C> FloodlightGroupGetCall<'a, C>
45128where
45129    C: common::Connector,
45130{
45131    /// Perform the operation you have build so far.
45132    pub async fn doit(mut self) -> common::Result<(common::Response, FloodlightGroup)> {
45133        use std::borrow::Cow;
45134        use std::io::{Read, Seek};
45135
45136        use common::{url::Params, ToParts};
45137        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
45138
45139        let mut dd = common::DefaultDelegate;
45140        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
45141        dlg.begin(common::MethodInfo {
45142            id: "displayvideo.floodlightGroups.get",
45143            http_method: hyper::Method::GET,
45144        });
45145
45146        for &field in ["alt", "floodlightGroupId", "partnerId"].iter() {
45147            if self._additional_params.contains_key(field) {
45148                dlg.finished(false);
45149                return Err(common::Error::FieldClash(field));
45150            }
45151        }
45152
45153        let mut params = Params::with_capacity(4 + self._additional_params.len());
45154        params.push("floodlightGroupId", self._floodlight_group_id.to_string());
45155        if let Some(value) = self._partner_id.as_ref() {
45156            params.push("partnerId", value.to_string());
45157        }
45158
45159        params.extend(self._additional_params.iter());
45160
45161        params.push("alt", "json");
45162        let mut url = self.hub._base_url.clone() + "v1/floodlightGroups/{+floodlightGroupId}";
45163        if self._scopes.is_empty() {
45164            self._scopes
45165                .insert(Scope::DisplayVideo.as_ref().to_string());
45166        }
45167
45168        #[allow(clippy::single_element_loop)]
45169        for &(find_this, param_name) in [("{+floodlightGroupId}", "floodlightGroupId")].iter() {
45170            url = params.uri_replacement(url, param_name, find_this, true);
45171        }
45172        {
45173            let to_remove = ["floodlightGroupId"];
45174            params.remove_params(&to_remove);
45175        }
45176
45177        let url = params.parse_with_url(&url);
45178
45179        loop {
45180            let token = match self
45181                .hub
45182                .auth
45183                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
45184                .await
45185            {
45186                Ok(token) => token,
45187                Err(e) => match dlg.token(e) {
45188                    Ok(token) => token,
45189                    Err(e) => {
45190                        dlg.finished(false);
45191                        return Err(common::Error::MissingToken(e));
45192                    }
45193                },
45194            };
45195            let mut req_result = {
45196                let client = &self.hub.client;
45197                dlg.pre_request();
45198                let mut req_builder = hyper::Request::builder()
45199                    .method(hyper::Method::GET)
45200                    .uri(url.as_str())
45201                    .header(USER_AGENT, self.hub._user_agent.clone());
45202
45203                if let Some(token) = token.as_ref() {
45204                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
45205                }
45206
45207                let request = req_builder
45208                    .header(CONTENT_LENGTH, 0_u64)
45209                    .body(common::to_body::<String>(None));
45210
45211                client.request(request.unwrap()).await
45212            };
45213
45214            match req_result {
45215                Err(err) => {
45216                    if let common::Retry::After(d) = dlg.http_error(&err) {
45217                        sleep(d).await;
45218                        continue;
45219                    }
45220                    dlg.finished(false);
45221                    return Err(common::Error::HttpError(err));
45222                }
45223                Ok(res) => {
45224                    let (mut parts, body) = res.into_parts();
45225                    let mut body = common::Body::new(body);
45226                    if !parts.status.is_success() {
45227                        let bytes = common::to_bytes(body).await.unwrap_or_default();
45228                        let error = serde_json::from_str(&common::to_string(&bytes));
45229                        let response = common::to_response(parts, bytes.into());
45230
45231                        if let common::Retry::After(d) =
45232                            dlg.http_failure(&response, error.as_ref().ok())
45233                        {
45234                            sleep(d).await;
45235                            continue;
45236                        }
45237
45238                        dlg.finished(false);
45239
45240                        return Err(match error {
45241                            Ok(value) => common::Error::BadRequest(value),
45242                            _ => common::Error::Failure(response),
45243                        });
45244                    }
45245                    let response = {
45246                        let bytes = common::to_bytes(body).await.unwrap_or_default();
45247                        let encoded = common::to_string(&bytes);
45248                        match serde_json::from_str(&encoded) {
45249                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
45250                            Err(error) => {
45251                                dlg.response_json_decode_error(&encoded, &error);
45252                                return Err(common::Error::JsonDecodeError(
45253                                    encoded.to_string(),
45254                                    error,
45255                                ));
45256                            }
45257                        }
45258                    };
45259
45260                    dlg.finished(true);
45261                    return Ok(response);
45262                }
45263            }
45264        }
45265    }
45266
45267    /// Required. The ID of the Floodlight group to fetch.
45268    ///
45269    /// Sets the *floodlight group id* path property to the given value.
45270    ///
45271    /// Even though the property as already been set when instantiating this call,
45272    /// we provide this method for API completeness.
45273    pub fn floodlight_group_id(mut self, new_value: i64) -> FloodlightGroupGetCall<'a, C> {
45274        self._floodlight_group_id = new_value;
45275        self
45276    }
45277    /// Required. The partner context by which the Floodlight group is being accessed.
45278    ///
45279    /// Sets the *partner id* query property to the given value.
45280    pub fn partner_id(mut self, new_value: i64) -> FloodlightGroupGetCall<'a, C> {
45281        self._partner_id = Some(new_value);
45282        self
45283    }
45284    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
45285    /// while executing the actual API request.
45286    ///
45287    /// ````text
45288    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
45289    /// ````
45290    ///
45291    /// Sets the *delegate* property to the given value.
45292    pub fn delegate(
45293        mut self,
45294        new_value: &'a mut dyn common::Delegate,
45295    ) -> FloodlightGroupGetCall<'a, C> {
45296        self._delegate = Some(new_value);
45297        self
45298    }
45299
45300    /// Set any additional parameter of the query string used in the request.
45301    /// It should be used to set parameters which are not yet available through their own
45302    /// setters.
45303    ///
45304    /// Please note that this method must not be used to set any of the known parameters
45305    /// which have their own setter method. If done anyway, the request will fail.
45306    ///
45307    /// # Additional Parameters
45308    ///
45309    /// * *$.xgafv* (query-string) - V1 error format.
45310    /// * *access_token* (query-string) - OAuth access token.
45311    /// * *alt* (query-string) - Data format for response.
45312    /// * *callback* (query-string) - JSONP
45313    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
45314    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
45315    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
45316    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
45317    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
45318    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
45319    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
45320    pub fn param<T>(mut self, name: T, value: T) -> FloodlightGroupGetCall<'a, C>
45321    where
45322        T: AsRef<str>,
45323    {
45324        self._additional_params
45325            .insert(name.as_ref().to_string(), value.as_ref().to_string());
45326        self
45327    }
45328
45329    /// Identifies the authorization scope for the method you are building.
45330    ///
45331    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
45332    /// [`Scope::DisplayVideo`].
45333    ///
45334    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
45335    /// tokens for more than one scope.
45336    ///
45337    /// Usually there is more than one suitable scope to authorize an operation, some of which may
45338    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
45339    /// sufficient, a read-write scope will do as well.
45340    pub fn add_scope<St>(mut self, scope: St) -> FloodlightGroupGetCall<'a, C>
45341    where
45342        St: AsRef<str>,
45343    {
45344        self._scopes.insert(String::from(scope.as_ref()));
45345        self
45346    }
45347    /// Identifies the authorization scope(s) for the method you are building.
45348    ///
45349    /// See [`Self::add_scope()`] for details.
45350    pub fn add_scopes<I, St>(mut self, scopes: I) -> FloodlightGroupGetCall<'a, C>
45351    where
45352        I: IntoIterator<Item = St>,
45353        St: AsRef<str>,
45354    {
45355        self._scopes
45356            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
45357        self
45358    }
45359
45360    /// Removes all scopes, and no default scope will be used either.
45361    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
45362    /// for details).
45363    pub fn clear_scopes(mut self) -> FloodlightGroupGetCall<'a, C> {
45364        self._scopes.clear();
45365        self
45366    }
45367}
45368
45369/// Updates an existing Floodlight group. Returns the updated Floodlight group if successful.
45370///
45371/// A builder for the *patch* method supported by a *floodlightGroup* resource.
45372/// It is not used directly, but through a [`FloodlightGroupMethods`] instance.
45373///
45374/// # Example
45375///
45376/// Instantiate a resource method builder
45377///
45378/// ```test_harness,no_run
45379/// # extern crate hyper;
45380/// # extern crate hyper_rustls;
45381/// # extern crate google_displayvideo1 as displayvideo1;
45382/// use displayvideo1::api::FloodlightGroup;
45383/// # async fn dox() {
45384/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
45385///
45386/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
45387/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
45388/// #     secret,
45389/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
45390/// # ).build().await.unwrap();
45391///
45392/// # let client = hyper_util::client::legacy::Client::builder(
45393/// #     hyper_util::rt::TokioExecutor::new()
45394/// # )
45395/// # .build(
45396/// #     hyper_rustls::HttpsConnectorBuilder::new()
45397/// #         .with_native_roots()
45398/// #         .unwrap()
45399/// #         .https_or_http()
45400/// #         .enable_http1()
45401/// #         .build()
45402/// # );
45403/// # let mut hub = DisplayVideo::new(client, auth);
45404/// // As the method needs a request, you would usually fill it with the desired information
45405/// // into the respective structure. Some of the parts shown here might not be applicable !
45406/// // Values shown here are possibly random and not representative !
45407/// let mut req = FloodlightGroup::default();
45408///
45409/// // You can configure optional parameters by calling the respective setters at will, and
45410/// // execute the final call using `doit()`.
45411/// // Values shown here are possibly random and not representative !
45412/// let result = hub.floodlight_groups().patch(req, -48)
45413///              .update_mask(FieldMask::new::<&str>(&[]))
45414///              .partner_id(-59)
45415///              .doit().await;
45416/// # }
45417/// ```
45418pub struct FloodlightGroupPatchCall<'a, C>
45419where
45420    C: 'a,
45421{
45422    hub: &'a DisplayVideo<C>,
45423    _request: FloodlightGroup,
45424    _floodlight_group_id: i64,
45425    _update_mask: Option<common::FieldMask>,
45426    _partner_id: Option<i64>,
45427    _delegate: Option<&'a mut dyn common::Delegate>,
45428    _additional_params: HashMap<String, String>,
45429    _scopes: BTreeSet<String>,
45430}
45431
45432impl<'a, C> common::CallBuilder for FloodlightGroupPatchCall<'a, C> {}
45433
45434impl<'a, C> FloodlightGroupPatchCall<'a, C>
45435where
45436    C: common::Connector,
45437{
45438    /// Perform the operation you have build so far.
45439    pub async fn doit(mut self) -> common::Result<(common::Response, FloodlightGroup)> {
45440        use std::borrow::Cow;
45441        use std::io::{Read, Seek};
45442
45443        use common::{url::Params, ToParts};
45444        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
45445
45446        let mut dd = common::DefaultDelegate;
45447        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
45448        dlg.begin(common::MethodInfo {
45449            id: "displayvideo.floodlightGroups.patch",
45450            http_method: hyper::Method::PATCH,
45451        });
45452
45453        for &field in ["alt", "floodlightGroupId", "updateMask", "partnerId"].iter() {
45454            if self._additional_params.contains_key(field) {
45455                dlg.finished(false);
45456                return Err(common::Error::FieldClash(field));
45457            }
45458        }
45459
45460        let mut params = Params::with_capacity(6 + self._additional_params.len());
45461        params.push("floodlightGroupId", self._floodlight_group_id.to_string());
45462        if let Some(value) = self._update_mask.as_ref() {
45463            params.push("updateMask", value.to_string());
45464        }
45465        if let Some(value) = self._partner_id.as_ref() {
45466            params.push("partnerId", value.to_string());
45467        }
45468
45469        params.extend(self._additional_params.iter());
45470
45471        params.push("alt", "json");
45472        let mut url = self.hub._base_url.clone() + "v1/floodlightGroups/{floodlightGroupId}";
45473        if self._scopes.is_empty() {
45474            self._scopes
45475                .insert(Scope::DisplayVideo.as_ref().to_string());
45476        }
45477
45478        #[allow(clippy::single_element_loop)]
45479        for &(find_this, param_name) in [("{floodlightGroupId}", "floodlightGroupId")].iter() {
45480            url = params.uri_replacement(url, param_name, find_this, false);
45481        }
45482        {
45483            let to_remove = ["floodlightGroupId"];
45484            params.remove_params(&to_remove);
45485        }
45486
45487        let url = params.parse_with_url(&url);
45488
45489        let mut json_mime_type = mime::APPLICATION_JSON;
45490        let mut request_value_reader = {
45491            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
45492            common::remove_json_null_values(&mut value);
45493            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
45494            serde_json::to_writer(&mut dst, &value).unwrap();
45495            dst
45496        };
45497        let request_size = request_value_reader
45498            .seek(std::io::SeekFrom::End(0))
45499            .unwrap();
45500        request_value_reader
45501            .seek(std::io::SeekFrom::Start(0))
45502            .unwrap();
45503
45504        loop {
45505            let token = match self
45506                .hub
45507                .auth
45508                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
45509                .await
45510            {
45511                Ok(token) => token,
45512                Err(e) => match dlg.token(e) {
45513                    Ok(token) => token,
45514                    Err(e) => {
45515                        dlg.finished(false);
45516                        return Err(common::Error::MissingToken(e));
45517                    }
45518                },
45519            };
45520            request_value_reader
45521                .seek(std::io::SeekFrom::Start(0))
45522                .unwrap();
45523            let mut req_result = {
45524                let client = &self.hub.client;
45525                dlg.pre_request();
45526                let mut req_builder = hyper::Request::builder()
45527                    .method(hyper::Method::PATCH)
45528                    .uri(url.as_str())
45529                    .header(USER_AGENT, self.hub._user_agent.clone());
45530
45531                if let Some(token) = token.as_ref() {
45532                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
45533                }
45534
45535                let request = req_builder
45536                    .header(CONTENT_TYPE, json_mime_type.to_string())
45537                    .header(CONTENT_LENGTH, request_size as u64)
45538                    .body(common::to_body(
45539                        request_value_reader.get_ref().clone().into(),
45540                    ));
45541
45542                client.request(request.unwrap()).await
45543            };
45544
45545            match req_result {
45546                Err(err) => {
45547                    if let common::Retry::After(d) = dlg.http_error(&err) {
45548                        sleep(d).await;
45549                        continue;
45550                    }
45551                    dlg.finished(false);
45552                    return Err(common::Error::HttpError(err));
45553                }
45554                Ok(res) => {
45555                    let (mut parts, body) = res.into_parts();
45556                    let mut body = common::Body::new(body);
45557                    if !parts.status.is_success() {
45558                        let bytes = common::to_bytes(body).await.unwrap_or_default();
45559                        let error = serde_json::from_str(&common::to_string(&bytes));
45560                        let response = common::to_response(parts, bytes.into());
45561
45562                        if let common::Retry::After(d) =
45563                            dlg.http_failure(&response, error.as_ref().ok())
45564                        {
45565                            sleep(d).await;
45566                            continue;
45567                        }
45568
45569                        dlg.finished(false);
45570
45571                        return Err(match error {
45572                            Ok(value) => common::Error::BadRequest(value),
45573                            _ => common::Error::Failure(response),
45574                        });
45575                    }
45576                    let response = {
45577                        let bytes = common::to_bytes(body).await.unwrap_or_default();
45578                        let encoded = common::to_string(&bytes);
45579                        match serde_json::from_str(&encoded) {
45580                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
45581                            Err(error) => {
45582                                dlg.response_json_decode_error(&encoded, &error);
45583                                return Err(common::Error::JsonDecodeError(
45584                                    encoded.to_string(),
45585                                    error,
45586                                ));
45587                            }
45588                        }
45589                    };
45590
45591                    dlg.finished(true);
45592                    return Ok(response);
45593                }
45594            }
45595        }
45596    }
45597
45598    ///
45599    /// Sets the *request* property to the given value.
45600    ///
45601    /// Even though the property as already been set when instantiating this call,
45602    /// we provide this method for API completeness.
45603    pub fn request(mut self, new_value: FloodlightGroup) -> FloodlightGroupPatchCall<'a, C> {
45604        self._request = new_value;
45605        self
45606    }
45607    /// Output only. The unique ID of the Floodlight group. Assigned by the system.
45608    ///
45609    /// Sets the *floodlight group id* path property to the given value.
45610    ///
45611    /// Even though the property as already been set when instantiating this call,
45612    /// we provide this method for API completeness.
45613    pub fn floodlight_group_id(mut self, new_value: i64) -> FloodlightGroupPatchCall<'a, C> {
45614        self._floodlight_group_id = new_value;
45615        self
45616    }
45617    /// Required. The mask to control which fields to update.
45618    ///
45619    /// Sets the *update mask* query property to the given value.
45620    pub fn update_mask(mut self, new_value: common::FieldMask) -> FloodlightGroupPatchCall<'a, C> {
45621        self._update_mask = Some(new_value);
45622        self
45623    }
45624    /// Required. The partner context by which the Floodlight group is being accessed.
45625    ///
45626    /// Sets the *partner id* query property to the given value.
45627    pub fn partner_id(mut self, new_value: i64) -> FloodlightGroupPatchCall<'a, C> {
45628        self._partner_id = Some(new_value);
45629        self
45630    }
45631    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
45632    /// while executing the actual API request.
45633    ///
45634    /// ````text
45635    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
45636    /// ````
45637    ///
45638    /// Sets the *delegate* property to the given value.
45639    pub fn delegate(
45640        mut self,
45641        new_value: &'a mut dyn common::Delegate,
45642    ) -> FloodlightGroupPatchCall<'a, C> {
45643        self._delegate = Some(new_value);
45644        self
45645    }
45646
45647    /// Set any additional parameter of the query string used in the request.
45648    /// It should be used to set parameters which are not yet available through their own
45649    /// setters.
45650    ///
45651    /// Please note that this method must not be used to set any of the known parameters
45652    /// which have their own setter method. If done anyway, the request will fail.
45653    ///
45654    /// # Additional Parameters
45655    ///
45656    /// * *$.xgafv* (query-string) - V1 error format.
45657    /// * *access_token* (query-string) - OAuth access token.
45658    /// * *alt* (query-string) - Data format for response.
45659    /// * *callback* (query-string) - JSONP
45660    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
45661    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
45662    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
45663    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
45664    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
45665    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
45666    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
45667    pub fn param<T>(mut self, name: T, value: T) -> FloodlightGroupPatchCall<'a, C>
45668    where
45669        T: AsRef<str>,
45670    {
45671        self._additional_params
45672            .insert(name.as_ref().to_string(), value.as_ref().to_string());
45673        self
45674    }
45675
45676    /// Identifies the authorization scope for the method you are building.
45677    ///
45678    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
45679    /// [`Scope::DisplayVideo`].
45680    ///
45681    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
45682    /// tokens for more than one scope.
45683    ///
45684    /// Usually there is more than one suitable scope to authorize an operation, some of which may
45685    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
45686    /// sufficient, a read-write scope will do as well.
45687    pub fn add_scope<St>(mut self, scope: St) -> FloodlightGroupPatchCall<'a, C>
45688    where
45689        St: AsRef<str>,
45690    {
45691        self._scopes.insert(String::from(scope.as_ref()));
45692        self
45693    }
45694    /// Identifies the authorization scope(s) for the method you are building.
45695    ///
45696    /// See [`Self::add_scope()`] for details.
45697    pub fn add_scopes<I, St>(mut self, scopes: I) -> FloodlightGroupPatchCall<'a, C>
45698    where
45699        I: IntoIterator<Item = St>,
45700        St: AsRef<str>,
45701    {
45702        self._scopes
45703            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
45704        self
45705    }
45706
45707    /// Removes all scopes, and no default scope will be used either.
45708    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
45709    /// for details).
45710    pub fn clear_scopes(mut self) -> FloodlightGroupPatchCall<'a, C> {
45711        self._scopes.clear();
45712        self
45713    }
45714}
45715
45716/// Gets a Google audience.
45717///
45718/// A builder for the *get* method supported by a *googleAudience* resource.
45719/// It is not used directly, but through a [`GoogleAudienceMethods`] instance.
45720///
45721/// # Example
45722///
45723/// Instantiate a resource method builder
45724///
45725/// ```test_harness,no_run
45726/// # extern crate hyper;
45727/// # extern crate hyper_rustls;
45728/// # extern crate google_displayvideo1 as displayvideo1;
45729/// # async fn dox() {
45730/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
45731///
45732/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
45733/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
45734/// #     secret,
45735/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
45736/// # ).build().await.unwrap();
45737///
45738/// # let client = hyper_util::client::legacy::Client::builder(
45739/// #     hyper_util::rt::TokioExecutor::new()
45740/// # )
45741/// # .build(
45742/// #     hyper_rustls::HttpsConnectorBuilder::new()
45743/// #         .with_native_roots()
45744/// #         .unwrap()
45745/// #         .https_or_http()
45746/// #         .enable_http1()
45747/// #         .build()
45748/// # );
45749/// # let mut hub = DisplayVideo::new(client, auth);
45750/// // You can configure optional parameters by calling the respective setters at will, and
45751/// // execute the final call using `doit()`.
45752/// // Values shown here are possibly random and not representative !
45753/// let result = hub.google_audiences().get(-31)
45754///              .partner_id(-42)
45755///              .advertiser_id(-41)
45756///              .doit().await;
45757/// # }
45758/// ```
45759pub struct GoogleAudienceGetCall<'a, C>
45760where
45761    C: 'a,
45762{
45763    hub: &'a DisplayVideo<C>,
45764    _google_audience_id: i64,
45765    _partner_id: Option<i64>,
45766    _advertiser_id: Option<i64>,
45767    _delegate: Option<&'a mut dyn common::Delegate>,
45768    _additional_params: HashMap<String, String>,
45769    _scopes: BTreeSet<String>,
45770}
45771
45772impl<'a, C> common::CallBuilder for GoogleAudienceGetCall<'a, C> {}
45773
45774impl<'a, C> GoogleAudienceGetCall<'a, C>
45775where
45776    C: common::Connector,
45777{
45778    /// Perform the operation you have build so far.
45779    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleAudience)> {
45780        use std::borrow::Cow;
45781        use std::io::{Read, Seek};
45782
45783        use common::{url::Params, ToParts};
45784        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
45785
45786        let mut dd = common::DefaultDelegate;
45787        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
45788        dlg.begin(common::MethodInfo {
45789            id: "displayvideo.googleAudiences.get",
45790            http_method: hyper::Method::GET,
45791        });
45792
45793        for &field in ["alt", "googleAudienceId", "partnerId", "advertiserId"].iter() {
45794            if self._additional_params.contains_key(field) {
45795                dlg.finished(false);
45796                return Err(common::Error::FieldClash(field));
45797            }
45798        }
45799
45800        let mut params = Params::with_capacity(5 + self._additional_params.len());
45801        params.push("googleAudienceId", self._google_audience_id.to_string());
45802        if let Some(value) = self._partner_id.as_ref() {
45803            params.push("partnerId", value.to_string());
45804        }
45805        if let Some(value) = self._advertiser_id.as_ref() {
45806            params.push("advertiserId", value.to_string());
45807        }
45808
45809        params.extend(self._additional_params.iter());
45810
45811        params.push("alt", "json");
45812        let mut url = self.hub._base_url.clone() + "v1/googleAudiences/{+googleAudienceId}";
45813        if self._scopes.is_empty() {
45814            self._scopes
45815                .insert(Scope::DisplayVideo.as_ref().to_string());
45816        }
45817
45818        #[allow(clippy::single_element_loop)]
45819        for &(find_this, param_name) in [("{+googleAudienceId}", "googleAudienceId")].iter() {
45820            url = params.uri_replacement(url, param_name, find_this, true);
45821        }
45822        {
45823            let to_remove = ["googleAudienceId"];
45824            params.remove_params(&to_remove);
45825        }
45826
45827        let url = params.parse_with_url(&url);
45828
45829        loop {
45830            let token = match self
45831                .hub
45832                .auth
45833                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
45834                .await
45835            {
45836                Ok(token) => token,
45837                Err(e) => match dlg.token(e) {
45838                    Ok(token) => token,
45839                    Err(e) => {
45840                        dlg.finished(false);
45841                        return Err(common::Error::MissingToken(e));
45842                    }
45843                },
45844            };
45845            let mut req_result = {
45846                let client = &self.hub.client;
45847                dlg.pre_request();
45848                let mut req_builder = hyper::Request::builder()
45849                    .method(hyper::Method::GET)
45850                    .uri(url.as_str())
45851                    .header(USER_AGENT, self.hub._user_agent.clone());
45852
45853                if let Some(token) = token.as_ref() {
45854                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
45855                }
45856
45857                let request = req_builder
45858                    .header(CONTENT_LENGTH, 0_u64)
45859                    .body(common::to_body::<String>(None));
45860
45861                client.request(request.unwrap()).await
45862            };
45863
45864            match req_result {
45865                Err(err) => {
45866                    if let common::Retry::After(d) = dlg.http_error(&err) {
45867                        sleep(d).await;
45868                        continue;
45869                    }
45870                    dlg.finished(false);
45871                    return Err(common::Error::HttpError(err));
45872                }
45873                Ok(res) => {
45874                    let (mut parts, body) = res.into_parts();
45875                    let mut body = common::Body::new(body);
45876                    if !parts.status.is_success() {
45877                        let bytes = common::to_bytes(body).await.unwrap_or_default();
45878                        let error = serde_json::from_str(&common::to_string(&bytes));
45879                        let response = common::to_response(parts, bytes.into());
45880
45881                        if let common::Retry::After(d) =
45882                            dlg.http_failure(&response, error.as_ref().ok())
45883                        {
45884                            sleep(d).await;
45885                            continue;
45886                        }
45887
45888                        dlg.finished(false);
45889
45890                        return Err(match error {
45891                            Ok(value) => common::Error::BadRequest(value),
45892                            _ => common::Error::Failure(response),
45893                        });
45894                    }
45895                    let response = {
45896                        let bytes = common::to_bytes(body).await.unwrap_or_default();
45897                        let encoded = common::to_string(&bytes);
45898                        match serde_json::from_str(&encoded) {
45899                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
45900                            Err(error) => {
45901                                dlg.response_json_decode_error(&encoded, &error);
45902                                return Err(common::Error::JsonDecodeError(
45903                                    encoded.to_string(),
45904                                    error,
45905                                ));
45906                            }
45907                        }
45908                    };
45909
45910                    dlg.finished(true);
45911                    return Ok(response);
45912                }
45913            }
45914        }
45915    }
45916
45917    /// Required. The ID of the Google audience to fetch.
45918    ///
45919    /// Sets the *google audience id* path property to the given value.
45920    ///
45921    /// Even though the property as already been set when instantiating this call,
45922    /// we provide this method for API completeness.
45923    pub fn google_audience_id(mut self, new_value: i64) -> GoogleAudienceGetCall<'a, C> {
45924        self._google_audience_id = new_value;
45925        self
45926    }
45927    /// The ID of the partner that has access to the fetched Google audience.
45928    ///
45929    /// Sets the *partner id* query property to the given value.
45930    pub fn partner_id(mut self, new_value: i64) -> GoogleAudienceGetCall<'a, C> {
45931        self._partner_id = Some(new_value);
45932        self
45933    }
45934    /// The ID of the advertiser that has access to the fetched Google audience.
45935    ///
45936    /// Sets the *advertiser id* query property to the given value.
45937    pub fn advertiser_id(mut self, new_value: i64) -> GoogleAudienceGetCall<'a, C> {
45938        self._advertiser_id = Some(new_value);
45939        self
45940    }
45941    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
45942    /// while executing the actual API request.
45943    ///
45944    /// ````text
45945    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
45946    /// ````
45947    ///
45948    /// Sets the *delegate* property to the given value.
45949    pub fn delegate(
45950        mut self,
45951        new_value: &'a mut dyn common::Delegate,
45952    ) -> GoogleAudienceGetCall<'a, C> {
45953        self._delegate = Some(new_value);
45954        self
45955    }
45956
45957    /// Set any additional parameter of the query string used in the request.
45958    /// It should be used to set parameters which are not yet available through their own
45959    /// setters.
45960    ///
45961    /// Please note that this method must not be used to set any of the known parameters
45962    /// which have their own setter method. If done anyway, the request will fail.
45963    ///
45964    /// # Additional Parameters
45965    ///
45966    /// * *$.xgafv* (query-string) - V1 error format.
45967    /// * *access_token* (query-string) - OAuth access token.
45968    /// * *alt* (query-string) - Data format for response.
45969    /// * *callback* (query-string) - JSONP
45970    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
45971    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
45972    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
45973    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
45974    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
45975    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
45976    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
45977    pub fn param<T>(mut self, name: T, value: T) -> GoogleAudienceGetCall<'a, C>
45978    where
45979        T: AsRef<str>,
45980    {
45981        self._additional_params
45982            .insert(name.as_ref().to_string(), value.as_ref().to_string());
45983        self
45984    }
45985
45986    /// Identifies the authorization scope for the method you are building.
45987    ///
45988    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
45989    /// [`Scope::DisplayVideo`].
45990    ///
45991    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
45992    /// tokens for more than one scope.
45993    ///
45994    /// Usually there is more than one suitable scope to authorize an operation, some of which may
45995    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
45996    /// sufficient, a read-write scope will do as well.
45997    pub fn add_scope<St>(mut self, scope: St) -> GoogleAudienceGetCall<'a, C>
45998    where
45999        St: AsRef<str>,
46000    {
46001        self._scopes.insert(String::from(scope.as_ref()));
46002        self
46003    }
46004    /// Identifies the authorization scope(s) for the method you are building.
46005    ///
46006    /// See [`Self::add_scope()`] for details.
46007    pub fn add_scopes<I, St>(mut self, scopes: I) -> GoogleAudienceGetCall<'a, C>
46008    where
46009        I: IntoIterator<Item = St>,
46010        St: AsRef<str>,
46011    {
46012        self._scopes
46013            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
46014        self
46015    }
46016
46017    /// Removes all scopes, and no default scope will be used either.
46018    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
46019    /// for details).
46020    pub fn clear_scopes(mut self) -> GoogleAudienceGetCall<'a, C> {
46021        self._scopes.clear();
46022        self
46023    }
46024}
46025
46026/// Lists Google audiences. The order is defined by the order_by parameter.
46027///
46028/// A builder for the *list* method supported by a *googleAudience* resource.
46029/// It is not used directly, but through a [`GoogleAudienceMethods`] instance.
46030///
46031/// # Example
46032///
46033/// Instantiate a resource method builder
46034///
46035/// ```test_harness,no_run
46036/// # extern crate hyper;
46037/// # extern crate hyper_rustls;
46038/// # extern crate google_displayvideo1 as displayvideo1;
46039/// # async fn dox() {
46040/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
46041///
46042/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
46043/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
46044/// #     secret,
46045/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
46046/// # ).build().await.unwrap();
46047///
46048/// # let client = hyper_util::client::legacy::Client::builder(
46049/// #     hyper_util::rt::TokioExecutor::new()
46050/// # )
46051/// # .build(
46052/// #     hyper_rustls::HttpsConnectorBuilder::new()
46053/// #         .with_native_roots()
46054/// #         .unwrap()
46055/// #         .https_or_http()
46056/// #         .enable_http1()
46057/// #         .build()
46058/// # );
46059/// # let mut hub = DisplayVideo::new(client, auth);
46060/// // You can configure optional parameters by calling the respective setters at will, and
46061/// // execute the final call using `doit()`.
46062/// // Values shown here are possibly random and not representative !
46063/// let result = hub.google_audiences().list()
46064///              .partner_id(-6)
46065///              .page_token("At")
46066///              .page_size(-92)
46067///              .order_by("diam")
46068///              .filter("sed")
46069///              .advertiser_id(-18)
46070///              .doit().await;
46071/// # }
46072/// ```
46073pub struct GoogleAudienceListCall<'a, C>
46074where
46075    C: 'a,
46076{
46077    hub: &'a DisplayVideo<C>,
46078    _partner_id: Option<i64>,
46079    _page_token: Option<String>,
46080    _page_size: Option<i32>,
46081    _order_by: Option<String>,
46082    _filter: Option<String>,
46083    _advertiser_id: Option<i64>,
46084    _delegate: Option<&'a mut dyn common::Delegate>,
46085    _additional_params: HashMap<String, String>,
46086    _scopes: BTreeSet<String>,
46087}
46088
46089impl<'a, C> common::CallBuilder for GoogleAudienceListCall<'a, C> {}
46090
46091impl<'a, C> GoogleAudienceListCall<'a, C>
46092where
46093    C: common::Connector,
46094{
46095    /// Perform the operation you have build so far.
46096    pub async fn doit(mut self) -> common::Result<(common::Response, ListGoogleAudiencesResponse)> {
46097        use std::borrow::Cow;
46098        use std::io::{Read, Seek};
46099
46100        use common::{url::Params, ToParts};
46101        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
46102
46103        let mut dd = common::DefaultDelegate;
46104        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
46105        dlg.begin(common::MethodInfo {
46106            id: "displayvideo.googleAudiences.list",
46107            http_method: hyper::Method::GET,
46108        });
46109
46110        for &field in [
46111            "alt",
46112            "partnerId",
46113            "pageToken",
46114            "pageSize",
46115            "orderBy",
46116            "filter",
46117            "advertiserId",
46118        ]
46119        .iter()
46120        {
46121            if self._additional_params.contains_key(field) {
46122                dlg.finished(false);
46123                return Err(common::Error::FieldClash(field));
46124            }
46125        }
46126
46127        let mut params = Params::with_capacity(8 + self._additional_params.len());
46128        if let Some(value) = self._partner_id.as_ref() {
46129            params.push("partnerId", value.to_string());
46130        }
46131        if let Some(value) = self._page_token.as_ref() {
46132            params.push("pageToken", value);
46133        }
46134        if let Some(value) = self._page_size.as_ref() {
46135            params.push("pageSize", value.to_string());
46136        }
46137        if let Some(value) = self._order_by.as_ref() {
46138            params.push("orderBy", value);
46139        }
46140        if let Some(value) = self._filter.as_ref() {
46141            params.push("filter", value);
46142        }
46143        if let Some(value) = self._advertiser_id.as_ref() {
46144            params.push("advertiserId", value.to_string());
46145        }
46146
46147        params.extend(self._additional_params.iter());
46148
46149        params.push("alt", "json");
46150        let mut url = self.hub._base_url.clone() + "v1/googleAudiences";
46151        if self._scopes.is_empty() {
46152            self._scopes
46153                .insert(Scope::DisplayVideo.as_ref().to_string());
46154        }
46155
46156        let url = params.parse_with_url(&url);
46157
46158        loop {
46159            let token = match self
46160                .hub
46161                .auth
46162                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
46163                .await
46164            {
46165                Ok(token) => token,
46166                Err(e) => match dlg.token(e) {
46167                    Ok(token) => token,
46168                    Err(e) => {
46169                        dlg.finished(false);
46170                        return Err(common::Error::MissingToken(e));
46171                    }
46172                },
46173            };
46174            let mut req_result = {
46175                let client = &self.hub.client;
46176                dlg.pre_request();
46177                let mut req_builder = hyper::Request::builder()
46178                    .method(hyper::Method::GET)
46179                    .uri(url.as_str())
46180                    .header(USER_AGENT, self.hub._user_agent.clone());
46181
46182                if let Some(token) = token.as_ref() {
46183                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
46184                }
46185
46186                let request = req_builder
46187                    .header(CONTENT_LENGTH, 0_u64)
46188                    .body(common::to_body::<String>(None));
46189
46190                client.request(request.unwrap()).await
46191            };
46192
46193            match req_result {
46194                Err(err) => {
46195                    if let common::Retry::After(d) = dlg.http_error(&err) {
46196                        sleep(d).await;
46197                        continue;
46198                    }
46199                    dlg.finished(false);
46200                    return Err(common::Error::HttpError(err));
46201                }
46202                Ok(res) => {
46203                    let (mut parts, body) = res.into_parts();
46204                    let mut body = common::Body::new(body);
46205                    if !parts.status.is_success() {
46206                        let bytes = common::to_bytes(body).await.unwrap_or_default();
46207                        let error = serde_json::from_str(&common::to_string(&bytes));
46208                        let response = common::to_response(parts, bytes.into());
46209
46210                        if let common::Retry::After(d) =
46211                            dlg.http_failure(&response, error.as_ref().ok())
46212                        {
46213                            sleep(d).await;
46214                            continue;
46215                        }
46216
46217                        dlg.finished(false);
46218
46219                        return Err(match error {
46220                            Ok(value) => common::Error::BadRequest(value),
46221                            _ => common::Error::Failure(response),
46222                        });
46223                    }
46224                    let response = {
46225                        let bytes = common::to_bytes(body).await.unwrap_or_default();
46226                        let encoded = common::to_string(&bytes);
46227                        match serde_json::from_str(&encoded) {
46228                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
46229                            Err(error) => {
46230                                dlg.response_json_decode_error(&encoded, &error);
46231                                return Err(common::Error::JsonDecodeError(
46232                                    encoded.to_string(),
46233                                    error,
46234                                ));
46235                            }
46236                        }
46237                    };
46238
46239                    dlg.finished(true);
46240                    return Ok(response);
46241                }
46242            }
46243        }
46244    }
46245
46246    /// The ID of the partner that has access to the fetched Google audiences.
46247    ///
46248    /// Sets the *partner id* query property to the given value.
46249    pub fn partner_id(mut self, new_value: i64) -> GoogleAudienceListCall<'a, C> {
46250        self._partner_id = Some(new_value);
46251        self
46252    }
46253    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListGoogleAudiences` method. If not specified, the first page of results will be returned.
46254    ///
46255    /// Sets the *page token* query property to the given value.
46256    pub fn page_token(mut self, new_value: &str) -> GoogleAudienceListCall<'a, C> {
46257        self._page_token = Some(new_value.to_string());
46258        self
46259    }
46260    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
46261    ///
46262    /// Sets the *page size* query property to the given value.
46263    pub fn page_size(mut self, new_value: i32) -> GoogleAudienceListCall<'a, C> {
46264        self._page_size = Some(new_value);
46265        self
46266    }
46267    /// Field by which to sort the list. Acceptable values are: * `googleAudienceId` (default) * `displayName` The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `displayName desc`.
46268    ///
46269    /// Sets the *order by* query property to the given value.
46270    pub fn order_by(mut self, new_value: &str) -> GoogleAudienceListCall<'a, C> {
46271        self._order_by = Some(new_value.to_string());
46272        self
46273    }
46274    /// Allows filtering by Google audience fields. Supported syntax: * Filter expressions for Google audiences can only contain at most one restriction. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `HAS (:)` operator. Supported fields: * `displayName` Examples: * All Google audiences for which the display name contains “Google”: `displayName:"Google"`. The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
46275    ///
46276    /// Sets the *filter* query property to the given value.
46277    pub fn filter(mut self, new_value: &str) -> GoogleAudienceListCall<'a, C> {
46278        self._filter = Some(new_value.to_string());
46279        self
46280    }
46281    /// The ID of the advertiser that has access to the fetched Google audiences.
46282    ///
46283    /// Sets the *advertiser id* query property to the given value.
46284    pub fn advertiser_id(mut self, new_value: i64) -> GoogleAudienceListCall<'a, C> {
46285        self._advertiser_id = Some(new_value);
46286        self
46287    }
46288    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
46289    /// while executing the actual API request.
46290    ///
46291    /// ````text
46292    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
46293    /// ````
46294    ///
46295    /// Sets the *delegate* property to the given value.
46296    pub fn delegate(
46297        mut self,
46298        new_value: &'a mut dyn common::Delegate,
46299    ) -> GoogleAudienceListCall<'a, C> {
46300        self._delegate = Some(new_value);
46301        self
46302    }
46303
46304    /// Set any additional parameter of the query string used in the request.
46305    /// It should be used to set parameters which are not yet available through their own
46306    /// setters.
46307    ///
46308    /// Please note that this method must not be used to set any of the known parameters
46309    /// which have their own setter method. If done anyway, the request will fail.
46310    ///
46311    /// # Additional Parameters
46312    ///
46313    /// * *$.xgafv* (query-string) - V1 error format.
46314    /// * *access_token* (query-string) - OAuth access token.
46315    /// * *alt* (query-string) - Data format for response.
46316    /// * *callback* (query-string) - JSONP
46317    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
46318    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
46319    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
46320    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
46321    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
46322    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
46323    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
46324    pub fn param<T>(mut self, name: T, value: T) -> GoogleAudienceListCall<'a, C>
46325    where
46326        T: AsRef<str>,
46327    {
46328        self._additional_params
46329            .insert(name.as_ref().to_string(), value.as_ref().to_string());
46330        self
46331    }
46332
46333    /// Identifies the authorization scope for the method you are building.
46334    ///
46335    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
46336    /// [`Scope::DisplayVideo`].
46337    ///
46338    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
46339    /// tokens for more than one scope.
46340    ///
46341    /// Usually there is more than one suitable scope to authorize an operation, some of which may
46342    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
46343    /// sufficient, a read-write scope will do as well.
46344    pub fn add_scope<St>(mut self, scope: St) -> GoogleAudienceListCall<'a, C>
46345    where
46346        St: AsRef<str>,
46347    {
46348        self._scopes.insert(String::from(scope.as_ref()));
46349        self
46350    }
46351    /// Identifies the authorization scope(s) for the method you are building.
46352    ///
46353    /// See [`Self::add_scope()`] for details.
46354    pub fn add_scopes<I, St>(mut self, scopes: I) -> GoogleAudienceListCall<'a, C>
46355    where
46356        I: IntoIterator<Item = St>,
46357        St: AsRef<str>,
46358    {
46359        self._scopes
46360            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
46361        self
46362    }
46363
46364    /// Removes all scopes, and no default scope will be used either.
46365    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
46366    /// for details).
46367    pub fn clear_scopes(mut self) -> GoogleAudienceListCall<'a, C> {
46368        self._scopes.clear();
46369        self
46370    }
46371}
46372
46373/// Creates a new guaranteed order. Returns the newly created guaranteed order if successful.
46374///
46375/// A builder for the *create* method supported by a *guaranteedOrder* resource.
46376/// It is not used directly, but through a [`GuaranteedOrderMethods`] instance.
46377///
46378/// # Example
46379///
46380/// Instantiate a resource method builder
46381///
46382/// ```test_harness,no_run
46383/// # extern crate hyper;
46384/// # extern crate hyper_rustls;
46385/// # extern crate google_displayvideo1 as displayvideo1;
46386/// use displayvideo1::api::GuaranteedOrder;
46387/// # async fn dox() {
46388/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
46389///
46390/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
46391/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
46392/// #     secret,
46393/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
46394/// # ).build().await.unwrap();
46395///
46396/// # let client = hyper_util::client::legacy::Client::builder(
46397/// #     hyper_util::rt::TokioExecutor::new()
46398/// # )
46399/// # .build(
46400/// #     hyper_rustls::HttpsConnectorBuilder::new()
46401/// #         .with_native_roots()
46402/// #         .unwrap()
46403/// #         .https_or_http()
46404/// #         .enable_http1()
46405/// #         .build()
46406/// # );
46407/// # let mut hub = DisplayVideo::new(client, auth);
46408/// // As the method needs a request, you would usually fill it with the desired information
46409/// // into the respective structure. Some of the parts shown here might not be applicable !
46410/// // Values shown here are possibly random and not representative !
46411/// let mut req = GuaranteedOrder::default();
46412///
46413/// // You can configure optional parameters by calling the respective setters at will, and
46414/// // execute the final call using `doit()`.
46415/// // Values shown here are possibly random and not representative !
46416/// let result = hub.guaranteed_orders().create(req)
46417///              .partner_id(-17)
46418///              .advertiser_id(-84)
46419///              .doit().await;
46420/// # }
46421/// ```
46422pub struct GuaranteedOrderCreateCall<'a, C>
46423where
46424    C: 'a,
46425{
46426    hub: &'a DisplayVideo<C>,
46427    _request: GuaranteedOrder,
46428    _partner_id: Option<i64>,
46429    _advertiser_id: Option<i64>,
46430    _delegate: Option<&'a mut dyn common::Delegate>,
46431    _additional_params: HashMap<String, String>,
46432    _scopes: BTreeSet<String>,
46433}
46434
46435impl<'a, C> common::CallBuilder for GuaranteedOrderCreateCall<'a, C> {}
46436
46437impl<'a, C> GuaranteedOrderCreateCall<'a, C>
46438where
46439    C: common::Connector,
46440{
46441    /// Perform the operation you have build so far.
46442    pub async fn doit(mut self) -> common::Result<(common::Response, GuaranteedOrder)> {
46443        use std::borrow::Cow;
46444        use std::io::{Read, Seek};
46445
46446        use common::{url::Params, ToParts};
46447        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
46448
46449        let mut dd = common::DefaultDelegate;
46450        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
46451        dlg.begin(common::MethodInfo {
46452            id: "displayvideo.guaranteedOrders.create",
46453            http_method: hyper::Method::POST,
46454        });
46455
46456        for &field in ["alt", "partnerId", "advertiserId"].iter() {
46457            if self._additional_params.contains_key(field) {
46458                dlg.finished(false);
46459                return Err(common::Error::FieldClash(field));
46460            }
46461        }
46462
46463        let mut params = Params::with_capacity(5 + self._additional_params.len());
46464        if let Some(value) = self._partner_id.as_ref() {
46465            params.push("partnerId", value.to_string());
46466        }
46467        if let Some(value) = self._advertiser_id.as_ref() {
46468            params.push("advertiserId", value.to_string());
46469        }
46470
46471        params.extend(self._additional_params.iter());
46472
46473        params.push("alt", "json");
46474        let mut url = self.hub._base_url.clone() + "v1/guaranteedOrders";
46475        if self._scopes.is_empty() {
46476            self._scopes
46477                .insert(Scope::DisplayVideo.as_ref().to_string());
46478        }
46479
46480        let url = params.parse_with_url(&url);
46481
46482        let mut json_mime_type = mime::APPLICATION_JSON;
46483        let mut request_value_reader = {
46484            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
46485            common::remove_json_null_values(&mut value);
46486            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
46487            serde_json::to_writer(&mut dst, &value).unwrap();
46488            dst
46489        };
46490        let request_size = request_value_reader
46491            .seek(std::io::SeekFrom::End(0))
46492            .unwrap();
46493        request_value_reader
46494            .seek(std::io::SeekFrom::Start(0))
46495            .unwrap();
46496
46497        loop {
46498            let token = match self
46499                .hub
46500                .auth
46501                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
46502                .await
46503            {
46504                Ok(token) => token,
46505                Err(e) => match dlg.token(e) {
46506                    Ok(token) => token,
46507                    Err(e) => {
46508                        dlg.finished(false);
46509                        return Err(common::Error::MissingToken(e));
46510                    }
46511                },
46512            };
46513            request_value_reader
46514                .seek(std::io::SeekFrom::Start(0))
46515                .unwrap();
46516            let mut req_result = {
46517                let client = &self.hub.client;
46518                dlg.pre_request();
46519                let mut req_builder = hyper::Request::builder()
46520                    .method(hyper::Method::POST)
46521                    .uri(url.as_str())
46522                    .header(USER_AGENT, self.hub._user_agent.clone());
46523
46524                if let Some(token) = token.as_ref() {
46525                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
46526                }
46527
46528                let request = req_builder
46529                    .header(CONTENT_TYPE, json_mime_type.to_string())
46530                    .header(CONTENT_LENGTH, request_size as u64)
46531                    .body(common::to_body(
46532                        request_value_reader.get_ref().clone().into(),
46533                    ));
46534
46535                client.request(request.unwrap()).await
46536            };
46537
46538            match req_result {
46539                Err(err) => {
46540                    if let common::Retry::After(d) = dlg.http_error(&err) {
46541                        sleep(d).await;
46542                        continue;
46543                    }
46544                    dlg.finished(false);
46545                    return Err(common::Error::HttpError(err));
46546                }
46547                Ok(res) => {
46548                    let (mut parts, body) = res.into_parts();
46549                    let mut body = common::Body::new(body);
46550                    if !parts.status.is_success() {
46551                        let bytes = common::to_bytes(body).await.unwrap_or_default();
46552                        let error = serde_json::from_str(&common::to_string(&bytes));
46553                        let response = common::to_response(parts, bytes.into());
46554
46555                        if let common::Retry::After(d) =
46556                            dlg.http_failure(&response, error.as_ref().ok())
46557                        {
46558                            sleep(d).await;
46559                            continue;
46560                        }
46561
46562                        dlg.finished(false);
46563
46564                        return Err(match error {
46565                            Ok(value) => common::Error::BadRequest(value),
46566                            _ => common::Error::Failure(response),
46567                        });
46568                    }
46569                    let response = {
46570                        let bytes = common::to_bytes(body).await.unwrap_or_default();
46571                        let encoded = common::to_string(&bytes);
46572                        match serde_json::from_str(&encoded) {
46573                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
46574                            Err(error) => {
46575                                dlg.response_json_decode_error(&encoded, &error);
46576                                return Err(common::Error::JsonDecodeError(
46577                                    encoded.to_string(),
46578                                    error,
46579                                ));
46580                            }
46581                        }
46582                    };
46583
46584                    dlg.finished(true);
46585                    return Ok(response);
46586                }
46587            }
46588        }
46589    }
46590
46591    ///
46592    /// Sets the *request* property to the given value.
46593    ///
46594    /// Even though the property as already been set when instantiating this call,
46595    /// we provide this method for API completeness.
46596    pub fn request(mut self, new_value: GuaranteedOrder) -> GuaranteedOrderCreateCall<'a, C> {
46597        self._request = new_value;
46598        self
46599    }
46600    /// The ID of the partner that the request is being made within.
46601    ///
46602    /// Sets the *partner id* query property to the given value.
46603    pub fn partner_id(mut self, new_value: i64) -> GuaranteedOrderCreateCall<'a, C> {
46604        self._partner_id = Some(new_value);
46605        self
46606    }
46607    /// The ID of the advertiser that the request is being made within.
46608    ///
46609    /// Sets the *advertiser id* query property to the given value.
46610    pub fn advertiser_id(mut self, new_value: i64) -> GuaranteedOrderCreateCall<'a, C> {
46611        self._advertiser_id = Some(new_value);
46612        self
46613    }
46614    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
46615    /// while executing the actual API request.
46616    ///
46617    /// ````text
46618    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
46619    /// ````
46620    ///
46621    /// Sets the *delegate* property to the given value.
46622    pub fn delegate(
46623        mut self,
46624        new_value: &'a mut dyn common::Delegate,
46625    ) -> GuaranteedOrderCreateCall<'a, C> {
46626        self._delegate = Some(new_value);
46627        self
46628    }
46629
46630    /// Set any additional parameter of the query string used in the request.
46631    /// It should be used to set parameters which are not yet available through their own
46632    /// setters.
46633    ///
46634    /// Please note that this method must not be used to set any of the known parameters
46635    /// which have their own setter method. If done anyway, the request will fail.
46636    ///
46637    /// # Additional Parameters
46638    ///
46639    /// * *$.xgafv* (query-string) - V1 error format.
46640    /// * *access_token* (query-string) - OAuth access token.
46641    /// * *alt* (query-string) - Data format for response.
46642    /// * *callback* (query-string) - JSONP
46643    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
46644    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
46645    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
46646    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
46647    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
46648    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
46649    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
46650    pub fn param<T>(mut self, name: T, value: T) -> GuaranteedOrderCreateCall<'a, C>
46651    where
46652        T: AsRef<str>,
46653    {
46654        self._additional_params
46655            .insert(name.as_ref().to_string(), value.as_ref().to_string());
46656        self
46657    }
46658
46659    /// Identifies the authorization scope for the method you are building.
46660    ///
46661    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
46662    /// [`Scope::DisplayVideo`].
46663    ///
46664    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
46665    /// tokens for more than one scope.
46666    ///
46667    /// Usually there is more than one suitable scope to authorize an operation, some of which may
46668    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
46669    /// sufficient, a read-write scope will do as well.
46670    pub fn add_scope<St>(mut self, scope: St) -> GuaranteedOrderCreateCall<'a, C>
46671    where
46672        St: AsRef<str>,
46673    {
46674        self._scopes.insert(String::from(scope.as_ref()));
46675        self
46676    }
46677    /// Identifies the authorization scope(s) for the method you are building.
46678    ///
46679    /// See [`Self::add_scope()`] for details.
46680    pub fn add_scopes<I, St>(mut self, scopes: I) -> GuaranteedOrderCreateCall<'a, C>
46681    where
46682        I: IntoIterator<Item = St>,
46683        St: AsRef<str>,
46684    {
46685        self._scopes
46686            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
46687        self
46688    }
46689
46690    /// Removes all scopes, and no default scope will be used either.
46691    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
46692    /// for details).
46693    pub fn clear_scopes(mut self) -> GuaranteedOrderCreateCall<'a, C> {
46694        self._scopes.clear();
46695        self
46696    }
46697}
46698
46699/// Edits read advertisers of a guaranteed order.
46700///
46701/// A builder for the *editGuaranteedOrderReadAccessors* method supported by a *guaranteedOrder* resource.
46702/// It is not used directly, but through a [`GuaranteedOrderMethods`] instance.
46703///
46704/// # Example
46705///
46706/// Instantiate a resource method builder
46707///
46708/// ```test_harness,no_run
46709/// # extern crate hyper;
46710/// # extern crate hyper_rustls;
46711/// # extern crate google_displayvideo1 as displayvideo1;
46712/// use displayvideo1::api::EditGuaranteedOrderReadAccessorsRequest;
46713/// # async fn dox() {
46714/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
46715///
46716/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
46717/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
46718/// #     secret,
46719/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
46720/// # ).build().await.unwrap();
46721///
46722/// # let client = hyper_util::client::legacy::Client::builder(
46723/// #     hyper_util::rt::TokioExecutor::new()
46724/// # )
46725/// # .build(
46726/// #     hyper_rustls::HttpsConnectorBuilder::new()
46727/// #         .with_native_roots()
46728/// #         .unwrap()
46729/// #         .https_or_http()
46730/// #         .enable_http1()
46731/// #         .build()
46732/// # );
46733/// # let mut hub = DisplayVideo::new(client, auth);
46734/// // As the method needs a request, you would usually fill it with the desired information
46735/// // into the respective structure. Some of the parts shown here might not be applicable !
46736/// // Values shown here are possibly random and not representative !
46737/// let mut req = EditGuaranteedOrderReadAccessorsRequest::default();
46738///
46739/// // You can configure optional parameters by calling the respective setters at will, and
46740/// // execute the final call using `doit()`.
46741/// // Values shown here are possibly random and not representative !
46742/// let result = hub.guaranteed_orders().edit_guaranteed_order_read_accessors(req, "guaranteedOrderId")
46743///              .doit().await;
46744/// # }
46745/// ```
46746pub struct GuaranteedOrderEditGuaranteedOrderReadAccessorCall<'a, C>
46747where
46748    C: 'a,
46749{
46750    hub: &'a DisplayVideo<C>,
46751    _request: EditGuaranteedOrderReadAccessorsRequest,
46752    _guaranteed_order_id: String,
46753    _delegate: Option<&'a mut dyn common::Delegate>,
46754    _additional_params: HashMap<String, String>,
46755    _scopes: BTreeSet<String>,
46756}
46757
46758impl<'a, C> common::CallBuilder for GuaranteedOrderEditGuaranteedOrderReadAccessorCall<'a, C> {}
46759
46760impl<'a, C> GuaranteedOrderEditGuaranteedOrderReadAccessorCall<'a, C>
46761where
46762    C: common::Connector,
46763{
46764    /// Perform the operation you have build so far.
46765    pub async fn doit(
46766        mut self,
46767    ) -> common::Result<(common::Response, EditGuaranteedOrderReadAccessorsResponse)> {
46768        use std::borrow::Cow;
46769        use std::io::{Read, Seek};
46770
46771        use common::{url::Params, ToParts};
46772        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
46773
46774        let mut dd = common::DefaultDelegate;
46775        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
46776        dlg.begin(common::MethodInfo {
46777            id: "displayvideo.guaranteedOrders.editGuaranteedOrderReadAccessors",
46778            http_method: hyper::Method::POST,
46779        });
46780
46781        for &field in ["alt", "guaranteedOrderId"].iter() {
46782            if self._additional_params.contains_key(field) {
46783                dlg.finished(false);
46784                return Err(common::Error::FieldClash(field));
46785            }
46786        }
46787
46788        let mut params = Params::with_capacity(4 + self._additional_params.len());
46789        params.push("guaranteedOrderId", self._guaranteed_order_id);
46790
46791        params.extend(self._additional_params.iter());
46792
46793        params.push("alt", "json");
46794        let mut url = self.hub._base_url.clone()
46795            + "v1/guaranteedOrders/{+guaranteedOrderId}:editGuaranteedOrderReadAccessors";
46796        if self._scopes.is_empty() {
46797            self._scopes
46798                .insert(Scope::DisplayVideo.as_ref().to_string());
46799        }
46800
46801        #[allow(clippy::single_element_loop)]
46802        for &(find_this, param_name) in [("{+guaranteedOrderId}", "guaranteedOrderId")].iter() {
46803            url = params.uri_replacement(url, param_name, find_this, true);
46804        }
46805        {
46806            let to_remove = ["guaranteedOrderId"];
46807            params.remove_params(&to_remove);
46808        }
46809
46810        let url = params.parse_with_url(&url);
46811
46812        let mut json_mime_type = mime::APPLICATION_JSON;
46813        let mut request_value_reader = {
46814            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
46815            common::remove_json_null_values(&mut value);
46816            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
46817            serde_json::to_writer(&mut dst, &value).unwrap();
46818            dst
46819        };
46820        let request_size = request_value_reader
46821            .seek(std::io::SeekFrom::End(0))
46822            .unwrap();
46823        request_value_reader
46824            .seek(std::io::SeekFrom::Start(0))
46825            .unwrap();
46826
46827        loop {
46828            let token = match self
46829                .hub
46830                .auth
46831                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
46832                .await
46833            {
46834                Ok(token) => token,
46835                Err(e) => match dlg.token(e) {
46836                    Ok(token) => token,
46837                    Err(e) => {
46838                        dlg.finished(false);
46839                        return Err(common::Error::MissingToken(e));
46840                    }
46841                },
46842            };
46843            request_value_reader
46844                .seek(std::io::SeekFrom::Start(0))
46845                .unwrap();
46846            let mut req_result = {
46847                let client = &self.hub.client;
46848                dlg.pre_request();
46849                let mut req_builder = hyper::Request::builder()
46850                    .method(hyper::Method::POST)
46851                    .uri(url.as_str())
46852                    .header(USER_AGENT, self.hub._user_agent.clone());
46853
46854                if let Some(token) = token.as_ref() {
46855                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
46856                }
46857
46858                let request = req_builder
46859                    .header(CONTENT_TYPE, json_mime_type.to_string())
46860                    .header(CONTENT_LENGTH, request_size as u64)
46861                    .body(common::to_body(
46862                        request_value_reader.get_ref().clone().into(),
46863                    ));
46864
46865                client.request(request.unwrap()).await
46866            };
46867
46868            match req_result {
46869                Err(err) => {
46870                    if let common::Retry::After(d) = dlg.http_error(&err) {
46871                        sleep(d).await;
46872                        continue;
46873                    }
46874                    dlg.finished(false);
46875                    return Err(common::Error::HttpError(err));
46876                }
46877                Ok(res) => {
46878                    let (mut parts, body) = res.into_parts();
46879                    let mut body = common::Body::new(body);
46880                    if !parts.status.is_success() {
46881                        let bytes = common::to_bytes(body).await.unwrap_or_default();
46882                        let error = serde_json::from_str(&common::to_string(&bytes));
46883                        let response = common::to_response(parts, bytes.into());
46884
46885                        if let common::Retry::After(d) =
46886                            dlg.http_failure(&response, error.as_ref().ok())
46887                        {
46888                            sleep(d).await;
46889                            continue;
46890                        }
46891
46892                        dlg.finished(false);
46893
46894                        return Err(match error {
46895                            Ok(value) => common::Error::BadRequest(value),
46896                            _ => common::Error::Failure(response),
46897                        });
46898                    }
46899                    let response = {
46900                        let bytes = common::to_bytes(body).await.unwrap_or_default();
46901                        let encoded = common::to_string(&bytes);
46902                        match serde_json::from_str(&encoded) {
46903                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
46904                            Err(error) => {
46905                                dlg.response_json_decode_error(&encoded, &error);
46906                                return Err(common::Error::JsonDecodeError(
46907                                    encoded.to_string(),
46908                                    error,
46909                                ));
46910                            }
46911                        }
46912                    };
46913
46914                    dlg.finished(true);
46915                    return Ok(response);
46916                }
46917            }
46918        }
46919    }
46920
46921    ///
46922    /// Sets the *request* property to the given value.
46923    ///
46924    /// Even though the property as already been set when instantiating this call,
46925    /// we provide this method for API completeness.
46926    pub fn request(
46927        mut self,
46928        new_value: EditGuaranteedOrderReadAccessorsRequest,
46929    ) -> GuaranteedOrderEditGuaranteedOrderReadAccessorCall<'a, C> {
46930        self._request = new_value;
46931        self
46932    }
46933    /// Required. The ID of the guaranteed order to edit. The ID is of the format `{exchange}-{legacy_guaranteed_order_id}`
46934    ///
46935    /// Sets the *guaranteed order id* path property to the given value.
46936    ///
46937    /// Even though the property as already been set when instantiating this call,
46938    /// we provide this method for API completeness.
46939    pub fn guaranteed_order_id(
46940        mut self,
46941        new_value: &str,
46942    ) -> GuaranteedOrderEditGuaranteedOrderReadAccessorCall<'a, C> {
46943        self._guaranteed_order_id = new_value.to_string();
46944        self
46945    }
46946    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
46947    /// while executing the actual API request.
46948    ///
46949    /// ````text
46950    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
46951    /// ````
46952    ///
46953    /// Sets the *delegate* property to the given value.
46954    pub fn delegate(
46955        mut self,
46956        new_value: &'a mut dyn common::Delegate,
46957    ) -> GuaranteedOrderEditGuaranteedOrderReadAccessorCall<'a, C> {
46958        self._delegate = Some(new_value);
46959        self
46960    }
46961
46962    /// Set any additional parameter of the query string used in the request.
46963    /// It should be used to set parameters which are not yet available through their own
46964    /// setters.
46965    ///
46966    /// Please note that this method must not be used to set any of the known parameters
46967    /// which have their own setter method. If done anyway, the request will fail.
46968    ///
46969    /// # Additional Parameters
46970    ///
46971    /// * *$.xgafv* (query-string) - V1 error format.
46972    /// * *access_token* (query-string) - OAuth access token.
46973    /// * *alt* (query-string) - Data format for response.
46974    /// * *callback* (query-string) - JSONP
46975    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
46976    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
46977    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
46978    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
46979    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
46980    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
46981    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
46982    pub fn param<T>(
46983        mut self,
46984        name: T,
46985        value: T,
46986    ) -> GuaranteedOrderEditGuaranteedOrderReadAccessorCall<'a, C>
46987    where
46988        T: AsRef<str>,
46989    {
46990        self._additional_params
46991            .insert(name.as_ref().to_string(), value.as_ref().to_string());
46992        self
46993    }
46994
46995    /// Identifies the authorization scope for the method you are building.
46996    ///
46997    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
46998    /// [`Scope::DisplayVideo`].
46999    ///
47000    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
47001    /// tokens for more than one scope.
47002    ///
47003    /// Usually there is more than one suitable scope to authorize an operation, some of which may
47004    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
47005    /// sufficient, a read-write scope will do as well.
47006    pub fn add_scope<St>(
47007        mut self,
47008        scope: St,
47009    ) -> GuaranteedOrderEditGuaranteedOrderReadAccessorCall<'a, C>
47010    where
47011        St: AsRef<str>,
47012    {
47013        self._scopes.insert(String::from(scope.as_ref()));
47014        self
47015    }
47016    /// Identifies the authorization scope(s) for the method you are building.
47017    ///
47018    /// See [`Self::add_scope()`] for details.
47019    pub fn add_scopes<I, St>(
47020        mut self,
47021        scopes: I,
47022    ) -> GuaranteedOrderEditGuaranteedOrderReadAccessorCall<'a, C>
47023    where
47024        I: IntoIterator<Item = St>,
47025        St: AsRef<str>,
47026    {
47027        self._scopes
47028            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
47029        self
47030    }
47031
47032    /// Removes all scopes, and no default scope will be used either.
47033    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
47034    /// for details).
47035    pub fn clear_scopes(mut self) -> GuaranteedOrderEditGuaranteedOrderReadAccessorCall<'a, C> {
47036        self._scopes.clear();
47037        self
47038    }
47039}
47040
47041/// Gets a guaranteed order.
47042///
47043/// A builder for the *get* method supported by a *guaranteedOrder* resource.
47044/// It is not used directly, but through a [`GuaranteedOrderMethods`] instance.
47045///
47046/// # Example
47047///
47048/// Instantiate a resource method builder
47049///
47050/// ```test_harness,no_run
47051/// # extern crate hyper;
47052/// # extern crate hyper_rustls;
47053/// # extern crate google_displayvideo1 as displayvideo1;
47054/// # async fn dox() {
47055/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
47056///
47057/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
47058/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
47059/// #     secret,
47060/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
47061/// # ).build().await.unwrap();
47062///
47063/// # let client = hyper_util::client::legacy::Client::builder(
47064/// #     hyper_util::rt::TokioExecutor::new()
47065/// # )
47066/// # .build(
47067/// #     hyper_rustls::HttpsConnectorBuilder::new()
47068/// #         .with_native_roots()
47069/// #         .unwrap()
47070/// #         .https_or_http()
47071/// #         .enable_http1()
47072/// #         .build()
47073/// # );
47074/// # let mut hub = DisplayVideo::new(client, auth);
47075/// // You can configure optional parameters by calling the respective setters at will, and
47076/// // execute the final call using `doit()`.
47077/// // Values shown here are possibly random and not representative !
47078/// let result = hub.guaranteed_orders().get("guaranteedOrderId")
47079///              .partner_id(-27)
47080///              .advertiser_id(-53)
47081///              .doit().await;
47082/// # }
47083/// ```
47084pub struct GuaranteedOrderGetCall<'a, C>
47085where
47086    C: 'a,
47087{
47088    hub: &'a DisplayVideo<C>,
47089    _guaranteed_order_id: String,
47090    _partner_id: Option<i64>,
47091    _advertiser_id: Option<i64>,
47092    _delegate: Option<&'a mut dyn common::Delegate>,
47093    _additional_params: HashMap<String, String>,
47094    _scopes: BTreeSet<String>,
47095}
47096
47097impl<'a, C> common::CallBuilder for GuaranteedOrderGetCall<'a, C> {}
47098
47099impl<'a, C> GuaranteedOrderGetCall<'a, C>
47100where
47101    C: common::Connector,
47102{
47103    /// Perform the operation you have build so far.
47104    pub async fn doit(mut self) -> common::Result<(common::Response, GuaranteedOrder)> {
47105        use std::borrow::Cow;
47106        use std::io::{Read, Seek};
47107
47108        use common::{url::Params, ToParts};
47109        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
47110
47111        let mut dd = common::DefaultDelegate;
47112        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
47113        dlg.begin(common::MethodInfo {
47114            id: "displayvideo.guaranteedOrders.get",
47115            http_method: hyper::Method::GET,
47116        });
47117
47118        for &field in ["alt", "guaranteedOrderId", "partnerId", "advertiserId"].iter() {
47119            if self._additional_params.contains_key(field) {
47120                dlg.finished(false);
47121                return Err(common::Error::FieldClash(field));
47122            }
47123        }
47124
47125        let mut params = Params::with_capacity(5 + self._additional_params.len());
47126        params.push("guaranteedOrderId", self._guaranteed_order_id);
47127        if let Some(value) = self._partner_id.as_ref() {
47128            params.push("partnerId", value.to_string());
47129        }
47130        if let Some(value) = self._advertiser_id.as_ref() {
47131            params.push("advertiserId", value.to_string());
47132        }
47133
47134        params.extend(self._additional_params.iter());
47135
47136        params.push("alt", "json");
47137        let mut url = self.hub._base_url.clone() + "v1/guaranteedOrders/{+guaranteedOrderId}";
47138        if self._scopes.is_empty() {
47139            self._scopes
47140                .insert(Scope::DisplayVideo.as_ref().to_string());
47141        }
47142
47143        #[allow(clippy::single_element_loop)]
47144        for &(find_this, param_name) in [("{+guaranteedOrderId}", "guaranteedOrderId")].iter() {
47145            url = params.uri_replacement(url, param_name, find_this, true);
47146        }
47147        {
47148            let to_remove = ["guaranteedOrderId"];
47149            params.remove_params(&to_remove);
47150        }
47151
47152        let url = params.parse_with_url(&url);
47153
47154        loop {
47155            let token = match self
47156                .hub
47157                .auth
47158                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
47159                .await
47160            {
47161                Ok(token) => token,
47162                Err(e) => match dlg.token(e) {
47163                    Ok(token) => token,
47164                    Err(e) => {
47165                        dlg.finished(false);
47166                        return Err(common::Error::MissingToken(e));
47167                    }
47168                },
47169            };
47170            let mut req_result = {
47171                let client = &self.hub.client;
47172                dlg.pre_request();
47173                let mut req_builder = hyper::Request::builder()
47174                    .method(hyper::Method::GET)
47175                    .uri(url.as_str())
47176                    .header(USER_AGENT, self.hub._user_agent.clone());
47177
47178                if let Some(token) = token.as_ref() {
47179                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
47180                }
47181
47182                let request = req_builder
47183                    .header(CONTENT_LENGTH, 0_u64)
47184                    .body(common::to_body::<String>(None));
47185
47186                client.request(request.unwrap()).await
47187            };
47188
47189            match req_result {
47190                Err(err) => {
47191                    if let common::Retry::After(d) = dlg.http_error(&err) {
47192                        sleep(d).await;
47193                        continue;
47194                    }
47195                    dlg.finished(false);
47196                    return Err(common::Error::HttpError(err));
47197                }
47198                Ok(res) => {
47199                    let (mut parts, body) = res.into_parts();
47200                    let mut body = common::Body::new(body);
47201                    if !parts.status.is_success() {
47202                        let bytes = common::to_bytes(body).await.unwrap_or_default();
47203                        let error = serde_json::from_str(&common::to_string(&bytes));
47204                        let response = common::to_response(parts, bytes.into());
47205
47206                        if let common::Retry::After(d) =
47207                            dlg.http_failure(&response, error.as_ref().ok())
47208                        {
47209                            sleep(d).await;
47210                            continue;
47211                        }
47212
47213                        dlg.finished(false);
47214
47215                        return Err(match error {
47216                            Ok(value) => common::Error::BadRequest(value),
47217                            _ => common::Error::Failure(response),
47218                        });
47219                    }
47220                    let response = {
47221                        let bytes = common::to_bytes(body).await.unwrap_or_default();
47222                        let encoded = common::to_string(&bytes);
47223                        match serde_json::from_str(&encoded) {
47224                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
47225                            Err(error) => {
47226                                dlg.response_json_decode_error(&encoded, &error);
47227                                return Err(common::Error::JsonDecodeError(
47228                                    encoded.to_string(),
47229                                    error,
47230                                ));
47231                            }
47232                        }
47233                    };
47234
47235                    dlg.finished(true);
47236                    return Ok(response);
47237                }
47238            }
47239        }
47240    }
47241
47242    /// Required. The ID of the guaranteed order to fetch. The ID is of the format `{exchange}-{legacy_guaranteed_order_id}`
47243    ///
47244    /// Sets the *guaranteed order id* path property to the given value.
47245    ///
47246    /// Even though the property as already been set when instantiating this call,
47247    /// we provide this method for API completeness.
47248    pub fn guaranteed_order_id(mut self, new_value: &str) -> GuaranteedOrderGetCall<'a, C> {
47249        self._guaranteed_order_id = new_value.to_string();
47250        self
47251    }
47252    /// The ID of the partner that has access to the guaranteed order.
47253    ///
47254    /// Sets the *partner id* query property to the given value.
47255    pub fn partner_id(mut self, new_value: i64) -> GuaranteedOrderGetCall<'a, C> {
47256        self._partner_id = Some(new_value);
47257        self
47258    }
47259    /// The ID of the advertiser that has access to the guaranteed order.
47260    ///
47261    /// Sets the *advertiser id* query property to the given value.
47262    pub fn advertiser_id(mut self, new_value: i64) -> GuaranteedOrderGetCall<'a, C> {
47263        self._advertiser_id = Some(new_value);
47264        self
47265    }
47266    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
47267    /// while executing the actual API request.
47268    ///
47269    /// ````text
47270    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
47271    /// ````
47272    ///
47273    /// Sets the *delegate* property to the given value.
47274    pub fn delegate(
47275        mut self,
47276        new_value: &'a mut dyn common::Delegate,
47277    ) -> GuaranteedOrderGetCall<'a, C> {
47278        self._delegate = Some(new_value);
47279        self
47280    }
47281
47282    /// Set any additional parameter of the query string used in the request.
47283    /// It should be used to set parameters which are not yet available through their own
47284    /// setters.
47285    ///
47286    /// Please note that this method must not be used to set any of the known parameters
47287    /// which have their own setter method. If done anyway, the request will fail.
47288    ///
47289    /// # Additional Parameters
47290    ///
47291    /// * *$.xgafv* (query-string) - V1 error format.
47292    /// * *access_token* (query-string) - OAuth access token.
47293    /// * *alt* (query-string) - Data format for response.
47294    /// * *callback* (query-string) - JSONP
47295    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
47296    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
47297    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
47298    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
47299    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
47300    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
47301    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
47302    pub fn param<T>(mut self, name: T, value: T) -> GuaranteedOrderGetCall<'a, C>
47303    where
47304        T: AsRef<str>,
47305    {
47306        self._additional_params
47307            .insert(name.as_ref().to_string(), value.as_ref().to_string());
47308        self
47309    }
47310
47311    /// Identifies the authorization scope for the method you are building.
47312    ///
47313    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
47314    /// [`Scope::DisplayVideo`].
47315    ///
47316    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
47317    /// tokens for more than one scope.
47318    ///
47319    /// Usually there is more than one suitable scope to authorize an operation, some of which may
47320    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
47321    /// sufficient, a read-write scope will do as well.
47322    pub fn add_scope<St>(mut self, scope: St) -> GuaranteedOrderGetCall<'a, C>
47323    where
47324        St: AsRef<str>,
47325    {
47326        self._scopes.insert(String::from(scope.as_ref()));
47327        self
47328    }
47329    /// Identifies the authorization scope(s) for the method you are building.
47330    ///
47331    /// See [`Self::add_scope()`] for details.
47332    pub fn add_scopes<I, St>(mut self, scopes: I) -> GuaranteedOrderGetCall<'a, C>
47333    where
47334        I: IntoIterator<Item = St>,
47335        St: AsRef<str>,
47336    {
47337        self._scopes
47338            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
47339        self
47340    }
47341
47342    /// Removes all scopes, and no default scope will be used either.
47343    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
47344    /// for details).
47345    pub fn clear_scopes(mut self) -> GuaranteedOrderGetCall<'a, C> {
47346        self._scopes.clear();
47347        self
47348    }
47349}
47350
47351/// Lists guaranteed orders that are accessible to the current user. The order is defined by the order_by parameter. If a filter by entity_status is not specified, guaranteed orders with entity status `ENTITY_STATUS_ARCHIVED` will not be included in the results.
47352///
47353/// A builder for the *list* method supported by a *guaranteedOrder* resource.
47354/// It is not used directly, but through a [`GuaranteedOrderMethods`] instance.
47355///
47356/// # Example
47357///
47358/// Instantiate a resource method builder
47359///
47360/// ```test_harness,no_run
47361/// # extern crate hyper;
47362/// # extern crate hyper_rustls;
47363/// # extern crate google_displayvideo1 as displayvideo1;
47364/// # async fn dox() {
47365/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
47366///
47367/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
47368/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
47369/// #     secret,
47370/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
47371/// # ).build().await.unwrap();
47372///
47373/// # let client = hyper_util::client::legacy::Client::builder(
47374/// #     hyper_util::rt::TokioExecutor::new()
47375/// # )
47376/// # .build(
47377/// #     hyper_rustls::HttpsConnectorBuilder::new()
47378/// #         .with_native_roots()
47379/// #         .unwrap()
47380/// #         .https_or_http()
47381/// #         .enable_http1()
47382/// #         .build()
47383/// # );
47384/// # let mut hub = DisplayVideo::new(client, auth);
47385/// // You can configure optional parameters by calling the respective setters at will, and
47386/// // execute the final call using `doit()`.
47387/// // Values shown here are possibly random and not representative !
47388/// let result = hub.guaranteed_orders().list()
47389///              .partner_id(-98)
47390///              .page_token("Lorem")
47391///              .page_size(-15)
47392///              .order_by("duo")
47393///              .filter("elitr")
47394///              .advertiser_id(-32)
47395///              .doit().await;
47396/// # }
47397/// ```
47398pub struct GuaranteedOrderListCall<'a, C>
47399where
47400    C: 'a,
47401{
47402    hub: &'a DisplayVideo<C>,
47403    _partner_id: Option<i64>,
47404    _page_token: Option<String>,
47405    _page_size: Option<i32>,
47406    _order_by: Option<String>,
47407    _filter: Option<String>,
47408    _advertiser_id: Option<i64>,
47409    _delegate: Option<&'a mut dyn common::Delegate>,
47410    _additional_params: HashMap<String, String>,
47411    _scopes: BTreeSet<String>,
47412}
47413
47414impl<'a, C> common::CallBuilder for GuaranteedOrderListCall<'a, C> {}
47415
47416impl<'a, C> GuaranteedOrderListCall<'a, C>
47417where
47418    C: common::Connector,
47419{
47420    /// Perform the operation you have build so far.
47421    pub async fn doit(
47422        mut self,
47423    ) -> common::Result<(common::Response, ListGuaranteedOrdersResponse)> {
47424        use std::borrow::Cow;
47425        use std::io::{Read, Seek};
47426
47427        use common::{url::Params, ToParts};
47428        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
47429
47430        let mut dd = common::DefaultDelegate;
47431        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
47432        dlg.begin(common::MethodInfo {
47433            id: "displayvideo.guaranteedOrders.list",
47434            http_method: hyper::Method::GET,
47435        });
47436
47437        for &field in [
47438            "alt",
47439            "partnerId",
47440            "pageToken",
47441            "pageSize",
47442            "orderBy",
47443            "filter",
47444            "advertiserId",
47445        ]
47446        .iter()
47447        {
47448            if self._additional_params.contains_key(field) {
47449                dlg.finished(false);
47450                return Err(common::Error::FieldClash(field));
47451            }
47452        }
47453
47454        let mut params = Params::with_capacity(8 + self._additional_params.len());
47455        if let Some(value) = self._partner_id.as_ref() {
47456            params.push("partnerId", value.to_string());
47457        }
47458        if let Some(value) = self._page_token.as_ref() {
47459            params.push("pageToken", value);
47460        }
47461        if let Some(value) = self._page_size.as_ref() {
47462            params.push("pageSize", value.to_string());
47463        }
47464        if let Some(value) = self._order_by.as_ref() {
47465            params.push("orderBy", value);
47466        }
47467        if let Some(value) = self._filter.as_ref() {
47468            params.push("filter", value);
47469        }
47470        if let Some(value) = self._advertiser_id.as_ref() {
47471            params.push("advertiserId", value.to_string());
47472        }
47473
47474        params.extend(self._additional_params.iter());
47475
47476        params.push("alt", "json");
47477        let mut url = self.hub._base_url.clone() + "v1/guaranteedOrders";
47478        if self._scopes.is_empty() {
47479            self._scopes
47480                .insert(Scope::DisplayVideo.as_ref().to_string());
47481        }
47482
47483        let url = params.parse_with_url(&url);
47484
47485        loop {
47486            let token = match self
47487                .hub
47488                .auth
47489                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
47490                .await
47491            {
47492                Ok(token) => token,
47493                Err(e) => match dlg.token(e) {
47494                    Ok(token) => token,
47495                    Err(e) => {
47496                        dlg.finished(false);
47497                        return Err(common::Error::MissingToken(e));
47498                    }
47499                },
47500            };
47501            let mut req_result = {
47502                let client = &self.hub.client;
47503                dlg.pre_request();
47504                let mut req_builder = hyper::Request::builder()
47505                    .method(hyper::Method::GET)
47506                    .uri(url.as_str())
47507                    .header(USER_AGENT, self.hub._user_agent.clone());
47508
47509                if let Some(token) = token.as_ref() {
47510                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
47511                }
47512
47513                let request = req_builder
47514                    .header(CONTENT_LENGTH, 0_u64)
47515                    .body(common::to_body::<String>(None));
47516
47517                client.request(request.unwrap()).await
47518            };
47519
47520            match req_result {
47521                Err(err) => {
47522                    if let common::Retry::After(d) = dlg.http_error(&err) {
47523                        sleep(d).await;
47524                        continue;
47525                    }
47526                    dlg.finished(false);
47527                    return Err(common::Error::HttpError(err));
47528                }
47529                Ok(res) => {
47530                    let (mut parts, body) = res.into_parts();
47531                    let mut body = common::Body::new(body);
47532                    if !parts.status.is_success() {
47533                        let bytes = common::to_bytes(body).await.unwrap_or_default();
47534                        let error = serde_json::from_str(&common::to_string(&bytes));
47535                        let response = common::to_response(parts, bytes.into());
47536
47537                        if let common::Retry::After(d) =
47538                            dlg.http_failure(&response, error.as_ref().ok())
47539                        {
47540                            sleep(d).await;
47541                            continue;
47542                        }
47543
47544                        dlg.finished(false);
47545
47546                        return Err(match error {
47547                            Ok(value) => common::Error::BadRequest(value),
47548                            _ => common::Error::Failure(response),
47549                        });
47550                    }
47551                    let response = {
47552                        let bytes = common::to_bytes(body).await.unwrap_or_default();
47553                        let encoded = common::to_string(&bytes);
47554                        match serde_json::from_str(&encoded) {
47555                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
47556                            Err(error) => {
47557                                dlg.response_json_decode_error(&encoded, &error);
47558                                return Err(common::Error::JsonDecodeError(
47559                                    encoded.to_string(),
47560                                    error,
47561                                ));
47562                            }
47563                        }
47564                    };
47565
47566                    dlg.finished(true);
47567                    return Ok(response);
47568                }
47569            }
47570        }
47571    }
47572
47573    /// The ID of the partner that has access to the guaranteed order.
47574    ///
47575    /// Sets the *partner id* query property to the given value.
47576    pub fn partner_id(mut self, new_value: i64) -> GuaranteedOrderListCall<'a, C> {
47577        self._partner_id = Some(new_value);
47578        self
47579    }
47580    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListGuaranteedOrders` method. If not specified, the first page of results will be returned.
47581    ///
47582    /// Sets the *page token* query property to the given value.
47583    pub fn page_token(mut self, new_value: &str) -> GuaranteedOrderListCall<'a, C> {
47584        self._page_token = Some(new_value.to_string());
47585        self
47586    }
47587    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`.
47588    ///
47589    /// Sets the *page size* query property to the given value.
47590    pub fn page_size(mut self, new_value: i32) -> GuaranteedOrderListCall<'a, C> {
47591        self._page_size = Some(new_value);
47592        self
47593    }
47594    /// Field by which to sort the list. Acceptable values are: * `displayName` (default) The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. For example, `displayName desc`.
47595    ///
47596    /// Sets the *order by* query property to the given value.
47597    pub fn order_by(mut self, new_value: &str) -> GuaranteedOrderListCall<'a, C> {
47598        self._order_by = Some(new_value.to_string());
47599        self
47600    }
47601    /// Allows filtering by guaranteed order fields. * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by `AND` or `OR` logical operators. A sequence of restrictions implicitly uses `AND`. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `EQUALS (=)` operator. Supported fields: * `guaranteed_order_id` * `exchange` * `display_name` * `status.entityStatus` Examples: * All active guaranteed orders: `status.entityStatus="ENTITY_STATUS_ACTIVE"` * Guaranteed orders belonging to Google Ad Manager or Rubicon exchanges: `exchange="EXCHANGE_GOOGLE_AD_MANAGER" OR exchange="EXCHANGE_RUBICON"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
47602    ///
47603    /// Sets the *filter* query property to the given value.
47604    pub fn filter(mut self, new_value: &str) -> GuaranteedOrderListCall<'a, C> {
47605        self._filter = Some(new_value.to_string());
47606        self
47607    }
47608    /// The ID of the advertiser that has access to the guaranteed order.
47609    ///
47610    /// Sets the *advertiser id* query property to the given value.
47611    pub fn advertiser_id(mut self, new_value: i64) -> GuaranteedOrderListCall<'a, C> {
47612        self._advertiser_id = Some(new_value);
47613        self
47614    }
47615    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
47616    /// while executing the actual API request.
47617    ///
47618    /// ````text
47619    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
47620    /// ````
47621    ///
47622    /// Sets the *delegate* property to the given value.
47623    pub fn delegate(
47624        mut self,
47625        new_value: &'a mut dyn common::Delegate,
47626    ) -> GuaranteedOrderListCall<'a, C> {
47627        self._delegate = Some(new_value);
47628        self
47629    }
47630
47631    /// Set any additional parameter of the query string used in the request.
47632    /// It should be used to set parameters which are not yet available through their own
47633    /// setters.
47634    ///
47635    /// Please note that this method must not be used to set any of the known parameters
47636    /// which have their own setter method. If done anyway, the request will fail.
47637    ///
47638    /// # Additional Parameters
47639    ///
47640    /// * *$.xgafv* (query-string) - V1 error format.
47641    /// * *access_token* (query-string) - OAuth access token.
47642    /// * *alt* (query-string) - Data format for response.
47643    /// * *callback* (query-string) - JSONP
47644    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
47645    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
47646    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
47647    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
47648    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
47649    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
47650    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
47651    pub fn param<T>(mut self, name: T, value: T) -> GuaranteedOrderListCall<'a, C>
47652    where
47653        T: AsRef<str>,
47654    {
47655        self._additional_params
47656            .insert(name.as_ref().to_string(), value.as_ref().to_string());
47657        self
47658    }
47659
47660    /// Identifies the authorization scope for the method you are building.
47661    ///
47662    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
47663    /// [`Scope::DisplayVideo`].
47664    ///
47665    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
47666    /// tokens for more than one scope.
47667    ///
47668    /// Usually there is more than one suitable scope to authorize an operation, some of which may
47669    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
47670    /// sufficient, a read-write scope will do as well.
47671    pub fn add_scope<St>(mut self, scope: St) -> GuaranteedOrderListCall<'a, C>
47672    where
47673        St: AsRef<str>,
47674    {
47675        self._scopes.insert(String::from(scope.as_ref()));
47676        self
47677    }
47678    /// Identifies the authorization scope(s) for the method you are building.
47679    ///
47680    /// See [`Self::add_scope()`] for details.
47681    pub fn add_scopes<I, St>(mut self, scopes: I) -> GuaranteedOrderListCall<'a, C>
47682    where
47683        I: IntoIterator<Item = St>,
47684        St: AsRef<str>,
47685    {
47686        self._scopes
47687            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
47688        self
47689    }
47690
47691    /// Removes all scopes, and no default scope will be used either.
47692    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
47693    /// for details).
47694    pub fn clear_scopes(mut self) -> GuaranteedOrderListCall<'a, C> {
47695        self._scopes.clear();
47696        self
47697    }
47698}
47699
47700/// Updates an existing guaranteed order. Returns the updated guaranteed order if successful.
47701///
47702/// A builder for the *patch* method supported by a *guaranteedOrder* resource.
47703/// It is not used directly, but through a [`GuaranteedOrderMethods`] instance.
47704///
47705/// # Example
47706///
47707/// Instantiate a resource method builder
47708///
47709/// ```test_harness,no_run
47710/// # extern crate hyper;
47711/// # extern crate hyper_rustls;
47712/// # extern crate google_displayvideo1 as displayvideo1;
47713/// use displayvideo1::api::GuaranteedOrder;
47714/// # async fn dox() {
47715/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
47716///
47717/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
47718/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
47719/// #     secret,
47720/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
47721/// # ).build().await.unwrap();
47722///
47723/// # let client = hyper_util::client::legacy::Client::builder(
47724/// #     hyper_util::rt::TokioExecutor::new()
47725/// # )
47726/// # .build(
47727/// #     hyper_rustls::HttpsConnectorBuilder::new()
47728/// #         .with_native_roots()
47729/// #         .unwrap()
47730/// #         .https_or_http()
47731/// #         .enable_http1()
47732/// #         .build()
47733/// # );
47734/// # let mut hub = DisplayVideo::new(client, auth);
47735/// // As the method needs a request, you would usually fill it with the desired information
47736/// // into the respective structure. Some of the parts shown here might not be applicable !
47737/// // Values shown here are possibly random and not representative !
47738/// let mut req = GuaranteedOrder::default();
47739///
47740/// // You can configure optional parameters by calling the respective setters at will, and
47741/// // execute the final call using `doit()`.
47742/// // Values shown here are possibly random and not representative !
47743/// let result = hub.guaranteed_orders().patch(req, "guaranteedOrderId")
47744///              .update_mask(FieldMask::new::<&str>(&[]))
47745///              .partner_id(-87)
47746///              .advertiser_id(-18)
47747///              .doit().await;
47748/// # }
47749/// ```
47750pub struct GuaranteedOrderPatchCall<'a, C>
47751where
47752    C: 'a,
47753{
47754    hub: &'a DisplayVideo<C>,
47755    _request: GuaranteedOrder,
47756    _guaranteed_order_id: String,
47757    _update_mask: Option<common::FieldMask>,
47758    _partner_id: Option<i64>,
47759    _advertiser_id: Option<i64>,
47760    _delegate: Option<&'a mut dyn common::Delegate>,
47761    _additional_params: HashMap<String, String>,
47762    _scopes: BTreeSet<String>,
47763}
47764
47765impl<'a, C> common::CallBuilder for GuaranteedOrderPatchCall<'a, C> {}
47766
47767impl<'a, C> GuaranteedOrderPatchCall<'a, C>
47768where
47769    C: common::Connector,
47770{
47771    /// Perform the operation you have build so far.
47772    pub async fn doit(mut self) -> common::Result<(common::Response, GuaranteedOrder)> {
47773        use std::borrow::Cow;
47774        use std::io::{Read, Seek};
47775
47776        use common::{url::Params, ToParts};
47777        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
47778
47779        let mut dd = common::DefaultDelegate;
47780        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
47781        dlg.begin(common::MethodInfo {
47782            id: "displayvideo.guaranteedOrders.patch",
47783            http_method: hyper::Method::PATCH,
47784        });
47785
47786        for &field in [
47787            "alt",
47788            "guaranteedOrderId",
47789            "updateMask",
47790            "partnerId",
47791            "advertiserId",
47792        ]
47793        .iter()
47794        {
47795            if self._additional_params.contains_key(field) {
47796                dlg.finished(false);
47797                return Err(common::Error::FieldClash(field));
47798            }
47799        }
47800
47801        let mut params = Params::with_capacity(7 + self._additional_params.len());
47802        params.push("guaranteedOrderId", self._guaranteed_order_id);
47803        if let Some(value) = self._update_mask.as_ref() {
47804            params.push("updateMask", value.to_string());
47805        }
47806        if let Some(value) = self._partner_id.as_ref() {
47807            params.push("partnerId", value.to_string());
47808        }
47809        if let Some(value) = self._advertiser_id.as_ref() {
47810            params.push("advertiserId", value.to_string());
47811        }
47812
47813        params.extend(self._additional_params.iter());
47814
47815        params.push("alt", "json");
47816        let mut url = self.hub._base_url.clone() + "v1/guaranteedOrders/{+guaranteedOrderId}";
47817        if self._scopes.is_empty() {
47818            self._scopes
47819                .insert(Scope::DisplayVideo.as_ref().to_string());
47820        }
47821
47822        #[allow(clippy::single_element_loop)]
47823        for &(find_this, param_name) in [("{+guaranteedOrderId}", "guaranteedOrderId")].iter() {
47824            url = params.uri_replacement(url, param_name, find_this, true);
47825        }
47826        {
47827            let to_remove = ["guaranteedOrderId"];
47828            params.remove_params(&to_remove);
47829        }
47830
47831        let url = params.parse_with_url(&url);
47832
47833        let mut json_mime_type = mime::APPLICATION_JSON;
47834        let mut request_value_reader = {
47835            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
47836            common::remove_json_null_values(&mut value);
47837            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
47838            serde_json::to_writer(&mut dst, &value).unwrap();
47839            dst
47840        };
47841        let request_size = request_value_reader
47842            .seek(std::io::SeekFrom::End(0))
47843            .unwrap();
47844        request_value_reader
47845            .seek(std::io::SeekFrom::Start(0))
47846            .unwrap();
47847
47848        loop {
47849            let token = match self
47850                .hub
47851                .auth
47852                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
47853                .await
47854            {
47855                Ok(token) => token,
47856                Err(e) => match dlg.token(e) {
47857                    Ok(token) => token,
47858                    Err(e) => {
47859                        dlg.finished(false);
47860                        return Err(common::Error::MissingToken(e));
47861                    }
47862                },
47863            };
47864            request_value_reader
47865                .seek(std::io::SeekFrom::Start(0))
47866                .unwrap();
47867            let mut req_result = {
47868                let client = &self.hub.client;
47869                dlg.pre_request();
47870                let mut req_builder = hyper::Request::builder()
47871                    .method(hyper::Method::PATCH)
47872                    .uri(url.as_str())
47873                    .header(USER_AGENT, self.hub._user_agent.clone());
47874
47875                if let Some(token) = token.as_ref() {
47876                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
47877                }
47878
47879                let request = req_builder
47880                    .header(CONTENT_TYPE, json_mime_type.to_string())
47881                    .header(CONTENT_LENGTH, request_size as u64)
47882                    .body(common::to_body(
47883                        request_value_reader.get_ref().clone().into(),
47884                    ));
47885
47886                client.request(request.unwrap()).await
47887            };
47888
47889            match req_result {
47890                Err(err) => {
47891                    if let common::Retry::After(d) = dlg.http_error(&err) {
47892                        sleep(d).await;
47893                        continue;
47894                    }
47895                    dlg.finished(false);
47896                    return Err(common::Error::HttpError(err));
47897                }
47898                Ok(res) => {
47899                    let (mut parts, body) = res.into_parts();
47900                    let mut body = common::Body::new(body);
47901                    if !parts.status.is_success() {
47902                        let bytes = common::to_bytes(body).await.unwrap_or_default();
47903                        let error = serde_json::from_str(&common::to_string(&bytes));
47904                        let response = common::to_response(parts, bytes.into());
47905
47906                        if let common::Retry::After(d) =
47907                            dlg.http_failure(&response, error.as_ref().ok())
47908                        {
47909                            sleep(d).await;
47910                            continue;
47911                        }
47912
47913                        dlg.finished(false);
47914
47915                        return Err(match error {
47916                            Ok(value) => common::Error::BadRequest(value),
47917                            _ => common::Error::Failure(response),
47918                        });
47919                    }
47920                    let response = {
47921                        let bytes = common::to_bytes(body).await.unwrap_or_default();
47922                        let encoded = common::to_string(&bytes);
47923                        match serde_json::from_str(&encoded) {
47924                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
47925                            Err(error) => {
47926                                dlg.response_json_decode_error(&encoded, &error);
47927                                return Err(common::Error::JsonDecodeError(
47928                                    encoded.to_string(),
47929                                    error,
47930                                ));
47931                            }
47932                        }
47933                    };
47934
47935                    dlg.finished(true);
47936                    return Ok(response);
47937                }
47938            }
47939        }
47940    }
47941
47942    ///
47943    /// Sets the *request* property to the given value.
47944    ///
47945    /// Even though the property as already been set when instantiating this call,
47946    /// we provide this method for API completeness.
47947    pub fn request(mut self, new_value: GuaranteedOrder) -> GuaranteedOrderPatchCall<'a, C> {
47948        self._request = new_value;
47949        self
47950    }
47951    /// Output only. The unique identifier of the guaranteed order. The guaranteed order IDs have the format `{exchange}-{legacy_guaranteed_order_id}`.
47952    ///
47953    /// Sets the *guaranteed order id* path property to the given value.
47954    ///
47955    /// Even though the property as already been set when instantiating this call,
47956    /// we provide this method for API completeness.
47957    pub fn guaranteed_order_id(mut self, new_value: &str) -> GuaranteedOrderPatchCall<'a, C> {
47958        self._guaranteed_order_id = new_value.to_string();
47959        self
47960    }
47961    /// Required. The mask to control which fields to update.
47962    ///
47963    /// Sets the *update mask* query property to the given value.
47964    pub fn update_mask(mut self, new_value: common::FieldMask) -> GuaranteedOrderPatchCall<'a, C> {
47965        self._update_mask = Some(new_value);
47966        self
47967    }
47968    /// The ID of the partner that the request is being made within.
47969    ///
47970    /// Sets the *partner id* query property to the given value.
47971    pub fn partner_id(mut self, new_value: i64) -> GuaranteedOrderPatchCall<'a, C> {
47972        self._partner_id = Some(new_value);
47973        self
47974    }
47975    /// The ID of the advertiser that the request is being made within.
47976    ///
47977    /// Sets the *advertiser id* query property to the given value.
47978    pub fn advertiser_id(mut self, new_value: i64) -> GuaranteedOrderPatchCall<'a, C> {
47979        self._advertiser_id = Some(new_value);
47980        self
47981    }
47982    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
47983    /// while executing the actual API request.
47984    ///
47985    /// ````text
47986    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
47987    /// ````
47988    ///
47989    /// Sets the *delegate* property to the given value.
47990    pub fn delegate(
47991        mut self,
47992        new_value: &'a mut dyn common::Delegate,
47993    ) -> GuaranteedOrderPatchCall<'a, C> {
47994        self._delegate = Some(new_value);
47995        self
47996    }
47997
47998    /// Set any additional parameter of the query string used in the request.
47999    /// It should be used to set parameters which are not yet available through their own
48000    /// setters.
48001    ///
48002    /// Please note that this method must not be used to set any of the known parameters
48003    /// which have their own setter method. If done anyway, the request will fail.
48004    ///
48005    /// # Additional Parameters
48006    ///
48007    /// * *$.xgafv* (query-string) - V1 error format.
48008    /// * *access_token* (query-string) - OAuth access token.
48009    /// * *alt* (query-string) - Data format for response.
48010    /// * *callback* (query-string) - JSONP
48011    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
48012    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
48013    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
48014    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
48015    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
48016    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
48017    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
48018    pub fn param<T>(mut self, name: T, value: T) -> GuaranteedOrderPatchCall<'a, C>
48019    where
48020        T: AsRef<str>,
48021    {
48022        self._additional_params
48023            .insert(name.as_ref().to_string(), value.as_ref().to_string());
48024        self
48025    }
48026
48027    /// Identifies the authorization scope for the method you are building.
48028    ///
48029    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
48030    /// [`Scope::DisplayVideo`].
48031    ///
48032    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
48033    /// tokens for more than one scope.
48034    ///
48035    /// Usually there is more than one suitable scope to authorize an operation, some of which may
48036    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
48037    /// sufficient, a read-write scope will do as well.
48038    pub fn add_scope<St>(mut self, scope: St) -> GuaranteedOrderPatchCall<'a, C>
48039    where
48040        St: AsRef<str>,
48041    {
48042        self._scopes.insert(String::from(scope.as_ref()));
48043        self
48044    }
48045    /// Identifies the authorization scope(s) for the method you are building.
48046    ///
48047    /// See [`Self::add_scope()`] for details.
48048    pub fn add_scopes<I, St>(mut self, scopes: I) -> GuaranteedOrderPatchCall<'a, C>
48049    where
48050        I: IntoIterator<Item = St>,
48051        St: AsRef<str>,
48052    {
48053        self._scopes
48054            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
48055        self
48056    }
48057
48058    /// Removes all scopes, and no default scope will be used either.
48059    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
48060    /// for details).
48061    pub fn clear_scopes(mut self) -> GuaranteedOrderPatchCall<'a, C> {
48062        self._scopes.clear();
48063        self
48064    }
48065}
48066
48067/// Bulk edits multiple assignments between inventory sources and a single inventory source group. The operation will delete the assigned inventory sources provided in BulkEditAssignedInventorySourcesRequest.deleted_assigned_inventory_sources and then create the assigned inventory sources provided in BulkEditAssignedInventorySourcesRequest.created_assigned_inventory_sources.
48068///
48069/// A builder for the *assignedInventorySources.bulkEdit* method supported by a *inventorySourceGroup* resource.
48070/// It is not used directly, but through a [`InventorySourceGroupMethods`] instance.
48071///
48072/// # Example
48073///
48074/// Instantiate a resource method builder
48075///
48076/// ```test_harness,no_run
48077/// # extern crate hyper;
48078/// # extern crate hyper_rustls;
48079/// # extern crate google_displayvideo1 as displayvideo1;
48080/// use displayvideo1::api::BulkEditAssignedInventorySourcesRequest;
48081/// # async fn dox() {
48082/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
48083///
48084/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
48085/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
48086/// #     secret,
48087/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
48088/// # ).build().await.unwrap();
48089///
48090/// # let client = hyper_util::client::legacy::Client::builder(
48091/// #     hyper_util::rt::TokioExecutor::new()
48092/// # )
48093/// # .build(
48094/// #     hyper_rustls::HttpsConnectorBuilder::new()
48095/// #         .with_native_roots()
48096/// #         .unwrap()
48097/// #         .https_or_http()
48098/// #         .enable_http1()
48099/// #         .build()
48100/// # );
48101/// # let mut hub = DisplayVideo::new(client, auth);
48102/// // As the method needs a request, you would usually fill it with the desired information
48103/// // into the respective structure. Some of the parts shown here might not be applicable !
48104/// // Values shown here are possibly random and not representative !
48105/// let mut req = BulkEditAssignedInventorySourcesRequest::default();
48106///
48107/// // You can configure optional parameters by calling the respective setters at will, and
48108/// // execute the final call using `doit()`.
48109/// // Values shown here are possibly random and not representative !
48110/// let result = hub.inventory_source_groups().assigned_inventory_sources_bulk_edit(req, -51)
48111///              .doit().await;
48112/// # }
48113/// ```
48114pub struct InventorySourceGroupAssignedInventorySourceBulkEditCall<'a, C>
48115where
48116    C: 'a,
48117{
48118    hub: &'a DisplayVideo<C>,
48119    _request: BulkEditAssignedInventorySourcesRequest,
48120    _inventory_source_group_id: i64,
48121    _delegate: Option<&'a mut dyn common::Delegate>,
48122    _additional_params: HashMap<String, String>,
48123    _scopes: BTreeSet<String>,
48124}
48125
48126impl<'a, C> common::CallBuilder for InventorySourceGroupAssignedInventorySourceBulkEditCall<'a, C> {}
48127
48128impl<'a, C> InventorySourceGroupAssignedInventorySourceBulkEditCall<'a, C>
48129where
48130    C: common::Connector,
48131{
48132    /// Perform the operation you have build so far.
48133    pub async fn doit(
48134        mut self,
48135    ) -> common::Result<(common::Response, BulkEditAssignedInventorySourcesResponse)> {
48136        use std::borrow::Cow;
48137        use std::io::{Read, Seek};
48138
48139        use common::{url::Params, ToParts};
48140        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
48141
48142        let mut dd = common::DefaultDelegate;
48143        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
48144        dlg.begin(common::MethodInfo {
48145            id: "displayvideo.inventorySourceGroups.assignedInventorySources.bulkEdit",
48146            http_method: hyper::Method::POST,
48147        });
48148
48149        for &field in ["alt", "inventorySourceGroupId"].iter() {
48150            if self._additional_params.contains_key(field) {
48151                dlg.finished(false);
48152                return Err(common::Error::FieldClash(field));
48153            }
48154        }
48155
48156        let mut params = Params::with_capacity(4 + self._additional_params.len());
48157        params.push(
48158            "inventorySourceGroupId",
48159            self._inventory_source_group_id.to_string(),
48160        );
48161
48162        params.extend(self._additional_params.iter());
48163
48164        params.push("alt", "json");
48165        let mut url = self.hub._base_url.clone() + "v1/inventorySourceGroups/{+inventorySourceGroupId}/assignedInventorySources:bulkEdit";
48166        if self._scopes.is_empty() {
48167            self._scopes
48168                .insert(Scope::DisplayVideo.as_ref().to_string());
48169        }
48170
48171        #[allow(clippy::single_element_loop)]
48172        for &(find_this, param_name) in
48173            [("{+inventorySourceGroupId}", "inventorySourceGroupId")].iter()
48174        {
48175            url = params.uri_replacement(url, param_name, find_this, true);
48176        }
48177        {
48178            let to_remove = ["inventorySourceGroupId"];
48179            params.remove_params(&to_remove);
48180        }
48181
48182        let url = params.parse_with_url(&url);
48183
48184        let mut json_mime_type = mime::APPLICATION_JSON;
48185        let mut request_value_reader = {
48186            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
48187            common::remove_json_null_values(&mut value);
48188            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
48189            serde_json::to_writer(&mut dst, &value).unwrap();
48190            dst
48191        };
48192        let request_size = request_value_reader
48193            .seek(std::io::SeekFrom::End(0))
48194            .unwrap();
48195        request_value_reader
48196            .seek(std::io::SeekFrom::Start(0))
48197            .unwrap();
48198
48199        loop {
48200            let token = match self
48201                .hub
48202                .auth
48203                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
48204                .await
48205            {
48206                Ok(token) => token,
48207                Err(e) => match dlg.token(e) {
48208                    Ok(token) => token,
48209                    Err(e) => {
48210                        dlg.finished(false);
48211                        return Err(common::Error::MissingToken(e));
48212                    }
48213                },
48214            };
48215            request_value_reader
48216                .seek(std::io::SeekFrom::Start(0))
48217                .unwrap();
48218            let mut req_result = {
48219                let client = &self.hub.client;
48220                dlg.pre_request();
48221                let mut req_builder = hyper::Request::builder()
48222                    .method(hyper::Method::POST)
48223                    .uri(url.as_str())
48224                    .header(USER_AGENT, self.hub._user_agent.clone());
48225
48226                if let Some(token) = token.as_ref() {
48227                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
48228                }
48229
48230                let request = req_builder
48231                    .header(CONTENT_TYPE, json_mime_type.to_string())
48232                    .header(CONTENT_LENGTH, request_size as u64)
48233                    .body(common::to_body(
48234                        request_value_reader.get_ref().clone().into(),
48235                    ));
48236
48237                client.request(request.unwrap()).await
48238            };
48239
48240            match req_result {
48241                Err(err) => {
48242                    if let common::Retry::After(d) = dlg.http_error(&err) {
48243                        sleep(d).await;
48244                        continue;
48245                    }
48246                    dlg.finished(false);
48247                    return Err(common::Error::HttpError(err));
48248                }
48249                Ok(res) => {
48250                    let (mut parts, body) = res.into_parts();
48251                    let mut body = common::Body::new(body);
48252                    if !parts.status.is_success() {
48253                        let bytes = common::to_bytes(body).await.unwrap_or_default();
48254                        let error = serde_json::from_str(&common::to_string(&bytes));
48255                        let response = common::to_response(parts, bytes.into());
48256
48257                        if let common::Retry::After(d) =
48258                            dlg.http_failure(&response, error.as_ref().ok())
48259                        {
48260                            sleep(d).await;
48261                            continue;
48262                        }
48263
48264                        dlg.finished(false);
48265
48266                        return Err(match error {
48267                            Ok(value) => common::Error::BadRequest(value),
48268                            _ => common::Error::Failure(response),
48269                        });
48270                    }
48271                    let response = {
48272                        let bytes = common::to_bytes(body).await.unwrap_or_default();
48273                        let encoded = common::to_string(&bytes);
48274                        match serde_json::from_str(&encoded) {
48275                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
48276                            Err(error) => {
48277                                dlg.response_json_decode_error(&encoded, &error);
48278                                return Err(common::Error::JsonDecodeError(
48279                                    encoded.to_string(),
48280                                    error,
48281                                ));
48282                            }
48283                        }
48284                    };
48285
48286                    dlg.finished(true);
48287                    return Ok(response);
48288                }
48289            }
48290        }
48291    }
48292
48293    ///
48294    /// Sets the *request* property to the given value.
48295    ///
48296    /// Even though the property as already been set when instantiating this call,
48297    /// we provide this method for API completeness.
48298    pub fn request(
48299        mut self,
48300        new_value: BulkEditAssignedInventorySourcesRequest,
48301    ) -> InventorySourceGroupAssignedInventorySourceBulkEditCall<'a, C> {
48302        self._request = new_value;
48303        self
48304    }
48305    /// Required. The ID of the inventory source group to which the assignments are assigned.
48306    ///
48307    /// Sets the *inventory source group id* path property to the given value.
48308    ///
48309    /// Even though the property as already been set when instantiating this call,
48310    /// we provide this method for API completeness.
48311    pub fn inventory_source_group_id(
48312        mut self,
48313        new_value: i64,
48314    ) -> InventorySourceGroupAssignedInventorySourceBulkEditCall<'a, C> {
48315        self._inventory_source_group_id = new_value;
48316        self
48317    }
48318    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
48319    /// while executing the actual API request.
48320    ///
48321    /// ````text
48322    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
48323    /// ````
48324    ///
48325    /// Sets the *delegate* property to the given value.
48326    pub fn delegate(
48327        mut self,
48328        new_value: &'a mut dyn common::Delegate,
48329    ) -> InventorySourceGroupAssignedInventorySourceBulkEditCall<'a, C> {
48330        self._delegate = Some(new_value);
48331        self
48332    }
48333
48334    /// Set any additional parameter of the query string used in the request.
48335    /// It should be used to set parameters which are not yet available through their own
48336    /// setters.
48337    ///
48338    /// Please note that this method must not be used to set any of the known parameters
48339    /// which have their own setter method. If done anyway, the request will fail.
48340    ///
48341    /// # Additional Parameters
48342    ///
48343    /// * *$.xgafv* (query-string) - V1 error format.
48344    /// * *access_token* (query-string) - OAuth access token.
48345    /// * *alt* (query-string) - Data format for response.
48346    /// * *callback* (query-string) - JSONP
48347    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
48348    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
48349    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
48350    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
48351    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
48352    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
48353    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
48354    pub fn param<T>(
48355        mut self,
48356        name: T,
48357        value: T,
48358    ) -> InventorySourceGroupAssignedInventorySourceBulkEditCall<'a, C>
48359    where
48360        T: AsRef<str>,
48361    {
48362        self._additional_params
48363            .insert(name.as_ref().to_string(), value.as_ref().to_string());
48364        self
48365    }
48366
48367    /// Identifies the authorization scope for the method you are building.
48368    ///
48369    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
48370    /// [`Scope::DisplayVideo`].
48371    ///
48372    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
48373    /// tokens for more than one scope.
48374    ///
48375    /// Usually there is more than one suitable scope to authorize an operation, some of which may
48376    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
48377    /// sufficient, a read-write scope will do as well.
48378    pub fn add_scope<St>(
48379        mut self,
48380        scope: St,
48381    ) -> InventorySourceGroupAssignedInventorySourceBulkEditCall<'a, C>
48382    where
48383        St: AsRef<str>,
48384    {
48385        self._scopes.insert(String::from(scope.as_ref()));
48386        self
48387    }
48388    /// Identifies the authorization scope(s) for the method you are building.
48389    ///
48390    /// See [`Self::add_scope()`] for details.
48391    pub fn add_scopes<I, St>(
48392        mut self,
48393        scopes: I,
48394    ) -> InventorySourceGroupAssignedInventorySourceBulkEditCall<'a, C>
48395    where
48396        I: IntoIterator<Item = St>,
48397        St: AsRef<str>,
48398    {
48399        self._scopes
48400            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
48401        self
48402    }
48403
48404    /// Removes all scopes, and no default scope will be used either.
48405    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
48406    /// for details).
48407    pub fn clear_scopes(
48408        mut self,
48409    ) -> InventorySourceGroupAssignedInventorySourceBulkEditCall<'a, C> {
48410        self._scopes.clear();
48411        self
48412    }
48413}
48414
48415/// Creates an assignment between an inventory source and an inventory source group.
48416///
48417/// A builder for the *assignedInventorySources.create* method supported by a *inventorySourceGroup* resource.
48418/// It is not used directly, but through a [`InventorySourceGroupMethods`] instance.
48419///
48420/// # Example
48421///
48422/// Instantiate a resource method builder
48423///
48424/// ```test_harness,no_run
48425/// # extern crate hyper;
48426/// # extern crate hyper_rustls;
48427/// # extern crate google_displayvideo1 as displayvideo1;
48428/// use displayvideo1::api::AssignedInventorySource;
48429/// # async fn dox() {
48430/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
48431///
48432/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
48433/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
48434/// #     secret,
48435/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
48436/// # ).build().await.unwrap();
48437///
48438/// # let client = hyper_util::client::legacy::Client::builder(
48439/// #     hyper_util::rt::TokioExecutor::new()
48440/// # )
48441/// # .build(
48442/// #     hyper_rustls::HttpsConnectorBuilder::new()
48443/// #         .with_native_roots()
48444/// #         .unwrap()
48445/// #         .https_or_http()
48446/// #         .enable_http1()
48447/// #         .build()
48448/// # );
48449/// # let mut hub = DisplayVideo::new(client, auth);
48450/// // As the method needs a request, you would usually fill it with the desired information
48451/// // into the respective structure. Some of the parts shown here might not be applicable !
48452/// // Values shown here are possibly random and not representative !
48453/// let mut req = AssignedInventorySource::default();
48454///
48455/// // You can configure optional parameters by calling the respective setters at will, and
48456/// // execute the final call using `doit()`.
48457/// // Values shown here are possibly random and not representative !
48458/// let result = hub.inventory_source_groups().assigned_inventory_sources_create(req, -66)
48459///              .partner_id(-35)
48460///              .advertiser_id(-30)
48461///              .doit().await;
48462/// # }
48463/// ```
48464pub struct InventorySourceGroupAssignedInventorySourceCreateCall<'a, C>
48465where
48466    C: 'a,
48467{
48468    hub: &'a DisplayVideo<C>,
48469    _request: AssignedInventorySource,
48470    _inventory_source_group_id: i64,
48471    _partner_id: Option<i64>,
48472    _advertiser_id: Option<i64>,
48473    _delegate: Option<&'a mut dyn common::Delegate>,
48474    _additional_params: HashMap<String, String>,
48475    _scopes: BTreeSet<String>,
48476}
48477
48478impl<'a, C> common::CallBuilder for InventorySourceGroupAssignedInventorySourceCreateCall<'a, C> {}
48479
48480impl<'a, C> InventorySourceGroupAssignedInventorySourceCreateCall<'a, C>
48481where
48482    C: common::Connector,
48483{
48484    /// Perform the operation you have build so far.
48485    pub async fn doit(mut self) -> common::Result<(common::Response, AssignedInventorySource)> {
48486        use std::borrow::Cow;
48487        use std::io::{Read, Seek};
48488
48489        use common::{url::Params, ToParts};
48490        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
48491
48492        let mut dd = common::DefaultDelegate;
48493        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
48494        dlg.begin(common::MethodInfo {
48495            id: "displayvideo.inventorySourceGroups.assignedInventorySources.create",
48496            http_method: hyper::Method::POST,
48497        });
48498
48499        for &field in ["alt", "inventorySourceGroupId", "partnerId", "advertiserId"].iter() {
48500            if self._additional_params.contains_key(field) {
48501                dlg.finished(false);
48502                return Err(common::Error::FieldClash(field));
48503            }
48504        }
48505
48506        let mut params = Params::with_capacity(6 + self._additional_params.len());
48507        params.push(
48508            "inventorySourceGroupId",
48509            self._inventory_source_group_id.to_string(),
48510        );
48511        if let Some(value) = self._partner_id.as_ref() {
48512            params.push("partnerId", value.to_string());
48513        }
48514        if let Some(value) = self._advertiser_id.as_ref() {
48515            params.push("advertiserId", value.to_string());
48516        }
48517
48518        params.extend(self._additional_params.iter());
48519
48520        params.push("alt", "json");
48521        let mut url = self.hub._base_url.clone()
48522            + "v1/inventorySourceGroups/{+inventorySourceGroupId}/assignedInventorySources";
48523        if self._scopes.is_empty() {
48524            self._scopes
48525                .insert(Scope::DisplayVideo.as_ref().to_string());
48526        }
48527
48528        #[allow(clippy::single_element_loop)]
48529        for &(find_this, param_name) in
48530            [("{+inventorySourceGroupId}", "inventorySourceGroupId")].iter()
48531        {
48532            url = params.uri_replacement(url, param_name, find_this, true);
48533        }
48534        {
48535            let to_remove = ["inventorySourceGroupId"];
48536            params.remove_params(&to_remove);
48537        }
48538
48539        let url = params.parse_with_url(&url);
48540
48541        let mut json_mime_type = mime::APPLICATION_JSON;
48542        let mut request_value_reader = {
48543            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
48544            common::remove_json_null_values(&mut value);
48545            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
48546            serde_json::to_writer(&mut dst, &value).unwrap();
48547            dst
48548        };
48549        let request_size = request_value_reader
48550            .seek(std::io::SeekFrom::End(0))
48551            .unwrap();
48552        request_value_reader
48553            .seek(std::io::SeekFrom::Start(0))
48554            .unwrap();
48555
48556        loop {
48557            let token = match self
48558                .hub
48559                .auth
48560                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
48561                .await
48562            {
48563                Ok(token) => token,
48564                Err(e) => match dlg.token(e) {
48565                    Ok(token) => token,
48566                    Err(e) => {
48567                        dlg.finished(false);
48568                        return Err(common::Error::MissingToken(e));
48569                    }
48570                },
48571            };
48572            request_value_reader
48573                .seek(std::io::SeekFrom::Start(0))
48574                .unwrap();
48575            let mut req_result = {
48576                let client = &self.hub.client;
48577                dlg.pre_request();
48578                let mut req_builder = hyper::Request::builder()
48579                    .method(hyper::Method::POST)
48580                    .uri(url.as_str())
48581                    .header(USER_AGENT, self.hub._user_agent.clone());
48582
48583                if let Some(token) = token.as_ref() {
48584                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
48585                }
48586
48587                let request = req_builder
48588                    .header(CONTENT_TYPE, json_mime_type.to_string())
48589                    .header(CONTENT_LENGTH, request_size as u64)
48590                    .body(common::to_body(
48591                        request_value_reader.get_ref().clone().into(),
48592                    ));
48593
48594                client.request(request.unwrap()).await
48595            };
48596
48597            match req_result {
48598                Err(err) => {
48599                    if let common::Retry::After(d) = dlg.http_error(&err) {
48600                        sleep(d).await;
48601                        continue;
48602                    }
48603                    dlg.finished(false);
48604                    return Err(common::Error::HttpError(err));
48605                }
48606                Ok(res) => {
48607                    let (mut parts, body) = res.into_parts();
48608                    let mut body = common::Body::new(body);
48609                    if !parts.status.is_success() {
48610                        let bytes = common::to_bytes(body).await.unwrap_or_default();
48611                        let error = serde_json::from_str(&common::to_string(&bytes));
48612                        let response = common::to_response(parts, bytes.into());
48613
48614                        if let common::Retry::After(d) =
48615                            dlg.http_failure(&response, error.as_ref().ok())
48616                        {
48617                            sleep(d).await;
48618                            continue;
48619                        }
48620
48621                        dlg.finished(false);
48622
48623                        return Err(match error {
48624                            Ok(value) => common::Error::BadRequest(value),
48625                            _ => common::Error::Failure(response),
48626                        });
48627                    }
48628                    let response = {
48629                        let bytes = common::to_bytes(body).await.unwrap_or_default();
48630                        let encoded = common::to_string(&bytes);
48631                        match serde_json::from_str(&encoded) {
48632                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
48633                            Err(error) => {
48634                                dlg.response_json_decode_error(&encoded, &error);
48635                                return Err(common::Error::JsonDecodeError(
48636                                    encoded.to_string(),
48637                                    error,
48638                                ));
48639                            }
48640                        }
48641                    };
48642
48643                    dlg.finished(true);
48644                    return Ok(response);
48645                }
48646            }
48647        }
48648    }
48649
48650    ///
48651    /// Sets the *request* property to the given value.
48652    ///
48653    /// Even though the property as already been set when instantiating this call,
48654    /// we provide this method for API completeness.
48655    pub fn request(
48656        mut self,
48657        new_value: AssignedInventorySource,
48658    ) -> InventorySourceGroupAssignedInventorySourceCreateCall<'a, C> {
48659        self._request = new_value;
48660        self
48661    }
48662    /// Required. The ID of the inventory source group to which the assignment will be assigned.
48663    ///
48664    /// Sets the *inventory source group id* path property to the given value.
48665    ///
48666    /// Even though the property as already been set when instantiating this call,
48667    /// we provide this method for API completeness.
48668    pub fn inventory_source_group_id(
48669        mut self,
48670        new_value: i64,
48671    ) -> InventorySourceGroupAssignedInventorySourceCreateCall<'a, C> {
48672        self._inventory_source_group_id = new_value;
48673        self
48674    }
48675    /// The ID of the partner that owns the parent inventory source group. Only this partner will have write access to this assigned inventory source.
48676    ///
48677    /// Sets the *partner id* query property to the given value.
48678    pub fn partner_id(
48679        mut self,
48680        new_value: i64,
48681    ) -> InventorySourceGroupAssignedInventorySourceCreateCall<'a, C> {
48682        self._partner_id = Some(new_value);
48683        self
48684    }
48685    /// The ID of the advertiser that owns the parent inventory source group. The parent partner will not have access to this assigned inventory source.
48686    ///
48687    /// Sets the *advertiser id* query property to the given value.
48688    pub fn advertiser_id(
48689        mut self,
48690        new_value: i64,
48691    ) -> InventorySourceGroupAssignedInventorySourceCreateCall<'a, C> {
48692        self._advertiser_id = Some(new_value);
48693        self
48694    }
48695    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
48696    /// while executing the actual API request.
48697    ///
48698    /// ````text
48699    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
48700    /// ````
48701    ///
48702    /// Sets the *delegate* property to the given value.
48703    pub fn delegate(
48704        mut self,
48705        new_value: &'a mut dyn common::Delegate,
48706    ) -> InventorySourceGroupAssignedInventorySourceCreateCall<'a, C> {
48707        self._delegate = Some(new_value);
48708        self
48709    }
48710
48711    /// Set any additional parameter of the query string used in the request.
48712    /// It should be used to set parameters which are not yet available through their own
48713    /// setters.
48714    ///
48715    /// Please note that this method must not be used to set any of the known parameters
48716    /// which have their own setter method. If done anyway, the request will fail.
48717    ///
48718    /// # Additional Parameters
48719    ///
48720    /// * *$.xgafv* (query-string) - V1 error format.
48721    /// * *access_token* (query-string) - OAuth access token.
48722    /// * *alt* (query-string) - Data format for response.
48723    /// * *callback* (query-string) - JSONP
48724    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
48725    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
48726    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
48727    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
48728    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
48729    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
48730    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
48731    pub fn param<T>(
48732        mut self,
48733        name: T,
48734        value: T,
48735    ) -> InventorySourceGroupAssignedInventorySourceCreateCall<'a, C>
48736    where
48737        T: AsRef<str>,
48738    {
48739        self._additional_params
48740            .insert(name.as_ref().to_string(), value.as_ref().to_string());
48741        self
48742    }
48743
48744    /// Identifies the authorization scope for the method you are building.
48745    ///
48746    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
48747    /// [`Scope::DisplayVideo`].
48748    ///
48749    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
48750    /// tokens for more than one scope.
48751    ///
48752    /// Usually there is more than one suitable scope to authorize an operation, some of which may
48753    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
48754    /// sufficient, a read-write scope will do as well.
48755    pub fn add_scope<St>(
48756        mut self,
48757        scope: St,
48758    ) -> InventorySourceGroupAssignedInventorySourceCreateCall<'a, C>
48759    where
48760        St: AsRef<str>,
48761    {
48762        self._scopes.insert(String::from(scope.as_ref()));
48763        self
48764    }
48765    /// Identifies the authorization scope(s) for the method you are building.
48766    ///
48767    /// See [`Self::add_scope()`] for details.
48768    pub fn add_scopes<I, St>(
48769        mut self,
48770        scopes: I,
48771    ) -> InventorySourceGroupAssignedInventorySourceCreateCall<'a, C>
48772    where
48773        I: IntoIterator<Item = St>,
48774        St: AsRef<str>,
48775    {
48776        self._scopes
48777            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
48778        self
48779    }
48780
48781    /// Removes all scopes, and no default scope will be used either.
48782    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
48783    /// for details).
48784    pub fn clear_scopes(mut self) -> InventorySourceGroupAssignedInventorySourceCreateCall<'a, C> {
48785        self._scopes.clear();
48786        self
48787    }
48788}
48789
48790/// Deletes the assignment between an inventory source and an inventory source group.
48791///
48792/// A builder for the *assignedInventorySources.delete* method supported by a *inventorySourceGroup* resource.
48793/// It is not used directly, but through a [`InventorySourceGroupMethods`] instance.
48794///
48795/// # Example
48796///
48797/// Instantiate a resource method builder
48798///
48799/// ```test_harness,no_run
48800/// # extern crate hyper;
48801/// # extern crate hyper_rustls;
48802/// # extern crate google_displayvideo1 as displayvideo1;
48803/// # async fn dox() {
48804/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
48805///
48806/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
48807/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
48808/// #     secret,
48809/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
48810/// # ).build().await.unwrap();
48811///
48812/// # let client = hyper_util::client::legacy::Client::builder(
48813/// #     hyper_util::rt::TokioExecutor::new()
48814/// # )
48815/// # .build(
48816/// #     hyper_rustls::HttpsConnectorBuilder::new()
48817/// #         .with_native_roots()
48818/// #         .unwrap()
48819/// #         .https_or_http()
48820/// #         .enable_http1()
48821/// #         .build()
48822/// # );
48823/// # let mut hub = DisplayVideo::new(client, auth);
48824/// // You can configure optional parameters by calling the respective setters at will, and
48825/// // execute the final call using `doit()`.
48826/// // Values shown here are possibly random and not representative !
48827/// let result = hub.inventory_source_groups().assigned_inventory_sources_delete(-65, -82)
48828///              .partner_id(-13)
48829///              .advertiser_id(-101)
48830///              .doit().await;
48831/// # }
48832/// ```
48833pub struct InventorySourceGroupAssignedInventorySourceDeleteCall<'a, C>
48834where
48835    C: 'a,
48836{
48837    hub: &'a DisplayVideo<C>,
48838    _inventory_source_group_id: i64,
48839    _assigned_inventory_source_id: i64,
48840    _partner_id: Option<i64>,
48841    _advertiser_id: Option<i64>,
48842    _delegate: Option<&'a mut dyn common::Delegate>,
48843    _additional_params: HashMap<String, String>,
48844    _scopes: BTreeSet<String>,
48845}
48846
48847impl<'a, C> common::CallBuilder for InventorySourceGroupAssignedInventorySourceDeleteCall<'a, C> {}
48848
48849impl<'a, C> InventorySourceGroupAssignedInventorySourceDeleteCall<'a, C>
48850where
48851    C: common::Connector,
48852{
48853    /// Perform the operation you have build so far.
48854    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
48855        use std::borrow::Cow;
48856        use std::io::{Read, Seek};
48857
48858        use common::{url::Params, ToParts};
48859        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
48860
48861        let mut dd = common::DefaultDelegate;
48862        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
48863        dlg.begin(common::MethodInfo {
48864            id: "displayvideo.inventorySourceGroups.assignedInventorySources.delete",
48865            http_method: hyper::Method::DELETE,
48866        });
48867
48868        for &field in [
48869            "alt",
48870            "inventorySourceGroupId",
48871            "assignedInventorySourceId",
48872            "partnerId",
48873            "advertiserId",
48874        ]
48875        .iter()
48876        {
48877            if self._additional_params.contains_key(field) {
48878                dlg.finished(false);
48879                return Err(common::Error::FieldClash(field));
48880            }
48881        }
48882
48883        let mut params = Params::with_capacity(6 + self._additional_params.len());
48884        params.push(
48885            "inventorySourceGroupId",
48886            self._inventory_source_group_id.to_string(),
48887        );
48888        params.push(
48889            "assignedInventorySourceId",
48890            self._assigned_inventory_source_id.to_string(),
48891        );
48892        if let Some(value) = self._partner_id.as_ref() {
48893            params.push("partnerId", value.to_string());
48894        }
48895        if let Some(value) = self._advertiser_id.as_ref() {
48896            params.push("advertiserId", value.to_string());
48897        }
48898
48899        params.extend(self._additional_params.iter());
48900
48901        params.push("alt", "json");
48902        let mut url = self.hub._base_url.clone() + "v1/inventorySourceGroups/{+inventorySourceGroupId}/assignedInventorySources/{+assignedInventorySourceId}";
48903        if self._scopes.is_empty() {
48904            self._scopes
48905                .insert(Scope::DisplayVideo.as_ref().to_string());
48906        }
48907
48908        #[allow(clippy::single_element_loop)]
48909        for &(find_this, param_name) in [
48910            ("{+inventorySourceGroupId}", "inventorySourceGroupId"),
48911            ("{+assignedInventorySourceId}", "assignedInventorySourceId"),
48912        ]
48913        .iter()
48914        {
48915            url = params.uri_replacement(url, param_name, find_this, true);
48916        }
48917        {
48918            let to_remove = ["assignedInventorySourceId", "inventorySourceGroupId"];
48919            params.remove_params(&to_remove);
48920        }
48921
48922        let url = params.parse_with_url(&url);
48923
48924        loop {
48925            let token = match self
48926                .hub
48927                .auth
48928                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
48929                .await
48930            {
48931                Ok(token) => token,
48932                Err(e) => match dlg.token(e) {
48933                    Ok(token) => token,
48934                    Err(e) => {
48935                        dlg.finished(false);
48936                        return Err(common::Error::MissingToken(e));
48937                    }
48938                },
48939            };
48940            let mut req_result = {
48941                let client = &self.hub.client;
48942                dlg.pre_request();
48943                let mut req_builder = hyper::Request::builder()
48944                    .method(hyper::Method::DELETE)
48945                    .uri(url.as_str())
48946                    .header(USER_AGENT, self.hub._user_agent.clone());
48947
48948                if let Some(token) = token.as_ref() {
48949                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
48950                }
48951
48952                let request = req_builder
48953                    .header(CONTENT_LENGTH, 0_u64)
48954                    .body(common::to_body::<String>(None));
48955
48956                client.request(request.unwrap()).await
48957            };
48958
48959            match req_result {
48960                Err(err) => {
48961                    if let common::Retry::After(d) = dlg.http_error(&err) {
48962                        sleep(d).await;
48963                        continue;
48964                    }
48965                    dlg.finished(false);
48966                    return Err(common::Error::HttpError(err));
48967                }
48968                Ok(res) => {
48969                    let (mut parts, body) = res.into_parts();
48970                    let mut body = common::Body::new(body);
48971                    if !parts.status.is_success() {
48972                        let bytes = common::to_bytes(body).await.unwrap_or_default();
48973                        let error = serde_json::from_str(&common::to_string(&bytes));
48974                        let response = common::to_response(parts, bytes.into());
48975
48976                        if let common::Retry::After(d) =
48977                            dlg.http_failure(&response, error.as_ref().ok())
48978                        {
48979                            sleep(d).await;
48980                            continue;
48981                        }
48982
48983                        dlg.finished(false);
48984
48985                        return Err(match error {
48986                            Ok(value) => common::Error::BadRequest(value),
48987                            _ => common::Error::Failure(response),
48988                        });
48989                    }
48990                    let response = {
48991                        let bytes = common::to_bytes(body).await.unwrap_or_default();
48992                        let encoded = common::to_string(&bytes);
48993                        match serde_json::from_str(&encoded) {
48994                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
48995                            Err(error) => {
48996                                dlg.response_json_decode_error(&encoded, &error);
48997                                return Err(common::Error::JsonDecodeError(
48998                                    encoded.to_string(),
48999                                    error,
49000                                ));
49001                            }
49002                        }
49003                    };
49004
49005                    dlg.finished(true);
49006                    return Ok(response);
49007                }
49008            }
49009        }
49010    }
49011
49012    /// Required. The ID of the inventory source group to which this assignment is assigned.
49013    ///
49014    /// Sets the *inventory source group id* path property to the given value.
49015    ///
49016    /// Even though the property as already been set when instantiating this call,
49017    /// we provide this method for API completeness.
49018    pub fn inventory_source_group_id(
49019        mut self,
49020        new_value: i64,
49021    ) -> InventorySourceGroupAssignedInventorySourceDeleteCall<'a, C> {
49022        self._inventory_source_group_id = new_value;
49023        self
49024    }
49025    /// Required. The ID of the assigned inventory source to delete.
49026    ///
49027    /// Sets the *assigned inventory source id* path property to the given value.
49028    ///
49029    /// Even though the property as already been set when instantiating this call,
49030    /// we provide this method for API completeness.
49031    pub fn assigned_inventory_source_id(
49032        mut self,
49033        new_value: i64,
49034    ) -> InventorySourceGroupAssignedInventorySourceDeleteCall<'a, C> {
49035        self._assigned_inventory_source_id = new_value;
49036        self
49037    }
49038    /// The ID of the partner that owns the parent inventory source group. Only this partner has write access to this assigned inventory source.
49039    ///
49040    /// Sets the *partner id* query property to the given value.
49041    pub fn partner_id(
49042        mut self,
49043        new_value: i64,
49044    ) -> InventorySourceGroupAssignedInventorySourceDeleteCall<'a, C> {
49045        self._partner_id = Some(new_value);
49046        self
49047    }
49048    /// The ID of the advertiser that owns the parent inventory source group. The parent partner does not have access to this assigned inventory source.
49049    ///
49050    /// Sets the *advertiser id* query property to the given value.
49051    pub fn advertiser_id(
49052        mut self,
49053        new_value: i64,
49054    ) -> InventorySourceGroupAssignedInventorySourceDeleteCall<'a, C> {
49055        self._advertiser_id = Some(new_value);
49056        self
49057    }
49058    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
49059    /// while executing the actual API request.
49060    ///
49061    /// ````text
49062    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
49063    /// ````
49064    ///
49065    /// Sets the *delegate* property to the given value.
49066    pub fn delegate(
49067        mut self,
49068        new_value: &'a mut dyn common::Delegate,
49069    ) -> InventorySourceGroupAssignedInventorySourceDeleteCall<'a, C> {
49070        self._delegate = Some(new_value);
49071        self
49072    }
49073
49074    /// Set any additional parameter of the query string used in the request.
49075    /// It should be used to set parameters which are not yet available through their own
49076    /// setters.
49077    ///
49078    /// Please note that this method must not be used to set any of the known parameters
49079    /// which have their own setter method. If done anyway, the request will fail.
49080    ///
49081    /// # Additional Parameters
49082    ///
49083    /// * *$.xgafv* (query-string) - V1 error format.
49084    /// * *access_token* (query-string) - OAuth access token.
49085    /// * *alt* (query-string) - Data format for response.
49086    /// * *callback* (query-string) - JSONP
49087    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
49088    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
49089    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
49090    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
49091    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
49092    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
49093    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
49094    pub fn param<T>(
49095        mut self,
49096        name: T,
49097        value: T,
49098    ) -> InventorySourceGroupAssignedInventorySourceDeleteCall<'a, C>
49099    where
49100        T: AsRef<str>,
49101    {
49102        self._additional_params
49103            .insert(name.as_ref().to_string(), value.as_ref().to_string());
49104        self
49105    }
49106
49107    /// Identifies the authorization scope for the method you are building.
49108    ///
49109    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
49110    /// [`Scope::DisplayVideo`].
49111    ///
49112    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
49113    /// tokens for more than one scope.
49114    ///
49115    /// Usually there is more than one suitable scope to authorize an operation, some of which may
49116    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
49117    /// sufficient, a read-write scope will do as well.
49118    pub fn add_scope<St>(
49119        mut self,
49120        scope: St,
49121    ) -> InventorySourceGroupAssignedInventorySourceDeleteCall<'a, C>
49122    where
49123        St: AsRef<str>,
49124    {
49125        self._scopes.insert(String::from(scope.as_ref()));
49126        self
49127    }
49128    /// Identifies the authorization scope(s) for the method you are building.
49129    ///
49130    /// See [`Self::add_scope()`] for details.
49131    pub fn add_scopes<I, St>(
49132        mut self,
49133        scopes: I,
49134    ) -> InventorySourceGroupAssignedInventorySourceDeleteCall<'a, C>
49135    where
49136        I: IntoIterator<Item = St>,
49137        St: AsRef<str>,
49138    {
49139        self._scopes
49140            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
49141        self
49142    }
49143
49144    /// Removes all scopes, and no default scope will be used either.
49145    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
49146    /// for details).
49147    pub fn clear_scopes(mut self) -> InventorySourceGroupAssignedInventorySourceDeleteCall<'a, C> {
49148        self._scopes.clear();
49149        self
49150    }
49151}
49152
49153/// Lists inventory sources assigned to an inventory source group.
49154///
49155/// A builder for the *assignedInventorySources.list* method supported by a *inventorySourceGroup* resource.
49156/// It is not used directly, but through a [`InventorySourceGroupMethods`] instance.
49157///
49158/// # Example
49159///
49160/// Instantiate a resource method builder
49161///
49162/// ```test_harness,no_run
49163/// # extern crate hyper;
49164/// # extern crate hyper_rustls;
49165/// # extern crate google_displayvideo1 as displayvideo1;
49166/// # async fn dox() {
49167/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
49168///
49169/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
49170/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
49171/// #     secret,
49172/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
49173/// # ).build().await.unwrap();
49174///
49175/// # let client = hyper_util::client::legacy::Client::builder(
49176/// #     hyper_util::rt::TokioExecutor::new()
49177/// # )
49178/// # .build(
49179/// #     hyper_rustls::HttpsConnectorBuilder::new()
49180/// #         .with_native_roots()
49181/// #         .unwrap()
49182/// #         .https_or_http()
49183/// #         .enable_http1()
49184/// #         .build()
49185/// # );
49186/// # let mut hub = DisplayVideo::new(client, auth);
49187/// // You can configure optional parameters by calling the respective setters at will, and
49188/// // execute the final call using `doit()`.
49189/// // Values shown here are possibly random and not representative !
49190/// let result = hub.inventory_source_groups().assigned_inventory_sources_list(-48)
49191///              .partner_id(-63)
49192///              .page_token("tempor")
49193///              .page_size(-54)
49194///              .order_by("amet")
49195///              .filter("sit")
49196///              .advertiser_id(-16)
49197///              .doit().await;
49198/// # }
49199/// ```
49200pub struct InventorySourceGroupAssignedInventorySourceListCall<'a, C>
49201where
49202    C: 'a,
49203{
49204    hub: &'a DisplayVideo<C>,
49205    _inventory_source_group_id: i64,
49206    _partner_id: Option<i64>,
49207    _page_token: Option<String>,
49208    _page_size: Option<i32>,
49209    _order_by: Option<String>,
49210    _filter: Option<String>,
49211    _advertiser_id: Option<i64>,
49212    _delegate: Option<&'a mut dyn common::Delegate>,
49213    _additional_params: HashMap<String, String>,
49214    _scopes: BTreeSet<String>,
49215}
49216
49217impl<'a, C> common::CallBuilder for InventorySourceGroupAssignedInventorySourceListCall<'a, C> {}
49218
49219impl<'a, C> InventorySourceGroupAssignedInventorySourceListCall<'a, C>
49220where
49221    C: common::Connector,
49222{
49223    /// Perform the operation you have build so far.
49224    pub async fn doit(
49225        mut self,
49226    ) -> common::Result<(common::Response, ListAssignedInventorySourcesResponse)> {
49227        use std::borrow::Cow;
49228        use std::io::{Read, Seek};
49229
49230        use common::{url::Params, ToParts};
49231        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
49232
49233        let mut dd = common::DefaultDelegate;
49234        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
49235        dlg.begin(common::MethodInfo {
49236            id: "displayvideo.inventorySourceGroups.assignedInventorySources.list",
49237            http_method: hyper::Method::GET,
49238        });
49239
49240        for &field in [
49241            "alt",
49242            "inventorySourceGroupId",
49243            "partnerId",
49244            "pageToken",
49245            "pageSize",
49246            "orderBy",
49247            "filter",
49248            "advertiserId",
49249        ]
49250        .iter()
49251        {
49252            if self._additional_params.contains_key(field) {
49253                dlg.finished(false);
49254                return Err(common::Error::FieldClash(field));
49255            }
49256        }
49257
49258        let mut params = Params::with_capacity(9 + self._additional_params.len());
49259        params.push(
49260            "inventorySourceGroupId",
49261            self._inventory_source_group_id.to_string(),
49262        );
49263        if let Some(value) = self._partner_id.as_ref() {
49264            params.push("partnerId", value.to_string());
49265        }
49266        if let Some(value) = self._page_token.as_ref() {
49267            params.push("pageToken", value);
49268        }
49269        if let Some(value) = self._page_size.as_ref() {
49270            params.push("pageSize", value.to_string());
49271        }
49272        if let Some(value) = self._order_by.as_ref() {
49273            params.push("orderBy", value);
49274        }
49275        if let Some(value) = self._filter.as_ref() {
49276            params.push("filter", value);
49277        }
49278        if let Some(value) = self._advertiser_id.as_ref() {
49279            params.push("advertiserId", value.to_string());
49280        }
49281
49282        params.extend(self._additional_params.iter());
49283
49284        params.push("alt", "json");
49285        let mut url = self.hub._base_url.clone()
49286            + "v1/inventorySourceGroups/{+inventorySourceGroupId}/assignedInventorySources";
49287        if self._scopes.is_empty() {
49288            self._scopes
49289                .insert(Scope::DisplayVideo.as_ref().to_string());
49290        }
49291
49292        #[allow(clippy::single_element_loop)]
49293        for &(find_this, param_name) in
49294            [("{+inventorySourceGroupId}", "inventorySourceGroupId")].iter()
49295        {
49296            url = params.uri_replacement(url, param_name, find_this, true);
49297        }
49298        {
49299            let to_remove = ["inventorySourceGroupId"];
49300            params.remove_params(&to_remove);
49301        }
49302
49303        let url = params.parse_with_url(&url);
49304
49305        loop {
49306            let token = match self
49307                .hub
49308                .auth
49309                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
49310                .await
49311            {
49312                Ok(token) => token,
49313                Err(e) => match dlg.token(e) {
49314                    Ok(token) => token,
49315                    Err(e) => {
49316                        dlg.finished(false);
49317                        return Err(common::Error::MissingToken(e));
49318                    }
49319                },
49320            };
49321            let mut req_result = {
49322                let client = &self.hub.client;
49323                dlg.pre_request();
49324                let mut req_builder = hyper::Request::builder()
49325                    .method(hyper::Method::GET)
49326                    .uri(url.as_str())
49327                    .header(USER_AGENT, self.hub._user_agent.clone());
49328
49329                if let Some(token) = token.as_ref() {
49330                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
49331                }
49332
49333                let request = req_builder
49334                    .header(CONTENT_LENGTH, 0_u64)
49335                    .body(common::to_body::<String>(None));
49336
49337                client.request(request.unwrap()).await
49338            };
49339
49340            match req_result {
49341                Err(err) => {
49342                    if let common::Retry::After(d) = dlg.http_error(&err) {
49343                        sleep(d).await;
49344                        continue;
49345                    }
49346                    dlg.finished(false);
49347                    return Err(common::Error::HttpError(err));
49348                }
49349                Ok(res) => {
49350                    let (mut parts, body) = res.into_parts();
49351                    let mut body = common::Body::new(body);
49352                    if !parts.status.is_success() {
49353                        let bytes = common::to_bytes(body).await.unwrap_or_default();
49354                        let error = serde_json::from_str(&common::to_string(&bytes));
49355                        let response = common::to_response(parts, bytes.into());
49356
49357                        if let common::Retry::After(d) =
49358                            dlg.http_failure(&response, error.as_ref().ok())
49359                        {
49360                            sleep(d).await;
49361                            continue;
49362                        }
49363
49364                        dlg.finished(false);
49365
49366                        return Err(match error {
49367                            Ok(value) => common::Error::BadRequest(value),
49368                            _ => common::Error::Failure(response),
49369                        });
49370                    }
49371                    let response = {
49372                        let bytes = common::to_bytes(body).await.unwrap_or_default();
49373                        let encoded = common::to_string(&bytes);
49374                        match serde_json::from_str(&encoded) {
49375                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
49376                            Err(error) => {
49377                                dlg.response_json_decode_error(&encoded, &error);
49378                                return Err(common::Error::JsonDecodeError(
49379                                    encoded.to_string(),
49380                                    error,
49381                                ));
49382                            }
49383                        }
49384                    };
49385
49386                    dlg.finished(true);
49387                    return Ok(response);
49388                }
49389            }
49390        }
49391    }
49392
49393    /// Required. The ID of the inventory source group to which these assignments are assigned.
49394    ///
49395    /// Sets the *inventory source group id* path property to the given value.
49396    ///
49397    /// Even though the property as already been set when instantiating this call,
49398    /// we provide this method for API completeness.
49399    pub fn inventory_source_group_id(
49400        mut self,
49401        new_value: i64,
49402    ) -> InventorySourceGroupAssignedInventorySourceListCall<'a, C> {
49403        self._inventory_source_group_id = new_value;
49404        self
49405    }
49406    /// The ID of the partner that has access to the assignment. If the parent inventory source group is advertiser-owned, the assignment cannot be accessed via a partner.
49407    ///
49408    /// Sets the *partner id* query property to the given value.
49409    pub fn partner_id(
49410        mut self,
49411        new_value: i64,
49412    ) -> InventorySourceGroupAssignedInventorySourceListCall<'a, C> {
49413        self._partner_id = Some(new_value);
49414        self
49415    }
49416    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListAssignedInventorySources` method. If not specified, the first page of results will be returned.
49417    ///
49418    /// Sets the *page token* query property to the given value.
49419    pub fn page_token(
49420        mut self,
49421        new_value: &str,
49422    ) -> InventorySourceGroupAssignedInventorySourceListCall<'a, C> {
49423        self._page_token = Some(new_value.to_string());
49424        self
49425    }
49426    /// Requested page size. Must be between `1` and `100`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
49427    ///
49428    /// Sets the *page size* query property to the given value.
49429    pub fn page_size(
49430        mut self,
49431        new_value: i32,
49432    ) -> InventorySourceGroupAssignedInventorySourceListCall<'a, C> {
49433        self._page_size = Some(new_value);
49434        self
49435    }
49436    /// Field by which to sort the list. Acceptable values are: * `assignedInventorySourceId` (default) The default sorting order is ascending. To specify descending order for a field, a suffix " desc" should be added to the field name. Example: `assignedInventorySourceId desc`.
49437    ///
49438    /// Sets the *order by* query property to the given value.
49439    pub fn order_by(
49440        mut self,
49441        new_value: &str,
49442    ) -> InventorySourceGroupAssignedInventorySourceListCall<'a, C> {
49443        self._order_by = Some(new_value.to_string());
49444        self
49445    }
49446    /// Allows filtering by assigned inventory source fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by the `OR` logical operator. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `EQUALS (=)` operator. Supported fields: * `assignedInventorySourceId` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
49447    ///
49448    /// Sets the *filter* query property to the given value.
49449    pub fn filter(
49450        mut self,
49451        new_value: &str,
49452    ) -> InventorySourceGroupAssignedInventorySourceListCall<'a, C> {
49453        self._filter = Some(new_value.to_string());
49454        self
49455    }
49456    /// The ID of the advertiser that has access to the assignment. If the parent inventory source group is partner-owned, only advertisers to which the parent group is explicitly shared can access the assigned inventory source.
49457    ///
49458    /// Sets the *advertiser id* query property to the given value.
49459    pub fn advertiser_id(
49460        mut self,
49461        new_value: i64,
49462    ) -> InventorySourceGroupAssignedInventorySourceListCall<'a, C> {
49463        self._advertiser_id = Some(new_value);
49464        self
49465    }
49466    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
49467    /// while executing the actual API request.
49468    ///
49469    /// ````text
49470    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
49471    /// ````
49472    ///
49473    /// Sets the *delegate* property to the given value.
49474    pub fn delegate(
49475        mut self,
49476        new_value: &'a mut dyn common::Delegate,
49477    ) -> InventorySourceGroupAssignedInventorySourceListCall<'a, C> {
49478        self._delegate = Some(new_value);
49479        self
49480    }
49481
49482    /// Set any additional parameter of the query string used in the request.
49483    /// It should be used to set parameters which are not yet available through their own
49484    /// setters.
49485    ///
49486    /// Please note that this method must not be used to set any of the known parameters
49487    /// which have their own setter method. If done anyway, the request will fail.
49488    ///
49489    /// # Additional Parameters
49490    ///
49491    /// * *$.xgafv* (query-string) - V1 error format.
49492    /// * *access_token* (query-string) - OAuth access token.
49493    /// * *alt* (query-string) - Data format for response.
49494    /// * *callback* (query-string) - JSONP
49495    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
49496    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
49497    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
49498    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
49499    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
49500    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
49501    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
49502    pub fn param<T>(
49503        mut self,
49504        name: T,
49505        value: T,
49506    ) -> InventorySourceGroupAssignedInventorySourceListCall<'a, C>
49507    where
49508        T: AsRef<str>,
49509    {
49510        self._additional_params
49511            .insert(name.as_ref().to_string(), value.as_ref().to_string());
49512        self
49513    }
49514
49515    /// Identifies the authorization scope for the method you are building.
49516    ///
49517    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
49518    /// [`Scope::DisplayVideo`].
49519    ///
49520    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
49521    /// tokens for more than one scope.
49522    ///
49523    /// Usually there is more than one suitable scope to authorize an operation, some of which may
49524    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
49525    /// sufficient, a read-write scope will do as well.
49526    pub fn add_scope<St>(
49527        mut self,
49528        scope: St,
49529    ) -> InventorySourceGroupAssignedInventorySourceListCall<'a, C>
49530    where
49531        St: AsRef<str>,
49532    {
49533        self._scopes.insert(String::from(scope.as_ref()));
49534        self
49535    }
49536    /// Identifies the authorization scope(s) for the method you are building.
49537    ///
49538    /// See [`Self::add_scope()`] for details.
49539    pub fn add_scopes<I, St>(
49540        mut self,
49541        scopes: I,
49542    ) -> InventorySourceGroupAssignedInventorySourceListCall<'a, C>
49543    where
49544        I: IntoIterator<Item = St>,
49545        St: AsRef<str>,
49546    {
49547        self._scopes
49548            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
49549        self
49550    }
49551
49552    /// Removes all scopes, and no default scope will be used either.
49553    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
49554    /// for details).
49555    pub fn clear_scopes(mut self) -> InventorySourceGroupAssignedInventorySourceListCall<'a, C> {
49556        self._scopes.clear();
49557        self
49558    }
49559}
49560
49561/// Creates a new inventory source group. Returns the newly created inventory source group if successful.
49562///
49563/// A builder for the *create* method supported by a *inventorySourceGroup* resource.
49564/// It is not used directly, but through a [`InventorySourceGroupMethods`] instance.
49565///
49566/// # Example
49567///
49568/// Instantiate a resource method builder
49569///
49570/// ```test_harness,no_run
49571/// # extern crate hyper;
49572/// # extern crate hyper_rustls;
49573/// # extern crate google_displayvideo1 as displayvideo1;
49574/// use displayvideo1::api::InventorySourceGroup;
49575/// # async fn dox() {
49576/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
49577///
49578/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
49579/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
49580/// #     secret,
49581/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
49582/// # ).build().await.unwrap();
49583///
49584/// # let client = hyper_util::client::legacy::Client::builder(
49585/// #     hyper_util::rt::TokioExecutor::new()
49586/// # )
49587/// # .build(
49588/// #     hyper_rustls::HttpsConnectorBuilder::new()
49589/// #         .with_native_roots()
49590/// #         .unwrap()
49591/// #         .https_or_http()
49592/// #         .enable_http1()
49593/// #         .build()
49594/// # );
49595/// # let mut hub = DisplayVideo::new(client, auth);
49596/// // As the method needs a request, you would usually fill it with the desired information
49597/// // into the respective structure. Some of the parts shown here might not be applicable !
49598/// // Values shown here are possibly random and not representative !
49599/// let mut req = InventorySourceGroup::default();
49600///
49601/// // You can configure optional parameters by calling the respective setters at will, and
49602/// // execute the final call using `doit()`.
49603/// // Values shown here are possibly random and not representative !
49604/// let result = hub.inventory_source_groups().create(req)
49605///              .partner_id(-60)
49606///              .advertiser_id(-100)
49607///              .doit().await;
49608/// # }
49609/// ```
49610pub struct InventorySourceGroupCreateCall<'a, C>
49611where
49612    C: 'a,
49613{
49614    hub: &'a DisplayVideo<C>,
49615    _request: InventorySourceGroup,
49616    _partner_id: Option<i64>,
49617    _advertiser_id: Option<i64>,
49618    _delegate: Option<&'a mut dyn common::Delegate>,
49619    _additional_params: HashMap<String, String>,
49620    _scopes: BTreeSet<String>,
49621}
49622
49623impl<'a, C> common::CallBuilder for InventorySourceGroupCreateCall<'a, C> {}
49624
49625impl<'a, C> InventorySourceGroupCreateCall<'a, C>
49626where
49627    C: common::Connector,
49628{
49629    /// Perform the operation you have build so far.
49630    pub async fn doit(mut self) -> common::Result<(common::Response, InventorySourceGroup)> {
49631        use std::borrow::Cow;
49632        use std::io::{Read, Seek};
49633
49634        use common::{url::Params, ToParts};
49635        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
49636
49637        let mut dd = common::DefaultDelegate;
49638        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
49639        dlg.begin(common::MethodInfo {
49640            id: "displayvideo.inventorySourceGroups.create",
49641            http_method: hyper::Method::POST,
49642        });
49643
49644        for &field in ["alt", "partnerId", "advertiserId"].iter() {
49645            if self._additional_params.contains_key(field) {
49646                dlg.finished(false);
49647                return Err(common::Error::FieldClash(field));
49648            }
49649        }
49650
49651        let mut params = Params::with_capacity(5 + self._additional_params.len());
49652        if let Some(value) = self._partner_id.as_ref() {
49653            params.push("partnerId", value.to_string());
49654        }
49655        if let Some(value) = self._advertiser_id.as_ref() {
49656            params.push("advertiserId", value.to_string());
49657        }
49658
49659        params.extend(self._additional_params.iter());
49660
49661        params.push("alt", "json");
49662        let mut url = self.hub._base_url.clone() + "v1/inventorySourceGroups";
49663        if self._scopes.is_empty() {
49664            self._scopes
49665                .insert(Scope::DisplayVideo.as_ref().to_string());
49666        }
49667
49668        let url = params.parse_with_url(&url);
49669
49670        let mut json_mime_type = mime::APPLICATION_JSON;
49671        let mut request_value_reader = {
49672            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
49673            common::remove_json_null_values(&mut value);
49674            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
49675            serde_json::to_writer(&mut dst, &value).unwrap();
49676            dst
49677        };
49678        let request_size = request_value_reader
49679            .seek(std::io::SeekFrom::End(0))
49680            .unwrap();
49681        request_value_reader
49682            .seek(std::io::SeekFrom::Start(0))
49683            .unwrap();
49684
49685        loop {
49686            let token = match self
49687                .hub
49688                .auth
49689                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
49690                .await
49691            {
49692                Ok(token) => token,
49693                Err(e) => match dlg.token(e) {
49694                    Ok(token) => token,
49695                    Err(e) => {
49696                        dlg.finished(false);
49697                        return Err(common::Error::MissingToken(e));
49698                    }
49699                },
49700            };
49701            request_value_reader
49702                .seek(std::io::SeekFrom::Start(0))
49703                .unwrap();
49704            let mut req_result = {
49705                let client = &self.hub.client;
49706                dlg.pre_request();
49707                let mut req_builder = hyper::Request::builder()
49708                    .method(hyper::Method::POST)
49709                    .uri(url.as_str())
49710                    .header(USER_AGENT, self.hub._user_agent.clone());
49711
49712                if let Some(token) = token.as_ref() {
49713                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
49714                }
49715
49716                let request = req_builder
49717                    .header(CONTENT_TYPE, json_mime_type.to_string())
49718                    .header(CONTENT_LENGTH, request_size as u64)
49719                    .body(common::to_body(
49720                        request_value_reader.get_ref().clone().into(),
49721                    ));
49722
49723                client.request(request.unwrap()).await
49724            };
49725
49726            match req_result {
49727                Err(err) => {
49728                    if let common::Retry::After(d) = dlg.http_error(&err) {
49729                        sleep(d).await;
49730                        continue;
49731                    }
49732                    dlg.finished(false);
49733                    return Err(common::Error::HttpError(err));
49734                }
49735                Ok(res) => {
49736                    let (mut parts, body) = res.into_parts();
49737                    let mut body = common::Body::new(body);
49738                    if !parts.status.is_success() {
49739                        let bytes = common::to_bytes(body).await.unwrap_or_default();
49740                        let error = serde_json::from_str(&common::to_string(&bytes));
49741                        let response = common::to_response(parts, bytes.into());
49742
49743                        if let common::Retry::After(d) =
49744                            dlg.http_failure(&response, error.as_ref().ok())
49745                        {
49746                            sleep(d).await;
49747                            continue;
49748                        }
49749
49750                        dlg.finished(false);
49751
49752                        return Err(match error {
49753                            Ok(value) => common::Error::BadRequest(value),
49754                            _ => common::Error::Failure(response),
49755                        });
49756                    }
49757                    let response = {
49758                        let bytes = common::to_bytes(body).await.unwrap_or_default();
49759                        let encoded = common::to_string(&bytes);
49760                        match serde_json::from_str(&encoded) {
49761                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
49762                            Err(error) => {
49763                                dlg.response_json_decode_error(&encoded, &error);
49764                                return Err(common::Error::JsonDecodeError(
49765                                    encoded.to_string(),
49766                                    error,
49767                                ));
49768                            }
49769                        }
49770                    };
49771
49772                    dlg.finished(true);
49773                    return Ok(response);
49774                }
49775            }
49776        }
49777    }
49778
49779    ///
49780    /// Sets the *request* property to the given value.
49781    ///
49782    /// Even though the property as already been set when instantiating this call,
49783    /// we provide this method for API completeness.
49784    pub fn request(
49785        mut self,
49786        new_value: InventorySourceGroup,
49787    ) -> InventorySourceGroupCreateCall<'a, C> {
49788        self._request = new_value;
49789        self
49790    }
49791    /// The ID of the partner that owns the inventory source group. Only this partner will have write access to this group. Only advertisers to which this group is explicitly shared will have read access to this group.
49792    ///
49793    /// Sets the *partner id* query property to the given value.
49794    pub fn partner_id(mut self, new_value: i64) -> InventorySourceGroupCreateCall<'a, C> {
49795        self._partner_id = Some(new_value);
49796        self
49797    }
49798    /// The ID of the advertiser that owns the inventory source group. The parent partner will not have access to this group.
49799    ///
49800    /// Sets the *advertiser id* query property to the given value.
49801    pub fn advertiser_id(mut self, new_value: i64) -> InventorySourceGroupCreateCall<'a, C> {
49802        self._advertiser_id = Some(new_value);
49803        self
49804    }
49805    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
49806    /// while executing the actual API request.
49807    ///
49808    /// ````text
49809    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
49810    /// ````
49811    ///
49812    /// Sets the *delegate* property to the given value.
49813    pub fn delegate(
49814        mut self,
49815        new_value: &'a mut dyn common::Delegate,
49816    ) -> InventorySourceGroupCreateCall<'a, C> {
49817        self._delegate = Some(new_value);
49818        self
49819    }
49820
49821    /// Set any additional parameter of the query string used in the request.
49822    /// It should be used to set parameters which are not yet available through their own
49823    /// setters.
49824    ///
49825    /// Please note that this method must not be used to set any of the known parameters
49826    /// which have their own setter method. If done anyway, the request will fail.
49827    ///
49828    /// # Additional Parameters
49829    ///
49830    /// * *$.xgafv* (query-string) - V1 error format.
49831    /// * *access_token* (query-string) - OAuth access token.
49832    /// * *alt* (query-string) - Data format for response.
49833    /// * *callback* (query-string) - JSONP
49834    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
49835    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
49836    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
49837    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
49838    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
49839    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
49840    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
49841    pub fn param<T>(mut self, name: T, value: T) -> InventorySourceGroupCreateCall<'a, C>
49842    where
49843        T: AsRef<str>,
49844    {
49845        self._additional_params
49846            .insert(name.as_ref().to_string(), value.as_ref().to_string());
49847        self
49848    }
49849
49850    /// Identifies the authorization scope for the method you are building.
49851    ///
49852    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
49853    /// [`Scope::DisplayVideo`].
49854    ///
49855    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
49856    /// tokens for more than one scope.
49857    ///
49858    /// Usually there is more than one suitable scope to authorize an operation, some of which may
49859    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
49860    /// sufficient, a read-write scope will do as well.
49861    pub fn add_scope<St>(mut self, scope: St) -> InventorySourceGroupCreateCall<'a, C>
49862    where
49863        St: AsRef<str>,
49864    {
49865        self._scopes.insert(String::from(scope.as_ref()));
49866        self
49867    }
49868    /// Identifies the authorization scope(s) for the method you are building.
49869    ///
49870    /// See [`Self::add_scope()`] for details.
49871    pub fn add_scopes<I, St>(mut self, scopes: I) -> InventorySourceGroupCreateCall<'a, C>
49872    where
49873        I: IntoIterator<Item = St>,
49874        St: AsRef<str>,
49875    {
49876        self._scopes
49877            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
49878        self
49879    }
49880
49881    /// Removes all scopes, and no default scope will be used either.
49882    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
49883    /// for details).
49884    pub fn clear_scopes(mut self) -> InventorySourceGroupCreateCall<'a, C> {
49885        self._scopes.clear();
49886        self
49887    }
49888}
49889
49890/// Deletes an inventory source group.
49891///
49892/// A builder for the *delete* method supported by a *inventorySourceGroup* resource.
49893/// It is not used directly, but through a [`InventorySourceGroupMethods`] instance.
49894///
49895/// # Example
49896///
49897/// Instantiate a resource method builder
49898///
49899/// ```test_harness,no_run
49900/// # extern crate hyper;
49901/// # extern crate hyper_rustls;
49902/// # extern crate google_displayvideo1 as displayvideo1;
49903/// # async fn dox() {
49904/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
49905///
49906/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
49907/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
49908/// #     secret,
49909/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
49910/// # ).build().await.unwrap();
49911///
49912/// # let client = hyper_util::client::legacy::Client::builder(
49913/// #     hyper_util::rt::TokioExecutor::new()
49914/// # )
49915/// # .build(
49916/// #     hyper_rustls::HttpsConnectorBuilder::new()
49917/// #         .with_native_roots()
49918/// #         .unwrap()
49919/// #         .https_or_http()
49920/// #         .enable_http1()
49921/// #         .build()
49922/// # );
49923/// # let mut hub = DisplayVideo::new(client, auth);
49924/// // You can configure optional parameters by calling the respective setters at will, and
49925/// // execute the final call using `doit()`.
49926/// // Values shown here are possibly random and not representative !
49927/// let result = hub.inventory_source_groups().delete(-5)
49928///              .partner_id(-24)
49929///              .advertiser_id(-94)
49930///              .doit().await;
49931/// # }
49932/// ```
49933pub struct InventorySourceGroupDeleteCall<'a, C>
49934where
49935    C: 'a,
49936{
49937    hub: &'a DisplayVideo<C>,
49938    _inventory_source_group_id: i64,
49939    _partner_id: Option<i64>,
49940    _advertiser_id: Option<i64>,
49941    _delegate: Option<&'a mut dyn common::Delegate>,
49942    _additional_params: HashMap<String, String>,
49943    _scopes: BTreeSet<String>,
49944}
49945
49946impl<'a, C> common::CallBuilder for InventorySourceGroupDeleteCall<'a, C> {}
49947
49948impl<'a, C> InventorySourceGroupDeleteCall<'a, C>
49949where
49950    C: common::Connector,
49951{
49952    /// Perform the operation you have build so far.
49953    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
49954        use std::borrow::Cow;
49955        use std::io::{Read, Seek};
49956
49957        use common::{url::Params, ToParts};
49958        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
49959
49960        let mut dd = common::DefaultDelegate;
49961        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
49962        dlg.begin(common::MethodInfo {
49963            id: "displayvideo.inventorySourceGroups.delete",
49964            http_method: hyper::Method::DELETE,
49965        });
49966
49967        for &field in ["alt", "inventorySourceGroupId", "partnerId", "advertiserId"].iter() {
49968            if self._additional_params.contains_key(field) {
49969                dlg.finished(false);
49970                return Err(common::Error::FieldClash(field));
49971            }
49972        }
49973
49974        let mut params = Params::with_capacity(5 + self._additional_params.len());
49975        params.push(
49976            "inventorySourceGroupId",
49977            self._inventory_source_group_id.to_string(),
49978        );
49979        if let Some(value) = self._partner_id.as_ref() {
49980            params.push("partnerId", value.to_string());
49981        }
49982        if let Some(value) = self._advertiser_id.as_ref() {
49983            params.push("advertiserId", value.to_string());
49984        }
49985
49986        params.extend(self._additional_params.iter());
49987
49988        params.push("alt", "json");
49989        let mut url =
49990            self.hub._base_url.clone() + "v1/inventorySourceGroups/{+inventorySourceGroupId}";
49991        if self._scopes.is_empty() {
49992            self._scopes
49993                .insert(Scope::DisplayVideo.as_ref().to_string());
49994        }
49995
49996        #[allow(clippy::single_element_loop)]
49997        for &(find_this, param_name) in
49998            [("{+inventorySourceGroupId}", "inventorySourceGroupId")].iter()
49999        {
50000            url = params.uri_replacement(url, param_name, find_this, true);
50001        }
50002        {
50003            let to_remove = ["inventorySourceGroupId"];
50004            params.remove_params(&to_remove);
50005        }
50006
50007        let url = params.parse_with_url(&url);
50008
50009        loop {
50010            let token = match self
50011                .hub
50012                .auth
50013                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
50014                .await
50015            {
50016                Ok(token) => token,
50017                Err(e) => match dlg.token(e) {
50018                    Ok(token) => token,
50019                    Err(e) => {
50020                        dlg.finished(false);
50021                        return Err(common::Error::MissingToken(e));
50022                    }
50023                },
50024            };
50025            let mut req_result = {
50026                let client = &self.hub.client;
50027                dlg.pre_request();
50028                let mut req_builder = hyper::Request::builder()
50029                    .method(hyper::Method::DELETE)
50030                    .uri(url.as_str())
50031                    .header(USER_AGENT, self.hub._user_agent.clone());
50032
50033                if let Some(token) = token.as_ref() {
50034                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
50035                }
50036
50037                let request = req_builder
50038                    .header(CONTENT_LENGTH, 0_u64)
50039                    .body(common::to_body::<String>(None));
50040
50041                client.request(request.unwrap()).await
50042            };
50043
50044            match req_result {
50045                Err(err) => {
50046                    if let common::Retry::After(d) = dlg.http_error(&err) {
50047                        sleep(d).await;
50048                        continue;
50049                    }
50050                    dlg.finished(false);
50051                    return Err(common::Error::HttpError(err));
50052                }
50053                Ok(res) => {
50054                    let (mut parts, body) = res.into_parts();
50055                    let mut body = common::Body::new(body);
50056                    if !parts.status.is_success() {
50057                        let bytes = common::to_bytes(body).await.unwrap_or_default();
50058                        let error = serde_json::from_str(&common::to_string(&bytes));
50059                        let response = common::to_response(parts, bytes.into());
50060
50061                        if let common::Retry::After(d) =
50062                            dlg.http_failure(&response, error.as_ref().ok())
50063                        {
50064                            sleep(d).await;
50065                            continue;
50066                        }
50067
50068                        dlg.finished(false);
50069
50070                        return Err(match error {
50071                            Ok(value) => common::Error::BadRequest(value),
50072                            _ => common::Error::Failure(response),
50073                        });
50074                    }
50075                    let response = {
50076                        let bytes = common::to_bytes(body).await.unwrap_or_default();
50077                        let encoded = common::to_string(&bytes);
50078                        match serde_json::from_str(&encoded) {
50079                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
50080                            Err(error) => {
50081                                dlg.response_json_decode_error(&encoded, &error);
50082                                return Err(common::Error::JsonDecodeError(
50083                                    encoded.to_string(),
50084                                    error,
50085                                ));
50086                            }
50087                        }
50088                    };
50089
50090                    dlg.finished(true);
50091                    return Ok(response);
50092                }
50093            }
50094        }
50095    }
50096
50097    /// Required. The ID of the inventory source group to delete.
50098    ///
50099    /// Sets the *inventory source group id* path property to the given value.
50100    ///
50101    /// Even though the property as already been set when instantiating this call,
50102    /// we provide this method for API completeness.
50103    pub fn inventory_source_group_id(
50104        mut self,
50105        new_value: i64,
50106    ) -> InventorySourceGroupDeleteCall<'a, C> {
50107        self._inventory_source_group_id = new_value;
50108        self
50109    }
50110    /// The ID of the partner that owns the inventory source group. Only this partner has write access to this group.
50111    ///
50112    /// Sets the *partner id* query property to the given value.
50113    pub fn partner_id(mut self, new_value: i64) -> InventorySourceGroupDeleteCall<'a, C> {
50114        self._partner_id = Some(new_value);
50115        self
50116    }
50117    /// The ID of the advertiser that owns the inventory source group. The parent partner does not have access to this group.
50118    ///
50119    /// Sets the *advertiser id* query property to the given value.
50120    pub fn advertiser_id(mut self, new_value: i64) -> InventorySourceGroupDeleteCall<'a, C> {
50121        self._advertiser_id = Some(new_value);
50122        self
50123    }
50124    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
50125    /// while executing the actual API request.
50126    ///
50127    /// ````text
50128    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
50129    /// ````
50130    ///
50131    /// Sets the *delegate* property to the given value.
50132    pub fn delegate(
50133        mut self,
50134        new_value: &'a mut dyn common::Delegate,
50135    ) -> InventorySourceGroupDeleteCall<'a, C> {
50136        self._delegate = Some(new_value);
50137        self
50138    }
50139
50140    /// Set any additional parameter of the query string used in the request.
50141    /// It should be used to set parameters which are not yet available through their own
50142    /// setters.
50143    ///
50144    /// Please note that this method must not be used to set any of the known parameters
50145    /// which have their own setter method. If done anyway, the request will fail.
50146    ///
50147    /// # Additional Parameters
50148    ///
50149    /// * *$.xgafv* (query-string) - V1 error format.
50150    /// * *access_token* (query-string) - OAuth access token.
50151    /// * *alt* (query-string) - Data format for response.
50152    /// * *callback* (query-string) - JSONP
50153    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
50154    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
50155    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
50156    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
50157    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
50158    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
50159    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
50160    pub fn param<T>(mut self, name: T, value: T) -> InventorySourceGroupDeleteCall<'a, C>
50161    where
50162        T: AsRef<str>,
50163    {
50164        self._additional_params
50165            .insert(name.as_ref().to_string(), value.as_ref().to_string());
50166        self
50167    }
50168
50169    /// Identifies the authorization scope for the method you are building.
50170    ///
50171    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
50172    /// [`Scope::DisplayVideo`].
50173    ///
50174    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
50175    /// tokens for more than one scope.
50176    ///
50177    /// Usually there is more than one suitable scope to authorize an operation, some of which may
50178    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
50179    /// sufficient, a read-write scope will do as well.
50180    pub fn add_scope<St>(mut self, scope: St) -> InventorySourceGroupDeleteCall<'a, C>
50181    where
50182        St: AsRef<str>,
50183    {
50184        self._scopes.insert(String::from(scope.as_ref()));
50185        self
50186    }
50187    /// Identifies the authorization scope(s) for the method you are building.
50188    ///
50189    /// See [`Self::add_scope()`] for details.
50190    pub fn add_scopes<I, St>(mut self, scopes: I) -> InventorySourceGroupDeleteCall<'a, C>
50191    where
50192        I: IntoIterator<Item = St>,
50193        St: AsRef<str>,
50194    {
50195        self._scopes
50196            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
50197        self
50198    }
50199
50200    /// Removes all scopes, and no default scope will be used either.
50201    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
50202    /// for details).
50203    pub fn clear_scopes(mut self) -> InventorySourceGroupDeleteCall<'a, C> {
50204        self._scopes.clear();
50205        self
50206    }
50207}
50208
50209/// Gets an inventory source group.
50210///
50211/// A builder for the *get* method supported by a *inventorySourceGroup* resource.
50212/// It is not used directly, but through a [`InventorySourceGroupMethods`] instance.
50213///
50214/// # Example
50215///
50216/// Instantiate a resource method builder
50217///
50218/// ```test_harness,no_run
50219/// # extern crate hyper;
50220/// # extern crate hyper_rustls;
50221/// # extern crate google_displayvideo1 as displayvideo1;
50222/// # async fn dox() {
50223/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
50224///
50225/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
50226/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
50227/// #     secret,
50228/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
50229/// # ).build().await.unwrap();
50230///
50231/// # let client = hyper_util::client::legacy::Client::builder(
50232/// #     hyper_util::rt::TokioExecutor::new()
50233/// # )
50234/// # .build(
50235/// #     hyper_rustls::HttpsConnectorBuilder::new()
50236/// #         .with_native_roots()
50237/// #         .unwrap()
50238/// #         .https_or_http()
50239/// #         .enable_http1()
50240/// #         .build()
50241/// # );
50242/// # let mut hub = DisplayVideo::new(client, auth);
50243/// // You can configure optional parameters by calling the respective setters at will, and
50244/// // execute the final call using `doit()`.
50245/// // Values shown here are possibly random and not representative !
50246/// let result = hub.inventory_source_groups().get(-90)
50247///              .partner_id(-4)
50248///              .advertiser_id(-95)
50249///              .doit().await;
50250/// # }
50251/// ```
50252pub struct InventorySourceGroupGetCall<'a, C>
50253where
50254    C: 'a,
50255{
50256    hub: &'a DisplayVideo<C>,
50257    _inventory_source_group_id: i64,
50258    _partner_id: Option<i64>,
50259    _advertiser_id: Option<i64>,
50260    _delegate: Option<&'a mut dyn common::Delegate>,
50261    _additional_params: HashMap<String, String>,
50262    _scopes: BTreeSet<String>,
50263}
50264
50265impl<'a, C> common::CallBuilder for InventorySourceGroupGetCall<'a, C> {}
50266
50267impl<'a, C> InventorySourceGroupGetCall<'a, C>
50268where
50269    C: common::Connector,
50270{
50271    /// Perform the operation you have build so far.
50272    pub async fn doit(mut self) -> common::Result<(common::Response, InventorySourceGroup)> {
50273        use std::borrow::Cow;
50274        use std::io::{Read, Seek};
50275
50276        use common::{url::Params, ToParts};
50277        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
50278
50279        let mut dd = common::DefaultDelegate;
50280        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
50281        dlg.begin(common::MethodInfo {
50282            id: "displayvideo.inventorySourceGroups.get",
50283            http_method: hyper::Method::GET,
50284        });
50285
50286        for &field in ["alt", "inventorySourceGroupId", "partnerId", "advertiserId"].iter() {
50287            if self._additional_params.contains_key(field) {
50288                dlg.finished(false);
50289                return Err(common::Error::FieldClash(field));
50290            }
50291        }
50292
50293        let mut params = Params::with_capacity(5 + self._additional_params.len());
50294        params.push(
50295            "inventorySourceGroupId",
50296            self._inventory_source_group_id.to_string(),
50297        );
50298        if let Some(value) = self._partner_id.as_ref() {
50299            params.push("partnerId", value.to_string());
50300        }
50301        if let Some(value) = self._advertiser_id.as_ref() {
50302            params.push("advertiserId", value.to_string());
50303        }
50304
50305        params.extend(self._additional_params.iter());
50306
50307        params.push("alt", "json");
50308        let mut url =
50309            self.hub._base_url.clone() + "v1/inventorySourceGroups/{+inventorySourceGroupId}";
50310        if self._scopes.is_empty() {
50311            self._scopes
50312                .insert(Scope::DisplayVideo.as_ref().to_string());
50313        }
50314
50315        #[allow(clippy::single_element_loop)]
50316        for &(find_this, param_name) in
50317            [("{+inventorySourceGroupId}", "inventorySourceGroupId")].iter()
50318        {
50319            url = params.uri_replacement(url, param_name, find_this, true);
50320        }
50321        {
50322            let to_remove = ["inventorySourceGroupId"];
50323            params.remove_params(&to_remove);
50324        }
50325
50326        let url = params.parse_with_url(&url);
50327
50328        loop {
50329            let token = match self
50330                .hub
50331                .auth
50332                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
50333                .await
50334            {
50335                Ok(token) => token,
50336                Err(e) => match dlg.token(e) {
50337                    Ok(token) => token,
50338                    Err(e) => {
50339                        dlg.finished(false);
50340                        return Err(common::Error::MissingToken(e));
50341                    }
50342                },
50343            };
50344            let mut req_result = {
50345                let client = &self.hub.client;
50346                dlg.pre_request();
50347                let mut req_builder = hyper::Request::builder()
50348                    .method(hyper::Method::GET)
50349                    .uri(url.as_str())
50350                    .header(USER_AGENT, self.hub._user_agent.clone());
50351
50352                if let Some(token) = token.as_ref() {
50353                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
50354                }
50355
50356                let request = req_builder
50357                    .header(CONTENT_LENGTH, 0_u64)
50358                    .body(common::to_body::<String>(None));
50359
50360                client.request(request.unwrap()).await
50361            };
50362
50363            match req_result {
50364                Err(err) => {
50365                    if let common::Retry::After(d) = dlg.http_error(&err) {
50366                        sleep(d).await;
50367                        continue;
50368                    }
50369                    dlg.finished(false);
50370                    return Err(common::Error::HttpError(err));
50371                }
50372                Ok(res) => {
50373                    let (mut parts, body) = res.into_parts();
50374                    let mut body = common::Body::new(body);
50375                    if !parts.status.is_success() {
50376                        let bytes = common::to_bytes(body).await.unwrap_or_default();
50377                        let error = serde_json::from_str(&common::to_string(&bytes));
50378                        let response = common::to_response(parts, bytes.into());
50379
50380                        if let common::Retry::After(d) =
50381                            dlg.http_failure(&response, error.as_ref().ok())
50382                        {
50383                            sleep(d).await;
50384                            continue;
50385                        }
50386
50387                        dlg.finished(false);
50388
50389                        return Err(match error {
50390                            Ok(value) => common::Error::BadRequest(value),
50391                            _ => common::Error::Failure(response),
50392                        });
50393                    }
50394                    let response = {
50395                        let bytes = common::to_bytes(body).await.unwrap_or_default();
50396                        let encoded = common::to_string(&bytes);
50397                        match serde_json::from_str(&encoded) {
50398                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
50399                            Err(error) => {
50400                                dlg.response_json_decode_error(&encoded, &error);
50401                                return Err(common::Error::JsonDecodeError(
50402                                    encoded.to_string(),
50403                                    error,
50404                                ));
50405                            }
50406                        }
50407                    };
50408
50409                    dlg.finished(true);
50410                    return Ok(response);
50411                }
50412            }
50413        }
50414    }
50415
50416    /// Required. The ID of the inventory source group to fetch.
50417    ///
50418    /// Sets the *inventory source group id* path property to the given value.
50419    ///
50420    /// Even though the property as already been set when instantiating this call,
50421    /// we provide this method for API completeness.
50422    pub fn inventory_source_group_id(
50423        mut self,
50424        new_value: i64,
50425    ) -> InventorySourceGroupGetCall<'a, C> {
50426        self._inventory_source_group_id = new_value;
50427        self
50428    }
50429    /// The ID of the partner that has access to the inventory source group. A partner cannot access an advertiser-owned inventory source group.
50430    ///
50431    /// Sets the *partner id* query property to the given value.
50432    pub fn partner_id(mut self, new_value: i64) -> InventorySourceGroupGetCall<'a, C> {
50433        self._partner_id = Some(new_value);
50434        self
50435    }
50436    /// The ID of the advertiser that has access to the inventory source group. If an inventory source group is partner-owned, only advertisers to which the group is explicitly shared can access the group.
50437    ///
50438    /// Sets the *advertiser id* query property to the given value.
50439    pub fn advertiser_id(mut self, new_value: i64) -> InventorySourceGroupGetCall<'a, C> {
50440        self._advertiser_id = Some(new_value);
50441        self
50442    }
50443    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
50444    /// while executing the actual API request.
50445    ///
50446    /// ````text
50447    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
50448    /// ````
50449    ///
50450    /// Sets the *delegate* property to the given value.
50451    pub fn delegate(
50452        mut self,
50453        new_value: &'a mut dyn common::Delegate,
50454    ) -> InventorySourceGroupGetCall<'a, C> {
50455        self._delegate = Some(new_value);
50456        self
50457    }
50458
50459    /// Set any additional parameter of the query string used in the request.
50460    /// It should be used to set parameters which are not yet available through their own
50461    /// setters.
50462    ///
50463    /// Please note that this method must not be used to set any of the known parameters
50464    /// which have their own setter method. If done anyway, the request will fail.
50465    ///
50466    /// # Additional Parameters
50467    ///
50468    /// * *$.xgafv* (query-string) - V1 error format.
50469    /// * *access_token* (query-string) - OAuth access token.
50470    /// * *alt* (query-string) - Data format for response.
50471    /// * *callback* (query-string) - JSONP
50472    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
50473    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
50474    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
50475    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
50476    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
50477    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
50478    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
50479    pub fn param<T>(mut self, name: T, value: T) -> InventorySourceGroupGetCall<'a, C>
50480    where
50481        T: AsRef<str>,
50482    {
50483        self._additional_params
50484            .insert(name.as_ref().to_string(), value.as_ref().to_string());
50485        self
50486    }
50487
50488    /// Identifies the authorization scope for the method you are building.
50489    ///
50490    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
50491    /// [`Scope::DisplayVideo`].
50492    ///
50493    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
50494    /// tokens for more than one scope.
50495    ///
50496    /// Usually there is more than one suitable scope to authorize an operation, some of which may
50497    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
50498    /// sufficient, a read-write scope will do as well.
50499    pub fn add_scope<St>(mut self, scope: St) -> InventorySourceGroupGetCall<'a, C>
50500    where
50501        St: AsRef<str>,
50502    {
50503        self._scopes.insert(String::from(scope.as_ref()));
50504        self
50505    }
50506    /// Identifies the authorization scope(s) for the method you are building.
50507    ///
50508    /// See [`Self::add_scope()`] for details.
50509    pub fn add_scopes<I, St>(mut self, scopes: I) -> InventorySourceGroupGetCall<'a, C>
50510    where
50511        I: IntoIterator<Item = St>,
50512        St: AsRef<str>,
50513    {
50514        self._scopes
50515            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
50516        self
50517    }
50518
50519    /// Removes all scopes, and no default scope will be used either.
50520    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
50521    /// for details).
50522    pub fn clear_scopes(mut self) -> InventorySourceGroupGetCall<'a, C> {
50523        self._scopes.clear();
50524        self
50525    }
50526}
50527
50528/// Lists inventory source groups that are accessible to the current user. The order is defined by the order_by parameter.
50529///
50530/// A builder for the *list* method supported by a *inventorySourceGroup* resource.
50531/// It is not used directly, but through a [`InventorySourceGroupMethods`] instance.
50532///
50533/// # Example
50534///
50535/// Instantiate a resource method builder
50536///
50537/// ```test_harness,no_run
50538/// # extern crate hyper;
50539/// # extern crate hyper_rustls;
50540/// # extern crate google_displayvideo1 as displayvideo1;
50541/// # async fn dox() {
50542/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
50543///
50544/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
50545/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
50546/// #     secret,
50547/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
50548/// # ).build().await.unwrap();
50549///
50550/// # let client = hyper_util::client::legacy::Client::builder(
50551/// #     hyper_util::rt::TokioExecutor::new()
50552/// # )
50553/// # .build(
50554/// #     hyper_rustls::HttpsConnectorBuilder::new()
50555/// #         .with_native_roots()
50556/// #         .unwrap()
50557/// #         .https_or_http()
50558/// #         .enable_http1()
50559/// #         .build()
50560/// # );
50561/// # let mut hub = DisplayVideo::new(client, auth);
50562/// // You can configure optional parameters by calling the respective setters at will, and
50563/// // execute the final call using `doit()`.
50564/// // Values shown here are possibly random and not representative !
50565/// let result = hub.inventory_source_groups().list()
50566///              .partner_id(-4)
50567///              .page_token("dolor")
50568///              .page_size(-46)
50569///              .order_by("et")
50570///              .filter("sit")
50571///              .advertiser_id(-51)
50572///              .doit().await;
50573/// # }
50574/// ```
50575pub struct InventorySourceGroupListCall<'a, C>
50576where
50577    C: 'a,
50578{
50579    hub: &'a DisplayVideo<C>,
50580    _partner_id: Option<i64>,
50581    _page_token: Option<String>,
50582    _page_size: Option<i32>,
50583    _order_by: Option<String>,
50584    _filter: Option<String>,
50585    _advertiser_id: Option<i64>,
50586    _delegate: Option<&'a mut dyn common::Delegate>,
50587    _additional_params: HashMap<String, String>,
50588    _scopes: BTreeSet<String>,
50589}
50590
50591impl<'a, C> common::CallBuilder for InventorySourceGroupListCall<'a, C> {}
50592
50593impl<'a, C> InventorySourceGroupListCall<'a, C>
50594where
50595    C: common::Connector,
50596{
50597    /// Perform the operation you have build so far.
50598    pub async fn doit(
50599        mut self,
50600    ) -> common::Result<(common::Response, ListInventorySourceGroupsResponse)> {
50601        use std::borrow::Cow;
50602        use std::io::{Read, Seek};
50603
50604        use common::{url::Params, ToParts};
50605        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
50606
50607        let mut dd = common::DefaultDelegate;
50608        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
50609        dlg.begin(common::MethodInfo {
50610            id: "displayvideo.inventorySourceGroups.list",
50611            http_method: hyper::Method::GET,
50612        });
50613
50614        for &field in [
50615            "alt",
50616            "partnerId",
50617            "pageToken",
50618            "pageSize",
50619            "orderBy",
50620            "filter",
50621            "advertiserId",
50622        ]
50623        .iter()
50624        {
50625            if self._additional_params.contains_key(field) {
50626                dlg.finished(false);
50627                return Err(common::Error::FieldClash(field));
50628            }
50629        }
50630
50631        let mut params = Params::with_capacity(8 + self._additional_params.len());
50632        if let Some(value) = self._partner_id.as_ref() {
50633            params.push("partnerId", value.to_string());
50634        }
50635        if let Some(value) = self._page_token.as_ref() {
50636            params.push("pageToken", value);
50637        }
50638        if let Some(value) = self._page_size.as_ref() {
50639            params.push("pageSize", value.to_string());
50640        }
50641        if let Some(value) = self._order_by.as_ref() {
50642            params.push("orderBy", value);
50643        }
50644        if let Some(value) = self._filter.as_ref() {
50645            params.push("filter", value);
50646        }
50647        if let Some(value) = self._advertiser_id.as_ref() {
50648            params.push("advertiserId", value.to_string());
50649        }
50650
50651        params.extend(self._additional_params.iter());
50652
50653        params.push("alt", "json");
50654        let mut url = self.hub._base_url.clone() + "v1/inventorySourceGroups";
50655        if self._scopes.is_empty() {
50656            self._scopes
50657                .insert(Scope::DisplayVideo.as_ref().to_string());
50658        }
50659
50660        let url = params.parse_with_url(&url);
50661
50662        loop {
50663            let token = match self
50664                .hub
50665                .auth
50666                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
50667                .await
50668            {
50669                Ok(token) => token,
50670                Err(e) => match dlg.token(e) {
50671                    Ok(token) => token,
50672                    Err(e) => {
50673                        dlg.finished(false);
50674                        return Err(common::Error::MissingToken(e));
50675                    }
50676                },
50677            };
50678            let mut req_result = {
50679                let client = &self.hub.client;
50680                dlg.pre_request();
50681                let mut req_builder = hyper::Request::builder()
50682                    .method(hyper::Method::GET)
50683                    .uri(url.as_str())
50684                    .header(USER_AGENT, self.hub._user_agent.clone());
50685
50686                if let Some(token) = token.as_ref() {
50687                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
50688                }
50689
50690                let request = req_builder
50691                    .header(CONTENT_LENGTH, 0_u64)
50692                    .body(common::to_body::<String>(None));
50693
50694                client.request(request.unwrap()).await
50695            };
50696
50697            match req_result {
50698                Err(err) => {
50699                    if let common::Retry::After(d) = dlg.http_error(&err) {
50700                        sleep(d).await;
50701                        continue;
50702                    }
50703                    dlg.finished(false);
50704                    return Err(common::Error::HttpError(err));
50705                }
50706                Ok(res) => {
50707                    let (mut parts, body) = res.into_parts();
50708                    let mut body = common::Body::new(body);
50709                    if !parts.status.is_success() {
50710                        let bytes = common::to_bytes(body).await.unwrap_or_default();
50711                        let error = serde_json::from_str(&common::to_string(&bytes));
50712                        let response = common::to_response(parts, bytes.into());
50713
50714                        if let common::Retry::After(d) =
50715                            dlg.http_failure(&response, error.as_ref().ok())
50716                        {
50717                            sleep(d).await;
50718                            continue;
50719                        }
50720
50721                        dlg.finished(false);
50722
50723                        return Err(match error {
50724                            Ok(value) => common::Error::BadRequest(value),
50725                            _ => common::Error::Failure(response),
50726                        });
50727                    }
50728                    let response = {
50729                        let bytes = common::to_bytes(body).await.unwrap_or_default();
50730                        let encoded = common::to_string(&bytes);
50731                        match serde_json::from_str(&encoded) {
50732                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
50733                            Err(error) => {
50734                                dlg.response_json_decode_error(&encoded, &error);
50735                                return Err(common::Error::JsonDecodeError(
50736                                    encoded.to_string(),
50737                                    error,
50738                                ));
50739                            }
50740                        }
50741                    };
50742
50743                    dlg.finished(true);
50744                    return Ok(response);
50745                }
50746            }
50747        }
50748    }
50749
50750    /// The ID of the partner that has access to the inventory source group. A partner cannot access advertiser-owned inventory source groups.
50751    ///
50752    /// Sets the *partner id* query property to the given value.
50753    pub fn partner_id(mut self, new_value: i64) -> InventorySourceGroupListCall<'a, C> {
50754        self._partner_id = Some(new_value);
50755        self
50756    }
50757    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListInventorySources` method. If not specified, the first page of results will be returned.
50758    ///
50759    /// Sets the *page token* query property to the given value.
50760    pub fn page_token(mut self, new_value: &str) -> InventorySourceGroupListCall<'a, C> {
50761        self._page_token = Some(new_value.to_string());
50762        self
50763    }
50764    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`.
50765    ///
50766    /// Sets the *page size* query property to the given value.
50767    pub fn page_size(mut self, new_value: i32) -> InventorySourceGroupListCall<'a, C> {
50768        self._page_size = Some(new_value);
50769        self
50770    }
50771    /// Field by which to sort the list. Acceptable values are: * `displayName` (default) * `inventorySourceGroupId` The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. For example, `displayName desc`.
50772    ///
50773    /// Sets the *order by* query property to the given value.
50774    pub fn order_by(mut self, new_value: &str) -> InventorySourceGroupListCall<'a, C> {
50775        self._order_by = Some(new_value.to_string());
50776        self
50777    }
50778    /// Allows filtering by inventory source group fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by the logical operator `OR`. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `EQUALS (=)` operator. Supported fields: * `inventorySourceGroupId` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
50779    ///
50780    /// Sets the *filter* query property to the given value.
50781    pub fn filter(mut self, new_value: &str) -> InventorySourceGroupListCall<'a, C> {
50782        self._filter = Some(new_value.to_string());
50783        self
50784    }
50785    /// The ID of the advertiser that has access to the inventory source group. If an inventory source group is partner-owned, only advertisers to which the group is explicitly shared can access the group.
50786    ///
50787    /// Sets the *advertiser id* query property to the given value.
50788    pub fn advertiser_id(mut self, new_value: i64) -> InventorySourceGroupListCall<'a, C> {
50789        self._advertiser_id = Some(new_value);
50790        self
50791    }
50792    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
50793    /// while executing the actual API request.
50794    ///
50795    /// ````text
50796    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
50797    /// ````
50798    ///
50799    /// Sets the *delegate* property to the given value.
50800    pub fn delegate(
50801        mut self,
50802        new_value: &'a mut dyn common::Delegate,
50803    ) -> InventorySourceGroupListCall<'a, C> {
50804        self._delegate = Some(new_value);
50805        self
50806    }
50807
50808    /// Set any additional parameter of the query string used in the request.
50809    /// It should be used to set parameters which are not yet available through their own
50810    /// setters.
50811    ///
50812    /// Please note that this method must not be used to set any of the known parameters
50813    /// which have their own setter method. If done anyway, the request will fail.
50814    ///
50815    /// # Additional Parameters
50816    ///
50817    /// * *$.xgafv* (query-string) - V1 error format.
50818    /// * *access_token* (query-string) - OAuth access token.
50819    /// * *alt* (query-string) - Data format for response.
50820    /// * *callback* (query-string) - JSONP
50821    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
50822    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
50823    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
50824    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
50825    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
50826    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
50827    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
50828    pub fn param<T>(mut self, name: T, value: T) -> InventorySourceGroupListCall<'a, C>
50829    where
50830        T: AsRef<str>,
50831    {
50832        self._additional_params
50833            .insert(name.as_ref().to_string(), value.as_ref().to_string());
50834        self
50835    }
50836
50837    /// Identifies the authorization scope for the method you are building.
50838    ///
50839    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
50840    /// [`Scope::DisplayVideo`].
50841    ///
50842    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
50843    /// tokens for more than one scope.
50844    ///
50845    /// Usually there is more than one suitable scope to authorize an operation, some of which may
50846    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
50847    /// sufficient, a read-write scope will do as well.
50848    pub fn add_scope<St>(mut self, scope: St) -> InventorySourceGroupListCall<'a, C>
50849    where
50850        St: AsRef<str>,
50851    {
50852        self._scopes.insert(String::from(scope.as_ref()));
50853        self
50854    }
50855    /// Identifies the authorization scope(s) for the method you are building.
50856    ///
50857    /// See [`Self::add_scope()`] for details.
50858    pub fn add_scopes<I, St>(mut self, scopes: I) -> InventorySourceGroupListCall<'a, C>
50859    where
50860        I: IntoIterator<Item = St>,
50861        St: AsRef<str>,
50862    {
50863        self._scopes
50864            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
50865        self
50866    }
50867
50868    /// Removes all scopes, and no default scope will be used either.
50869    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
50870    /// for details).
50871    pub fn clear_scopes(mut self) -> InventorySourceGroupListCall<'a, C> {
50872        self._scopes.clear();
50873        self
50874    }
50875}
50876
50877/// Updates an inventory source group. Returns the updated inventory source group if successful.
50878///
50879/// A builder for the *patch* method supported by a *inventorySourceGroup* resource.
50880/// It is not used directly, but through a [`InventorySourceGroupMethods`] instance.
50881///
50882/// # Example
50883///
50884/// Instantiate a resource method builder
50885///
50886/// ```test_harness,no_run
50887/// # extern crate hyper;
50888/// # extern crate hyper_rustls;
50889/// # extern crate google_displayvideo1 as displayvideo1;
50890/// use displayvideo1::api::InventorySourceGroup;
50891/// # async fn dox() {
50892/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
50893///
50894/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
50895/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
50896/// #     secret,
50897/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
50898/// # ).build().await.unwrap();
50899///
50900/// # let client = hyper_util::client::legacy::Client::builder(
50901/// #     hyper_util::rt::TokioExecutor::new()
50902/// # )
50903/// # .build(
50904/// #     hyper_rustls::HttpsConnectorBuilder::new()
50905/// #         .with_native_roots()
50906/// #         .unwrap()
50907/// #         .https_or_http()
50908/// #         .enable_http1()
50909/// #         .build()
50910/// # );
50911/// # let mut hub = DisplayVideo::new(client, auth);
50912/// // As the method needs a request, you would usually fill it with the desired information
50913/// // into the respective structure. Some of the parts shown here might not be applicable !
50914/// // Values shown here are possibly random and not representative !
50915/// let mut req = InventorySourceGroup::default();
50916///
50917/// // You can configure optional parameters by calling the respective setters at will, and
50918/// // execute the final call using `doit()`.
50919/// // Values shown here are possibly random and not representative !
50920/// let result = hub.inventory_source_groups().patch(req, -41)
50921///              .update_mask(FieldMask::new::<&str>(&[]))
50922///              .partner_id(-79)
50923///              .advertiser_id(-100)
50924///              .doit().await;
50925/// # }
50926/// ```
50927pub struct InventorySourceGroupPatchCall<'a, C>
50928where
50929    C: 'a,
50930{
50931    hub: &'a DisplayVideo<C>,
50932    _request: InventorySourceGroup,
50933    _inventory_source_group_id: i64,
50934    _update_mask: Option<common::FieldMask>,
50935    _partner_id: Option<i64>,
50936    _advertiser_id: Option<i64>,
50937    _delegate: Option<&'a mut dyn common::Delegate>,
50938    _additional_params: HashMap<String, String>,
50939    _scopes: BTreeSet<String>,
50940}
50941
50942impl<'a, C> common::CallBuilder for InventorySourceGroupPatchCall<'a, C> {}
50943
50944impl<'a, C> InventorySourceGroupPatchCall<'a, C>
50945where
50946    C: common::Connector,
50947{
50948    /// Perform the operation you have build so far.
50949    pub async fn doit(mut self) -> common::Result<(common::Response, InventorySourceGroup)> {
50950        use std::borrow::Cow;
50951        use std::io::{Read, Seek};
50952
50953        use common::{url::Params, ToParts};
50954        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
50955
50956        let mut dd = common::DefaultDelegate;
50957        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
50958        dlg.begin(common::MethodInfo {
50959            id: "displayvideo.inventorySourceGroups.patch",
50960            http_method: hyper::Method::PATCH,
50961        });
50962
50963        for &field in [
50964            "alt",
50965            "inventorySourceGroupId",
50966            "updateMask",
50967            "partnerId",
50968            "advertiserId",
50969        ]
50970        .iter()
50971        {
50972            if self._additional_params.contains_key(field) {
50973                dlg.finished(false);
50974                return Err(common::Error::FieldClash(field));
50975            }
50976        }
50977
50978        let mut params = Params::with_capacity(7 + self._additional_params.len());
50979        params.push(
50980            "inventorySourceGroupId",
50981            self._inventory_source_group_id.to_string(),
50982        );
50983        if let Some(value) = self._update_mask.as_ref() {
50984            params.push("updateMask", value.to_string());
50985        }
50986        if let Some(value) = self._partner_id.as_ref() {
50987            params.push("partnerId", value.to_string());
50988        }
50989        if let Some(value) = self._advertiser_id.as_ref() {
50990            params.push("advertiserId", value.to_string());
50991        }
50992
50993        params.extend(self._additional_params.iter());
50994
50995        params.push("alt", "json");
50996        let mut url =
50997            self.hub._base_url.clone() + "v1/inventorySourceGroups/{inventorySourceGroupId}";
50998        if self._scopes.is_empty() {
50999            self._scopes
51000                .insert(Scope::DisplayVideo.as_ref().to_string());
51001        }
51002
51003        #[allow(clippy::single_element_loop)]
51004        for &(find_this, param_name) in
51005            [("{inventorySourceGroupId}", "inventorySourceGroupId")].iter()
51006        {
51007            url = params.uri_replacement(url, param_name, find_this, false);
51008        }
51009        {
51010            let to_remove = ["inventorySourceGroupId"];
51011            params.remove_params(&to_remove);
51012        }
51013
51014        let url = params.parse_with_url(&url);
51015
51016        let mut json_mime_type = mime::APPLICATION_JSON;
51017        let mut request_value_reader = {
51018            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
51019            common::remove_json_null_values(&mut value);
51020            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
51021            serde_json::to_writer(&mut dst, &value).unwrap();
51022            dst
51023        };
51024        let request_size = request_value_reader
51025            .seek(std::io::SeekFrom::End(0))
51026            .unwrap();
51027        request_value_reader
51028            .seek(std::io::SeekFrom::Start(0))
51029            .unwrap();
51030
51031        loop {
51032            let token = match self
51033                .hub
51034                .auth
51035                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
51036                .await
51037            {
51038                Ok(token) => token,
51039                Err(e) => match dlg.token(e) {
51040                    Ok(token) => token,
51041                    Err(e) => {
51042                        dlg.finished(false);
51043                        return Err(common::Error::MissingToken(e));
51044                    }
51045                },
51046            };
51047            request_value_reader
51048                .seek(std::io::SeekFrom::Start(0))
51049                .unwrap();
51050            let mut req_result = {
51051                let client = &self.hub.client;
51052                dlg.pre_request();
51053                let mut req_builder = hyper::Request::builder()
51054                    .method(hyper::Method::PATCH)
51055                    .uri(url.as_str())
51056                    .header(USER_AGENT, self.hub._user_agent.clone());
51057
51058                if let Some(token) = token.as_ref() {
51059                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
51060                }
51061
51062                let request = req_builder
51063                    .header(CONTENT_TYPE, json_mime_type.to_string())
51064                    .header(CONTENT_LENGTH, request_size as u64)
51065                    .body(common::to_body(
51066                        request_value_reader.get_ref().clone().into(),
51067                    ));
51068
51069                client.request(request.unwrap()).await
51070            };
51071
51072            match req_result {
51073                Err(err) => {
51074                    if let common::Retry::After(d) = dlg.http_error(&err) {
51075                        sleep(d).await;
51076                        continue;
51077                    }
51078                    dlg.finished(false);
51079                    return Err(common::Error::HttpError(err));
51080                }
51081                Ok(res) => {
51082                    let (mut parts, body) = res.into_parts();
51083                    let mut body = common::Body::new(body);
51084                    if !parts.status.is_success() {
51085                        let bytes = common::to_bytes(body).await.unwrap_or_default();
51086                        let error = serde_json::from_str(&common::to_string(&bytes));
51087                        let response = common::to_response(parts, bytes.into());
51088
51089                        if let common::Retry::After(d) =
51090                            dlg.http_failure(&response, error.as_ref().ok())
51091                        {
51092                            sleep(d).await;
51093                            continue;
51094                        }
51095
51096                        dlg.finished(false);
51097
51098                        return Err(match error {
51099                            Ok(value) => common::Error::BadRequest(value),
51100                            _ => common::Error::Failure(response),
51101                        });
51102                    }
51103                    let response = {
51104                        let bytes = common::to_bytes(body).await.unwrap_or_default();
51105                        let encoded = common::to_string(&bytes);
51106                        match serde_json::from_str(&encoded) {
51107                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
51108                            Err(error) => {
51109                                dlg.response_json_decode_error(&encoded, &error);
51110                                return Err(common::Error::JsonDecodeError(
51111                                    encoded.to_string(),
51112                                    error,
51113                                ));
51114                            }
51115                        }
51116                    };
51117
51118                    dlg.finished(true);
51119                    return Ok(response);
51120                }
51121            }
51122        }
51123    }
51124
51125    ///
51126    /// Sets the *request* property to the given value.
51127    ///
51128    /// Even though the property as already been set when instantiating this call,
51129    /// we provide this method for API completeness.
51130    pub fn request(
51131        mut self,
51132        new_value: InventorySourceGroup,
51133    ) -> InventorySourceGroupPatchCall<'a, C> {
51134        self._request = new_value;
51135        self
51136    }
51137    /// Output only. The unique ID of the inventory source group. Assigned by the system.
51138    ///
51139    /// Sets the *inventory source group id* path property to the given value.
51140    ///
51141    /// Even though the property as already been set when instantiating this call,
51142    /// we provide this method for API completeness.
51143    pub fn inventory_source_group_id(
51144        mut self,
51145        new_value: i64,
51146    ) -> InventorySourceGroupPatchCall<'a, C> {
51147        self._inventory_source_group_id = new_value;
51148        self
51149    }
51150    /// Required. The mask to control which fields to update.
51151    ///
51152    /// Sets the *update mask* query property to the given value.
51153    pub fn update_mask(
51154        mut self,
51155        new_value: common::FieldMask,
51156    ) -> InventorySourceGroupPatchCall<'a, C> {
51157        self._update_mask = Some(new_value);
51158        self
51159    }
51160    /// The ID of the partner that owns the inventory source group. Only this partner has write access to this group.
51161    ///
51162    /// Sets the *partner id* query property to the given value.
51163    pub fn partner_id(mut self, new_value: i64) -> InventorySourceGroupPatchCall<'a, C> {
51164        self._partner_id = Some(new_value);
51165        self
51166    }
51167    /// The ID of the advertiser that owns the inventory source group. The parent partner does not have access to this group.
51168    ///
51169    /// Sets the *advertiser id* query property to the given value.
51170    pub fn advertiser_id(mut self, new_value: i64) -> InventorySourceGroupPatchCall<'a, C> {
51171        self._advertiser_id = Some(new_value);
51172        self
51173    }
51174    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
51175    /// while executing the actual API request.
51176    ///
51177    /// ````text
51178    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
51179    /// ````
51180    ///
51181    /// Sets the *delegate* property to the given value.
51182    pub fn delegate(
51183        mut self,
51184        new_value: &'a mut dyn common::Delegate,
51185    ) -> InventorySourceGroupPatchCall<'a, C> {
51186        self._delegate = Some(new_value);
51187        self
51188    }
51189
51190    /// Set any additional parameter of the query string used in the request.
51191    /// It should be used to set parameters which are not yet available through their own
51192    /// setters.
51193    ///
51194    /// Please note that this method must not be used to set any of the known parameters
51195    /// which have their own setter method. If done anyway, the request will fail.
51196    ///
51197    /// # Additional Parameters
51198    ///
51199    /// * *$.xgafv* (query-string) - V1 error format.
51200    /// * *access_token* (query-string) - OAuth access token.
51201    /// * *alt* (query-string) - Data format for response.
51202    /// * *callback* (query-string) - JSONP
51203    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
51204    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
51205    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
51206    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
51207    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
51208    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
51209    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
51210    pub fn param<T>(mut self, name: T, value: T) -> InventorySourceGroupPatchCall<'a, C>
51211    where
51212        T: AsRef<str>,
51213    {
51214        self._additional_params
51215            .insert(name.as_ref().to_string(), value.as_ref().to_string());
51216        self
51217    }
51218
51219    /// Identifies the authorization scope for the method you are building.
51220    ///
51221    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
51222    /// [`Scope::DisplayVideo`].
51223    ///
51224    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
51225    /// tokens for more than one scope.
51226    ///
51227    /// Usually there is more than one suitable scope to authorize an operation, some of which may
51228    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
51229    /// sufficient, a read-write scope will do as well.
51230    pub fn add_scope<St>(mut self, scope: St) -> InventorySourceGroupPatchCall<'a, C>
51231    where
51232        St: AsRef<str>,
51233    {
51234        self._scopes.insert(String::from(scope.as_ref()));
51235        self
51236    }
51237    /// Identifies the authorization scope(s) for the method you are building.
51238    ///
51239    /// See [`Self::add_scope()`] for details.
51240    pub fn add_scopes<I, St>(mut self, scopes: I) -> InventorySourceGroupPatchCall<'a, C>
51241    where
51242        I: IntoIterator<Item = St>,
51243        St: AsRef<str>,
51244    {
51245        self._scopes
51246            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
51247        self
51248    }
51249
51250    /// Removes all scopes, and no default scope will be used either.
51251    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
51252    /// for details).
51253    pub fn clear_scopes(mut self) -> InventorySourceGroupPatchCall<'a, C> {
51254        self._scopes.clear();
51255        self
51256    }
51257}
51258
51259/// Creates a new inventory source. Returns the newly created inventory source if successful.
51260///
51261/// A builder for the *create* method supported by a *inventorySource* resource.
51262/// It is not used directly, but through a [`InventorySourceMethods`] instance.
51263///
51264/// # Example
51265///
51266/// Instantiate a resource method builder
51267///
51268/// ```test_harness,no_run
51269/// # extern crate hyper;
51270/// # extern crate hyper_rustls;
51271/// # extern crate google_displayvideo1 as displayvideo1;
51272/// use displayvideo1::api::InventorySource;
51273/// # async fn dox() {
51274/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
51275///
51276/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
51277/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
51278/// #     secret,
51279/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
51280/// # ).build().await.unwrap();
51281///
51282/// # let client = hyper_util::client::legacy::Client::builder(
51283/// #     hyper_util::rt::TokioExecutor::new()
51284/// # )
51285/// # .build(
51286/// #     hyper_rustls::HttpsConnectorBuilder::new()
51287/// #         .with_native_roots()
51288/// #         .unwrap()
51289/// #         .https_or_http()
51290/// #         .enable_http1()
51291/// #         .build()
51292/// # );
51293/// # let mut hub = DisplayVideo::new(client, auth);
51294/// // As the method needs a request, you would usually fill it with the desired information
51295/// // into the respective structure. Some of the parts shown here might not be applicable !
51296/// // Values shown here are possibly random and not representative !
51297/// let mut req = InventorySource::default();
51298///
51299/// // You can configure optional parameters by calling the respective setters at will, and
51300/// // execute the final call using `doit()`.
51301/// // Values shown here are possibly random and not representative !
51302/// let result = hub.inventory_sources().create(req)
51303///              .partner_id(-38)
51304///              .advertiser_id(-15)
51305///              .doit().await;
51306/// # }
51307/// ```
51308pub struct InventorySourceCreateCall<'a, C>
51309where
51310    C: 'a,
51311{
51312    hub: &'a DisplayVideo<C>,
51313    _request: InventorySource,
51314    _partner_id: Option<i64>,
51315    _advertiser_id: Option<i64>,
51316    _delegate: Option<&'a mut dyn common::Delegate>,
51317    _additional_params: HashMap<String, String>,
51318    _scopes: BTreeSet<String>,
51319}
51320
51321impl<'a, C> common::CallBuilder for InventorySourceCreateCall<'a, C> {}
51322
51323impl<'a, C> InventorySourceCreateCall<'a, C>
51324where
51325    C: common::Connector,
51326{
51327    /// Perform the operation you have build so far.
51328    pub async fn doit(mut self) -> common::Result<(common::Response, InventorySource)> {
51329        use std::borrow::Cow;
51330        use std::io::{Read, Seek};
51331
51332        use common::{url::Params, ToParts};
51333        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
51334
51335        let mut dd = common::DefaultDelegate;
51336        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
51337        dlg.begin(common::MethodInfo {
51338            id: "displayvideo.inventorySources.create",
51339            http_method: hyper::Method::POST,
51340        });
51341
51342        for &field in ["alt", "partnerId", "advertiserId"].iter() {
51343            if self._additional_params.contains_key(field) {
51344                dlg.finished(false);
51345                return Err(common::Error::FieldClash(field));
51346            }
51347        }
51348
51349        let mut params = Params::with_capacity(5 + self._additional_params.len());
51350        if let Some(value) = self._partner_id.as_ref() {
51351            params.push("partnerId", value.to_string());
51352        }
51353        if let Some(value) = self._advertiser_id.as_ref() {
51354            params.push("advertiserId", value.to_string());
51355        }
51356
51357        params.extend(self._additional_params.iter());
51358
51359        params.push("alt", "json");
51360        let mut url = self.hub._base_url.clone() + "v1/inventorySources";
51361        if self._scopes.is_empty() {
51362            self._scopes
51363                .insert(Scope::DisplayVideo.as_ref().to_string());
51364        }
51365
51366        let url = params.parse_with_url(&url);
51367
51368        let mut json_mime_type = mime::APPLICATION_JSON;
51369        let mut request_value_reader = {
51370            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
51371            common::remove_json_null_values(&mut value);
51372            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
51373            serde_json::to_writer(&mut dst, &value).unwrap();
51374            dst
51375        };
51376        let request_size = request_value_reader
51377            .seek(std::io::SeekFrom::End(0))
51378            .unwrap();
51379        request_value_reader
51380            .seek(std::io::SeekFrom::Start(0))
51381            .unwrap();
51382
51383        loop {
51384            let token = match self
51385                .hub
51386                .auth
51387                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
51388                .await
51389            {
51390                Ok(token) => token,
51391                Err(e) => match dlg.token(e) {
51392                    Ok(token) => token,
51393                    Err(e) => {
51394                        dlg.finished(false);
51395                        return Err(common::Error::MissingToken(e));
51396                    }
51397                },
51398            };
51399            request_value_reader
51400                .seek(std::io::SeekFrom::Start(0))
51401                .unwrap();
51402            let mut req_result = {
51403                let client = &self.hub.client;
51404                dlg.pre_request();
51405                let mut req_builder = hyper::Request::builder()
51406                    .method(hyper::Method::POST)
51407                    .uri(url.as_str())
51408                    .header(USER_AGENT, self.hub._user_agent.clone());
51409
51410                if let Some(token) = token.as_ref() {
51411                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
51412                }
51413
51414                let request = req_builder
51415                    .header(CONTENT_TYPE, json_mime_type.to_string())
51416                    .header(CONTENT_LENGTH, request_size as u64)
51417                    .body(common::to_body(
51418                        request_value_reader.get_ref().clone().into(),
51419                    ));
51420
51421                client.request(request.unwrap()).await
51422            };
51423
51424            match req_result {
51425                Err(err) => {
51426                    if let common::Retry::After(d) = dlg.http_error(&err) {
51427                        sleep(d).await;
51428                        continue;
51429                    }
51430                    dlg.finished(false);
51431                    return Err(common::Error::HttpError(err));
51432                }
51433                Ok(res) => {
51434                    let (mut parts, body) = res.into_parts();
51435                    let mut body = common::Body::new(body);
51436                    if !parts.status.is_success() {
51437                        let bytes = common::to_bytes(body).await.unwrap_or_default();
51438                        let error = serde_json::from_str(&common::to_string(&bytes));
51439                        let response = common::to_response(parts, bytes.into());
51440
51441                        if let common::Retry::After(d) =
51442                            dlg.http_failure(&response, error.as_ref().ok())
51443                        {
51444                            sleep(d).await;
51445                            continue;
51446                        }
51447
51448                        dlg.finished(false);
51449
51450                        return Err(match error {
51451                            Ok(value) => common::Error::BadRequest(value),
51452                            _ => common::Error::Failure(response),
51453                        });
51454                    }
51455                    let response = {
51456                        let bytes = common::to_bytes(body).await.unwrap_or_default();
51457                        let encoded = common::to_string(&bytes);
51458                        match serde_json::from_str(&encoded) {
51459                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
51460                            Err(error) => {
51461                                dlg.response_json_decode_error(&encoded, &error);
51462                                return Err(common::Error::JsonDecodeError(
51463                                    encoded.to_string(),
51464                                    error,
51465                                ));
51466                            }
51467                        }
51468                    };
51469
51470                    dlg.finished(true);
51471                    return Ok(response);
51472                }
51473            }
51474        }
51475    }
51476
51477    ///
51478    /// Sets the *request* property to the given value.
51479    ///
51480    /// Even though the property as already been set when instantiating this call,
51481    /// we provide this method for API completeness.
51482    pub fn request(mut self, new_value: InventorySource) -> InventorySourceCreateCall<'a, C> {
51483        self._request = new_value;
51484        self
51485    }
51486    /// The ID of the partner that the request is being made within.
51487    ///
51488    /// Sets the *partner id* query property to the given value.
51489    pub fn partner_id(mut self, new_value: i64) -> InventorySourceCreateCall<'a, C> {
51490        self._partner_id = Some(new_value);
51491        self
51492    }
51493    /// The ID of the advertiser that the request is being made within.
51494    ///
51495    /// Sets the *advertiser id* query property to the given value.
51496    pub fn advertiser_id(mut self, new_value: i64) -> InventorySourceCreateCall<'a, C> {
51497        self._advertiser_id = Some(new_value);
51498        self
51499    }
51500    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
51501    /// while executing the actual API request.
51502    ///
51503    /// ````text
51504    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
51505    /// ````
51506    ///
51507    /// Sets the *delegate* property to the given value.
51508    pub fn delegate(
51509        mut self,
51510        new_value: &'a mut dyn common::Delegate,
51511    ) -> InventorySourceCreateCall<'a, C> {
51512        self._delegate = Some(new_value);
51513        self
51514    }
51515
51516    /// Set any additional parameter of the query string used in the request.
51517    /// It should be used to set parameters which are not yet available through their own
51518    /// setters.
51519    ///
51520    /// Please note that this method must not be used to set any of the known parameters
51521    /// which have their own setter method. If done anyway, the request will fail.
51522    ///
51523    /// # Additional Parameters
51524    ///
51525    /// * *$.xgafv* (query-string) - V1 error format.
51526    /// * *access_token* (query-string) - OAuth access token.
51527    /// * *alt* (query-string) - Data format for response.
51528    /// * *callback* (query-string) - JSONP
51529    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
51530    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
51531    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
51532    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
51533    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
51534    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
51535    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
51536    pub fn param<T>(mut self, name: T, value: T) -> InventorySourceCreateCall<'a, C>
51537    where
51538        T: AsRef<str>,
51539    {
51540        self._additional_params
51541            .insert(name.as_ref().to_string(), value.as_ref().to_string());
51542        self
51543    }
51544
51545    /// Identifies the authorization scope for the method you are building.
51546    ///
51547    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
51548    /// [`Scope::DisplayVideo`].
51549    ///
51550    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
51551    /// tokens for more than one scope.
51552    ///
51553    /// Usually there is more than one suitable scope to authorize an operation, some of which may
51554    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
51555    /// sufficient, a read-write scope will do as well.
51556    pub fn add_scope<St>(mut self, scope: St) -> InventorySourceCreateCall<'a, C>
51557    where
51558        St: AsRef<str>,
51559    {
51560        self._scopes.insert(String::from(scope.as_ref()));
51561        self
51562    }
51563    /// Identifies the authorization scope(s) for the method you are building.
51564    ///
51565    /// See [`Self::add_scope()`] for details.
51566    pub fn add_scopes<I, St>(mut self, scopes: I) -> InventorySourceCreateCall<'a, C>
51567    where
51568        I: IntoIterator<Item = St>,
51569        St: AsRef<str>,
51570    {
51571        self._scopes
51572            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
51573        self
51574    }
51575
51576    /// Removes all scopes, and no default scope will be used either.
51577    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
51578    /// for details).
51579    pub fn clear_scopes(mut self) -> InventorySourceCreateCall<'a, C> {
51580        self._scopes.clear();
51581        self
51582    }
51583}
51584
51585/// Edits read/write accessors of an inventory source. Returns the updated read_write_accessors for the inventory source.
51586///
51587/// A builder for the *editInventorySourceReadWriteAccessors* method supported by a *inventorySource* resource.
51588/// It is not used directly, but through a [`InventorySourceMethods`] instance.
51589///
51590/// # Example
51591///
51592/// Instantiate a resource method builder
51593///
51594/// ```test_harness,no_run
51595/// # extern crate hyper;
51596/// # extern crate hyper_rustls;
51597/// # extern crate google_displayvideo1 as displayvideo1;
51598/// use displayvideo1::api::EditInventorySourceReadWriteAccessorsRequest;
51599/// # async fn dox() {
51600/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
51601///
51602/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
51603/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
51604/// #     secret,
51605/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
51606/// # ).build().await.unwrap();
51607///
51608/// # let client = hyper_util::client::legacy::Client::builder(
51609/// #     hyper_util::rt::TokioExecutor::new()
51610/// # )
51611/// # .build(
51612/// #     hyper_rustls::HttpsConnectorBuilder::new()
51613/// #         .with_native_roots()
51614/// #         .unwrap()
51615/// #         .https_or_http()
51616/// #         .enable_http1()
51617/// #         .build()
51618/// # );
51619/// # let mut hub = DisplayVideo::new(client, auth);
51620/// // As the method needs a request, you would usually fill it with the desired information
51621/// // into the respective structure. Some of the parts shown here might not be applicable !
51622/// // Values shown here are possibly random and not representative !
51623/// let mut req = EditInventorySourceReadWriteAccessorsRequest::default();
51624///
51625/// // You can configure optional parameters by calling the respective setters at will, and
51626/// // execute the final call using `doit()`.
51627/// // Values shown here are possibly random and not representative !
51628/// let result = hub.inventory_sources().edit_inventory_source_read_write_accessors(req, -78)
51629///              .doit().await;
51630/// # }
51631/// ```
51632pub struct InventorySourceEditInventorySourceReadWriteAccessorCall<'a, C>
51633where
51634    C: 'a,
51635{
51636    hub: &'a DisplayVideo<C>,
51637    _request: EditInventorySourceReadWriteAccessorsRequest,
51638    _inventory_source_id: i64,
51639    _delegate: Option<&'a mut dyn common::Delegate>,
51640    _additional_params: HashMap<String, String>,
51641    _scopes: BTreeSet<String>,
51642}
51643
51644impl<'a, C> common::CallBuilder for InventorySourceEditInventorySourceReadWriteAccessorCall<'a, C> {}
51645
51646impl<'a, C> InventorySourceEditInventorySourceReadWriteAccessorCall<'a, C>
51647where
51648    C: common::Connector,
51649{
51650    /// Perform the operation you have build so far.
51651    pub async fn doit(mut self) -> common::Result<(common::Response, InventorySourceAccessors)> {
51652        use std::borrow::Cow;
51653        use std::io::{Read, Seek};
51654
51655        use common::{url::Params, ToParts};
51656        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
51657
51658        let mut dd = common::DefaultDelegate;
51659        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
51660        dlg.begin(common::MethodInfo {
51661            id: "displayvideo.inventorySources.editInventorySourceReadWriteAccessors",
51662            http_method: hyper::Method::POST,
51663        });
51664
51665        for &field in ["alt", "inventorySourceId"].iter() {
51666            if self._additional_params.contains_key(field) {
51667                dlg.finished(false);
51668                return Err(common::Error::FieldClash(field));
51669            }
51670        }
51671
51672        let mut params = Params::with_capacity(4 + self._additional_params.len());
51673        params.push("inventorySourceId", self._inventory_source_id.to_string());
51674
51675        params.extend(self._additional_params.iter());
51676
51677        params.push("alt", "json");
51678        let mut url = self.hub._base_url.clone()
51679            + "v1/inventorySources/{+inventorySourceId}:editInventorySourceReadWriteAccessors";
51680        if self._scopes.is_empty() {
51681            self._scopes
51682                .insert(Scope::DisplayVideo.as_ref().to_string());
51683        }
51684
51685        #[allow(clippy::single_element_loop)]
51686        for &(find_this, param_name) in [("{+inventorySourceId}", "inventorySourceId")].iter() {
51687            url = params.uri_replacement(url, param_name, find_this, true);
51688        }
51689        {
51690            let to_remove = ["inventorySourceId"];
51691            params.remove_params(&to_remove);
51692        }
51693
51694        let url = params.parse_with_url(&url);
51695
51696        let mut json_mime_type = mime::APPLICATION_JSON;
51697        let mut request_value_reader = {
51698            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
51699            common::remove_json_null_values(&mut value);
51700            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
51701            serde_json::to_writer(&mut dst, &value).unwrap();
51702            dst
51703        };
51704        let request_size = request_value_reader
51705            .seek(std::io::SeekFrom::End(0))
51706            .unwrap();
51707        request_value_reader
51708            .seek(std::io::SeekFrom::Start(0))
51709            .unwrap();
51710
51711        loop {
51712            let token = match self
51713                .hub
51714                .auth
51715                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
51716                .await
51717            {
51718                Ok(token) => token,
51719                Err(e) => match dlg.token(e) {
51720                    Ok(token) => token,
51721                    Err(e) => {
51722                        dlg.finished(false);
51723                        return Err(common::Error::MissingToken(e));
51724                    }
51725                },
51726            };
51727            request_value_reader
51728                .seek(std::io::SeekFrom::Start(0))
51729                .unwrap();
51730            let mut req_result = {
51731                let client = &self.hub.client;
51732                dlg.pre_request();
51733                let mut req_builder = hyper::Request::builder()
51734                    .method(hyper::Method::POST)
51735                    .uri(url.as_str())
51736                    .header(USER_AGENT, self.hub._user_agent.clone());
51737
51738                if let Some(token) = token.as_ref() {
51739                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
51740                }
51741
51742                let request = req_builder
51743                    .header(CONTENT_TYPE, json_mime_type.to_string())
51744                    .header(CONTENT_LENGTH, request_size as u64)
51745                    .body(common::to_body(
51746                        request_value_reader.get_ref().clone().into(),
51747                    ));
51748
51749                client.request(request.unwrap()).await
51750            };
51751
51752            match req_result {
51753                Err(err) => {
51754                    if let common::Retry::After(d) = dlg.http_error(&err) {
51755                        sleep(d).await;
51756                        continue;
51757                    }
51758                    dlg.finished(false);
51759                    return Err(common::Error::HttpError(err));
51760                }
51761                Ok(res) => {
51762                    let (mut parts, body) = res.into_parts();
51763                    let mut body = common::Body::new(body);
51764                    if !parts.status.is_success() {
51765                        let bytes = common::to_bytes(body).await.unwrap_or_default();
51766                        let error = serde_json::from_str(&common::to_string(&bytes));
51767                        let response = common::to_response(parts, bytes.into());
51768
51769                        if let common::Retry::After(d) =
51770                            dlg.http_failure(&response, error.as_ref().ok())
51771                        {
51772                            sleep(d).await;
51773                            continue;
51774                        }
51775
51776                        dlg.finished(false);
51777
51778                        return Err(match error {
51779                            Ok(value) => common::Error::BadRequest(value),
51780                            _ => common::Error::Failure(response),
51781                        });
51782                    }
51783                    let response = {
51784                        let bytes = common::to_bytes(body).await.unwrap_or_default();
51785                        let encoded = common::to_string(&bytes);
51786                        match serde_json::from_str(&encoded) {
51787                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
51788                            Err(error) => {
51789                                dlg.response_json_decode_error(&encoded, &error);
51790                                return Err(common::Error::JsonDecodeError(
51791                                    encoded.to_string(),
51792                                    error,
51793                                ));
51794                            }
51795                        }
51796                    };
51797
51798                    dlg.finished(true);
51799                    return Ok(response);
51800                }
51801            }
51802        }
51803    }
51804
51805    ///
51806    /// Sets the *request* property to the given value.
51807    ///
51808    /// Even though the property as already been set when instantiating this call,
51809    /// we provide this method for API completeness.
51810    pub fn request(
51811        mut self,
51812        new_value: EditInventorySourceReadWriteAccessorsRequest,
51813    ) -> InventorySourceEditInventorySourceReadWriteAccessorCall<'a, C> {
51814        self._request = new_value;
51815        self
51816    }
51817    /// Required. The ID of inventory source to update.
51818    ///
51819    /// Sets the *inventory source id* path property to the given value.
51820    ///
51821    /// Even though the property as already been set when instantiating this call,
51822    /// we provide this method for API completeness.
51823    pub fn inventory_source_id(
51824        mut self,
51825        new_value: i64,
51826    ) -> InventorySourceEditInventorySourceReadWriteAccessorCall<'a, C> {
51827        self._inventory_source_id = new_value;
51828        self
51829    }
51830    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
51831    /// while executing the actual API request.
51832    ///
51833    /// ````text
51834    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
51835    /// ````
51836    ///
51837    /// Sets the *delegate* property to the given value.
51838    pub fn delegate(
51839        mut self,
51840        new_value: &'a mut dyn common::Delegate,
51841    ) -> InventorySourceEditInventorySourceReadWriteAccessorCall<'a, C> {
51842        self._delegate = Some(new_value);
51843        self
51844    }
51845
51846    /// Set any additional parameter of the query string used in the request.
51847    /// It should be used to set parameters which are not yet available through their own
51848    /// setters.
51849    ///
51850    /// Please note that this method must not be used to set any of the known parameters
51851    /// which have their own setter method. If done anyway, the request will fail.
51852    ///
51853    /// # Additional Parameters
51854    ///
51855    /// * *$.xgafv* (query-string) - V1 error format.
51856    /// * *access_token* (query-string) - OAuth access token.
51857    /// * *alt* (query-string) - Data format for response.
51858    /// * *callback* (query-string) - JSONP
51859    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
51860    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
51861    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
51862    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
51863    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
51864    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
51865    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
51866    pub fn param<T>(
51867        mut self,
51868        name: T,
51869        value: T,
51870    ) -> InventorySourceEditInventorySourceReadWriteAccessorCall<'a, C>
51871    where
51872        T: AsRef<str>,
51873    {
51874        self._additional_params
51875            .insert(name.as_ref().to_string(), value.as_ref().to_string());
51876        self
51877    }
51878
51879    /// Identifies the authorization scope for the method you are building.
51880    ///
51881    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
51882    /// [`Scope::DisplayVideo`].
51883    ///
51884    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
51885    /// tokens for more than one scope.
51886    ///
51887    /// Usually there is more than one suitable scope to authorize an operation, some of which may
51888    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
51889    /// sufficient, a read-write scope will do as well.
51890    pub fn add_scope<St>(
51891        mut self,
51892        scope: St,
51893    ) -> InventorySourceEditInventorySourceReadWriteAccessorCall<'a, C>
51894    where
51895        St: AsRef<str>,
51896    {
51897        self._scopes.insert(String::from(scope.as_ref()));
51898        self
51899    }
51900    /// Identifies the authorization scope(s) for the method you are building.
51901    ///
51902    /// See [`Self::add_scope()`] for details.
51903    pub fn add_scopes<I, St>(
51904        mut self,
51905        scopes: I,
51906    ) -> InventorySourceEditInventorySourceReadWriteAccessorCall<'a, C>
51907    where
51908        I: IntoIterator<Item = St>,
51909        St: AsRef<str>,
51910    {
51911        self._scopes
51912            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
51913        self
51914    }
51915
51916    /// Removes all scopes, and no default scope will be used either.
51917    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
51918    /// for details).
51919    pub fn clear_scopes(
51920        mut self,
51921    ) -> InventorySourceEditInventorySourceReadWriteAccessorCall<'a, C> {
51922        self._scopes.clear();
51923        self
51924    }
51925}
51926
51927/// Gets an inventory source.
51928///
51929/// A builder for the *get* method supported by a *inventorySource* resource.
51930/// It is not used directly, but through a [`InventorySourceMethods`] instance.
51931///
51932/// # Example
51933///
51934/// Instantiate a resource method builder
51935///
51936/// ```test_harness,no_run
51937/// # extern crate hyper;
51938/// # extern crate hyper_rustls;
51939/// # extern crate google_displayvideo1 as displayvideo1;
51940/// # async fn dox() {
51941/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
51942///
51943/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
51944/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
51945/// #     secret,
51946/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
51947/// # ).build().await.unwrap();
51948///
51949/// # let client = hyper_util::client::legacy::Client::builder(
51950/// #     hyper_util::rt::TokioExecutor::new()
51951/// # )
51952/// # .build(
51953/// #     hyper_rustls::HttpsConnectorBuilder::new()
51954/// #         .with_native_roots()
51955/// #         .unwrap()
51956/// #         .https_or_http()
51957/// #         .enable_http1()
51958/// #         .build()
51959/// # );
51960/// # let mut hub = DisplayVideo::new(client, auth);
51961/// // You can configure optional parameters by calling the respective setters at will, and
51962/// // execute the final call using `doit()`.
51963/// // Values shown here are possibly random and not representative !
51964/// let result = hub.inventory_sources().get(-77)
51965///              .partner_id(-92)
51966///              .doit().await;
51967/// # }
51968/// ```
51969pub struct InventorySourceGetCall<'a, C>
51970where
51971    C: 'a,
51972{
51973    hub: &'a DisplayVideo<C>,
51974    _inventory_source_id: i64,
51975    _partner_id: Option<i64>,
51976    _delegate: Option<&'a mut dyn common::Delegate>,
51977    _additional_params: HashMap<String, String>,
51978    _scopes: BTreeSet<String>,
51979}
51980
51981impl<'a, C> common::CallBuilder for InventorySourceGetCall<'a, C> {}
51982
51983impl<'a, C> InventorySourceGetCall<'a, C>
51984where
51985    C: common::Connector,
51986{
51987    /// Perform the operation you have build so far.
51988    pub async fn doit(mut self) -> common::Result<(common::Response, InventorySource)> {
51989        use std::borrow::Cow;
51990        use std::io::{Read, Seek};
51991
51992        use common::{url::Params, ToParts};
51993        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
51994
51995        let mut dd = common::DefaultDelegate;
51996        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
51997        dlg.begin(common::MethodInfo {
51998            id: "displayvideo.inventorySources.get",
51999            http_method: hyper::Method::GET,
52000        });
52001
52002        for &field in ["alt", "inventorySourceId", "partnerId"].iter() {
52003            if self._additional_params.contains_key(field) {
52004                dlg.finished(false);
52005                return Err(common::Error::FieldClash(field));
52006            }
52007        }
52008
52009        let mut params = Params::with_capacity(4 + self._additional_params.len());
52010        params.push("inventorySourceId", self._inventory_source_id.to_string());
52011        if let Some(value) = self._partner_id.as_ref() {
52012            params.push("partnerId", value.to_string());
52013        }
52014
52015        params.extend(self._additional_params.iter());
52016
52017        params.push("alt", "json");
52018        let mut url = self.hub._base_url.clone() + "v1/inventorySources/{+inventorySourceId}";
52019        if self._scopes.is_empty() {
52020            self._scopes
52021                .insert(Scope::DisplayVideo.as_ref().to_string());
52022        }
52023
52024        #[allow(clippy::single_element_loop)]
52025        for &(find_this, param_name) in [("{+inventorySourceId}", "inventorySourceId")].iter() {
52026            url = params.uri_replacement(url, param_name, find_this, true);
52027        }
52028        {
52029            let to_remove = ["inventorySourceId"];
52030            params.remove_params(&to_remove);
52031        }
52032
52033        let url = params.parse_with_url(&url);
52034
52035        loop {
52036            let token = match self
52037                .hub
52038                .auth
52039                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
52040                .await
52041            {
52042                Ok(token) => token,
52043                Err(e) => match dlg.token(e) {
52044                    Ok(token) => token,
52045                    Err(e) => {
52046                        dlg.finished(false);
52047                        return Err(common::Error::MissingToken(e));
52048                    }
52049                },
52050            };
52051            let mut req_result = {
52052                let client = &self.hub.client;
52053                dlg.pre_request();
52054                let mut req_builder = hyper::Request::builder()
52055                    .method(hyper::Method::GET)
52056                    .uri(url.as_str())
52057                    .header(USER_AGENT, self.hub._user_agent.clone());
52058
52059                if let Some(token) = token.as_ref() {
52060                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
52061                }
52062
52063                let request = req_builder
52064                    .header(CONTENT_LENGTH, 0_u64)
52065                    .body(common::to_body::<String>(None));
52066
52067                client.request(request.unwrap()).await
52068            };
52069
52070            match req_result {
52071                Err(err) => {
52072                    if let common::Retry::After(d) = dlg.http_error(&err) {
52073                        sleep(d).await;
52074                        continue;
52075                    }
52076                    dlg.finished(false);
52077                    return Err(common::Error::HttpError(err));
52078                }
52079                Ok(res) => {
52080                    let (mut parts, body) = res.into_parts();
52081                    let mut body = common::Body::new(body);
52082                    if !parts.status.is_success() {
52083                        let bytes = common::to_bytes(body).await.unwrap_or_default();
52084                        let error = serde_json::from_str(&common::to_string(&bytes));
52085                        let response = common::to_response(parts, bytes.into());
52086
52087                        if let common::Retry::After(d) =
52088                            dlg.http_failure(&response, error.as_ref().ok())
52089                        {
52090                            sleep(d).await;
52091                            continue;
52092                        }
52093
52094                        dlg.finished(false);
52095
52096                        return Err(match error {
52097                            Ok(value) => common::Error::BadRequest(value),
52098                            _ => common::Error::Failure(response),
52099                        });
52100                    }
52101                    let response = {
52102                        let bytes = common::to_bytes(body).await.unwrap_or_default();
52103                        let encoded = common::to_string(&bytes);
52104                        match serde_json::from_str(&encoded) {
52105                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
52106                            Err(error) => {
52107                                dlg.response_json_decode_error(&encoded, &error);
52108                                return Err(common::Error::JsonDecodeError(
52109                                    encoded.to_string(),
52110                                    error,
52111                                ));
52112                            }
52113                        }
52114                    };
52115
52116                    dlg.finished(true);
52117                    return Ok(response);
52118                }
52119            }
52120        }
52121    }
52122
52123    /// Required. The ID of the inventory source to fetch.
52124    ///
52125    /// Sets the *inventory source id* path property to the given value.
52126    ///
52127    /// Even though the property as already been set when instantiating this call,
52128    /// we provide this method for API completeness.
52129    pub fn inventory_source_id(mut self, new_value: i64) -> InventorySourceGetCall<'a, C> {
52130        self._inventory_source_id = new_value;
52131        self
52132    }
52133    /// Required. The ID of the DV360 partner to which the fetched inventory source is permissioned.
52134    ///
52135    /// Sets the *partner id* query property to the given value.
52136    pub fn partner_id(mut self, new_value: i64) -> InventorySourceGetCall<'a, C> {
52137        self._partner_id = Some(new_value);
52138        self
52139    }
52140    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
52141    /// while executing the actual API request.
52142    ///
52143    /// ````text
52144    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
52145    /// ````
52146    ///
52147    /// Sets the *delegate* property to the given value.
52148    pub fn delegate(
52149        mut self,
52150        new_value: &'a mut dyn common::Delegate,
52151    ) -> InventorySourceGetCall<'a, C> {
52152        self._delegate = Some(new_value);
52153        self
52154    }
52155
52156    /// Set any additional parameter of the query string used in the request.
52157    /// It should be used to set parameters which are not yet available through their own
52158    /// setters.
52159    ///
52160    /// Please note that this method must not be used to set any of the known parameters
52161    /// which have their own setter method. If done anyway, the request will fail.
52162    ///
52163    /// # Additional Parameters
52164    ///
52165    /// * *$.xgafv* (query-string) - V1 error format.
52166    /// * *access_token* (query-string) - OAuth access token.
52167    /// * *alt* (query-string) - Data format for response.
52168    /// * *callback* (query-string) - JSONP
52169    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
52170    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
52171    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
52172    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
52173    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
52174    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
52175    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
52176    pub fn param<T>(mut self, name: T, value: T) -> InventorySourceGetCall<'a, C>
52177    where
52178        T: AsRef<str>,
52179    {
52180        self._additional_params
52181            .insert(name.as_ref().to_string(), value.as_ref().to_string());
52182        self
52183    }
52184
52185    /// Identifies the authorization scope for the method you are building.
52186    ///
52187    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
52188    /// [`Scope::DisplayVideo`].
52189    ///
52190    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
52191    /// tokens for more than one scope.
52192    ///
52193    /// Usually there is more than one suitable scope to authorize an operation, some of which may
52194    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
52195    /// sufficient, a read-write scope will do as well.
52196    pub fn add_scope<St>(mut self, scope: St) -> InventorySourceGetCall<'a, C>
52197    where
52198        St: AsRef<str>,
52199    {
52200        self._scopes.insert(String::from(scope.as_ref()));
52201        self
52202    }
52203    /// Identifies the authorization scope(s) for the method you are building.
52204    ///
52205    /// See [`Self::add_scope()`] for details.
52206    pub fn add_scopes<I, St>(mut self, scopes: I) -> InventorySourceGetCall<'a, C>
52207    where
52208        I: IntoIterator<Item = St>,
52209        St: AsRef<str>,
52210    {
52211        self._scopes
52212            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
52213        self
52214    }
52215
52216    /// Removes all scopes, and no default scope will be used either.
52217    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
52218    /// for details).
52219    pub fn clear_scopes(mut self) -> InventorySourceGetCall<'a, C> {
52220        self._scopes.clear();
52221        self
52222    }
52223}
52224
52225/// Lists inventory sources that are accessible to the current user. The order is defined by the order_by parameter. If a filter by entity_status is not specified, inventory sources with entity status `ENTITY_STATUS_ARCHIVED` will not be included in the results.
52226///
52227/// A builder for the *list* method supported by a *inventorySource* resource.
52228/// It is not used directly, but through a [`InventorySourceMethods`] instance.
52229///
52230/// # Example
52231///
52232/// Instantiate a resource method builder
52233///
52234/// ```test_harness,no_run
52235/// # extern crate hyper;
52236/// # extern crate hyper_rustls;
52237/// # extern crate google_displayvideo1 as displayvideo1;
52238/// # async fn dox() {
52239/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
52240///
52241/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
52242/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
52243/// #     secret,
52244/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
52245/// # ).build().await.unwrap();
52246///
52247/// # let client = hyper_util::client::legacy::Client::builder(
52248/// #     hyper_util::rt::TokioExecutor::new()
52249/// # )
52250/// # .build(
52251/// #     hyper_rustls::HttpsConnectorBuilder::new()
52252/// #         .with_native_roots()
52253/// #         .unwrap()
52254/// #         .https_or_http()
52255/// #         .enable_http1()
52256/// #         .build()
52257/// # );
52258/// # let mut hub = DisplayVideo::new(client, auth);
52259/// // You can configure optional parameters by calling the respective setters at will, and
52260/// // execute the final call using `doit()`.
52261/// // Values shown here are possibly random and not representative !
52262/// let result = hub.inventory_sources().list()
52263///              .partner_id(-47)
52264///              .page_token("At")
52265///              .page_size(-90)
52266///              .order_by("erat")
52267///              .filter("duo")
52268///              .advertiser_id(-35)
52269///              .doit().await;
52270/// # }
52271/// ```
52272pub struct InventorySourceListCall<'a, C>
52273where
52274    C: 'a,
52275{
52276    hub: &'a DisplayVideo<C>,
52277    _partner_id: Option<i64>,
52278    _page_token: Option<String>,
52279    _page_size: Option<i32>,
52280    _order_by: Option<String>,
52281    _filter: Option<String>,
52282    _advertiser_id: Option<i64>,
52283    _delegate: Option<&'a mut dyn common::Delegate>,
52284    _additional_params: HashMap<String, String>,
52285    _scopes: BTreeSet<String>,
52286}
52287
52288impl<'a, C> common::CallBuilder for InventorySourceListCall<'a, C> {}
52289
52290impl<'a, C> InventorySourceListCall<'a, C>
52291where
52292    C: common::Connector,
52293{
52294    /// Perform the operation you have build so far.
52295    pub async fn doit(
52296        mut self,
52297    ) -> common::Result<(common::Response, ListInventorySourcesResponse)> {
52298        use std::borrow::Cow;
52299        use std::io::{Read, Seek};
52300
52301        use common::{url::Params, ToParts};
52302        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
52303
52304        let mut dd = common::DefaultDelegate;
52305        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
52306        dlg.begin(common::MethodInfo {
52307            id: "displayvideo.inventorySources.list",
52308            http_method: hyper::Method::GET,
52309        });
52310
52311        for &field in [
52312            "alt",
52313            "partnerId",
52314            "pageToken",
52315            "pageSize",
52316            "orderBy",
52317            "filter",
52318            "advertiserId",
52319        ]
52320        .iter()
52321        {
52322            if self._additional_params.contains_key(field) {
52323                dlg.finished(false);
52324                return Err(common::Error::FieldClash(field));
52325            }
52326        }
52327
52328        let mut params = Params::with_capacity(8 + self._additional_params.len());
52329        if let Some(value) = self._partner_id.as_ref() {
52330            params.push("partnerId", value.to_string());
52331        }
52332        if let Some(value) = self._page_token.as_ref() {
52333            params.push("pageToken", value);
52334        }
52335        if let Some(value) = self._page_size.as_ref() {
52336            params.push("pageSize", value.to_string());
52337        }
52338        if let Some(value) = self._order_by.as_ref() {
52339            params.push("orderBy", value);
52340        }
52341        if let Some(value) = self._filter.as_ref() {
52342            params.push("filter", value);
52343        }
52344        if let Some(value) = self._advertiser_id.as_ref() {
52345            params.push("advertiserId", value.to_string());
52346        }
52347
52348        params.extend(self._additional_params.iter());
52349
52350        params.push("alt", "json");
52351        let mut url = self.hub._base_url.clone() + "v1/inventorySources";
52352        if self._scopes.is_empty() {
52353            self._scopes
52354                .insert(Scope::DisplayVideo.as_ref().to_string());
52355        }
52356
52357        let url = params.parse_with_url(&url);
52358
52359        loop {
52360            let token = match self
52361                .hub
52362                .auth
52363                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
52364                .await
52365            {
52366                Ok(token) => token,
52367                Err(e) => match dlg.token(e) {
52368                    Ok(token) => token,
52369                    Err(e) => {
52370                        dlg.finished(false);
52371                        return Err(common::Error::MissingToken(e));
52372                    }
52373                },
52374            };
52375            let mut req_result = {
52376                let client = &self.hub.client;
52377                dlg.pre_request();
52378                let mut req_builder = hyper::Request::builder()
52379                    .method(hyper::Method::GET)
52380                    .uri(url.as_str())
52381                    .header(USER_AGENT, self.hub._user_agent.clone());
52382
52383                if let Some(token) = token.as_ref() {
52384                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
52385                }
52386
52387                let request = req_builder
52388                    .header(CONTENT_LENGTH, 0_u64)
52389                    .body(common::to_body::<String>(None));
52390
52391                client.request(request.unwrap()).await
52392            };
52393
52394            match req_result {
52395                Err(err) => {
52396                    if let common::Retry::After(d) = dlg.http_error(&err) {
52397                        sleep(d).await;
52398                        continue;
52399                    }
52400                    dlg.finished(false);
52401                    return Err(common::Error::HttpError(err));
52402                }
52403                Ok(res) => {
52404                    let (mut parts, body) = res.into_parts();
52405                    let mut body = common::Body::new(body);
52406                    if !parts.status.is_success() {
52407                        let bytes = common::to_bytes(body).await.unwrap_or_default();
52408                        let error = serde_json::from_str(&common::to_string(&bytes));
52409                        let response = common::to_response(parts, bytes.into());
52410
52411                        if let common::Retry::After(d) =
52412                            dlg.http_failure(&response, error.as_ref().ok())
52413                        {
52414                            sleep(d).await;
52415                            continue;
52416                        }
52417
52418                        dlg.finished(false);
52419
52420                        return Err(match error {
52421                            Ok(value) => common::Error::BadRequest(value),
52422                            _ => common::Error::Failure(response),
52423                        });
52424                    }
52425                    let response = {
52426                        let bytes = common::to_bytes(body).await.unwrap_or_default();
52427                        let encoded = common::to_string(&bytes);
52428                        match serde_json::from_str(&encoded) {
52429                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
52430                            Err(error) => {
52431                                dlg.response_json_decode_error(&encoded, &error);
52432                                return Err(common::Error::JsonDecodeError(
52433                                    encoded.to_string(),
52434                                    error,
52435                                ));
52436                            }
52437                        }
52438                    };
52439
52440                    dlg.finished(true);
52441                    return Ok(response);
52442                }
52443            }
52444        }
52445    }
52446
52447    /// The ID of the partner that has access to the inventory source.
52448    ///
52449    /// Sets the *partner id* query property to the given value.
52450    pub fn partner_id(mut self, new_value: i64) -> InventorySourceListCall<'a, C> {
52451        self._partner_id = Some(new_value);
52452        self
52453    }
52454    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListInventorySources` method. If not specified, the first page of results will be returned.
52455    ///
52456    /// Sets the *page token* query property to the given value.
52457    pub fn page_token(mut self, new_value: &str) -> InventorySourceListCall<'a, C> {
52458        self._page_token = Some(new_value.to_string());
52459        self
52460    }
52461    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`.
52462    ///
52463    /// Sets the *page size* query property to the given value.
52464    pub fn page_size(mut self, new_value: i32) -> InventorySourceListCall<'a, C> {
52465        self._page_size = Some(new_value);
52466        self
52467    }
52468    /// Field by which to sort the list. Acceptable values are: * `displayName` (default) The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. For example, `displayName desc`.
52469    ///
52470    /// Sets the *order by* query property to the given value.
52471    pub fn order_by(mut self, new_value: &str) -> InventorySourceListCall<'a, C> {
52472        self._order_by = Some(new_value.to_string());
52473        self
52474    }
52475    /// Allows filtering by inventory source fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by `AND` or `OR` logical operators. A sequence of restrictions implicitly uses `AND`. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `EQUALS (=)` operator. Supported fields: * `status.entityStatus` * `commitment` * `deliveryMethod` * `rateDetails.rateType` * `exchange` Examples: * All active inventory sources: `status.entityStatus="ENTITY_STATUS_ACTIVE"` * Inventory sources belonging to Google Ad Manager or Rubicon exchanges: `exchange="EXCHANGE_GOOGLE_AD_MANAGER" OR exchange="EXCHANGE_RUBICON"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
52476    ///
52477    /// Sets the *filter* query property to the given value.
52478    pub fn filter(mut self, new_value: &str) -> InventorySourceListCall<'a, C> {
52479        self._filter = Some(new_value.to_string());
52480        self
52481    }
52482    /// The ID of the advertiser that has access to the inventory source.
52483    ///
52484    /// Sets the *advertiser id* query property to the given value.
52485    pub fn advertiser_id(mut self, new_value: i64) -> InventorySourceListCall<'a, C> {
52486        self._advertiser_id = Some(new_value);
52487        self
52488    }
52489    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
52490    /// while executing the actual API request.
52491    ///
52492    /// ````text
52493    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
52494    /// ````
52495    ///
52496    /// Sets the *delegate* property to the given value.
52497    pub fn delegate(
52498        mut self,
52499        new_value: &'a mut dyn common::Delegate,
52500    ) -> InventorySourceListCall<'a, C> {
52501        self._delegate = Some(new_value);
52502        self
52503    }
52504
52505    /// Set any additional parameter of the query string used in the request.
52506    /// It should be used to set parameters which are not yet available through their own
52507    /// setters.
52508    ///
52509    /// Please note that this method must not be used to set any of the known parameters
52510    /// which have their own setter method. If done anyway, the request will fail.
52511    ///
52512    /// # Additional Parameters
52513    ///
52514    /// * *$.xgafv* (query-string) - V1 error format.
52515    /// * *access_token* (query-string) - OAuth access token.
52516    /// * *alt* (query-string) - Data format for response.
52517    /// * *callback* (query-string) - JSONP
52518    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
52519    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
52520    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
52521    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
52522    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
52523    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
52524    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
52525    pub fn param<T>(mut self, name: T, value: T) -> InventorySourceListCall<'a, C>
52526    where
52527        T: AsRef<str>,
52528    {
52529        self._additional_params
52530            .insert(name.as_ref().to_string(), value.as_ref().to_string());
52531        self
52532    }
52533
52534    /// Identifies the authorization scope for the method you are building.
52535    ///
52536    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
52537    /// [`Scope::DisplayVideo`].
52538    ///
52539    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
52540    /// tokens for more than one scope.
52541    ///
52542    /// Usually there is more than one suitable scope to authorize an operation, some of which may
52543    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
52544    /// sufficient, a read-write scope will do as well.
52545    pub fn add_scope<St>(mut self, scope: St) -> InventorySourceListCall<'a, C>
52546    where
52547        St: AsRef<str>,
52548    {
52549        self._scopes.insert(String::from(scope.as_ref()));
52550        self
52551    }
52552    /// Identifies the authorization scope(s) for the method you are building.
52553    ///
52554    /// See [`Self::add_scope()`] for details.
52555    pub fn add_scopes<I, St>(mut self, scopes: I) -> InventorySourceListCall<'a, C>
52556    where
52557        I: IntoIterator<Item = St>,
52558        St: AsRef<str>,
52559    {
52560        self._scopes
52561            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
52562        self
52563    }
52564
52565    /// Removes all scopes, and no default scope will be used either.
52566    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
52567    /// for details).
52568    pub fn clear_scopes(mut self) -> InventorySourceListCall<'a, C> {
52569        self._scopes.clear();
52570        self
52571    }
52572}
52573
52574/// Updates an existing inventory source. Returns the updated inventory source if successful.
52575///
52576/// A builder for the *patch* method supported by a *inventorySource* resource.
52577/// It is not used directly, but through a [`InventorySourceMethods`] instance.
52578///
52579/// # Example
52580///
52581/// Instantiate a resource method builder
52582///
52583/// ```test_harness,no_run
52584/// # extern crate hyper;
52585/// # extern crate hyper_rustls;
52586/// # extern crate google_displayvideo1 as displayvideo1;
52587/// use displayvideo1::api::InventorySource;
52588/// # async fn dox() {
52589/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
52590///
52591/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
52592/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
52593/// #     secret,
52594/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
52595/// # ).build().await.unwrap();
52596///
52597/// # let client = hyper_util::client::legacy::Client::builder(
52598/// #     hyper_util::rt::TokioExecutor::new()
52599/// # )
52600/// # .build(
52601/// #     hyper_rustls::HttpsConnectorBuilder::new()
52602/// #         .with_native_roots()
52603/// #         .unwrap()
52604/// #         .https_or_http()
52605/// #         .enable_http1()
52606/// #         .build()
52607/// # );
52608/// # let mut hub = DisplayVideo::new(client, auth);
52609/// // As the method needs a request, you would usually fill it with the desired information
52610/// // into the respective structure. Some of the parts shown here might not be applicable !
52611/// // Values shown here are possibly random and not representative !
52612/// let mut req = InventorySource::default();
52613///
52614/// // You can configure optional parameters by calling the respective setters at will, and
52615/// // execute the final call using `doit()`.
52616/// // Values shown here are possibly random and not representative !
52617/// let result = hub.inventory_sources().patch(req, -1)
52618///              .update_mask(FieldMask::new::<&str>(&[]))
52619///              .partner_id(-81)
52620///              .advertiser_id(-48)
52621///              .doit().await;
52622/// # }
52623/// ```
52624pub struct InventorySourcePatchCall<'a, C>
52625where
52626    C: 'a,
52627{
52628    hub: &'a DisplayVideo<C>,
52629    _request: InventorySource,
52630    _inventory_source_id: i64,
52631    _update_mask: Option<common::FieldMask>,
52632    _partner_id: Option<i64>,
52633    _advertiser_id: Option<i64>,
52634    _delegate: Option<&'a mut dyn common::Delegate>,
52635    _additional_params: HashMap<String, String>,
52636    _scopes: BTreeSet<String>,
52637}
52638
52639impl<'a, C> common::CallBuilder for InventorySourcePatchCall<'a, C> {}
52640
52641impl<'a, C> InventorySourcePatchCall<'a, C>
52642where
52643    C: common::Connector,
52644{
52645    /// Perform the operation you have build so far.
52646    pub async fn doit(mut self) -> common::Result<(common::Response, InventorySource)> {
52647        use std::borrow::Cow;
52648        use std::io::{Read, Seek};
52649
52650        use common::{url::Params, ToParts};
52651        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
52652
52653        let mut dd = common::DefaultDelegate;
52654        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
52655        dlg.begin(common::MethodInfo {
52656            id: "displayvideo.inventorySources.patch",
52657            http_method: hyper::Method::PATCH,
52658        });
52659
52660        for &field in [
52661            "alt",
52662            "inventorySourceId",
52663            "updateMask",
52664            "partnerId",
52665            "advertiserId",
52666        ]
52667        .iter()
52668        {
52669            if self._additional_params.contains_key(field) {
52670                dlg.finished(false);
52671                return Err(common::Error::FieldClash(field));
52672            }
52673        }
52674
52675        let mut params = Params::with_capacity(7 + self._additional_params.len());
52676        params.push("inventorySourceId", self._inventory_source_id.to_string());
52677        if let Some(value) = self._update_mask.as_ref() {
52678            params.push("updateMask", value.to_string());
52679        }
52680        if let Some(value) = self._partner_id.as_ref() {
52681            params.push("partnerId", value.to_string());
52682        }
52683        if let Some(value) = self._advertiser_id.as_ref() {
52684            params.push("advertiserId", value.to_string());
52685        }
52686
52687        params.extend(self._additional_params.iter());
52688
52689        params.push("alt", "json");
52690        let mut url = self.hub._base_url.clone() + "v1/inventorySources/{+inventorySourceId}";
52691        if self._scopes.is_empty() {
52692            self._scopes
52693                .insert(Scope::DisplayVideo.as_ref().to_string());
52694        }
52695
52696        #[allow(clippy::single_element_loop)]
52697        for &(find_this, param_name) in [("{+inventorySourceId}", "inventorySourceId")].iter() {
52698            url = params.uri_replacement(url, param_name, find_this, true);
52699        }
52700        {
52701            let to_remove = ["inventorySourceId"];
52702            params.remove_params(&to_remove);
52703        }
52704
52705        let url = params.parse_with_url(&url);
52706
52707        let mut json_mime_type = mime::APPLICATION_JSON;
52708        let mut request_value_reader = {
52709            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
52710            common::remove_json_null_values(&mut value);
52711            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
52712            serde_json::to_writer(&mut dst, &value).unwrap();
52713            dst
52714        };
52715        let request_size = request_value_reader
52716            .seek(std::io::SeekFrom::End(0))
52717            .unwrap();
52718        request_value_reader
52719            .seek(std::io::SeekFrom::Start(0))
52720            .unwrap();
52721
52722        loop {
52723            let token = match self
52724                .hub
52725                .auth
52726                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
52727                .await
52728            {
52729                Ok(token) => token,
52730                Err(e) => match dlg.token(e) {
52731                    Ok(token) => token,
52732                    Err(e) => {
52733                        dlg.finished(false);
52734                        return Err(common::Error::MissingToken(e));
52735                    }
52736                },
52737            };
52738            request_value_reader
52739                .seek(std::io::SeekFrom::Start(0))
52740                .unwrap();
52741            let mut req_result = {
52742                let client = &self.hub.client;
52743                dlg.pre_request();
52744                let mut req_builder = hyper::Request::builder()
52745                    .method(hyper::Method::PATCH)
52746                    .uri(url.as_str())
52747                    .header(USER_AGENT, self.hub._user_agent.clone());
52748
52749                if let Some(token) = token.as_ref() {
52750                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
52751                }
52752
52753                let request = req_builder
52754                    .header(CONTENT_TYPE, json_mime_type.to_string())
52755                    .header(CONTENT_LENGTH, request_size as u64)
52756                    .body(common::to_body(
52757                        request_value_reader.get_ref().clone().into(),
52758                    ));
52759
52760                client.request(request.unwrap()).await
52761            };
52762
52763            match req_result {
52764                Err(err) => {
52765                    if let common::Retry::After(d) = dlg.http_error(&err) {
52766                        sleep(d).await;
52767                        continue;
52768                    }
52769                    dlg.finished(false);
52770                    return Err(common::Error::HttpError(err));
52771                }
52772                Ok(res) => {
52773                    let (mut parts, body) = res.into_parts();
52774                    let mut body = common::Body::new(body);
52775                    if !parts.status.is_success() {
52776                        let bytes = common::to_bytes(body).await.unwrap_or_default();
52777                        let error = serde_json::from_str(&common::to_string(&bytes));
52778                        let response = common::to_response(parts, bytes.into());
52779
52780                        if let common::Retry::After(d) =
52781                            dlg.http_failure(&response, error.as_ref().ok())
52782                        {
52783                            sleep(d).await;
52784                            continue;
52785                        }
52786
52787                        dlg.finished(false);
52788
52789                        return Err(match error {
52790                            Ok(value) => common::Error::BadRequest(value),
52791                            _ => common::Error::Failure(response),
52792                        });
52793                    }
52794                    let response = {
52795                        let bytes = common::to_bytes(body).await.unwrap_or_default();
52796                        let encoded = common::to_string(&bytes);
52797                        match serde_json::from_str(&encoded) {
52798                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
52799                            Err(error) => {
52800                                dlg.response_json_decode_error(&encoded, &error);
52801                                return Err(common::Error::JsonDecodeError(
52802                                    encoded.to_string(),
52803                                    error,
52804                                ));
52805                            }
52806                        }
52807                    };
52808
52809                    dlg.finished(true);
52810                    return Ok(response);
52811                }
52812            }
52813        }
52814    }
52815
52816    ///
52817    /// Sets the *request* property to the given value.
52818    ///
52819    /// Even though the property as already been set when instantiating this call,
52820    /// we provide this method for API completeness.
52821    pub fn request(mut self, new_value: InventorySource) -> InventorySourcePatchCall<'a, C> {
52822        self._request = new_value;
52823        self
52824    }
52825    /// Output only. The unique ID of the inventory source. Assigned by the system.
52826    ///
52827    /// Sets the *inventory source id* path property to the given value.
52828    ///
52829    /// Even though the property as already been set when instantiating this call,
52830    /// we provide this method for API completeness.
52831    pub fn inventory_source_id(mut self, new_value: i64) -> InventorySourcePatchCall<'a, C> {
52832        self._inventory_source_id = new_value;
52833        self
52834    }
52835    /// Required. The mask to control which fields to update.
52836    ///
52837    /// Sets the *update mask* query property to the given value.
52838    pub fn update_mask(mut self, new_value: common::FieldMask) -> InventorySourcePatchCall<'a, C> {
52839        self._update_mask = Some(new_value);
52840        self
52841    }
52842    /// The ID of the partner that the request is being made within.
52843    ///
52844    /// Sets the *partner id* query property to the given value.
52845    pub fn partner_id(mut self, new_value: i64) -> InventorySourcePatchCall<'a, C> {
52846        self._partner_id = Some(new_value);
52847        self
52848    }
52849    /// The ID of the advertiser that the request is being made within.
52850    ///
52851    /// Sets the *advertiser id* query property to the given value.
52852    pub fn advertiser_id(mut self, new_value: i64) -> InventorySourcePatchCall<'a, C> {
52853        self._advertiser_id = Some(new_value);
52854        self
52855    }
52856    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
52857    /// while executing the actual API request.
52858    ///
52859    /// ````text
52860    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
52861    /// ````
52862    ///
52863    /// Sets the *delegate* property to the given value.
52864    pub fn delegate(
52865        mut self,
52866        new_value: &'a mut dyn common::Delegate,
52867    ) -> InventorySourcePatchCall<'a, C> {
52868        self._delegate = Some(new_value);
52869        self
52870    }
52871
52872    /// Set any additional parameter of the query string used in the request.
52873    /// It should be used to set parameters which are not yet available through their own
52874    /// setters.
52875    ///
52876    /// Please note that this method must not be used to set any of the known parameters
52877    /// which have their own setter method. If done anyway, the request will fail.
52878    ///
52879    /// # Additional Parameters
52880    ///
52881    /// * *$.xgafv* (query-string) - V1 error format.
52882    /// * *access_token* (query-string) - OAuth access token.
52883    /// * *alt* (query-string) - Data format for response.
52884    /// * *callback* (query-string) - JSONP
52885    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
52886    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
52887    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
52888    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
52889    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
52890    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
52891    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
52892    pub fn param<T>(mut self, name: T, value: T) -> InventorySourcePatchCall<'a, C>
52893    where
52894        T: AsRef<str>,
52895    {
52896        self._additional_params
52897            .insert(name.as_ref().to_string(), value.as_ref().to_string());
52898        self
52899    }
52900
52901    /// Identifies the authorization scope for the method you are building.
52902    ///
52903    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
52904    /// [`Scope::DisplayVideo`].
52905    ///
52906    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
52907    /// tokens for more than one scope.
52908    ///
52909    /// Usually there is more than one suitable scope to authorize an operation, some of which may
52910    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
52911    /// sufficient, a read-write scope will do as well.
52912    pub fn add_scope<St>(mut self, scope: St) -> InventorySourcePatchCall<'a, C>
52913    where
52914        St: AsRef<str>,
52915    {
52916        self._scopes.insert(String::from(scope.as_ref()));
52917        self
52918    }
52919    /// Identifies the authorization scope(s) for the method you are building.
52920    ///
52921    /// See [`Self::add_scope()`] for details.
52922    pub fn add_scopes<I, St>(mut self, scopes: I) -> InventorySourcePatchCall<'a, C>
52923    where
52924        I: IntoIterator<Item = St>,
52925        St: AsRef<str>,
52926    {
52927        self._scopes
52928            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
52929        self
52930    }
52931
52932    /// Removes all scopes, and no default scope will be used either.
52933    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
52934    /// for details).
52935    pub fn clear_scopes(mut self) -> InventorySourcePatchCall<'a, C> {
52936        self._scopes.clear();
52937        self
52938    }
52939}
52940
52941/// Downloads media. Download is supported on the URI `/download/{resource_name=**}?alt=media.` **Note**: Download requests will not be successful without including `alt=media` query string.
52942///
52943/// This method supports **media download**. To enable it, adjust the builder like this:
52944/// `.param("alt", "media")`.
52945/// Please note that due to missing multi-part support on the server side, you will only receive the media,
52946/// but not the `GoogleBytestreamMedia` structure that you would usually get. The latter will be a default value.
52947///
52948/// A builder for the *download* method supported by a *media* resource.
52949/// It is not used directly, but through a [`MediaMethods`] instance.
52950///
52951/// # Example
52952///
52953/// Instantiate a resource method builder
52954///
52955/// ```test_harness,no_run
52956/// # extern crate hyper;
52957/// # extern crate hyper_rustls;
52958/// # extern crate google_displayvideo1 as displayvideo1;
52959/// # async fn dox() {
52960/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
52961///
52962/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
52963/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
52964/// #     secret,
52965/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
52966/// # ).build().await.unwrap();
52967///
52968/// # let client = hyper_util::client::legacy::Client::builder(
52969/// #     hyper_util::rt::TokioExecutor::new()
52970/// # )
52971/// # .build(
52972/// #     hyper_rustls::HttpsConnectorBuilder::new()
52973/// #         .with_native_roots()
52974/// #         .unwrap()
52975/// #         .https_or_http()
52976/// #         .enable_http1()
52977/// #         .build()
52978/// # );
52979/// # let mut hub = DisplayVideo::new(client, auth);
52980/// // You can configure optional parameters by calling the respective setters at will, and
52981/// // execute the final call using `doit()`.
52982/// // Values shown here are possibly random and not representative !
52983/// let result = hub.media().download("resourceName")
52984///              .doit().await;
52985/// # }
52986/// ```
52987pub struct MediaDownloadCall<'a, C>
52988where
52989    C: 'a,
52990{
52991    hub: &'a DisplayVideo<C>,
52992    _resource_name: String,
52993    _delegate: Option<&'a mut dyn common::Delegate>,
52994    _additional_params: HashMap<String, String>,
52995    _scopes: BTreeSet<String>,
52996}
52997
52998impl<'a, C> common::CallBuilder for MediaDownloadCall<'a, C> {}
52999
53000impl<'a, C> MediaDownloadCall<'a, C>
53001where
53002    C: common::Connector,
53003{
53004    /// Perform the operation you have build so far.
53005    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleBytestreamMedia)> {
53006        use std::borrow::Cow;
53007        use std::io::{Read, Seek};
53008
53009        use common::{url::Params, ToParts};
53010        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
53011
53012        let mut dd = common::DefaultDelegate;
53013        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
53014        dlg.begin(common::MethodInfo {
53015            id: "displayvideo.media.download",
53016            http_method: hyper::Method::GET,
53017        });
53018
53019        for &field in ["resourceName"].iter() {
53020            if self._additional_params.contains_key(field) {
53021                dlg.finished(false);
53022                return Err(common::Error::FieldClash(field));
53023            }
53024        }
53025
53026        let mut params = Params::with_capacity(2 + self._additional_params.len());
53027        params.push("resourceName", self._resource_name);
53028
53029        params.extend(self._additional_params.iter());
53030
53031        let (alt_field_missing, enable_resource_parsing) = {
53032            if let Some(value) = params.get("alt") {
53033                (false, value == "json")
53034            } else {
53035                (true, true)
53036            }
53037        };
53038        if alt_field_missing {
53039            params.push("alt", "json");
53040        }
53041        let mut url = self.hub._base_url.clone() + "download/{+resourceName}";
53042        if self._scopes.is_empty() {
53043            self._scopes
53044                .insert(Scope::DisplayVideo.as_ref().to_string());
53045        }
53046
53047        #[allow(clippy::single_element_loop)]
53048        for &(find_this, param_name) in [("{+resourceName}", "resourceName")].iter() {
53049            url = params.uri_replacement(url, param_name, find_this, true);
53050        }
53051        {
53052            let to_remove = ["resourceName"];
53053            params.remove_params(&to_remove);
53054        }
53055
53056        let url = params.parse_with_url(&url);
53057
53058        loop {
53059            let token = match self
53060                .hub
53061                .auth
53062                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
53063                .await
53064            {
53065                Ok(token) => token,
53066                Err(e) => match dlg.token(e) {
53067                    Ok(token) => token,
53068                    Err(e) => {
53069                        dlg.finished(false);
53070                        return Err(common::Error::MissingToken(e));
53071                    }
53072                },
53073            };
53074            let mut req_result = {
53075                let client = &self.hub.client;
53076                dlg.pre_request();
53077                let mut req_builder = hyper::Request::builder()
53078                    .method(hyper::Method::GET)
53079                    .uri(url.as_str())
53080                    .header(USER_AGENT, self.hub._user_agent.clone());
53081
53082                if let Some(token) = token.as_ref() {
53083                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
53084                }
53085
53086                let request = req_builder
53087                    .header(CONTENT_LENGTH, 0_u64)
53088                    .body(common::to_body::<String>(None));
53089
53090                client.request(request.unwrap()).await
53091            };
53092
53093            match req_result {
53094                Err(err) => {
53095                    if let common::Retry::After(d) = dlg.http_error(&err) {
53096                        sleep(d).await;
53097                        continue;
53098                    }
53099                    dlg.finished(false);
53100                    return Err(common::Error::HttpError(err));
53101                }
53102                Ok(res) => {
53103                    let (mut parts, body) = res.into_parts();
53104                    let mut body = common::Body::new(body);
53105                    if !parts.status.is_success() {
53106                        let bytes = common::to_bytes(body).await.unwrap_or_default();
53107                        let error = serde_json::from_str(&common::to_string(&bytes));
53108                        let response = common::to_response(parts, bytes.into());
53109
53110                        if let common::Retry::After(d) =
53111                            dlg.http_failure(&response, error.as_ref().ok())
53112                        {
53113                            sleep(d).await;
53114                            continue;
53115                        }
53116
53117                        dlg.finished(false);
53118
53119                        return Err(match error {
53120                            Ok(value) => common::Error::BadRequest(value),
53121                            _ => common::Error::Failure(response),
53122                        });
53123                    }
53124                    let response = if enable_resource_parsing {
53125                        let bytes = common::to_bytes(body).await.unwrap_or_default();
53126                        let encoded = common::to_string(&bytes);
53127                        match serde_json::from_str(&encoded) {
53128                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
53129                            Err(error) => {
53130                                dlg.response_json_decode_error(&encoded, &error);
53131                                return Err(common::Error::JsonDecodeError(
53132                                    encoded.to_string(),
53133                                    error,
53134                                ));
53135                            }
53136                        }
53137                    } else {
53138                        (
53139                            common::Response::from_parts(parts, body),
53140                            Default::default(),
53141                        )
53142                    };
53143
53144                    dlg.finished(true);
53145                    return Ok(response);
53146                }
53147            }
53148        }
53149    }
53150
53151    /// Name of the media that is being downloaded. See ReadRequest.resource_name.
53152    ///
53153    /// Sets the *resource name* path property to the given value.
53154    ///
53155    /// Even though the property as already been set when instantiating this call,
53156    /// we provide this method for API completeness.
53157    pub fn resource_name(mut self, new_value: &str) -> MediaDownloadCall<'a, C> {
53158        self._resource_name = new_value.to_string();
53159        self
53160    }
53161    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
53162    /// while executing the actual API request.
53163    ///
53164    /// ````text
53165    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
53166    /// ````
53167    ///
53168    /// Sets the *delegate* property to the given value.
53169    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> MediaDownloadCall<'a, C> {
53170        self._delegate = Some(new_value);
53171        self
53172    }
53173
53174    /// Set any additional parameter of the query string used in the request.
53175    /// It should be used to set parameters which are not yet available through their own
53176    /// setters.
53177    ///
53178    /// Please note that this method must not be used to set any of the known parameters
53179    /// which have their own setter method. If done anyway, the request will fail.
53180    ///
53181    /// # Additional Parameters
53182    ///
53183    /// * *$.xgafv* (query-string) - V1 error format.
53184    /// * *access_token* (query-string) - OAuth access token.
53185    /// * *alt* (query-string) - Data format for response.
53186    /// * *callback* (query-string) - JSONP
53187    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
53188    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
53189    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
53190    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
53191    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
53192    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
53193    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
53194    pub fn param<T>(mut self, name: T, value: T) -> MediaDownloadCall<'a, C>
53195    where
53196        T: AsRef<str>,
53197    {
53198        self._additional_params
53199            .insert(name.as_ref().to_string(), value.as_ref().to_string());
53200        self
53201    }
53202
53203    /// Identifies the authorization scope for the method you are building.
53204    ///
53205    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
53206    /// [`Scope::DisplayVideo`].
53207    ///
53208    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
53209    /// tokens for more than one scope.
53210    ///
53211    /// Usually there is more than one suitable scope to authorize an operation, some of which may
53212    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
53213    /// sufficient, a read-write scope will do as well.
53214    pub fn add_scope<St>(mut self, scope: St) -> MediaDownloadCall<'a, C>
53215    where
53216        St: AsRef<str>,
53217    {
53218        self._scopes.insert(String::from(scope.as_ref()));
53219        self
53220    }
53221    /// Identifies the authorization scope(s) for the method you are building.
53222    ///
53223    /// See [`Self::add_scope()`] for details.
53224    pub fn add_scopes<I, St>(mut self, scopes: I) -> MediaDownloadCall<'a, C>
53225    where
53226        I: IntoIterator<Item = St>,
53227        St: AsRef<str>,
53228    {
53229        self._scopes
53230            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
53231        self
53232    }
53233
53234    /// Removes all scopes, and no default scope will be used either.
53235    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
53236    /// for details).
53237    pub fn clear_scopes(mut self) -> MediaDownloadCall<'a, C> {
53238        self._scopes.clear();
53239        self
53240    }
53241}
53242
53243/// Uploads media. Upload is supported on the URI `/upload/media/{resource_name=**}?upload_type=media.` **Note**: Upload requests will not be successful without including `upload_type=media` query string.
53244///
53245/// A builder for the *upload* method supported by a *media* resource.
53246/// It is not used directly, but through a [`MediaMethods`] instance.
53247///
53248/// # Example
53249///
53250/// Instantiate a resource method builder
53251///
53252/// ```test_harness,no_run
53253/// # extern crate hyper;
53254/// # extern crate hyper_rustls;
53255/// # extern crate google_displayvideo1 as displayvideo1;
53256/// use displayvideo1::api::GoogleBytestreamMedia;
53257/// use std::fs;
53258/// # async fn dox() {
53259/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53260///
53261/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
53262/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
53263/// #     secret,
53264/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
53265/// # ).build().await.unwrap();
53266///
53267/// # let client = hyper_util::client::legacy::Client::builder(
53268/// #     hyper_util::rt::TokioExecutor::new()
53269/// # )
53270/// # .build(
53271/// #     hyper_rustls::HttpsConnectorBuilder::new()
53272/// #         .with_native_roots()
53273/// #         .unwrap()
53274/// #         .https_or_http()
53275/// #         .enable_http1()
53276/// #         .build()
53277/// # );
53278/// # let mut hub = DisplayVideo::new(client, auth);
53279/// // As the method needs a request, you would usually fill it with the desired information
53280/// // into the respective structure. Some of the parts shown here might not be applicable !
53281/// // Values shown here are possibly random and not representative !
53282/// let mut req = GoogleBytestreamMedia::default();
53283///
53284/// // You can configure optional parameters by calling the respective setters at will, and
53285/// // execute the final call using `upload(...)`.
53286/// // Values shown here are possibly random and not representative !
53287/// let result = hub.media().upload(req, "resourceName")
53288///              .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await;
53289/// # }
53290/// ```
53291pub struct MediaUploadCall<'a, C>
53292where
53293    C: 'a,
53294{
53295    hub: &'a DisplayVideo<C>,
53296    _request: GoogleBytestreamMedia,
53297    _resource_name: String,
53298    _delegate: Option<&'a mut dyn common::Delegate>,
53299    _additional_params: HashMap<String, String>,
53300    _scopes: BTreeSet<String>,
53301}
53302
53303impl<'a, C> common::CallBuilder for MediaUploadCall<'a, C> {}
53304
53305impl<'a, C> MediaUploadCall<'a, C>
53306where
53307    C: common::Connector,
53308{
53309    /// Perform the operation you have build so far.
53310    async fn doit<RS>(
53311        mut self,
53312        mut reader: RS,
53313        reader_mime_type: mime::Mime,
53314        protocol: common::UploadProtocol,
53315    ) -> common::Result<(common::Response, GoogleBytestreamMedia)>
53316    where
53317        RS: common::ReadSeek,
53318    {
53319        use std::borrow::Cow;
53320        use std::io::{Read, Seek};
53321
53322        use common::{url::Params, ToParts};
53323        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
53324
53325        let mut dd = common::DefaultDelegate;
53326        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
53327        dlg.begin(common::MethodInfo {
53328            id: "displayvideo.media.upload",
53329            http_method: hyper::Method::POST,
53330        });
53331
53332        for &field in ["alt", "resourceName"].iter() {
53333            if self._additional_params.contains_key(field) {
53334                dlg.finished(false);
53335                return Err(common::Error::FieldClash(field));
53336            }
53337        }
53338
53339        let mut params = Params::with_capacity(4 + self._additional_params.len());
53340        params.push("resourceName", self._resource_name);
53341
53342        params.extend(self._additional_params.iter());
53343
53344        params.push("alt", "json");
53345        let (mut url, upload_type) = if protocol == common::UploadProtocol::Simple {
53346            (
53347                self.hub._root_url.clone() + "upload/media/{+resourceName}",
53348                "multipart",
53349            )
53350        } else {
53351            unreachable!()
53352        };
53353        params.push("uploadType", upload_type);
53354        if self._scopes.is_empty() {
53355            self._scopes
53356                .insert(Scope::DisplayVideo.as_ref().to_string());
53357        }
53358
53359        #[allow(clippy::single_element_loop)]
53360        for &(find_this, param_name) in [("{+resourceName}", "resourceName")].iter() {
53361            url = params.uri_replacement(url, param_name, find_this, true);
53362        }
53363        {
53364            let to_remove = ["resourceName"];
53365            params.remove_params(&to_remove);
53366        }
53367
53368        let url = params.parse_with_url(&url);
53369
53370        let mut json_mime_type = mime::APPLICATION_JSON;
53371        let mut request_value_reader = {
53372            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
53373            common::remove_json_null_values(&mut value);
53374            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
53375            serde_json::to_writer(&mut dst, &value).unwrap();
53376            dst
53377        };
53378        let request_size = request_value_reader
53379            .seek(std::io::SeekFrom::End(0))
53380            .unwrap();
53381        request_value_reader
53382            .seek(std::io::SeekFrom::Start(0))
53383            .unwrap();
53384
53385        loop {
53386            let token = match self
53387                .hub
53388                .auth
53389                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
53390                .await
53391            {
53392                Ok(token) => token,
53393                Err(e) => match dlg.token(e) {
53394                    Ok(token) => token,
53395                    Err(e) => {
53396                        dlg.finished(false);
53397                        return Err(common::Error::MissingToken(e));
53398                    }
53399                },
53400            };
53401            request_value_reader
53402                .seek(std::io::SeekFrom::Start(0))
53403                .unwrap();
53404            let mut req_result = {
53405                let mut mp_reader: common::MultiPartReader = Default::default();
53406                let (mut body_reader, content_type) = match protocol {
53407                    common::UploadProtocol::Simple => {
53408                        mp_reader.reserve_exact(2);
53409                        let size = reader.seek(std::io::SeekFrom::End(0)).unwrap();
53410                        reader.seek(std::io::SeekFrom::Start(0)).unwrap();
53411
53412                        mp_reader
53413                            .add_part(
53414                                &mut request_value_reader,
53415                                request_size,
53416                                json_mime_type.clone(),
53417                            )
53418                            .add_part(&mut reader, size, reader_mime_type.clone());
53419                        (
53420                            &mut mp_reader as &mut (dyn std::io::Read + Send),
53421                            common::MultiPartReader::mime_type(),
53422                        )
53423                    }
53424                    _ => (
53425                        &mut request_value_reader as &mut (dyn std::io::Read + Send),
53426                        json_mime_type.clone(),
53427                    ),
53428                };
53429                let client = &self.hub.client;
53430                dlg.pre_request();
53431                let mut req_builder = hyper::Request::builder()
53432                    .method(hyper::Method::POST)
53433                    .uri(url.as_str())
53434                    .header(USER_AGENT, self.hub._user_agent.clone());
53435
53436                if let Some(token) = token.as_ref() {
53437                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
53438                }
53439
53440                let mut body_reader_bytes = vec![];
53441                body_reader.read_to_end(&mut body_reader_bytes).unwrap();
53442                let request = req_builder
53443                    .header(CONTENT_TYPE, content_type.to_string())
53444                    .body(common::to_body(body_reader_bytes.into()));
53445
53446                client.request(request.unwrap()).await
53447            };
53448
53449            match req_result {
53450                Err(err) => {
53451                    if let common::Retry::After(d) = dlg.http_error(&err) {
53452                        sleep(d).await;
53453                        continue;
53454                    }
53455                    dlg.finished(false);
53456                    return Err(common::Error::HttpError(err));
53457                }
53458                Ok(res) => {
53459                    let (mut parts, body) = res.into_parts();
53460                    let mut body = common::Body::new(body);
53461                    if !parts.status.is_success() {
53462                        let bytes = common::to_bytes(body).await.unwrap_or_default();
53463                        let error = serde_json::from_str(&common::to_string(&bytes));
53464                        let response = common::to_response(parts, bytes.into());
53465
53466                        if let common::Retry::After(d) =
53467                            dlg.http_failure(&response, error.as_ref().ok())
53468                        {
53469                            sleep(d).await;
53470                            continue;
53471                        }
53472
53473                        dlg.finished(false);
53474
53475                        return Err(match error {
53476                            Ok(value) => common::Error::BadRequest(value),
53477                            _ => common::Error::Failure(response),
53478                        });
53479                    }
53480                    let response = {
53481                        let bytes = common::to_bytes(body).await.unwrap_or_default();
53482                        let encoded = common::to_string(&bytes);
53483                        match serde_json::from_str(&encoded) {
53484                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
53485                            Err(error) => {
53486                                dlg.response_json_decode_error(&encoded, &error);
53487                                return Err(common::Error::JsonDecodeError(
53488                                    encoded.to_string(),
53489                                    error,
53490                                ));
53491                            }
53492                        }
53493                    };
53494
53495                    dlg.finished(true);
53496                    return Ok(response);
53497                }
53498            }
53499        }
53500    }
53501
53502    /// Upload media all at once.
53503    /// If the upload fails for whichever reason, all progress is lost.
53504    ///
53505    /// * *multipart*: yes
53506    /// * *max size*: 0kb
53507    /// * *valid mime types*: '*/*'
53508    pub async fn upload<RS>(
53509        self,
53510        stream: RS,
53511        mime_type: mime::Mime,
53512    ) -> common::Result<(common::Response, GoogleBytestreamMedia)>
53513    where
53514        RS: common::ReadSeek,
53515    {
53516        self.doit(stream, mime_type, common::UploadProtocol::Simple)
53517            .await
53518    }
53519
53520    ///
53521    /// Sets the *request* property to the given value.
53522    ///
53523    /// Even though the property as already been set when instantiating this call,
53524    /// we provide this method for API completeness.
53525    pub fn request(mut self, new_value: GoogleBytestreamMedia) -> MediaUploadCall<'a, C> {
53526        self._request = new_value;
53527        self
53528    }
53529    /// Name of the media that is being downloaded. See ReadRequest.resource_name.
53530    ///
53531    /// Sets the *resource name* path property to the given value.
53532    ///
53533    /// Even though the property as already been set when instantiating this call,
53534    /// we provide this method for API completeness.
53535    pub fn resource_name(mut self, new_value: &str) -> MediaUploadCall<'a, C> {
53536        self._resource_name = new_value.to_string();
53537        self
53538    }
53539    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
53540    /// while executing the actual API request.
53541    ///
53542    /// ````text
53543    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
53544    /// ````
53545    ///
53546    /// Sets the *delegate* property to the given value.
53547    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> MediaUploadCall<'a, C> {
53548        self._delegate = Some(new_value);
53549        self
53550    }
53551
53552    /// Set any additional parameter of the query string used in the request.
53553    /// It should be used to set parameters which are not yet available through their own
53554    /// setters.
53555    ///
53556    /// Please note that this method must not be used to set any of the known parameters
53557    /// which have their own setter method. If done anyway, the request will fail.
53558    ///
53559    /// # Additional Parameters
53560    ///
53561    /// * *$.xgafv* (query-string) - V1 error format.
53562    /// * *access_token* (query-string) - OAuth access token.
53563    /// * *alt* (query-string) - Data format for response.
53564    /// * *callback* (query-string) - JSONP
53565    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
53566    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
53567    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
53568    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
53569    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
53570    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
53571    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
53572    pub fn param<T>(mut self, name: T, value: T) -> MediaUploadCall<'a, C>
53573    where
53574        T: AsRef<str>,
53575    {
53576        self._additional_params
53577            .insert(name.as_ref().to_string(), value.as_ref().to_string());
53578        self
53579    }
53580
53581    /// Identifies the authorization scope for the method you are building.
53582    ///
53583    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
53584    /// [`Scope::DisplayVideo`].
53585    ///
53586    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
53587    /// tokens for more than one scope.
53588    ///
53589    /// Usually there is more than one suitable scope to authorize an operation, some of which may
53590    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
53591    /// sufficient, a read-write scope will do as well.
53592    pub fn add_scope<St>(mut self, scope: St) -> MediaUploadCall<'a, C>
53593    where
53594        St: AsRef<str>,
53595    {
53596        self._scopes.insert(String::from(scope.as_ref()));
53597        self
53598    }
53599    /// Identifies the authorization scope(s) for the method you are building.
53600    ///
53601    /// See [`Self::add_scope()`] for details.
53602    pub fn add_scopes<I, St>(mut self, scopes: I) -> MediaUploadCall<'a, C>
53603    where
53604        I: IntoIterator<Item = St>,
53605        St: AsRef<str>,
53606    {
53607        self._scopes
53608            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
53609        self
53610    }
53611
53612    /// Removes all scopes, and no default scope will be used either.
53613    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
53614    /// for details).
53615    pub fn clear_scopes(mut self) -> MediaUploadCall<'a, C> {
53616        self._scopes.clear();
53617        self
53618    }
53619}
53620
53621/// Bulk edits sites under a single channel. The operation will delete the sites provided in BulkEditSitesRequest.deleted_sites and then create the sites provided in BulkEditSitesRequest.created_sites.
53622///
53623/// A builder for the *channels.sites.bulkEdit* method supported by a *partner* resource.
53624/// It is not used directly, but through a [`PartnerMethods`] instance.
53625///
53626/// # Example
53627///
53628/// Instantiate a resource method builder
53629///
53630/// ```test_harness,no_run
53631/// # extern crate hyper;
53632/// # extern crate hyper_rustls;
53633/// # extern crate google_displayvideo1 as displayvideo1;
53634/// use displayvideo1::api::BulkEditSitesRequest;
53635/// # async fn dox() {
53636/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53637///
53638/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
53639/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
53640/// #     secret,
53641/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
53642/// # ).build().await.unwrap();
53643///
53644/// # let client = hyper_util::client::legacy::Client::builder(
53645/// #     hyper_util::rt::TokioExecutor::new()
53646/// # )
53647/// # .build(
53648/// #     hyper_rustls::HttpsConnectorBuilder::new()
53649/// #         .with_native_roots()
53650/// #         .unwrap()
53651/// #         .https_or_http()
53652/// #         .enable_http1()
53653/// #         .build()
53654/// # );
53655/// # let mut hub = DisplayVideo::new(client, auth);
53656/// // As the method needs a request, you would usually fill it with the desired information
53657/// // into the respective structure. Some of the parts shown here might not be applicable !
53658/// // Values shown here are possibly random and not representative !
53659/// let mut req = BulkEditSitesRequest::default();
53660///
53661/// // You can configure optional parameters by calling the respective setters at will, and
53662/// // execute the final call using `doit()`.
53663/// // Values shown here are possibly random and not representative !
53664/// let result = hub.partners().channels_sites_bulk_edit(req, -91, -73)
53665///              .doit().await;
53666/// # }
53667/// ```
53668pub struct PartnerChannelSiteBulkEditCall<'a, C>
53669where
53670    C: 'a,
53671{
53672    hub: &'a DisplayVideo<C>,
53673    _request: BulkEditSitesRequest,
53674    _partner_id: i64,
53675    _channel_id: i64,
53676    _delegate: Option<&'a mut dyn common::Delegate>,
53677    _additional_params: HashMap<String, String>,
53678    _scopes: BTreeSet<String>,
53679}
53680
53681impl<'a, C> common::CallBuilder for PartnerChannelSiteBulkEditCall<'a, C> {}
53682
53683impl<'a, C> PartnerChannelSiteBulkEditCall<'a, C>
53684where
53685    C: common::Connector,
53686{
53687    /// Perform the operation you have build so far.
53688    pub async fn doit(mut self) -> common::Result<(common::Response, BulkEditSitesResponse)> {
53689        use std::borrow::Cow;
53690        use std::io::{Read, Seek};
53691
53692        use common::{url::Params, ToParts};
53693        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
53694
53695        let mut dd = common::DefaultDelegate;
53696        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
53697        dlg.begin(common::MethodInfo {
53698            id: "displayvideo.partners.channels.sites.bulkEdit",
53699            http_method: hyper::Method::POST,
53700        });
53701
53702        for &field in ["alt", "partnerId", "channelId"].iter() {
53703            if self._additional_params.contains_key(field) {
53704                dlg.finished(false);
53705                return Err(common::Error::FieldClash(field));
53706            }
53707        }
53708
53709        let mut params = Params::with_capacity(5 + self._additional_params.len());
53710        params.push("partnerId", self._partner_id.to_string());
53711        params.push("channelId", self._channel_id.to_string());
53712
53713        params.extend(self._additional_params.iter());
53714
53715        params.push("alt", "json");
53716        let mut url = self.hub._base_url.clone()
53717            + "v1/partners/{partnerId}/channels/{+channelId}/sites:bulkEdit";
53718        if self._scopes.is_empty() {
53719            self._scopes
53720                .insert(Scope::DisplayVideo.as_ref().to_string());
53721        }
53722
53723        #[allow(clippy::single_element_loop)]
53724        for &(find_this, param_name) in
53725            [("{partnerId}", "partnerId"), ("{+channelId}", "channelId")].iter()
53726        {
53727            url = params.uri_replacement(url, param_name, find_this, true);
53728        }
53729        {
53730            let to_remove = ["channelId", "partnerId"];
53731            params.remove_params(&to_remove);
53732        }
53733
53734        let url = params.parse_with_url(&url);
53735
53736        let mut json_mime_type = mime::APPLICATION_JSON;
53737        let mut request_value_reader = {
53738            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
53739            common::remove_json_null_values(&mut value);
53740            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
53741            serde_json::to_writer(&mut dst, &value).unwrap();
53742            dst
53743        };
53744        let request_size = request_value_reader
53745            .seek(std::io::SeekFrom::End(0))
53746            .unwrap();
53747        request_value_reader
53748            .seek(std::io::SeekFrom::Start(0))
53749            .unwrap();
53750
53751        loop {
53752            let token = match self
53753                .hub
53754                .auth
53755                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
53756                .await
53757            {
53758                Ok(token) => token,
53759                Err(e) => match dlg.token(e) {
53760                    Ok(token) => token,
53761                    Err(e) => {
53762                        dlg.finished(false);
53763                        return Err(common::Error::MissingToken(e));
53764                    }
53765                },
53766            };
53767            request_value_reader
53768                .seek(std::io::SeekFrom::Start(0))
53769                .unwrap();
53770            let mut req_result = {
53771                let client = &self.hub.client;
53772                dlg.pre_request();
53773                let mut req_builder = hyper::Request::builder()
53774                    .method(hyper::Method::POST)
53775                    .uri(url.as_str())
53776                    .header(USER_AGENT, self.hub._user_agent.clone());
53777
53778                if let Some(token) = token.as_ref() {
53779                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
53780                }
53781
53782                let request = req_builder
53783                    .header(CONTENT_TYPE, json_mime_type.to_string())
53784                    .header(CONTENT_LENGTH, request_size as u64)
53785                    .body(common::to_body(
53786                        request_value_reader.get_ref().clone().into(),
53787                    ));
53788
53789                client.request(request.unwrap()).await
53790            };
53791
53792            match req_result {
53793                Err(err) => {
53794                    if let common::Retry::After(d) = dlg.http_error(&err) {
53795                        sleep(d).await;
53796                        continue;
53797                    }
53798                    dlg.finished(false);
53799                    return Err(common::Error::HttpError(err));
53800                }
53801                Ok(res) => {
53802                    let (mut parts, body) = res.into_parts();
53803                    let mut body = common::Body::new(body);
53804                    if !parts.status.is_success() {
53805                        let bytes = common::to_bytes(body).await.unwrap_or_default();
53806                        let error = serde_json::from_str(&common::to_string(&bytes));
53807                        let response = common::to_response(parts, bytes.into());
53808
53809                        if let common::Retry::After(d) =
53810                            dlg.http_failure(&response, error.as_ref().ok())
53811                        {
53812                            sleep(d).await;
53813                            continue;
53814                        }
53815
53816                        dlg.finished(false);
53817
53818                        return Err(match error {
53819                            Ok(value) => common::Error::BadRequest(value),
53820                            _ => common::Error::Failure(response),
53821                        });
53822                    }
53823                    let response = {
53824                        let bytes = common::to_bytes(body).await.unwrap_or_default();
53825                        let encoded = common::to_string(&bytes);
53826                        match serde_json::from_str(&encoded) {
53827                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
53828                            Err(error) => {
53829                                dlg.response_json_decode_error(&encoded, &error);
53830                                return Err(common::Error::JsonDecodeError(
53831                                    encoded.to_string(),
53832                                    error,
53833                                ));
53834                            }
53835                        }
53836                    };
53837
53838                    dlg.finished(true);
53839                    return Ok(response);
53840                }
53841            }
53842        }
53843    }
53844
53845    ///
53846    /// Sets the *request* property to the given value.
53847    ///
53848    /// Even though the property as already been set when instantiating this call,
53849    /// we provide this method for API completeness.
53850    pub fn request(
53851        mut self,
53852        new_value: BulkEditSitesRequest,
53853    ) -> PartnerChannelSiteBulkEditCall<'a, C> {
53854        self._request = new_value;
53855        self
53856    }
53857    /// The ID of the partner that owns the parent channel.
53858    ///
53859    /// Sets the *partner id* path property to the given value.
53860    ///
53861    /// Even though the property as already been set when instantiating this call,
53862    /// we provide this method for API completeness.
53863    pub fn partner_id(mut self, new_value: i64) -> PartnerChannelSiteBulkEditCall<'a, C> {
53864        self._partner_id = new_value;
53865        self
53866    }
53867    /// Required. The ID of the parent channel to which the sites belong.
53868    ///
53869    /// Sets the *channel id* path property to the given value.
53870    ///
53871    /// Even though the property as already been set when instantiating this call,
53872    /// we provide this method for API completeness.
53873    pub fn channel_id(mut self, new_value: i64) -> PartnerChannelSiteBulkEditCall<'a, C> {
53874        self._channel_id = new_value;
53875        self
53876    }
53877    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
53878    /// while executing the actual API request.
53879    ///
53880    /// ````text
53881    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
53882    /// ````
53883    ///
53884    /// Sets the *delegate* property to the given value.
53885    pub fn delegate(
53886        mut self,
53887        new_value: &'a mut dyn common::Delegate,
53888    ) -> PartnerChannelSiteBulkEditCall<'a, C> {
53889        self._delegate = Some(new_value);
53890        self
53891    }
53892
53893    /// Set any additional parameter of the query string used in the request.
53894    /// It should be used to set parameters which are not yet available through their own
53895    /// setters.
53896    ///
53897    /// Please note that this method must not be used to set any of the known parameters
53898    /// which have their own setter method. If done anyway, the request will fail.
53899    ///
53900    /// # Additional Parameters
53901    ///
53902    /// * *$.xgafv* (query-string) - V1 error format.
53903    /// * *access_token* (query-string) - OAuth access token.
53904    /// * *alt* (query-string) - Data format for response.
53905    /// * *callback* (query-string) - JSONP
53906    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
53907    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
53908    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
53909    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
53910    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
53911    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
53912    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
53913    pub fn param<T>(mut self, name: T, value: T) -> PartnerChannelSiteBulkEditCall<'a, C>
53914    where
53915        T: AsRef<str>,
53916    {
53917        self._additional_params
53918            .insert(name.as_ref().to_string(), value.as_ref().to_string());
53919        self
53920    }
53921
53922    /// Identifies the authorization scope for the method you are building.
53923    ///
53924    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
53925    /// [`Scope::DisplayVideo`].
53926    ///
53927    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
53928    /// tokens for more than one scope.
53929    ///
53930    /// Usually there is more than one suitable scope to authorize an operation, some of which may
53931    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
53932    /// sufficient, a read-write scope will do as well.
53933    pub fn add_scope<St>(mut self, scope: St) -> PartnerChannelSiteBulkEditCall<'a, C>
53934    where
53935        St: AsRef<str>,
53936    {
53937        self._scopes.insert(String::from(scope.as_ref()));
53938        self
53939    }
53940    /// Identifies the authorization scope(s) for the method you are building.
53941    ///
53942    /// See [`Self::add_scope()`] for details.
53943    pub fn add_scopes<I, St>(mut self, scopes: I) -> PartnerChannelSiteBulkEditCall<'a, C>
53944    where
53945        I: IntoIterator<Item = St>,
53946        St: AsRef<str>,
53947    {
53948        self._scopes
53949            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
53950        self
53951    }
53952
53953    /// Removes all scopes, and no default scope will be used either.
53954    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
53955    /// for details).
53956    pub fn clear_scopes(mut self) -> PartnerChannelSiteBulkEditCall<'a, C> {
53957        self._scopes.clear();
53958        self
53959    }
53960}
53961
53962/// Creates a site in a channel.
53963///
53964/// A builder for the *channels.sites.create* method supported by a *partner* resource.
53965/// It is not used directly, but through a [`PartnerMethods`] instance.
53966///
53967/// # Example
53968///
53969/// Instantiate a resource method builder
53970///
53971/// ```test_harness,no_run
53972/// # extern crate hyper;
53973/// # extern crate hyper_rustls;
53974/// # extern crate google_displayvideo1 as displayvideo1;
53975/// use displayvideo1::api::Site;
53976/// # async fn dox() {
53977/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53978///
53979/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
53980/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
53981/// #     secret,
53982/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
53983/// # ).build().await.unwrap();
53984///
53985/// # let client = hyper_util::client::legacy::Client::builder(
53986/// #     hyper_util::rt::TokioExecutor::new()
53987/// # )
53988/// # .build(
53989/// #     hyper_rustls::HttpsConnectorBuilder::new()
53990/// #         .with_native_roots()
53991/// #         .unwrap()
53992/// #         .https_or_http()
53993/// #         .enable_http1()
53994/// #         .build()
53995/// # );
53996/// # let mut hub = DisplayVideo::new(client, auth);
53997/// // As the method needs a request, you would usually fill it with the desired information
53998/// // into the respective structure. Some of the parts shown here might not be applicable !
53999/// // Values shown here are possibly random and not representative !
54000/// let mut req = Site::default();
54001///
54002/// // You can configure optional parameters by calling the respective setters at will, and
54003/// // execute the final call using `doit()`.
54004/// // Values shown here are possibly random and not representative !
54005/// let result = hub.partners().channels_sites_create(req, -37, -78)
54006///              .advertiser_id(-46)
54007///              .doit().await;
54008/// # }
54009/// ```
54010pub struct PartnerChannelSiteCreateCall<'a, C>
54011where
54012    C: 'a,
54013{
54014    hub: &'a DisplayVideo<C>,
54015    _request: Site,
54016    _partner_id: i64,
54017    _channel_id: i64,
54018    _advertiser_id: Option<i64>,
54019    _delegate: Option<&'a mut dyn common::Delegate>,
54020    _additional_params: HashMap<String, String>,
54021    _scopes: BTreeSet<String>,
54022}
54023
54024impl<'a, C> common::CallBuilder for PartnerChannelSiteCreateCall<'a, C> {}
54025
54026impl<'a, C> PartnerChannelSiteCreateCall<'a, C>
54027where
54028    C: common::Connector,
54029{
54030    /// Perform the operation you have build so far.
54031    pub async fn doit(mut self) -> common::Result<(common::Response, Site)> {
54032        use std::borrow::Cow;
54033        use std::io::{Read, Seek};
54034
54035        use common::{url::Params, ToParts};
54036        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
54037
54038        let mut dd = common::DefaultDelegate;
54039        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
54040        dlg.begin(common::MethodInfo {
54041            id: "displayvideo.partners.channels.sites.create",
54042            http_method: hyper::Method::POST,
54043        });
54044
54045        for &field in ["alt", "partnerId", "channelId", "advertiserId"].iter() {
54046            if self._additional_params.contains_key(field) {
54047                dlg.finished(false);
54048                return Err(common::Error::FieldClash(field));
54049            }
54050        }
54051
54052        let mut params = Params::with_capacity(6 + self._additional_params.len());
54053        params.push("partnerId", self._partner_id.to_string());
54054        params.push("channelId", self._channel_id.to_string());
54055        if let Some(value) = self._advertiser_id.as_ref() {
54056            params.push("advertiserId", value.to_string());
54057        }
54058
54059        params.extend(self._additional_params.iter());
54060
54061        params.push("alt", "json");
54062        let mut url =
54063            self.hub._base_url.clone() + "v1/partners/{partnerId}/channels/{+channelId}/sites";
54064        if self._scopes.is_empty() {
54065            self._scopes
54066                .insert(Scope::DisplayVideo.as_ref().to_string());
54067        }
54068
54069        #[allow(clippy::single_element_loop)]
54070        for &(find_this, param_name) in
54071            [("{partnerId}", "partnerId"), ("{+channelId}", "channelId")].iter()
54072        {
54073            url = params.uri_replacement(url, param_name, find_this, true);
54074        }
54075        {
54076            let to_remove = ["channelId", "partnerId"];
54077            params.remove_params(&to_remove);
54078        }
54079
54080        let url = params.parse_with_url(&url);
54081
54082        let mut json_mime_type = mime::APPLICATION_JSON;
54083        let mut request_value_reader = {
54084            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
54085            common::remove_json_null_values(&mut value);
54086            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
54087            serde_json::to_writer(&mut dst, &value).unwrap();
54088            dst
54089        };
54090        let request_size = request_value_reader
54091            .seek(std::io::SeekFrom::End(0))
54092            .unwrap();
54093        request_value_reader
54094            .seek(std::io::SeekFrom::Start(0))
54095            .unwrap();
54096
54097        loop {
54098            let token = match self
54099                .hub
54100                .auth
54101                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
54102                .await
54103            {
54104                Ok(token) => token,
54105                Err(e) => match dlg.token(e) {
54106                    Ok(token) => token,
54107                    Err(e) => {
54108                        dlg.finished(false);
54109                        return Err(common::Error::MissingToken(e));
54110                    }
54111                },
54112            };
54113            request_value_reader
54114                .seek(std::io::SeekFrom::Start(0))
54115                .unwrap();
54116            let mut req_result = {
54117                let client = &self.hub.client;
54118                dlg.pre_request();
54119                let mut req_builder = hyper::Request::builder()
54120                    .method(hyper::Method::POST)
54121                    .uri(url.as_str())
54122                    .header(USER_AGENT, self.hub._user_agent.clone());
54123
54124                if let Some(token) = token.as_ref() {
54125                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
54126                }
54127
54128                let request = req_builder
54129                    .header(CONTENT_TYPE, json_mime_type.to_string())
54130                    .header(CONTENT_LENGTH, request_size as u64)
54131                    .body(common::to_body(
54132                        request_value_reader.get_ref().clone().into(),
54133                    ));
54134
54135                client.request(request.unwrap()).await
54136            };
54137
54138            match req_result {
54139                Err(err) => {
54140                    if let common::Retry::After(d) = dlg.http_error(&err) {
54141                        sleep(d).await;
54142                        continue;
54143                    }
54144                    dlg.finished(false);
54145                    return Err(common::Error::HttpError(err));
54146                }
54147                Ok(res) => {
54148                    let (mut parts, body) = res.into_parts();
54149                    let mut body = common::Body::new(body);
54150                    if !parts.status.is_success() {
54151                        let bytes = common::to_bytes(body).await.unwrap_or_default();
54152                        let error = serde_json::from_str(&common::to_string(&bytes));
54153                        let response = common::to_response(parts, bytes.into());
54154
54155                        if let common::Retry::After(d) =
54156                            dlg.http_failure(&response, error.as_ref().ok())
54157                        {
54158                            sleep(d).await;
54159                            continue;
54160                        }
54161
54162                        dlg.finished(false);
54163
54164                        return Err(match error {
54165                            Ok(value) => common::Error::BadRequest(value),
54166                            _ => common::Error::Failure(response),
54167                        });
54168                    }
54169                    let response = {
54170                        let bytes = common::to_bytes(body).await.unwrap_or_default();
54171                        let encoded = common::to_string(&bytes);
54172                        match serde_json::from_str(&encoded) {
54173                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
54174                            Err(error) => {
54175                                dlg.response_json_decode_error(&encoded, &error);
54176                                return Err(common::Error::JsonDecodeError(
54177                                    encoded.to_string(),
54178                                    error,
54179                                ));
54180                            }
54181                        }
54182                    };
54183
54184                    dlg.finished(true);
54185                    return Ok(response);
54186                }
54187            }
54188        }
54189    }
54190
54191    ///
54192    /// Sets the *request* property to the given value.
54193    ///
54194    /// Even though the property as already been set when instantiating this call,
54195    /// we provide this method for API completeness.
54196    pub fn request(mut self, new_value: Site) -> PartnerChannelSiteCreateCall<'a, C> {
54197        self._request = new_value;
54198        self
54199    }
54200    /// The ID of the partner that owns the parent channel.
54201    ///
54202    /// Sets the *partner id* path property to the given value.
54203    ///
54204    /// Even though the property as already been set when instantiating this call,
54205    /// we provide this method for API completeness.
54206    pub fn partner_id(mut self, new_value: i64) -> PartnerChannelSiteCreateCall<'a, C> {
54207        self._partner_id = new_value;
54208        self
54209    }
54210    /// Required. The ID of the parent channel in which the site will be created.
54211    ///
54212    /// Sets the *channel id* path property to the given value.
54213    ///
54214    /// Even though the property as already been set when instantiating this call,
54215    /// we provide this method for API completeness.
54216    pub fn channel_id(mut self, new_value: i64) -> PartnerChannelSiteCreateCall<'a, C> {
54217        self._channel_id = new_value;
54218        self
54219    }
54220    /// The ID of the advertiser that owns the parent channel.
54221    ///
54222    /// Sets the *advertiser id* query property to the given value.
54223    pub fn advertiser_id(mut self, new_value: i64) -> PartnerChannelSiteCreateCall<'a, C> {
54224        self._advertiser_id = Some(new_value);
54225        self
54226    }
54227    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
54228    /// while executing the actual API request.
54229    ///
54230    /// ````text
54231    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
54232    /// ````
54233    ///
54234    /// Sets the *delegate* property to the given value.
54235    pub fn delegate(
54236        mut self,
54237        new_value: &'a mut dyn common::Delegate,
54238    ) -> PartnerChannelSiteCreateCall<'a, C> {
54239        self._delegate = Some(new_value);
54240        self
54241    }
54242
54243    /// Set any additional parameter of the query string used in the request.
54244    /// It should be used to set parameters which are not yet available through their own
54245    /// setters.
54246    ///
54247    /// Please note that this method must not be used to set any of the known parameters
54248    /// which have their own setter method. If done anyway, the request will fail.
54249    ///
54250    /// # Additional Parameters
54251    ///
54252    /// * *$.xgafv* (query-string) - V1 error format.
54253    /// * *access_token* (query-string) - OAuth access token.
54254    /// * *alt* (query-string) - Data format for response.
54255    /// * *callback* (query-string) - JSONP
54256    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
54257    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
54258    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
54259    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
54260    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
54261    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
54262    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
54263    pub fn param<T>(mut self, name: T, value: T) -> PartnerChannelSiteCreateCall<'a, C>
54264    where
54265        T: AsRef<str>,
54266    {
54267        self._additional_params
54268            .insert(name.as_ref().to_string(), value.as_ref().to_string());
54269        self
54270    }
54271
54272    /// Identifies the authorization scope for the method you are building.
54273    ///
54274    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
54275    /// [`Scope::DisplayVideo`].
54276    ///
54277    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
54278    /// tokens for more than one scope.
54279    ///
54280    /// Usually there is more than one suitable scope to authorize an operation, some of which may
54281    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
54282    /// sufficient, a read-write scope will do as well.
54283    pub fn add_scope<St>(mut self, scope: St) -> PartnerChannelSiteCreateCall<'a, C>
54284    where
54285        St: AsRef<str>,
54286    {
54287        self._scopes.insert(String::from(scope.as_ref()));
54288        self
54289    }
54290    /// Identifies the authorization scope(s) for the method you are building.
54291    ///
54292    /// See [`Self::add_scope()`] for details.
54293    pub fn add_scopes<I, St>(mut self, scopes: I) -> PartnerChannelSiteCreateCall<'a, C>
54294    where
54295        I: IntoIterator<Item = St>,
54296        St: AsRef<str>,
54297    {
54298        self._scopes
54299            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
54300        self
54301    }
54302
54303    /// Removes all scopes, and no default scope will be used either.
54304    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
54305    /// for details).
54306    pub fn clear_scopes(mut self) -> PartnerChannelSiteCreateCall<'a, C> {
54307        self._scopes.clear();
54308        self
54309    }
54310}
54311
54312/// Deletes a site from a channel.
54313///
54314/// A builder for the *channels.sites.delete* method supported by a *partner* resource.
54315/// It is not used directly, but through a [`PartnerMethods`] instance.
54316///
54317/// # Example
54318///
54319/// Instantiate a resource method builder
54320///
54321/// ```test_harness,no_run
54322/// # extern crate hyper;
54323/// # extern crate hyper_rustls;
54324/// # extern crate google_displayvideo1 as displayvideo1;
54325/// # async fn dox() {
54326/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
54327///
54328/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
54329/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
54330/// #     secret,
54331/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
54332/// # ).build().await.unwrap();
54333///
54334/// # let client = hyper_util::client::legacy::Client::builder(
54335/// #     hyper_util::rt::TokioExecutor::new()
54336/// # )
54337/// # .build(
54338/// #     hyper_rustls::HttpsConnectorBuilder::new()
54339/// #         .with_native_roots()
54340/// #         .unwrap()
54341/// #         .https_or_http()
54342/// #         .enable_http1()
54343/// #         .build()
54344/// # );
54345/// # let mut hub = DisplayVideo::new(client, auth);
54346/// // You can configure optional parameters by calling the respective setters at will, and
54347/// // execute the final call using `doit()`.
54348/// // Values shown here are possibly random and not representative !
54349/// let result = hub.partners().channels_sites_delete(-99, -47, "urlOrAppId")
54350///              .advertiser_id(-32)
54351///              .doit().await;
54352/// # }
54353/// ```
54354pub struct PartnerChannelSiteDeleteCall<'a, C>
54355where
54356    C: 'a,
54357{
54358    hub: &'a DisplayVideo<C>,
54359    _partner_id: i64,
54360    _channel_id: i64,
54361    _url_or_app_id: String,
54362    _advertiser_id: Option<i64>,
54363    _delegate: Option<&'a mut dyn common::Delegate>,
54364    _additional_params: HashMap<String, String>,
54365    _scopes: BTreeSet<String>,
54366}
54367
54368impl<'a, C> common::CallBuilder for PartnerChannelSiteDeleteCall<'a, C> {}
54369
54370impl<'a, C> PartnerChannelSiteDeleteCall<'a, C>
54371where
54372    C: common::Connector,
54373{
54374    /// Perform the operation you have build so far.
54375    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
54376        use std::borrow::Cow;
54377        use std::io::{Read, Seek};
54378
54379        use common::{url::Params, ToParts};
54380        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
54381
54382        let mut dd = common::DefaultDelegate;
54383        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
54384        dlg.begin(common::MethodInfo {
54385            id: "displayvideo.partners.channels.sites.delete",
54386            http_method: hyper::Method::DELETE,
54387        });
54388
54389        for &field in [
54390            "alt",
54391            "partnerId",
54392            "channelId",
54393            "urlOrAppId",
54394            "advertiserId",
54395        ]
54396        .iter()
54397        {
54398            if self._additional_params.contains_key(field) {
54399                dlg.finished(false);
54400                return Err(common::Error::FieldClash(field));
54401            }
54402        }
54403
54404        let mut params = Params::with_capacity(6 + self._additional_params.len());
54405        params.push("partnerId", self._partner_id.to_string());
54406        params.push("channelId", self._channel_id.to_string());
54407        params.push("urlOrAppId", self._url_or_app_id);
54408        if let Some(value) = self._advertiser_id.as_ref() {
54409            params.push("advertiserId", value.to_string());
54410        }
54411
54412        params.extend(self._additional_params.iter());
54413
54414        params.push("alt", "json");
54415        let mut url = self.hub._base_url.clone()
54416            + "v1/partners/{partnerId}/channels/{+channelId}/sites/{+urlOrAppId}";
54417        if self._scopes.is_empty() {
54418            self._scopes
54419                .insert(Scope::DisplayVideo.as_ref().to_string());
54420        }
54421
54422        #[allow(clippy::single_element_loop)]
54423        for &(find_this, param_name) in [
54424            ("{partnerId}", "partnerId"),
54425            ("{+channelId}", "channelId"),
54426            ("{+urlOrAppId}", "urlOrAppId"),
54427        ]
54428        .iter()
54429        {
54430            url = params.uri_replacement(url, param_name, find_this, true);
54431        }
54432        {
54433            let to_remove = ["urlOrAppId", "channelId", "partnerId"];
54434            params.remove_params(&to_remove);
54435        }
54436
54437        let url = params.parse_with_url(&url);
54438
54439        loop {
54440            let token = match self
54441                .hub
54442                .auth
54443                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
54444                .await
54445            {
54446                Ok(token) => token,
54447                Err(e) => match dlg.token(e) {
54448                    Ok(token) => token,
54449                    Err(e) => {
54450                        dlg.finished(false);
54451                        return Err(common::Error::MissingToken(e));
54452                    }
54453                },
54454            };
54455            let mut req_result = {
54456                let client = &self.hub.client;
54457                dlg.pre_request();
54458                let mut req_builder = hyper::Request::builder()
54459                    .method(hyper::Method::DELETE)
54460                    .uri(url.as_str())
54461                    .header(USER_AGENT, self.hub._user_agent.clone());
54462
54463                if let Some(token) = token.as_ref() {
54464                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
54465                }
54466
54467                let request = req_builder
54468                    .header(CONTENT_LENGTH, 0_u64)
54469                    .body(common::to_body::<String>(None));
54470
54471                client.request(request.unwrap()).await
54472            };
54473
54474            match req_result {
54475                Err(err) => {
54476                    if let common::Retry::After(d) = dlg.http_error(&err) {
54477                        sleep(d).await;
54478                        continue;
54479                    }
54480                    dlg.finished(false);
54481                    return Err(common::Error::HttpError(err));
54482                }
54483                Ok(res) => {
54484                    let (mut parts, body) = res.into_parts();
54485                    let mut body = common::Body::new(body);
54486                    if !parts.status.is_success() {
54487                        let bytes = common::to_bytes(body).await.unwrap_or_default();
54488                        let error = serde_json::from_str(&common::to_string(&bytes));
54489                        let response = common::to_response(parts, bytes.into());
54490
54491                        if let common::Retry::After(d) =
54492                            dlg.http_failure(&response, error.as_ref().ok())
54493                        {
54494                            sleep(d).await;
54495                            continue;
54496                        }
54497
54498                        dlg.finished(false);
54499
54500                        return Err(match error {
54501                            Ok(value) => common::Error::BadRequest(value),
54502                            _ => common::Error::Failure(response),
54503                        });
54504                    }
54505                    let response = {
54506                        let bytes = common::to_bytes(body).await.unwrap_or_default();
54507                        let encoded = common::to_string(&bytes);
54508                        match serde_json::from_str(&encoded) {
54509                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
54510                            Err(error) => {
54511                                dlg.response_json_decode_error(&encoded, &error);
54512                                return Err(common::Error::JsonDecodeError(
54513                                    encoded.to_string(),
54514                                    error,
54515                                ));
54516                            }
54517                        }
54518                    };
54519
54520                    dlg.finished(true);
54521                    return Ok(response);
54522                }
54523            }
54524        }
54525    }
54526
54527    /// The ID of the partner that owns the parent channel.
54528    ///
54529    /// Sets the *partner id* path property to the given value.
54530    ///
54531    /// Even though the property as already been set when instantiating this call,
54532    /// we provide this method for API completeness.
54533    pub fn partner_id(mut self, new_value: i64) -> PartnerChannelSiteDeleteCall<'a, C> {
54534        self._partner_id = new_value;
54535        self
54536    }
54537    /// Required. The ID of the parent channel to which the site belongs.
54538    ///
54539    /// Sets the *channel id* path property to the given value.
54540    ///
54541    /// Even though the property as already been set when instantiating this call,
54542    /// we provide this method for API completeness.
54543    pub fn channel_id(mut self, new_value: i64) -> PartnerChannelSiteDeleteCall<'a, C> {
54544        self._channel_id = new_value;
54545        self
54546    }
54547    /// Required. The URL or app ID of the site to delete.
54548    ///
54549    /// Sets the *url or app id* path property to the given value.
54550    ///
54551    /// Even though the property as already been set when instantiating this call,
54552    /// we provide this method for API completeness.
54553    pub fn url_or_app_id(mut self, new_value: &str) -> PartnerChannelSiteDeleteCall<'a, C> {
54554        self._url_or_app_id = new_value.to_string();
54555        self
54556    }
54557    /// The ID of the advertiser that owns the parent channel.
54558    ///
54559    /// Sets the *advertiser id* query property to the given value.
54560    pub fn advertiser_id(mut self, new_value: i64) -> PartnerChannelSiteDeleteCall<'a, C> {
54561        self._advertiser_id = Some(new_value);
54562        self
54563    }
54564    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
54565    /// while executing the actual API request.
54566    ///
54567    /// ````text
54568    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
54569    /// ````
54570    ///
54571    /// Sets the *delegate* property to the given value.
54572    pub fn delegate(
54573        mut self,
54574        new_value: &'a mut dyn common::Delegate,
54575    ) -> PartnerChannelSiteDeleteCall<'a, C> {
54576        self._delegate = Some(new_value);
54577        self
54578    }
54579
54580    /// Set any additional parameter of the query string used in the request.
54581    /// It should be used to set parameters which are not yet available through their own
54582    /// setters.
54583    ///
54584    /// Please note that this method must not be used to set any of the known parameters
54585    /// which have their own setter method. If done anyway, the request will fail.
54586    ///
54587    /// # Additional Parameters
54588    ///
54589    /// * *$.xgafv* (query-string) - V1 error format.
54590    /// * *access_token* (query-string) - OAuth access token.
54591    /// * *alt* (query-string) - Data format for response.
54592    /// * *callback* (query-string) - JSONP
54593    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
54594    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
54595    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
54596    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
54597    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
54598    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
54599    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
54600    pub fn param<T>(mut self, name: T, value: T) -> PartnerChannelSiteDeleteCall<'a, C>
54601    where
54602        T: AsRef<str>,
54603    {
54604        self._additional_params
54605            .insert(name.as_ref().to_string(), value.as_ref().to_string());
54606        self
54607    }
54608
54609    /// Identifies the authorization scope for the method you are building.
54610    ///
54611    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
54612    /// [`Scope::DisplayVideo`].
54613    ///
54614    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
54615    /// tokens for more than one scope.
54616    ///
54617    /// Usually there is more than one suitable scope to authorize an operation, some of which may
54618    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
54619    /// sufficient, a read-write scope will do as well.
54620    pub fn add_scope<St>(mut self, scope: St) -> PartnerChannelSiteDeleteCall<'a, C>
54621    where
54622        St: AsRef<str>,
54623    {
54624        self._scopes.insert(String::from(scope.as_ref()));
54625        self
54626    }
54627    /// Identifies the authorization scope(s) for the method you are building.
54628    ///
54629    /// See [`Self::add_scope()`] for details.
54630    pub fn add_scopes<I, St>(mut self, scopes: I) -> PartnerChannelSiteDeleteCall<'a, C>
54631    where
54632        I: IntoIterator<Item = St>,
54633        St: AsRef<str>,
54634    {
54635        self._scopes
54636            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
54637        self
54638    }
54639
54640    /// Removes all scopes, and no default scope will be used either.
54641    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
54642    /// for details).
54643    pub fn clear_scopes(mut self) -> PartnerChannelSiteDeleteCall<'a, C> {
54644        self._scopes.clear();
54645        self
54646    }
54647}
54648
54649/// Lists sites in a channel.
54650///
54651/// A builder for the *channels.sites.list* method supported by a *partner* resource.
54652/// It is not used directly, but through a [`PartnerMethods`] instance.
54653///
54654/// # Example
54655///
54656/// Instantiate a resource method builder
54657///
54658/// ```test_harness,no_run
54659/// # extern crate hyper;
54660/// # extern crate hyper_rustls;
54661/// # extern crate google_displayvideo1 as displayvideo1;
54662/// # async fn dox() {
54663/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
54664///
54665/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
54666/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
54667/// #     secret,
54668/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
54669/// # ).build().await.unwrap();
54670///
54671/// # let client = hyper_util::client::legacy::Client::builder(
54672/// #     hyper_util::rt::TokioExecutor::new()
54673/// # )
54674/// # .build(
54675/// #     hyper_rustls::HttpsConnectorBuilder::new()
54676/// #         .with_native_roots()
54677/// #         .unwrap()
54678/// #         .https_or_http()
54679/// #         .enable_http1()
54680/// #         .build()
54681/// # );
54682/// # let mut hub = DisplayVideo::new(client, auth);
54683/// // You can configure optional parameters by calling the respective setters at will, and
54684/// // execute the final call using `doit()`.
54685/// // Values shown here are possibly random and not representative !
54686/// let result = hub.partners().channels_sites_list(-5, -62)
54687///              .page_token("invidunt")
54688///              .page_size(-10)
54689///              .order_by("duo")
54690///              .filter("sea")
54691///              .advertiser_id(-65)
54692///              .doit().await;
54693/// # }
54694/// ```
54695pub struct PartnerChannelSiteListCall<'a, C>
54696where
54697    C: 'a,
54698{
54699    hub: &'a DisplayVideo<C>,
54700    _partner_id: i64,
54701    _channel_id: i64,
54702    _page_token: Option<String>,
54703    _page_size: Option<i32>,
54704    _order_by: Option<String>,
54705    _filter: Option<String>,
54706    _advertiser_id: Option<i64>,
54707    _delegate: Option<&'a mut dyn common::Delegate>,
54708    _additional_params: HashMap<String, String>,
54709    _scopes: BTreeSet<String>,
54710}
54711
54712impl<'a, C> common::CallBuilder for PartnerChannelSiteListCall<'a, C> {}
54713
54714impl<'a, C> PartnerChannelSiteListCall<'a, C>
54715where
54716    C: common::Connector,
54717{
54718    /// Perform the operation you have build so far.
54719    pub async fn doit(mut self) -> common::Result<(common::Response, ListSitesResponse)> {
54720        use std::borrow::Cow;
54721        use std::io::{Read, Seek};
54722
54723        use common::{url::Params, ToParts};
54724        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
54725
54726        let mut dd = common::DefaultDelegate;
54727        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
54728        dlg.begin(common::MethodInfo {
54729            id: "displayvideo.partners.channels.sites.list",
54730            http_method: hyper::Method::GET,
54731        });
54732
54733        for &field in [
54734            "alt",
54735            "partnerId",
54736            "channelId",
54737            "pageToken",
54738            "pageSize",
54739            "orderBy",
54740            "filter",
54741            "advertiserId",
54742        ]
54743        .iter()
54744        {
54745            if self._additional_params.contains_key(field) {
54746                dlg.finished(false);
54747                return Err(common::Error::FieldClash(field));
54748            }
54749        }
54750
54751        let mut params = Params::with_capacity(9 + self._additional_params.len());
54752        params.push("partnerId", self._partner_id.to_string());
54753        params.push("channelId", self._channel_id.to_string());
54754        if let Some(value) = self._page_token.as_ref() {
54755            params.push("pageToken", value);
54756        }
54757        if let Some(value) = self._page_size.as_ref() {
54758            params.push("pageSize", value.to_string());
54759        }
54760        if let Some(value) = self._order_by.as_ref() {
54761            params.push("orderBy", value);
54762        }
54763        if let Some(value) = self._filter.as_ref() {
54764            params.push("filter", value);
54765        }
54766        if let Some(value) = self._advertiser_id.as_ref() {
54767            params.push("advertiserId", value.to_string());
54768        }
54769
54770        params.extend(self._additional_params.iter());
54771
54772        params.push("alt", "json");
54773        let mut url =
54774            self.hub._base_url.clone() + "v1/partners/{+partnerId}/channels/{+channelId}/sites";
54775        if self._scopes.is_empty() {
54776            self._scopes
54777                .insert(Scope::DisplayVideo.as_ref().to_string());
54778        }
54779
54780        #[allow(clippy::single_element_loop)]
54781        for &(find_this, param_name) in
54782            [("{+partnerId}", "partnerId"), ("{+channelId}", "channelId")].iter()
54783        {
54784            url = params.uri_replacement(url, param_name, find_this, true);
54785        }
54786        {
54787            let to_remove = ["channelId", "partnerId"];
54788            params.remove_params(&to_remove);
54789        }
54790
54791        let url = params.parse_with_url(&url);
54792
54793        loop {
54794            let token = match self
54795                .hub
54796                .auth
54797                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
54798                .await
54799            {
54800                Ok(token) => token,
54801                Err(e) => match dlg.token(e) {
54802                    Ok(token) => token,
54803                    Err(e) => {
54804                        dlg.finished(false);
54805                        return Err(common::Error::MissingToken(e));
54806                    }
54807                },
54808            };
54809            let mut req_result = {
54810                let client = &self.hub.client;
54811                dlg.pre_request();
54812                let mut req_builder = hyper::Request::builder()
54813                    .method(hyper::Method::GET)
54814                    .uri(url.as_str())
54815                    .header(USER_AGENT, self.hub._user_agent.clone());
54816
54817                if let Some(token) = token.as_ref() {
54818                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
54819                }
54820
54821                let request = req_builder
54822                    .header(CONTENT_LENGTH, 0_u64)
54823                    .body(common::to_body::<String>(None));
54824
54825                client.request(request.unwrap()).await
54826            };
54827
54828            match req_result {
54829                Err(err) => {
54830                    if let common::Retry::After(d) = dlg.http_error(&err) {
54831                        sleep(d).await;
54832                        continue;
54833                    }
54834                    dlg.finished(false);
54835                    return Err(common::Error::HttpError(err));
54836                }
54837                Ok(res) => {
54838                    let (mut parts, body) = res.into_parts();
54839                    let mut body = common::Body::new(body);
54840                    if !parts.status.is_success() {
54841                        let bytes = common::to_bytes(body).await.unwrap_or_default();
54842                        let error = serde_json::from_str(&common::to_string(&bytes));
54843                        let response = common::to_response(parts, bytes.into());
54844
54845                        if let common::Retry::After(d) =
54846                            dlg.http_failure(&response, error.as_ref().ok())
54847                        {
54848                            sleep(d).await;
54849                            continue;
54850                        }
54851
54852                        dlg.finished(false);
54853
54854                        return Err(match error {
54855                            Ok(value) => common::Error::BadRequest(value),
54856                            _ => common::Error::Failure(response),
54857                        });
54858                    }
54859                    let response = {
54860                        let bytes = common::to_bytes(body).await.unwrap_or_default();
54861                        let encoded = common::to_string(&bytes);
54862                        match serde_json::from_str(&encoded) {
54863                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
54864                            Err(error) => {
54865                                dlg.response_json_decode_error(&encoded, &error);
54866                                return Err(common::Error::JsonDecodeError(
54867                                    encoded.to_string(),
54868                                    error,
54869                                ));
54870                            }
54871                        }
54872                    };
54873
54874                    dlg.finished(true);
54875                    return Ok(response);
54876                }
54877            }
54878        }
54879    }
54880
54881    /// The ID of the partner that owns the parent channel.
54882    ///
54883    /// Sets the *partner id* path property to the given value.
54884    ///
54885    /// Even though the property as already been set when instantiating this call,
54886    /// we provide this method for API completeness.
54887    pub fn partner_id(mut self, new_value: i64) -> PartnerChannelSiteListCall<'a, C> {
54888        self._partner_id = new_value;
54889        self
54890    }
54891    /// Required. The ID of the parent channel to which the requested sites belong.
54892    ///
54893    /// Sets the *channel id* path property to the given value.
54894    ///
54895    /// Even though the property as already been set when instantiating this call,
54896    /// we provide this method for API completeness.
54897    pub fn channel_id(mut self, new_value: i64) -> PartnerChannelSiteListCall<'a, C> {
54898        self._channel_id = new_value;
54899        self
54900    }
54901    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListSites` method. If not specified, the first page of results will be returned.
54902    ///
54903    /// Sets the *page token* query property to the given value.
54904    pub fn page_token(mut self, new_value: &str) -> PartnerChannelSiteListCall<'a, C> {
54905        self._page_token = Some(new_value.to_string());
54906        self
54907    }
54908    /// Requested page size. Must be between `1` and `10000`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
54909    ///
54910    /// Sets the *page size* query property to the given value.
54911    pub fn page_size(mut self, new_value: i32) -> PartnerChannelSiteListCall<'a, C> {
54912        self._page_size = Some(new_value);
54913        self
54914    }
54915    /// Field by which to sort the list. Acceptable values are: * `urlOrAppId` (default) The default sorting order is ascending. To specify descending order for a field, a suffix " desc" should be added to the field name. Example: `urlOrAppId desc`.
54916    ///
54917    /// Sets the *order by* query property to the given value.
54918    pub fn order_by(mut self, new_value: &str) -> PartnerChannelSiteListCall<'a, C> {
54919        self._order_by = Some(new_value.to_string());
54920        self
54921    }
54922    /// Allows filtering by site fields. Supported syntax: * Filter expressions for site retrieval can only contain at most one restriction. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `HAS (:)` operator. Supported fields: * `urlOrAppId` Examples: * All sites for which the URL or app ID contains “google”: `urlOrAppId : "google"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
54923    ///
54924    /// Sets the *filter* query property to the given value.
54925    pub fn filter(mut self, new_value: &str) -> PartnerChannelSiteListCall<'a, C> {
54926        self._filter = Some(new_value.to_string());
54927        self
54928    }
54929    /// The ID of the advertiser that owns the parent channel.
54930    ///
54931    /// Sets the *advertiser id* query property to the given value.
54932    pub fn advertiser_id(mut self, new_value: i64) -> PartnerChannelSiteListCall<'a, C> {
54933        self._advertiser_id = Some(new_value);
54934        self
54935    }
54936    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
54937    /// while executing the actual API request.
54938    ///
54939    /// ````text
54940    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
54941    /// ````
54942    ///
54943    /// Sets the *delegate* property to the given value.
54944    pub fn delegate(
54945        mut self,
54946        new_value: &'a mut dyn common::Delegate,
54947    ) -> PartnerChannelSiteListCall<'a, C> {
54948        self._delegate = Some(new_value);
54949        self
54950    }
54951
54952    /// Set any additional parameter of the query string used in the request.
54953    /// It should be used to set parameters which are not yet available through their own
54954    /// setters.
54955    ///
54956    /// Please note that this method must not be used to set any of the known parameters
54957    /// which have their own setter method. If done anyway, the request will fail.
54958    ///
54959    /// # Additional Parameters
54960    ///
54961    /// * *$.xgafv* (query-string) - V1 error format.
54962    /// * *access_token* (query-string) - OAuth access token.
54963    /// * *alt* (query-string) - Data format for response.
54964    /// * *callback* (query-string) - JSONP
54965    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
54966    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
54967    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
54968    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
54969    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
54970    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
54971    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
54972    pub fn param<T>(mut self, name: T, value: T) -> PartnerChannelSiteListCall<'a, C>
54973    where
54974        T: AsRef<str>,
54975    {
54976        self._additional_params
54977            .insert(name.as_ref().to_string(), value.as_ref().to_string());
54978        self
54979    }
54980
54981    /// Identifies the authorization scope for the method you are building.
54982    ///
54983    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
54984    /// [`Scope::DisplayVideo`].
54985    ///
54986    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
54987    /// tokens for more than one scope.
54988    ///
54989    /// Usually there is more than one suitable scope to authorize an operation, some of which may
54990    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
54991    /// sufficient, a read-write scope will do as well.
54992    pub fn add_scope<St>(mut self, scope: St) -> PartnerChannelSiteListCall<'a, C>
54993    where
54994        St: AsRef<str>,
54995    {
54996        self._scopes.insert(String::from(scope.as_ref()));
54997        self
54998    }
54999    /// Identifies the authorization scope(s) for the method you are building.
55000    ///
55001    /// See [`Self::add_scope()`] for details.
55002    pub fn add_scopes<I, St>(mut self, scopes: I) -> PartnerChannelSiteListCall<'a, C>
55003    where
55004        I: IntoIterator<Item = St>,
55005        St: AsRef<str>,
55006    {
55007        self._scopes
55008            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
55009        self
55010    }
55011
55012    /// Removes all scopes, and no default scope will be used either.
55013    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
55014    /// for details).
55015    pub fn clear_scopes(mut self) -> PartnerChannelSiteListCall<'a, C> {
55016        self._scopes.clear();
55017        self
55018    }
55019}
55020
55021/// Replaces all of the sites under a single channel. The operation will replace the sites under a channel with the sites provided in ReplaceSitesRequest.new_sites. **This method regularly experiences high latency.** We recommend [increasing your default timeout](https://developers.google.com/display-video/api/guides/best-practices/timeouts#client_library_timeout) to avoid errors.
55022///
55023/// A builder for the *channels.sites.replace* method supported by a *partner* resource.
55024/// It is not used directly, but through a [`PartnerMethods`] instance.
55025///
55026/// # Example
55027///
55028/// Instantiate a resource method builder
55029///
55030/// ```test_harness,no_run
55031/// # extern crate hyper;
55032/// # extern crate hyper_rustls;
55033/// # extern crate google_displayvideo1 as displayvideo1;
55034/// use displayvideo1::api::ReplaceSitesRequest;
55035/// # async fn dox() {
55036/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
55037///
55038/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
55039/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
55040/// #     secret,
55041/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
55042/// # ).build().await.unwrap();
55043///
55044/// # let client = hyper_util::client::legacy::Client::builder(
55045/// #     hyper_util::rt::TokioExecutor::new()
55046/// # )
55047/// # .build(
55048/// #     hyper_rustls::HttpsConnectorBuilder::new()
55049/// #         .with_native_roots()
55050/// #         .unwrap()
55051/// #         .https_or_http()
55052/// #         .enable_http1()
55053/// #         .build()
55054/// # );
55055/// # let mut hub = DisplayVideo::new(client, auth);
55056/// // As the method needs a request, you would usually fill it with the desired information
55057/// // into the respective structure. Some of the parts shown here might not be applicable !
55058/// // Values shown here are possibly random and not representative !
55059/// let mut req = ReplaceSitesRequest::default();
55060///
55061/// // You can configure optional parameters by calling the respective setters at will, and
55062/// // execute the final call using `doit()`.
55063/// // Values shown here are possibly random and not representative !
55064/// let result = hub.partners().channels_sites_replace(req, -95, -11)
55065///              .doit().await;
55066/// # }
55067/// ```
55068pub struct PartnerChannelSiteReplaceCall<'a, C>
55069where
55070    C: 'a,
55071{
55072    hub: &'a DisplayVideo<C>,
55073    _request: ReplaceSitesRequest,
55074    _partner_id: i64,
55075    _channel_id: i64,
55076    _delegate: Option<&'a mut dyn common::Delegate>,
55077    _additional_params: HashMap<String, String>,
55078    _scopes: BTreeSet<String>,
55079}
55080
55081impl<'a, C> common::CallBuilder for PartnerChannelSiteReplaceCall<'a, C> {}
55082
55083impl<'a, C> PartnerChannelSiteReplaceCall<'a, C>
55084where
55085    C: common::Connector,
55086{
55087    /// Perform the operation you have build so far.
55088    pub async fn doit(mut self) -> common::Result<(common::Response, ReplaceSitesResponse)> {
55089        use std::borrow::Cow;
55090        use std::io::{Read, Seek};
55091
55092        use common::{url::Params, ToParts};
55093        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
55094
55095        let mut dd = common::DefaultDelegate;
55096        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
55097        dlg.begin(common::MethodInfo {
55098            id: "displayvideo.partners.channels.sites.replace",
55099            http_method: hyper::Method::POST,
55100        });
55101
55102        for &field in ["alt", "partnerId", "channelId"].iter() {
55103            if self._additional_params.contains_key(field) {
55104                dlg.finished(false);
55105                return Err(common::Error::FieldClash(field));
55106            }
55107        }
55108
55109        let mut params = Params::with_capacity(5 + self._additional_params.len());
55110        params.push("partnerId", self._partner_id.to_string());
55111        params.push("channelId", self._channel_id.to_string());
55112
55113        params.extend(self._additional_params.iter());
55114
55115        params.push("alt", "json");
55116        let mut url = self.hub._base_url.clone()
55117            + "v1/partners/{partnerId}/channels/{+channelId}/sites:replace";
55118        if self._scopes.is_empty() {
55119            self._scopes
55120                .insert(Scope::DisplayVideo.as_ref().to_string());
55121        }
55122
55123        #[allow(clippy::single_element_loop)]
55124        for &(find_this, param_name) in
55125            [("{partnerId}", "partnerId"), ("{+channelId}", "channelId")].iter()
55126        {
55127            url = params.uri_replacement(url, param_name, find_this, true);
55128        }
55129        {
55130            let to_remove = ["channelId", "partnerId"];
55131            params.remove_params(&to_remove);
55132        }
55133
55134        let url = params.parse_with_url(&url);
55135
55136        let mut json_mime_type = mime::APPLICATION_JSON;
55137        let mut request_value_reader = {
55138            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
55139            common::remove_json_null_values(&mut value);
55140            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
55141            serde_json::to_writer(&mut dst, &value).unwrap();
55142            dst
55143        };
55144        let request_size = request_value_reader
55145            .seek(std::io::SeekFrom::End(0))
55146            .unwrap();
55147        request_value_reader
55148            .seek(std::io::SeekFrom::Start(0))
55149            .unwrap();
55150
55151        loop {
55152            let token = match self
55153                .hub
55154                .auth
55155                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
55156                .await
55157            {
55158                Ok(token) => token,
55159                Err(e) => match dlg.token(e) {
55160                    Ok(token) => token,
55161                    Err(e) => {
55162                        dlg.finished(false);
55163                        return Err(common::Error::MissingToken(e));
55164                    }
55165                },
55166            };
55167            request_value_reader
55168                .seek(std::io::SeekFrom::Start(0))
55169                .unwrap();
55170            let mut req_result = {
55171                let client = &self.hub.client;
55172                dlg.pre_request();
55173                let mut req_builder = hyper::Request::builder()
55174                    .method(hyper::Method::POST)
55175                    .uri(url.as_str())
55176                    .header(USER_AGENT, self.hub._user_agent.clone());
55177
55178                if let Some(token) = token.as_ref() {
55179                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
55180                }
55181
55182                let request = req_builder
55183                    .header(CONTENT_TYPE, json_mime_type.to_string())
55184                    .header(CONTENT_LENGTH, request_size as u64)
55185                    .body(common::to_body(
55186                        request_value_reader.get_ref().clone().into(),
55187                    ));
55188
55189                client.request(request.unwrap()).await
55190            };
55191
55192            match req_result {
55193                Err(err) => {
55194                    if let common::Retry::After(d) = dlg.http_error(&err) {
55195                        sleep(d).await;
55196                        continue;
55197                    }
55198                    dlg.finished(false);
55199                    return Err(common::Error::HttpError(err));
55200                }
55201                Ok(res) => {
55202                    let (mut parts, body) = res.into_parts();
55203                    let mut body = common::Body::new(body);
55204                    if !parts.status.is_success() {
55205                        let bytes = common::to_bytes(body).await.unwrap_or_default();
55206                        let error = serde_json::from_str(&common::to_string(&bytes));
55207                        let response = common::to_response(parts, bytes.into());
55208
55209                        if let common::Retry::After(d) =
55210                            dlg.http_failure(&response, error.as_ref().ok())
55211                        {
55212                            sleep(d).await;
55213                            continue;
55214                        }
55215
55216                        dlg.finished(false);
55217
55218                        return Err(match error {
55219                            Ok(value) => common::Error::BadRequest(value),
55220                            _ => common::Error::Failure(response),
55221                        });
55222                    }
55223                    let response = {
55224                        let bytes = common::to_bytes(body).await.unwrap_or_default();
55225                        let encoded = common::to_string(&bytes);
55226                        match serde_json::from_str(&encoded) {
55227                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
55228                            Err(error) => {
55229                                dlg.response_json_decode_error(&encoded, &error);
55230                                return Err(common::Error::JsonDecodeError(
55231                                    encoded.to_string(),
55232                                    error,
55233                                ));
55234                            }
55235                        }
55236                    };
55237
55238                    dlg.finished(true);
55239                    return Ok(response);
55240                }
55241            }
55242        }
55243    }
55244
55245    ///
55246    /// Sets the *request* property to the given value.
55247    ///
55248    /// Even though the property as already been set when instantiating this call,
55249    /// we provide this method for API completeness.
55250    pub fn request(
55251        mut self,
55252        new_value: ReplaceSitesRequest,
55253    ) -> PartnerChannelSiteReplaceCall<'a, C> {
55254        self._request = new_value;
55255        self
55256    }
55257    /// The ID of the partner that owns the parent channel.
55258    ///
55259    /// Sets the *partner id* path property to the given value.
55260    ///
55261    /// Even though the property as already been set when instantiating this call,
55262    /// we provide this method for API completeness.
55263    pub fn partner_id(mut self, new_value: i64) -> PartnerChannelSiteReplaceCall<'a, C> {
55264        self._partner_id = new_value;
55265        self
55266    }
55267    /// Required. The ID of the parent channel whose sites will be replaced.
55268    ///
55269    /// Sets the *channel id* path property to the given value.
55270    ///
55271    /// Even though the property as already been set when instantiating this call,
55272    /// we provide this method for API completeness.
55273    pub fn channel_id(mut self, new_value: i64) -> PartnerChannelSiteReplaceCall<'a, C> {
55274        self._channel_id = new_value;
55275        self
55276    }
55277    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
55278    /// while executing the actual API request.
55279    ///
55280    /// ````text
55281    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
55282    /// ````
55283    ///
55284    /// Sets the *delegate* property to the given value.
55285    pub fn delegate(
55286        mut self,
55287        new_value: &'a mut dyn common::Delegate,
55288    ) -> PartnerChannelSiteReplaceCall<'a, C> {
55289        self._delegate = Some(new_value);
55290        self
55291    }
55292
55293    /// Set any additional parameter of the query string used in the request.
55294    /// It should be used to set parameters which are not yet available through their own
55295    /// setters.
55296    ///
55297    /// Please note that this method must not be used to set any of the known parameters
55298    /// which have their own setter method. If done anyway, the request will fail.
55299    ///
55300    /// # Additional Parameters
55301    ///
55302    /// * *$.xgafv* (query-string) - V1 error format.
55303    /// * *access_token* (query-string) - OAuth access token.
55304    /// * *alt* (query-string) - Data format for response.
55305    /// * *callback* (query-string) - JSONP
55306    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
55307    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
55308    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
55309    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
55310    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
55311    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
55312    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
55313    pub fn param<T>(mut self, name: T, value: T) -> PartnerChannelSiteReplaceCall<'a, C>
55314    where
55315        T: AsRef<str>,
55316    {
55317        self._additional_params
55318            .insert(name.as_ref().to_string(), value.as_ref().to_string());
55319        self
55320    }
55321
55322    /// Identifies the authorization scope for the method you are building.
55323    ///
55324    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
55325    /// [`Scope::DisplayVideo`].
55326    ///
55327    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
55328    /// tokens for more than one scope.
55329    ///
55330    /// Usually there is more than one suitable scope to authorize an operation, some of which may
55331    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
55332    /// sufficient, a read-write scope will do as well.
55333    pub fn add_scope<St>(mut self, scope: St) -> PartnerChannelSiteReplaceCall<'a, C>
55334    where
55335        St: AsRef<str>,
55336    {
55337        self._scopes.insert(String::from(scope.as_ref()));
55338        self
55339    }
55340    /// Identifies the authorization scope(s) for the method you are building.
55341    ///
55342    /// See [`Self::add_scope()`] for details.
55343    pub fn add_scopes<I, St>(mut self, scopes: I) -> PartnerChannelSiteReplaceCall<'a, C>
55344    where
55345        I: IntoIterator<Item = St>,
55346        St: AsRef<str>,
55347    {
55348        self._scopes
55349            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
55350        self
55351    }
55352
55353    /// Removes all scopes, and no default scope will be used either.
55354    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
55355    /// for details).
55356    pub fn clear_scopes(mut self) -> PartnerChannelSiteReplaceCall<'a, C> {
55357        self._scopes.clear();
55358        self
55359    }
55360}
55361
55362/// Creates a new channel. Returns the newly created channel if successful.
55363///
55364/// A builder for the *channels.create* method supported by a *partner* resource.
55365/// It is not used directly, but through a [`PartnerMethods`] instance.
55366///
55367/// # Example
55368///
55369/// Instantiate a resource method builder
55370///
55371/// ```test_harness,no_run
55372/// # extern crate hyper;
55373/// # extern crate hyper_rustls;
55374/// # extern crate google_displayvideo1 as displayvideo1;
55375/// use displayvideo1::api::Channel;
55376/// # async fn dox() {
55377/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
55378///
55379/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
55380/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
55381/// #     secret,
55382/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
55383/// # ).build().await.unwrap();
55384///
55385/// # let client = hyper_util::client::legacy::Client::builder(
55386/// #     hyper_util::rt::TokioExecutor::new()
55387/// # )
55388/// # .build(
55389/// #     hyper_rustls::HttpsConnectorBuilder::new()
55390/// #         .with_native_roots()
55391/// #         .unwrap()
55392/// #         .https_or_http()
55393/// #         .enable_http1()
55394/// #         .build()
55395/// # );
55396/// # let mut hub = DisplayVideo::new(client, auth);
55397/// // As the method needs a request, you would usually fill it with the desired information
55398/// // into the respective structure. Some of the parts shown here might not be applicable !
55399/// // Values shown here are possibly random and not representative !
55400/// let mut req = Channel::default();
55401///
55402/// // You can configure optional parameters by calling the respective setters at will, and
55403/// // execute the final call using `doit()`.
55404/// // Values shown here are possibly random and not representative !
55405/// let result = hub.partners().channels_create(req, -39)
55406///              .advertiser_id(-55)
55407///              .doit().await;
55408/// # }
55409/// ```
55410pub struct PartnerChannelCreateCall<'a, C>
55411where
55412    C: 'a,
55413{
55414    hub: &'a DisplayVideo<C>,
55415    _request: Channel,
55416    _partner_id: i64,
55417    _advertiser_id: Option<i64>,
55418    _delegate: Option<&'a mut dyn common::Delegate>,
55419    _additional_params: HashMap<String, String>,
55420    _scopes: BTreeSet<String>,
55421}
55422
55423impl<'a, C> common::CallBuilder for PartnerChannelCreateCall<'a, C> {}
55424
55425impl<'a, C> PartnerChannelCreateCall<'a, C>
55426where
55427    C: common::Connector,
55428{
55429    /// Perform the operation you have build so far.
55430    pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
55431        use std::borrow::Cow;
55432        use std::io::{Read, Seek};
55433
55434        use common::{url::Params, ToParts};
55435        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
55436
55437        let mut dd = common::DefaultDelegate;
55438        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
55439        dlg.begin(common::MethodInfo {
55440            id: "displayvideo.partners.channels.create",
55441            http_method: hyper::Method::POST,
55442        });
55443
55444        for &field in ["alt", "partnerId", "advertiserId"].iter() {
55445            if self._additional_params.contains_key(field) {
55446                dlg.finished(false);
55447                return Err(common::Error::FieldClash(field));
55448            }
55449        }
55450
55451        let mut params = Params::with_capacity(5 + self._additional_params.len());
55452        params.push("partnerId", self._partner_id.to_string());
55453        if let Some(value) = self._advertiser_id.as_ref() {
55454            params.push("advertiserId", value.to_string());
55455        }
55456
55457        params.extend(self._additional_params.iter());
55458
55459        params.push("alt", "json");
55460        let mut url = self.hub._base_url.clone() + "v1/partners/{+partnerId}/channels";
55461        if self._scopes.is_empty() {
55462            self._scopes
55463                .insert(Scope::DisplayVideo.as_ref().to_string());
55464        }
55465
55466        #[allow(clippy::single_element_loop)]
55467        for &(find_this, param_name) in [("{+partnerId}", "partnerId")].iter() {
55468            url = params.uri_replacement(url, param_name, find_this, true);
55469        }
55470        {
55471            let to_remove = ["partnerId"];
55472            params.remove_params(&to_remove);
55473        }
55474
55475        let url = params.parse_with_url(&url);
55476
55477        let mut json_mime_type = mime::APPLICATION_JSON;
55478        let mut request_value_reader = {
55479            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
55480            common::remove_json_null_values(&mut value);
55481            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
55482            serde_json::to_writer(&mut dst, &value).unwrap();
55483            dst
55484        };
55485        let request_size = request_value_reader
55486            .seek(std::io::SeekFrom::End(0))
55487            .unwrap();
55488        request_value_reader
55489            .seek(std::io::SeekFrom::Start(0))
55490            .unwrap();
55491
55492        loop {
55493            let token = match self
55494                .hub
55495                .auth
55496                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
55497                .await
55498            {
55499                Ok(token) => token,
55500                Err(e) => match dlg.token(e) {
55501                    Ok(token) => token,
55502                    Err(e) => {
55503                        dlg.finished(false);
55504                        return Err(common::Error::MissingToken(e));
55505                    }
55506                },
55507            };
55508            request_value_reader
55509                .seek(std::io::SeekFrom::Start(0))
55510                .unwrap();
55511            let mut req_result = {
55512                let client = &self.hub.client;
55513                dlg.pre_request();
55514                let mut req_builder = hyper::Request::builder()
55515                    .method(hyper::Method::POST)
55516                    .uri(url.as_str())
55517                    .header(USER_AGENT, self.hub._user_agent.clone());
55518
55519                if let Some(token) = token.as_ref() {
55520                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
55521                }
55522
55523                let request = req_builder
55524                    .header(CONTENT_TYPE, json_mime_type.to_string())
55525                    .header(CONTENT_LENGTH, request_size as u64)
55526                    .body(common::to_body(
55527                        request_value_reader.get_ref().clone().into(),
55528                    ));
55529
55530                client.request(request.unwrap()).await
55531            };
55532
55533            match req_result {
55534                Err(err) => {
55535                    if let common::Retry::After(d) = dlg.http_error(&err) {
55536                        sleep(d).await;
55537                        continue;
55538                    }
55539                    dlg.finished(false);
55540                    return Err(common::Error::HttpError(err));
55541                }
55542                Ok(res) => {
55543                    let (mut parts, body) = res.into_parts();
55544                    let mut body = common::Body::new(body);
55545                    if !parts.status.is_success() {
55546                        let bytes = common::to_bytes(body).await.unwrap_or_default();
55547                        let error = serde_json::from_str(&common::to_string(&bytes));
55548                        let response = common::to_response(parts, bytes.into());
55549
55550                        if let common::Retry::After(d) =
55551                            dlg.http_failure(&response, error.as_ref().ok())
55552                        {
55553                            sleep(d).await;
55554                            continue;
55555                        }
55556
55557                        dlg.finished(false);
55558
55559                        return Err(match error {
55560                            Ok(value) => common::Error::BadRequest(value),
55561                            _ => common::Error::Failure(response),
55562                        });
55563                    }
55564                    let response = {
55565                        let bytes = common::to_bytes(body).await.unwrap_or_default();
55566                        let encoded = common::to_string(&bytes);
55567                        match serde_json::from_str(&encoded) {
55568                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
55569                            Err(error) => {
55570                                dlg.response_json_decode_error(&encoded, &error);
55571                                return Err(common::Error::JsonDecodeError(
55572                                    encoded.to_string(),
55573                                    error,
55574                                ));
55575                            }
55576                        }
55577                    };
55578
55579                    dlg.finished(true);
55580                    return Ok(response);
55581                }
55582            }
55583        }
55584    }
55585
55586    ///
55587    /// Sets the *request* property to the given value.
55588    ///
55589    /// Even though the property as already been set when instantiating this call,
55590    /// we provide this method for API completeness.
55591    pub fn request(mut self, new_value: Channel) -> PartnerChannelCreateCall<'a, C> {
55592        self._request = new_value;
55593        self
55594    }
55595    /// The ID of the partner that owns the created channel.
55596    ///
55597    /// Sets the *partner id* path property to the given value.
55598    ///
55599    /// Even though the property as already been set when instantiating this call,
55600    /// we provide this method for API completeness.
55601    pub fn partner_id(mut self, new_value: i64) -> PartnerChannelCreateCall<'a, C> {
55602        self._partner_id = new_value;
55603        self
55604    }
55605    /// The ID of the advertiser that owns the created channel.
55606    ///
55607    /// Sets the *advertiser id* query property to the given value.
55608    pub fn advertiser_id(mut self, new_value: i64) -> PartnerChannelCreateCall<'a, C> {
55609        self._advertiser_id = Some(new_value);
55610        self
55611    }
55612    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
55613    /// while executing the actual API request.
55614    ///
55615    /// ````text
55616    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
55617    /// ````
55618    ///
55619    /// Sets the *delegate* property to the given value.
55620    pub fn delegate(
55621        mut self,
55622        new_value: &'a mut dyn common::Delegate,
55623    ) -> PartnerChannelCreateCall<'a, C> {
55624        self._delegate = Some(new_value);
55625        self
55626    }
55627
55628    /// Set any additional parameter of the query string used in the request.
55629    /// It should be used to set parameters which are not yet available through their own
55630    /// setters.
55631    ///
55632    /// Please note that this method must not be used to set any of the known parameters
55633    /// which have their own setter method. If done anyway, the request will fail.
55634    ///
55635    /// # Additional Parameters
55636    ///
55637    /// * *$.xgafv* (query-string) - V1 error format.
55638    /// * *access_token* (query-string) - OAuth access token.
55639    /// * *alt* (query-string) - Data format for response.
55640    /// * *callback* (query-string) - JSONP
55641    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
55642    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
55643    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
55644    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
55645    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
55646    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
55647    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
55648    pub fn param<T>(mut self, name: T, value: T) -> PartnerChannelCreateCall<'a, C>
55649    where
55650        T: AsRef<str>,
55651    {
55652        self._additional_params
55653            .insert(name.as_ref().to_string(), value.as_ref().to_string());
55654        self
55655    }
55656
55657    /// Identifies the authorization scope for the method you are building.
55658    ///
55659    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
55660    /// [`Scope::DisplayVideo`].
55661    ///
55662    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
55663    /// tokens for more than one scope.
55664    ///
55665    /// Usually there is more than one suitable scope to authorize an operation, some of which may
55666    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
55667    /// sufficient, a read-write scope will do as well.
55668    pub fn add_scope<St>(mut self, scope: St) -> PartnerChannelCreateCall<'a, C>
55669    where
55670        St: AsRef<str>,
55671    {
55672        self._scopes.insert(String::from(scope.as_ref()));
55673        self
55674    }
55675    /// Identifies the authorization scope(s) for the method you are building.
55676    ///
55677    /// See [`Self::add_scope()`] for details.
55678    pub fn add_scopes<I, St>(mut self, scopes: I) -> PartnerChannelCreateCall<'a, C>
55679    where
55680        I: IntoIterator<Item = St>,
55681        St: AsRef<str>,
55682    {
55683        self._scopes
55684            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
55685        self
55686    }
55687
55688    /// Removes all scopes, and no default scope will be used either.
55689    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
55690    /// for details).
55691    pub fn clear_scopes(mut self) -> PartnerChannelCreateCall<'a, C> {
55692        self._scopes.clear();
55693        self
55694    }
55695}
55696
55697/// Gets a channel for a partner or advertiser.
55698///
55699/// A builder for the *channels.get* method supported by a *partner* resource.
55700/// It is not used directly, but through a [`PartnerMethods`] instance.
55701///
55702/// # Example
55703///
55704/// Instantiate a resource method builder
55705///
55706/// ```test_harness,no_run
55707/// # extern crate hyper;
55708/// # extern crate hyper_rustls;
55709/// # extern crate google_displayvideo1 as displayvideo1;
55710/// # async fn dox() {
55711/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
55712///
55713/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
55714/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
55715/// #     secret,
55716/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
55717/// # ).build().await.unwrap();
55718///
55719/// # let client = hyper_util::client::legacy::Client::builder(
55720/// #     hyper_util::rt::TokioExecutor::new()
55721/// # )
55722/// # .build(
55723/// #     hyper_rustls::HttpsConnectorBuilder::new()
55724/// #         .with_native_roots()
55725/// #         .unwrap()
55726/// #         .https_or_http()
55727/// #         .enable_http1()
55728/// #         .build()
55729/// # );
55730/// # let mut hub = DisplayVideo::new(client, auth);
55731/// // You can configure optional parameters by calling the respective setters at will, and
55732/// // execute the final call using `doit()`.
55733/// // Values shown here are possibly random and not representative !
55734/// let result = hub.partners().channels_get(-60, -98)
55735///              .advertiser_id(-2)
55736///              .doit().await;
55737/// # }
55738/// ```
55739pub struct PartnerChannelGetCall<'a, C>
55740where
55741    C: 'a,
55742{
55743    hub: &'a DisplayVideo<C>,
55744    _partner_id: i64,
55745    _channel_id: i64,
55746    _advertiser_id: Option<i64>,
55747    _delegate: Option<&'a mut dyn common::Delegate>,
55748    _additional_params: HashMap<String, String>,
55749    _scopes: BTreeSet<String>,
55750}
55751
55752impl<'a, C> common::CallBuilder for PartnerChannelGetCall<'a, C> {}
55753
55754impl<'a, C> PartnerChannelGetCall<'a, C>
55755where
55756    C: common::Connector,
55757{
55758    /// Perform the operation you have build so far.
55759    pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
55760        use std::borrow::Cow;
55761        use std::io::{Read, Seek};
55762
55763        use common::{url::Params, ToParts};
55764        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
55765
55766        let mut dd = common::DefaultDelegate;
55767        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
55768        dlg.begin(common::MethodInfo {
55769            id: "displayvideo.partners.channels.get",
55770            http_method: hyper::Method::GET,
55771        });
55772
55773        for &field in ["alt", "partnerId", "channelId", "advertiserId"].iter() {
55774            if self._additional_params.contains_key(field) {
55775                dlg.finished(false);
55776                return Err(common::Error::FieldClash(field));
55777            }
55778        }
55779
55780        let mut params = Params::with_capacity(5 + self._additional_params.len());
55781        params.push("partnerId", self._partner_id.to_string());
55782        params.push("channelId", self._channel_id.to_string());
55783        if let Some(value) = self._advertiser_id.as_ref() {
55784            params.push("advertiserId", value.to_string());
55785        }
55786
55787        params.extend(self._additional_params.iter());
55788
55789        params.push("alt", "json");
55790        let mut url = self.hub._base_url.clone() + "v1/partners/{+partnerId}/channels/{+channelId}";
55791        if self._scopes.is_empty() {
55792            self._scopes
55793                .insert(Scope::DisplayVideo.as_ref().to_string());
55794        }
55795
55796        #[allow(clippy::single_element_loop)]
55797        for &(find_this, param_name) in
55798            [("{+partnerId}", "partnerId"), ("{+channelId}", "channelId")].iter()
55799        {
55800            url = params.uri_replacement(url, param_name, find_this, true);
55801        }
55802        {
55803            let to_remove = ["channelId", "partnerId"];
55804            params.remove_params(&to_remove);
55805        }
55806
55807        let url = params.parse_with_url(&url);
55808
55809        loop {
55810            let token = match self
55811                .hub
55812                .auth
55813                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
55814                .await
55815            {
55816                Ok(token) => token,
55817                Err(e) => match dlg.token(e) {
55818                    Ok(token) => token,
55819                    Err(e) => {
55820                        dlg.finished(false);
55821                        return Err(common::Error::MissingToken(e));
55822                    }
55823                },
55824            };
55825            let mut req_result = {
55826                let client = &self.hub.client;
55827                dlg.pre_request();
55828                let mut req_builder = hyper::Request::builder()
55829                    .method(hyper::Method::GET)
55830                    .uri(url.as_str())
55831                    .header(USER_AGENT, self.hub._user_agent.clone());
55832
55833                if let Some(token) = token.as_ref() {
55834                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
55835                }
55836
55837                let request = req_builder
55838                    .header(CONTENT_LENGTH, 0_u64)
55839                    .body(common::to_body::<String>(None));
55840
55841                client.request(request.unwrap()).await
55842            };
55843
55844            match req_result {
55845                Err(err) => {
55846                    if let common::Retry::After(d) = dlg.http_error(&err) {
55847                        sleep(d).await;
55848                        continue;
55849                    }
55850                    dlg.finished(false);
55851                    return Err(common::Error::HttpError(err));
55852                }
55853                Ok(res) => {
55854                    let (mut parts, body) = res.into_parts();
55855                    let mut body = common::Body::new(body);
55856                    if !parts.status.is_success() {
55857                        let bytes = common::to_bytes(body).await.unwrap_or_default();
55858                        let error = serde_json::from_str(&common::to_string(&bytes));
55859                        let response = common::to_response(parts, bytes.into());
55860
55861                        if let common::Retry::After(d) =
55862                            dlg.http_failure(&response, error.as_ref().ok())
55863                        {
55864                            sleep(d).await;
55865                            continue;
55866                        }
55867
55868                        dlg.finished(false);
55869
55870                        return Err(match error {
55871                            Ok(value) => common::Error::BadRequest(value),
55872                            _ => common::Error::Failure(response),
55873                        });
55874                    }
55875                    let response = {
55876                        let bytes = common::to_bytes(body).await.unwrap_or_default();
55877                        let encoded = common::to_string(&bytes);
55878                        match serde_json::from_str(&encoded) {
55879                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
55880                            Err(error) => {
55881                                dlg.response_json_decode_error(&encoded, &error);
55882                                return Err(common::Error::JsonDecodeError(
55883                                    encoded.to_string(),
55884                                    error,
55885                                ));
55886                            }
55887                        }
55888                    };
55889
55890                    dlg.finished(true);
55891                    return Ok(response);
55892                }
55893            }
55894        }
55895    }
55896
55897    /// The ID of the partner that owns the fetched channel.
55898    ///
55899    /// Sets the *partner id* path property to the given value.
55900    ///
55901    /// Even though the property as already been set when instantiating this call,
55902    /// we provide this method for API completeness.
55903    pub fn partner_id(mut self, new_value: i64) -> PartnerChannelGetCall<'a, C> {
55904        self._partner_id = new_value;
55905        self
55906    }
55907    /// Required. The ID of the channel to fetch.
55908    ///
55909    /// Sets the *channel id* path property to the given value.
55910    ///
55911    /// Even though the property as already been set when instantiating this call,
55912    /// we provide this method for API completeness.
55913    pub fn channel_id(mut self, new_value: i64) -> PartnerChannelGetCall<'a, C> {
55914        self._channel_id = new_value;
55915        self
55916    }
55917    /// The ID of the advertiser that owns the fetched channel.
55918    ///
55919    /// Sets the *advertiser id* query property to the given value.
55920    pub fn advertiser_id(mut self, new_value: i64) -> PartnerChannelGetCall<'a, C> {
55921        self._advertiser_id = Some(new_value);
55922        self
55923    }
55924    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
55925    /// while executing the actual API request.
55926    ///
55927    /// ````text
55928    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
55929    /// ````
55930    ///
55931    /// Sets the *delegate* property to the given value.
55932    pub fn delegate(
55933        mut self,
55934        new_value: &'a mut dyn common::Delegate,
55935    ) -> PartnerChannelGetCall<'a, C> {
55936        self._delegate = Some(new_value);
55937        self
55938    }
55939
55940    /// Set any additional parameter of the query string used in the request.
55941    /// It should be used to set parameters which are not yet available through their own
55942    /// setters.
55943    ///
55944    /// Please note that this method must not be used to set any of the known parameters
55945    /// which have their own setter method. If done anyway, the request will fail.
55946    ///
55947    /// # Additional Parameters
55948    ///
55949    /// * *$.xgafv* (query-string) - V1 error format.
55950    /// * *access_token* (query-string) - OAuth access token.
55951    /// * *alt* (query-string) - Data format for response.
55952    /// * *callback* (query-string) - JSONP
55953    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
55954    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
55955    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
55956    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
55957    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
55958    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
55959    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
55960    pub fn param<T>(mut self, name: T, value: T) -> PartnerChannelGetCall<'a, C>
55961    where
55962        T: AsRef<str>,
55963    {
55964        self._additional_params
55965            .insert(name.as_ref().to_string(), value.as_ref().to_string());
55966        self
55967    }
55968
55969    /// Identifies the authorization scope for the method you are building.
55970    ///
55971    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
55972    /// [`Scope::DisplayVideo`].
55973    ///
55974    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
55975    /// tokens for more than one scope.
55976    ///
55977    /// Usually there is more than one suitable scope to authorize an operation, some of which may
55978    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
55979    /// sufficient, a read-write scope will do as well.
55980    pub fn add_scope<St>(mut self, scope: St) -> PartnerChannelGetCall<'a, C>
55981    where
55982        St: AsRef<str>,
55983    {
55984        self._scopes.insert(String::from(scope.as_ref()));
55985        self
55986    }
55987    /// Identifies the authorization scope(s) for the method you are building.
55988    ///
55989    /// See [`Self::add_scope()`] for details.
55990    pub fn add_scopes<I, St>(mut self, scopes: I) -> PartnerChannelGetCall<'a, C>
55991    where
55992        I: IntoIterator<Item = St>,
55993        St: AsRef<str>,
55994    {
55995        self._scopes
55996            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
55997        self
55998    }
55999
56000    /// Removes all scopes, and no default scope will be used either.
56001    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
56002    /// for details).
56003    pub fn clear_scopes(mut self) -> PartnerChannelGetCall<'a, C> {
56004        self._scopes.clear();
56005        self
56006    }
56007}
56008
56009/// Lists channels for a partner or advertiser.
56010///
56011/// A builder for the *channels.list* method supported by a *partner* resource.
56012/// It is not used directly, but through a [`PartnerMethods`] instance.
56013///
56014/// # Example
56015///
56016/// Instantiate a resource method builder
56017///
56018/// ```test_harness,no_run
56019/// # extern crate hyper;
56020/// # extern crate hyper_rustls;
56021/// # extern crate google_displayvideo1 as displayvideo1;
56022/// # async fn dox() {
56023/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
56024///
56025/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
56026/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
56027/// #     secret,
56028/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
56029/// # ).build().await.unwrap();
56030///
56031/// # let client = hyper_util::client::legacy::Client::builder(
56032/// #     hyper_util::rt::TokioExecutor::new()
56033/// # )
56034/// # .build(
56035/// #     hyper_rustls::HttpsConnectorBuilder::new()
56036/// #         .with_native_roots()
56037/// #         .unwrap()
56038/// #         .https_or_http()
56039/// #         .enable_http1()
56040/// #         .build()
56041/// # );
56042/// # let mut hub = DisplayVideo::new(client, auth);
56043/// // You can configure optional parameters by calling the respective setters at will, and
56044/// // execute the final call using `doit()`.
56045/// // Values shown here are possibly random and not representative !
56046/// let result = hub.partners().channels_list(-55)
56047///              .page_token("At")
56048///              .page_size(-26)
56049///              .order_by("takimata")
56050///              .filter("gubergren")
56051///              .advertiser_id(-74)
56052///              .doit().await;
56053/// # }
56054/// ```
56055pub struct PartnerChannelListCall<'a, C>
56056where
56057    C: 'a,
56058{
56059    hub: &'a DisplayVideo<C>,
56060    _partner_id: i64,
56061    _page_token: Option<String>,
56062    _page_size: Option<i32>,
56063    _order_by: Option<String>,
56064    _filter: Option<String>,
56065    _advertiser_id: Option<i64>,
56066    _delegate: Option<&'a mut dyn common::Delegate>,
56067    _additional_params: HashMap<String, String>,
56068    _scopes: BTreeSet<String>,
56069}
56070
56071impl<'a, C> common::CallBuilder for PartnerChannelListCall<'a, C> {}
56072
56073impl<'a, C> PartnerChannelListCall<'a, C>
56074where
56075    C: common::Connector,
56076{
56077    /// Perform the operation you have build so far.
56078    pub async fn doit(mut self) -> common::Result<(common::Response, ListChannelsResponse)> {
56079        use std::borrow::Cow;
56080        use std::io::{Read, Seek};
56081
56082        use common::{url::Params, ToParts};
56083        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
56084
56085        let mut dd = common::DefaultDelegate;
56086        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
56087        dlg.begin(common::MethodInfo {
56088            id: "displayvideo.partners.channels.list",
56089            http_method: hyper::Method::GET,
56090        });
56091
56092        for &field in [
56093            "alt",
56094            "partnerId",
56095            "pageToken",
56096            "pageSize",
56097            "orderBy",
56098            "filter",
56099            "advertiserId",
56100        ]
56101        .iter()
56102        {
56103            if self._additional_params.contains_key(field) {
56104                dlg.finished(false);
56105                return Err(common::Error::FieldClash(field));
56106            }
56107        }
56108
56109        let mut params = Params::with_capacity(8 + self._additional_params.len());
56110        params.push("partnerId", self._partner_id.to_string());
56111        if let Some(value) = self._page_token.as_ref() {
56112            params.push("pageToken", value);
56113        }
56114        if let Some(value) = self._page_size.as_ref() {
56115            params.push("pageSize", value.to_string());
56116        }
56117        if let Some(value) = self._order_by.as_ref() {
56118            params.push("orderBy", value);
56119        }
56120        if let Some(value) = self._filter.as_ref() {
56121            params.push("filter", value);
56122        }
56123        if let Some(value) = self._advertiser_id.as_ref() {
56124            params.push("advertiserId", value.to_string());
56125        }
56126
56127        params.extend(self._additional_params.iter());
56128
56129        params.push("alt", "json");
56130        let mut url = self.hub._base_url.clone() + "v1/partners/{+partnerId}/channels";
56131        if self._scopes.is_empty() {
56132            self._scopes
56133                .insert(Scope::DisplayVideo.as_ref().to_string());
56134        }
56135
56136        #[allow(clippy::single_element_loop)]
56137        for &(find_this, param_name) in [("{+partnerId}", "partnerId")].iter() {
56138            url = params.uri_replacement(url, param_name, find_this, true);
56139        }
56140        {
56141            let to_remove = ["partnerId"];
56142            params.remove_params(&to_remove);
56143        }
56144
56145        let url = params.parse_with_url(&url);
56146
56147        loop {
56148            let token = match self
56149                .hub
56150                .auth
56151                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
56152                .await
56153            {
56154                Ok(token) => token,
56155                Err(e) => match dlg.token(e) {
56156                    Ok(token) => token,
56157                    Err(e) => {
56158                        dlg.finished(false);
56159                        return Err(common::Error::MissingToken(e));
56160                    }
56161                },
56162            };
56163            let mut req_result = {
56164                let client = &self.hub.client;
56165                dlg.pre_request();
56166                let mut req_builder = hyper::Request::builder()
56167                    .method(hyper::Method::GET)
56168                    .uri(url.as_str())
56169                    .header(USER_AGENT, self.hub._user_agent.clone());
56170
56171                if let Some(token) = token.as_ref() {
56172                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
56173                }
56174
56175                let request = req_builder
56176                    .header(CONTENT_LENGTH, 0_u64)
56177                    .body(common::to_body::<String>(None));
56178
56179                client.request(request.unwrap()).await
56180            };
56181
56182            match req_result {
56183                Err(err) => {
56184                    if let common::Retry::After(d) = dlg.http_error(&err) {
56185                        sleep(d).await;
56186                        continue;
56187                    }
56188                    dlg.finished(false);
56189                    return Err(common::Error::HttpError(err));
56190                }
56191                Ok(res) => {
56192                    let (mut parts, body) = res.into_parts();
56193                    let mut body = common::Body::new(body);
56194                    if !parts.status.is_success() {
56195                        let bytes = common::to_bytes(body).await.unwrap_or_default();
56196                        let error = serde_json::from_str(&common::to_string(&bytes));
56197                        let response = common::to_response(parts, bytes.into());
56198
56199                        if let common::Retry::After(d) =
56200                            dlg.http_failure(&response, error.as_ref().ok())
56201                        {
56202                            sleep(d).await;
56203                            continue;
56204                        }
56205
56206                        dlg.finished(false);
56207
56208                        return Err(match error {
56209                            Ok(value) => common::Error::BadRequest(value),
56210                            _ => common::Error::Failure(response),
56211                        });
56212                    }
56213                    let response = {
56214                        let bytes = common::to_bytes(body).await.unwrap_or_default();
56215                        let encoded = common::to_string(&bytes);
56216                        match serde_json::from_str(&encoded) {
56217                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
56218                            Err(error) => {
56219                                dlg.response_json_decode_error(&encoded, &error);
56220                                return Err(common::Error::JsonDecodeError(
56221                                    encoded.to_string(),
56222                                    error,
56223                                ));
56224                            }
56225                        }
56226                    };
56227
56228                    dlg.finished(true);
56229                    return Ok(response);
56230                }
56231            }
56232        }
56233    }
56234
56235    /// The ID of the partner that owns the channels.
56236    ///
56237    /// Sets the *partner id* path property to the given value.
56238    ///
56239    /// Even though the property as already been set when instantiating this call,
56240    /// we provide this method for API completeness.
56241    pub fn partner_id(mut self, new_value: i64) -> PartnerChannelListCall<'a, C> {
56242        self._partner_id = new_value;
56243        self
56244    }
56245    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListChannels` method. If not specified, the first page of results will be returned.
56246    ///
56247    /// Sets the *page token* query property to the given value.
56248    pub fn page_token(mut self, new_value: &str) -> PartnerChannelListCall<'a, C> {
56249        self._page_token = Some(new_value.to_string());
56250        self
56251    }
56252    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
56253    ///
56254    /// Sets the *page size* query property to the given value.
56255    pub fn page_size(mut self, new_value: i32) -> PartnerChannelListCall<'a, C> {
56256        self._page_size = Some(new_value);
56257        self
56258    }
56259    /// Field by which to sort the list. Acceptable values are: * `displayName` (default) * `channelId` The default sorting order is ascending. To specify descending order for a field, a suffix " desc" should be added to the field name. Example: `displayName desc`.
56260    ///
56261    /// Sets the *order by* query property to the given value.
56262    pub fn order_by(mut self, new_value: &str) -> PartnerChannelListCall<'a, C> {
56263        self._order_by = Some(new_value.to_string());
56264        self
56265    }
56266    /// Allows filtering by channel fields. Supported syntax: * Filter expressions for channel can only contain at most one restriction. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `HAS (:)` operator. Supported fields: * `displayName` Examples: * All channels for which the display name contains “google”: `displayName : "google"`. The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
56267    ///
56268    /// Sets the *filter* query property to the given value.
56269    pub fn filter(mut self, new_value: &str) -> PartnerChannelListCall<'a, C> {
56270        self._filter = Some(new_value.to_string());
56271        self
56272    }
56273    /// The ID of the advertiser that owns the channels.
56274    ///
56275    /// Sets the *advertiser id* query property to the given value.
56276    pub fn advertiser_id(mut self, new_value: i64) -> PartnerChannelListCall<'a, C> {
56277        self._advertiser_id = Some(new_value);
56278        self
56279    }
56280    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
56281    /// while executing the actual API request.
56282    ///
56283    /// ````text
56284    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
56285    /// ````
56286    ///
56287    /// Sets the *delegate* property to the given value.
56288    pub fn delegate(
56289        mut self,
56290        new_value: &'a mut dyn common::Delegate,
56291    ) -> PartnerChannelListCall<'a, C> {
56292        self._delegate = Some(new_value);
56293        self
56294    }
56295
56296    /// Set any additional parameter of the query string used in the request.
56297    /// It should be used to set parameters which are not yet available through their own
56298    /// setters.
56299    ///
56300    /// Please note that this method must not be used to set any of the known parameters
56301    /// which have their own setter method. If done anyway, the request will fail.
56302    ///
56303    /// # Additional Parameters
56304    ///
56305    /// * *$.xgafv* (query-string) - V1 error format.
56306    /// * *access_token* (query-string) - OAuth access token.
56307    /// * *alt* (query-string) - Data format for response.
56308    /// * *callback* (query-string) - JSONP
56309    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
56310    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
56311    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
56312    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
56313    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
56314    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
56315    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
56316    pub fn param<T>(mut self, name: T, value: T) -> PartnerChannelListCall<'a, C>
56317    where
56318        T: AsRef<str>,
56319    {
56320        self._additional_params
56321            .insert(name.as_ref().to_string(), value.as_ref().to_string());
56322        self
56323    }
56324
56325    /// Identifies the authorization scope for the method you are building.
56326    ///
56327    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
56328    /// [`Scope::DisplayVideo`].
56329    ///
56330    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
56331    /// tokens for more than one scope.
56332    ///
56333    /// Usually there is more than one suitable scope to authorize an operation, some of which may
56334    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
56335    /// sufficient, a read-write scope will do as well.
56336    pub fn add_scope<St>(mut self, scope: St) -> PartnerChannelListCall<'a, C>
56337    where
56338        St: AsRef<str>,
56339    {
56340        self._scopes.insert(String::from(scope.as_ref()));
56341        self
56342    }
56343    /// Identifies the authorization scope(s) for the method you are building.
56344    ///
56345    /// See [`Self::add_scope()`] for details.
56346    pub fn add_scopes<I, St>(mut self, scopes: I) -> PartnerChannelListCall<'a, C>
56347    where
56348        I: IntoIterator<Item = St>,
56349        St: AsRef<str>,
56350    {
56351        self._scopes
56352            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
56353        self
56354    }
56355
56356    /// Removes all scopes, and no default scope will be used either.
56357    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
56358    /// for details).
56359    pub fn clear_scopes(mut self) -> PartnerChannelListCall<'a, C> {
56360        self._scopes.clear();
56361        self
56362    }
56363}
56364
56365/// Updates a channel. Returns the updated channel if successful.
56366///
56367/// A builder for the *channels.patch* method supported by a *partner* resource.
56368/// It is not used directly, but through a [`PartnerMethods`] instance.
56369///
56370/// # Example
56371///
56372/// Instantiate a resource method builder
56373///
56374/// ```test_harness,no_run
56375/// # extern crate hyper;
56376/// # extern crate hyper_rustls;
56377/// # extern crate google_displayvideo1 as displayvideo1;
56378/// use displayvideo1::api::Channel;
56379/// # async fn dox() {
56380/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
56381///
56382/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
56383/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
56384/// #     secret,
56385/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
56386/// # ).build().await.unwrap();
56387///
56388/// # let client = hyper_util::client::legacy::Client::builder(
56389/// #     hyper_util::rt::TokioExecutor::new()
56390/// # )
56391/// # .build(
56392/// #     hyper_rustls::HttpsConnectorBuilder::new()
56393/// #         .with_native_roots()
56394/// #         .unwrap()
56395/// #         .https_or_http()
56396/// #         .enable_http1()
56397/// #         .build()
56398/// # );
56399/// # let mut hub = DisplayVideo::new(client, auth);
56400/// // As the method needs a request, you would usually fill it with the desired information
56401/// // into the respective structure. Some of the parts shown here might not be applicable !
56402/// // Values shown here are possibly random and not representative !
56403/// let mut req = Channel::default();
56404///
56405/// // You can configure optional parameters by calling the respective setters at will, and
56406/// // execute the final call using `doit()`.
56407/// // Values shown here are possibly random and not representative !
56408/// let result = hub.partners().channels_patch(req, -88, -33)
56409///              .update_mask(FieldMask::new::<&str>(&[]))
56410///              .advertiser_id(-98)
56411///              .doit().await;
56412/// # }
56413/// ```
56414pub struct PartnerChannelPatchCall<'a, C>
56415where
56416    C: 'a,
56417{
56418    hub: &'a DisplayVideo<C>,
56419    _request: Channel,
56420    _partner_id: i64,
56421    _channel_id: i64,
56422    _update_mask: Option<common::FieldMask>,
56423    _advertiser_id: Option<i64>,
56424    _delegate: Option<&'a mut dyn common::Delegate>,
56425    _additional_params: HashMap<String, String>,
56426    _scopes: BTreeSet<String>,
56427}
56428
56429impl<'a, C> common::CallBuilder for PartnerChannelPatchCall<'a, C> {}
56430
56431impl<'a, C> PartnerChannelPatchCall<'a, C>
56432where
56433    C: common::Connector,
56434{
56435    /// Perform the operation you have build so far.
56436    pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
56437        use std::borrow::Cow;
56438        use std::io::{Read, Seek};
56439
56440        use common::{url::Params, ToParts};
56441        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
56442
56443        let mut dd = common::DefaultDelegate;
56444        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
56445        dlg.begin(common::MethodInfo {
56446            id: "displayvideo.partners.channels.patch",
56447            http_method: hyper::Method::PATCH,
56448        });
56449
56450        for &field in [
56451            "alt",
56452            "partnerId",
56453            "channelId",
56454            "updateMask",
56455            "advertiserId",
56456        ]
56457        .iter()
56458        {
56459            if self._additional_params.contains_key(field) {
56460                dlg.finished(false);
56461                return Err(common::Error::FieldClash(field));
56462            }
56463        }
56464
56465        let mut params = Params::with_capacity(7 + self._additional_params.len());
56466        params.push("partnerId", self._partner_id.to_string());
56467        params.push("channelId", self._channel_id.to_string());
56468        if let Some(value) = self._update_mask.as_ref() {
56469            params.push("updateMask", value.to_string());
56470        }
56471        if let Some(value) = self._advertiser_id.as_ref() {
56472            params.push("advertiserId", value.to_string());
56473        }
56474
56475        params.extend(self._additional_params.iter());
56476
56477        params.push("alt", "json");
56478        let mut url = self.hub._base_url.clone() + "v1/partners/{+partnerId}/channels/{channelId}";
56479        if self._scopes.is_empty() {
56480            self._scopes
56481                .insert(Scope::DisplayVideo.as_ref().to_string());
56482        }
56483
56484        #[allow(clippy::single_element_loop)]
56485        for &(find_this, param_name) in
56486            [("{+partnerId}", "partnerId"), ("{channelId}", "channelId")].iter()
56487        {
56488            url = params.uri_replacement(url, param_name, find_this, true);
56489        }
56490        {
56491            let to_remove = ["channelId", "partnerId"];
56492            params.remove_params(&to_remove);
56493        }
56494
56495        let url = params.parse_with_url(&url);
56496
56497        let mut json_mime_type = mime::APPLICATION_JSON;
56498        let mut request_value_reader = {
56499            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
56500            common::remove_json_null_values(&mut value);
56501            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
56502            serde_json::to_writer(&mut dst, &value).unwrap();
56503            dst
56504        };
56505        let request_size = request_value_reader
56506            .seek(std::io::SeekFrom::End(0))
56507            .unwrap();
56508        request_value_reader
56509            .seek(std::io::SeekFrom::Start(0))
56510            .unwrap();
56511
56512        loop {
56513            let token = match self
56514                .hub
56515                .auth
56516                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
56517                .await
56518            {
56519                Ok(token) => token,
56520                Err(e) => match dlg.token(e) {
56521                    Ok(token) => token,
56522                    Err(e) => {
56523                        dlg.finished(false);
56524                        return Err(common::Error::MissingToken(e));
56525                    }
56526                },
56527            };
56528            request_value_reader
56529                .seek(std::io::SeekFrom::Start(0))
56530                .unwrap();
56531            let mut req_result = {
56532                let client = &self.hub.client;
56533                dlg.pre_request();
56534                let mut req_builder = hyper::Request::builder()
56535                    .method(hyper::Method::PATCH)
56536                    .uri(url.as_str())
56537                    .header(USER_AGENT, self.hub._user_agent.clone());
56538
56539                if let Some(token) = token.as_ref() {
56540                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
56541                }
56542
56543                let request = req_builder
56544                    .header(CONTENT_TYPE, json_mime_type.to_string())
56545                    .header(CONTENT_LENGTH, request_size as u64)
56546                    .body(common::to_body(
56547                        request_value_reader.get_ref().clone().into(),
56548                    ));
56549
56550                client.request(request.unwrap()).await
56551            };
56552
56553            match req_result {
56554                Err(err) => {
56555                    if let common::Retry::After(d) = dlg.http_error(&err) {
56556                        sleep(d).await;
56557                        continue;
56558                    }
56559                    dlg.finished(false);
56560                    return Err(common::Error::HttpError(err));
56561                }
56562                Ok(res) => {
56563                    let (mut parts, body) = res.into_parts();
56564                    let mut body = common::Body::new(body);
56565                    if !parts.status.is_success() {
56566                        let bytes = common::to_bytes(body).await.unwrap_or_default();
56567                        let error = serde_json::from_str(&common::to_string(&bytes));
56568                        let response = common::to_response(parts, bytes.into());
56569
56570                        if let common::Retry::After(d) =
56571                            dlg.http_failure(&response, error.as_ref().ok())
56572                        {
56573                            sleep(d).await;
56574                            continue;
56575                        }
56576
56577                        dlg.finished(false);
56578
56579                        return Err(match error {
56580                            Ok(value) => common::Error::BadRequest(value),
56581                            _ => common::Error::Failure(response),
56582                        });
56583                    }
56584                    let response = {
56585                        let bytes = common::to_bytes(body).await.unwrap_or_default();
56586                        let encoded = common::to_string(&bytes);
56587                        match serde_json::from_str(&encoded) {
56588                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
56589                            Err(error) => {
56590                                dlg.response_json_decode_error(&encoded, &error);
56591                                return Err(common::Error::JsonDecodeError(
56592                                    encoded.to_string(),
56593                                    error,
56594                                ));
56595                            }
56596                        }
56597                    };
56598
56599                    dlg.finished(true);
56600                    return Ok(response);
56601                }
56602            }
56603        }
56604    }
56605
56606    ///
56607    /// Sets the *request* property to the given value.
56608    ///
56609    /// Even though the property as already been set when instantiating this call,
56610    /// we provide this method for API completeness.
56611    pub fn request(mut self, new_value: Channel) -> PartnerChannelPatchCall<'a, C> {
56612        self._request = new_value;
56613        self
56614    }
56615    /// The ID of the partner that owns the created channel.
56616    ///
56617    /// Sets the *partner id* path property to the given value.
56618    ///
56619    /// Even though the property as already been set when instantiating this call,
56620    /// we provide this method for API completeness.
56621    pub fn partner_id(mut self, new_value: i64) -> PartnerChannelPatchCall<'a, C> {
56622        self._partner_id = new_value;
56623        self
56624    }
56625    /// Output only. The unique ID of the channel. Assigned by the system.
56626    ///
56627    /// Sets the *channel id* path property to the given value.
56628    ///
56629    /// Even though the property as already been set when instantiating this call,
56630    /// we provide this method for API completeness.
56631    pub fn channel_id(mut self, new_value: i64) -> PartnerChannelPatchCall<'a, C> {
56632        self._channel_id = new_value;
56633        self
56634    }
56635    /// Required. The mask to control which fields to update.
56636    ///
56637    /// Sets the *update mask* query property to the given value.
56638    pub fn update_mask(mut self, new_value: common::FieldMask) -> PartnerChannelPatchCall<'a, C> {
56639        self._update_mask = Some(new_value);
56640        self
56641    }
56642    /// The ID of the advertiser that owns the created channel.
56643    ///
56644    /// Sets the *advertiser id* query property to the given value.
56645    pub fn advertiser_id(mut self, new_value: i64) -> PartnerChannelPatchCall<'a, C> {
56646        self._advertiser_id = Some(new_value);
56647        self
56648    }
56649    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
56650    /// while executing the actual API request.
56651    ///
56652    /// ````text
56653    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
56654    /// ````
56655    ///
56656    /// Sets the *delegate* property to the given value.
56657    pub fn delegate(
56658        mut self,
56659        new_value: &'a mut dyn common::Delegate,
56660    ) -> PartnerChannelPatchCall<'a, C> {
56661        self._delegate = Some(new_value);
56662        self
56663    }
56664
56665    /// Set any additional parameter of the query string used in the request.
56666    /// It should be used to set parameters which are not yet available through their own
56667    /// setters.
56668    ///
56669    /// Please note that this method must not be used to set any of the known parameters
56670    /// which have their own setter method. If done anyway, the request will fail.
56671    ///
56672    /// # Additional Parameters
56673    ///
56674    /// * *$.xgafv* (query-string) - V1 error format.
56675    /// * *access_token* (query-string) - OAuth access token.
56676    /// * *alt* (query-string) - Data format for response.
56677    /// * *callback* (query-string) - JSONP
56678    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
56679    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
56680    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
56681    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
56682    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
56683    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
56684    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
56685    pub fn param<T>(mut self, name: T, value: T) -> PartnerChannelPatchCall<'a, C>
56686    where
56687        T: AsRef<str>,
56688    {
56689        self._additional_params
56690            .insert(name.as_ref().to_string(), value.as_ref().to_string());
56691        self
56692    }
56693
56694    /// Identifies the authorization scope for the method you are building.
56695    ///
56696    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
56697    /// [`Scope::DisplayVideo`].
56698    ///
56699    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
56700    /// tokens for more than one scope.
56701    ///
56702    /// Usually there is more than one suitable scope to authorize an operation, some of which may
56703    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
56704    /// sufficient, a read-write scope will do as well.
56705    pub fn add_scope<St>(mut self, scope: St) -> PartnerChannelPatchCall<'a, C>
56706    where
56707        St: AsRef<str>,
56708    {
56709        self._scopes.insert(String::from(scope.as_ref()));
56710        self
56711    }
56712    /// Identifies the authorization scope(s) for the method you are building.
56713    ///
56714    /// See [`Self::add_scope()`] for details.
56715    pub fn add_scopes<I, St>(mut self, scopes: I) -> PartnerChannelPatchCall<'a, C>
56716    where
56717        I: IntoIterator<Item = St>,
56718        St: AsRef<str>,
56719    {
56720        self._scopes
56721            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
56722        self
56723    }
56724
56725    /// Removes all scopes, and no default scope will be used either.
56726    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
56727    /// for details).
56728    pub fn clear_scopes(mut self) -> PartnerChannelPatchCall<'a, C> {
56729        self._scopes.clear();
56730        self
56731    }
56732}
56733
56734/// Assigns a targeting option to a partner. Returns the assigned targeting option if successful.
56735///
56736/// A builder for the *targetingTypes.assignedTargetingOptions.create* method supported by a *partner* resource.
56737/// It is not used directly, but through a [`PartnerMethods`] instance.
56738///
56739/// # Example
56740///
56741/// Instantiate a resource method builder
56742///
56743/// ```test_harness,no_run
56744/// # extern crate hyper;
56745/// # extern crate hyper_rustls;
56746/// # extern crate google_displayvideo1 as displayvideo1;
56747/// use displayvideo1::api::AssignedTargetingOption;
56748/// # async fn dox() {
56749/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
56750///
56751/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
56752/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
56753/// #     secret,
56754/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
56755/// # ).build().await.unwrap();
56756///
56757/// # let client = hyper_util::client::legacy::Client::builder(
56758/// #     hyper_util::rt::TokioExecutor::new()
56759/// # )
56760/// # .build(
56761/// #     hyper_rustls::HttpsConnectorBuilder::new()
56762/// #         .with_native_roots()
56763/// #         .unwrap()
56764/// #         .https_or_http()
56765/// #         .enable_http1()
56766/// #         .build()
56767/// # );
56768/// # let mut hub = DisplayVideo::new(client, auth);
56769/// // As the method needs a request, you would usually fill it with the desired information
56770/// // into the respective structure. Some of the parts shown here might not be applicable !
56771/// // Values shown here are possibly random and not representative !
56772/// let mut req = AssignedTargetingOption::default();
56773///
56774/// // You can configure optional parameters by calling the respective setters at will, and
56775/// // execute the final call using `doit()`.
56776/// // Values shown here are possibly random and not representative !
56777/// let result = hub.partners().targeting_types_assigned_targeting_options_create(req, -12, "targetingType")
56778///              .doit().await;
56779/// # }
56780/// ```
56781pub struct PartnerTargetingTypeAssignedTargetingOptionCreateCall<'a, C>
56782where
56783    C: 'a,
56784{
56785    hub: &'a DisplayVideo<C>,
56786    _request: AssignedTargetingOption,
56787    _partner_id: i64,
56788    _targeting_type: String,
56789    _delegate: Option<&'a mut dyn common::Delegate>,
56790    _additional_params: HashMap<String, String>,
56791    _scopes: BTreeSet<String>,
56792}
56793
56794impl<'a, C> common::CallBuilder for PartnerTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {}
56795
56796impl<'a, C> PartnerTargetingTypeAssignedTargetingOptionCreateCall<'a, C>
56797where
56798    C: common::Connector,
56799{
56800    /// Perform the operation you have build so far.
56801    pub async fn doit(mut self) -> common::Result<(common::Response, AssignedTargetingOption)> {
56802        use std::borrow::Cow;
56803        use std::io::{Read, Seek};
56804
56805        use common::{url::Params, ToParts};
56806        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
56807
56808        let mut dd = common::DefaultDelegate;
56809        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
56810        dlg.begin(common::MethodInfo {
56811            id: "displayvideo.partners.targetingTypes.assignedTargetingOptions.create",
56812            http_method: hyper::Method::POST,
56813        });
56814
56815        for &field in ["alt", "partnerId", "targetingType"].iter() {
56816            if self._additional_params.contains_key(field) {
56817                dlg.finished(false);
56818                return Err(common::Error::FieldClash(field));
56819            }
56820        }
56821
56822        let mut params = Params::with_capacity(5 + self._additional_params.len());
56823        params.push("partnerId", self._partner_id.to_string());
56824        params.push("targetingType", self._targeting_type);
56825
56826        params.extend(self._additional_params.iter());
56827
56828        params.push("alt", "json");
56829        let mut url = self.hub._base_url.clone()
56830            + "v1/partners/{+partnerId}/targetingTypes/{+targetingType}/assignedTargetingOptions";
56831        if self._scopes.is_empty() {
56832            self._scopes
56833                .insert(Scope::DisplayVideo.as_ref().to_string());
56834        }
56835
56836        #[allow(clippy::single_element_loop)]
56837        for &(find_this, param_name) in [
56838            ("{+partnerId}", "partnerId"),
56839            ("{+targetingType}", "targetingType"),
56840        ]
56841        .iter()
56842        {
56843            url = params.uri_replacement(url, param_name, find_this, true);
56844        }
56845        {
56846            let to_remove = ["targetingType", "partnerId"];
56847            params.remove_params(&to_remove);
56848        }
56849
56850        let url = params.parse_with_url(&url);
56851
56852        let mut json_mime_type = mime::APPLICATION_JSON;
56853        let mut request_value_reader = {
56854            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
56855            common::remove_json_null_values(&mut value);
56856            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
56857            serde_json::to_writer(&mut dst, &value).unwrap();
56858            dst
56859        };
56860        let request_size = request_value_reader
56861            .seek(std::io::SeekFrom::End(0))
56862            .unwrap();
56863        request_value_reader
56864            .seek(std::io::SeekFrom::Start(0))
56865            .unwrap();
56866
56867        loop {
56868            let token = match self
56869                .hub
56870                .auth
56871                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
56872                .await
56873            {
56874                Ok(token) => token,
56875                Err(e) => match dlg.token(e) {
56876                    Ok(token) => token,
56877                    Err(e) => {
56878                        dlg.finished(false);
56879                        return Err(common::Error::MissingToken(e));
56880                    }
56881                },
56882            };
56883            request_value_reader
56884                .seek(std::io::SeekFrom::Start(0))
56885                .unwrap();
56886            let mut req_result = {
56887                let client = &self.hub.client;
56888                dlg.pre_request();
56889                let mut req_builder = hyper::Request::builder()
56890                    .method(hyper::Method::POST)
56891                    .uri(url.as_str())
56892                    .header(USER_AGENT, self.hub._user_agent.clone());
56893
56894                if let Some(token) = token.as_ref() {
56895                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
56896                }
56897
56898                let request = req_builder
56899                    .header(CONTENT_TYPE, json_mime_type.to_string())
56900                    .header(CONTENT_LENGTH, request_size as u64)
56901                    .body(common::to_body(
56902                        request_value_reader.get_ref().clone().into(),
56903                    ));
56904
56905                client.request(request.unwrap()).await
56906            };
56907
56908            match req_result {
56909                Err(err) => {
56910                    if let common::Retry::After(d) = dlg.http_error(&err) {
56911                        sleep(d).await;
56912                        continue;
56913                    }
56914                    dlg.finished(false);
56915                    return Err(common::Error::HttpError(err));
56916                }
56917                Ok(res) => {
56918                    let (mut parts, body) = res.into_parts();
56919                    let mut body = common::Body::new(body);
56920                    if !parts.status.is_success() {
56921                        let bytes = common::to_bytes(body).await.unwrap_or_default();
56922                        let error = serde_json::from_str(&common::to_string(&bytes));
56923                        let response = common::to_response(parts, bytes.into());
56924
56925                        if let common::Retry::After(d) =
56926                            dlg.http_failure(&response, error.as_ref().ok())
56927                        {
56928                            sleep(d).await;
56929                            continue;
56930                        }
56931
56932                        dlg.finished(false);
56933
56934                        return Err(match error {
56935                            Ok(value) => common::Error::BadRequest(value),
56936                            _ => common::Error::Failure(response),
56937                        });
56938                    }
56939                    let response = {
56940                        let bytes = common::to_bytes(body).await.unwrap_or_default();
56941                        let encoded = common::to_string(&bytes);
56942                        match serde_json::from_str(&encoded) {
56943                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
56944                            Err(error) => {
56945                                dlg.response_json_decode_error(&encoded, &error);
56946                                return Err(common::Error::JsonDecodeError(
56947                                    encoded.to_string(),
56948                                    error,
56949                                ));
56950                            }
56951                        }
56952                    };
56953
56954                    dlg.finished(true);
56955                    return Ok(response);
56956                }
56957            }
56958        }
56959    }
56960
56961    ///
56962    /// Sets the *request* property to the given value.
56963    ///
56964    /// Even though the property as already been set when instantiating this call,
56965    /// we provide this method for API completeness.
56966    pub fn request(
56967        mut self,
56968        new_value: AssignedTargetingOption,
56969    ) -> PartnerTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
56970        self._request = new_value;
56971        self
56972    }
56973    /// Required. The ID of the partner.
56974    ///
56975    /// Sets the *partner id* path property to the given value.
56976    ///
56977    /// Even though the property as already been set when instantiating this call,
56978    /// we provide this method for API completeness.
56979    pub fn partner_id(
56980        mut self,
56981        new_value: i64,
56982    ) -> PartnerTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
56983        self._partner_id = new_value;
56984        self
56985    }
56986    /// Required. Identifies the type of this assigned targeting option. Supported targeting types: * `TARGETING_TYPE_CHANNEL`
56987    ///
56988    /// Sets the *targeting type* path property to the given value.
56989    ///
56990    /// Even though the property as already been set when instantiating this call,
56991    /// we provide this method for API completeness.
56992    pub fn targeting_type(
56993        mut self,
56994        new_value: &str,
56995    ) -> PartnerTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
56996        self._targeting_type = new_value.to_string();
56997        self
56998    }
56999    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
57000    /// while executing the actual API request.
57001    ///
57002    /// ````text
57003    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
57004    /// ````
57005    ///
57006    /// Sets the *delegate* property to the given value.
57007    pub fn delegate(
57008        mut self,
57009        new_value: &'a mut dyn common::Delegate,
57010    ) -> PartnerTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
57011        self._delegate = Some(new_value);
57012        self
57013    }
57014
57015    /// Set any additional parameter of the query string used in the request.
57016    /// It should be used to set parameters which are not yet available through their own
57017    /// setters.
57018    ///
57019    /// Please note that this method must not be used to set any of the known parameters
57020    /// which have their own setter method. If done anyway, the request will fail.
57021    ///
57022    /// # Additional Parameters
57023    ///
57024    /// * *$.xgafv* (query-string) - V1 error format.
57025    /// * *access_token* (query-string) - OAuth access token.
57026    /// * *alt* (query-string) - Data format for response.
57027    /// * *callback* (query-string) - JSONP
57028    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
57029    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
57030    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
57031    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
57032    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
57033    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
57034    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
57035    pub fn param<T>(
57036        mut self,
57037        name: T,
57038        value: T,
57039    ) -> PartnerTargetingTypeAssignedTargetingOptionCreateCall<'a, C>
57040    where
57041        T: AsRef<str>,
57042    {
57043        self._additional_params
57044            .insert(name.as_ref().to_string(), value.as_ref().to_string());
57045        self
57046    }
57047
57048    /// Identifies the authorization scope for the method you are building.
57049    ///
57050    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
57051    /// [`Scope::DisplayVideo`].
57052    ///
57053    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
57054    /// tokens for more than one scope.
57055    ///
57056    /// Usually there is more than one suitable scope to authorize an operation, some of which may
57057    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
57058    /// sufficient, a read-write scope will do as well.
57059    pub fn add_scope<St>(
57060        mut self,
57061        scope: St,
57062    ) -> PartnerTargetingTypeAssignedTargetingOptionCreateCall<'a, C>
57063    where
57064        St: AsRef<str>,
57065    {
57066        self._scopes.insert(String::from(scope.as_ref()));
57067        self
57068    }
57069    /// Identifies the authorization scope(s) for the method you are building.
57070    ///
57071    /// See [`Self::add_scope()`] for details.
57072    pub fn add_scopes<I, St>(
57073        mut self,
57074        scopes: I,
57075    ) -> PartnerTargetingTypeAssignedTargetingOptionCreateCall<'a, C>
57076    where
57077        I: IntoIterator<Item = St>,
57078        St: AsRef<str>,
57079    {
57080        self._scopes
57081            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
57082        self
57083    }
57084
57085    /// Removes all scopes, and no default scope will be used either.
57086    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
57087    /// for details).
57088    pub fn clear_scopes(mut self) -> PartnerTargetingTypeAssignedTargetingOptionCreateCall<'a, C> {
57089        self._scopes.clear();
57090        self
57091    }
57092}
57093
57094/// Deletes an assigned targeting option from a partner.
57095///
57096/// A builder for the *targetingTypes.assignedTargetingOptions.delete* method supported by a *partner* resource.
57097/// It is not used directly, but through a [`PartnerMethods`] instance.
57098///
57099/// # Example
57100///
57101/// Instantiate a resource method builder
57102///
57103/// ```test_harness,no_run
57104/// # extern crate hyper;
57105/// # extern crate hyper_rustls;
57106/// # extern crate google_displayvideo1 as displayvideo1;
57107/// # async fn dox() {
57108/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
57109///
57110/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
57111/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
57112/// #     secret,
57113/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
57114/// # ).build().await.unwrap();
57115///
57116/// # let client = hyper_util::client::legacy::Client::builder(
57117/// #     hyper_util::rt::TokioExecutor::new()
57118/// # )
57119/// # .build(
57120/// #     hyper_rustls::HttpsConnectorBuilder::new()
57121/// #         .with_native_roots()
57122/// #         .unwrap()
57123/// #         .https_or_http()
57124/// #         .enable_http1()
57125/// #         .build()
57126/// # );
57127/// # let mut hub = DisplayVideo::new(client, auth);
57128/// // You can configure optional parameters by calling the respective setters at will, and
57129/// // execute the final call using `doit()`.
57130/// // Values shown here are possibly random and not representative !
57131/// let result = hub.partners().targeting_types_assigned_targeting_options_delete(-50, "targetingType", "assignedTargetingOptionId")
57132///              .doit().await;
57133/// # }
57134/// ```
57135pub struct PartnerTargetingTypeAssignedTargetingOptionDeleteCall<'a, C>
57136where
57137    C: 'a,
57138{
57139    hub: &'a DisplayVideo<C>,
57140    _partner_id: i64,
57141    _targeting_type: String,
57142    _assigned_targeting_option_id: String,
57143    _delegate: Option<&'a mut dyn common::Delegate>,
57144    _additional_params: HashMap<String, String>,
57145    _scopes: BTreeSet<String>,
57146}
57147
57148impl<'a, C> common::CallBuilder for PartnerTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {}
57149
57150impl<'a, C> PartnerTargetingTypeAssignedTargetingOptionDeleteCall<'a, C>
57151where
57152    C: common::Connector,
57153{
57154    /// Perform the operation you have build so far.
57155    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
57156        use std::borrow::Cow;
57157        use std::io::{Read, Seek};
57158
57159        use common::{url::Params, ToParts};
57160        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
57161
57162        let mut dd = common::DefaultDelegate;
57163        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
57164        dlg.begin(common::MethodInfo {
57165            id: "displayvideo.partners.targetingTypes.assignedTargetingOptions.delete",
57166            http_method: hyper::Method::DELETE,
57167        });
57168
57169        for &field in [
57170            "alt",
57171            "partnerId",
57172            "targetingType",
57173            "assignedTargetingOptionId",
57174        ]
57175        .iter()
57176        {
57177            if self._additional_params.contains_key(field) {
57178                dlg.finished(false);
57179                return Err(common::Error::FieldClash(field));
57180            }
57181        }
57182
57183        let mut params = Params::with_capacity(5 + self._additional_params.len());
57184        params.push("partnerId", self._partner_id.to_string());
57185        params.push("targetingType", self._targeting_type);
57186        params.push(
57187            "assignedTargetingOptionId",
57188            self._assigned_targeting_option_id,
57189        );
57190
57191        params.extend(self._additional_params.iter());
57192
57193        params.push("alt", "json");
57194        let mut url = self.hub._base_url.clone() + "v1/partners/{+partnerId}/targetingTypes/{+targetingType}/assignedTargetingOptions/{+assignedTargetingOptionId}";
57195        if self._scopes.is_empty() {
57196            self._scopes
57197                .insert(Scope::DisplayVideo.as_ref().to_string());
57198        }
57199
57200        #[allow(clippy::single_element_loop)]
57201        for &(find_this, param_name) in [
57202            ("{+partnerId}", "partnerId"),
57203            ("{+targetingType}", "targetingType"),
57204            ("{+assignedTargetingOptionId}", "assignedTargetingOptionId"),
57205        ]
57206        .iter()
57207        {
57208            url = params.uri_replacement(url, param_name, find_this, true);
57209        }
57210        {
57211            let to_remove = ["assignedTargetingOptionId", "targetingType", "partnerId"];
57212            params.remove_params(&to_remove);
57213        }
57214
57215        let url = params.parse_with_url(&url);
57216
57217        loop {
57218            let token = match self
57219                .hub
57220                .auth
57221                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
57222                .await
57223            {
57224                Ok(token) => token,
57225                Err(e) => match dlg.token(e) {
57226                    Ok(token) => token,
57227                    Err(e) => {
57228                        dlg.finished(false);
57229                        return Err(common::Error::MissingToken(e));
57230                    }
57231                },
57232            };
57233            let mut req_result = {
57234                let client = &self.hub.client;
57235                dlg.pre_request();
57236                let mut req_builder = hyper::Request::builder()
57237                    .method(hyper::Method::DELETE)
57238                    .uri(url.as_str())
57239                    .header(USER_AGENT, self.hub._user_agent.clone());
57240
57241                if let Some(token) = token.as_ref() {
57242                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
57243                }
57244
57245                let request = req_builder
57246                    .header(CONTENT_LENGTH, 0_u64)
57247                    .body(common::to_body::<String>(None));
57248
57249                client.request(request.unwrap()).await
57250            };
57251
57252            match req_result {
57253                Err(err) => {
57254                    if let common::Retry::After(d) = dlg.http_error(&err) {
57255                        sleep(d).await;
57256                        continue;
57257                    }
57258                    dlg.finished(false);
57259                    return Err(common::Error::HttpError(err));
57260                }
57261                Ok(res) => {
57262                    let (mut parts, body) = res.into_parts();
57263                    let mut body = common::Body::new(body);
57264                    if !parts.status.is_success() {
57265                        let bytes = common::to_bytes(body).await.unwrap_or_default();
57266                        let error = serde_json::from_str(&common::to_string(&bytes));
57267                        let response = common::to_response(parts, bytes.into());
57268
57269                        if let common::Retry::After(d) =
57270                            dlg.http_failure(&response, error.as_ref().ok())
57271                        {
57272                            sleep(d).await;
57273                            continue;
57274                        }
57275
57276                        dlg.finished(false);
57277
57278                        return Err(match error {
57279                            Ok(value) => common::Error::BadRequest(value),
57280                            _ => common::Error::Failure(response),
57281                        });
57282                    }
57283                    let response = {
57284                        let bytes = common::to_bytes(body).await.unwrap_or_default();
57285                        let encoded = common::to_string(&bytes);
57286                        match serde_json::from_str(&encoded) {
57287                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
57288                            Err(error) => {
57289                                dlg.response_json_decode_error(&encoded, &error);
57290                                return Err(common::Error::JsonDecodeError(
57291                                    encoded.to_string(),
57292                                    error,
57293                                ));
57294                            }
57295                        }
57296                    };
57297
57298                    dlg.finished(true);
57299                    return Ok(response);
57300                }
57301            }
57302        }
57303    }
57304
57305    /// Required. The ID of the partner.
57306    ///
57307    /// Sets the *partner id* path property to the given value.
57308    ///
57309    /// Even though the property as already been set when instantiating this call,
57310    /// we provide this method for API completeness.
57311    pub fn partner_id(
57312        mut self,
57313        new_value: i64,
57314    ) -> PartnerTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
57315        self._partner_id = new_value;
57316        self
57317    }
57318    /// Required. Identifies the type of this assigned targeting option. Supported targeting types: * `TARGETING_TYPE_CHANNEL`
57319    ///
57320    /// Sets the *targeting type* path property to the given value.
57321    ///
57322    /// Even though the property as already been set when instantiating this call,
57323    /// we provide this method for API completeness.
57324    pub fn targeting_type(
57325        mut self,
57326        new_value: &str,
57327    ) -> PartnerTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
57328        self._targeting_type = new_value.to_string();
57329        self
57330    }
57331    /// Required. The ID of the assigned targeting option to delete.
57332    ///
57333    /// Sets the *assigned targeting option id* path property to the given value.
57334    ///
57335    /// Even though the property as already been set when instantiating this call,
57336    /// we provide this method for API completeness.
57337    pub fn assigned_targeting_option_id(
57338        mut self,
57339        new_value: &str,
57340    ) -> PartnerTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
57341        self._assigned_targeting_option_id = new_value.to_string();
57342        self
57343    }
57344    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
57345    /// while executing the actual API request.
57346    ///
57347    /// ````text
57348    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
57349    /// ````
57350    ///
57351    /// Sets the *delegate* property to the given value.
57352    pub fn delegate(
57353        mut self,
57354        new_value: &'a mut dyn common::Delegate,
57355    ) -> PartnerTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
57356        self._delegate = Some(new_value);
57357        self
57358    }
57359
57360    /// Set any additional parameter of the query string used in the request.
57361    /// It should be used to set parameters which are not yet available through their own
57362    /// setters.
57363    ///
57364    /// Please note that this method must not be used to set any of the known parameters
57365    /// which have their own setter method. If done anyway, the request will fail.
57366    ///
57367    /// # Additional Parameters
57368    ///
57369    /// * *$.xgafv* (query-string) - V1 error format.
57370    /// * *access_token* (query-string) - OAuth access token.
57371    /// * *alt* (query-string) - Data format for response.
57372    /// * *callback* (query-string) - JSONP
57373    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
57374    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
57375    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
57376    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
57377    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
57378    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
57379    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
57380    pub fn param<T>(
57381        mut self,
57382        name: T,
57383        value: T,
57384    ) -> PartnerTargetingTypeAssignedTargetingOptionDeleteCall<'a, C>
57385    where
57386        T: AsRef<str>,
57387    {
57388        self._additional_params
57389            .insert(name.as_ref().to_string(), value.as_ref().to_string());
57390        self
57391    }
57392
57393    /// Identifies the authorization scope for the method you are building.
57394    ///
57395    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
57396    /// [`Scope::DisplayVideo`].
57397    ///
57398    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
57399    /// tokens for more than one scope.
57400    ///
57401    /// Usually there is more than one suitable scope to authorize an operation, some of which may
57402    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
57403    /// sufficient, a read-write scope will do as well.
57404    pub fn add_scope<St>(
57405        mut self,
57406        scope: St,
57407    ) -> PartnerTargetingTypeAssignedTargetingOptionDeleteCall<'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>(
57418        mut self,
57419        scopes: I,
57420    ) -> PartnerTargetingTypeAssignedTargetingOptionDeleteCall<'a, C>
57421    where
57422        I: IntoIterator<Item = St>,
57423        St: AsRef<str>,
57424    {
57425        self._scopes
57426            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
57427        self
57428    }
57429
57430    /// Removes all scopes, and no default scope will be used either.
57431    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
57432    /// for details).
57433    pub fn clear_scopes(mut self) -> PartnerTargetingTypeAssignedTargetingOptionDeleteCall<'a, C> {
57434        self._scopes.clear();
57435        self
57436    }
57437}
57438
57439/// Gets a single targeting option assigned to a partner.
57440///
57441/// A builder for the *targetingTypes.assignedTargetingOptions.get* method supported by a *partner* resource.
57442/// It is not used directly, but through a [`PartnerMethods`] instance.
57443///
57444/// # Example
57445///
57446/// Instantiate a resource method builder
57447///
57448/// ```test_harness,no_run
57449/// # extern crate hyper;
57450/// # extern crate hyper_rustls;
57451/// # extern crate google_displayvideo1 as displayvideo1;
57452/// # async fn dox() {
57453/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
57454///
57455/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
57456/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
57457/// #     secret,
57458/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
57459/// # ).build().await.unwrap();
57460///
57461/// # let client = hyper_util::client::legacy::Client::builder(
57462/// #     hyper_util::rt::TokioExecutor::new()
57463/// # )
57464/// # .build(
57465/// #     hyper_rustls::HttpsConnectorBuilder::new()
57466/// #         .with_native_roots()
57467/// #         .unwrap()
57468/// #         .https_or_http()
57469/// #         .enable_http1()
57470/// #         .build()
57471/// # );
57472/// # let mut hub = DisplayVideo::new(client, auth);
57473/// // You can configure optional parameters by calling the respective setters at will, and
57474/// // execute the final call using `doit()`.
57475/// // Values shown here are possibly random and not representative !
57476/// let result = hub.partners().targeting_types_assigned_targeting_options_get(-51, "targetingType", "assignedTargetingOptionId")
57477///              .doit().await;
57478/// # }
57479/// ```
57480pub struct PartnerTargetingTypeAssignedTargetingOptionGetCall<'a, C>
57481where
57482    C: 'a,
57483{
57484    hub: &'a DisplayVideo<C>,
57485    _partner_id: i64,
57486    _targeting_type: String,
57487    _assigned_targeting_option_id: String,
57488    _delegate: Option<&'a mut dyn common::Delegate>,
57489    _additional_params: HashMap<String, String>,
57490    _scopes: BTreeSet<String>,
57491}
57492
57493impl<'a, C> common::CallBuilder for PartnerTargetingTypeAssignedTargetingOptionGetCall<'a, C> {}
57494
57495impl<'a, C> PartnerTargetingTypeAssignedTargetingOptionGetCall<'a, C>
57496where
57497    C: common::Connector,
57498{
57499    /// Perform the operation you have build so far.
57500    pub async fn doit(mut self) -> common::Result<(common::Response, AssignedTargetingOption)> {
57501        use std::borrow::Cow;
57502        use std::io::{Read, Seek};
57503
57504        use common::{url::Params, ToParts};
57505        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
57506
57507        let mut dd = common::DefaultDelegate;
57508        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
57509        dlg.begin(common::MethodInfo {
57510            id: "displayvideo.partners.targetingTypes.assignedTargetingOptions.get",
57511            http_method: hyper::Method::GET,
57512        });
57513
57514        for &field in [
57515            "alt",
57516            "partnerId",
57517            "targetingType",
57518            "assignedTargetingOptionId",
57519        ]
57520        .iter()
57521        {
57522            if self._additional_params.contains_key(field) {
57523                dlg.finished(false);
57524                return Err(common::Error::FieldClash(field));
57525            }
57526        }
57527
57528        let mut params = Params::with_capacity(5 + self._additional_params.len());
57529        params.push("partnerId", self._partner_id.to_string());
57530        params.push("targetingType", self._targeting_type);
57531        params.push(
57532            "assignedTargetingOptionId",
57533            self._assigned_targeting_option_id,
57534        );
57535
57536        params.extend(self._additional_params.iter());
57537
57538        params.push("alt", "json");
57539        let mut url = self.hub._base_url.clone() + "v1/partners/{+partnerId}/targetingTypes/{+targetingType}/assignedTargetingOptions/{+assignedTargetingOptionId}";
57540        if self._scopes.is_empty() {
57541            self._scopes
57542                .insert(Scope::DisplayVideo.as_ref().to_string());
57543        }
57544
57545        #[allow(clippy::single_element_loop)]
57546        for &(find_this, param_name) in [
57547            ("{+partnerId}", "partnerId"),
57548            ("{+targetingType}", "targetingType"),
57549            ("{+assignedTargetingOptionId}", "assignedTargetingOptionId"),
57550        ]
57551        .iter()
57552        {
57553            url = params.uri_replacement(url, param_name, find_this, true);
57554        }
57555        {
57556            let to_remove = ["assignedTargetingOptionId", "targetingType", "partnerId"];
57557            params.remove_params(&to_remove);
57558        }
57559
57560        let url = params.parse_with_url(&url);
57561
57562        loop {
57563            let token = match self
57564                .hub
57565                .auth
57566                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
57567                .await
57568            {
57569                Ok(token) => token,
57570                Err(e) => match dlg.token(e) {
57571                    Ok(token) => token,
57572                    Err(e) => {
57573                        dlg.finished(false);
57574                        return Err(common::Error::MissingToken(e));
57575                    }
57576                },
57577            };
57578            let mut req_result = {
57579                let client = &self.hub.client;
57580                dlg.pre_request();
57581                let mut req_builder = hyper::Request::builder()
57582                    .method(hyper::Method::GET)
57583                    .uri(url.as_str())
57584                    .header(USER_AGENT, self.hub._user_agent.clone());
57585
57586                if let Some(token) = token.as_ref() {
57587                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
57588                }
57589
57590                let request = req_builder
57591                    .header(CONTENT_LENGTH, 0_u64)
57592                    .body(common::to_body::<String>(None));
57593
57594                client.request(request.unwrap()).await
57595            };
57596
57597            match req_result {
57598                Err(err) => {
57599                    if let common::Retry::After(d) = dlg.http_error(&err) {
57600                        sleep(d).await;
57601                        continue;
57602                    }
57603                    dlg.finished(false);
57604                    return Err(common::Error::HttpError(err));
57605                }
57606                Ok(res) => {
57607                    let (mut parts, body) = res.into_parts();
57608                    let mut body = common::Body::new(body);
57609                    if !parts.status.is_success() {
57610                        let bytes = common::to_bytes(body).await.unwrap_or_default();
57611                        let error = serde_json::from_str(&common::to_string(&bytes));
57612                        let response = common::to_response(parts, bytes.into());
57613
57614                        if let common::Retry::After(d) =
57615                            dlg.http_failure(&response, error.as_ref().ok())
57616                        {
57617                            sleep(d).await;
57618                            continue;
57619                        }
57620
57621                        dlg.finished(false);
57622
57623                        return Err(match error {
57624                            Ok(value) => common::Error::BadRequest(value),
57625                            _ => common::Error::Failure(response),
57626                        });
57627                    }
57628                    let response = {
57629                        let bytes = common::to_bytes(body).await.unwrap_or_default();
57630                        let encoded = common::to_string(&bytes);
57631                        match serde_json::from_str(&encoded) {
57632                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
57633                            Err(error) => {
57634                                dlg.response_json_decode_error(&encoded, &error);
57635                                return Err(common::Error::JsonDecodeError(
57636                                    encoded.to_string(),
57637                                    error,
57638                                ));
57639                            }
57640                        }
57641                    };
57642
57643                    dlg.finished(true);
57644                    return Ok(response);
57645                }
57646            }
57647        }
57648    }
57649
57650    /// Required. The ID of the partner.
57651    ///
57652    /// Sets the *partner id* path property to the given value.
57653    ///
57654    /// Even though the property as already been set when instantiating this call,
57655    /// we provide this method for API completeness.
57656    pub fn partner_id(
57657        mut self,
57658        new_value: i64,
57659    ) -> PartnerTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
57660        self._partner_id = new_value;
57661        self
57662    }
57663    /// Required. Identifies the type of this assigned targeting option. Supported targeting types: * `TARGETING_TYPE_CHANNEL`
57664    ///
57665    /// Sets the *targeting type* path property to the given value.
57666    ///
57667    /// Even though the property as already been set when instantiating this call,
57668    /// we provide this method for API completeness.
57669    pub fn targeting_type(
57670        mut self,
57671        new_value: &str,
57672    ) -> PartnerTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
57673        self._targeting_type = new_value.to_string();
57674        self
57675    }
57676    /// Required. An identifier unique to the targeting type in this partner that identifies the assigned targeting option being requested.
57677    ///
57678    /// Sets the *assigned targeting option id* path property to the given value.
57679    ///
57680    /// Even though the property as already been set when instantiating this call,
57681    /// we provide this method for API completeness.
57682    pub fn assigned_targeting_option_id(
57683        mut self,
57684        new_value: &str,
57685    ) -> PartnerTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
57686        self._assigned_targeting_option_id = new_value.to_string();
57687        self
57688    }
57689    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
57690    /// while executing the actual API request.
57691    ///
57692    /// ````text
57693    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
57694    /// ````
57695    ///
57696    /// Sets the *delegate* property to the given value.
57697    pub fn delegate(
57698        mut self,
57699        new_value: &'a mut dyn common::Delegate,
57700    ) -> PartnerTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
57701        self._delegate = Some(new_value);
57702        self
57703    }
57704
57705    /// Set any additional parameter of the query string used in the request.
57706    /// It should be used to set parameters which are not yet available through their own
57707    /// setters.
57708    ///
57709    /// Please note that this method must not be used to set any of the known parameters
57710    /// which have their own setter method. If done anyway, the request will fail.
57711    ///
57712    /// # Additional Parameters
57713    ///
57714    /// * *$.xgafv* (query-string) - V1 error format.
57715    /// * *access_token* (query-string) - OAuth access token.
57716    /// * *alt* (query-string) - Data format for response.
57717    /// * *callback* (query-string) - JSONP
57718    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
57719    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
57720    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
57721    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
57722    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
57723    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
57724    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
57725    pub fn param<T>(
57726        mut self,
57727        name: T,
57728        value: T,
57729    ) -> PartnerTargetingTypeAssignedTargetingOptionGetCall<'a, C>
57730    where
57731        T: AsRef<str>,
57732    {
57733        self._additional_params
57734            .insert(name.as_ref().to_string(), value.as_ref().to_string());
57735        self
57736    }
57737
57738    /// Identifies the authorization scope for the method you are building.
57739    ///
57740    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
57741    /// [`Scope::DisplayVideo`].
57742    ///
57743    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
57744    /// tokens for more than one scope.
57745    ///
57746    /// Usually there is more than one suitable scope to authorize an operation, some of which may
57747    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
57748    /// sufficient, a read-write scope will do as well.
57749    pub fn add_scope<St>(
57750        mut self,
57751        scope: St,
57752    ) -> PartnerTargetingTypeAssignedTargetingOptionGetCall<'a, C>
57753    where
57754        St: AsRef<str>,
57755    {
57756        self._scopes.insert(String::from(scope.as_ref()));
57757        self
57758    }
57759    /// Identifies the authorization scope(s) for the method you are building.
57760    ///
57761    /// See [`Self::add_scope()`] for details.
57762    pub fn add_scopes<I, St>(
57763        mut self,
57764        scopes: I,
57765    ) -> PartnerTargetingTypeAssignedTargetingOptionGetCall<'a, C>
57766    where
57767        I: IntoIterator<Item = St>,
57768        St: AsRef<str>,
57769    {
57770        self._scopes
57771            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
57772        self
57773    }
57774
57775    /// Removes all scopes, and no default scope will be used either.
57776    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
57777    /// for details).
57778    pub fn clear_scopes(mut self) -> PartnerTargetingTypeAssignedTargetingOptionGetCall<'a, C> {
57779        self._scopes.clear();
57780        self
57781    }
57782}
57783
57784/// Lists the targeting options assigned to a partner.
57785///
57786/// A builder for the *targetingTypes.assignedTargetingOptions.list* method supported by a *partner* resource.
57787/// It is not used directly, but through a [`PartnerMethods`] instance.
57788///
57789/// # Example
57790///
57791/// Instantiate a resource method builder
57792///
57793/// ```test_harness,no_run
57794/// # extern crate hyper;
57795/// # extern crate hyper_rustls;
57796/// # extern crate google_displayvideo1 as displayvideo1;
57797/// # async fn dox() {
57798/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
57799///
57800/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
57801/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
57802/// #     secret,
57803/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
57804/// # ).build().await.unwrap();
57805///
57806/// # let client = hyper_util::client::legacy::Client::builder(
57807/// #     hyper_util::rt::TokioExecutor::new()
57808/// # )
57809/// # .build(
57810/// #     hyper_rustls::HttpsConnectorBuilder::new()
57811/// #         .with_native_roots()
57812/// #         .unwrap()
57813/// #         .https_or_http()
57814/// #         .enable_http1()
57815/// #         .build()
57816/// # );
57817/// # let mut hub = DisplayVideo::new(client, auth);
57818/// // You can configure optional parameters by calling the respective setters at will, and
57819/// // execute the final call using `doit()`.
57820/// // Values shown here are possibly random and not representative !
57821/// let result = hub.partners().targeting_types_assigned_targeting_options_list(-101, "targetingType")
57822///              .page_token("consetetur")
57823///              .page_size(-15)
57824///              .order_by("accusam")
57825///              .filter("consetetur")
57826///              .doit().await;
57827/// # }
57828/// ```
57829pub struct PartnerTargetingTypeAssignedTargetingOptionListCall<'a, C>
57830where
57831    C: 'a,
57832{
57833    hub: &'a DisplayVideo<C>,
57834    _partner_id: i64,
57835    _targeting_type: String,
57836    _page_token: Option<String>,
57837    _page_size: Option<i32>,
57838    _order_by: Option<String>,
57839    _filter: Option<String>,
57840    _delegate: Option<&'a mut dyn common::Delegate>,
57841    _additional_params: HashMap<String, String>,
57842    _scopes: BTreeSet<String>,
57843}
57844
57845impl<'a, C> common::CallBuilder for PartnerTargetingTypeAssignedTargetingOptionListCall<'a, C> {}
57846
57847impl<'a, C> PartnerTargetingTypeAssignedTargetingOptionListCall<'a, C>
57848where
57849    C: common::Connector,
57850{
57851    /// Perform the operation you have build so far.
57852    pub async fn doit(
57853        mut self,
57854    ) -> common::Result<(
57855        common::Response,
57856        ListPartnerAssignedTargetingOptionsResponse,
57857    )> {
57858        use std::borrow::Cow;
57859        use std::io::{Read, Seek};
57860
57861        use common::{url::Params, ToParts};
57862        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
57863
57864        let mut dd = common::DefaultDelegate;
57865        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
57866        dlg.begin(common::MethodInfo {
57867            id: "displayvideo.partners.targetingTypes.assignedTargetingOptions.list",
57868            http_method: hyper::Method::GET,
57869        });
57870
57871        for &field in [
57872            "alt",
57873            "partnerId",
57874            "targetingType",
57875            "pageToken",
57876            "pageSize",
57877            "orderBy",
57878            "filter",
57879        ]
57880        .iter()
57881        {
57882            if self._additional_params.contains_key(field) {
57883                dlg.finished(false);
57884                return Err(common::Error::FieldClash(field));
57885            }
57886        }
57887
57888        let mut params = Params::with_capacity(8 + self._additional_params.len());
57889        params.push("partnerId", self._partner_id.to_string());
57890        params.push("targetingType", self._targeting_type);
57891        if let Some(value) = self._page_token.as_ref() {
57892            params.push("pageToken", value);
57893        }
57894        if let Some(value) = self._page_size.as_ref() {
57895            params.push("pageSize", value.to_string());
57896        }
57897        if let Some(value) = self._order_by.as_ref() {
57898            params.push("orderBy", value);
57899        }
57900        if let Some(value) = self._filter.as_ref() {
57901            params.push("filter", value);
57902        }
57903
57904        params.extend(self._additional_params.iter());
57905
57906        params.push("alt", "json");
57907        let mut url = self.hub._base_url.clone()
57908            + "v1/partners/{+partnerId}/targetingTypes/{+targetingType}/assignedTargetingOptions";
57909        if self._scopes.is_empty() {
57910            self._scopes
57911                .insert(Scope::DisplayVideo.as_ref().to_string());
57912        }
57913
57914        #[allow(clippy::single_element_loop)]
57915        for &(find_this, param_name) in [
57916            ("{+partnerId}", "partnerId"),
57917            ("{+targetingType}", "targetingType"),
57918        ]
57919        .iter()
57920        {
57921            url = params.uri_replacement(url, param_name, find_this, true);
57922        }
57923        {
57924            let to_remove = ["targetingType", "partnerId"];
57925            params.remove_params(&to_remove);
57926        }
57927
57928        let url = params.parse_with_url(&url);
57929
57930        loop {
57931            let token = match self
57932                .hub
57933                .auth
57934                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
57935                .await
57936            {
57937                Ok(token) => token,
57938                Err(e) => match dlg.token(e) {
57939                    Ok(token) => token,
57940                    Err(e) => {
57941                        dlg.finished(false);
57942                        return Err(common::Error::MissingToken(e));
57943                    }
57944                },
57945            };
57946            let mut req_result = {
57947                let client = &self.hub.client;
57948                dlg.pre_request();
57949                let mut req_builder = hyper::Request::builder()
57950                    .method(hyper::Method::GET)
57951                    .uri(url.as_str())
57952                    .header(USER_AGENT, self.hub._user_agent.clone());
57953
57954                if let Some(token) = token.as_ref() {
57955                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
57956                }
57957
57958                let request = req_builder
57959                    .header(CONTENT_LENGTH, 0_u64)
57960                    .body(common::to_body::<String>(None));
57961
57962                client.request(request.unwrap()).await
57963            };
57964
57965            match req_result {
57966                Err(err) => {
57967                    if let common::Retry::After(d) = dlg.http_error(&err) {
57968                        sleep(d).await;
57969                        continue;
57970                    }
57971                    dlg.finished(false);
57972                    return Err(common::Error::HttpError(err));
57973                }
57974                Ok(res) => {
57975                    let (mut parts, body) = res.into_parts();
57976                    let mut body = common::Body::new(body);
57977                    if !parts.status.is_success() {
57978                        let bytes = common::to_bytes(body).await.unwrap_or_default();
57979                        let error = serde_json::from_str(&common::to_string(&bytes));
57980                        let response = common::to_response(parts, bytes.into());
57981
57982                        if let common::Retry::After(d) =
57983                            dlg.http_failure(&response, error.as_ref().ok())
57984                        {
57985                            sleep(d).await;
57986                            continue;
57987                        }
57988
57989                        dlg.finished(false);
57990
57991                        return Err(match error {
57992                            Ok(value) => common::Error::BadRequest(value),
57993                            _ => common::Error::Failure(response),
57994                        });
57995                    }
57996                    let response = {
57997                        let bytes = common::to_bytes(body).await.unwrap_or_default();
57998                        let encoded = common::to_string(&bytes);
57999                        match serde_json::from_str(&encoded) {
58000                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
58001                            Err(error) => {
58002                                dlg.response_json_decode_error(&encoded, &error);
58003                                return Err(common::Error::JsonDecodeError(
58004                                    encoded.to_string(),
58005                                    error,
58006                                ));
58007                            }
58008                        }
58009                    };
58010
58011                    dlg.finished(true);
58012                    return Ok(response);
58013                }
58014            }
58015        }
58016    }
58017
58018    /// Required. The ID of the partner.
58019    ///
58020    /// Sets the *partner id* path property to the given value.
58021    ///
58022    /// Even though the property as already been set when instantiating this call,
58023    /// we provide this method for API completeness.
58024    pub fn partner_id(
58025        mut self,
58026        new_value: i64,
58027    ) -> PartnerTargetingTypeAssignedTargetingOptionListCall<'a, C> {
58028        self._partner_id = new_value;
58029        self
58030    }
58031    /// Required. Identifies the type of assigned targeting options to list. Supported targeting types: * `TARGETING_TYPE_CHANNEL`
58032    ///
58033    /// Sets the *targeting type* path property to the given value.
58034    ///
58035    /// Even though the property as already been set when instantiating this call,
58036    /// we provide this method for API completeness.
58037    pub fn targeting_type(
58038        mut self,
58039        new_value: &str,
58040    ) -> PartnerTargetingTypeAssignedTargetingOptionListCall<'a, C> {
58041        self._targeting_type = new_value.to_string();
58042        self
58043    }
58044    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListPartnerAssignedTargetingOptions` method. If not specified, the first page of results will be returned.
58045    ///
58046    /// Sets the *page token* query property to the given value.
58047    pub fn page_token(
58048        mut self,
58049        new_value: &str,
58050    ) -> PartnerTargetingTypeAssignedTargetingOptionListCall<'a, C> {
58051        self._page_token = Some(new_value.to_string());
58052        self
58053    }
58054    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
58055    ///
58056    /// Sets the *page size* query property to the given value.
58057    pub fn page_size(
58058        mut self,
58059        new_value: i32,
58060    ) -> PartnerTargetingTypeAssignedTargetingOptionListCall<'a, C> {
58061        self._page_size = Some(new_value);
58062        self
58063    }
58064    /// Field by which to sort the list. Acceptable values are: * `assignedTargetingOptionId` (default) The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `assignedTargetingOptionId desc`.
58065    ///
58066    /// Sets the *order by* query property to the given value.
58067    pub fn order_by(
58068        mut self,
58069        new_value: &str,
58070    ) -> PartnerTargetingTypeAssignedTargetingOptionListCall<'a, C> {
58071        self._order_by = Some(new_value.to_string());
58072        self
58073    }
58074    /// Allows filtering by assigned targeting option fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by the logical operator `OR`. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `EQUALS (=)` operator. Supported fields: * `assignedTargetingOptionId` Examples: * `AssignedTargetingOption` resource with ID 123456: `assignedTargetingOptionId="123456"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
58075    ///
58076    /// Sets the *filter* query property to the given value.
58077    pub fn filter(
58078        mut self,
58079        new_value: &str,
58080    ) -> PartnerTargetingTypeAssignedTargetingOptionListCall<'a, C> {
58081        self._filter = Some(new_value.to_string());
58082        self
58083    }
58084    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
58085    /// while executing the actual API request.
58086    ///
58087    /// ````text
58088    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
58089    /// ````
58090    ///
58091    /// Sets the *delegate* property to the given value.
58092    pub fn delegate(
58093        mut self,
58094        new_value: &'a mut dyn common::Delegate,
58095    ) -> PartnerTargetingTypeAssignedTargetingOptionListCall<'a, C> {
58096        self._delegate = Some(new_value);
58097        self
58098    }
58099
58100    /// Set any additional parameter of the query string used in the request.
58101    /// It should be used to set parameters which are not yet available through their own
58102    /// setters.
58103    ///
58104    /// Please note that this method must not be used to set any of the known parameters
58105    /// which have their own setter method. If done anyway, the request will fail.
58106    ///
58107    /// # Additional Parameters
58108    ///
58109    /// * *$.xgafv* (query-string) - V1 error format.
58110    /// * *access_token* (query-string) - OAuth access token.
58111    /// * *alt* (query-string) - Data format for response.
58112    /// * *callback* (query-string) - JSONP
58113    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
58114    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
58115    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
58116    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
58117    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
58118    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
58119    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
58120    pub fn param<T>(
58121        mut self,
58122        name: T,
58123        value: T,
58124    ) -> PartnerTargetingTypeAssignedTargetingOptionListCall<'a, C>
58125    where
58126        T: AsRef<str>,
58127    {
58128        self._additional_params
58129            .insert(name.as_ref().to_string(), value.as_ref().to_string());
58130        self
58131    }
58132
58133    /// Identifies the authorization scope for the method you are building.
58134    ///
58135    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
58136    /// [`Scope::DisplayVideo`].
58137    ///
58138    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
58139    /// tokens for more than one scope.
58140    ///
58141    /// Usually there is more than one suitable scope to authorize an operation, some of which may
58142    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
58143    /// sufficient, a read-write scope will do as well.
58144    pub fn add_scope<St>(
58145        mut self,
58146        scope: St,
58147    ) -> PartnerTargetingTypeAssignedTargetingOptionListCall<'a, C>
58148    where
58149        St: AsRef<str>,
58150    {
58151        self._scopes.insert(String::from(scope.as_ref()));
58152        self
58153    }
58154    /// Identifies the authorization scope(s) for the method you are building.
58155    ///
58156    /// See [`Self::add_scope()`] for details.
58157    pub fn add_scopes<I, St>(
58158        mut self,
58159        scopes: I,
58160    ) -> PartnerTargetingTypeAssignedTargetingOptionListCall<'a, C>
58161    where
58162        I: IntoIterator<Item = St>,
58163        St: AsRef<str>,
58164    {
58165        self._scopes
58166            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
58167        self
58168    }
58169
58170    /// Removes all scopes, and no default scope will be used either.
58171    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
58172    /// for details).
58173    pub fn clear_scopes(mut self) -> PartnerTargetingTypeAssignedTargetingOptionListCall<'a, C> {
58174        self._scopes.clear();
58175        self
58176    }
58177}
58178
58179/// Bulk edits targeting options under a single partner. The operation will delete the assigned targeting options provided in BulkEditPartnerAssignedTargetingOptionsRequest.deleteRequests and then create the assigned targeting options provided in BulkEditPartnerAssignedTargetingOptionsRequest.createRequests .
58180///
58181/// A builder for the *bulkEditPartnerAssignedTargetingOptions* method supported by a *partner* resource.
58182/// It is not used directly, but through a [`PartnerMethods`] instance.
58183///
58184/// # Example
58185///
58186/// Instantiate a resource method builder
58187///
58188/// ```test_harness,no_run
58189/// # extern crate hyper;
58190/// # extern crate hyper_rustls;
58191/// # extern crate google_displayvideo1 as displayvideo1;
58192/// use displayvideo1::api::BulkEditPartnerAssignedTargetingOptionsRequest;
58193/// # async fn dox() {
58194/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
58195///
58196/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
58197/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
58198/// #     secret,
58199/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
58200/// # ).build().await.unwrap();
58201///
58202/// # let client = hyper_util::client::legacy::Client::builder(
58203/// #     hyper_util::rt::TokioExecutor::new()
58204/// # )
58205/// # .build(
58206/// #     hyper_rustls::HttpsConnectorBuilder::new()
58207/// #         .with_native_roots()
58208/// #         .unwrap()
58209/// #         .https_or_http()
58210/// #         .enable_http1()
58211/// #         .build()
58212/// # );
58213/// # let mut hub = DisplayVideo::new(client, auth);
58214/// // As the method needs a request, you would usually fill it with the desired information
58215/// // into the respective structure. Some of the parts shown here might not be applicable !
58216/// // Values shown here are possibly random and not representative !
58217/// let mut req = BulkEditPartnerAssignedTargetingOptionsRequest::default();
58218///
58219/// // You can configure optional parameters by calling the respective setters at will, and
58220/// // execute the final call using `doit()`.
58221/// // Values shown here are possibly random and not representative !
58222/// let result = hub.partners().bulk_edit_partner_assigned_targeting_options(req, -9)
58223///              .doit().await;
58224/// # }
58225/// ```
58226pub struct PartnerBulkEditPartnerAssignedTargetingOptionCall<'a, C>
58227where
58228    C: 'a,
58229{
58230    hub: &'a DisplayVideo<C>,
58231    _request: BulkEditPartnerAssignedTargetingOptionsRequest,
58232    _partner_id: i64,
58233    _delegate: Option<&'a mut dyn common::Delegate>,
58234    _additional_params: HashMap<String, String>,
58235    _scopes: BTreeSet<String>,
58236}
58237
58238impl<'a, C> common::CallBuilder for PartnerBulkEditPartnerAssignedTargetingOptionCall<'a, C> {}
58239
58240impl<'a, C> PartnerBulkEditPartnerAssignedTargetingOptionCall<'a, C>
58241where
58242    C: common::Connector,
58243{
58244    /// Perform the operation you have build so far.
58245    pub async fn doit(
58246        mut self,
58247    ) -> common::Result<(
58248        common::Response,
58249        BulkEditPartnerAssignedTargetingOptionsResponse,
58250    )> {
58251        use std::borrow::Cow;
58252        use std::io::{Read, Seek};
58253
58254        use common::{url::Params, ToParts};
58255        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
58256
58257        let mut dd = common::DefaultDelegate;
58258        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
58259        dlg.begin(common::MethodInfo {
58260            id: "displayvideo.partners.bulkEditPartnerAssignedTargetingOptions",
58261            http_method: hyper::Method::POST,
58262        });
58263
58264        for &field in ["alt", "partnerId"].iter() {
58265            if self._additional_params.contains_key(field) {
58266                dlg.finished(false);
58267                return Err(common::Error::FieldClash(field));
58268            }
58269        }
58270
58271        let mut params = Params::with_capacity(4 + self._additional_params.len());
58272        params.push("partnerId", self._partner_id.to_string());
58273
58274        params.extend(self._additional_params.iter());
58275
58276        params.push("alt", "json");
58277        let mut url = self.hub._base_url.clone()
58278            + "v1/partners/{+partnerId}:bulkEditPartnerAssignedTargetingOptions";
58279        if self._scopes.is_empty() {
58280            self._scopes
58281                .insert(Scope::DisplayVideo.as_ref().to_string());
58282        }
58283
58284        #[allow(clippy::single_element_loop)]
58285        for &(find_this, param_name) in [("{+partnerId}", "partnerId")].iter() {
58286            url = params.uri_replacement(url, param_name, find_this, true);
58287        }
58288        {
58289            let to_remove = ["partnerId"];
58290            params.remove_params(&to_remove);
58291        }
58292
58293        let url = params.parse_with_url(&url);
58294
58295        let mut json_mime_type = mime::APPLICATION_JSON;
58296        let mut request_value_reader = {
58297            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
58298            common::remove_json_null_values(&mut value);
58299            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
58300            serde_json::to_writer(&mut dst, &value).unwrap();
58301            dst
58302        };
58303        let request_size = request_value_reader
58304            .seek(std::io::SeekFrom::End(0))
58305            .unwrap();
58306        request_value_reader
58307            .seek(std::io::SeekFrom::Start(0))
58308            .unwrap();
58309
58310        loop {
58311            let token = match self
58312                .hub
58313                .auth
58314                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
58315                .await
58316            {
58317                Ok(token) => token,
58318                Err(e) => match dlg.token(e) {
58319                    Ok(token) => token,
58320                    Err(e) => {
58321                        dlg.finished(false);
58322                        return Err(common::Error::MissingToken(e));
58323                    }
58324                },
58325            };
58326            request_value_reader
58327                .seek(std::io::SeekFrom::Start(0))
58328                .unwrap();
58329            let mut req_result = {
58330                let client = &self.hub.client;
58331                dlg.pre_request();
58332                let mut req_builder = hyper::Request::builder()
58333                    .method(hyper::Method::POST)
58334                    .uri(url.as_str())
58335                    .header(USER_AGENT, self.hub._user_agent.clone());
58336
58337                if let Some(token) = token.as_ref() {
58338                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
58339                }
58340
58341                let request = req_builder
58342                    .header(CONTENT_TYPE, json_mime_type.to_string())
58343                    .header(CONTENT_LENGTH, request_size as u64)
58344                    .body(common::to_body(
58345                        request_value_reader.get_ref().clone().into(),
58346                    ));
58347
58348                client.request(request.unwrap()).await
58349            };
58350
58351            match req_result {
58352                Err(err) => {
58353                    if let common::Retry::After(d) = dlg.http_error(&err) {
58354                        sleep(d).await;
58355                        continue;
58356                    }
58357                    dlg.finished(false);
58358                    return Err(common::Error::HttpError(err));
58359                }
58360                Ok(res) => {
58361                    let (mut parts, body) = res.into_parts();
58362                    let mut body = common::Body::new(body);
58363                    if !parts.status.is_success() {
58364                        let bytes = common::to_bytes(body).await.unwrap_or_default();
58365                        let error = serde_json::from_str(&common::to_string(&bytes));
58366                        let response = common::to_response(parts, bytes.into());
58367
58368                        if let common::Retry::After(d) =
58369                            dlg.http_failure(&response, error.as_ref().ok())
58370                        {
58371                            sleep(d).await;
58372                            continue;
58373                        }
58374
58375                        dlg.finished(false);
58376
58377                        return Err(match error {
58378                            Ok(value) => common::Error::BadRequest(value),
58379                            _ => common::Error::Failure(response),
58380                        });
58381                    }
58382                    let response = {
58383                        let bytes = common::to_bytes(body).await.unwrap_or_default();
58384                        let encoded = common::to_string(&bytes);
58385                        match serde_json::from_str(&encoded) {
58386                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
58387                            Err(error) => {
58388                                dlg.response_json_decode_error(&encoded, &error);
58389                                return Err(common::Error::JsonDecodeError(
58390                                    encoded.to_string(),
58391                                    error,
58392                                ));
58393                            }
58394                        }
58395                    };
58396
58397                    dlg.finished(true);
58398                    return Ok(response);
58399                }
58400            }
58401        }
58402    }
58403
58404    ///
58405    /// Sets the *request* property to the given value.
58406    ///
58407    /// Even though the property as already been set when instantiating this call,
58408    /// we provide this method for API completeness.
58409    pub fn request(
58410        mut self,
58411        new_value: BulkEditPartnerAssignedTargetingOptionsRequest,
58412    ) -> PartnerBulkEditPartnerAssignedTargetingOptionCall<'a, C> {
58413        self._request = new_value;
58414        self
58415    }
58416    /// Required. The ID of the partner.
58417    ///
58418    /// Sets the *partner id* path property to the given value.
58419    ///
58420    /// Even though the property as already been set when instantiating this call,
58421    /// we provide this method for API completeness.
58422    pub fn partner_id(
58423        mut self,
58424        new_value: i64,
58425    ) -> PartnerBulkEditPartnerAssignedTargetingOptionCall<'a, C> {
58426        self._partner_id = new_value;
58427        self
58428    }
58429    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
58430    /// while executing the actual API request.
58431    ///
58432    /// ````text
58433    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
58434    /// ````
58435    ///
58436    /// Sets the *delegate* property to the given value.
58437    pub fn delegate(
58438        mut self,
58439        new_value: &'a mut dyn common::Delegate,
58440    ) -> PartnerBulkEditPartnerAssignedTargetingOptionCall<'a, C> {
58441        self._delegate = Some(new_value);
58442        self
58443    }
58444
58445    /// Set any additional parameter of the query string used in the request.
58446    /// It should be used to set parameters which are not yet available through their own
58447    /// setters.
58448    ///
58449    /// Please note that this method must not be used to set any of the known parameters
58450    /// which have their own setter method. If done anyway, the request will fail.
58451    ///
58452    /// # Additional Parameters
58453    ///
58454    /// * *$.xgafv* (query-string) - V1 error format.
58455    /// * *access_token* (query-string) - OAuth access token.
58456    /// * *alt* (query-string) - Data format for response.
58457    /// * *callback* (query-string) - JSONP
58458    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
58459    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
58460    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
58461    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
58462    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
58463    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
58464    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
58465    pub fn param<T>(
58466        mut self,
58467        name: T,
58468        value: T,
58469    ) -> PartnerBulkEditPartnerAssignedTargetingOptionCall<'a, C>
58470    where
58471        T: AsRef<str>,
58472    {
58473        self._additional_params
58474            .insert(name.as_ref().to_string(), value.as_ref().to_string());
58475        self
58476    }
58477
58478    /// Identifies the authorization scope for the method you are building.
58479    ///
58480    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
58481    /// [`Scope::DisplayVideo`].
58482    ///
58483    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
58484    /// tokens for more than one scope.
58485    ///
58486    /// Usually there is more than one suitable scope to authorize an operation, some of which may
58487    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
58488    /// sufficient, a read-write scope will do as well.
58489    pub fn add_scope<St>(
58490        mut self,
58491        scope: St,
58492    ) -> PartnerBulkEditPartnerAssignedTargetingOptionCall<'a, C>
58493    where
58494        St: AsRef<str>,
58495    {
58496        self._scopes.insert(String::from(scope.as_ref()));
58497        self
58498    }
58499    /// Identifies the authorization scope(s) for the method you are building.
58500    ///
58501    /// See [`Self::add_scope()`] for details.
58502    pub fn add_scopes<I, St>(
58503        mut self,
58504        scopes: I,
58505    ) -> PartnerBulkEditPartnerAssignedTargetingOptionCall<'a, C>
58506    where
58507        I: IntoIterator<Item = St>,
58508        St: AsRef<str>,
58509    {
58510        self._scopes
58511            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
58512        self
58513    }
58514
58515    /// Removes all scopes, and no default scope will be used either.
58516    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
58517    /// for details).
58518    pub fn clear_scopes(mut self) -> PartnerBulkEditPartnerAssignedTargetingOptionCall<'a, C> {
58519        self._scopes.clear();
58520        self
58521    }
58522}
58523
58524/// Gets a partner.
58525///
58526/// A builder for the *get* method supported by a *partner* resource.
58527/// It is not used directly, but through a [`PartnerMethods`] instance.
58528///
58529/// # Example
58530///
58531/// Instantiate a resource method builder
58532///
58533/// ```test_harness,no_run
58534/// # extern crate hyper;
58535/// # extern crate hyper_rustls;
58536/// # extern crate google_displayvideo1 as displayvideo1;
58537/// # async fn dox() {
58538/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
58539///
58540/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
58541/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
58542/// #     secret,
58543/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
58544/// # ).build().await.unwrap();
58545///
58546/// # let client = hyper_util::client::legacy::Client::builder(
58547/// #     hyper_util::rt::TokioExecutor::new()
58548/// # )
58549/// # .build(
58550/// #     hyper_rustls::HttpsConnectorBuilder::new()
58551/// #         .with_native_roots()
58552/// #         .unwrap()
58553/// #         .https_or_http()
58554/// #         .enable_http1()
58555/// #         .build()
58556/// # );
58557/// # let mut hub = DisplayVideo::new(client, auth);
58558/// // You can configure optional parameters by calling the respective setters at will, and
58559/// // execute the final call using `doit()`.
58560/// // Values shown here are possibly random and not representative !
58561/// let result = hub.partners().get(-43)
58562///              .doit().await;
58563/// # }
58564/// ```
58565pub struct PartnerGetCall<'a, C>
58566where
58567    C: 'a,
58568{
58569    hub: &'a DisplayVideo<C>,
58570    _partner_id: i64,
58571    _delegate: Option<&'a mut dyn common::Delegate>,
58572    _additional_params: HashMap<String, String>,
58573    _scopes: BTreeSet<String>,
58574}
58575
58576impl<'a, C> common::CallBuilder for PartnerGetCall<'a, C> {}
58577
58578impl<'a, C> PartnerGetCall<'a, C>
58579where
58580    C: common::Connector,
58581{
58582    /// Perform the operation you have build so far.
58583    pub async fn doit(mut self) -> common::Result<(common::Response, Partner)> {
58584        use std::borrow::Cow;
58585        use std::io::{Read, Seek};
58586
58587        use common::{url::Params, ToParts};
58588        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
58589
58590        let mut dd = common::DefaultDelegate;
58591        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
58592        dlg.begin(common::MethodInfo {
58593            id: "displayvideo.partners.get",
58594            http_method: hyper::Method::GET,
58595        });
58596
58597        for &field in ["alt", "partnerId"].iter() {
58598            if self._additional_params.contains_key(field) {
58599                dlg.finished(false);
58600                return Err(common::Error::FieldClash(field));
58601            }
58602        }
58603
58604        let mut params = Params::with_capacity(3 + self._additional_params.len());
58605        params.push("partnerId", self._partner_id.to_string());
58606
58607        params.extend(self._additional_params.iter());
58608
58609        params.push("alt", "json");
58610        let mut url = self.hub._base_url.clone() + "v1/partners/{+partnerId}";
58611        if self._scopes.is_empty() {
58612            self._scopes
58613                .insert(Scope::DisplayVideo.as_ref().to_string());
58614        }
58615
58616        #[allow(clippy::single_element_loop)]
58617        for &(find_this, param_name) in [("{+partnerId}", "partnerId")].iter() {
58618            url = params.uri_replacement(url, param_name, find_this, true);
58619        }
58620        {
58621            let to_remove = ["partnerId"];
58622            params.remove_params(&to_remove);
58623        }
58624
58625        let url = params.parse_with_url(&url);
58626
58627        loop {
58628            let token = match self
58629                .hub
58630                .auth
58631                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
58632                .await
58633            {
58634                Ok(token) => token,
58635                Err(e) => match dlg.token(e) {
58636                    Ok(token) => token,
58637                    Err(e) => {
58638                        dlg.finished(false);
58639                        return Err(common::Error::MissingToken(e));
58640                    }
58641                },
58642            };
58643            let mut req_result = {
58644                let client = &self.hub.client;
58645                dlg.pre_request();
58646                let mut req_builder = hyper::Request::builder()
58647                    .method(hyper::Method::GET)
58648                    .uri(url.as_str())
58649                    .header(USER_AGENT, self.hub._user_agent.clone());
58650
58651                if let Some(token) = token.as_ref() {
58652                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
58653                }
58654
58655                let request = req_builder
58656                    .header(CONTENT_LENGTH, 0_u64)
58657                    .body(common::to_body::<String>(None));
58658
58659                client.request(request.unwrap()).await
58660            };
58661
58662            match req_result {
58663                Err(err) => {
58664                    if let common::Retry::After(d) = dlg.http_error(&err) {
58665                        sleep(d).await;
58666                        continue;
58667                    }
58668                    dlg.finished(false);
58669                    return Err(common::Error::HttpError(err));
58670                }
58671                Ok(res) => {
58672                    let (mut parts, body) = res.into_parts();
58673                    let mut body = common::Body::new(body);
58674                    if !parts.status.is_success() {
58675                        let bytes = common::to_bytes(body).await.unwrap_or_default();
58676                        let error = serde_json::from_str(&common::to_string(&bytes));
58677                        let response = common::to_response(parts, bytes.into());
58678
58679                        if let common::Retry::After(d) =
58680                            dlg.http_failure(&response, error.as_ref().ok())
58681                        {
58682                            sleep(d).await;
58683                            continue;
58684                        }
58685
58686                        dlg.finished(false);
58687
58688                        return Err(match error {
58689                            Ok(value) => common::Error::BadRequest(value),
58690                            _ => common::Error::Failure(response),
58691                        });
58692                    }
58693                    let response = {
58694                        let bytes = common::to_bytes(body).await.unwrap_or_default();
58695                        let encoded = common::to_string(&bytes);
58696                        match serde_json::from_str(&encoded) {
58697                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
58698                            Err(error) => {
58699                                dlg.response_json_decode_error(&encoded, &error);
58700                                return Err(common::Error::JsonDecodeError(
58701                                    encoded.to_string(),
58702                                    error,
58703                                ));
58704                            }
58705                        }
58706                    };
58707
58708                    dlg.finished(true);
58709                    return Ok(response);
58710                }
58711            }
58712        }
58713    }
58714
58715    /// Required. The ID of the partner to fetch.
58716    ///
58717    /// Sets the *partner id* path property to the given value.
58718    ///
58719    /// Even though the property as already been set when instantiating this call,
58720    /// we provide this method for API completeness.
58721    pub fn partner_id(mut self, new_value: i64) -> PartnerGetCall<'a, C> {
58722        self._partner_id = new_value;
58723        self
58724    }
58725    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
58726    /// while executing the actual API request.
58727    ///
58728    /// ````text
58729    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
58730    /// ````
58731    ///
58732    /// Sets the *delegate* property to the given value.
58733    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PartnerGetCall<'a, C> {
58734        self._delegate = Some(new_value);
58735        self
58736    }
58737
58738    /// Set any additional parameter of the query string used in the request.
58739    /// It should be used to set parameters which are not yet available through their own
58740    /// setters.
58741    ///
58742    /// Please note that this method must not be used to set any of the known parameters
58743    /// which have their own setter method. If done anyway, the request will fail.
58744    ///
58745    /// # Additional Parameters
58746    ///
58747    /// * *$.xgafv* (query-string) - V1 error format.
58748    /// * *access_token* (query-string) - OAuth access token.
58749    /// * *alt* (query-string) - Data format for response.
58750    /// * *callback* (query-string) - JSONP
58751    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
58752    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
58753    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
58754    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
58755    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
58756    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
58757    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
58758    pub fn param<T>(mut self, name: T, value: T) -> PartnerGetCall<'a, C>
58759    where
58760        T: AsRef<str>,
58761    {
58762        self._additional_params
58763            .insert(name.as_ref().to_string(), value.as_ref().to_string());
58764        self
58765    }
58766
58767    /// Identifies the authorization scope for the method you are building.
58768    ///
58769    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
58770    /// [`Scope::DisplayVideo`].
58771    ///
58772    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
58773    /// tokens for more than one scope.
58774    ///
58775    /// Usually there is more than one suitable scope to authorize an operation, some of which may
58776    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
58777    /// sufficient, a read-write scope will do as well.
58778    pub fn add_scope<St>(mut self, scope: St) -> PartnerGetCall<'a, C>
58779    where
58780        St: AsRef<str>,
58781    {
58782        self._scopes.insert(String::from(scope.as_ref()));
58783        self
58784    }
58785    /// Identifies the authorization scope(s) for the method you are building.
58786    ///
58787    /// See [`Self::add_scope()`] for details.
58788    pub fn add_scopes<I, St>(mut self, scopes: I) -> PartnerGetCall<'a, C>
58789    where
58790        I: IntoIterator<Item = St>,
58791        St: AsRef<str>,
58792    {
58793        self._scopes
58794            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
58795        self
58796    }
58797
58798    /// Removes all scopes, and no default scope will be used either.
58799    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
58800    /// for details).
58801    pub fn clear_scopes(mut self) -> PartnerGetCall<'a, C> {
58802        self._scopes.clear();
58803        self
58804    }
58805}
58806
58807/// Lists partners that are accessible to the current user. The order is defined by the order_by parameter.
58808///
58809/// A builder for the *list* method supported by a *partner* resource.
58810/// It is not used directly, but through a [`PartnerMethods`] instance.
58811///
58812/// # Example
58813///
58814/// Instantiate a resource method builder
58815///
58816/// ```test_harness,no_run
58817/// # extern crate hyper;
58818/// # extern crate hyper_rustls;
58819/// # extern crate google_displayvideo1 as displayvideo1;
58820/// # async fn dox() {
58821/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
58822///
58823/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
58824/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
58825/// #     secret,
58826/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
58827/// # ).build().await.unwrap();
58828///
58829/// # let client = hyper_util::client::legacy::Client::builder(
58830/// #     hyper_util::rt::TokioExecutor::new()
58831/// # )
58832/// # .build(
58833/// #     hyper_rustls::HttpsConnectorBuilder::new()
58834/// #         .with_native_roots()
58835/// #         .unwrap()
58836/// #         .https_or_http()
58837/// #         .enable_http1()
58838/// #         .build()
58839/// # );
58840/// # let mut hub = DisplayVideo::new(client, auth);
58841/// // You can configure optional parameters by calling the respective setters at will, and
58842/// // execute the final call using `doit()`.
58843/// // Values shown here are possibly random and not representative !
58844/// let result = hub.partners().list()
58845///              .page_token("nonumy")
58846///              .page_size(-60)
58847///              .order_by("eos")
58848///              .filter("dolore")
58849///              .doit().await;
58850/// # }
58851/// ```
58852pub struct PartnerListCall<'a, C>
58853where
58854    C: 'a,
58855{
58856    hub: &'a DisplayVideo<C>,
58857    _page_token: Option<String>,
58858    _page_size: Option<i32>,
58859    _order_by: Option<String>,
58860    _filter: Option<String>,
58861    _delegate: Option<&'a mut dyn common::Delegate>,
58862    _additional_params: HashMap<String, String>,
58863    _scopes: BTreeSet<String>,
58864}
58865
58866impl<'a, C> common::CallBuilder for PartnerListCall<'a, C> {}
58867
58868impl<'a, C> PartnerListCall<'a, C>
58869where
58870    C: common::Connector,
58871{
58872    /// Perform the operation you have build so far.
58873    pub async fn doit(mut self) -> common::Result<(common::Response, ListPartnersResponse)> {
58874        use std::borrow::Cow;
58875        use std::io::{Read, Seek};
58876
58877        use common::{url::Params, ToParts};
58878        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
58879
58880        let mut dd = common::DefaultDelegate;
58881        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
58882        dlg.begin(common::MethodInfo {
58883            id: "displayvideo.partners.list",
58884            http_method: hyper::Method::GET,
58885        });
58886
58887        for &field in ["alt", "pageToken", "pageSize", "orderBy", "filter"].iter() {
58888            if self._additional_params.contains_key(field) {
58889                dlg.finished(false);
58890                return Err(common::Error::FieldClash(field));
58891            }
58892        }
58893
58894        let mut params = Params::with_capacity(6 + self._additional_params.len());
58895        if let Some(value) = self._page_token.as_ref() {
58896            params.push("pageToken", value);
58897        }
58898        if let Some(value) = self._page_size.as_ref() {
58899            params.push("pageSize", value.to_string());
58900        }
58901        if let Some(value) = self._order_by.as_ref() {
58902            params.push("orderBy", value);
58903        }
58904        if let Some(value) = self._filter.as_ref() {
58905            params.push("filter", value);
58906        }
58907
58908        params.extend(self._additional_params.iter());
58909
58910        params.push("alt", "json");
58911        let mut url = self.hub._base_url.clone() + "v1/partners";
58912        if self._scopes.is_empty() {
58913            self._scopes
58914                .insert(Scope::DisplayVideo.as_ref().to_string());
58915        }
58916
58917        let url = params.parse_with_url(&url);
58918
58919        loop {
58920            let token = match self
58921                .hub
58922                .auth
58923                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
58924                .await
58925            {
58926                Ok(token) => token,
58927                Err(e) => match dlg.token(e) {
58928                    Ok(token) => token,
58929                    Err(e) => {
58930                        dlg.finished(false);
58931                        return Err(common::Error::MissingToken(e));
58932                    }
58933                },
58934            };
58935            let mut req_result = {
58936                let client = &self.hub.client;
58937                dlg.pre_request();
58938                let mut req_builder = hyper::Request::builder()
58939                    .method(hyper::Method::GET)
58940                    .uri(url.as_str())
58941                    .header(USER_AGENT, self.hub._user_agent.clone());
58942
58943                if let Some(token) = token.as_ref() {
58944                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
58945                }
58946
58947                let request = req_builder
58948                    .header(CONTENT_LENGTH, 0_u64)
58949                    .body(common::to_body::<String>(None));
58950
58951                client.request(request.unwrap()).await
58952            };
58953
58954            match req_result {
58955                Err(err) => {
58956                    if let common::Retry::After(d) = dlg.http_error(&err) {
58957                        sleep(d).await;
58958                        continue;
58959                    }
58960                    dlg.finished(false);
58961                    return Err(common::Error::HttpError(err));
58962                }
58963                Ok(res) => {
58964                    let (mut parts, body) = res.into_parts();
58965                    let mut body = common::Body::new(body);
58966                    if !parts.status.is_success() {
58967                        let bytes = common::to_bytes(body).await.unwrap_or_default();
58968                        let error = serde_json::from_str(&common::to_string(&bytes));
58969                        let response = common::to_response(parts, bytes.into());
58970
58971                        if let common::Retry::After(d) =
58972                            dlg.http_failure(&response, error.as_ref().ok())
58973                        {
58974                            sleep(d).await;
58975                            continue;
58976                        }
58977
58978                        dlg.finished(false);
58979
58980                        return Err(match error {
58981                            Ok(value) => common::Error::BadRequest(value),
58982                            _ => common::Error::Failure(response),
58983                        });
58984                    }
58985                    let response = {
58986                        let bytes = common::to_bytes(body).await.unwrap_or_default();
58987                        let encoded = common::to_string(&bytes);
58988                        match serde_json::from_str(&encoded) {
58989                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
58990                            Err(error) => {
58991                                dlg.response_json_decode_error(&encoded, &error);
58992                                return Err(common::Error::JsonDecodeError(
58993                                    encoded.to_string(),
58994                                    error,
58995                                ));
58996                            }
58997                        }
58998                    };
58999
59000                    dlg.finished(true);
59001                    return Ok(response);
59002                }
59003            }
59004        }
59005    }
59006
59007    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListPartners` method. If not specified, the first page of results will be returned.
59008    ///
59009    /// Sets the *page token* query property to the given value.
59010    pub fn page_token(mut self, new_value: &str) -> PartnerListCall<'a, C> {
59011        self._page_token = Some(new_value.to_string());
59012        self
59013    }
59014    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`.
59015    ///
59016    /// Sets the *page size* query property to the given value.
59017    pub fn page_size(mut self, new_value: i32) -> PartnerListCall<'a, C> {
59018        self._page_size = Some(new_value);
59019        self
59020    }
59021    /// Field by which to sort the list. Acceptable values are: * `displayName` The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. For example, `displayName desc`.
59022    ///
59023    /// Sets the *order by* query property to the given value.
59024    pub fn order_by(mut self, new_value: &str) -> PartnerListCall<'a, C> {
59025        self._order_by = Some(new_value.to_string());
59026        self
59027    }
59028    /// Allows filtering by partner fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by `AND` or `OR` logical operators. A sequence of restrictions implicitly uses `AND`. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `EQUALS (=)` operator. Supported fields: * `entityStatus` Examples: * All active partners: `entityStatus="ENTITY_STATUS_ACTIVE"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
59029    ///
59030    /// Sets the *filter* query property to the given value.
59031    pub fn filter(mut self, new_value: &str) -> PartnerListCall<'a, C> {
59032        self._filter = Some(new_value.to_string());
59033        self
59034    }
59035    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
59036    /// while executing the actual API request.
59037    ///
59038    /// ````text
59039    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
59040    /// ````
59041    ///
59042    /// Sets the *delegate* property to the given value.
59043    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PartnerListCall<'a, C> {
59044        self._delegate = Some(new_value);
59045        self
59046    }
59047
59048    /// Set any additional parameter of the query string used in the request.
59049    /// It should be used to set parameters which are not yet available through their own
59050    /// setters.
59051    ///
59052    /// Please note that this method must not be used to set any of the known parameters
59053    /// which have their own setter method. If done anyway, the request will fail.
59054    ///
59055    /// # Additional Parameters
59056    ///
59057    /// * *$.xgafv* (query-string) - V1 error format.
59058    /// * *access_token* (query-string) - OAuth access token.
59059    /// * *alt* (query-string) - Data format for response.
59060    /// * *callback* (query-string) - JSONP
59061    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
59062    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
59063    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
59064    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
59065    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
59066    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
59067    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
59068    pub fn param<T>(mut self, name: T, value: T) -> PartnerListCall<'a, C>
59069    where
59070        T: AsRef<str>,
59071    {
59072        self._additional_params
59073            .insert(name.as_ref().to_string(), value.as_ref().to_string());
59074        self
59075    }
59076
59077    /// Identifies the authorization scope for the method you are building.
59078    ///
59079    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
59080    /// [`Scope::DisplayVideo`].
59081    ///
59082    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
59083    /// tokens for more than one scope.
59084    ///
59085    /// Usually there is more than one suitable scope to authorize an operation, some of which may
59086    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
59087    /// sufficient, a read-write scope will do as well.
59088    pub fn add_scope<St>(mut self, scope: St) -> PartnerListCall<'a, C>
59089    where
59090        St: AsRef<str>,
59091    {
59092        self._scopes.insert(String::from(scope.as_ref()));
59093        self
59094    }
59095    /// Identifies the authorization scope(s) for the method you are building.
59096    ///
59097    /// See [`Self::add_scope()`] for details.
59098    pub fn add_scopes<I, St>(mut self, scopes: I) -> PartnerListCall<'a, C>
59099    where
59100        I: IntoIterator<Item = St>,
59101        St: AsRef<str>,
59102    {
59103        self._scopes
59104            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
59105        self
59106    }
59107
59108    /// Removes all scopes, and no default scope will be used either.
59109    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
59110    /// for details).
59111    pub fn clear_scopes(mut self) -> PartnerListCall<'a, C> {
59112        self._scopes.clear();
59113        self
59114    }
59115}
59116
59117/// Gets the latest state of an asynchronous SDF download task operation. Clients should poll this method at intervals of 30 seconds.
59118///
59119/// A builder for the *operations.get* method supported by a *sdfdownloadtask* resource.
59120/// It is not used directly, but through a [`SdfdownloadtaskMethods`] instance.
59121///
59122/// # Example
59123///
59124/// Instantiate a resource method builder
59125///
59126/// ```test_harness,no_run
59127/// # extern crate hyper;
59128/// # extern crate hyper_rustls;
59129/// # extern crate google_displayvideo1 as displayvideo1;
59130/// # async fn dox() {
59131/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
59132///
59133/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
59134/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
59135/// #     secret,
59136/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
59137/// # ).build().await.unwrap();
59138///
59139/// # let client = hyper_util::client::legacy::Client::builder(
59140/// #     hyper_util::rt::TokioExecutor::new()
59141/// # )
59142/// # .build(
59143/// #     hyper_rustls::HttpsConnectorBuilder::new()
59144/// #         .with_native_roots()
59145/// #         .unwrap()
59146/// #         .https_or_http()
59147/// #         .enable_http1()
59148/// #         .build()
59149/// # );
59150/// # let mut hub = DisplayVideo::new(client, auth);
59151/// // You can configure optional parameters by calling the respective setters at will, and
59152/// // execute the final call using `doit()`.
59153/// // Values shown here are possibly random and not representative !
59154/// let result = hub.sdfdownloadtasks().operations_get("name")
59155///              .doit().await;
59156/// # }
59157/// ```
59158pub struct SdfdownloadtaskOperationGetCall<'a, C>
59159where
59160    C: 'a,
59161{
59162    hub: &'a DisplayVideo<C>,
59163    _name: String,
59164    _delegate: Option<&'a mut dyn common::Delegate>,
59165    _additional_params: HashMap<String, String>,
59166    _scopes: BTreeSet<String>,
59167}
59168
59169impl<'a, C> common::CallBuilder for SdfdownloadtaskOperationGetCall<'a, C> {}
59170
59171impl<'a, C> SdfdownloadtaskOperationGetCall<'a, C>
59172where
59173    C: common::Connector,
59174{
59175    /// Perform the operation you have build so far.
59176    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
59177        use std::borrow::Cow;
59178        use std::io::{Read, Seek};
59179
59180        use common::{url::Params, ToParts};
59181        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
59182
59183        let mut dd = common::DefaultDelegate;
59184        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
59185        dlg.begin(common::MethodInfo {
59186            id: "displayvideo.sdfdownloadtasks.operations.get",
59187            http_method: hyper::Method::GET,
59188        });
59189
59190        for &field in ["alt", "name"].iter() {
59191            if self._additional_params.contains_key(field) {
59192                dlg.finished(false);
59193                return Err(common::Error::FieldClash(field));
59194            }
59195        }
59196
59197        let mut params = Params::with_capacity(3 + self._additional_params.len());
59198        params.push("name", self._name);
59199
59200        params.extend(self._additional_params.iter());
59201
59202        params.push("alt", "json");
59203        let mut url = self.hub._base_url.clone() + "v1/{+name}";
59204        if self._scopes.is_empty() {
59205            self._scopes
59206                .insert(Scope::DisplayVideo.as_ref().to_string());
59207        }
59208
59209        #[allow(clippy::single_element_loop)]
59210        for &(find_this, param_name) in [("{+name}", "name")].iter() {
59211            url = params.uri_replacement(url, param_name, find_this, true);
59212        }
59213        {
59214            let to_remove = ["name"];
59215            params.remove_params(&to_remove);
59216        }
59217
59218        let url = params.parse_with_url(&url);
59219
59220        loop {
59221            let token = match self
59222                .hub
59223                .auth
59224                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
59225                .await
59226            {
59227                Ok(token) => token,
59228                Err(e) => match dlg.token(e) {
59229                    Ok(token) => token,
59230                    Err(e) => {
59231                        dlg.finished(false);
59232                        return Err(common::Error::MissingToken(e));
59233                    }
59234                },
59235            };
59236            let mut req_result = {
59237                let client = &self.hub.client;
59238                dlg.pre_request();
59239                let mut req_builder = hyper::Request::builder()
59240                    .method(hyper::Method::GET)
59241                    .uri(url.as_str())
59242                    .header(USER_AGENT, self.hub._user_agent.clone());
59243
59244                if let Some(token) = token.as_ref() {
59245                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
59246                }
59247
59248                let request = req_builder
59249                    .header(CONTENT_LENGTH, 0_u64)
59250                    .body(common::to_body::<String>(None));
59251
59252                client.request(request.unwrap()).await
59253            };
59254
59255            match req_result {
59256                Err(err) => {
59257                    if let common::Retry::After(d) = dlg.http_error(&err) {
59258                        sleep(d).await;
59259                        continue;
59260                    }
59261                    dlg.finished(false);
59262                    return Err(common::Error::HttpError(err));
59263                }
59264                Ok(res) => {
59265                    let (mut parts, body) = res.into_parts();
59266                    let mut body = common::Body::new(body);
59267                    if !parts.status.is_success() {
59268                        let bytes = common::to_bytes(body).await.unwrap_or_default();
59269                        let error = serde_json::from_str(&common::to_string(&bytes));
59270                        let response = common::to_response(parts, bytes.into());
59271
59272                        if let common::Retry::After(d) =
59273                            dlg.http_failure(&response, error.as_ref().ok())
59274                        {
59275                            sleep(d).await;
59276                            continue;
59277                        }
59278
59279                        dlg.finished(false);
59280
59281                        return Err(match error {
59282                            Ok(value) => common::Error::BadRequest(value),
59283                            _ => common::Error::Failure(response),
59284                        });
59285                    }
59286                    let response = {
59287                        let bytes = common::to_bytes(body).await.unwrap_or_default();
59288                        let encoded = common::to_string(&bytes);
59289                        match serde_json::from_str(&encoded) {
59290                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
59291                            Err(error) => {
59292                                dlg.response_json_decode_error(&encoded, &error);
59293                                return Err(common::Error::JsonDecodeError(
59294                                    encoded.to_string(),
59295                                    error,
59296                                ));
59297                            }
59298                        }
59299                    };
59300
59301                    dlg.finished(true);
59302                    return Ok(response);
59303                }
59304            }
59305        }
59306    }
59307
59308    /// The name of the operation resource.
59309    ///
59310    /// Sets the *name* path property to the given value.
59311    ///
59312    /// Even though the property as already been set when instantiating this call,
59313    /// we provide this method for API completeness.
59314    pub fn name(mut self, new_value: &str) -> SdfdownloadtaskOperationGetCall<'a, C> {
59315        self._name = new_value.to_string();
59316        self
59317    }
59318    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
59319    /// while executing the actual API request.
59320    ///
59321    /// ````text
59322    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
59323    /// ````
59324    ///
59325    /// Sets the *delegate* property to the given value.
59326    pub fn delegate(
59327        mut self,
59328        new_value: &'a mut dyn common::Delegate,
59329    ) -> SdfdownloadtaskOperationGetCall<'a, C> {
59330        self._delegate = Some(new_value);
59331        self
59332    }
59333
59334    /// Set any additional parameter of the query string used in the request.
59335    /// It should be used to set parameters which are not yet available through their own
59336    /// setters.
59337    ///
59338    /// Please note that this method must not be used to set any of the known parameters
59339    /// which have their own setter method. If done anyway, the request will fail.
59340    ///
59341    /// # Additional Parameters
59342    ///
59343    /// * *$.xgafv* (query-string) - V1 error format.
59344    /// * *access_token* (query-string) - OAuth access token.
59345    /// * *alt* (query-string) - Data format for response.
59346    /// * *callback* (query-string) - JSONP
59347    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
59348    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
59349    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
59350    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
59351    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
59352    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
59353    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
59354    pub fn param<T>(mut self, name: T, value: T) -> SdfdownloadtaskOperationGetCall<'a, C>
59355    where
59356        T: AsRef<str>,
59357    {
59358        self._additional_params
59359            .insert(name.as_ref().to_string(), value.as_ref().to_string());
59360        self
59361    }
59362
59363    /// Identifies the authorization scope for the method you are building.
59364    ///
59365    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
59366    /// [`Scope::DisplayVideo`].
59367    ///
59368    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
59369    /// tokens for more than one scope.
59370    ///
59371    /// Usually there is more than one suitable scope to authorize an operation, some of which may
59372    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
59373    /// sufficient, a read-write scope will do as well.
59374    pub fn add_scope<St>(mut self, scope: St) -> SdfdownloadtaskOperationGetCall<'a, C>
59375    where
59376        St: AsRef<str>,
59377    {
59378        self._scopes.insert(String::from(scope.as_ref()));
59379        self
59380    }
59381    /// Identifies the authorization scope(s) for the method you are building.
59382    ///
59383    /// See [`Self::add_scope()`] for details.
59384    pub fn add_scopes<I, St>(mut self, scopes: I) -> SdfdownloadtaskOperationGetCall<'a, C>
59385    where
59386        I: IntoIterator<Item = St>,
59387        St: AsRef<str>,
59388    {
59389        self._scopes
59390            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
59391        self
59392    }
59393
59394    /// Removes all scopes, and no default scope will be used either.
59395    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
59396    /// for details).
59397    pub fn clear_scopes(mut self) -> SdfdownloadtaskOperationGetCall<'a, C> {
59398        self._scopes.clear();
59399        self
59400    }
59401}
59402
59403/// Creates an SDF Download Task. Returns an Operation. An SDF Download Task is a long-running, asynchronous operation. The metadata type of this operation is SdfDownloadTaskMetadata. If the request is successful, the response type of the operation is SdfDownloadTask. The response will not include the download files, which must be retrieved with media.download. The state of operation can be retrieved with sdfdownloadtask.operations.get. Any errors can be found in the error.message. Note that error.details is expected to be empty.
59404///
59405/// A builder for the *create* method supported by a *sdfdownloadtask* resource.
59406/// It is not used directly, but through a [`SdfdownloadtaskMethods`] instance.
59407///
59408/// # Example
59409///
59410/// Instantiate a resource method builder
59411///
59412/// ```test_harness,no_run
59413/// # extern crate hyper;
59414/// # extern crate hyper_rustls;
59415/// # extern crate google_displayvideo1 as displayvideo1;
59416/// use displayvideo1::api::CreateSdfDownloadTaskRequest;
59417/// # async fn dox() {
59418/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
59419///
59420/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
59421/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
59422/// #     secret,
59423/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
59424/// # ).build().await.unwrap();
59425///
59426/// # let client = hyper_util::client::legacy::Client::builder(
59427/// #     hyper_util::rt::TokioExecutor::new()
59428/// # )
59429/// # .build(
59430/// #     hyper_rustls::HttpsConnectorBuilder::new()
59431/// #         .with_native_roots()
59432/// #         .unwrap()
59433/// #         .https_or_http()
59434/// #         .enable_http1()
59435/// #         .build()
59436/// # );
59437/// # let mut hub = DisplayVideo::new(client, auth);
59438/// // As the method needs a request, you would usually fill it with the desired information
59439/// // into the respective structure. Some of the parts shown here might not be applicable !
59440/// // Values shown here are possibly random and not representative !
59441/// let mut req = CreateSdfDownloadTaskRequest::default();
59442///
59443/// // You can configure optional parameters by calling the respective setters at will, and
59444/// // execute the final call using `doit()`.
59445/// // Values shown here are possibly random and not representative !
59446/// let result = hub.sdfdownloadtasks().create(req)
59447///              .doit().await;
59448/// # }
59449/// ```
59450pub struct SdfdownloadtaskCreateCall<'a, C>
59451where
59452    C: 'a,
59453{
59454    hub: &'a DisplayVideo<C>,
59455    _request: CreateSdfDownloadTaskRequest,
59456    _delegate: Option<&'a mut dyn common::Delegate>,
59457    _additional_params: HashMap<String, String>,
59458    _scopes: BTreeSet<String>,
59459}
59460
59461impl<'a, C> common::CallBuilder for SdfdownloadtaskCreateCall<'a, C> {}
59462
59463impl<'a, C> SdfdownloadtaskCreateCall<'a, C>
59464where
59465    C: common::Connector,
59466{
59467    /// Perform the operation you have build so far.
59468    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
59469        use std::borrow::Cow;
59470        use std::io::{Read, Seek};
59471
59472        use common::{url::Params, ToParts};
59473        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
59474
59475        let mut dd = common::DefaultDelegate;
59476        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
59477        dlg.begin(common::MethodInfo {
59478            id: "displayvideo.sdfdownloadtasks.create",
59479            http_method: hyper::Method::POST,
59480        });
59481
59482        for &field in ["alt"].iter() {
59483            if self._additional_params.contains_key(field) {
59484                dlg.finished(false);
59485                return Err(common::Error::FieldClash(field));
59486            }
59487        }
59488
59489        let mut params = Params::with_capacity(3 + self._additional_params.len());
59490
59491        params.extend(self._additional_params.iter());
59492
59493        params.push("alt", "json");
59494        let mut url = self.hub._base_url.clone() + "v1/sdfdownloadtasks";
59495        if self._scopes.is_empty() {
59496            self._scopes
59497                .insert(Scope::DisplayVideo.as_ref().to_string());
59498        }
59499
59500        let url = params.parse_with_url(&url);
59501
59502        let mut json_mime_type = mime::APPLICATION_JSON;
59503        let mut request_value_reader = {
59504            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
59505            common::remove_json_null_values(&mut value);
59506            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
59507            serde_json::to_writer(&mut dst, &value).unwrap();
59508            dst
59509        };
59510        let request_size = request_value_reader
59511            .seek(std::io::SeekFrom::End(0))
59512            .unwrap();
59513        request_value_reader
59514            .seek(std::io::SeekFrom::Start(0))
59515            .unwrap();
59516
59517        loop {
59518            let token = match self
59519                .hub
59520                .auth
59521                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
59522                .await
59523            {
59524                Ok(token) => token,
59525                Err(e) => match dlg.token(e) {
59526                    Ok(token) => token,
59527                    Err(e) => {
59528                        dlg.finished(false);
59529                        return Err(common::Error::MissingToken(e));
59530                    }
59531                },
59532            };
59533            request_value_reader
59534                .seek(std::io::SeekFrom::Start(0))
59535                .unwrap();
59536            let mut req_result = {
59537                let client = &self.hub.client;
59538                dlg.pre_request();
59539                let mut req_builder = hyper::Request::builder()
59540                    .method(hyper::Method::POST)
59541                    .uri(url.as_str())
59542                    .header(USER_AGENT, self.hub._user_agent.clone());
59543
59544                if let Some(token) = token.as_ref() {
59545                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
59546                }
59547
59548                let request = req_builder
59549                    .header(CONTENT_TYPE, json_mime_type.to_string())
59550                    .header(CONTENT_LENGTH, request_size as u64)
59551                    .body(common::to_body(
59552                        request_value_reader.get_ref().clone().into(),
59553                    ));
59554
59555                client.request(request.unwrap()).await
59556            };
59557
59558            match req_result {
59559                Err(err) => {
59560                    if let common::Retry::After(d) = dlg.http_error(&err) {
59561                        sleep(d).await;
59562                        continue;
59563                    }
59564                    dlg.finished(false);
59565                    return Err(common::Error::HttpError(err));
59566                }
59567                Ok(res) => {
59568                    let (mut parts, body) = res.into_parts();
59569                    let mut body = common::Body::new(body);
59570                    if !parts.status.is_success() {
59571                        let bytes = common::to_bytes(body).await.unwrap_or_default();
59572                        let error = serde_json::from_str(&common::to_string(&bytes));
59573                        let response = common::to_response(parts, bytes.into());
59574
59575                        if let common::Retry::After(d) =
59576                            dlg.http_failure(&response, error.as_ref().ok())
59577                        {
59578                            sleep(d).await;
59579                            continue;
59580                        }
59581
59582                        dlg.finished(false);
59583
59584                        return Err(match error {
59585                            Ok(value) => common::Error::BadRequest(value),
59586                            _ => common::Error::Failure(response),
59587                        });
59588                    }
59589                    let response = {
59590                        let bytes = common::to_bytes(body).await.unwrap_or_default();
59591                        let encoded = common::to_string(&bytes);
59592                        match serde_json::from_str(&encoded) {
59593                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
59594                            Err(error) => {
59595                                dlg.response_json_decode_error(&encoded, &error);
59596                                return Err(common::Error::JsonDecodeError(
59597                                    encoded.to_string(),
59598                                    error,
59599                                ));
59600                            }
59601                        }
59602                    };
59603
59604                    dlg.finished(true);
59605                    return Ok(response);
59606                }
59607            }
59608        }
59609    }
59610
59611    ///
59612    /// Sets the *request* property to the given value.
59613    ///
59614    /// Even though the property as already been set when instantiating this call,
59615    /// we provide this method for API completeness.
59616    pub fn request(
59617        mut self,
59618        new_value: CreateSdfDownloadTaskRequest,
59619    ) -> SdfdownloadtaskCreateCall<'a, C> {
59620        self._request = new_value;
59621        self
59622    }
59623    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
59624    /// while executing the actual API request.
59625    ///
59626    /// ````text
59627    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
59628    /// ````
59629    ///
59630    /// Sets the *delegate* property to the given value.
59631    pub fn delegate(
59632        mut self,
59633        new_value: &'a mut dyn common::Delegate,
59634    ) -> SdfdownloadtaskCreateCall<'a, C> {
59635        self._delegate = Some(new_value);
59636        self
59637    }
59638
59639    /// Set any additional parameter of the query string used in the request.
59640    /// It should be used to set parameters which are not yet available through their own
59641    /// setters.
59642    ///
59643    /// Please note that this method must not be used to set any of the known parameters
59644    /// which have their own setter method. If done anyway, the request will fail.
59645    ///
59646    /// # Additional Parameters
59647    ///
59648    /// * *$.xgafv* (query-string) - V1 error format.
59649    /// * *access_token* (query-string) - OAuth access token.
59650    /// * *alt* (query-string) - Data format for response.
59651    /// * *callback* (query-string) - JSONP
59652    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
59653    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
59654    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
59655    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
59656    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
59657    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
59658    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
59659    pub fn param<T>(mut self, name: T, value: T) -> SdfdownloadtaskCreateCall<'a, C>
59660    where
59661        T: AsRef<str>,
59662    {
59663        self._additional_params
59664            .insert(name.as_ref().to_string(), value.as_ref().to_string());
59665        self
59666    }
59667
59668    /// Identifies the authorization scope for the method you are building.
59669    ///
59670    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
59671    /// [`Scope::DisplayVideo`].
59672    ///
59673    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
59674    /// tokens for more than one scope.
59675    ///
59676    /// Usually there is more than one suitable scope to authorize an operation, some of which may
59677    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
59678    /// sufficient, a read-write scope will do as well.
59679    pub fn add_scope<St>(mut self, scope: St) -> SdfdownloadtaskCreateCall<'a, C>
59680    where
59681        St: AsRef<str>,
59682    {
59683        self._scopes.insert(String::from(scope.as_ref()));
59684        self
59685    }
59686    /// Identifies the authorization scope(s) for the method you are building.
59687    ///
59688    /// See [`Self::add_scope()`] for details.
59689    pub fn add_scopes<I, St>(mut self, scopes: I) -> SdfdownloadtaskCreateCall<'a, C>
59690    where
59691        I: IntoIterator<Item = St>,
59692        St: AsRef<str>,
59693    {
59694        self._scopes
59695            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
59696        self
59697    }
59698
59699    /// Removes all scopes, and no default scope will be used either.
59700    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
59701    /// for details).
59702    pub fn clear_scopes(mut self) -> SdfdownloadtaskCreateCall<'a, C> {
59703        self._scopes.clear();
59704        self
59705    }
59706}
59707
59708/// Gets a single targeting option.
59709///
59710/// A builder for the *targetingOptions.get* method supported by a *targetingType* resource.
59711/// It is not used directly, but through a [`TargetingTypeMethods`] instance.
59712///
59713/// # Example
59714///
59715/// Instantiate a resource method builder
59716///
59717/// ```test_harness,no_run
59718/// # extern crate hyper;
59719/// # extern crate hyper_rustls;
59720/// # extern crate google_displayvideo1 as displayvideo1;
59721/// # async fn dox() {
59722/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
59723///
59724/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
59725/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
59726/// #     secret,
59727/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
59728/// # ).build().await.unwrap();
59729///
59730/// # let client = hyper_util::client::legacy::Client::builder(
59731/// #     hyper_util::rt::TokioExecutor::new()
59732/// # )
59733/// # .build(
59734/// #     hyper_rustls::HttpsConnectorBuilder::new()
59735/// #         .with_native_roots()
59736/// #         .unwrap()
59737/// #         .https_or_http()
59738/// #         .enable_http1()
59739/// #         .build()
59740/// # );
59741/// # let mut hub = DisplayVideo::new(client, auth);
59742/// // You can configure optional parameters by calling the respective setters at will, and
59743/// // execute the final call using `doit()`.
59744/// // Values shown here are possibly random and not representative !
59745/// let result = hub.targeting_types().targeting_options_get("targetingType", "targetingOptionId")
59746///              .advertiser_id(-36)
59747///              .doit().await;
59748/// # }
59749/// ```
59750pub struct TargetingTypeTargetingOptionGetCall<'a, C>
59751where
59752    C: 'a,
59753{
59754    hub: &'a DisplayVideo<C>,
59755    _targeting_type: String,
59756    _targeting_option_id: String,
59757    _advertiser_id: Option<i64>,
59758    _delegate: Option<&'a mut dyn common::Delegate>,
59759    _additional_params: HashMap<String, String>,
59760    _scopes: BTreeSet<String>,
59761}
59762
59763impl<'a, C> common::CallBuilder for TargetingTypeTargetingOptionGetCall<'a, C> {}
59764
59765impl<'a, C> TargetingTypeTargetingOptionGetCall<'a, C>
59766where
59767    C: common::Connector,
59768{
59769    /// Perform the operation you have build so far.
59770    pub async fn doit(mut self) -> common::Result<(common::Response, TargetingOption)> {
59771        use std::borrow::Cow;
59772        use std::io::{Read, Seek};
59773
59774        use common::{url::Params, ToParts};
59775        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
59776
59777        let mut dd = common::DefaultDelegate;
59778        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
59779        dlg.begin(common::MethodInfo {
59780            id: "displayvideo.targetingTypes.targetingOptions.get",
59781            http_method: hyper::Method::GET,
59782        });
59783
59784        for &field in ["alt", "targetingType", "targetingOptionId", "advertiserId"].iter() {
59785            if self._additional_params.contains_key(field) {
59786                dlg.finished(false);
59787                return Err(common::Error::FieldClash(field));
59788            }
59789        }
59790
59791        let mut params = Params::with_capacity(5 + self._additional_params.len());
59792        params.push("targetingType", self._targeting_type);
59793        params.push("targetingOptionId", self._targeting_option_id);
59794        if let Some(value) = self._advertiser_id.as_ref() {
59795            params.push("advertiserId", value.to_string());
59796        }
59797
59798        params.extend(self._additional_params.iter());
59799
59800        params.push("alt", "json");
59801        let mut url = self.hub._base_url.clone()
59802            + "v1/targetingTypes/{+targetingType}/targetingOptions/{+targetingOptionId}";
59803        if self._scopes.is_empty() {
59804            self._scopes
59805                .insert(Scope::DisplayVideo.as_ref().to_string());
59806        }
59807
59808        #[allow(clippy::single_element_loop)]
59809        for &(find_this, param_name) in [
59810            ("{+targetingType}", "targetingType"),
59811            ("{+targetingOptionId}", "targetingOptionId"),
59812        ]
59813        .iter()
59814        {
59815            url = params.uri_replacement(url, param_name, find_this, true);
59816        }
59817        {
59818            let to_remove = ["targetingOptionId", "targetingType"];
59819            params.remove_params(&to_remove);
59820        }
59821
59822        let url = params.parse_with_url(&url);
59823
59824        loop {
59825            let token = match self
59826                .hub
59827                .auth
59828                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
59829                .await
59830            {
59831                Ok(token) => token,
59832                Err(e) => match dlg.token(e) {
59833                    Ok(token) => token,
59834                    Err(e) => {
59835                        dlg.finished(false);
59836                        return Err(common::Error::MissingToken(e));
59837                    }
59838                },
59839            };
59840            let mut req_result = {
59841                let client = &self.hub.client;
59842                dlg.pre_request();
59843                let mut req_builder = hyper::Request::builder()
59844                    .method(hyper::Method::GET)
59845                    .uri(url.as_str())
59846                    .header(USER_AGENT, self.hub._user_agent.clone());
59847
59848                if let Some(token) = token.as_ref() {
59849                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
59850                }
59851
59852                let request = req_builder
59853                    .header(CONTENT_LENGTH, 0_u64)
59854                    .body(common::to_body::<String>(None));
59855
59856                client.request(request.unwrap()).await
59857            };
59858
59859            match req_result {
59860                Err(err) => {
59861                    if let common::Retry::After(d) = dlg.http_error(&err) {
59862                        sleep(d).await;
59863                        continue;
59864                    }
59865                    dlg.finished(false);
59866                    return Err(common::Error::HttpError(err));
59867                }
59868                Ok(res) => {
59869                    let (mut parts, body) = res.into_parts();
59870                    let mut body = common::Body::new(body);
59871                    if !parts.status.is_success() {
59872                        let bytes = common::to_bytes(body).await.unwrap_or_default();
59873                        let error = serde_json::from_str(&common::to_string(&bytes));
59874                        let response = common::to_response(parts, bytes.into());
59875
59876                        if let common::Retry::After(d) =
59877                            dlg.http_failure(&response, error.as_ref().ok())
59878                        {
59879                            sleep(d).await;
59880                            continue;
59881                        }
59882
59883                        dlg.finished(false);
59884
59885                        return Err(match error {
59886                            Ok(value) => common::Error::BadRequest(value),
59887                            _ => common::Error::Failure(response),
59888                        });
59889                    }
59890                    let response = {
59891                        let bytes = common::to_bytes(body).await.unwrap_or_default();
59892                        let encoded = common::to_string(&bytes);
59893                        match serde_json::from_str(&encoded) {
59894                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
59895                            Err(error) => {
59896                                dlg.response_json_decode_error(&encoded, &error);
59897                                return Err(common::Error::JsonDecodeError(
59898                                    encoded.to_string(),
59899                                    error,
59900                                ));
59901                            }
59902                        }
59903                    };
59904
59905                    dlg.finished(true);
59906                    return Ok(response);
59907                }
59908            }
59909        }
59910    }
59911
59912    /// Required. The type of targeting option to retrieve. Accepted values are: * `TARGETING_TYPE_APP_CATEGORY` * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_VIDEO_PLAYER_SIZE` * `TARGETING_TYPE_USER_REWARDED_CONTENT` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_DEVICE_TYPE` * `TARGETING_TYPE_BROWSER` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_CARRIER_AND_ISP` * `TARGETING_TYPE_OPERATING_SYSTEM` * `TARGETING_TYPE_DEVICE_MAKE_MODEL` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_CATEGORY` * `TARGETING_TYPE_VIEWABILITY` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_NATIVE_CONTENT_POSITION` * `TARGETING_TYPE_OMID`
59913    ///
59914    /// Sets the *targeting type* path property to the given value.
59915    ///
59916    /// Even though the property as already been set when instantiating this call,
59917    /// we provide this method for API completeness.
59918    pub fn targeting_type(mut self, new_value: &str) -> TargetingTypeTargetingOptionGetCall<'a, C> {
59919        self._targeting_type = new_value.to_string();
59920        self
59921    }
59922    /// Required. The ID of the of targeting option to retrieve.
59923    ///
59924    /// Sets the *targeting option id* path property to the given value.
59925    ///
59926    /// Even though the property as already been set when instantiating this call,
59927    /// we provide this method for API completeness.
59928    pub fn targeting_option_id(
59929        mut self,
59930        new_value: &str,
59931    ) -> TargetingTypeTargetingOptionGetCall<'a, C> {
59932        self._targeting_option_id = new_value.to_string();
59933        self
59934    }
59935    /// Required. The Advertiser this request is being made in the context of.
59936    ///
59937    /// Sets the *advertiser id* query property to the given value.
59938    pub fn advertiser_id(mut self, new_value: i64) -> TargetingTypeTargetingOptionGetCall<'a, C> {
59939        self._advertiser_id = Some(new_value);
59940        self
59941    }
59942    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
59943    /// while executing the actual API request.
59944    ///
59945    /// ````text
59946    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
59947    /// ````
59948    ///
59949    /// Sets the *delegate* property to the given value.
59950    pub fn delegate(
59951        mut self,
59952        new_value: &'a mut dyn common::Delegate,
59953    ) -> TargetingTypeTargetingOptionGetCall<'a, C> {
59954        self._delegate = Some(new_value);
59955        self
59956    }
59957
59958    /// Set any additional parameter of the query string used in the request.
59959    /// It should be used to set parameters which are not yet available through their own
59960    /// setters.
59961    ///
59962    /// Please note that this method must not be used to set any of the known parameters
59963    /// which have their own setter method. If done anyway, the request will fail.
59964    ///
59965    /// # Additional Parameters
59966    ///
59967    /// * *$.xgafv* (query-string) - V1 error format.
59968    /// * *access_token* (query-string) - OAuth access token.
59969    /// * *alt* (query-string) - Data format for response.
59970    /// * *callback* (query-string) - JSONP
59971    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
59972    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
59973    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
59974    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
59975    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
59976    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
59977    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
59978    pub fn param<T>(mut self, name: T, value: T) -> TargetingTypeTargetingOptionGetCall<'a, C>
59979    where
59980        T: AsRef<str>,
59981    {
59982        self._additional_params
59983            .insert(name.as_ref().to_string(), value.as_ref().to_string());
59984        self
59985    }
59986
59987    /// Identifies the authorization scope for the method you are building.
59988    ///
59989    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
59990    /// [`Scope::DisplayVideo`].
59991    ///
59992    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
59993    /// tokens for more than one scope.
59994    ///
59995    /// Usually there is more than one suitable scope to authorize an operation, some of which may
59996    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
59997    /// sufficient, a read-write scope will do as well.
59998    pub fn add_scope<St>(mut self, scope: St) -> TargetingTypeTargetingOptionGetCall<'a, C>
59999    where
60000        St: AsRef<str>,
60001    {
60002        self._scopes.insert(String::from(scope.as_ref()));
60003        self
60004    }
60005    /// Identifies the authorization scope(s) for the method you are building.
60006    ///
60007    /// See [`Self::add_scope()`] for details.
60008    pub fn add_scopes<I, St>(mut self, scopes: I) -> TargetingTypeTargetingOptionGetCall<'a, C>
60009    where
60010        I: IntoIterator<Item = St>,
60011        St: AsRef<str>,
60012    {
60013        self._scopes
60014            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
60015        self
60016    }
60017
60018    /// Removes all scopes, and no default scope will be used either.
60019    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
60020    /// for details).
60021    pub fn clear_scopes(mut self) -> TargetingTypeTargetingOptionGetCall<'a, C> {
60022        self._scopes.clear();
60023        self
60024    }
60025}
60026
60027/// Lists targeting options of a given type.
60028///
60029/// A builder for the *targetingOptions.list* method supported by a *targetingType* resource.
60030/// It is not used directly, but through a [`TargetingTypeMethods`] instance.
60031///
60032/// # Example
60033///
60034/// Instantiate a resource method builder
60035///
60036/// ```test_harness,no_run
60037/// # extern crate hyper;
60038/// # extern crate hyper_rustls;
60039/// # extern crate google_displayvideo1 as displayvideo1;
60040/// # async fn dox() {
60041/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
60042///
60043/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
60044/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
60045/// #     secret,
60046/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
60047/// # ).build().await.unwrap();
60048///
60049/// # let client = hyper_util::client::legacy::Client::builder(
60050/// #     hyper_util::rt::TokioExecutor::new()
60051/// # )
60052/// # .build(
60053/// #     hyper_rustls::HttpsConnectorBuilder::new()
60054/// #         .with_native_roots()
60055/// #         .unwrap()
60056/// #         .https_or_http()
60057/// #         .enable_http1()
60058/// #         .build()
60059/// # );
60060/// # let mut hub = DisplayVideo::new(client, auth);
60061/// // You can configure optional parameters by calling the respective setters at will, and
60062/// // execute the final call using `doit()`.
60063/// // Values shown here are possibly random and not representative !
60064/// let result = hub.targeting_types().targeting_options_list("targetingType")
60065///              .page_token("eirmod")
60066///              .page_size(-43)
60067///              .order_by("At")
60068///              .filter("Stet")
60069///              .advertiser_id(-3)
60070///              .doit().await;
60071/// # }
60072/// ```
60073pub struct TargetingTypeTargetingOptionListCall<'a, C>
60074where
60075    C: 'a,
60076{
60077    hub: &'a DisplayVideo<C>,
60078    _targeting_type: String,
60079    _page_token: Option<String>,
60080    _page_size: Option<i32>,
60081    _order_by: Option<String>,
60082    _filter: Option<String>,
60083    _advertiser_id: Option<i64>,
60084    _delegate: Option<&'a mut dyn common::Delegate>,
60085    _additional_params: HashMap<String, String>,
60086    _scopes: BTreeSet<String>,
60087}
60088
60089impl<'a, C> common::CallBuilder for TargetingTypeTargetingOptionListCall<'a, C> {}
60090
60091impl<'a, C> TargetingTypeTargetingOptionListCall<'a, C>
60092where
60093    C: common::Connector,
60094{
60095    /// Perform the operation you have build so far.
60096    pub async fn doit(
60097        mut self,
60098    ) -> common::Result<(common::Response, ListTargetingOptionsResponse)> {
60099        use std::borrow::Cow;
60100        use std::io::{Read, Seek};
60101
60102        use common::{url::Params, ToParts};
60103        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
60104
60105        let mut dd = common::DefaultDelegate;
60106        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
60107        dlg.begin(common::MethodInfo {
60108            id: "displayvideo.targetingTypes.targetingOptions.list",
60109            http_method: hyper::Method::GET,
60110        });
60111
60112        for &field in [
60113            "alt",
60114            "targetingType",
60115            "pageToken",
60116            "pageSize",
60117            "orderBy",
60118            "filter",
60119            "advertiserId",
60120        ]
60121        .iter()
60122        {
60123            if self._additional_params.contains_key(field) {
60124                dlg.finished(false);
60125                return Err(common::Error::FieldClash(field));
60126            }
60127        }
60128
60129        let mut params = Params::with_capacity(8 + self._additional_params.len());
60130        params.push("targetingType", self._targeting_type);
60131        if let Some(value) = self._page_token.as_ref() {
60132            params.push("pageToken", value);
60133        }
60134        if let Some(value) = self._page_size.as_ref() {
60135            params.push("pageSize", value.to_string());
60136        }
60137        if let Some(value) = self._order_by.as_ref() {
60138            params.push("orderBy", value);
60139        }
60140        if let Some(value) = self._filter.as_ref() {
60141            params.push("filter", value);
60142        }
60143        if let Some(value) = self._advertiser_id.as_ref() {
60144            params.push("advertiserId", value.to_string());
60145        }
60146
60147        params.extend(self._additional_params.iter());
60148
60149        params.push("alt", "json");
60150        let mut url =
60151            self.hub._base_url.clone() + "v1/targetingTypes/{+targetingType}/targetingOptions";
60152        if self._scopes.is_empty() {
60153            self._scopes
60154                .insert(Scope::DisplayVideo.as_ref().to_string());
60155        }
60156
60157        #[allow(clippy::single_element_loop)]
60158        for &(find_this, param_name) in [("{+targetingType}", "targetingType")].iter() {
60159            url = params.uri_replacement(url, param_name, find_this, true);
60160        }
60161        {
60162            let to_remove = ["targetingType"];
60163            params.remove_params(&to_remove);
60164        }
60165
60166        let url = params.parse_with_url(&url);
60167
60168        loop {
60169            let token = match self
60170                .hub
60171                .auth
60172                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
60173                .await
60174            {
60175                Ok(token) => token,
60176                Err(e) => match dlg.token(e) {
60177                    Ok(token) => token,
60178                    Err(e) => {
60179                        dlg.finished(false);
60180                        return Err(common::Error::MissingToken(e));
60181                    }
60182                },
60183            };
60184            let mut req_result = {
60185                let client = &self.hub.client;
60186                dlg.pre_request();
60187                let mut req_builder = hyper::Request::builder()
60188                    .method(hyper::Method::GET)
60189                    .uri(url.as_str())
60190                    .header(USER_AGENT, self.hub._user_agent.clone());
60191
60192                if let Some(token) = token.as_ref() {
60193                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
60194                }
60195
60196                let request = req_builder
60197                    .header(CONTENT_LENGTH, 0_u64)
60198                    .body(common::to_body::<String>(None));
60199
60200                client.request(request.unwrap()).await
60201            };
60202
60203            match req_result {
60204                Err(err) => {
60205                    if let common::Retry::After(d) = dlg.http_error(&err) {
60206                        sleep(d).await;
60207                        continue;
60208                    }
60209                    dlg.finished(false);
60210                    return Err(common::Error::HttpError(err));
60211                }
60212                Ok(res) => {
60213                    let (mut parts, body) = res.into_parts();
60214                    let mut body = common::Body::new(body);
60215                    if !parts.status.is_success() {
60216                        let bytes = common::to_bytes(body).await.unwrap_or_default();
60217                        let error = serde_json::from_str(&common::to_string(&bytes));
60218                        let response = common::to_response(parts, bytes.into());
60219
60220                        if let common::Retry::After(d) =
60221                            dlg.http_failure(&response, error.as_ref().ok())
60222                        {
60223                            sleep(d).await;
60224                            continue;
60225                        }
60226
60227                        dlg.finished(false);
60228
60229                        return Err(match error {
60230                            Ok(value) => common::Error::BadRequest(value),
60231                            _ => common::Error::Failure(response),
60232                        });
60233                    }
60234                    let response = {
60235                        let bytes = common::to_bytes(body).await.unwrap_or_default();
60236                        let encoded = common::to_string(&bytes);
60237                        match serde_json::from_str(&encoded) {
60238                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
60239                            Err(error) => {
60240                                dlg.response_json_decode_error(&encoded, &error);
60241                                return Err(common::Error::JsonDecodeError(
60242                                    encoded.to_string(),
60243                                    error,
60244                                ));
60245                            }
60246                        }
60247                    };
60248
60249                    dlg.finished(true);
60250                    return Ok(response);
60251                }
60252            }
60253        }
60254    }
60255
60256    /// Required. The type of targeting option to be listed. Accepted values are: * `TARGETING_TYPE_APP_CATEGORY` * `TARGETING_TYPE_AGE_RANGE` * `TARGETING_TYPE_GENDER` * `TARGETING_TYPE_VIDEO_PLAYER_SIZE` * `TARGETING_TYPE_USER_REWARDED_CONTENT` * `TARGETING_TYPE_PARENTAL_STATUS` * `TARGETING_TYPE_CONTENT_INSTREAM_POSITION` * `TARGETING_TYPE_CONTENT_OUTSTREAM_POSITION` * `TARGETING_TYPE_DEVICE_TYPE` * `TARGETING_TYPE_BROWSER` * `TARGETING_TYPE_HOUSEHOLD_INCOME` * `TARGETING_TYPE_ON_SCREEN_POSITION` * `TARGETING_TYPE_CARRIER_AND_ISP` * `TARGETING_TYPE_OPERATING_SYSTEM` * `TARGETING_TYPE_DEVICE_MAKE_MODEL` * `TARGETING_TYPE_ENVIRONMENT` * `TARGETING_TYPE_CATEGORY` * `TARGETING_TYPE_VIEWABILITY` * `TARGETING_TYPE_AUTHORIZED_SELLER_STATUS` * `TARGETING_TYPE_LANGUAGE` * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_DIGITAL_CONTENT_LABEL_EXCLUSION` * `TARGETING_TYPE_SENSITIVE_CATEGORY_EXCLUSION` * `TARGETING_TYPE_EXCHANGE` * `TARGETING_TYPE_SUB_EXCHANGE` * `TARGETING_TYPE_NATIVE_CONTENT_POSITION` * `TARGETING_TYPE_OMID`
60257    ///
60258    /// Sets the *targeting type* path property to the given value.
60259    ///
60260    /// Even though the property as already been set when instantiating this call,
60261    /// we provide this method for API completeness.
60262    pub fn targeting_type(
60263        mut self,
60264        new_value: &str,
60265    ) -> TargetingTypeTargetingOptionListCall<'a, C> {
60266        self._targeting_type = new_value.to_string();
60267        self
60268    }
60269    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListTargetingOptions` method. If not specified, the first page of results will be returned.
60270    ///
60271    /// Sets the *page token* query property to the given value.
60272    pub fn page_token(mut self, new_value: &str) -> TargetingTypeTargetingOptionListCall<'a, C> {
60273        self._page_token = Some(new_value.to_string());
60274        self
60275    }
60276    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` if an invalid value is specified.
60277    ///
60278    /// Sets the *page size* query property to the given value.
60279    pub fn page_size(mut self, new_value: i32) -> TargetingTypeTargetingOptionListCall<'a, C> {
60280        self._page_size = Some(new_value);
60281        self
60282    }
60283    /// Field by which to sort the list. Acceptable values are: * `targetingOptionId` (default) The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. Example: `targetingOptionId desc`.
60284    ///
60285    /// Sets the *order by* query property to the given value.
60286    pub fn order_by(mut self, new_value: &str) -> TargetingTypeTargetingOptionListCall<'a, C> {
60287        self._order_by = Some(new_value.to_string());
60288        self
60289    }
60290    /// Allows filtering by targeting option fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by `OR` logical operators. * A restriction has the form of `{field} {operator} {value}`. * All fields must use the `EQUALS (=)` operator. Supported fields: * `carrierAndIspDetails.type` * `geoRegionDetails.geoRegionType` * `targetingOptionId` Examples: * All `GEO REGION` targeting options that belong to sub type `GEO_REGION_TYPE_COUNTRY` or `GEO_REGION_TYPE_STATE`: `geoRegionDetails.geoRegionType="GEO_REGION_TYPE_COUNTRY" OR geoRegionDetails.geoRegionType="GEO_REGION_TYPE_STATE"` * All `CARRIER AND ISP` targeting options that belong to sub type `CARRIER_AND_ISP_TYPE_CARRIER`: `carrierAndIspDetails.type="CARRIER_AND_ISP_TYPE_CARRIER"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
60291    ///
60292    /// Sets the *filter* query property to the given value.
60293    pub fn filter(mut self, new_value: &str) -> TargetingTypeTargetingOptionListCall<'a, C> {
60294        self._filter = Some(new_value.to_string());
60295        self
60296    }
60297    /// Required. The Advertiser this request is being made in the context of.
60298    ///
60299    /// Sets the *advertiser id* query property to the given value.
60300    pub fn advertiser_id(mut self, new_value: i64) -> TargetingTypeTargetingOptionListCall<'a, C> {
60301        self._advertiser_id = Some(new_value);
60302        self
60303    }
60304    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
60305    /// while executing the actual API request.
60306    ///
60307    /// ````text
60308    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
60309    /// ````
60310    ///
60311    /// Sets the *delegate* property to the given value.
60312    pub fn delegate(
60313        mut self,
60314        new_value: &'a mut dyn common::Delegate,
60315    ) -> TargetingTypeTargetingOptionListCall<'a, C> {
60316        self._delegate = Some(new_value);
60317        self
60318    }
60319
60320    /// Set any additional parameter of the query string used in the request.
60321    /// It should be used to set parameters which are not yet available through their own
60322    /// setters.
60323    ///
60324    /// Please note that this method must not be used to set any of the known parameters
60325    /// which have their own setter method. If done anyway, the request will fail.
60326    ///
60327    /// # Additional Parameters
60328    ///
60329    /// * *$.xgafv* (query-string) - V1 error format.
60330    /// * *access_token* (query-string) - OAuth access token.
60331    /// * *alt* (query-string) - Data format for response.
60332    /// * *callback* (query-string) - JSONP
60333    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
60334    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
60335    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
60336    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
60337    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
60338    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
60339    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
60340    pub fn param<T>(mut self, name: T, value: T) -> TargetingTypeTargetingOptionListCall<'a, C>
60341    where
60342        T: AsRef<str>,
60343    {
60344        self._additional_params
60345            .insert(name.as_ref().to_string(), value.as_ref().to_string());
60346        self
60347    }
60348
60349    /// Identifies the authorization scope for the method you are building.
60350    ///
60351    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
60352    /// [`Scope::DisplayVideo`].
60353    ///
60354    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
60355    /// tokens for more than one scope.
60356    ///
60357    /// Usually there is more than one suitable scope to authorize an operation, some of which may
60358    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
60359    /// sufficient, a read-write scope will do as well.
60360    pub fn add_scope<St>(mut self, scope: St) -> TargetingTypeTargetingOptionListCall<'a, C>
60361    where
60362        St: AsRef<str>,
60363    {
60364        self._scopes.insert(String::from(scope.as_ref()));
60365        self
60366    }
60367    /// Identifies the authorization scope(s) for the method you are building.
60368    ///
60369    /// See [`Self::add_scope()`] for details.
60370    pub fn add_scopes<I, St>(mut self, scopes: I) -> TargetingTypeTargetingOptionListCall<'a, C>
60371    where
60372        I: IntoIterator<Item = St>,
60373        St: AsRef<str>,
60374    {
60375        self._scopes
60376            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
60377        self
60378    }
60379
60380    /// Removes all scopes, and no default scope will be used either.
60381    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
60382    /// for details).
60383    pub fn clear_scopes(mut self) -> TargetingTypeTargetingOptionListCall<'a, C> {
60384        self._scopes.clear();
60385        self
60386    }
60387}
60388
60389/// Searches for targeting options of a given type based on the given search terms.
60390///
60391/// A builder for the *targetingOptions.search* method supported by a *targetingType* resource.
60392/// It is not used directly, but through a [`TargetingTypeMethods`] instance.
60393///
60394/// # Example
60395///
60396/// Instantiate a resource method builder
60397///
60398/// ```test_harness,no_run
60399/// # extern crate hyper;
60400/// # extern crate hyper_rustls;
60401/// # extern crate google_displayvideo1 as displayvideo1;
60402/// use displayvideo1::api::SearchTargetingOptionsRequest;
60403/// # async fn dox() {
60404/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
60405///
60406/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
60407/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
60408/// #     secret,
60409/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
60410/// # ).build().await.unwrap();
60411///
60412/// # let client = hyper_util::client::legacy::Client::builder(
60413/// #     hyper_util::rt::TokioExecutor::new()
60414/// # )
60415/// # .build(
60416/// #     hyper_rustls::HttpsConnectorBuilder::new()
60417/// #         .with_native_roots()
60418/// #         .unwrap()
60419/// #         .https_or_http()
60420/// #         .enable_http1()
60421/// #         .build()
60422/// # );
60423/// # let mut hub = DisplayVideo::new(client, auth);
60424/// // As the method needs a request, you would usually fill it with the desired information
60425/// // into the respective structure. Some of the parts shown here might not be applicable !
60426/// // Values shown here are possibly random and not representative !
60427/// let mut req = SearchTargetingOptionsRequest::default();
60428///
60429/// // You can configure optional parameters by calling the respective setters at will, and
60430/// // execute the final call using `doit()`.
60431/// // Values shown here are possibly random and not representative !
60432/// let result = hub.targeting_types().targeting_options_search(req, "targetingType")
60433///              .doit().await;
60434/// # }
60435/// ```
60436pub struct TargetingTypeTargetingOptionSearchCall<'a, C>
60437where
60438    C: 'a,
60439{
60440    hub: &'a DisplayVideo<C>,
60441    _request: SearchTargetingOptionsRequest,
60442    _targeting_type: String,
60443    _delegate: Option<&'a mut dyn common::Delegate>,
60444    _additional_params: HashMap<String, String>,
60445    _scopes: BTreeSet<String>,
60446}
60447
60448impl<'a, C> common::CallBuilder for TargetingTypeTargetingOptionSearchCall<'a, C> {}
60449
60450impl<'a, C> TargetingTypeTargetingOptionSearchCall<'a, C>
60451where
60452    C: common::Connector,
60453{
60454    /// Perform the operation you have build so far.
60455    pub async fn doit(
60456        mut self,
60457    ) -> common::Result<(common::Response, SearchTargetingOptionsResponse)> {
60458        use std::borrow::Cow;
60459        use std::io::{Read, Seek};
60460
60461        use common::{url::Params, ToParts};
60462        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
60463
60464        let mut dd = common::DefaultDelegate;
60465        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
60466        dlg.begin(common::MethodInfo {
60467            id: "displayvideo.targetingTypes.targetingOptions.search",
60468            http_method: hyper::Method::POST,
60469        });
60470
60471        for &field in ["alt", "targetingType"].iter() {
60472            if self._additional_params.contains_key(field) {
60473                dlg.finished(false);
60474                return Err(common::Error::FieldClash(field));
60475            }
60476        }
60477
60478        let mut params = Params::with_capacity(4 + self._additional_params.len());
60479        params.push("targetingType", self._targeting_type);
60480
60481        params.extend(self._additional_params.iter());
60482
60483        params.push("alt", "json");
60484        let mut url = self.hub._base_url.clone()
60485            + "v1/targetingTypes/{+targetingType}/targetingOptions:search";
60486        if self._scopes.is_empty() {
60487            self._scopes
60488                .insert(Scope::DisplayVideo.as_ref().to_string());
60489        }
60490
60491        #[allow(clippy::single_element_loop)]
60492        for &(find_this, param_name) in [("{+targetingType}", "targetingType")].iter() {
60493            url = params.uri_replacement(url, param_name, find_this, true);
60494        }
60495        {
60496            let to_remove = ["targetingType"];
60497            params.remove_params(&to_remove);
60498        }
60499
60500        let url = params.parse_with_url(&url);
60501
60502        let mut json_mime_type = mime::APPLICATION_JSON;
60503        let mut request_value_reader = {
60504            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
60505            common::remove_json_null_values(&mut value);
60506            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
60507            serde_json::to_writer(&mut dst, &value).unwrap();
60508            dst
60509        };
60510        let request_size = request_value_reader
60511            .seek(std::io::SeekFrom::End(0))
60512            .unwrap();
60513        request_value_reader
60514            .seek(std::io::SeekFrom::Start(0))
60515            .unwrap();
60516
60517        loop {
60518            let token = match self
60519                .hub
60520                .auth
60521                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
60522                .await
60523            {
60524                Ok(token) => token,
60525                Err(e) => match dlg.token(e) {
60526                    Ok(token) => token,
60527                    Err(e) => {
60528                        dlg.finished(false);
60529                        return Err(common::Error::MissingToken(e));
60530                    }
60531                },
60532            };
60533            request_value_reader
60534                .seek(std::io::SeekFrom::Start(0))
60535                .unwrap();
60536            let mut req_result = {
60537                let client = &self.hub.client;
60538                dlg.pre_request();
60539                let mut req_builder = hyper::Request::builder()
60540                    .method(hyper::Method::POST)
60541                    .uri(url.as_str())
60542                    .header(USER_AGENT, self.hub._user_agent.clone());
60543
60544                if let Some(token) = token.as_ref() {
60545                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
60546                }
60547
60548                let request = req_builder
60549                    .header(CONTENT_TYPE, json_mime_type.to_string())
60550                    .header(CONTENT_LENGTH, request_size as u64)
60551                    .body(common::to_body(
60552                        request_value_reader.get_ref().clone().into(),
60553                    ));
60554
60555                client.request(request.unwrap()).await
60556            };
60557
60558            match req_result {
60559                Err(err) => {
60560                    if let common::Retry::After(d) = dlg.http_error(&err) {
60561                        sleep(d).await;
60562                        continue;
60563                    }
60564                    dlg.finished(false);
60565                    return Err(common::Error::HttpError(err));
60566                }
60567                Ok(res) => {
60568                    let (mut parts, body) = res.into_parts();
60569                    let mut body = common::Body::new(body);
60570                    if !parts.status.is_success() {
60571                        let bytes = common::to_bytes(body).await.unwrap_or_default();
60572                        let error = serde_json::from_str(&common::to_string(&bytes));
60573                        let response = common::to_response(parts, bytes.into());
60574
60575                        if let common::Retry::After(d) =
60576                            dlg.http_failure(&response, error.as_ref().ok())
60577                        {
60578                            sleep(d).await;
60579                            continue;
60580                        }
60581
60582                        dlg.finished(false);
60583
60584                        return Err(match error {
60585                            Ok(value) => common::Error::BadRequest(value),
60586                            _ => common::Error::Failure(response),
60587                        });
60588                    }
60589                    let response = {
60590                        let bytes = common::to_bytes(body).await.unwrap_or_default();
60591                        let encoded = common::to_string(&bytes);
60592                        match serde_json::from_str(&encoded) {
60593                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
60594                            Err(error) => {
60595                                dlg.response_json_decode_error(&encoded, &error);
60596                                return Err(common::Error::JsonDecodeError(
60597                                    encoded.to_string(),
60598                                    error,
60599                                ));
60600                            }
60601                        }
60602                    };
60603
60604                    dlg.finished(true);
60605                    return Ok(response);
60606                }
60607            }
60608        }
60609    }
60610
60611    ///
60612    /// Sets the *request* property to the given value.
60613    ///
60614    /// Even though the property as already been set when instantiating this call,
60615    /// we provide this method for API completeness.
60616    pub fn request(
60617        mut self,
60618        new_value: SearchTargetingOptionsRequest,
60619    ) -> TargetingTypeTargetingOptionSearchCall<'a, C> {
60620        self._request = new_value;
60621        self
60622    }
60623    /// Required. The type of targeting options to retrieve. Accepted values are: * `TARGETING_TYPE_GEO_REGION` * `TARGETING_TYPE_POI` * `TARGETING_TYPE_BUSINESS_CHAIN`
60624    ///
60625    /// Sets the *targeting type* path property to the given value.
60626    ///
60627    /// Even though the property as already been set when instantiating this call,
60628    /// we provide this method for API completeness.
60629    pub fn targeting_type(
60630        mut self,
60631        new_value: &str,
60632    ) -> TargetingTypeTargetingOptionSearchCall<'a, C> {
60633        self._targeting_type = new_value.to_string();
60634        self
60635    }
60636    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
60637    /// while executing the actual API request.
60638    ///
60639    /// ````text
60640    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
60641    /// ````
60642    ///
60643    /// Sets the *delegate* property to the given value.
60644    pub fn delegate(
60645        mut self,
60646        new_value: &'a mut dyn common::Delegate,
60647    ) -> TargetingTypeTargetingOptionSearchCall<'a, C> {
60648        self._delegate = Some(new_value);
60649        self
60650    }
60651
60652    /// Set any additional parameter of the query string used in the request.
60653    /// It should be used to set parameters which are not yet available through their own
60654    /// setters.
60655    ///
60656    /// Please note that this method must not be used to set any of the known parameters
60657    /// which have their own setter method. If done anyway, the request will fail.
60658    ///
60659    /// # Additional Parameters
60660    ///
60661    /// * *$.xgafv* (query-string) - V1 error format.
60662    /// * *access_token* (query-string) - OAuth access token.
60663    /// * *alt* (query-string) - Data format for response.
60664    /// * *callback* (query-string) - JSONP
60665    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
60666    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
60667    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
60668    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
60669    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
60670    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
60671    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
60672    pub fn param<T>(mut self, name: T, value: T) -> TargetingTypeTargetingOptionSearchCall<'a, C>
60673    where
60674        T: AsRef<str>,
60675    {
60676        self._additional_params
60677            .insert(name.as_ref().to_string(), value.as_ref().to_string());
60678        self
60679    }
60680
60681    /// Identifies the authorization scope for the method you are building.
60682    ///
60683    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
60684    /// [`Scope::DisplayVideo`].
60685    ///
60686    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
60687    /// tokens for more than one scope.
60688    ///
60689    /// Usually there is more than one suitable scope to authorize an operation, some of which may
60690    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
60691    /// sufficient, a read-write scope will do as well.
60692    pub fn add_scope<St>(mut self, scope: St) -> TargetingTypeTargetingOptionSearchCall<'a, C>
60693    where
60694        St: AsRef<str>,
60695    {
60696        self._scopes.insert(String::from(scope.as_ref()));
60697        self
60698    }
60699    /// Identifies the authorization scope(s) for the method you are building.
60700    ///
60701    /// See [`Self::add_scope()`] for details.
60702    pub fn add_scopes<I, St>(mut self, scopes: I) -> TargetingTypeTargetingOptionSearchCall<'a, C>
60703    where
60704        I: IntoIterator<Item = St>,
60705        St: AsRef<str>,
60706    {
60707        self._scopes
60708            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
60709        self
60710    }
60711
60712    /// Removes all scopes, and no default scope will be used either.
60713    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
60714    /// for details).
60715    pub fn clear_scopes(mut self) -> TargetingTypeTargetingOptionSearchCall<'a, C> {
60716        self._scopes.clear();
60717        self
60718    }
60719}
60720
60721/// Bulk edits user roles for a user. The operation will delete the assigned user roles provided in BulkEditAssignedUserRolesRequest.deletedAssignedUserRoles and then assign the user roles provided in BulkEditAssignedUserRolesRequest.createdAssignedUserRoles. This method has unique authentication requirements. Read the prerequisites in our [Managing Users guide](https://developers.google.com/display-video/api/guides/users/overview#prerequisites) before using this method. The “Try this method” feature does not work for this method.
60722///
60723/// A builder for the *bulkEditAssignedUserRoles* method supported by a *user* resource.
60724/// It is not used directly, but through a [`UserMethods`] instance.
60725///
60726/// # Example
60727///
60728/// Instantiate a resource method builder
60729///
60730/// ```test_harness,no_run
60731/// # extern crate hyper;
60732/// # extern crate hyper_rustls;
60733/// # extern crate google_displayvideo1 as displayvideo1;
60734/// use displayvideo1::api::BulkEditAssignedUserRolesRequest;
60735/// # async fn dox() {
60736/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
60737///
60738/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
60739/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
60740/// #     secret,
60741/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
60742/// # ).build().await.unwrap();
60743///
60744/// # let client = hyper_util::client::legacy::Client::builder(
60745/// #     hyper_util::rt::TokioExecutor::new()
60746/// # )
60747/// # .build(
60748/// #     hyper_rustls::HttpsConnectorBuilder::new()
60749/// #         .with_native_roots()
60750/// #         .unwrap()
60751/// #         .https_or_http()
60752/// #         .enable_http1()
60753/// #         .build()
60754/// # );
60755/// # let mut hub = DisplayVideo::new(client, auth);
60756/// // As the method needs a request, you would usually fill it with the desired information
60757/// // into the respective structure. Some of the parts shown here might not be applicable !
60758/// // Values shown here are possibly random and not representative !
60759/// let mut req = BulkEditAssignedUserRolesRequest::default();
60760///
60761/// // You can configure optional parameters by calling the respective setters at will, and
60762/// // execute the final call using `doit()`.
60763/// // Values shown here are possibly random and not representative !
60764/// let result = hub.users().bulk_edit_assigned_user_roles(req, -6)
60765///              .doit().await;
60766/// # }
60767/// ```
60768pub struct UserBulkEditAssignedUserRoleCall<'a, C>
60769where
60770    C: 'a,
60771{
60772    hub: &'a DisplayVideo<C>,
60773    _request: BulkEditAssignedUserRolesRequest,
60774    _user_id: i64,
60775    _delegate: Option<&'a mut dyn common::Delegate>,
60776    _additional_params: HashMap<String, String>,
60777    _scopes: BTreeSet<String>,
60778}
60779
60780impl<'a, C> common::CallBuilder for UserBulkEditAssignedUserRoleCall<'a, C> {}
60781
60782impl<'a, C> UserBulkEditAssignedUserRoleCall<'a, C>
60783where
60784    C: common::Connector,
60785{
60786    /// Perform the operation you have build so far.
60787    pub async fn doit(
60788        mut self,
60789    ) -> common::Result<(common::Response, BulkEditAssignedUserRolesResponse)> {
60790        use std::borrow::Cow;
60791        use std::io::{Read, Seek};
60792
60793        use common::{url::Params, ToParts};
60794        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
60795
60796        let mut dd = common::DefaultDelegate;
60797        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
60798        dlg.begin(common::MethodInfo {
60799            id: "displayvideo.users.bulkEditAssignedUserRoles",
60800            http_method: hyper::Method::POST,
60801        });
60802
60803        for &field in ["alt", "userId"].iter() {
60804            if self._additional_params.contains_key(field) {
60805                dlg.finished(false);
60806                return Err(common::Error::FieldClash(field));
60807            }
60808        }
60809
60810        let mut params = Params::with_capacity(4 + self._additional_params.len());
60811        params.push("userId", self._user_id.to_string());
60812
60813        params.extend(self._additional_params.iter());
60814
60815        params.push("alt", "json");
60816        let mut url = self.hub._base_url.clone() + "v1/users/{+userId}:bulkEditAssignedUserRoles";
60817        if self._scopes.is_empty() {
60818            self._scopes
60819                .insert(Scope::DisplayVideoUserManagement.as_ref().to_string());
60820        }
60821
60822        #[allow(clippy::single_element_loop)]
60823        for &(find_this, param_name) in [("{+userId}", "userId")].iter() {
60824            url = params.uri_replacement(url, param_name, find_this, true);
60825        }
60826        {
60827            let to_remove = ["userId"];
60828            params.remove_params(&to_remove);
60829        }
60830
60831        let url = params.parse_with_url(&url);
60832
60833        let mut json_mime_type = mime::APPLICATION_JSON;
60834        let mut request_value_reader = {
60835            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
60836            common::remove_json_null_values(&mut value);
60837            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
60838            serde_json::to_writer(&mut dst, &value).unwrap();
60839            dst
60840        };
60841        let request_size = request_value_reader
60842            .seek(std::io::SeekFrom::End(0))
60843            .unwrap();
60844        request_value_reader
60845            .seek(std::io::SeekFrom::Start(0))
60846            .unwrap();
60847
60848        loop {
60849            let token = match self
60850                .hub
60851                .auth
60852                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
60853                .await
60854            {
60855                Ok(token) => token,
60856                Err(e) => match dlg.token(e) {
60857                    Ok(token) => token,
60858                    Err(e) => {
60859                        dlg.finished(false);
60860                        return Err(common::Error::MissingToken(e));
60861                    }
60862                },
60863            };
60864            request_value_reader
60865                .seek(std::io::SeekFrom::Start(0))
60866                .unwrap();
60867            let mut req_result = {
60868                let client = &self.hub.client;
60869                dlg.pre_request();
60870                let mut req_builder = hyper::Request::builder()
60871                    .method(hyper::Method::POST)
60872                    .uri(url.as_str())
60873                    .header(USER_AGENT, self.hub._user_agent.clone());
60874
60875                if let Some(token) = token.as_ref() {
60876                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
60877                }
60878
60879                let request = req_builder
60880                    .header(CONTENT_TYPE, json_mime_type.to_string())
60881                    .header(CONTENT_LENGTH, request_size as u64)
60882                    .body(common::to_body(
60883                        request_value_reader.get_ref().clone().into(),
60884                    ));
60885
60886                client.request(request.unwrap()).await
60887            };
60888
60889            match req_result {
60890                Err(err) => {
60891                    if let common::Retry::After(d) = dlg.http_error(&err) {
60892                        sleep(d).await;
60893                        continue;
60894                    }
60895                    dlg.finished(false);
60896                    return Err(common::Error::HttpError(err));
60897                }
60898                Ok(res) => {
60899                    let (mut parts, body) = res.into_parts();
60900                    let mut body = common::Body::new(body);
60901                    if !parts.status.is_success() {
60902                        let bytes = common::to_bytes(body).await.unwrap_or_default();
60903                        let error = serde_json::from_str(&common::to_string(&bytes));
60904                        let response = common::to_response(parts, bytes.into());
60905
60906                        if let common::Retry::After(d) =
60907                            dlg.http_failure(&response, error.as_ref().ok())
60908                        {
60909                            sleep(d).await;
60910                            continue;
60911                        }
60912
60913                        dlg.finished(false);
60914
60915                        return Err(match error {
60916                            Ok(value) => common::Error::BadRequest(value),
60917                            _ => common::Error::Failure(response),
60918                        });
60919                    }
60920                    let response = {
60921                        let bytes = common::to_bytes(body).await.unwrap_or_default();
60922                        let encoded = common::to_string(&bytes);
60923                        match serde_json::from_str(&encoded) {
60924                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
60925                            Err(error) => {
60926                                dlg.response_json_decode_error(&encoded, &error);
60927                                return Err(common::Error::JsonDecodeError(
60928                                    encoded.to_string(),
60929                                    error,
60930                                ));
60931                            }
60932                        }
60933                    };
60934
60935                    dlg.finished(true);
60936                    return Ok(response);
60937                }
60938            }
60939        }
60940    }
60941
60942    ///
60943    /// Sets the *request* property to the given value.
60944    ///
60945    /// Even though the property as already been set when instantiating this call,
60946    /// we provide this method for API completeness.
60947    pub fn request(
60948        mut self,
60949        new_value: BulkEditAssignedUserRolesRequest,
60950    ) -> UserBulkEditAssignedUserRoleCall<'a, C> {
60951        self._request = new_value;
60952        self
60953    }
60954    /// Required. The ID of the user to which the assigned user roles belong.
60955    ///
60956    /// Sets the *user id* path property to the given value.
60957    ///
60958    /// Even though the property as already been set when instantiating this call,
60959    /// we provide this method for API completeness.
60960    pub fn user_id(mut self, new_value: i64) -> UserBulkEditAssignedUserRoleCall<'a, C> {
60961        self._user_id = new_value;
60962        self
60963    }
60964    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
60965    /// while executing the actual API request.
60966    ///
60967    /// ````text
60968    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
60969    /// ````
60970    ///
60971    /// Sets the *delegate* property to the given value.
60972    pub fn delegate(
60973        mut self,
60974        new_value: &'a mut dyn common::Delegate,
60975    ) -> UserBulkEditAssignedUserRoleCall<'a, C> {
60976        self._delegate = Some(new_value);
60977        self
60978    }
60979
60980    /// Set any additional parameter of the query string used in the request.
60981    /// It should be used to set parameters which are not yet available through their own
60982    /// setters.
60983    ///
60984    /// Please note that this method must not be used to set any of the known parameters
60985    /// which have their own setter method. If done anyway, the request will fail.
60986    ///
60987    /// # Additional Parameters
60988    ///
60989    /// * *$.xgafv* (query-string) - V1 error format.
60990    /// * *access_token* (query-string) - OAuth access token.
60991    /// * *alt* (query-string) - Data format for response.
60992    /// * *callback* (query-string) - JSONP
60993    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
60994    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
60995    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
60996    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
60997    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
60998    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
60999    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
61000    pub fn param<T>(mut self, name: T, value: T) -> UserBulkEditAssignedUserRoleCall<'a, C>
61001    where
61002        T: AsRef<str>,
61003    {
61004        self._additional_params
61005            .insert(name.as_ref().to_string(), value.as_ref().to_string());
61006        self
61007    }
61008
61009    /// Identifies the authorization scope for the method you are building.
61010    ///
61011    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
61012    /// [`Scope::DisplayVideoUserManagement`].
61013    ///
61014    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
61015    /// tokens for more than one scope.
61016    ///
61017    /// Usually there is more than one suitable scope to authorize an operation, some of which may
61018    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
61019    /// sufficient, a read-write scope will do as well.
61020    pub fn add_scope<St>(mut self, scope: St) -> UserBulkEditAssignedUserRoleCall<'a, C>
61021    where
61022        St: AsRef<str>,
61023    {
61024        self._scopes.insert(String::from(scope.as_ref()));
61025        self
61026    }
61027    /// Identifies the authorization scope(s) for the method you are building.
61028    ///
61029    /// See [`Self::add_scope()`] for details.
61030    pub fn add_scopes<I, St>(mut self, scopes: I) -> UserBulkEditAssignedUserRoleCall<'a, C>
61031    where
61032        I: IntoIterator<Item = St>,
61033        St: AsRef<str>,
61034    {
61035        self._scopes
61036            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
61037        self
61038    }
61039
61040    /// Removes all scopes, and no default scope will be used either.
61041    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
61042    /// for details).
61043    pub fn clear_scopes(mut self) -> UserBulkEditAssignedUserRoleCall<'a, C> {
61044        self._scopes.clear();
61045        self
61046    }
61047}
61048
61049/// Creates a new user. Returns the newly created user if successful. This method has unique authentication requirements. Read the prerequisites in our [Managing Users guide](https://developers.google.com/display-video/api/guides/users/overview#prerequisites) before using this method. The “Try this method” feature does not work for this method.
61050///
61051/// A builder for the *create* method supported by a *user* resource.
61052/// It is not used directly, but through a [`UserMethods`] instance.
61053///
61054/// # Example
61055///
61056/// Instantiate a resource method builder
61057///
61058/// ```test_harness,no_run
61059/// # extern crate hyper;
61060/// # extern crate hyper_rustls;
61061/// # extern crate google_displayvideo1 as displayvideo1;
61062/// use displayvideo1::api::User;
61063/// # async fn dox() {
61064/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
61065///
61066/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
61067/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
61068/// #     secret,
61069/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
61070/// # ).build().await.unwrap();
61071///
61072/// # let client = hyper_util::client::legacy::Client::builder(
61073/// #     hyper_util::rt::TokioExecutor::new()
61074/// # )
61075/// # .build(
61076/// #     hyper_rustls::HttpsConnectorBuilder::new()
61077/// #         .with_native_roots()
61078/// #         .unwrap()
61079/// #         .https_or_http()
61080/// #         .enable_http1()
61081/// #         .build()
61082/// # );
61083/// # let mut hub = DisplayVideo::new(client, auth);
61084/// // As the method needs a request, you would usually fill it with the desired information
61085/// // into the respective structure. Some of the parts shown here might not be applicable !
61086/// // Values shown here are possibly random and not representative !
61087/// let mut req = User::default();
61088///
61089/// // You can configure optional parameters by calling the respective setters at will, and
61090/// // execute the final call using `doit()`.
61091/// // Values shown here are possibly random and not representative !
61092/// let result = hub.users().create(req)
61093///              .doit().await;
61094/// # }
61095/// ```
61096pub struct UserCreateCall<'a, C>
61097where
61098    C: 'a,
61099{
61100    hub: &'a DisplayVideo<C>,
61101    _request: User,
61102    _delegate: Option<&'a mut dyn common::Delegate>,
61103    _additional_params: HashMap<String, String>,
61104    _scopes: BTreeSet<String>,
61105}
61106
61107impl<'a, C> common::CallBuilder for UserCreateCall<'a, C> {}
61108
61109impl<'a, C> UserCreateCall<'a, C>
61110where
61111    C: common::Connector,
61112{
61113    /// Perform the operation you have build so far.
61114    pub async fn doit(mut self) -> common::Result<(common::Response, User)> {
61115        use std::borrow::Cow;
61116        use std::io::{Read, Seek};
61117
61118        use common::{url::Params, ToParts};
61119        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
61120
61121        let mut dd = common::DefaultDelegate;
61122        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
61123        dlg.begin(common::MethodInfo {
61124            id: "displayvideo.users.create",
61125            http_method: hyper::Method::POST,
61126        });
61127
61128        for &field in ["alt"].iter() {
61129            if self._additional_params.contains_key(field) {
61130                dlg.finished(false);
61131                return Err(common::Error::FieldClash(field));
61132            }
61133        }
61134
61135        let mut params = Params::with_capacity(3 + self._additional_params.len());
61136
61137        params.extend(self._additional_params.iter());
61138
61139        params.push("alt", "json");
61140        let mut url = self.hub._base_url.clone() + "v1/users";
61141        if self._scopes.is_empty() {
61142            self._scopes
61143                .insert(Scope::DisplayVideoUserManagement.as_ref().to_string());
61144        }
61145
61146        let url = params.parse_with_url(&url);
61147
61148        let mut json_mime_type = mime::APPLICATION_JSON;
61149        let mut request_value_reader = {
61150            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
61151            common::remove_json_null_values(&mut value);
61152            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
61153            serde_json::to_writer(&mut dst, &value).unwrap();
61154            dst
61155        };
61156        let request_size = request_value_reader
61157            .seek(std::io::SeekFrom::End(0))
61158            .unwrap();
61159        request_value_reader
61160            .seek(std::io::SeekFrom::Start(0))
61161            .unwrap();
61162
61163        loop {
61164            let token = match self
61165                .hub
61166                .auth
61167                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
61168                .await
61169            {
61170                Ok(token) => token,
61171                Err(e) => match dlg.token(e) {
61172                    Ok(token) => token,
61173                    Err(e) => {
61174                        dlg.finished(false);
61175                        return Err(common::Error::MissingToken(e));
61176                    }
61177                },
61178            };
61179            request_value_reader
61180                .seek(std::io::SeekFrom::Start(0))
61181                .unwrap();
61182            let mut req_result = {
61183                let client = &self.hub.client;
61184                dlg.pre_request();
61185                let mut req_builder = hyper::Request::builder()
61186                    .method(hyper::Method::POST)
61187                    .uri(url.as_str())
61188                    .header(USER_AGENT, self.hub._user_agent.clone());
61189
61190                if let Some(token) = token.as_ref() {
61191                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
61192                }
61193
61194                let request = req_builder
61195                    .header(CONTENT_TYPE, json_mime_type.to_string())
61196                    .header(CONTENT_LENGTH, request_size as u64)
61197                    .body(common::to_body(
61198                        request_value_reader.get_ref().clone().into(),
61199                    ));
61200
61201                client.request(request.unwrap()).await
61202            };
61203
61204            match req_result {
61205                Err(err) => {
61206                    if let common::Retry::After(d) = dlg.http_error(&err) {
61207                        sleep(d).await;
61208                        continue;
61209                    }
61210                    dlg.finished(false);
61211                    return Err(common::Error::HttpError(err));
61212                }
61213                Ok(res) => {
61214                    let (mut parts, body) = res.into_parts();
61215                    let mut body = common::Body::new(body);
61216                    if !parts.status.is_success() {
61217                        let bytes = common::to_bytes(body).await.unwrap_or_default();
61218                        let error = serde_json::from_str(&common::to_string(&bytes));
61219                        let response = common::to_response(parts, bytes.into());
61220
61221                        if let common::Retry::After(d) =
61222                            dlg.http_failure(&response, error.as_ref().ok())
61223                        {
61224                            sleep(d).await;
61225                            continue;
61226                        }
61227
61228                        dlg.finished(false);
61229
61230                        return Err(match error {
61231                            Ok(value) => common::Error::BadRequest(value),
61232                            _ => common::Error::Failure(response),
61233                        });
61234                    }
61235                    let response = {
61236                        let bytes = common::to_bytes(body).await.unwrap_or_default();
61237                        let encoded = common::to_string(&bytes);
61238                        match serde_json::from_str(&encoded) {
61239                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
61240                            Err(error) => {
61241                                dlg.response_json_decode_error(&encoded, &error);
61242                                return Err(common::Error::JsonDecodeError(
61243                                    encoded.to_string(),
61244                                    error,
61245                                ));
61246                            }
61247                        }
61248                    };
61249
61250                    dlg.finished(true);
61251                    return Ok(response);
61252                }
61253            }
61254        }
61255    }
61256
61257    ///
61258    /// Sets the *request* property to the given value.
61259    ///
61260    /// Even though the property as already been set when instantiating this call,
61261    /// we provide this method for API completeness.
61262    pub fn request(mut self, new_value: User) -> UserCreateCall<'a, C> {
61263        self._request = new_value;
61264        self
61265    }
61266    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
61267    /// while executing the actual API request.
61268    ///
61269    /// ````text
61270    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
61271    /// ````
61272    ///
61273    /// Sets the *delegate* property to the given value.
61274    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserCreateCall<'a, C> {
61275        self._delegate = Some(new_value);
61276        self
61277    }
61278
61279    /// Set any additional parameter of the query string used in the request.
61280    /// It should be used to set parameters which are not yet available through their own
61281    /// setters.
61282    ///
61283    /// Please note that this method must not be used to set any of the known parameters
61284    /// which have their own setter method. If done anyway, the request will fail.
61285    ///
61286    /// # Additional Parameters
61287    ///
61288    /// * *$.xgafv* (query-string) - V1 error format.
61289    /// * *access_token* (query-string) - OAuth access token.
61290    /// * *alt* (query-string) - Data format for response.
61291    /// * *callback* (query-string) - JSONP
61292    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
61293    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
61294    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
61295    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
61296    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
61297    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
61298    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
61299    pub fn param<T>(mut self, name: T, value: T) -> UserCreateCall<'a, C>
61300    where
61301        T: AsRef<str>,
61302    {
61303        self._additional_params
61304            .insert(name.as_ref().to_string(), value.as_ref().to_string());
61305        self
61306    }
61307
61308    /// Identifies the authorization scope for the method you are building.
61309    ///
61310    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
61311    /// [`Scope::DisplayVideoUserManagement`].
61312    ///
61313    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
61314    /// tokens for more than one scope.
61315    ///
61316    /// Usually there is more than one suitable scope to authorize an operation, some of which may
61317    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
61318    /// sufficient, a read-write scope will do as well.
61319    pub fn add_scope<St>(mut self, scope: St) -> UserCreateCall<'a, C>
61320    where
61321        St: AsRef<str>,
61322    {
61323        self._scopes.insert(String::from(scope.as_ref()));
61324        self
61325    }
61326    /// Identifies the authorization scope(s) for the method you are building.
61327    ///
61328    /// See [`Self::add_scope()`] for details.
61329    pub fn add_scopes<I, St>(mut self, scopes: I) -> UserCreateCall<'a, C>
61330    where
61331        I: IntoIterator<Item = St>,
61332        St: AsRef<str>,
61333    {
61334        self._scopes
61335            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
61336        self
61337    }
61338
61339    /// Removes all scopes, and no default scope will be used either.
61340    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
61341    /// for details).
61342    pub fn clear_scopes(mut self) -> UserCreateCall<'a, C> {
61343        self._scopes.clear();
61344        self
61345    }
61346}
61347
61348/// Deletes a user. This method has unique authentication requirements. Read the prerequisites in our [Managing Users guide](https://developers.google.com/display-video/api/guides/users/overview#prerequisites) before using this method. The “Try this method” feature does not work for this method.
61349///
61350/// A builder for the *delete* method supported by a *user* resource.
61351/// It is not used directly, but through a [`UserMethods`] instance.
61352///
61353/// # Example
61354///
61355/// Instantiate a resource method builder
61356///
61357/// ```test_harness,no_run
61358/// # extern crate hyper;
61359/// # extern crate hyper_rustls;
61360/// # extern crate google_displayvideo1 as displayvideo1;
61361/// # async fn dox() {
61362/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
61363///
61364/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
61365/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
61366/// #     secret,
61367/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
61368/// # ).build().await.unwrap();
61369///
61370/// # let client = hyper_util::client::legacy::Client::builder(
61371/// #     hyper_util::rt::TokioExecutor::new()
61372/// # )
61373/// # .build(
61374/// #     hyper_rustls::HttpsConnectorBuilder::new()
61375/// #         .with_native_roots()
61376/// #         .unwrap()
61377/// #         .https_or_http()
61378/// #         .enable_http1()
61379/// #         .build()
61380/// # );
61381/// # let mut hub = DisplayVideo::new(client, auth);
61382/// // You can configure optional parameters by calling the respective setters at will, and
61383/// // execute the final call using `doit()`.
61384/// // Values shown here are possibly random and not representative !
61385/// let result = hub.users().delete(-54)
61386///              .doit().await;
61387/// # }
61388/// ```
61389pub struct UserDeleteCall<'a, C>
61390where
61391    C: 'a,
61392{
61393    hub: &'a DisplayVideo<C>,
61394    _user_id: i64,
61395    _delegate: Option<&'a mut dyn common::Delegate>,
61396    _additional_params: HashMap<String, String>,
61397    _scopes: BTreeSet<String>,
61398}
61399
61400impl<'a, C> common::CallBuilder for UserDeleteCall<'a, C> {}
61401
61402impl<'a, C> UserDeleteCall<'a, C>
61403where
61404    C: common::Connector,
61405{
61406    /// Perform the operation you have build so far.
61407    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
61408        use std::borrow::Cow;
61409        use std::io::{Read, Seek};
61410
61411        use common::{url::Params, ToParts};
61412        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
61413
61414        let mut dd = common::DefaultDelegate;
61415        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
61416        dlg.begin(common::MethodInfo {
61417            id: "displayvideo.users.delete",
61418            http_method: hyper::Method::DELETE,
61419        });
61420
61421        for &field in ["alt", "userId"].iter() {
61422            if self._additional_params.contains_key(field) {
61423                dlg.finished(false);
61424                return Err(common::Error::FieldClash(field));
61425            }
61426        }
61427
61428        let mut params = Params::with_capacity(3 + self._additional_params.len());
61429        params.push("userId", self._user_id.to_string());
61430
61431        params.extend(self._additional_params.iter());
61432
61433        params.push("alt", "json");
61434        let mut url = self.hub._base_url.clone() + "v1/users/{+userId}";
61435        if self._scopes.is_empty() {
61436            self._scopes
61437                .insert(Scope::DisplayVideoUserManagement.as_ref().to_string());
61438        }
61439
61440        #[allow(clippy::single_element_loop)]
61441        for &(find_this, param_name) in [("{+userId}", "userId")].iter() {
61442            url = params.uri_replacement(url, param_name, find_this, true);
61443        }
61444        {
61445            let to_remove = ["userId"];
61446            params.remove_params(&to_remove);
61447        }
61448
61449        let url = params.parse_with_url(&url);
61450
61451        loop {
61452            let token = match self
61453                .hub
61454                .auth
61455                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
61456                .await
61457            {
61458                Ok(token) => token,
61459                Err(e) => match dlg.token(e) {
61460                    Ok(token) => token,
61461                    Err(e) => {
61462                        dlg.finished(false);
61463                        return Err(common::Error::MissingToken(e));
61464                    }
61465                },
61466            };
61467            let mut req_result = {
61468                let client = &self.hub.client;
61469                dlg.pre_request();
61470                let mut req_builder = hyper::Request::builder()
61471                    .method(hyper::Method::DELETE)
61472                    .uri(url.as_str())
61473                    .header(USER_AGENT, self.hub._user_agent.clone());
61474
61475                if let Some(token) = token.as_ref() {
61476                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
61477                }
61478
61479                let request = req_builder
61480                    .header(CONTENT_LENGTH, 0_u64)
61481                    .body(common::to_body::<String>(None));
61482
61483                client.request(request.unwrap()).await
61484            };
61485
61486            match req_result {
61487                Err(err) => {
61488                    if let common::Retry::After(d) = dlg.http_error(&err) {
61489                        sleep(d).await;
61490                        continue;
61491                    }
61492                    dlg.finished(false);
61493                    return Err(common::Error::HttpError(err));
61494                }
61495                Ok(res) => {
61496                    let (mut parts, body) = res.into_parts();
61497                    let mut body = common::Body::new(body);
61498                    if !parts.status.is_success() {
61499                        let bytes = common::to_bytes(body).await.unwrap_or_default();
61500                        let error = serde_json::from_str(&common::to_string(&bytes));
61501                        let response = common::to_response(parts, bytes.into());
61502
61503                        if let common::Retry::After(d) =
61504                            dlg.http_failure(&response, error.as_ref().ok())
61505                        {
61506                            sleep(d).await;
61507                            continue;
61508                        }
61509
61510                        dlg.finished(false);
61511
61512                        return Err(match error {
61513                            Ok(value) => common::Error::BadRequest(value),
61514                            _ => common::Error::Failure(response),
61515                        });
61516                    }
61517                    let response = {
61518                        let bytes = common::to_bytes(body).await.unwrap_or_default();
61519                        let encoded = common::to_string(&bytes);
61520                        match serde_json::from_str(&encoded) {
61521                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
61522                            Err(error) => {
61523                                dlg.response_json_decode_error(&encoded, &error);
61524                                return Err(common::Error::JsonDecodeError(
61525                                    encoded.to_string(),
61526                                    error,
61527                                ));
61528                            }
61529                        }
61530                    };
61531
61532                    dlg.finished(true);
61533                    return Ok(response);
61534                }
61535            }
61536        }
61537    }
61538
61539    /// Required. The ID of the user to delete.
61540    ///
61541    /// Sets the *user id* path property to the given value.
61542    ///
61543    /// Even though the property as already been set when instantiating this call,
61544    /// we provide this method for API completeness.
61545    pub fn user_id(mut self, new_value: i64) -> UserDeleteCall<'a, C> {
61546        self._user_id = new_value;
61547        self
61548    }
61549    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
61550    /// while executing the actual API request.
61551    ///
61552    /// ````text
61553    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
61554    /// ````
61555    ///
61556    /// Sets the *delegate* property to the given value.
61557    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserDeleteCall<'a, C> {
61558        self._delegate = Some(new_value);
61559        self
61560    }
61561
61562    /// Set any additional parameter of the query string used in the request.
61563    /// It should be used to set parameters which are not yet available through their own
61564    /// setters.
61565    ///
61566    /// Please note that this method must not be used to set any of the known parameters
61567    /// which have their own setter method. If done anyway, the request will fail.
61568    ///
61569    /// # Additional Parameters
61570    ///
61571    /// * *$.xgafv* (query-string) - V1 error format.
61572    /// * *access_token* (query-string) - OAuth access token.
61573    /// * *alt* (query-string) - Data format for response.
61574    /// * *callback* (query-string) - JSONP
61575    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
61576    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
61577    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
61578    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
61579    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
61580    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
61581    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
61582    pub fn param<T>(mut self, name: T, value: T) -> UserDeleteCall<'a, C>
61583    where
61584        T: AsRef<str>,
61585    {
61586        self._additional_params
61587            .insert(name.as_ref().to_string(), value.as_ref().to_string());
61588        self
61589    }
61590
61591    /// Identifies the authorization scope for the method you are building.
61592    ///
61593    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
61594    /// [`Scope::DisplayVideoUserManagement`].
61595    ///
61596    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
61597    /// tokens for more than one scope.
61598    ///
61599    /// Usually there is more than one suitable scope to authorize an operation, some of which may
61600    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
61601    /// sufficient, a read-write scope will do as well.
61602    pub fn add_scope<St>(mut self, scope: St) -> UserDeleteCall<'a, C>
61603    where
61604        St: AsRef<str>,
61605    {
61606        self._scopes.insert(String::from(scope.as_ref()));
61607        self
61608    }
61609    /// Identifies the authorization scope(s) for the method you are building.
61610    ///
61611    /// See [`Self::add_scope()`] for details.
61612    pub fn add_scopes<I, St>(mut self, scopes: I) -> UserDeleteCall<'a, C>
61613    where
61614        I: IntoIterator<Item = St>,
61615        St: AsRef<str>,
61616    {
61617        self._scopes
61618            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
61619        self
61620    }
61621
61622    /// Removes all scopes, and no default scope will be used either.
61623    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
61624    /// for details).
61625    pub fn clear_scopes(mut self) -> UserDeleteCall<'a, C> {
61626        self._scopes.clear();
61627        self
61628    }
61629}
61630
61631/// Gets a user. This method has unique authentication requirements. Read the prerequisites in our [Managing Users guide](https://developers.google.com/display-video/api/guides/users/overview#prerequisites) before using this method. The “Try this method” feature does not work for this method.
61632///
61633/// A builder for the *get* method supported by a *user* resource.
61634/// It is not used directly, but through a [`UserMethods`] instance.
61635///
61636/// # Example
61637///
61638/// Instantiate a resource method builder
61639///
61640/// ```test_harness,no_run
61641/// # extern crate hyper;
61642/// # extern crate hyper_rustls;
61643/// # extern crate google_displayvideo1 as displayvideo1;
61644/// # async fn dox() {
61645/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
61646///
61647/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
61648/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
61649/// #     secret,
61650/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
61651/// # ).build().await.unwrap();
61652///
61653/// # let client = hyper_util::client::legacy::Client::builder(
61654/// #     hyper_util::rt::TokioExecutor::new()
61655/// # )
61656/// # .build(
61657/// #     hyper_rustls::HttpsConnectorBuilder::new()
61658/// #         .with_native_roots()
61659/// #         .unwrap()
61660/// #         .https_or_http()
61661/// #         .enable_http1()
61662/// #         .build()
61663/// # );
61664/// # let mut hub = DisplayVideo::new(client, auth);
61665/// // You can configure optional parameters by calling the respective setters at will, and
61666/// // execute the final call using `doit()`.
61667/// // Values shown here are possibly random and not representative !
61668/// let result = hub.users().get(-97)
61669///              .doit().await;
61670/// # }
61671/// ```
61672pub struct UserGetCall<'a, C>
61673where
61674    C: 'a,
61675{
61676    hub: &'a DisplayVideo<C>,
61677    _user_id: i64,
61678    _delegate: Option<&'a mut dyn common::Delegate>,
61679    _additional_params: HashMap<String, String>,
61680    _scopes: BTreeSet<String>,
61681}
61682
61683impl<'a, C> common::CallBuilder for UserGetCall<'a, C> {}
61684
61685impl<'a, C> UserGetCall<'a, C>
61686where
61687    C: common::Connector,
61688{
61689    /// Perform the operation you have build so far.
61690    pub async fn doit(mut self) -> common::Result<(common::Response, User)> {
61691        use std::borrow::Cow;
61692        use std::io::{Read, Seek};
61693
61694        use common::{url::Params, ToParts};
61695        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
61696
61697        let mut dd = common::DefaultDelegate;
61698        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
61699        dlg.begin(common::MethodInfo {
61700            id: "displayvideo.users.get",
61701            http_method: hyper::Method::GET,
61702        });
61703
61704        for &field in ["alt", "userId"].iter() {
61705            if self._additional_params.contains_key(field) {
61706                dlg.finished(false);
61707                return Err(common::Error::FieldClash(field));
61708            }
61709        }
61710
61711        let mut params = Params::with_capacity(3 + self._additional_params.len());
61712        params.push("userId", self._user_id.to_string());
61713
61714        params.extend(self._additional_params.iter());
61715
61716        params.push("alt", "json");
61717        let mut url = self.hub._base_url.clone() + "v1/users/{+userId}";
61718        if self._scopes.is_empty() {
61719            self._scopes
61720                .insert(Scope::DisplayVideoUserManagement.as_ref().to_string());
61721        }
61722
61723        #[allow(clippy::single_element_loop)]
61724        for &(find_this, param_name) in [("{+userId}", "userId")].iter() {
61725            url = params.uri_replacement(url, param_name, find_this, true);
61726        }
61727        {
61728            let to_remove = ["userId"];
61729            params.remove_params(&to_remove);
61730        }
61731
61732        let url = params.parse_with_url(&url);
61733
61734        loop {
61735            let token = match self
61736                .hub
61737                .auth
61738                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
61739                .await
61740            {
61741                Ok(token) => token,
61742                Err(e) => match dlg.token(e) {
61743                    Ok(token) => token,
61744                    Err(e) => {
61745                        dlg.finished(false);
61746                        return Err(common::Error::MissingToken(e));
61747                    }
61748                },
61749            };
61750            let mut req_result = {
61751                let client = &self.hub.client;
61752                dlg.pre_request();
61753                let mut req_builder = hyper::Request::builder()
61754                    .method(hyper::Method::GET)
61755                    .uri(url.as_str())
61756                    .header(USER_AGENT, self.hub._user_agent.clone());
61757
61758                if let Some(token) = token.as_ref() {
61759                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
61760                }
61761
61762                let request = req_builder
61763                    .header(CONTENT_LENGTH, 0_u64)
61764                    .body(common::to_body::<String>(None));
61765
61766                client.request(request.unwrap()).await
61767            };
61768
61769            match req_result {
61770                Err(err) => {
61771                    if let common::Retry::After(d) = dlg.http_error(&err) {
61772                        sleep(d).await;
61773                        continue;
61774                    }
61775                    dlg.finished(false);
61776                    return Err(common::Error::HttpError(err));
61777                }
61778                Ok(res) => {
61779                    let (mut parts, body) = res.into_parts();
61780                    let mut body = common::Body::new(body);
61781                    if !parts.status.is_success() {
61782                        let bytes = common::to_bytes(body).await.unwrap_or_default();
61783                        let error = serde_json::from_str(&common::to_string(&bytes));
61784                        let response = common::to_response(parts, bytes.into());
61785
61786                        if let common::Retry::After(d) =
61787                            dlg.http_failure(&response, error.as_ref().ok())
61788                        {
61789                            sleep(d).await;
61790                            continue;
61791                        }
61792
61793                        dlg.finished(false);
61794
61795                        return Err(match error {
61796                            Ok(value) => common::Error::BadRequest(value),
61797                            _ => common::Error::Failure(response),
61798                        });
61799                    }
61800                    let response = {
61801                        let bytes = common::to_bytes(body).await.unwrap_or_default();
61802                        let encoded = common::to_string(&bytes);
61803                        match serde_json::from_str(&encoded) {
61804                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
61805                            Err(error) => {
61806                                dlg.response_json_decode_error(&encoded, &error);
61807                                return Err(common::Error::JsonDecodeError(
61808                                    encoded.to_string(),
61809                                    error,
61810                                ));
61811                            }
61812                        }
61813                    };
61814
61815                    dlg.finished(true);
61816                    return Ok(response);
61817                }
61818            }
61819        }
61820    }
61821
61822    /// Required. The ID of the user to fetch.
61823    ///
61824    /// Sets the *user id* path property to the given value.
61825    ///
61826    /// Even though the property as already been set when instantiating this call,
61827    /// we provide this method for API completeness.
61828    pub fn user_id(mut self, new_value: i64) -> UserGetCall<'a, C> {
61829        self._user_id = new_value;
61830        self
61831    }
61832    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
61833    /// while executing the actual API request.
61834    ///
61835    /// ````text
61836    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
61837    /// ````
61838    ///
61839    /// Sets the *delegate* property to the given value.
61840    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserGetCall<'a, C> {
61841        self._delegate = Some(new_value);
61842        self
61843    }
61844
61845    /// Set any additional parameter of the query string used in the request.
61846    /// It should be used to set parameters which are not yet available through their own
61847    /// setters.
61848    ///
61849    /// Please note that this method must not be used to set any of the known parameters
61850    /// which have their own setter method. If done anyway, the request will fail.
61851    ///
61852    /// # Additional Parameters
61853    ///
61854    /// * *$.xgafv* (query-string) - V1 error format.
61855    /// * *access_token* (query-string) - OAuth access token.
61856    /// * *alt* (query-string) - Data format for response.
61857    /// * *callback* (query-string) - JSONP
61858    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
61859    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
61860    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
61861    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
61862    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
61863    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
61864    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
61865    pub fn param<T>(mut self, name: T, value: T) -> UserGetCall<'a, C>
61866    where
61867        T: AsRef<str>,
61868    {
61869        self._additional_params
61870            .insert(name.as_ref().to_string(), value.as_ref().to_string());
61871        self
61872    }
61873
61874    /// Identifies the authorization scope for the method you are building.
61875    ///
61876    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
61877    /// [`Scope::DisplayVideoUserManagement`].
61878    ///
61879    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
61880    /// tokens for more than one scope.
61881    ///
61882    /// Usually there is more than one suitable scope to authorize an operation, some of which may
61883    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
61884    /// sufficient, a read-write scope will do as well.
61885    pub fn add_scope<St>(mut self, scope: St) -> UserGetCall<'a, C>
61886    where
61887        St: AsRef<str>,
61888    {
61889        self._scopes.insert(String::from(scope.as_ref()));
61890        self
61891    }
61892    /// Identifies the authorization scope(s) for the method you are building.
61893    ///
61894    /// See [`Self::add_scope()`] for details.
61895    pub fn add_scopes<I, St>(mut self, scopes: I) -> UserGetCall<'a, C>
61896    where
61897        I: IntoIterator<Item = St>,
61898        St: AsRef<str>,
61899    {
61900        self._scopes
61901            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
61902        self
61903    }
61904
61905    /// Removes all scopes, and no default scope will be used either.
61906    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
61907    /// for details).
61908    pub fn clear_scopes(mut self) -> UserGetCall<'a, C> {
61909        self._scopes.clear();
61910        self
61911    }
61912}
61913
61914/// Lists users that are accessible to the current user. If two users have user roles on the same partner or advertiser, they can access each other. This method has unique authentication requirements. Read the prerequisites in our [Managing Users guide](https://developers.google.com/display-video/api/guides/users/overview#prerequisites) before using this method. The “Try this method” feature does not work for this method.
61915///
61916/// A builder for the *list* method supported by a *user* resource.
61917/// It is not used directly, but through a [`UserMethods`] instance.
61918///
61919/// # Example
61920///
61921/// Instantiate a resource method builder
61922///
61923/// ```test_harness,no_run
61924/// # extern crate hyper;
61925/// # extern crate hyper_rustls;
61926/// # extern crate google_displayvideo1 as displayvideo1;
61927/// # async fn dox() {
61928/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
61929///
61930/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
61931/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
61932/// #     secret,
61933/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
61934/// # ).build().await.unwrap();
61935///
61936/// # let client = hyper_util::client::legacy::Client::builder(
61937/// #     hyper_util::rt::TokioExecutor::new()
61938/// # )
61939/// # .build(
61940/// #     hyper_rustls::HttpsConnectorBuilder::new()
61941/// #         .with_native_roots()
61942/// #         .unwrap()
61943/// #         .https_or_http()
61944/// #         .enable_http1()
61945/// #         .build()
61946/// # );
61947/// # let mut hub = DisplayVideo::new(client, auth);
61948/// // You can configure optional parameters by calling the respective setters at will, and
61949/// // execute the final call using `doit()`.
61950/// // Values shown here are possibly random and not representative !
61951/// let result = hub.users().list()
61952///              .page_token("magna")
61953///              .page_size(-83)
61954///              .order_by("invidunt")
61955///              .filter("et")
61956///              .doit().await;
61957/// # }
61958/// ```
61959pub struct UserListCall<'a, C>
61960where
61961    C: 'a,
61962{
61963    hub: &'a DisplayVideo<C>,
61964    _page_token: Option<String>,
61965    _page_size: Option<i32>,
61966    _order_by: Option<String>,
61967    _filter: Option<String>,
61968    _delegate: Option<&'a mut dyn common::Delegate>,
61969    _additional_params: HashMap<String, String>,
61970    _scopes: BTreeSet<String>,
61971}
61972
61973impl<'a, C> common::CallBuilder for UserListCall<'a, C> {}
61974
61975impl<'a, C> UserListCall<'a, C>
61976where
61977    C: common::Connector,
61978{
61979    /// Perform the operation you have build so far.
61980    pub async fn doit(mut self) -> common::Result<(common::Response, ListUsersResponse)> {
61981        use std::borrow::Cow;
61982        use std::io::{Read, Seek};
61983
61984        use common::{url::Params, ToParts};
61985        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
61986
61987        let mut dd = common::DefaultDelegate;
61988        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
61989        dlg.begin(common::MethodInfo {
61990            id: "displayvideo.users.list",
61991            http_method: hyper::Method::GET,
61992        });
61993
61994        for &field in ["alt", "pageToken", "pageSize", "orderBy", "filter"].iter() {
61995            if self._additional_params.contains_key(field) {
61996                dlg.finished(false);
61997                return Err(common::Error::FieldClash(field));
61998            }
61999        }
62000
62001        let mut params = Params::with_capacity(6 + self._additional_params.len());
62002        if let Some(value) = self._page_token.as_ref() {
62003            params.push("pageToken", value);
62004        }
62005        if let Some(value) = self._page_size.as_ref() {
62006            params.push("pageSize", value.to_string());
62007        }
62008        if let Some(value) = self._order_by.as_ref() {
62009            params.push("orderBy", value);
62010        }
62011        if let Some(value) = self._filter.as_ref() {
62012            params.push("filter", value);
62013        }
62014
62015        params.extend(self._additional_params.iter());
62016
62017        params.push("alt", "json");
62018        let mut url = self.hub._base_url.clone() + "v1/users";
62019        if self._scopes.is_empty() {
62020            self._scopes
62021                .insert(Scope::DisplayVideoUserManagement.as_ref().to_string());
62022        }
62023
62024        let url = params.parse_with_url(&url);
62025
62026        loop {
62027            let token = match self
62028                .hub
62029                .auth
62030                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
62031                .await
62032            {
62033                Ok(token) => token,
62034                Err(e) => match dlg.token(e) {
62035                    Ok(token) => token,
62036                    Err(e) => {
62037                        dlg.finished(false);
62038                        return Err(common::Error::MissingToken(e));
62039                    }
62040                },
62041            };
62042            let mut req_result = {
62043                let client = &self.hub.client;
62044                dlg.pre_request();
62045                let mut req_builder = hyper::Request::builder()
62046                    .method(hyper::Method::GET)
62047                    .uri(url.as_str())
62048                    .header(USER_AGENT, self.hub._user_agent.clone());
62049
62050                if let Some(token) = token.as_ref() {
62051                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
62052                }
62053
62054                let request = req_builder
62055                    .header(CONTENT_LENGTH, 0_u64)
62056                    .body(common::to_body::<String>(None));
62057
62058                client.request(request.unwrap()).await
62059            };
62060
62061            match req_result {
62062                Err(err) => {
62063                    if let common::Retry::After(d) = dlg.http_error(&err) {
62064                        sleep(d).await;
62065                        continue;
62066                    }
62067                    dlg.finished(false);
62068                    return Err(common::Error::HttpError(err));
62069                }
62070                Ok(res) => {
62071                    let (mut parts, body) = res.into_parts();
62072                    let mut body = common::Body::new(body);
62073                    if !parts.status.is_success() {
62074                        let bytes = common::to_bytes(body).await.unwrap_or_default();
62075                        let error = serde_json::from_str(&common::to_string(&bytes));
62076                        let response = common::to_response(parts, bytes.into());
62077
62078                        if let common::Retry::After(d) =
62079                            dlg.http_failure(&response, error.as_ref().ok())
62080                        {
62081                            sleep(d).await;
62082                            continue;
62083                        }
62084
62085                        dlg.finished(false);
62086
62087                        return Err(match error {
62088                            Ok(value) => common::Error::BadRequest(value),
62089                            _ => common::Error::Failure(response),
62090                        });
62091                    }
62092                    let response = {
62093                        let bytes = common::to_bytes(body).await.unwrap_or_default();
62094                        let encoded = common::to_string(&bytes);
62095                        match serde_json::from_str(&encoded) {
62096                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
62097                            Err(error) => {
62098                                dlg.response_json_decode_error(&encoded, &error);
62099                                return Err(common::Error::JsonDecodeError(
62100                                    encoded.to_string(),
62101                                    error,
62102                                ));
62103                            }
62104                        }
62105                    };
62106
62107                    dlg.finished(true);
62108                    return Ok(response);
62109                }
62110            }
62111        }
62112    }
62113
62114    /// A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to `ListUsers` method. If not specified, the first page of results will be returned.
62115    ///
62116    /// Sets the *page token* query property to the given value.
62117    pub fn page_token(mut self, new_value: &str) -> UserListCall<'a, C> {
62118        self._page_token = Some(new_value.to_string());
62119        self
62120    }
62121    /// Requested page size. Must be between `1` and `200`. If unspecified will default to `100`.
62122    ///
62123    /// Sets the *page size* query property to the given value.
62124    pub fn page_size(mut self, new_value: i32) -> UserListCall<'a, C> {
62125        self._page_size = Some(new_value);
62126        self
62127    }
62128    /// Field by which to sort the list. Acceptable values are: * `displayName` (default) The default sorting order is ascending. To specify descending order for a field, a suffix "desc" should be added to the field name. For example, `displayName desc`.
62129    ///
62130    /// Sets the *order by* query property to the given value.
62131    pub fn order_by(mut self, new_value: &str) -> UserListCall<'a, C> {
62132        self._order_by = Some(new_value.to_string());
62133        self
62134    }
62135    /// Allows filtering by user fields. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by the logical operator `AND`. * A restriction has the form of `{field} {operator} {value}`. * The `displayName` and `email` fields must use the `HAS (:)` operator. * The `lastLoginTime` field must use either the `LESS THAN OR EQUAL TO (<=)` or `GREATER THAN OR EQUAL TO (>=)` operator. * All other fields must use the `EQUALS (=)` operator. Supported fields: * `assignedUserRole.advertiserId` * `assignedUserRole.entityType`: This is synthetic field of `AssignedUserRole` used for filtering. Identifies the type of entity to which the user role is assigned. Valid values are `Partner` and `Advertiser`. * `assignedUserRole.parentPartnerId`: This is a synthetic field of `AssignedUserRole` used for filtering. Identifies the parent partner of the entity to which the user role is assigned. * `assignedUserRole.partnerId` * `assignedUserRole.userRole` * `displayName` * `email` * `lastLoginTime` (input in ISO 8601 format, or `YYYY-MM-DDTHH:MM:SSZ`) Examples: * The user with `displayName` containing “foo”: `displayName:"foo"` * The user with `email` containing “bar”: `email:"bar"` * All users with standard user roles: `assignedUserRole.userRole="STANDARD"` * All users with user roles for partner 123: `assignedUserRole.partnerId="123"` * All users with user roles for advertiser 123: `assignedUserRole.advertiserId="123"` * All users with partner level user roles: `entityType="PARTNER"` * All users with user roles for partner 123 and advertisers under partner 123: `parentPartnerId="123"` * All users that last logged in on or after 2023-01-01T00:00:00Z (format of ISO 8601): `lastLoginTime>="2023-01-01T00:00:00Z"` The length of this field should be no more than 500 characters. Reference our [filter `LIST` requests](https://developers.google.com/display-video/api/guides/how-tos/filters) guide for more information.
62136    ///
62137    /// Sets the *filter* query property to the given value.
62138    pub fn filter(mut self, new_value: &str) -> UserListCall<'a, C> {
62139        self._filter = Some(new_value.to_string());
62140        self
62141    }
62142    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
62143    /// while executing the actual API request.
62144    ///
62145    /// ````text
62146    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
62147    /// ````
62148    ///
62149    /// Sets the *delegate* property to the given value.
62150    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserListCall<'a, C> {
62151        self._delegate = Some(new_value);
62152        self
62153    }
62154
62155    /// Set any additional parameter of the query string used in the request.
62156    /// It should be used to set parameters which are not yet available through their own
62157    /// setters.
62158    ///
62159    /// Please note that this method must not be used to set any of the known parameters
62160    /// which have their own setter method. If done anyway, the request will fail.
62161    ///
62162    /// # Additional Parameters
62163    ///
62164    /// * *$.xgafv* (query-string) - V1 error format.
62165    /// * *access_token* (query-string) - OAuth access token.
62166    /// * *alt* (query-string) - Data format for response.
62167    /// * *callback* (query-string) - JSONP
62168    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
62169    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
62170    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
62171    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
62172    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
62173    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
62174    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
62175    pub fn param<T>(mut self, name: T, value: T) -> UserListCall<'a, C>
62176    where
62177        T: AsRef<str>,
62178    {
62179        self._additional_params
62180            .insert(name.as_ref().to_string(), value.as_ref().to_string());
62181        self
62182    }
62183
62184    /// Identifies the authorization scope for the method you are building.
62185    ///
62186    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
62187    /// [`Scope::DisplayVideoUserManagement`].
62188    ///
62189    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
62190    /// tokens for more than one scope.
62191    ///
62192    /// Usually there is more than one suitable scope to authorize an operation, some of which may
62193    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
62194    /// sufficient, a read-write scope will do as well.
62195    pub fn add_scope<St>(mut self, scope: St) -> UserListCall<'a, C>
62196    where
62197        St: AsRef<str>,
62198    {
62199        self._scopes.insert(String::from(scope.as_ref()));
62200        self
62201    }
62202    /// Identifies the authorization scope(s) for the method you are building.
62203    ///
62204    /// See [`Self::add_scope()`] for details.
62205    pub fn add_scopes<I, St>(mut self, scopes: I) -> UserListCall<'a, C>
62206    where
62207        I: IntoIterator<Item = St>,
62208        St: AsRef<str>,
62209    {
62210        self._scopes
62211            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
62212        self
62213    }
62214
62215    /// Removes all scopes, and no default scope will be used either.
62216    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
62217    /// for details).
62218    pub fn clear_scopes(mut self) -> UserListCall<'a, C> {
62219        self._scopes.clear();
62220        self
62221    }
62222}
62223
62224/// Updates an existing user. Returns the updated user if successful. This method has unique authentication requirements. Read the prerequisites in our [Managing Users guide](https://developers.google.com/display-video/api/guides/users/overview#prerequisites) before using this method. The “Try this method” feature does not work for this method.
62225///
62226/// A builder for the *patch* method supported by a *user* resource.
62227/// It is not used directly, but through a [`UserMethods`] instance.
62228///
62229/// # Example
62230///
62231/// Instantiate a resource method builder
62232///
62233/// ```test_harness,no_run
62234/// # extern crate hyper;
62235/// # extern crate hyper_rustls;
62236/// # extern crate google_displayvideo1 as displayvideo1;
62237/// use displayvideo1::api::User;
62238/// # async fn dox() {
62239/// # use displayvideo1::{DisplayVideo, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
62240///
62241/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
62242/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
62243/// #     secret,
62244/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
62245/// # ).build().await.unwrap();
62246///
62247/// # let client = hyper_util::client::legacy::Client::builder(
62248/// #     hyper_util::rt::TokioExecutor::new()
62249/// # )
62250/// # .build(
62251/// #     hyper_rustls::HttpsConnectorBuilder::new()
62252/// #         .with_native_roots()
62253/// #         .unwrap()
62254/// #         .https_or_http()
62255/// #         .enable_http1()
62256/// #         .build()
62257/// # );
62258/// # let mut hub = DisplayVideo::new(client, auth);
62259/// // As the method needs a request, you would usually fill it with the desired information
62260/// // into the respective structure. Some of the parts shown here might not be applicable !
62261/// // Values shown here are possibly random and not representative !
62262/// let mut req = User::default();
62263///
62264/// // You can configure optional parameters by calling the respective setters at will, and
62265/// // execute the final call using `doit()`.
62266/// // Values shown here are possibly random and not representative !
62267/// let result = hub.users().patch(req, -22)
62268///              .update_mask(FieldMask::new::<&str>(&[]))
62269///              .doit().await;
62270/// # }
62271/// ```
62272pub struct UserPatchCall<'a, C>
62273where
62274    C: 'a,
62275{
62276    hub: &'a DisplayVideo<C>,
62277    _request: User,
62278    _user_id: i64,
62279    _update_mask: Option<common::FieldMask>,
62280    _delegate: Option<&'a mut dyn common::Delegate>,
62281    _additional_params: HashMap<String, String>,
62282    _scopes: BTreeSet<String>,
62283}
62284
62285impl<'a, C> common::CallBuilder for UserPatchCall<'a, C> {}
62286
62287impl<'a, C> UserPatchCall<'a, C>
62288where
62289    C: common::Connector,
62290{
62291    /// Perform the operation you have build so far.
62292    pub async fn doit(mut self) -> common::Result<(common::Response, User)> {
62293        use std::borrow::Cow;
62294        use std::io::{Read, Seek};
62295
62296        use common::{url::Params, ToParts};
62297        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
62298
62299        let mut dd = common::DefaultDelegate;
62300        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
62301        dlg.begin(common::MethodInfo {
62302            id: "displayvideo.users.patch",
62303            http_method: hyper::Method::PATCH,
62304        });
62305
62306        for &field in ["alt", "userId", "updateMask"].iter() {
62307            if self._additional_params.contains_key(field) {
62308                dlg.finished(false);
62309                return Err(common::Error::FieldClash(field));
62310            }
62311        }
62312
62313        let mut params = Params::with_capacity(5 + self._additional_params.len());
62314        params.push("userId", self._user_id.to_string());
62315        if let Some(value) = self._update_mask.as_ref() {
62316            params.push("updateMask", value.to_string());
62317        }
62318
62319        params.extend(self._additional_params.iter());
62320
62321        params.push("alt", "json");
62322        let mut url = self.hub._base_url.clone() + "v1/users/{+userId}";
62323        if self._scopes.is_empty() {
62324            self._scopes
62325                .insert(Scope::DisplayVideoUserManagement.as_ref().to_string());
62326        }
62327
62328        #[allow(clippy::single_element_loop)]
62329        for &(find_this, param_name) in [("{+userId}", "userId")].iter() {
62330            url = params.uri_replacement(url, param_name, find_this, true);
62331        }
62332        {
62333            let to_remove = ["userId"];
62334            params.remove_params(&to_remove);
62335        }
62336
62337        let url = params.parse_with_url(&url);
62338
62339        let mut json_mime_type = mime::APPLICATION_JSON;
62340        let mut request_value_reader = {
62341            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
62342            common::remove_json_null_values(&mut value);
62343            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
62344            serde_json::to_writer(&mut dst, &value).unwrap();
62345            dst
62346        };
62347        let request_size = request_value_reader
62348            .seek(std::io::SeekFrom::End(0))
62349            .unwrap();
62350        request_value_reader
62351            .seek(std::io::SeekFrom::Start(0))
62352            .unwrap();
62353
62354        loop {
62355            let token = match self
62356                .hub
62357                .auth
62358                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
62359                .await
62360            {
62361                Ok(token) => token,
62362                Err(e) => match dlg.token(e) {
62363                    Ok(token) => token,
62364                    Err(e) => {
62365                        dlg.finished(false);
62366                        return Err(common::Error::MissingToken(e));
62367                    }
62368                },
62369            };
62370            request_value_reader
62371                .seek(std::io::SeekFrom::Start(0))
62372                .unwrap();
62373            let mut req_result = {
62374                let client = &self.hub.client;
62375                dlg.pre_request();
62376                let mut req_builder = hyper::Request::builder()
62377                    .method(hyper::Method::PATCH)
62378                    .uri(url.as_str())
62379                    .header(USER_AGENT, self.hub._user_agent.clone());
62380
62381                if let Some(token) = token.as_ref() {
62382                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
62383                }
62384
62385                let request = req_builder
62386                    .header(CONTENT_TYPE, json_mime_type.to_string())
62387                    .header(CONTENT_LENGTH, request_size as u64)
62388                    .body(common::to_body(
62389                        request_value_reader.get_ref().clone().into(),
62390                    ));
62391
62392                client.request(request.unwrap()).await
62393            };
62394
62395            match req_result {
62396                Err(err) => {
62397                    if let common::Retry::After(d) = dlg.http_error(&err) {
62398                        sleep(d).await;
62399                        continue;
62400                    }
62401                    dlg.finished(false);
62402                    return Err(common::Error::HttpError(err));
62403                }
62404                Ok(res) => {
62405                    let (mut parts, body) = res.into_parts();
62406                    let mut body = common::Body::new(body);
62407                    if !parts.status.is_success() {
62408                        let bytes = common::to_bytes(body).await.unwrap_or_default();
62409                        let error = serde_json::from_str(&common::to_string(&bytes));
62410                        let response = common::to_response(parts, bytes.into());
62411
62412                        if let common::Retry::After(d) =
62413                            dlg.http_failure(&response, error.as_ref().ok())
62414                        {
62415                            sleep(d).await;
62416                            continue;
62417                        }
62418
62419                        dlg.finished(false);
62420
62421                        return Err(match error {
62422                            Ok(value) => common::Error::BadRequest(value),
62423                            _ => common::Error::Failure(response),
62424                        });
62425                    }
62426                    let response = {
62427                        let bytes = common::to_bytes(body).await.unwrap_or_default();
62428                        let encoded = common::to_string(&bytes);
62429                        match serde_json::from_str(&encoded) {
62430                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
62431                            Err(error) => {
62432                                dlg.response_json_decode_error(&encoded, &error);
62433                                return Err(common::Error::JsonDecodeError(
62434                                    encoded.to_string(),
62435                                    error,
62436                                ));
62437                            }
62438                        }
62439                    };
62440
62441                    dlg.finished(true);
62442                    return Ok(response);
62443                }
62444            }
62445        }
62446    }
62447
62448    ///
62449    /// Sets the *request* property to the given value.
62450    ///
62451    /// Even though the property as already been set when instantiating this call,
62452    /// we provide this method for API completeness.
62453    pub fn request(mut self, new_value: User) -> UserPatchCall<'a, C> {
62454        self._request = new_value;
62455        self
62456    }
62457    /// Output only. The unique ID of the user. Assigned by the system.
62458    ///
62459    /// Sets the *user id* path property to the given value.
62460    ///
62461    /// Even though the property as already been set when instantiating this call,
62462    /// we provide this method for API completeness.
62463    pub fn user_id(mut self, new_value: i64) -> UserPatchCall<'a, C> {
62464        self._user_id = new_value;
62465        self
62466    }
62467    /// Required. The mask to control which fields to update.
62468    ///
62469    /// Sets the *update mask* query property to the given value.
62470    pub fn update_mask(mut self, new_value: common::FieldMask) -> UserPatchCall<'a, C> {
62471        self._update_mask = Some(new_value);
62472        self
62473    }
62474    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
62475    /// while executing the actual API request.
62476    ///
62477    /// ````text
62478    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
62479    /// ````
62480    ///
62481    /// Sets the *delegate* property to the given value.
62482    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserPatchCall<'a, C> {
62483        self._delegate = Some(new_value);
62484        self
62485    }
62486
62487    /// Set any additional parameter of the query string used in the request.
62488    /// It should be used to set parameters which are not yet available through their own
62489    /// setters.
62490    ///
62491    /// Please note that this method must not be used to set any of the known parameters
62492    /// which have their own setter method. If done anyway, the request will fail.
62493    ///
62494    /// # Additional Parameters
62495    ///
62496    /// * *$.xgafv* (query-string) - V1 error format.
62497    /// * *access_token* (query-string) - OAuth access token.
62498    /// * *alt* (query-string) - Data format for response.
62499    /// * *callback* (query-string) - JSONP
62500    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
62501    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
62502    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
62503    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
62504    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
62505    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
62506    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
62507    pub fn param<T>(mut self, name: T, value: T) -> UserPatchCall<'a, C>
62508    where
62509        T: AsRef<str>,
62510    {
62511        self._additional_params
62512            .insert(name.as_ref().to_string(), value.as_ref().to_string());
62513        self
62514    }
62515
62516    /// Identifies the authorization scope for the method you are building.
62517    ///
62518    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
62519    /// [`Scope::DisplayVideoUserManagement`].
62520    ///
62521    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
62522    /// tokens for more than one scope.
62523    ///
62524    /// Usually there is more than one suitable scope to authorize an operation, some of which may
62525    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
62526    /// sufficient, a read-write scope will do as well.
62527    pub fn add_scope<St>(mut self, scope: St) -> UserPatchCall<'a, C>
62528    where
62529        St: AsRef<str>,
62530    {
62531        self._scopes.insert(String::from(scope.as_ref()));
62532        self
62533    }
62534    /// Identifies the authorization scope(s) for the method you are building.
62535    ///
62536    /// See [`Self::add_scope()`] for details.
62537    pub fn add_scopes<I, St>(mut self, scopes: I) -> UserPatchCall<'a, C>
62538    where
62539        I: IntoIterator<Item = St>,
62540        St: AsRef<str>,
62541    {
62542        self._scopes
62543            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
62544        self
62545    }
62546
62547    /// Removes all scopes, and no default scope will be used either.
62548    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
62549    /// for details).
62550    pub fn clear_scopes(mut self) -> UserPatchCall<'a, C> {
62551        self._scopes.clear();
62552        self
62553    }
62554}