google_content2/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16    /// Manage your product listings and accounts for Google Shopping
17    Full,
18}
19
20impl AsRef<str> for Scope {
21    fn as_ref(&self) -> &str {
22        match *self {
23            Scope::Full => "https://www.googleapis.com/auth/content",
24        }
25    }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30    fn default() -> Scope {
31        Scope::Full
32    }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all ShoppingContent related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_content2 as content2;
49/// use content2::{Result, Error};
50/// # async fn dox() {
51/// use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
52///
53/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
54/// // `client_secret`, among other things.
55/// let secret: yup_oauth2::ApplicationSecret = Default::default();
56/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
57/// // unless you replace  `None` with the desired Flow.
58/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
59/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
60/// // retrieve them from storage.
61/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
62///     .with_native_roots()
63///     .unwrap()
64///     .https_only()
65///     .enable_http2()
66///     .build();
67///
68/// let executor = hyper_util::rt::TokioExecutor::new();
69/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
70///     secret,
71///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
72///     yup_oauth2::client::CustomHyperClientBuilder::from(
73///         hyper_util::client::legacy::Client::builder(executor).build(connector),
74///     ),
75/// ).build().await.unwrap();
76///
77/// let client = hyper_util::client::legacy::Client::builder(
78///     hyper_util::rt::TokioExecutor::new()
79/// )
80/// .build(
81///     hyper_rustls::HttpsConnectorBuilder::new()
82///         .with_native_roots()
83///         .unwrap()
84///         .https_or_http()
85///         .enable_http2()
86///         .build()
87/// );
88/// let mut hub = ShoppingContent::new(client, auth);
89/// // You can configure optional parameters by calling the respective setters at will, and
90/// // execute the final call using `doit()`.
91/// // Values shown here are possibly random and not representative !
92/// let result = hub.orders().list(97)
93///              .add_statuses("ea")
94///              .placed_date_start("ipsum")
95///              .placed_date_end("invidunt")
96///              .page_token("amet")
97///              .order_by("duo")
98///              .max_results(51)
99///              .acknowledged(false)
100///              .doit().await;
101///
102/// match result {
103///     Err(e) => match e {
104///         // The Error enum provides details about what exactly happened.
105///         // You can also just use its `Debug`, `Display` or `Error` traits
106///          Error::HttpError(_)
107///         |Error::Io(_)
108///         |Error::MissingAPIKey
109///         |Error::MissingToken(_)
110///         |Error::Cancelled
111///         |Error::UploadSizeLimitExceeded(_, _)
112///         |Error::Failure(_)
113///         |Error::BadRequest(_)
114///         |Error::FieldClash(_)
115///         |Error::JsonDecodeError(_, _) => println!("{}", e),
116///     },
117///     Ok(res) => println!("Success: {:?}", res),
118/// }
119/// # }
120/// ```
121#[derive(Clone)]
122pub struct ShoppingContent<C> {
123    pub client: common::Client<C>,
124    pub auth: Box<dyn common::GetToken>,
125    _user_agent: String,
126    _base_url: String,
127    _root_url: String,
128}
129
130impl<C> common::Hub for ShoppingContent<C> {}
131
132impl<'a, C> ShoppingContent<C> {
133    pub fn new<A: 'static + common::GetToken>(
134        client: common::Client<C>,
135        auth: A,
136    ) -> ShoppingContent<C> {
137        ShoppingContent {
138            client,
139            auth: Box::new(auth),
140            _user_agent: "google-api-rust-client/7.0.0".to_string(),
141            _base_url: "https://shoppingcontent.googleapis.com/content/v2/".to_string(),
142            _root_url: "https://shoppingcontent.googleapis.com/".to_string(),
143        }
144    }
145
146    pub fn accounts(&'a self) -> AccountMethods<'a, C> {
147        AccountMethods { hub: self }
148    }
149    pub fn accountstatuses(&'a self) -> AccountstatusMethods<'a, C> {
150        AccountstatusMethods { hub: self }
151    }
152    pub fn accounttax(&'a self) -> AccounttaxMethods<'a, C> {
153        AccounttaxMethods { hub: self }
154    }
155    pub fn datafeeds(&'a self) -> DatafeedMethods<'a, C> {
156        DatafeedMethods { hub: self }
157    }
158    pub fn datafeedstatuses(&'a self) -> DatafeedstatusMethods<'a, C> {
159        DatafeedstatusMethods { hub: self }
160    }
161    pub fn inventory(&'a self) -> InventoryMethods<'a, C> {
162        InventoryMethods { hub: self }
163    }
164    pub fn liasettings(&'a self) -> LiasettingMethods<'a, C> {
165        LiasettingMethods { hub: self }
166    }
167    pub fn orderinvoices(&'a self) -> OrderinvoiceMethods<'a, C> {
168        OrderinvoiceMethods { hub: self }
169    }
170    pub fn orderreports(&'a self) -> OrderreportMethods<'a, C> {
171        OrderreportMethods { hub: self }
172    }
173    pub fn orderreturns(&'a self) -> OrderreturnMethods<'a, C> {
174        OrderreturnMethods { hub: self }
175    }
176    pub fn orders(&'a self) -> OrderMethods<'a, C> {
177        OrderMethods { hub: self }
178    }
179    pub fn pos(&'a self) -> PoMethods<'a, C> {
180        PoMethods { hub: self }
181    }
182    pub fn products(&'a self) -> ProductMethods<'a, C> {
183        ProductMethods { hub: self }
184    }
185    pub fn productstatuses(&'a self) -> ProductstatusMethods<'a, C> {
186        ProductstatusMethods { hub: self }
187    }
188    pub fn shippingsettings(&'a self) -> ShippingsettingMethods<'a, C> {
189        ShippingsettingMethods { hub: self }
190    }
191
192    /// Set the user-agent header field to use in all requests to the server.
193    /// It defaults to `google-api-rust-client/7.0.0`.
194    ///
195    /// Returns the previously set user-agent.
196    pub fn user_agent(&mut self, agent_name: String) -> String {
197        std::mem::replace(&mut self._user_agent, agent_name)
198    }
199
200    /// Set the base url to use in all requests to the server.
201    /// It defaults to `https://shoppingcontent.googleapis.com/content/v2/`.
202    ///
203    /// Returns the previously set base url.
204    pub fn base_url(&mut self, new_base_url: String) -> String {
205        std::mem::replace(&mut self._base_url, new_base_url)
206    }
207
208    /// Set the root url to use in all requests to the server.
209    /// It defaults to `https://shoppingcontent.googleapis.com/`.
210    ///
211    /// Returns the previously set root url.
212    pub fn root_url(&mut self, new_root_url: String) -> String {
213        std::mem::replace(&mut self._root_url, new_root_url)
214    }
215}
216
217// ############
218// SCHEMAS ###
219// ##########
220/// Account data. After the creation of a new account it may take a few minutes before it is fully operational. The methods delete, insert, and update require the admin role.
221///
222/// # Activities
223///
224/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
225/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
226///
227/// * [authinfo accounts](AccountAuthinfoCall) (none)
228/// * [claimwebsite accounts](AccountClaimwebsiteCall) (none)
229/// * [custombatch accounts](AccountCustombatchCall) (none)
230/// * [delete accounts](AccountDeleteCall) (none)
231/// * [get accounts](AccountGetCall) (response)
232/// * [insert accounts](AccountInsertCall) (request|response)
233/// * [link accounts](AccountLinkCall) (none)
234/// * [list accounts](AccountListCall) (none)
235/// * [update accounts](AccountUpdateCall) (request|response)
236#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
237#[serde_with::serde_as]
238#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
239pub struct Account {
240    /// Indicates whether the merchant sells adult content.
241    #[serde(rename = "adultContent")]
242    pub adult_content: Option<bool>,
243    /// List of linked AdWords accounts that are active or pending approval. To create a new link request, add a new link with status `active` to the list. It will remain in a `pending` state until approved or rejected either in the AdWords interface or through the AdWords API. To delete an active link, or to cancel a link request, remove it from the list.
244    #[serde(rename = "adwordsLinks")]
245    pub adwords_links: Option<Vec<AccountAdwordsLink>>,
246    /// The business information of the account.
247    #[serde(rename = "businessInformation")]
248    pub business_information: Option<AccountBusinessInformation>,
249    /// The GMB account which is linked or in the process of being linked with the Merchant Center account.
250    #[serde(rename = "googleMyBusinessLink")]
251    pub google_my_business_link: Option<AccountGoogleMyBusinessLink>,
252    /// Required for update. Merchant Center account ID.
253    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
254    pub id: Option<u64>,
255    /// Identifies what kind of resource this is. Value: the fixed string "`content#account`"
256    pub kind: Option<String>,
257    /// Required. Display name for the account.
258    pub name: Option<String>,
259    /// [DEPRECATED] This field is never returned and will be ignored if provided.
260    #[serde(rename = "reviewsUrl")]
261    pub reviews_url: Option<String>,
262    /// Client-specific, locally-unique, internal ID for the child account.
263    #[serde(rename = "sellerId")]
264    pub seller_id: Option<String>,
265    /// Users with access to the account. Every account (except for subaccounts) must have at least one admin user.
266    pub users: Option<Vec<AccountUser>>,
267    /// The merchant's website.
268    #[serde(rename = "websiteUrl")]
269    pub website_url: Option<String>,
270    /// List of linked YouTube channels that are active or pending approval. To create a new link request, add a new link with status `active` to the list. It will remain in a `pending` state until approved or rejected in the YT Creator Studio interface. To delete an active link, or to cancel a link request, remove it from the list.
271    #[serde(rename = "youtubeChannelLinks")]
272    pub youtube_channel_links: Option<Vec<AccountYouTubeChannelLink>>,
273}
274
275impl common::RequestValue for Account {}
276impl common::Resource for Account {}
277impl common::ResponseResult for Account {}
278
279/// There is no detailed description.
280///
281/// This type is not used in any activity, and only used as *part* of another schema.
282///
283#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
284#[serde_with::serde_as]
285#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
286pub struct AccountAddress {
287    /// CLDR country code (e.g. "US"). This value cannot be set for a sub-account of an MCA. All MCA sub-accounts inherit the country of their parent MCA.
288    pub country: Option<String>,
289    /// City, town or commune. May also include dependent localities or sublocalities (e.g. neighborhoods or suburbs).
290    pub locality: Option<String>,
291    /// Postal code or ZIP (e.g. "94043").
292    #[serde(rename = "postalCode")]
293    pub postal_code: Option<String>,
294    /// Top-level administrative subdivision of the country. For example, a state like California ("CA") or a province like Quebec ("QC").
295    pub region: Option<String>,
296    /// Street-level part of the address.
297    #[serde(rename = "streetAddress")]
298    pub street_address: Option<String>,
299}
300
301impl common::Part for AccountAddress {}
302
303/// There is no detailed description.
304///
305/// This type is not used in any activity, and only used as *part* of another schema.
306///
307#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
308#[serde_with::serde_as]
309#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
310pub struct AccountAdwordsLink {
311    /// Customer ID of the AdWords account.
312    #[serde(rename = "adwordsId")]
313    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
314    pub adwords_id: Option<u64>,
315    /// Status of the link between this Merchant Center account and the AdWords account. Upon retrieval, it represents the actual status of the link and can be either `active` if it was approved in Google AdWords or `pending` if it's pending approval. Upon insertion, it represents the *intended* status of the link. Re-uploading a link with status `active` when it's still pending or with status `pending` when it's already active will have no effect: the status will remain unchanged. Re-uploading a link with deprecated status `inactive` is equivalent to not submitting the link at all and will delete the link if it was active or cancel the link request if it was pending. Acceptable values are: - "`active`" - "`pending`"
316    pub status: Option<String>,
317}
318
319impl common::Part for AccountAdwordsLink {}
320
321/// There is no detailed description.
322///
323/// This type is not used in any activity, and only used as *part* of another schema.
324///
325#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
326#[serde_with::serde_as]
327#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
328pub struct AccountBusinessInformation {
329    /// The address of the business.
330    pub address: Option<AccountAddress>,
331    /// The customer service information of the business.
332    #[serde(rename = "customerService")]
333    pub customer_service: Option<AccountCustomerService>,
334    /// The 10-digit [Korean business registration number](https://support.google.com/merchants/answer/9037766) separated with dashes in the format: XXX-XX-XXXXX. This field will only be updated if explicitly set.
335    #[serde(rename = "koreanBusinessRegistrationNumber")]
336    pub korean_business_registration_number: Option<String>,
337    /// The phone number of the business.
338    #[serde(rename = "phoneNumber")]
339    pub phone_number: Option<String>,
340}
341
342impl common::Part for AccountBusinessInformation {}
343
344/// There is no detailed description.
345///
346/// This type is not used in any activity, and only used as *part* of another schema.
347///
348#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
349#[serde_with::serde_as]
350#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
351pub struct AccountCustomerService {
352    /// Customer service email.
353    pub email: Option<String>,
354    /// Customer service phone number.
355    #[serde(rename = "phoneNumber")]
356    pub phone_number: Option<String>,
357    /// Customer service URL.
358    pub url: Option<String>,
359}
360
361impl common::Part for AccountCustomerService {}
362
363/// There is no detailed description.
364///
365/// This type is not used in any activity, and only used as *part* of another schema.
366///
367#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
368#[serde_with::serde_as]
369#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
370pub struct AccountGoogleMyBusinessLink {
371    /// The GMB email address of which a specific account within a GMB account. A sample account within a GMB account could be a business account with set of locations, managed under the GMB account.
372    #[serde(rename = "gmbEmail")]
373    pub gmb_email: Option<String>,
374    /// Status of the link between this Merchant Center account and the GMB account. Acceptable values are: - "`active`" - "`pending`"
375    pub status: Option<String>,
376}
377
378impl common::Part for AccountGoogleMyBusinessLink {}
379
380/// There is no detailed description.
381///
382/// This type is not used in any activity, and only used as *part* of another schema.
383///
384#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
385#[serde_with::serde_as]
386#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
387pub struct AccountIdentifier {
388    /// The aggregator ID, set for aggregators and subaccounts (in that case, it represents the aggregator of the subaccount).
389    #[serde(rename = "aggregatorId")]
390    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
391    pub aggregator_id: Option<u64>,
392    /// The merchant account ID, set for individual accounts and subaccounts.
393    #[serde(rename = "merchantId")]
394    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
395    pub merchant_id: Option<u64>,
396}
397
398impl common::Part for AccountIdentifier {}
399
400/// The status of an account, i.e., information about its products, which is computed offline and not returned immediately at insertion time.
401///
402/// # Activities
403///
404/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
405/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
406///
407/// * [get accountstatuses](AccountstatusGetCall) (response)
408#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
409#[serde_with::serde_as]
410#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
411pub struct AccountStatus {
412    /// The ID of the account for which the status is reported.
413    #[serde(rename = "accountId")]
414    pub account_id: Option<String>,
415    /// A list of account level issues.
416    #[serde(rename = "accountLevelIssues")]
417    pub account_level_issues: Option<Vec<AccountStatusAccountLevelIssue>>,
418    /// DEPRECATED - never populated.
419    #[serde(rename = "dataQualityIssues")]
420    pub data_quality_issues: Option<Vec<AccountStatusDataQualityIssue>>,
421    /// Identifies what kind of resource this is. Value: the fixed string "`content#accountStatus`"
422    pub kind: Option<String>,
423    /// List of product-related data by channel, destination, and country. Data in this field may be delayed by up to 30 minutes.
424    pub products: Option<Vec<AccountStatusProducts>>,
425    /// Whether the account's website is claimed or not.
426    #[serde(rename = "websiteClaimed")]
427    pub website_claimed: Option<bool>,
428}
429
430impl common::ResponseResult for AccountStatus {}
431
432/// There is no detailed description.
433///
434/// This type is not used in any activity, and only used as *part* of another schema.
435///
436#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
437#[serde_with::serde_as]
438#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
439pub struct AccountStatusAccountLevelIssue {
440    /// Country for which this issue is reported.
441    pub country: Option<String>,
442    /// The destination the issue applies to. If this field is empty then the issue applies to all available destinations.
443    pub destination: Option<String>,
444    /// Additional details about the issue.
445    pub detail: Option<String>,
446    /// The URL of a web page to help resolving this issue.
447    pub documentation: Option<String>,
448    /// Issue identifier.
449    pub id: Option<String>,
450    /// Severity of the issue. Acceptable values are: - "`critical`" - "`error`" - "`suggestion`"
451    pub severity: Option<String>,
452    /// Short description of the issue.
453    pub title: Option<String>,
454}
455
456impl common::Part for AccountStatusAccountLevelIssue {}
457
458/// There is no detailed description.
459///
460/// This type is not used in any activity, and only used as *part* of another schema.
461///
462#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
463#[serde_with::serde_as]
464#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
465pub struct AccountStatusDataQualityIssue {
466    /// no description provided
467    pub country: Option<String>,
468    /// no description provided
469    pub destination: Option<String>,
470    /// no description provided
471    pub detail: Option<String>,
472    /// no description provided
473    #[serde(rename = "displayedValue")]
474    pub displayed_value: Option<String>,
475    /// no description provided
476    #[serde(rename = "exampleItems")]
477    pub example_items: Option<Vec<AccountStatusExampleItem>>,
478    /// no description provided
479    pub id: Option<String>,
480    /// no description provided
481    #[serde(rename = "lastChecked")]
482    pub last_checked: Option<String>,
483    /// no description provided
484    pub location: Option<String>,
485    /// no description provided
486    #[serde(rename = "numItems")]
487    pub num_items: Option<u32>,
488    ///  Acceptable values are: - "`critical`" - "`error`" - "`suggestion`"
489    pub severity: Option<String>,
490    /// no description provided
491    #[serde(rename = "submittedValue")]
492    pub submitted_value: Option<String>,
493}
494
495impl common::Part for AccountStatusDataQualityIssue {}
496
497/// There is no detailed description.
498///
499/// This type is not used in any activity, and only used as *part* of another schema.
500///
501#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
502#[serde_with::serde_as]
503#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
504pub struct AccountStatusExampleItem {
505    /// no description provided
506    #[serde(rename = "itemId")]
507    pub item_id: Option<String>,
508    /// no description provided
509    pub link: Option<String>,
510    /// no description provided
511    #[serde(rename = "submittedValue")]
512    pub submitted_value: Option<String>,
513    /// no description provided
514    pub title: Option<String>,
515    /// no description provided
516    #[serde(rename = "valueOnLandingPage")]
517    pub value_on_landing_page: Option<String>,
518}
519
520impl common::Part for AccountStatusExampleItem {}
521
522/// There is no detailed description.
523///
524/// This type is not used in any activity, and only used as *part* of another schema.
525///
526#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
527#[serde_with::serde_as]
528#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
529pub struct AccountStatusItemLevelIssue {
530    /// The attribute's name, if the issue is caused by a single attribute.
531    #[serde(rename = "attributeName")]
532    pub attribute_name: Option<String>,
533    /// The error code of the issue.
534    pub code: Option<String>,
535    /// A short issue description in English.
536    pub description: Option<String>,
537    /// A detailed issue description in English.
538    pub detail: Option<String>,
539    /// The URL of a web page to help with resolving this issue.
540    pub documentation: Option<String>,
541    /// Number of items with this issue.
542    #[serde(rename = "numItems")]
543    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
544    pub num_items: Option<i64>,
545    /// Whether the issue can be resolved by the merchant.
546    pub resolution: Option<String>,
547    /// How this issue affects serving of the offer.
548    pub servability: Option<String>,
549}
550
551impl common::Part for AccountStatusItemLevelIssue {}
552
553/// There is no detailed description.
554///
555/// This type is not used in any activity, and only used as *part* of another schema.
556///
557#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
558#[serde_with::serde_as]
559#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
560pub struct AccountStatusProducts {
561    /// The channel the data applies to. Acceptable values are: - "`local`" - "`online`"
562    pub channel: Option<String>,
563    /// The country the data applies to.
564    pub country: Option<String>,
565    /// The destination the data applies to.
566    pub destination: Option<String>,
567    /// List of item-level issues.
568    #[serde(rename = "itemLevelIssues")]
569    pub item_level_issues: Option<Vec<AccountStatusItemLevelIssue>>,
570    /// Aggregated product statistics.
571    pub statistics: Option<AccountStatusStatistics>,
572}
573
574impl common::Part for AccountStatusProducts {}
575
576/// There is no detailed description.
577///
578/// This type is not used in any activity, and only used as *part* of another schema.
579///
580#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
581#[serde_with::serde_as]
582#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
583pub struct AccountStatusStatistics {
584    /// Number of active offers.
585    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
586    pub active: Option<i64>,
587    /// Number of disapproved offers.
588    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
589    pub disapproved: Option<i64>,
590    /// Number of expiring offers.
591    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
592    pub expiring: Option<i64>,
593    /// Number of pending offers.
594    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
595    pub pending: Option<i64>,
596}
597
598impl common::Part for AccountStatusStatistics {}
599
600/// The tax settings of a merchant account. All methods require the admin role.
601///
602/// # Activities
603///
604/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
605/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
606///
607/// * [get accounttax](AccounttaxGetCall) (response)
608/// * [update accounttax](AccounttaxUpdateCall) (request|response)
609#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
610#[serde_with::serde_as]
611#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
612pub struct AccountTax {
613    /// Required. The ID of the account to which these account tax settings belong.
614    #[serde(rename = "accountId")]
615    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
616    pub account_id: Option<u64>,
617    /// Identifies what kind of resource this is. Value: the fixed string "content#accountTax".
618    pub kind: Option<String>,
619    /// Tax rules. Updating the tax rules will enable US taxes (not reversible). Defining no rules is equivalent to not charging tax at all.
620    pub rules: Option<Vec<AccountTaxTaxRule>>,
621}
622
623impl common::RequestValue for AccountTax {}
624impl common::ResponseResult for AccountTax {}
625
626/// Tax calculation rule to apply in a state or province (USA only).
627///
628/// This type is not used in any activity, and only used as *part* of another schema.
629///
630#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
631#[serde_with::serde_as]
632#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
633pub struct AccountTaxTaxRule {
634    /// Country code in which tax is applicable.
635    pub country: Option<String>,
636    /// Required. State (or province) is which the tax is applicable, described by its location ID (also called criteria ID).
637    #[serde(rename = "locationId")]
638    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
639    pub location_id: Option<u64>,
640    /// Explicit tax rate in percent, represented as a floating point number without the percentage character. Must not be negative.
641    #[serde(rename = "ratePercent")]
642    pub rate_percent: Option<String>,
643    /// If true, shipping charges are also taxed.
644    #[serde(rename = "shippingTaxed")]
645    pub shipping_taxed: Option<bool>,
646    /// Whether the tax rate is taken from a global tax table or specified explicitly.
647    #[serde(rename = "useGlobalRate")]
648    pub use_global_rate: Option<bool>,
649}
650
651impl common::Part for AccountTaxTaxRule {}
652
653/// There is no detailed description.
654///
655/// This type is not used in any activity, and only used as *part* of another schema.
656///
657#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
658#[serde_with::serde_as]
659#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
660pub struct AccountUser {
661    /// Whether user is an admin.
662    pub admin: Option<bool>,
663    /// User's email address.
664    #[serde(rename = "emailAddress")]
665    pub email_address: Option<String>,
666    /// Whether user is an order manager.
667    #[serde(rename = "orderManager")]
668    pub order_manager: Option<bool>,
669    /// Whether user can access payment statements.
670    #[serde(rename = "paymentsAnalyst")]
671    pub payments_analyst: Option<bool>,
672    /// Whether user can manage payment settings.
673    #[serde(rename = "paymentsManager")]
674    pub payments_manager: Option<bool>,
675}
676
677impl common::Part for AccountUser {}
678
679/// There is no detailed description.
680///
681/// This type is not used in any activity, and only used as *part* of another schema.
682///
683#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
684#[serde_with::serde_as]
685#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
686pub struct AccountYouTubeChannelLink {
687    /// Channel ID.
688    #[serde(rename = "channelId")]
689    pub channel_id: Option<String>,
690    /// Status of the link between this Merchant Center account and the YouTube channel. Upon retrieval, it represents the actual status of the link and can be either `active` if it was approved in YT Creator Studio or `pending` if it's pending approval. Upon insertion, it represents the *intended* status of the link. Re-uploading a link with status `active` when it's still pending or with status `pending` when it's already active will have no effect: the status will remain unchanged. Re-uploading a link with deprecated status `inactive` is equivalent to not submitting the link at all and will delete the link if it was active or cancel the link request if it was pending.
691    pub status: Option<String>,
692}
693
694impl common::Part for AccountYouTubeChannelLink {}
695
696/// There is no detailed description.
697///
698/// # Activities
699///
700/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
701/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
702///
703/// * [authinfo accounts](AccountAuthinfoCall) (response)
704#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
705#[serde_with::serde_as]
706#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
707pub struct AccountsAuthInfoResponse {
708    /// The account identifiers corresponding to the authenticated user. - For an individual account: only the merchant ID is defined - For an aggregator: only the aggregator ID is defined - For a subaccount of an MCA: both the merchant ID and the aggregator ID are defined.
709    #[serde(rename = "accountIdentifiers")]
710    pub account_identifiers: Option<Vec<AccountIdentifier>>,
711    /// Identifies what kind of resource this is. Value: the fixed string "content#accountsAuthInfoResponse".
712    pub kind: Option<String>,
713}
714
715impl common::ResponseResult for AccountsAuthInfoResponse {}
716
717/// There is no detailed description.
718///
719/// # Activities
720///
721/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
722/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
723///
724/// * [claimwebsite accounts](AccountClaimwebsiteCall) (response)
725#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
726#[serde_with::serde_as]
727#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
728pub struct AccountsClaimWebsiteResponse {
729    /// Identifies what kind of resource this is. Value: the fixed string "content#accountsClaimWebsiteResponse".
730    pub kind: Option<String>,
731}
732
733impl common::ResponseResult for AccountsClaimWebsiteResponse {}
734
735/// There is no detailed description.
736///
737/// # Activities
738///
739/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
740/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
741///
742/// * [custombatch accounts](AccountCustombatchCall) (request)
743#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
744#[serde_with::serde_as]
745#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
746pub struct AccountsCustomBatchRequest {
747    /// The request entries to be processed in the batch.
748    pub entries: Option<Vec<AccountsCustomBatchRequestEntry>>,
749}
750
751impl common::RequestValue for AccountsCustomBatchRequest {}
752
753/// A batch entry encoding a single non-batch accounts request.
754///
755/// This type is not used in any activity, and only used as *part* of another schema.
756///
757#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
758#[serde_with::serde_as]
759#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
760pub struct AccountsCustomBatchRequestEntry {
761    /// The account to create or update. Only defined if the method is `insert` or `update`.
762    pub account: Option<Account>,
763    /// The ID of the targeted account. Only defined if the method is not `insert`.
764    #[serde(rename = "accountId")]
765    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
766    pub account_id: Option<u64>,
767    /// An entry ID, unique within the batch request.
768    #[serde(rename = "batchId")]
769    pub batch_id: Option<u32>,
770    /// Whether the account should be deleted if the account has offers. Only applicable if the method is `delete`.
771    pub force: Option<bool>,
772    /// Label IDs for the 'updatelabels' request.
773    #[serde(rename = "labelIds")]
774    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
775    pub label_ids: Option<Vec<u64>>,
776    /// Details about the `link` request.
777    #[serde(rename = "linkRequest")]
778    pub link_request: Option<AccountsCustomBatchRequestEntryLinkRequest>,
779    /// The ID of the managing account.
780    #[serde(rename = "merchantId")]
781    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
782    pub merchant_id: Option<u64>,
783    /// The method of the batch entry. Acceptable values are: - "`claimWebsite`" - "`delete`" - "`get`" - "`insert`" - "`link`" - "`update`"
784    pub method: Option<String>,
785    /// Only applicable if the method is `claimwebsite`. Indicates whether or not to take the claim from another account in case there is a conflict.
786    pub overwrite: Option<bool>,
787}
788
789impl common::Part for AccountsCustomBatchRequestEntry {}
790
791/// There is no detailed description.
792///
793/// This type is not used in any activity, and only used as *part* of another schema.
794///
795#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
796#[serde_with::serde_as]
797#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
798pub struct AccountsCustomBatchRequestEntryLinkRequest {
799    /// Action to perform for this link. The `"request"` action is only available to select merchants. Acceptable values are: - "`approve`" - "`remove`" - "`request`"
800    pub action: Option<String>,
801    /// Type of the link between the two accounts. Acceptable values are: - "`channelPartner`" - "`eCommercePlatform`"
802    #[serde(rename = "linkType")]
803    pub link_type: Option<String>,
804    /// The ID of the linked account.
805    #[serde(rename = "linkedAccountId")]
806    pub linked_account_id: Option<String>,
807}
808
809impl common::Part for AccountsCustomBatchRequestEntryLinkRequest {}
810
811/// There is no detailed description.
812///
813/// # Activities
814///
815/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
816/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
817///
818/// * [custombatch accounts](AccountCustombatchCall) (response)
819#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
820#[serde_with::serde_as]
821#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
822pub struct AccountsCustomBatchResponse {
823    /// The result of the execution of the batch requests.
824    pub entries: Option<Vec<AccountsCustomBatchResponseEntry>>,
825    /// Identifies what kind of resource this is. Value: the fixed string "content#accountsCustomBatchResponse".
826    pub kind: Option<String>,
827}
828
829impl common::ResponseResult for AccountsCustomBatchResponse {}
830
831/// A batch entry encoding a single non-batch accounts response.
832///
833/// This type is not used in any activity, and only used as *part* of another schema.
834///
835#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
836#[serde_with::serde_as]
837#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
838pub struct AccountsCustomBatchResponseEntry {
839    /// The retrieved, created, or updated account. Not defined if the method was `delete`, `claimwebsite` or `link`.
840    pub account: Option<Account>,
841    /// The ID of the request entry this entry responds to.
842    #[serde(rename = "batchId")]
843    pub batch_id: Option<u32>,
844    /// A list of errors defined if and only if the request failed.
845    pub errors: Option<Errors>,
846    /// Identifies what kind of resource this is. Value: the fixed string "`content#accountsCustomBatchResponseEntry`"
847    pub kind: Option<String>,
848    /// Deprecated. This field is never set. Acceptable values are: - "`active`" - "`inactive`" - "`pending`"
849    #[serde(rename = "linkStatus")]
850    pub link_status: Option<String>,
851}
852
853impl common::Part for AccountsCustomBatchResponseEntry {}
854
855/// There is no detailed description.
856///
857/// # Activities
858///
859/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
860/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
861///
862/// * [link accounts](AccountLinkCall) (request)
863#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
864#[serde_with::serde_as]
865#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
866pub struct AccountsLinkRequest {
867    /// Action to perform for this link. The `"request"` action is only available to select merchants. Acceptable values are: - "`approve`" - "`remove`" - "`request`"
868    pub action: Option<String>,
869    /// Type of the link between the two accounts. Acceptable values are: - "`channelPartner`" - "`eCommercePlatform`"
870    #[serde(rename = "linkType")]
871    pub link_type: Option<String>,
872    /// The ID of the linked account.
873    #[serde(rename = "linkedAccountId")]
874    pub linked_account_id: Option<String>,
875}
876
877impl common::RequestValue for AccountsLinkRequest {}
878
879/// There is no detailed description.
880///
881/// # Activities
882///
883/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
884/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
885///
886/// * [link accounts](AccountLinkCall) (response)
887#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
888#[serde_with::serde_as]
889#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
890pub struct AccountsLinkResponse {
891    /// Identifies what kind of resource this is. Value: the fixed string "content#accountsLinkResponse".
892    pub kind: Option<String>,
893}
894
895impl common::ResponseResult for AccountsLinkResponse {}
896
897/// There is no detailed description.
898///
899/// # Activities
900///
901/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
902/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
903///
904/// * [list accounts](AccountListCall) (response)
905#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
906#[serde_with::serde_as]
907#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
908pub struct AccountsListResponse {
909    /// Identifies what kind of resource this is. Value: the fixed string "content#accountsListResponse".
910    pub kind: Option<String>,
911    /// The token for the retrieval of the next page of accounts.
912    #[serde(rename = "nextPageToken")]
913    pub next_page_token: Option<String>,
914    /// no description provided
915    pub resources: Option<Vec<Account>>,
916}
917
918impl common::ResponseResult for AccountsListResponse {}
919
920/// There is no detailed description.
921///
922/// # Activities
923///
924/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
925/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
926///
927/// * [custombatch accountstatuses](AccountstatusCustombatchCall) (request)
928#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
929#[serde_with::serde_as]
930#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
931pub struct AccountstatusesCustomBatchRequest {
932    /// The request entries to be processed in the batch.
933    pub entries: Option<Vec<AccountstatusesCustomBatchRequestEntry>>,
934}
935
936impl common::RequestValue for AccountstatusesCustomBatchRequest {}
937
938/// A batch entry encoding a single non-batch accountstatuses request.
939///
940/// This type is not used in any activity, and only used as *part* of another schema.
941///
942#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
943#[serde_with::serde_as]
944#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
945pub struct AccountstatusesCustomBatchRequestEntry {
946    /// The ID of the (sub-)account whose status to get.
947    #[serde(rename = "accountId")]
948    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
949    pub account_id: Option<u64>,
950    /// An entry ID, unique within the batch request.
951    #[serde(rename = "batchId")]
952    pub batch_id: Option<u32>,
953    /// If set, only issues for the specified destinations are returned, otherwise only issues for the Shopping destination.
954    pub destinations: Option<Vec<String>>,
955    /// The ID of the managing account.
956    #[serde(rename = "merchantId")]
957    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
958    pub merchant_id: Option<u64>,
959    /// The method of the batch entry. Acceptable values are: - "`get`"
960    pub method: Option<String>,
961}
962
963impl common::Part for AccountstatusesCustomBatchRequestEntry {}
964
965/// There is no detailed description.
966///
967/// # Activities
968///
969/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
970/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
971///
972/// * [custombatch accountstatuses](AccountstatusCustombatchCall) (response)
973#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
974#[serde_with::serde_as]
975#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
976pub struct AccountstatusesCustomBatchResponse {
977    /// The result of the execution of the batch requests.
978    pub entries: Option<Vec<AccountstatusesCustomBatchResponseEntry>>,
979    /// Identifies what kind of resource this is. Value: the fixed string "content#accountstatusesCustomBatchResponse".
980    pub kind: Option<String>,
981}
982
983impl common::ResponseResult for AccountstatusesCustomBatchResponse {}
984
985/// A batch entry encoding a single non-batch accountstatuses response.
986///
987/// This type is not used in any activity, and only used as *part* of another schema.
988///
989#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
990#[serde_with::serde_as]
991#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
992pub struct AccountstatusesCustomBatchResponseEntry {
993    /// The requested account status. Defined if and only if the request was successful.
994    #[serde(rename = "accountStatus")]
995    pub account_status: Option<AccountStatus>,
996    /// The ID of the request entry this entry responds to.
997    #[serde(rename = "batchId")]
998    pub batch_id: Option<u32>,
999    /// A list of errors defined if and only if the request failed.
1000    pub errors: Option<Errors>,
1001}
1002
1003impl common::Part for AccountstatusesCustomBatchResponseEntry {}
1004
1005/// There is no detailed description.
1006///
1007/// # Activities
1008///
1009/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1010/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1011///
1012/// * [list accountstatuses](AccountstatusListCall) (response)
1013#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1014#[serde_with::serde_as]
1015#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1016pub struct AccountstatusesListResponse {
1017    /// Identifies what kind of resource this is. Value: the fixed string "content#accountstatusesListResponse".
1018    pub kind: Option<String>,
1019    /// The token for the retrieval of the next page of account statuses.
1020    #[serde(rename = "nextPageToken")]
1021    pub next_page_token: Option<String>,
1022    /// no description provided
1023    pub resources: Option<Vec<AccountStatus>>,
1024}
1025
1026impl common::ResponseResult for AccountstatusesListResponse {}
1027
1028/// There is no detailed description.
1029///
1030/// # Activities
1031///
1032/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1033/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1034///
1035/// * [custombatch accounttax](AccounttaxCustombatchCall) (request)
1036#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1037#[serde_with::serde_as]
1038#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1039pub struct AccounttaxCustomBatchRequest {
1040    /// The request entries to be processed in the batch.
1041    pub entries: Option<Vec<AccounttaxCustomBatchRequestEntry>>,
1042}
1043
1044impl common::RequestValue for AccounttaxCustomBatchRequest {}
1045
1046/// A batch entry encoding a single non-batch accounttax request.
1047///
1048/// This type is not used in any activity, and only used as *part* of another schema.
1049///
1050#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1051#[serde_with::serde_as]
1052#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1053pub struct AccounttaxCustomBatchRequestEntry {
1054    /// The ID of the account for which to get/update account tax settings.
1055    #[serde(rename = "accountId")]
1056    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1057    pub account_id: Option<u64>,
1058    /// The account tax settings to update. Only defined if the method is `update`.
1059    #[serde(rename = "accountTax")]
1060    pub account_tax: Option<AccountTax>,
1061    /// An entry ID, unique within the batch request.
1062    #[serde(rename = "batchId")]
1063    pub batch_id: Option<u32>,
1064    /// The ID of the managing account.
1065    #[serde(rename = "merchantId")]
1066    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1067    pub merchant_id: Option<u64>,
1068    /// The method of the batch entry. Acceptable values are: - "`get`" - "`update`"
1069    pub method: Option<String>,
1070}
1071
1072impl common::Part for AccounttaxCustomBatchRequestEntry {}
1073
1074/// There is no detailed description.
1075///
1076/// # Activities
1077///
1078/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1079/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1080///
1081/// * [custombatch accounttax](AccounttaxCustombatchCall) (response)
1082#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1083#[serde_with::serde_as]
1084#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1085pub struct AccounttaxCustomBatchResponse {
1086    /// The result of the execution of the batch requests.
1087    pub entries: Option<Vec<AccounttaxCustomBatchResponseEntry>>,
1088    /// Identifies what kind of resource this is. Value: the fixed string "content#accounttaxCustomBatchResponse".
1089    pub kind: Option<String>,
1090}
1091
1092impl common::ResponseResult for AccounttaxCustomBatchResponse {}
1093
1094/// A batch entry encoding a single non-batch accounttax response.
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 AccounttaxCustomBatchResponseEntry {
1102    /// The retrieved or updated account tax settings.
1103    #[serde(rename = "accountTax")]
1104    pub account_tax: Option<AccountTax>,
1105    /// The ID of the request entry this entry responds to.
1106    #[serde(rename = "batchId")]
1107    pub batch_id: Option<u32>,
1108    /// A list of errors defined if and only if the request failed.
1109    pub errors: Option<Errors>,
1110    /// Identifies what kind of resource this is. Value: the fixed string "`content#accounttaxCustomBatchResponseEntry`"
1111    pub kind: Option<String>,
1112}
1113
1114impl common::Part for AccounttaxCustomBatchResponseEntry {}
1115
1116/// There is no detailed description.
1117///
1118/// # Activities
1119///
1120/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1121/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1122///
1123/// * [list accounttax](AccounttaxListCall) (response)
1124#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1125#[serde_with::serde_as]
1126#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1127pub struct AccounttaxListResponse {
1128    /// Identifies what kind of resource this is. Value: the fixed string "content#accounttaxListResponse".
1129    pub kind: Option<String>,
1130    /// The token for the retrieval of the next page of account tax settings.
1131    #[serde(rename = "nextPageToken")]
1132    pub next_page_token: Option<String>,
1133    /// no description provided
1134    pub resources: Option<Vec<AccountTax>>,
1135}
1136
1137impl common::ResponseResult for AccounttaxListResponse {}
1138
1139/// There is no detailed description.
1140///
1141/// This type is not used in any activity, and only used as *part* of another schema.
1142///
1143#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1144#[serde_with::serde_as]
1145#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1146pub struct Address {
1147    /// Required. Top-level administrative subdivision of the country. For example, a state like California ("CA") or a province like Quebec ("QC").
1148    #[serde(rename = "administrativeArea")]
1149    pub administrative_area: Option<String>,
1150    /// Required. City, town or commune. May also include dependent localities or sublocalities (e.g. neighborhoods or suburbs).
1151    pub city: Option<String>,
1152    /// Required. [CLDR country code](http://www.unicode.org/repos/cldr/tags/latest/common/main/en.xml)(e.g. "US").
1153    pub country: Option<String>,
1154    /// Required. Postal code or ZIP (e.g. "94043"). Required.
1155    #[serde(rename = "postalCode")]
1156    pub postal_code: Option<String>,
1157    /// Street-level part of the address.
1158    #[serde(rename = "streetAddress")]
1159    pub street_address: Option<String>,
1160}
1161
1162impl common::Part for Address {}
1163
1164/// There is no detailed description.
1165///
1166/// This type is not used in any activity, and only used as *part* of another schema.
1167///
1168#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1169#[serde_with::serde_as]
1170#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1171pub struct Amount {
1172    /// [required] Value before taxes.
1173    pub pretax: Option<Price>,
1174    /// [required] Tax value.
1175    pub tax: Option<Price>,
1176}
1177
1178impl common::Part for Amount {}
1179
1180/// There is no detailed description.
1181///
1182/// This type is not used in any activity, and only used as *part* of another schema.
1183///
1184#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1185#[serde_with::serde_as]
1186#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1187pub struct BusinessDayConfig {
1188    /// Regular business days, such as '"monday"'. May not be empty.
1189    #[serde(rename = "businessDays")]
1190    pub business_days: Option<Vec<String>>,
1191}
1192
1193impl common::Part for BusinessDayConfig {}
1194
1195/// There is no detailed description.
1196///
1197/// This type is not used in any activity, and only used as *part* of another schema.
1198///
1199#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1200#[serde_with::serde_as]
1201#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1202pub struct CarrierRate {
1203    /// Carrier service, such as `"UPS"` or `"Fedex"`. The list of supported carriers can be retrieved via the `getSupportedCarriers` method. Required.
1204    #[serde(rename = "carrierName")]
1205    pub carrier_name: Option<String>,
1206    /// Carrier service, such as `"ground"` or `"2 days"`. The list of supported services for a carrier can be retrieved via the `getSupportedCarriers` method. Required.
1207    #[serde(rename = "carrierService")]
1208    pub carrier_service: Option<String>,
1209    /// Additive shipping rate modifier. Can be negative. For example `{ "value": "1", "currency" : "USD" }` adds $1 to the rate, `{ "value": "-3", "currency" : "USD" }` removes $3 from the rate. Optional.
1210    #[serde(rename = "flatAdjustment")]
1211    pub flat_adjustment: Option<Price>,
1212    /// Name of the carrier rate. Must be unique per rate group. Required.
1213    pub name: Option<String>,
1214    /// Shipping origin for this carrier rate. Required.
1215    #[serde(rename = "originPostalCode")]
1216    pub origin_postal_code: Option<String>,
1217    /// Multiplicative shipping rate modifier as a number in decimal notation. Can be negative. For example `"5.4"` increases the rate by 5.4%, `"-3"` decreases the rate by 3%. Optional.
1218    #[serde(rename = "percentageAdjustment")]
1219    pub percentage_adjustment: Option<String>,
1220}
1221
1222impl common::Part for CarrierRate {}
1223
1224/// There is no detailed description.
1225///
1226/// This type is not used in any activity, and only used as *part* of another schema.
1227///
1228#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1229#[serde_with::serde_as]
1230#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1231pub struct CarriersCarrier {
1232    /// The CLDR country code of the carrier (e.g., "US"). Always present.
1233    pub country: Option<String>,
1234    /// A list of services supported for EDD (Estimated Delivery Date) calculation. This is the list of valid values for WarehouseBasedDeliveryTime.carrierService.
1235    #[serde(rename = "eddServices")]
1236    pub edd_services: Option<Vec<String>>,
1237    /// The name of the carrier (e.g., `"UPS"`). Always present.
1238    pub name: Option<String>,
1239    /// A list of supported services (e.g., `"ground"`) for that carrier. Contains at least one service. This is the list of valid values for CarrierRate.carrierService.
1240    pub services: Option<Vec<String>>,
1241}
1242
1243impl common::Part for CarriersCarrier {}
1244
1245/// There is no detailed description.
1246///
1247/// This type is not used in any activity, and only used as *part* of another schema.
1248///
1249#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1250#[serde_with::serde_as]
1251#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1252pub struct CustomAttribute {
1253    /// The name of the attribute. Underscores will be replaced by spaces upon insertion.
1254    pub name: Option<String>,
1255    /// The type of the attribute. Acceptable values are: - "`boolean`" - "`datetimerange`" - "`float`" - "`group`" - "`int`" - "`price`" - "`text`" - "`time`" - "`url`"
1256    #[serde(rename = "type")]
1257    pub type_: Option<String>,
1258    /// Free-form unit of the attribute. Unit can only be used for values of type int, float, or price.
1259    pub unit: Option<String>,
1260    /// The value of the attribute.
1261    pub value: Option<String>,
1262}
1263
1264impl common::Part for CustomAttribute {}
1265
1266/// There is no detailed description.
1267///
1268/// This type is not used in any activity, and only used as *part* of another schema.
1269///
1270#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1271#[serde_with::serde_as]
1272#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1273pub struct CustomGroup {
1274    /// The sub-attributes.
1275    pub attributes: Option<Vec<CustomAttribute>>,
1276    /// The name of the group. Underscores will be replaced by spaces upon insertion.
1277    pub name: Option<String>,
1278}
1279
1280impl common::Part for CustomGroup {}
1281
1282/// There is no detailed description.
1283///
1284/// This type is not used in any activity, and only used as *part* of another schema.
1285///
1286#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1287#[serde_with::serde_as]
1288#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1289pub struct CustomerReturnReason {
1290    /// Description of the reason.
1291    pub description: Option<String>,
1292    /// Code of the return reason. Acceptable values are: - "`betterPriceFound`" - "`changedMind`" - "`damagedOrDefectiveItem`" - "`didNotMatchDescription`" - "`doesNotFit`" - "`expiredItem`" - "`incorrectItemReceived`" - "`noLongerNeeded`" - "`notSpecified`" - "`orderedWrongItem`" - "`other`" - "`qualityNotExpected`" - "`receivedTooLate`" - "`undeliverable`"
1293    #[serde(rename = "reasonCode")]
1294    pub reason_code: Option<String>,
1295}
1296
1297impl common::Part for CustomerReturnReason {}
1298
1299/// There is no detailed description.
1300///
1301/// This type is not used in any activity, and only used as *part* of another schema.
1302///
1303#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1304#[serde_with::serde_as]
1305#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1306pub struct CutoffTime {
1307    /// Hour of the cutoff time until which an order has to be placed to be processed in the same day. Required.
1308    pub hour: Option<u32>,
1309    /// Minute of the cutoff time until which an order has to be placed to be processed in the same day. Required.
1310    pub minute: Option<u32>,
1311    /// Timezone identifier for the cutoff time. A list of identifiers can be found in the AdWords API documentation. E.g. "Europe/Zurich". Required.
1312    pub timezone: Option<String>,
1313}
1314
1315impl common::Part for CutoffTime {}
1316
1317/// Datafeed configuration data.
1318///
1319/// # Activities
1320///
1321/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1322/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1323///
1324/// * [custombatch datafeeds](DatafeedCustombatchCall) (none)
1325/// * [delete datafeeds](DatafeedDeleteCall) (none)
1326/// * [fetchnow datafeeds](DatafeedFetchnowCall) (none)
1327/// * [get datafeeds](DatafeedGetCall) (response)
1328/// * [insert datafeeds](DatafeedInsertCall) (request|response)
1329/// * [list datafeeds](DatafeedListCall) (none)
1330/// * [update datafeeds](DatafeedUpdateCall) (request|response)
1331#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1332#[serde_with::serde_as]
1333#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1334pub struct Datafeed {
1335    /// The two-letter ISO 639-1 language in which the attributes are defined in the data feed.
1336    #[serde(rename = "attributeLanguage")]
1337    pub attribute_language: Option<String>,
1338    /// [DEPRECATED] Please use targets[].language instead. The two-letter ISO 639-1 language of the items in the feed. Must be a valid language for `targetCountry`.
1339    #[serde(rename = "contentLanguage")]
1340    pub content_language: Option<String>,
1341    /// Required. The type of data feed. For product inventory feeds, only feeds for local stores, not online stores, are supported. Acceptable values are: - "`local products`" - "`product inventory`" - "`products`"
1342    #[serde(rename = "contentType")]
1343    pub content_type: Option<String>,
1344    /// Fetch schedule for the feed file.
1345    #[serde(rename = "fetchSchedule")]
1346    pub fetch_schedule: Option<DatafeedFetchSchedule>,
1347    /// Required. The filename of the feed. All feeds must have a unique file name.
1348    #[serde(rename = "fileName")]
1349    pub file_name: Option<String>,
1350    /// Format of the feed file.
1351    pub format: Option<DatafeedFormat>,
1352    /// Required for update. The ID of the data feed.
1353    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1354    pub id: Option<i64>,
1355    /// [DEPRECATED] Please use targets[].includedDestinations instead. The list of intended destinations (corresponds to checked check boxes in Merchant Center).
1356    #[serde(rename = "intendedDestinations")]
1357    pub intended_destinations: Option<Vec<String>>,
1358    /// Identifies what kind of resource this is. Value: the fixed string "`content#datafeed`"
1359    pub kind: Option<String>,
1360    /// Required for insert. A descriptive name of the data feed.
1361    pub name: Option<String>,
1362    /// [DEPRECATED] Please use targets[].country instead. The country where the items in the feed will be included in the search index, represented as a CLDR territory code.
1363    #[serde(rename = "targetCountry")]
1364    pub target_country: Option<String>,
1365    /// The targets this feed should apply to (country, language, destinations).
1366    pub targets: Option<Vec<DatafeedTarget>>,
1367}
1368
1369impl common::RequestValue for Datafeed {}
1370impl common::Resource for Datafeed {}
1371impl common::ResponseResult for Datafeed {}
1372
1373/// The required fields vary based on the frequency of fetching. For a monthly fetch schedule, day_of_month and hour are required. For a weekly fetch schedule, weekday and hour are required. For a daily fetch schedule, only hour is required.
1374///
1375/// This type is not used in any activity, and only used as *part* of another schema.
1376///
1377#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1378#[serde_with::serde_as]
1379#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1380pub struct DatafeedFetchSchedule {
1381    /// The day of the month the feed file should be fetched (1-31).
1382    #[serde(rename = "dayOfMonth")]
1383    pub day_of_month: Option<u32>,
1384    /// The URL where the feed file can be fetched. Google Merchant Center will support automatic scheduled uploads using the HTTP, HTTPS, FTP, or SFTP protocols, so the value will need to be a valid link using one of those four protocols.
1385    #[serde(rename = "fetchUrl")]
1386    pub fetch_url: Option<String>,
1387    /// The hour of the day the feed file should be fetched (0-23).
1388    pub hour: Option<u32>,
1389    /// The minute of the hour the feed file should be fetched (0-59). Read-only.
1390    #[serde(rename = "minuteOfHour")]
1391    pub minute_of_hour: Option<u32>,
1392    /// An optional password for fetch_url.
1393    pub password: Option<String>,
1394    /// Whether the scheduled fetch is paused or not.
1395    pub paused: Option<bool>,
1396    /// Time zone used for schedule. UTC by default. E.g., "America/Los_Angeles".
1397    #[serde(rename = "timeZone")]
1398    pub time_zone: Option<String>,
1399    /// An optional user name for fetch_url.
1400    pub username: Option<String>,
1401    /// The day of the week the feed file should be fetched. Acceptable values are: - "`monday`" - "`tuesday`" - "`wednesday`" - "`thursday`" - "`friday`" - "`saturday`" - "`sunday`"
1402    pub weekday: Option<String>,
1403}
1404
1405impl common::Part for DatafeedFetchSchedule {}
1406
1407/// There is no detailed description.
1408///
1409/// This type is not used in any activity, and only used as *part* of another schema.
1410///
1411#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1412#[serde_with::serde_as]
1413#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1414pub struct DatafeedFormat {
1415    /// Delimiter for the separation of values in a delimiter-separated values feed. If not specified, the delimiter will be auto-detected. Ignored for non-DSV data feeds. Acceptable values are: - "`pipe`" - "`tab`" - "`tilde`"
1416    #[serde(rename = "columnDelimiter")]
1417    pub column_delimiter: Option<String>,
1418    /// Character encoding scheme of the data feed. If not specified, the encoding will be auto-detected. Acceptable values are: - "`latin-1`" - "`utf-16be`" - "`utf-16le`" - "`utf-8`" - "`windows-1252`"
1419    #[serde(rename = "fileEncoding")]
1420    pub file_encoding: Option<String>,
1421    /// Specifies how double quotes are interpreted. If not specified, the mode will be auto-detected. Ignored for non-DSV data feeds. Acceptable values are: - "`normal character`" - "`value quoting`"
1422    #[serde(rename = "quotingMode")]
1423    pub quoting_mode: Option<String>,
1424}
1425
1426impl common::Part for DatafeedFormat {}
1427
1428/// The status of a datafeed, i.e., the result of the last retrieval of the datafeed computed asynchronously when the feed processing is finished.
1429///
1430/// # Activities
1431///
1432/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1433/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1434///
1435/// * [get datafeedstatuses](DatafeedstatusGetCall) (response)
1436#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1437#[serde_with::serde_as]
1438#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1439pub struct DatafeedStatus {
1440    /// The country for which the status is reported, represented as a CLDR territory code.
1441    pub country: Option<String>,
1442    /// The ID of the feed for which the status is reported.
1443    #[serde(rename = "datafeedId")]
1444    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1445    pub datafeed_id: Option<u64>,
1446    /// The list of errors occurring in the feed.
1447    pub errors: Option<Vec<DatafeedStatusError>>,
1448    /// The number of items in the feed that were processed.
1449    #[serde(rename = "itemsTotal")]
1450    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1451    pub items_total: Option<u64>,
1452    /// The number of items in the feed that were valid.
1453    #[serde(rename = "itemsValid")]
1454    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1455    pub items_valid: Option<u64>,
1456    /// Identifies what kind of resource this is. Value: the fixed string "`content#datafeedStatus`"
1457    pub kind: Option<String>,
1458    /// The two-letter ISO 639-1 language for which the status is reported.
1459    pub language: Option<String>,
1460    /// The last date at which the feed was uploaded.
1461    #[serde(rename = "lastUploadDate")]
1462    pub last_upload_date: Option<String>,
1463    /// The processing status of the feed. Acceptable values are: - "`"`failure`": The feed could not be processed or all items had errors.`" - "`in progress`": The feed is being processed. - "`none`": The feed has not yet been processed. For example, a feed that has never been uploaded will have this processing status. - "`success`": The feed was processed successfully, though some items might have had errors.
1464    #[serde(rename = "processingStatus")]
1465    pub processing_status: Option<String>,
1466    /// The list of errors occurring in the feed.
1467    pub warnings: Option<Vec<DatafeedStatusError>>,
1468}
1469
1470impl common::ResponseResult for DatafeedStatus {}
1471
1472/// An error occurring in the feed, like "invalid price".
1473///
1474/// This type is not used in any activity, and only used as *part* of another schema.
1475///
1476#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1477#[serde_with::serde_as]
1478#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1479pub struct DatafeedStatusError {
1480    /// The code of the error, e.g., "validation/invalid_value".
1481    pub code: Option<String>,
1482    /// The number of occurrences of the error in the feed.
1483    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1484    pub count: Option<u64>,
1485    /// A list of example occurrences of the error, grouped by product.
1486    pub examples: Option<Vec<DatafeedStatusExample>>,
1487    /// The error message, e.g., "Invalid price".
1488    pub message: Option<String>,
1489}
1490
1491impl common::Part for DatafeedStatusError {}
1492
1493/// An example occurrence for a particular error.
1494///
1495/// This type is not used in any activity, and only used as *part* of another schema.
1496///
1497#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1498#[serde_with::serde_as]
1499#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1500pub struct DatafeedStatusExample {
1501    /// The ID of the example item.
1502    #[serde(rename = "itemId")]
1503    pub item_id: Option<String>,
1504    /// Line number in the data feed where the example is found.
1505    #[serde(rename = "lineNumber")]
1506    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1507    pub line_number: Option<u64>,
1508    /// The problematic value.
1509    pub value: Option<String>,
1510}
1511
1512impl common::Part for DatafeedStatusExample {}
1513
1514/// There is no detailed description.
1515///
1516/// This type is not used in any activity, and only used as *part* of another schema.
1517///
1518#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1519#[serde_with::serde_as]
1520#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1521pub struct DatafeedTarget {
1522    /// The country where the items in the feed will be included in the search index, represented as a CLDR territory code.
1523    pub country: Option<String>,
1524    /// The list of destinations to exclude for this target (corresponds to unchecked check boxes in Merchant Center).
1525    #[serde(rename = "excludedDestinations")]
1526    pub excluded_destinations: Option<Vec<String>>,
1527    /// The list of destinations to include for this target (corresponds to checked check boxes in Merchant Center). Default destinations are always included unless provided in `excludedDestinations`. List of supported destinations (if available to the account): - DisplayAds - Shopping - ShoppingActions - SurfacesAcrossGoogle
1528    #[serde(rename = "includedDestinations")]
1529    pub included_destinations: Option<Vec<String>>,
1530    /// The two-letter ISO 639-1 language of the items in the feed. Must be a valid language for `targets[].country`.
1531    pub language: Option<String>,
1532}
1533
1534impl common::Part for DatafeedTarget {}
1535
1536/// There is no detailed description.
1537///
1538/// # Activities
1539///
1540/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1541/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1542///
1543/// * [custombatch datafeeds](DatafeedCustombatchCall) (request)
1544#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1545#[serde_with::serde_as]
1546#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1547pub struct DatafeedsCustomBatchRequest {
1548    /// The request entries to be processed in the batch.
1549    pub entries: Option<Vec<DatafeedsCustomBatchRequestEntry>>,
1550}
1551
1552impl common::RequestValue for DatafeedsCustomBatchRequest {}
1553
1554/// A batch entry encoding a single non-batch datafeeds request.
1555///
1556/// This type is not used in any activity, and only used as *part* of another schema.
1557///
1558#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1559#[serde_with::serde_as]
1560#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1561pub struct DatafeedsCustomBatchRequestEntry {
1562    /// An entry ID, unique within the batch request.
1563    #[serde(rename = "batchId")]
1564    pub batch_id: Option<u32>,
1565    /// The data feed to insert.
1566    pub datafeed: Option<Datafeed>,
1567    /// The ID of the data feed to get, delete or fetch.
1568    #[serde(rename = "datafeedId")]
1569    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1570    pub datafeed_id: Option<u64>,
1571    /// The ID of the managing account.
1572    #[serde(rename = "merchantId")]
1573    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1574    pub merchant_id: Option<u64>,
1575    /// The method of the batch entry. Acceptable values are: - "`delete`" - "`fetchNow`" - "`get`" - "`insert`" - "`update`"
1576    pub method: Option<String>,
1577}
1578
1579impl common::Part for DatafeedsCustomBatchRequestEntry {}
1580
1581/// There is no detailed description.
1582///
1583/// # Activities
1584///
1585/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1586/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1587///
1588/// * [custombatch datafeeds](DatafeedCustombatchCall) (response)
1589#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1590#[serde_with::serde_as]
1591#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1592pub struct DatafeedsCustomBatchResponse {
1593    /// The result of the execution of the batch requests.
1594    pub entries: Option<Vec<DatafeedsCustomBatchResponseEntry>>,
1595    /// Identifies what kind of resource this is. Value: the fixed string "content#datafeedsCustomBatchResponse".
1596    pub kind: Option<String>,
1597}
1598
1599impl common::ResponseResult for DatafeedsCustomBatchResponse {}
1600
1601/// A batch entry encoding a single non-batch datafeeds response.
1602///
1603/// This type is not used in any activity, and only used as *part* of another schema.
1604///
1605#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1606#[serde_with::serde_as]
1607#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1608pub struct DatafeedsCustomBatchResponseEntry {
1609    /// The ID of the request entry this entry responds to.
1610    #[serde(rename = "batchId")]
1611    pub batch_id: Option<u32>,
1612    /// The requested data feed. Defined if and only if the request was successful.
1613    pub datafeed: Option<Datafeed>,
1614    /// A list of errors defined if and only if the request failed.
1615    pub errors: Option<Errors>,
1616}
1617
1618impl common::Part for DatafeedsCustomBatchResponseEntry {}
1619
1620/// There is no detailed description.
1621///
1622/// # Activities
1623///
1624/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1625/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1626///
1627/// * [fetchnow datafeeds](DatafeedFetchnowCall) (response)
1628#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1629#[serde_with::serde_as]
1630#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1631pub struct DatafeedsFetchNowResponse {
1632    /// Identifies what kind of resource this is. Value: the fixed string "content#datafeedsFetchNowResponse".
1633    pub kind: Option<String>,
1634}
1635
1636impl common::ResponseResult for DatafeedsFetchNowResponse {}
1637
1638/// There is no detailed description.
1639///
1640/// # Activities
1641///
1642/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1643/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1644///
1645/// * [list datafeeds](DatafeedListCall) (response)
1646#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1647#[serde_with::serde_as]
1648#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1649pub struct DatafeedsListResponse {
1650    /// Identifies what kind of resource this is. Value: the fixed string "content#datafeedsListResponse".
1651    pub kind: Option<String>,
1652    /// The token for the retrieval of the next page of datafeeds.
1653    #[serde(rename = "nextPageToken")]
1654    pub next_page_token: Option<String>,
1655    /// no description provided
1656    pub resources: Option<Vec<Datafeed>>,
1657}
1658
1659impl common::ResponseResult for DatafeedsListResponse {}
1660
1661/// There is no detailed description.
1662///
1663/// # Activities
1664///
1665/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1666/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1667///
1668/// * [custombatch datafeedstatuses](DatafeedstatusCustombatchCall) (request)
1669#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1670#[serde_with::serde_as]
1671#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1672pub struct DatafeedstatusesCustomBatchRequest {
1673    /// The request entries to be processed in the batch.
1674    pub entries: Option<Vec<DatafeedstatusesCustomBatchRequestEntry>>,
1675}
1676
1677impl common::RequestValue for DatafeedstatusesCustomBatchRequest {}
1678
1679/// A batch entry encoding a single non-batch datafeedstatuses request.
1680///
1681/// This type is not used in any activity, and only used as *part* of another schema.
1682///
1683#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1684#[serde_with::serde_as]
1685#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1686pub struct DatafeedstatusesCustomBatchRequestEntry {
1687    /// An entry ID, unique within the batch request.
1688    #[serde(rename = "batchId")]
1689    pub batch_id: Option<u32>,
1690    /// The country for which to get the datafeed status. If this parameter is provided then language must also be provided. Note that for multi-target datafeeds this parameter is required.
1691    pub country: Option<String>,
1692    /// The ID of the data feed to get.
1693    #[serde(rename = "datafeedId")]
1694    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1695    pub datafeed_id: Option<u64>,
1696    /// The language for which to get the datafeed status. If this parameter is provided then country must also be provided. Note that for multi-target datafeeds this parameter is required.
1697    pub language: Option<String>,
1698    /// The ID of the managing account.
1699    #[serde(rename = "merchantId")]
1700    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1701    pub merchant_id: Option<u64>,
1702    /// The method of the batch entry. Acceptable values are: - "`get`"
1703    pub method: Option<String>,
1704}
1705
1706impl common::Part for DatafeedstatusesCustomBatchRequestEntry {}
1707
1708/// There is no detailed description.
1709///
1710/// # Activities
1711///
1712/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1713/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1714///
1715/// * [custombatch datafeedstatuses](DatafeedstatusCustombatchCall) (response)
1716#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1717#[serde_with::serde_as]
1718#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1719pub struct DatafeedstatusesCustomBatchResponse {
1720    /// The result of the execution of the batch requests.
1721    pub entries: Option<Vec<DatafeedstatusesCustomBatchResponseEntry>>,
1722    /// Identifies what kind of resource this is. Value: the fixed string "content#datafeedstatusesCustomBatchResponse".
1723    pub kind: Option<String>,
1724}
1725
1726impl common::ResponseResult for DatafeedstatusesCustomBatchResponse {}
1727
1728/// A batch entry encoding a single non-batch datafeedstatuses response.
1729///
1730/// This type is not used in any activity, and only used as *part* of another schema.
1731///
1732#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1733#[serde_with::serde_as]
1734#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1735pub struct DatafeedstatusesCustomBatchResponseEntry {
1736    /// The ID of the request entry this entry responds to.
1737    #[serde(rename = "batchId")]
1738    pub batch_id: Option<u32>,
1739    /// The requested data feed status. Defined if and only if the request was successful.
1740    #[serde(rename = "datafeedStatus")]
1741    pub datafeed_status: Option<DatafeedStatus>,
1742    /// A list of errors defined if and only if the request failed.
1743    pub errors: Option<Errors>,
1744}
1745
1746impl common::Part for DatafeedstatusesCustomBatchResponseEntry {}
1747
1748/// There is no detailed description.
1749///
1750/// # Activities
1751///
1752/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1753/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1754///
1755/// * [list datafeedstatuses](DatafeedstatusListCall) (response)
1756#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1757#[serde_with::serde_as]
1758#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1759pub struct DatafeedstatusesListResponse {
1760    /// Identifies what kind of resource this is. Value: the fixed string "content#datafeedstatusesListResponse".
1761    pub kind: Option<String>,
1762    /// The token for the retrieval of the next page of datafeed statuses.
1763    #[serde(rename = "nextPageToken")]
1764    pub next_page_token: Option<String>,
1765    /// no description provided
1766    pub resources: Option<Vec<DatafeedStatus>>,
1767}
1768
1769impl common::ResponseResult for DatafeedstatusesListResponse {}
1770
1771/// There is no detailed description.
1772///
1773/// This type is not used in any activity, and only used as *part* of another schema.
1774///
1775#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1776#[serde_with::serde_as]
1777#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1778pub struct DeliveryTime {
1779    /// Business days cutoff time definition. If not configured the cutoff time will be defaulted to 8AM PST.
1780    #[serde(rename = "cutoffTime")]
1781    pub cutoff_time: Option<CutoffTime>,
1782    /// The business days during which orders can be handled. If not provided, Monday to Friday business days will be assumed.
1783    #[serde(rename = "handlingBusinessDayConfig")]
1784    pub handling_business_day_config: Option<BusinessDayConfig>,
1785    /// Holiday cutoff definitions. If configured, they specify order cutoff times for holiday-specific shipping.
1786    #[serde(rename = "holidayCutoffs")]
1787    pub holiday_cutoffs: Option<Vec<HolidayCutoff>>,
1788    /// Maximum number of business days spent before an order is shipped. 0 means same day shipped, 1 means next day shipped. Must be greater than or equal to `minHandlingTimeInDays`.
1789    #[serde(rename = "maxHandlingTimeInDays")]
1790    pub max_handling_time_in_days: Option<u32>,
1791    /// Maximum number of business days that is spent in transit. 0 means same day delivery, 1 means next day delivery. Must be greater than or equal to `minTransitTimeInDays`.
1792    #[serde(rename = "maxTransitTimeInDays")]
1793    pub max_transit_time_in_days: Option<u32>,
1794    /// Minimum number of business days spent before an order is shipped. 0 means same day shipped, 1 means next day shipped.
1795    #[serde(rename = "minHandlingTimeInDays")]
1796    pub min_handling_time_in_days: Option<u32>,
1797    /// Minimum number of business days that is spent in transit. 0 means same day delivery, 1 means next day delivery. Either `{min,max}TransitTimeInDays` or `transitTimeTable` must be set, but not both.
1798    #[serde(rename = "minTransitTimeInDays")]
1799    pub min_transit_time_in_days: Option<u32>,
1800    /// The business days during which orders can be in-transit. If not provided, Monday to Friday business days will be assumed.
1801    #[serde(rename = "transitBusinessDayConfig")]
1802    pub transit_business_day_config: Option<BusinessDayConfig>,
1803    /// Transit time table, number of business days spent in transit based on row and column dimensions. Either `{min,max}TransitTimeInDays` or `transitTimeTable` can be set, but not both.
1804    #[serde(rename = "transitTimeTable")]
1805    pub transit_time_table: Option<TransitTable>,
1806    /// Indicates that the delivery time should be calculated per warehouse (shipping origin location) based on the settings of the selected carrier. When set, no other transit time related field in DeliveryTime should be set.
1807    #[serde(rename = "warehouseBasedDeliveryTimes")]
1808    pub warehouse_based_delivery_times: Option<Vec<WarehouseBasedDeliveryTime>>,
1809}
1810
1811impl common::Part for DeliveryTime {}
1812
1813/// An error returned by the API.
1814///
1815/// This type is not used in any activity, and only used as *part* of another schema.
1816///
1817#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1818#[serde_with::serde_as]
1819#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1820pub struct Error {
1821    /// The domain of the error.
1822    pub domain: Option<String>,
1823    /// A description of the error.
1824    pub message: Option<String>,
1825    /// The error code.
1826    pub reason: Option<String>,
1827}
1828
1829impl common::Part for Error {}
1830
1831/// A list of errors returned by a failed batch entry.
1832///
1833/// This type is not used in any activity, and only used as *part* of another schema.
1834///
1835#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1836#[serde_with::serde_as]
1837#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1838pub struct Errors {
1839    /// The HTTP status of the first error in `errors`.
1840    pub code: Option<u32>,
1841    /// A list of errors.
1842    pub errors: Option<Vec<Error>>,
1843    /// The message of the first error in `errors`.
1844    pub message: Option<String>,
1845}
1846
1847impl common::Part for Errors {}
1848
1849/// There is no detailed description.
1850///
1851/// This type is not used in any activity, and only used as *part* of another schema.
1852///
1853#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1854#[serde_with::serde_as]
1855#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1856pub struct GmbAccounts {
1857    /// The ID of the Merchant Center account.
1858    #[serde(rename = "accountId")]
1859    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1860    pub account_id: Option<u64>,
1861    /// A list of GMB accounts which are available to the merchant.
1862    #[serde(rename = "gmbAccounts")]
1863    pub gmb_accounts: Option<Vec<GmbAccountsGmbAccount>>,
1864}
1865
1866impl common::Part for GmbAccounts {}
1867
1868/// There is no detailed description.
1869///
1870/// This type is not used in any activity, and only used as *part* of another schema.
1871///
1872#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1873#[serde_with::serde_as]
1874#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1875pub struct GmbAccountsGmbAccount {
1876    /// The email which identifies the GMB account.
1877    pub email: Option<String>,
1878    /// Number of listings under this account.
1879    #[serde(rename = "listingCount")]
1880    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1881    pub listing_count: Option<u64>,
1882    /// The name of the GMB account.
1883    pub name: Option<String>,
1884    /// The type of the GMB account (User or Business).
1885    #[serde(rename = "type")]
1886    pub type_: Option<String>,
1887}
1888
1889impl common::Part for GmbAccountsGmbAccount {}
1890
1891/// A non-empty list of row or column headers for a table. Exactly one of `prices`, `weights`, `numItems`, `postalCodeGroupNames`, or `location` must be set.
1892///
1893/// This type is not used in any activity, and only used as *part* of another schema.
1894///
1895#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1896#[serde_with::serde_as]
1897#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1898pub struct Headers {
1899    /// A list of location ID sets. Must be non-empty. Can only be set if all other fields are not set.
1900    pub locations: Option<Vec<LocationIdSet>>,
1901    /// A list of inclusive number of items upper bounds. The last value can be `"infinity"`. For example `["10", "50", "infinity"]` represents the headers "<= 10 items", "<= 50 items", and "> 50 items". Must be non-empty. Can only be set if all other fields are not set.
1902    #[serde(rename = "numberOfItems")]
1903    pub number_of_items: Option<Vec<String>>,
1904    /// A list of postal group names. The last value can be `"all other locations"`. Example: `["zone 1", "zone 2", "all other locations"]`. The referred postal code groups must match the delivery country of the service. Must be non-empty. Can only be set if all other fields are not set.
1905    #[serde(rename = "postalCodeGroupNames")]
1906    pub postal_code_group_names: Option<Vec<String>>,
1907    /// A list of inclusive order price upper bounds. The last price's value can be `"infinity"`. For example `[{"value": "10", "currency": "USD"}, {"value": "500", "currency": "USD"}, {"value": "infinity", "currency": "USD"}]` represents the headers "<= $10", "<= $500", and "> $500". All prices within a service must have the same currency. Must be non-empty. Can only be set if all other fields are not set.
1908    pub prices: Option<Vec<Price>>,
1909    /// A list of inclusive order weight upper bounds. The last weight's value can be `"infinity"`. For example `[{"value": "10", "unit": "kg"}, {"value": "50", "unit": "kg"}, {"value": "infinity", "unit": "kg"}]` represents the headers "<= 10kg", "<= 50kg", and "> 50kg". All weights within a service must have the same unit. Must be non-empty. Can only be set if all other fields are not set.
1910    pub weights: Option<Vec<Weight>>,
1911}
1912
1913impl common::Part for Headers {}
1914
1915/// There is no detailed description.
1916///
1917/// This type is not used in any activity, and only used as *part* of another schema.
1918///
1919#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1920#[serde_with::serde_as]
1921#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1922pub struct HolidayCutoff {
1923    /// Date of the order deadline, in ISO 8601 format. E.g. "2016-11-29" for 29th November 2016. Required.
1924    #[serde(rename = "deadlineDate")]
1925    pub deadline_date: Option<String>,
1926    /// Hour of the day on the deadline date until which the order has to be placed to qualify for the delivery guarantee. Possible values are: 0 (midnight), 1, ..., 12 (noon), 13, ..., 23. Required.
1927    #[serde(rename = "deadlineHour")]
1928    pub deadline_hour: Option<u32>,
1929    /// Timezone identifier for the deadline hour. A list of identifiers can be found in the AdWords API documentation. E.g. "Europe/Zurich". Required.
1930    #[serde(rename = "deadlineTimezone")]
1931    pub deadline_timezone: Option<String>,
1932    /// Unique identifier for the holiday. Required.
1933    #[serde(rename = "holidayId")]
1934    pub holiday_id: Option<String>,
1935    /// Date on which the deadline will become visible to consumers in ISO 8601 format. E.g. "2016-10-31" for 31st October 2016. Required.
1936    #[serde(rename = "visibleFromDate")]
1937    pub visible_from_date: Option<String>,
1938}
1939
1940impl common::Part for HolidayCutoff {}
1941
1942/// There is no detailed description.
1943///
1944/// This type is not used in any activity, and only used as *part* of another schema.
1945///
1946#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1947#[serde_with::serde_as]
1948#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1949pub struct HolidaysHoliday {
1950    /// The CLDR territory code of the country in which the holiday is available. E.g. "US", "DE", "GB". A holiday cutoff can only be configured in a shipping settings service with matching delivery country. Always present.
1951    #[serde(rename = "countryCode")]
1952    pub country_code: Option<String>,
1953    /// Date of the holiday, in ISO 8601 format. E.g. "2016-12-25" for Christmas 2016. Always present.
1954    pub date: Option<String>,
1955    /// Date on which the order has to arrive at the customer's, in ISO 8601 format. E.g. "2016-12-24" for 24th December 2016. Always present.
1956    #[serde(rename = "deliveryGuaranteeDate")]
1957    pub delivery_guarantee_date: Option<String>,
1958    /// Hour of the day in the delivery location's timezone on the guaranteed delivery date by which the order has to arrive at the customer's. Possible values are: 0 (midnight), 1, ..., 12 (noon), 13, ..., 23. Always present.
1959    #[serde(rename = "deliveryGuaranteeHour")]
1960    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1961    pub delivery_guarantee_hour: Option<u64>,
1962    /// Unique identifier for the holiday to be used when configuring holiday cutoffs. Always present.
1963    pub id: Option<String>,
1964    /// The holiday type. Always present. Acceptable values are: - "`Christmas`" - "`Easter`" - "`Father's Day`" - "`Halloween`" - "`Independence Day (USA)`" - "`Mother's Day`" - "`Thanksgiving`" - "`Valentine's Day`"
1965    #[serde(rename = "type")]
1966    pub type_: Option<String>,
1967}
1968
1969impl common::Part for HolidaysHoliday {}
1970
1971/// There is no detailed description.
1972///
1973/// This type is not used in any activity, and only used as *part* of another schema.
1974///
1975#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1976#[serde_with::serde_as]
1977#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1978pub struct Installment {
1979    /// The amount the buyer has to pay per month.
1980    pub amount: Option<Price>,
1981    /// The number of installments the buyer has to pay.
1982    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1983    pub months: Option<i64>,
1984}
1985
1986impl common::Part for Installment {}
1987
1988/// There is no detailed description.
1989///
1990/// This type is not used in any activity, and only used as *part* of another schema.
1991///
1992#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1993#[serde_with::serde_as]
1994#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1995pub struct Inventory {
1996    /// The availability of the product. Acceptable values are: - "`in stock`" - "`out of stock`" - "`preorder`"
1997    pub availability: Option<String>,
1998    /// Custom label 0 for custom grouping of items in a Shopping campaign. Only supported for online products.
1999    #[serde(rename = "customLabel0")]
2000    pub custom_label0: Option<String>,
2001    /// Custom label 1 for custom grouping of items in a Shopping campaign. Only supported for online products.
2002    #[serde(rename = "customLabel1")]
2003    pub custom_label1: Option<String>,
2004    /// Custom label 2 for custom grouping of items in a Shopping campaign. Only supported for online products.
2005    #[serde(rename = "customLabel2")]
2006    pub custom_label2: Option<String>,
2007    /// Custom label 3 for custom grouping of items in a Shopping campaign. Only supported for online products.
2008    #[serde(rename = "customLabel3")]
2009    pub custom_label3: Option<String>,
2010    /// Custom label 3 for custom grouping of items in a Shopping campaign. Only supported for online products.
2011    #[serde(rename = "customLabel4")]
2012    pub custom_label4: Option<String>,
2013    /// Number and amount of installments to pay for an item. Brazil only.
2014    pub installment: Option<Installment>,
2015    /// The instore product location. Supported only for local products.
2016    #[serde(rename = "instoreProductLocation")]
2017    pub instore_product_location: Option<String>,
2018    /// Identifies what kind of resource this is. Value: the fixed string "`content#inventory`"
2019    pub kind: Option<String>,
2020    /// Loyalty points that users receive after purchasing the item. Japan only.
2021    #[serde(rename = "loyaltyPoints")]
2022    pub loyalty_points: Option<LoyaltyPoints>,
2023    /// Store pickup information. Only supported for local inventory. Not setting `pickup` means "don't update" while setting it to the empty value (`{}` in JSON) means "delete". Otherwise, `pickupMethod` and `pickupSla` must be set together, unless `pickupMethod` is "not supported".
2024    pub pickup: Option<InventoryPickup>,
2025    /// The price of the product.
2026    pub price: Option<Price>,
2027    /// The quantity of the product. Must be equal to or greater than zero. Supported only for local products.
2028    pub quantity: Option<u32>,
2029    /// The sale price of the product. Mandatory if `sale_price_effective_date` is defined.
2030    #[serde(rename = "salePrice")]
2031    pub sale_price: Option<Price>,
2032    /// A date range represented by a pair of ISO 8601 dates separated by a space, comma, or slash. Both dates might be specified as 'null' if undecided.
2033    #[serde(rename = "salePriceEffectiveDate")]
2034    pub sale_price_effective_date: Option<String>,
2035    /// The quantity of the product that is available for selling on Google. Supported only for online products.
2036    #[serde(rename = "sellOnGoogleQuantity")]
2037    pub sell_on_google_quantity: Option<u32>,
2038}
2039
2040impl common::Part for Inventory {}
2041
2042/// There is no detailed description.
2043///
2044/// # Activities
2045///
2046/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2047/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2048///
2049/// * [custombatch inventory](InventoryCustombatchCall) (request)
2050#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2051#[serde_with::serde_as]
2052#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2053pub struct InventoryCustomBatchRequest {
2054    /// The request entries to be processed in the batch.
2055    pub entries: Option<Vec<InventoryCustomBatchRequestEntry>>,
2056}
2057
2058impl common::RequestValue for InventoryCustomBatchRequest {}
2059
2060/// A batch entry encoding a single non-batch inventory request.
2061///
2062/// This type is not used in any activity, and only used as *part* of another schema.
2063///
2064#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2065#[serde_with::serde_as]
2066#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2067pub struct InventoryCustomBatchRequestEntry {
2068    /// An entry ID, unique within the batch request.
2069    #[serde(rename = "batchId")]
2070    pub batch_id: Option<u32>,
2071    /// Price and availability of the product.
2072    pub inventory: Option<Inventory>,
2073    /// The ID of the managing account.
2074    #[serde(rename = "merchantId")]
2075    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2076    pub merchant_id: Option<u64>,
2077    /// The ID of the product for which to update price and availability.
2078    #[serde(rename = "productId")]
2079    pub product_id: Option<String>,
2080    /// The code of the store for which to update price and availability. Use `online` to update price and availability of an online product.
2081    #[serde(rename = "storeCode")]
2082    pub store_code: Option<String>,
2083}
2084
2085impl common::Part for InventoryCustomBatchRequestEntry {}
2086
2087/// There is no detailed description.
2088///
2089/// # Activities
2090///
2091/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2092/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2093///
2094/// * [custombatch inventory](InventoryCustombatchCall) (response)
2095#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2096#[serde_with::serde_as]
2097#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2098pub struct InventoryCustomBatchResponse {
2099    /// The result of the execution of the batch requests.
2100    pub entries: Option<Vec<InventoryCustomBatchResponseEntry>>,
2101    /// Identifies what kind of resource this is. Value: the fixed string "content#inventoryCustomBatchResponse".
2102    pub kind: Option<String>,
2103}
2104
2105impl common::ResponseResult for InventoryCustomBatchResponse {}
2106
2107/// A batch entry encoding a single non-batch inventory response.
2108///
2109/// This type is not used in any activity, and only used as *part* of another schema.
2110///
2111#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2112#[serde_with::serde_as]
2113#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2114pub struct InventoryCustomBatchResponseEntry {
2115    /// The ID of the request entry this entry responds to.
2116    #[serde(rename = "batchId")]
2117    pub batch_id: Option<u32>,
2118    /// A list of errors defined if and only if the request failed.
2119    pub errors: Option<Errors>,
2120    /// Identifies what kind of resource this is. Value: the fixed string "`content#inventoryCustomBatchResponseEntry`"
2121    pub kind: Option<String>,
2122}
2123
2124impl common::Part for InventoryCustomBatchResponseEntry {}
2125
2126/// There is no detailed description.
2127///
2128/// This type is not used in any activity, and only used as *part* of another schema.
2129///
2130#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2131#[serde_with::serde_as]
2132#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2133pub struct InventoryPickup {
2134    /// Whether store pickup is available for this offer and whether the pickup option should be shown as buy, reserve, or not supported. Only supported for local inventory. Unless the value is "not supported", must be submitted together with `pickupSla`. Acceptable values are: - "`buy`" - "`not supported`" - "`reserve`" - "`ship to store`"
2135    #[serde(rename = "pickupMethod")]
2136    pub pickup_method: Option<String>,
2137    /// The expected date that an order will be ready for pickup, relative to when the order is placed. Only supported for local inventory. Must be submitted together with `pickupMethod`. Acceptable values are: - "`five day`" - "`four day`" - "`multi day`" - "`multi week`" - "`next day`" - "`same day`" - "`seven day`" - "`six day`" - "`three day`" - "`two day`"
2138    #[serde(rename = "pickupSla")]
2139    pub pickup_sla: Option<String>,
2140}
2141
2142impl common::Part for InventoryPickup {}
2143
2144/// There is no detailed description.
2145///
2146/// # Activities
2147///
2148/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2149/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2150///
2151/// * [set inventory](InventorySetCall) (request)
2152#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2153#[serde_with::serde_as]
2154#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2155pub struct InventorySetRequest {
2156    /// The availability of the product. Acceptable values are: - "`in stock`" - "`out of stock`" - "`preorder`"
2157    pub availability: Option<String>,
2158    /// Custom label 0 for custom grouping of items in a Shopping campaign. Only supported for online products.
2159    #[serde(rename = "customLabel0")]
2160    pub custom_label0: Option<String>,
2161    /// Custom label 1 for custom grouping of items in a Shopping campaign. Only supported for online products.
2162    #[serde(rename = "customLabel1")]
2163    pub custom_label1: Option<String>,
2164    /// Custom label 2 for custom grouping of items in a Shopping campaign. Only supported for online products.
2165    #[serde(rename = "customLabel2")]
2166    pub custom_label2: Option<String>,
2167    /// Custom label 3 for custom grouping of items in a Shopping campaign. Only supported for online products.
2168    #[serde(rename = "customLabel3")]
2169    pub custom_label3: Option<String>,
2170    /// Custom label 3 for custom grouping of items in a Shopping campaign. Only supported for online products.
2171    #[serde(rename = "customLabel4")]
2172    pub custom_label4: Option<String>,
2173    /// Number and amount of installments to pay for an item. Brazil only.
2174    pub installment: Option<Installment>,
2175    /// The instore product location. Supported only for local products.
2176    #[serde(rename = "instoreProductLocation")]
2177    pub instore_product_location: Option<String>,
2178    /// Loyalty points that users receive after purchasing the item. Japan only.
2179    #[serde(rename = "loyaltyPoints")]
2180    pub loyalty_points: Option<LoyaltyPoints>,
2181    /// Store pickup information. Only supported for local inventory. Not setting `pickup` means "don't update" while setting it to the empty value (`{}` in JSON) means "delete". Otherwise, `pickupMethod` and `pickupSla` must be set together, unless `pickupMethod` is "not supported".
2182    pub pickup: Option<InventoryPickup>,
2183    /// The price of the product.
2184    pub price: Option<Price>,
2185    /// The quantity of the product. Must be equal to or greater than zero. Supported only for local products.
2186    pub quantity: Option<u32>,
2187    /// The sale price of the product. Mandatory if `sale_price_effective_date` is defined.
2188    #[serde(rename = "salePrice")]
2189    pub sale_price: Option<Price>,
2190    /// A date range represented by a pair of ISO 8601 dates separated by a space, comma, or slash. Both dates might be specified as 'null' if undecided.
2191    #[serde(rename = "salePriceEffectiveDate")]
2192    pub sale_price_effective_date: Option<String>,
2193    /// The quantity of the product that is available for selling on Google. Supported only for online products.
2194    #[serde(rename = "sellOnGoogleQuantity")]
2195    pub sell_on_google_quantity: Option<u32>,
2196}
2197
2198impl common::RequestValue for InventorySetRequest {}
2199
2200/// There is no detailed description.
2201///
2202/// # Activities
2203///
2204/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2205/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2206///
2207/// * [set inventory](InventorySetCall) (response)
2208#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2209#[serde_with::serde_as]
2210#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2211pub struct InventorySetResponse {
2212    /// Identifies what kind of resource this is. Value: the fixed string "content#inventorySetResponse".
2213    pub kind: Option<String>,
2214}
2215
2216impl common::ResponseResult for InventorySetResponse {}
2217
2218/// There is no detailed description.
2219///
2220/// This type is not used in any activity, and only used as *part* of another schema.
2221///
2222#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2223#[serde_with::serde_as]
2224#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2225pub struct InvoiceSummary {
2226    /// Summary of the total amounts of the additional charges.
2227    #[serde(rename = "additionalChargeSummaries")]
2228    pub additional_charge_summaries: Option<Vec<InvoiceSummaryAdditionalChargeSummary>>,
2229    /// Deprecated.
2230    #[serde(rename = "customerBalance")]
2231    pub customer_balance: Option<Amount>,
2232    /// Deprecated.
2233    #[serde(rename = "googleBalance")]
2234    pub google_balance: Option<Amount>,
2235    /// Deprecated.
2236    #[serde(rename = "merchantBalance")]
2237    pub merchant_balance: Option<Amount>,
2238    /// [required] Total price for the product.
2239    #[serde(rename = "productTotal")]
2240    pub product_total: Option<Amount>,
2241    /// Deprecated.
2242    #[serde(rename = "promotionSummaries")]
2243    pub promotion_summaries: Option<Vec<Promotion>>,
2244}
2245
2246impl common::Part for InvoiceSummary {}
2247
2248/// There is no detailed description.
2249///
2250/// This type is not used in any activity, and only used as *part* of another schema.
2251///
2252#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2253#[serde_with::serde_as]
2254#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2255pub struct InvoiceSummaryAdditionalChargeSummary {
2256    /// [required] Total additional charge for this type.
2257    #[serde(rename = "totalAmount")]
2258    pub total_amount: Option<Amount>,
2259    /// [required] Type of the additional charge. Acceptable values are: - "`shipping`"
2260    #[serde(rename = "type")]
2261    pub type_: Option<String>,
2262}
2263
2264impl common::Part for InvoiceSummaryAdditionalChargeSummary {}
2265
2266/// There is no detailed description.
2267///
2268/// This type is not used in any activity, and only used as *part* of another schema.
2269///
2270#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2271#[serde_with::serde_as]
2272#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2273pub struct LiaAboutPageSettings {
2274    /// The status of the verification process for the About page. Acceptable values are: - "`active`" - "`inactive`" - "`pending`"
2275    pub status: Option<String>,
2276    /// The URL for the About page.
2277    pub url: Option<String>,
2278}
2279
2280impl common::Part for LiaAboutPageSettings {}
2281
2282/// There is no detailed description.
2283///
2284/// This type is not used in any activity, and only used as *part* of another schema.
2285///
2286#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2287#[serde_with::serde_as]
2288#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2289pub struct LiaCountrySettings {
2290    /// The settings for the About page.
2291    pub about: Option<LiaAboutPageSettings>,
2292    /// Required. CLDR country code (e.g. "US").
2293    pub country: Option<String>,
2294    /// The status of the "Merchant hosted local storefront" feature.
2295    #[serde(rename = "hostedLocalStorefrontActive")]
2296    pub hosted_local_storefront_active: Option<bool>,
2297    /// LIA inventory verification settings.
2298    pub inventory: Option<LiaInventorySettings>,
2299    /// LIA "On Display To Order" settings.
2300    #[serde(rename = "onDisplayToOrder")]
2301    pub on_display_to_order: Option<LiaOnDisplayToOrderSettings>,
2302    /// The POS data provider linked with this country.
2303    #[serde(rename = "posDataProvider")]
2304    pub pos_data_provider: Option<LiaPosDataProvider>,
2305    /// The status of the "Store pickup" feature.
2306    #[serde(rename = "storePickupActive")]
2307    pub store_pickup_active: Option<bool>,
2308}
2309
2310impl common::Part for LiaCountrySettings {}
2311
2312/// There is no detailed description.
2313///
2314/// This type is not used in any activity, and only used as *part* of another schema.
2315///
2316#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2317#[serde_with::serde_as]
2318#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2319pub struct LiaInventorySettings {
2320    /// The email of the contact for the inventory verification process.
2321    #[serde(rename = "inventoryVerificationContactEmail")]
2322    pub inventory_verification_contact_email: Option<String>,
2323    /// The name of the contact for the inventory verification process.
2324    #[serde(rename = "inventoryVerificationContactName")]
2325    pub inventory_verification_contact_name: Option<String>,
2326    /// The status of the verification contact. Acceptable values are: - "`active`" - "`inactive`" - "`pending`"
2327    #[serde(rename = "inventoryVerificationContactStatus")]
2328    pub inventory_verification_contact_status: Option<String>,
2329    /// The status of the inventory verification process. Acceptable values are: - "`active`" - "`inactive`" - "`pending`"
2330    pub status: Option<String>,
2331}
2332
2333impl common::Part for LiaInventorySettings {}
2334
2335/// There is no detailed description.
2336///
2337/// This type is not used in any activity, and only used as *part* of another schema.
2338///
2339#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2340#[serde_with::serde_as]
2341#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2342pub struct LiaOnDisplayToOrderSettings {
2343    /// Shipping cost and policy URL.
2344    #[serde(rename = "shippingCostPolicyUrl")]
2345    pub shipping_cost_policy_url: Option<String>,
2346    /// The status of the ?On display to order? feature. Acceptable values are: - "`active`" - "`inactive`" - "`pending`"
2347    pub status: Option<String>,
2348}
2349
2350impl common::Part for LiaOnDisplayToOrderSettings {}
2351
2352/// There is no detailed description.
2353///
2354/// This type is not used in any activity, and only used as *part* of another schema.
2355///
2356#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2357#[serde_with::serde_as]
2358#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2359pub struct LiaPosDataProvider {
2360    /// The ID of the POS data provider.
2361    #[serde(rename = "posDataProviderId")]
2362    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2363    pub pos_data_provider_id: Option<u64>,
2364    /// The account ID by which this merchant is known to the POS data provider.
2365    #[serde(rename = "posExternalAccountId")]
2366    pub pos_external_account_id: Option<String>,
2367}
2368
2369impl common::Part for LiaPosDataProvider {}
2370
2371/// Local Inventory ads (LIA) settings. All methods except listposdataproviders require the admin role.
2372///
2373/// # Activities
2374///
2375/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2376/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2377///
2378/// * [get liasettings](LiasettingGetCall) (response)
2379/// * [update liasettings](LiasettingUpdateCall) (request|response)
2380#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2381#[serde_with::serde_as]
2382#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2383pub struct LiaSettings {
2384    /// The ID of the account to which these LIA settings belong. Ignored upon update, always present in get request responses.
2385    #[serde(rename = "accountId")]
2386    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2387    pub account_id: Option<u64>,
2388    /// The LIA settings for each country.
2389    #[serde(rename = "countrySettings")]
2390    pub country_settings: Option<Vec<LiaCountrySettings>>,
2391    /// Identifies what kind of resource this is. Value: the fixed string "`content#liaSettings`"
2392    pub kind: Option<String>,
2393}
2394
2395impl common::RequestValue for LiaSettings {}
2396impl common::ResponseResult for LiaSettings {}
2397
2398/// There is no detailed description.
2399///
2400/// # Activities
2401///
2402/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2403/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2404///
2405/// * [custombatch liasettings](LiasettingCustombatchCall) (request)
2406#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2407#[serde_with::serde_as]
2408#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2409pub struct LiasettingsCustomBatchRequest {
2410    /// The request entries to be processed in the batch.
2411    pub entries: Option<Vec<LiasettingsCustomBatchRequestEntry>>,
2412}
2413
2414impl common::RequestValue for LiasettingsCustomBatchRequest {}
2415
2416/// There is no detailed description.
2417///
2418/// This type is not used in any activity, and only used as *part* of another schema.
2419///
2420#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2421#[serde_with::serde_as]
2422#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2423pub struct LiasettingsCustomBatchRequestEntry {
2424    /// The ID of the account for which to get/update account LIA settings.
2425    #[serde(rename = "accountId")]
2426    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2427    pub account_id: Option<u64>,
2428    /// An entry ID, unique within the batch request.
2429    #[serde(rename = "batchId")]
2430    pub batch_id: Option<u32>,
2431    /// Inventory validation contact email. Required only for SetInventoryValidationContact.
2432    #[serde(rename = "contactEmail")]
2433    pub contact_email: Option<String>,
2434    /// Inventory validation contact name. Required only for SetInventoryValidationContact.
2435    #[serde(rename = "contactName")]
2436    pub contact_name: Option<String>,
2437    /// The country code. Required only for RequestInventoryVerification.
2438    pub country: Option<String>,
2439    /// The GMB account. Required only for RequestGmbAccess.
2440    #[serde(rename = "gmbEmail")]
2441    pub gmb_email: Option<String>,
2442    /// The account Lia settings to update. Only defined if the method is `update`.
2443    #[serde(rename = "liaSettings")]
2444    pub lia_settings: Option<LiaSettings>,
2445    /// The ID of the managing account.
2446    #[serde(rename = "merchantId")]
2447    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2448    pub merchant_id: Option<u64>,
2449    /// The method of the batch entry. Acceptable values are: - "`get`" - "`getAccessibleGmbAccounts`" - "`requestGmbAccess`" - "`requestInventoryVerification`" - "`setInventoryVerificationContact`" - "`update`"
2450    pub method: Option<String>,
2451    /// The ID of POS data provider. Required only for SetPosProvider.
2452    #[serde(rename = "posDataProviderId")]
2453    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2454    pub pos_data_provider_id: Option<u64>,
2455    /// The account ID by which this merchant is known to the POS provider.
2456    #[serde(rename = "posExternalAccountId")]
2457    pub pos_external_account_id: Option<String>,
2458}
2459
2460impl common::Part for LiasettingsCustomBatchRequestEntry {}
2461
2462/// There is no detailed description.
2463///
2464/// # Activities
2465///
2466/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2467/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2468///
2469/// * [custombatch liasettings](LiasettingCustombatchCall) (response)
2470#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2471#[serde_with::serde_as]
2472#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2473pub struct LiasettingsCustomBatchResponse {
2474    /// The result of the execution of the batch requests.
2475    pub entries: Option<Vec<LiasettingsCustomBatchResponseEntry>>,
2476    /// Identifies what kind of resource this is. Value: the fixed string "content#liasettingsCustomBatchResponse".
2477    pub kind: Option<String>,
2478}
2479
2480impl common::ResponseResult for LiasettingsCustomBatchResponse {}
2481
2482/// There is no detailed description.
2483///
2484/// This type is not used in any activity, and only used as *part* of another schema.
2485///
2486#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2487#[serde_with::serde_as]
2488#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2489pub struct LiasettingsCustomBatchResponseEntry {
2490    /// The ID of the request entry to which this entry responds.
2491    #[serde(rename = "batchId")]
2492    pub batch_id: Option<u32>,
2493    /// A list of errors defined if, and only if, the request failed.
2494    pub errors: Option<Errors>,
2495    /// The list of accessible GMB accounts.
2496    #[serde(rename = "gmbAccounts")]
2497    pub gmb_accounts: Option<GmbAccounts>,
2498    /// Identifies what kind of resource this is. Value: the fixed string "`content#liasettingsCustomBatchResponseEntry`"
2499    pub kind: Option<String>,
2500    /// The retrieved or updated Lia settings.
2501    #[serde(rename = "liaSettings")]
2502    pub lia_settings: Option<LiaSettings>,
2503    /// The list of POS data providers.
2504    #[serde(rename = "posDataProviders")]
2505    pub pos_data_providers: Option<Vec<PosDataProviders>>,
2506}
2507
2508impl common::Part for LiasettingsCustomBatchResponseEntry {}
2509
2510/// There is no detailed description.
2511///
2512/// # Activities
2513///
2514/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2515/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2516///
2517/// * [getaccessiblegmbaccounts liasettings](LiasettingGetaccessiblegmbaccountCall) (response)
2518#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2519#[serde_with::serde_as]
2520#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2521pub struct LiasettingsGetAccessibleGmbAccountsResponse {
2522    /// The ID of the Merchant Center account.
2523    #[serde(rename = "accountId")]
2524    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2525    pub account_id: Option<u64>,
2526    /// A list of GMB accounts which are available to the merchant.
2527    #[serde(rename = "gmbAccounts")]
2528    pub gmb_accounts: Option<Vec<GmbAccountsGmbAccount>>,
2529    /// Identifies what kind of resource this is. Value: the fixed string "content#liasettingsGetAccessibleGmbAccountsResponse".
2530    pub kind: Option<String>,
2531}
2532
2533impl common::ResponseResult for LiasettingsGetAccessibleGmbAccountsResponse {}
2534
2535/// There is no detailed description.
2536///
2537/// # Activities
2538///
2539/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2540/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2541///
2542/// * [listposdataproviders liasettings](LiasettingListposdataproviderCall) (response)
2543#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2544#[serde_with::serde_as]
2545#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2546pub struct LiasettingsListPosDataProvidersResponse {
2547    /// Identifies what kind of resource this is. Value: the fixed string "content#liasettingsListPosDataProvidersResponse".
2548    pub kind: Option<String>,
2549    /// The list of POS data providers for each eligible country
2550    #[serde(rename = "posDataProviders")]
2551    pub pos_data_providers: Option<Vec<PosDataProviders>>,
2552}
2553
2554impl common::ResponseResult for LiasettingsListPosDataProvidersResponse {}
2555
2556/// There is no detailed description.
2557///
2558/// # Activities
2559///
2560/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2561/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2562///
2563/// * [list liasettings](LiasettingListCall) (response)
2564#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2565#[serde_with::serde_as]
2566#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2567pub struct LiasettingsListResponse {
2568    /// Identifies what kind of resource this is. Value: the fixed string "content#liasettingsListResponse".
2569    pub kind: Option<String>,
2570    /// The token for the retrieval of the next page of LIA settings.
2571    #[serde(rename = "nextPageToken")]
2572    pub next_page_token: Option<String>,
2573    /// no description provided
2574    pub resources: Option<Vec<LiaSettings>>,
2575}
2576
2577impl common::ResponseResult for LiasettingsListResponse {}
2578
2579/// There is no detailed description.
2580///
2581/// # Activities
2582///
2583/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2584/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2585///
2586/// * [requestgmbaccess liasettings](LiasettingRequestgmbaccesCall) (response)
2587#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2588#[serde_with::serde_as]
2589#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2590pub struct LiasettingsRequestGmbAccessResponse {
2591    /// Identifies what kind of resource this is. Value: the fixed string "content#liasettingsRequestGmbAccessResponse".
2592    pub kind: Option<String>,
2593}
2594
2595impl common::ResponseResult for LiasettingsRequestGmbAccessResponse {}
2596
2597/// There is no detailed description.
2598///
2599/// # Activities
2600///
2601/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2602/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2603///
2604/// * [requestinventoryverification liasettings](LiasettingRequestinventoryverificationCall) (response)
2605#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2606#[serde_with::serde_as]
2607#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2608pub struct LiasettingsRequestInventoryVerificationResponse {
2609    /// Identifies what kind of resource this is. Value: the fixed string "content#liasettingsRequestInventoryVerificationResponse".
2610    pub kind: Option<String>,
2611}
2612
2613impl common::ResponseResult for LiasettingsRequestInventoryVerificationResponse {}
2614
2615/// There is no detailed description.
2616///
2617/// # Activities
2618///
2619/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2620/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2621///
2622/// * [setinventoryverificationcontact liasettings](LiasettingSetinventoryverificationcontactCall) (response)
2623#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2624#[serde_with::serde_as]
2625#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2626pub struct LiasettingsSetInventoryVerificationContactResponse {
2627    /// Identifies what kind of resource this is. Value: the fixed string "content#liasettingsSetInventoryVerificationContactResponse".
2628    pub kind: Option<String>,
2629}
2630
2631impl common::ResponseResult for LiasettingsSetInventoryVerificationContactResponse {}
2632
2633/// There is no detailed description.
2634///
2635/// # Activities
2636///
2637/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2638/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2639///
2640/// * [setposdataprovider liasettings](LiasettingSetposdataproviderCall) (response)
2641#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2642#[serde_with::serde_as]
2643#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2644pub struct LiasettingsSetPosDataProviderResponse {
2645    /// Identifies what kind of resource this is. Value: the fixed string "content#liasettingsSetPosDataProviderResponse".
2646    pub kind: Option<String>,
2647}
2648
2649impl common::ResponseResult for LiasettingsSetPosDataProviderResponse {}
2650
2651/// There is no detailed description.
2652///
2653/// This type is not used in any activity, and only used as *part* of another schema.
2654///
2655#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2656#[serde_with::serde_as]
2657#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2658pub struct LocationIdSet {
2659    /// A non-empty list of location IDs. They must all be of the same location type (e.g., state).
2660    #[serde(rename = "locationIds")]
2661    pub location_ids: Option<Vec<String>>,
2662}
2663
2664impl common::Part for LocationIdSet {}
2665
2666/// There is no detailed description.
2667///
2668/// This type is not used in any activity, and only used as *part* of another schema.
2669///
2670#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2671#[serde_with::serde_as]
2672#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2673pub struct LoyaltyPoints {
2674    /// Name of loyalty points program. It is recommended to limit the name to 12 full-width characters or 24 Roman characters.
2675    pub name: Option<String>,
2676    /// The retailer's loyalty points in absolute value.
2677    #[serde(rename = "pointsValue")]
2678    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2679    pub points_value: Option<i64>,
2680    /// The ratio of a point when converted to currency. Google assumes currency based on Merchant Center settings. If ratio is left out, it defaults to 1.0.
2681    pub ratio: Option<f64>,
2682}
2683
2684impl common::Part for LoyaltyPoints {}
2685
2686/// Order return. Production access (all methods) requires the order manager role. Sandbox access does not.
2687///
2688/// # Activities
2689///
2690/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2691/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2692///
2693/// * [get orderreturns](OrderreturnGetCall) (response)
2694#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2695#[serde_with::serde_as]
2696#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2697pub struct MerchantOrderReturn {
2698    /// The date of creation of the return, in ISO 8601 format.
2699    #[serde(rename = "creationDate")]
2700    pub creation_date: Option<String>,
2701    /// Merchant defined order ID.
2702    #[serde(rename = "merchantOrderId")]
2703    pub merchant_order_id: Option<String>,
2704    /// Google order ID.
2705    #[serde(rename = "orderId")]
2706    pub order_id: Option<String>,
2707    /// Order return ID generated by Google.
2708    #[serde(rename = "orderReturnId")]
2709    pub order_return_id: Option<String>,
2710    /// Items of the return.
2711    #[serde(rename = "returnItems")]
2712    pub return_items: Option<Vec<MerchantOrderReturnItem>>,
2713    /// Shipments of the return.
2714    #[serde(rename = "returnShipments")]
2715    pub return_shipments: Option<Vec<ReturnShipment>>,
2716}
2717
2718impl common::ResponseResult for MerchantOrderReturn {}
2719
2720/// There is no detailed description.
2721///
2722/// This type is not used in any activity, and only used as *part* of another schema.
2723///
2724#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2725#[serde_with::serde_as]
2726#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2727pub struct MerchantOrderReturnItem {
2728    /// The reason that the customer chooses to return an item.
2729    #[serde(rename = "customerReturnReason")]
2730    pub customer_return_reason: Option<CustomerReturnReason>,
2731    /// Product level item ID. If the returned items are of the same product, they will have the same ID.
2732    #[serde(rename = "itemId")]
2733    pub item_id: Option<String>,
2734    /// The reason that merchant chooses to accept a return item.
2735    #[serde(rename = "merchantReturnReason")]
2736    pub merchant_return_reason: Option<RefundReason>,
2737    /// Product data from the time of the order placement.
2738    pub product: Option<OrderLineItemProduct>,
2739    /// IDs of the return shipments that this return item belongs to.
2740    #[serde(rename = "returnShipmentIds")]
2741    pub return_shipment_ids: Option<Vec<String>>,
2742    /// State of the item. Acceptable values are: - "`canceled`" - "`new`" - "`received`" - "`refunded`" - "`rejected`"
2743    pub state: Option<String>,
2744}
2745
2746impl common::Part for MerchantOrderReturnItem {}
2747
2748/// There is no detailed description.
2749///
2750/// This type is not used in any activity, and only used as *part* of another schema.
2751///
2752#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2753#[serde_with::serde_as]
2754#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2755pub struct MinimumOrderValueTable {
2756    /// no description provided
2757    #[serde(rename = "storeCodeSetWithMovs")]
2758    pub store_code_set_with_movs: Option<Vec<MinimumOrderValueTableStoreCodeSetWithMov>>,
2759}
2760
2761impl common::Part for MinimumOrderValueTable {}
2762
2763/// A list of store code sets sharing the same minimum order value. At least two sets are required and the last one must be empty, which signifies 'MOV for all other stores'. Each store code can only appear once across all the sets. All prices within a service must have the same currency.
2764///
2765/// This type is not used in any activity, and only used as *part* of another schema.
2766///
2767#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2768#[serde_with::serde_as]
2769#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2770pub struct MinimumOrderValueTableStoreCodeSetWithMov {
2771    /// A list of unique store codes or empty for the catch all.
2772    #[serde(rename = "storeCodes")]
2773    pub store_codes: Option<Vec<String>>,
2774    /// The minimum order value for the given stores.
2775    pub value: Option<Price>,
2776}
2777
2778impl common::Part for MinimumOrderValueTableStoreCodeSetWithMov {}
2779
2780/// Order. Production access (all methods) requires the order manager role. Sandbox access does not.
2781///
2782/// # Activities
2783///
2784/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2785/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2786///
2787/// * [acknowledge orders](OrderAcknowledgeCall) (none)
2788/// * [advancetestorder orders](OrderAdvancetestorderCall) (none)
2789/// * [cancel orders](OrderCancelCall) (none)
2790/// * [cancellineitem orders](OrderCancellineitemCall) (none)
2791/// * [canceltestorderbycustomer orders](OrderCanceltestorderbycustomerCall) (none)
2792/// * [createtestorder orders](OrderCreatetestorderCall) (none)
2793/// * [createtestreturn orders](OrderCreatetestreturnCall) (none)
2794/// * [custombatch orders](OrderCustombatchCall) (none)
2795/// * [get orders](OrderGetCall) (response)
2796/// * [getbymerchantorderid orders](OrderGetbymerchantorderidCall) (none)
2797/// * [gettestordertemplate orders](OrderGettestordertemplateCall) (none)
2798/// * [instorerefundlineitem orders](OrderInstorerefundlineitemCall) (none)
2799/// * [list orders](OrderListCall) (none)
2800/// * [refund orders](OrderRefundCall) (none)
2801/// * [rejectreturnlineitem orders](OrderRejectreturnlineitemCall) (none)
2802/// * [returnlineitem orders](OrderReturnlineitemCall) (none)
2803/// * [returnrefundlineitem orders](OrderReturnrefundlineitemCall) (none)
2804/// * [setlineitemmetadata orders](OrderSetlineitemmetadataCall) (none)
2805/// * [shiplineitems orders](OrderShiplineitemCall) (none)
2806/// * [updatelineitemshippingdetails orders](OrderUpdatelineitemshippingdetailCall) (none)
2807/// * [updatemerchantorderid orders](OrderUpdatemerchantorderidCall) (none)
2808/// * [updateshipment orders](OrderUpdateshipmentCall) (none)
2809#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2810#[serde_with::serde_as]
2811#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2812pub struct Order {
2813    /// Whether the order was acknowledged.
2814    pub acknowledged: Option<bool>,
2815    /// Deprecated. Acceptable values are: - "`googleExpress`" - "`purchasesOnGoogle`"
2816    #[serde(rename = "channelType")]
2817    pub channel_type: Option<String>,
2818    /// The details of the customer who placed the order.
2819    pub customer: Option<OrderCustomer>,
2820    /// Delivery details for shipments of type `delivery`.
2821    #[serde(rename = "deliveryDetails")]
2822    pub delivery_details: Option<OrderDeliveryDetails>,
2823    /// The REST ID of the order. Globally unique.
2824    pub id: Option<String>,
2825    /// Identifies what kind of resource this is. Value: the fixed string "`content#order`"
2826    pub kind: Option<String>,
2827    /// Line items that are ordered.
2828    #[serde(rename = "lineItems")]
2829    pub line_items: Option<Vec<OrderLineItem>>,
2830    /// no description provided
2831    #[serde(rename = "merchantId")]
2832    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2833    pub merchant_id: Option<u64>,
2834    /// Merchant-provided ID of the order.
2835    #[serde(rename = "merchantOrderId")]
2836    pub merchant_order_id: Option<String>,
2837    /// The net amount for the order. For example, if an order was originally for a grand total of $100 and a refund was issued for $20, the net amount will be $80.
2838    #[serde(rename = "netAmount")]
2839    pub net_amount: Option<Price>,
2840    /// The details of the payment method.
2841    #[serde(rename = "paymentMethod")]
2842    pub payment_method: Option<OrderPaymentMethod>,
2843    /// The status of the payment. Acceptable values are: - "`paymentCaptured`" - "`paymentRejected`" - "`paymentSecured`" - "`pendingAuthorization`"
2844    #[serde(rename = "paymentStatus")]
2845    pub payment_status: Option<String>,
2846    /// Pickup details for shipments of type `pickup`.
2847    #[serde(rename = "pickupDetails")]
2848    pub pickup_details: Option<OrderPickupDetails>,
2849    /// The date when the order was placed, in ISO 8601 format.
2850    #[serde(rename = "placedDate")]
2851    pub placed_date: Option<String>,
2852    /// The details of the merchant provided promotions applied to the order. To determine which promotions apply to which products, check the `Promotions[].Benefits[].OfferIds` field against the `LineItems[].Product.OfferId` field for each promotion. If a promotion is applied to more than 1 `offerId`, divide the discount value by the number of affected offers to determine how much discount to apply to each `offerId`. Examples: 1. To calculate the line item level discount for a single specific item: For each promotion, subtract the `Promotions[].Benefits[].Discount.value` amount from the `LineItems[].Price.value`. 2. To calculate the line item level discount for multiple quantity of a specific item: For each promotion, divide the `Promotions[].Benefits[].Discount.value` by the quantity of products and substract it from `LineItems[].Product.Price.value` for each quantity item. Only 1 promotion can be applied to an offerId in a given order. To refund an item which had a promotion applied to it, make sure to refund the amount after first subtracting the promotion discount from the item price. More details about the program are here.
2853    pub promotions: Option<Vec<OrderLegacyPromotion>>,
2854    /// Refunds for the order.
2855    pub refunds: Option<Vec<OrderRefund>>,
2856    /// Shipments of the order.
2857    pub shipments: Option<Vec<OrderShipment>>,
2858    /// The total cost of shipping for all items.
2859    #[serde(rename = "shippingCost")]
2860    pub shipping_cost: Option<Price>,
2861    /// The tax for the total shipping cost.
2862    #[serde(rename = "shippingCostTax")]
2863    pub shipping_cost_tax: Option<Price>,
2864    /// Deprecated. Shipping details are provided with line items instead. Acceptable values are: - "`economy`" - "`expedited`" - "`oneDay`" - "`sameDay`" - "`standard`" - "`twoDay`"
2865    #[serde(rename = "shippingOption")]
2866    pub shipping_option: Option<String>,
2867    /// The status of the order. Acceptable values are: - "`canceled`" - "`delivered`" - "`inProgress`" - "`partiallyDelivered`" - "`partiallyReturned`" - "`partiallyShipped`" - "`pendingShipment`" - "`returned`" - "`shipped`"
2868    pub status: Option<String>,
2869    /// The party responsible for collecting and remitting taxes. Acceptable values are: - "`marketplaceFacilitator`" - "`merchant`"
2870    #[serde(rename = "taxCollector")]
2871    pub tax_collector: Option<String>,
2872}
2873
2874impl common::Resource for Order {}
2875impl common::ResponseResult for Order {}
2876
2877/// There is no detailed description.
2878///
2879/// This type is not used in any activity, and only used as *part* of another schema.
2880///
2881#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2882#[serde_with::serde_as]
2883#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2884pub struct OrderAddress {
2885    /// CLDR country code (e.g. "US").
2886    pub country: Option<String>,
2887    /// Strings representing the lines of the printed label for mailing the order, for example: John Smith 1600 Amphitheatre Parkway Mountain View, CA, 94043 United States
2888    #[serde(rename = "fullAddress")]
2889    pub full_address: Option<Vec<String>>,
2890    /// Whether the address is a post office box.
2891    #[serde(rename = "isPostOfficeBox")]
2892    pub is_post_office_box: Option<bool>,
2893    /// City, town or commune. May also include dependent localities or sublocalities (e.g. neighborhoods or suburbs).
2894    pub locality: Option<String>,
2895    /// Postal Code or ZIP (e.g. "94043").
2896    #[serde(rename = "postalCode")]
2897    pub postal_code: Option<String>,
2898    /// Name of the recipient.
2899    #[serde(rename = "recipientName")]
2900    pub recipient_name: Option<String>,
2901    /// Top-level administrative subdivision of the country. For example, a state like California ("CA") or a province like Quebec ("QC").
2902    pub region: Option<String>,
2903    /// Street-level part of the address.
2904    #[serde(rename = "streetAddress")]
2905    pub street_address: Option<Vec<String>>,
2906}
2907
2908impl common::Part for OrderAddress {}
2909
2910/// There is no detailed description.
2911///
2912/// This type is not used in any activity, and only used as *part* of another schema.
2913///
2914#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2915#[serde_with::serde_as]
2916#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2917pub struct OrderCancellation {
2918    /// The actor that created the cancellation. Acceptable values are: - "`customer`" - "`googleBot`" - "`googleCustomerService`" - "`googlePayments`" - "`googleSabre`" - "`merchant`"
2919    pub actor: Option<String>,
2920    /// Date on which the cancellation has been created, in ISO 8601 format.
2921    #[serde(rename = "creationDate")]
2922    pub creation_date: Option<String>,
2923    /// The quantity that was canceled.
2924    pub quantity: Option<u32>,
2925    /// The reason for the cancellation. Orders that are canceled with a noInventory reason will lead to the removal of the product from Buy on Google until you make an update to that product. This will not affect your Shopping ads. Acceptable values are: - "`autoPostInternal`" - "`autoPostInvalidBillingAddress`" - "`autoPostNoInventory`" - "`autoPostPriceError`" - "`autoPostUndeliverableShippingAddress`" - "`couponAbuse`" - "`customerCanceled`" - "`customerInitiatedCancel`" - "`customerSupportRequested`" - "`failToPushOrderGoogleError`" - "`failToPushOrderMerchantError`" - "`failToPushOrderMerchantFulfillmentError`" - "`failToPushOrderToMerchant`" - "`failToPushOrderToMerchantOutOfStock`" - "`invalidCoupon`" - "`malformedShippingAddress`" - "`merchantDidNotShipOnTime`" - "`noInventory`" - "`orderTimeout`" - "`other`" - "`paymentAbuse`" - "`paymentDeclined`" - "`priceError`" - "`returnRefundAbuse`" - "`shippingPriceError`" - "`taxError`" - "`undeliverableShippingAddress`" - "`unsupportedPoBoxAddress`"
2926    pub reason: Option<String>,
2927    /// The explanation of the reason.
2928    #[serde(rename = "reasonText")]
2929    pub reason_text: Option<String>,
2930}
2931
2932impl common::Part for OrderCancellation {}
2933
2934/// There is no detailed description.
2935///
2936/// This type is not used in any activity, and only used as *part* of another schema.
2937///
2938#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2939#[serde_with::serde_as]
2940#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2941pub struct OrderCustomer {
2942    /// Deprecated.
2943    pub email: Option<String>,
2944    /// Deprecated. Please use marketingRightsInfo instead.
2945    #[serde(rename = "explicitMarketingPreference")]
2946    pub explicit_marketing_preference: Option<bool>,
2947    /// Full name of the customer.
2948    #[serde(rename = "fullName")]
2949    pub full_name: Option<String>,
2950    /// Email address for the merchant to send value-added tax or invoice documentation of the order. Only the last document sent is made available to the customer. For more information, see About automated VAT invoicing for Buy on Google.
2951    #[serde(rename = "invoiceReceivingEmail")]
2952    pub invoice_receiving_email: Option<String>,
2953    /// Customer's marketing preferences. Contains the marketing opt-in information that is current at the time that the merchant call. User preference selections can change from one order to the next so preferences must be checked with every order.
2954    #[serde(rename = "marketingRightsInfo")]
2955    pub marketing_rights_info: Option<OrderCustomerMarketingRightsInfo>,
2956}
2957
2958impl common::Part for OrderCustomer {}
2959
2960/// There is no detailed description.
2961///
2962/// This type is not used in any activity, and only used as *part* of another schema.
2963///
2964#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2965#[serde_with::serde_as]
2966#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2967pub struct OrderCustomerMarketingRightsInfo {
2968    /// Last known customer selection regarding marketing preferences. In certain cases this selection might not be known, so this field would be empty. If a customer selected `granted` in their most recent order, they can be subscribed to marketing emails. Customers who have chosen `denied` must not be subscribed, or must be unsubscribed if already opted-in. Acceptable values are: - "`denied`" - "`granted`"
2969    #[serde(rename = "explicitMarketingPreference")]
2970    pub explicit_marketing_preference: Option<String>,
2971    /// Timestamp when last time marketing preference was updated. Could be empty, if user wasn't offered a selection yet.
2972    #[serde(rename = "lastUpdatedTimestamp")]
2973    pub last_updated_timestamp: Option<String>,
2974    /// Email address that can be used for marketing purposes. The field may be empty even if `explicitMarketingPreference` is 'granted'. This happens when retrieving an old order from the customer who deleted their account.
2975    #[serde(rename = "marketingEmailAddress")]
2976    pub marketing_email_address: Option<String>,
2977}
2978
2979impl common::Part for OrderCustomerMarketingRightsInfo {}
2980
2981/// There is no detailed description.
2982///
2983/// This type is not used in any activity, and only used as *part* of another schema.
2984///
2985#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2986#[serde_with::serde_as]
2987#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2988pub struct OrderDeliveryDetails {
2989    /// The delivery address
2990    pub address: Option<OrderAddress>,
2991    /// The phone number of the person receiving the delivery.
2992    #[serde(rename = "phoneNumber")]
2993    pub phone_number: Option<String>,
2994}
2995
2996impl common::Part for OrderDeliveryDetails {}
2997
2998/// There is no detailed description.
2999///
3000/// This type is not used in any activity, and only used as *part* of another schema.
3001///
3002#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3003#[serde_with::serde_as]
3004#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3005pub struct OrderLegacyPromotion {
3006    /// no description provided
3007    pub benefits: Option<Vec<OrderLegacyPromotionBenefit>>,
3008    /// The date and time frame when the promotion is active and ready for validation review. Note that the promotion live time may be delayed for a few hours due to the validation review. Start date and end date are separated by a forward slash (/). The start date is specified by the format (YYYY-MM-DD), followed by the letter ?T?, the time of the day when the sale starts (in Greenwich Mean Time, GMT), followed by an expression of the time zone for the sale. The end date is in the same format.
3009    #[serde(rename = "effectiveDates")]
3010    pub effective_dates: Option<String>,
3011    /// Optional. The text code that corresponds to the promotion when applied on the retailer?s website.
3012    #[serde(rename = "genericRedemptionCode")]
3013    pub generic_redemption_code: Option<String>,
3014    /// The unique ID of the promotion.
3015    pub id: Option<String>,
3016    /// The full title of the promotion.
3017    #[serde(rename = "longTitle")]
3018    pub long_title: Option<String>,
3019    /// Whether the promotion is applicable to all products or only specific products. Acceptable values are: - "`allProducts`" - "`specificProducts`"
3020    #[serde(rename = "productApplicability")]
3021    pub product_applicability: Option<String>,
3022    /// Indicates that the promotion is valid online. Acceptable values are: - "`online`"
3023    #[serde(rename = "redemptionChannel")]
3024    pub redemption_channel: Option<String>,
3025}
3026
3027impl common::Part for OrderLegacyPromotion {}
3028
3029/// There is no detailed description.
3030///
3031/// This type is not used in any activity, and only used as *part* of another schema.
3032///
3033#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3034#[serde_with::serde_as]
3035#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3036pub struct OrderLegacyPromotionBenefit {
3037    /// The discount in the order price when the promotion is applied.
3038    pub discount: Option<Price>,
3039    /// The OfferId(s) that were purchased in this order and map to this specific benefit of the promotion.
3040    #[serde(rename = "offerIds")]
3041    pub offer_ids: Option<Vec<String>>,
3042    /// Further describes the benefit of the promotion. Note that we will expand on this enumeration as we support new promotion sub-types. Acceptable values are: - "`buyMGetMoneyOff`" - "`buyMGetNMoneyOff`" - "`buyMGetNPercentOff`" - "`buyMGetPercentOff`" - "`freeGift`" - "`freeGiftWithItemId`" - "`freeGiftWithValue`" - "`freeOvernightShipping`" - "`freeShipping`" - "`freeTwoDayShipping`" - "`moneyOff`" - "`percentageOff`" - "`rewardPoints`" - "`salePrice`"
3043    #[serde(rename = "subType")]
3044    pub sub_type: Option<String>,
3045    /// The impact on tax when the promotion is applied.
3046    #[serde(rename = "taxImpact")]
3047    pub tax_impact: Option<Price>,
3048    /// Describes whether the promotion applies to products (e.g. 20% off) or to shipping (e.g. Free Shipping). Acceptable values are: - "`product`" - "`shipping`"
3049    #[serde(rename = "type")]
3050    pub type_: Option<String>,
3051}
3052
3053impl common::Part for OrderLegacyPromotionBenefit {}
3054
3055/// There is no detailed description.
3056///
3057/// This type is not used in any activity, and only used as *part* of another schema.
3058///
3059#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3060#[serde_with::serde_as]
3061#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3062pub struct OrderLineItem {
3063    /// Annotations that are attached to the line item.
3064    pub annotations: Option<Vec<OrderMerchantProvidedAnnotation>>,
3065    /// Cancellations of the line item.
3066    pub cancellations: Option<Vec<OrderCancellation>>,
3067    /// The ID of the line item.
3068    pub id: Option<String>,
3069    /// Total price for the line item. For example, if two items for $10 are purchased, the total price will be $20.
3070    pub price: Option<Price>,
3071    /// Product data as seen by customer from the time of the order placement. Note that certain attributes values (e.g. title or gtin) might be reformatted and no longer match values submitted via product feed.
3072    pub product: Option<OrderLineItemProduct>,
3073    /// Number of items canceled.
3074    #[serde(rename = "quantityCanceled")]
3075    pub quantity_canceled: Option<u32>,
3076    /// Number of items delivered.
3077    #[serde(rename = "quantityDelivered")]
3078    pub quantity_delivered: Option<u32>,
3079    /// Number of items ordered.
3080    #[serde(rename = "quantityOrdered")]
3081    pub quantity_ordered: Option<u32>,
3082    /// Number of items pending.
3083    #[serde(rename = "quantityPending")]
3084    pub quantity_pending: Option<u32>,
3085    /// Number of items ready for pickup.
3086    #[serde(rename = "quantityReadyForPickup")]
3087    pub quantity_ready_for_pickup: Option<u32>,
3088    /// Number of items returned.
3089    #[serde(rename = "quantityReturned")]
3090    pub quantity_returned: Option<u32>,
3091    /// Number of items shipped.
3092    #[serde(rename = "quantityShipped")]
3093    pub quantity_shipped: Option<u32>,
3094    /// Details of the return policy for the line item.
3095    #[serde(rename = "returnInfo")]
3096    pub return_info: Option<OrderLineItemReturnInfo>,
3097    /// Returns of the line item.
3098    pub returns: Option<Vec<OrderReturn>>,
3099    /// Details of the requested shipping for the line item.
3100    #[serde(rename = "shippingDetails")]
3101    pub shipping_details: Option<OrderLineItemShippingDetails>,
3102    /// Total tax amount for the line item. For example, if two items are purchased, and each have a cost tax of $2, the total tax amount will be $4.
3103    pub tax: Option<Price>,
3104}
3105
3106impl common::Part for OrderLineItem {}
3107
3108/// There is no detailed description.
3109///
3110/// This type is not used in any activity, and only used as *part* of another schema.
3111///
3112#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3113#[serde_with::serde_as]
3114#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3115pub struct OrderLineItemProduct {
3116    /// Brand of the item.
3117    pub brand: Option<String>,
3118    /// The item's channel (online or local). Acceptable values are: - "`local`" - "`online`"
3119    pub channel: Option<String>,
3120    /// Condition or state of the item. Acceptable values are: - "`new`" - "`refurbished`" - "`used`"
3121    pub condition: Option<String>,
3122    /// The two-letter ISO 639-1 language code for the item.
3123    #[serde(rename = "contentLanguage")]
3124    pub content_language: Option<String>,
3125    /// Associated fees at order creation time.
3126    pub fees: Option<Vec<OrderLineItemProductFee>>,
3127    /// Global Trade Item Number (GTIN) of the item.
3128    pub gtin: Option<String>,
3129    /// The REST ID of the product.
3130    pub id: Option<String>,
3131    /// URL of an image of the item.
3132    #[serde(rename = "imageLink")]
3133    pub image_link: Option<String>,
3134    /// Shared identifier for all variants of the same product.
3135    #[serde(rename = "itemGroupId")]
3136    pub item_group_id: Option<String>,
3137    /// Manufacturer Part Number (MPN) of the item.
3138    pub mpn: Option<String>,
3139    /// An identifier of the item.
3140    #[serde(rename = "offerId")]
3141    pub offer_id: Option<String>,
3142    /// Price of the item.
3143    pub price: Option<Price>,
3144    /// URL to the cached image shown to the user when order was placed.
3145    #[serde(rename = "shownImage")]
3146    pub shown_image: Option<String>,
3147    /// The CLDR territory // code of the target country of the product.
3148    #[serde(rename = "targetCountry")]
3149    pub target_country: Option<String>,
3150    /// The title of the product.
3151    pub title: Option<String>,
3152    /// Variant attributes for the item. These are dimensions of the product, such as color, gender, material, pattern, and size. You can find a comprehensive list of variant attributes here.
3153    #[serde(rename = "variantAttributes")]
3154    pub variant_attributes: Option<Vec<OrderLineItemProductVariantAttribute>>,
3155}
3156
3157impl common::Part for OrderLineItemProduct {}
3158
3159/// There is no detailed description.
3160///
3161/// This type is not used in any activity, and only used as *part* of another schema.
3162///
3163#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3164#[serde_with::serde_as]
3165#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3166pub struct OrderLineItemProductFee {
3167    /// Amount of the fee.
3168    pub amount: Option<Price>,
3169    /// Name of the fee.
3170    pub name: Option<String>,
3171}
3172
3173impl common::Part for OrderLineItemProductFee {}
3174
3175/// There is no detailed description.
3176///
3177/// This type is not used in any activity, and only used as *part* of another schema.
3178///
3179#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3180#[serde_with::serde_as]
3181#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3182pub struct OrderLineItemProductVariantAttribute {
3183    /// The dimension of the variant.
3184    pub dimension: Option<String>,
3185    /// The value for the dimension.
3186    pub value: Option<String>,
3187}
3188
3189impl common::Part for OrderLineItemProductVariantAttribute {}
3190
3191/// There is no detailed description.
3192///
3193/// This type is not used in any activity, and only used as *part* of another schema.
3194///
3195#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3196#[serde_with::serde_as]
3197#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3198pub struct OrderLineItemReturnInfo {
3199    /// Required. How many days later the item can be returned.
3200    #[serde(rename = "daysToReturn")]
3201    pub days_to_return: Option<i32>,
3202    /// Required. Whether the item is returnable.
3203    #[serde(rename = "isReturnable")]
3204    pub is_returnable: Option<bool>,
3205    /// Required. URL of the item return policy.
3206    #[serde(rename = "policyUrl")]
3207    pub policy_url: Option<String>,
3208}
3209
3210impl common::Part for OrderLineItemReturnInfo {}
3211
3212/// There is no detailed description.
3213///
3214/// This type is not used in any activity, and only used as *part* of another schema.
3215///
3216#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3217#[serde_with::serde_as]
3218#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3219pub struct OrderLineItemShippingDetails {
3220    /// Required. The delivery by date, in ISO 8601 format.
3221    #[serde(rename = "deliverByDate")]
3222    pub deliver_by_date: Option<String>,
3223    /// Required. Details of the shipping method.
3224    pub method: Option<OrderLineItemShippingDetailsMethod>,
3225    /// Required. The ship by date, in ISO 8601 format.
3226    #[serde(rename = "shipByDate")]
3227    pub ship_by_date: Option<String>,
3228    /// Type of shipment. Indicates whether `deliveryDetails` or `pickupDetails` is applicable for this shipment. Acceptable values are: - "`delivery`" - "`pickup`"
3229    #[serde(rename = "type")]
3230    pub type_: Option<String>,
3231}
3232
3233impl common::Part for OrderLineItemShippingDetails {}
3234
3235/// There is no detailed description.
3236///
3237/// This type is not used in any activity, and only used as *part* of another schema.
3238///
3239#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3240#[serde_with::serde_as]
3241#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3242pub struct OrderLineItemShippingDetailsMethod {
3243    /// The carrier for the shipping. Optional. See `shipments[].carrier` for a list of acceptable values.
3244    pub carrier: Option<String>,
3245    /// Required. Maximum transit time.
3246    #[serde(rename = "maxDaysInTransit")]
3247    pub max_days_in_transit: Option<u32>,
3248    /// Required. The name of the shipping method.
3249    #[serde(rename = "methodName")]
3250    pub method_name: Option<String>,
3251    /// Required. Minimum transit time.
3252    #[serde(rename = "minDaysInTransit")]
3253    pub min_days_in_transit: Option<u32>,
3254}
3255
3256impl common::Part for OrderLineItemShippingDetailsMethod {}
3257
3258/// There is no detailed description.
3259///
3260/// This type is not used in any activity, and only used as *part* of another schema.
3261///
3262#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3263#[serde_with::serde_as]
3264#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3265pub struct OrderMerchantProvidedAnnotation {
3266    /// Key for additional merchant provided (as key-value pairs) annotation about the line item.
3267    pub key: Option<String>,
3268    /// Value for additional merchant provided (as key-value pairs) annotation about the line item.
3269    pub value: Option<String>,
3270}
3271
3272impl common::Part for OrderMerchantProvidedAnnotation {}
3273
3274/// There is no detailed description.
3275///
3276/// This type is not used in any activity, and only used as *part* of another schema.
3277///
3278#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3279#[serde_with::serde_as]
3280#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3281pub struct OrderPaymentMethod {
3282    /// The billing address.
3283    #[serde(rename = "billingAddress")]
3284    pub billing_address: Option<OrderAddress>,
3285    /// The card expiration month (January = 1, February = 2 etc.).
3286    #[serde(rename = "expirationMonth")]
3287    pub expiration_month: Option<i32>,
3288    /// The card expiration year (4-digit, e.g. 2015).
3289    #[serde(rename = "expirationYear")]
3290    pub expiration_year: Option<i32>,
3291    /// The last four digits of the card number.
3292    #[serde(rename = "lastFourDigits")]
3293    pub last_four_digits: Option<String>,
3294    /// The billing phone number.
3295    #[serde(rename = "phoneNumber")]
3296    pub phone_number: Option<String>,
3297    /// The type of instrument. Acceptable values are: - "`AMEX`" - "`DISCOVER`" - "`JCB`" - "`MASTERCARD`" - "`UNIONPAY`" - "`VISA`" - "``"
3298    #[serde(rename = "type")]
3299    pub type_: Option<String>,
3300}
3301
3302impl common::Part for OrderPaymentMethod {}
3303
3304/// There is no detailed description.
3305///
3306/// This type is not used in any activity, and only used as *part* of another schema.
3307///
3308#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3309#[serde_with::serde_as]
3310#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3311pub struct OrderPickupDetails {
3312    /// Address of the pickup location where the shipment should be sent. Note that `recipientName` in the address is the name of the business at the pickup location.
3313    pub address: Option<OrderAddress>,
3314    /// Collectors authorized to pick up shipment from the pickup location.
3315    pub collectors: Option<Vec<OrderPickupDetailsCollector>>,
3316    /// ID of the pickup location.
3317    #[serde(rename = "locationId")]
3318    pub location_id: Option<String>,
3319}
3320
3321impl common::Part for OrderPickupDetails {}
3322
3323/// There is no detailed description.
3324///
3325/// This type is not used in any activity, and only used as *part* of another schema.
3326///
3327#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3328#[serde_with::serde_as]
3329#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3330pub struct OrderPickupDetailsCollector {
3331    /// Name of the person picking up the shipment.
3332    pub name: Option<String>,
3333    /// Phone number of the person picking up the shipment.
3334    #[serde(rename = "phoneNumber")]
3335    pub phone_number: Option<String>,
3336}
3337
3338impl common::Part for OrderPickupDetailsCollector {}
3339
3340/// There is no detailed description.
3341///
3342/// This type is not used in any activity, and only used as *part* of another schema.
3343///
3344#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3345#[serde_with::serde_as]
3346#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3347pub struct OrderRefund {
3348    /// The actor that created the refund. Acceptable values are: - "`customer`" - "`googleBot`" - "`googleCustomerService`" - "`googlePayments`" - "`googleSabre`" - "`merchant`"
3349    pub actor: Option<String>,
3350    /// The amount that is refunded.
3351    pub amount: Option<Price>,
3352    /// Date on which the item has been created, in ISO 8601 format.
3353    #[serde(rename = "creationDate")]
3354    pub creation_date: Option<String>,
3355    /// The reason for the refund. Acceptable values are: - "`adjustment`" - "`autoPostInternal`" - "`autoPostInvalidBillingAddress`" - "`autoPostNoInventory`" - "`autoPostPriceError`" - "`autoPostUndeliverableShippingAddress`" - "`couponAbuse`" - "`courtesyAdjustment`" - "`customerCanceled`" - "`customerDiscretionaryReturn`" - "`customerInitiatedMerchantCancel`" - "`customerSupportRequested`" - "`deliveredLateByCarrier`" - "`deliveredTooLate`" - "`expiredItem`" - "`failToPushOrderGoogleError`" - "`failToPushOrderMerchantError`" - "`failToPushOrderMerchantFulfillmentError`" - "`failToPushOrderToMerchant`" - "`failToPushOrderToMerchantOutOfStock`" - "`feeAdjustment`" - "`invalidCoupon`" - "`lateShipmentCredit`" - "`malformedShippingAddress`" - "`merchantDidNotShipOnTime`" - "`noInventory`" - "`orderTimeout`" - "`other`" - "`paymentAbuse`" - "`paymentDeclined`" - "`priceAdjustment`" - "`priceError`" - "`productArrivedDamaged`" - "`productNotAsDescribed`" - "`promoReallocation`" - "`qualityNotAsExpected`" - "`returnRefundAbuse`" - "`shippingCostAdjustment`" - "`shippingPriceError`" - "`taxAdjustment`" - "`taxError`" - "`undeliverableShippingAddress`" - "`unsupportedPoBoxAddress`" - "`wrongProductShipped`"
3356    pub reason: Option<String>,
3357    /// The explanation of the reason.
3358    #[serde(rename = "reasonText")]
3359    pub reason_text: Option<String>,
3360}
3361
3362impl common::Part for OrderRefund {}
3363
3364/// Order disbursement. All methods require the payment analyst role.
3365///
3366/// This type is not used in any activity, and only used as *part* of another schema.
3367///
3368#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3369#[serde_with::serde_as]
3370#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3371pub struct OrderReportDisbursement {
3372    /// The disbursement amount.
3373    #[serde(rename = "disbursementAmount")]
3374    pub disbursement_amount: Option<Price>,
3375    /// The disbursement date, in ISO 8601 format.
3376    #[serde(rename = "disbursementCreationDate")]
3377    pub disbursement_creation_date: Option<String>,
3378    /// The date the disbursement was initiated, in ISO 8601 format.
3379    #[serde(rename = "disbursementDate")]
3380    pub disbursement_date: Option<String>,
3381    /// The ID of the disbursement.
3382    #[serde(rename = "disbursementId")]
3383    pub disbursement_id: Option<String>,
3384    /// The ID of the managing account.
3385    #[serde(rename = "merchantId")]
3386    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3387    pub merchant_id: Option<u64>,
3388}
3389
3390impl common::Part for OrderReportDisbursement {}
3391
3392/// There is no detailed description.
3393///
3394/// This type is not used in any activity, and only used as *part* of another schema.
3395///
3396#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3397#[serde_with::serde_as]
3398#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3399pub struct OrderReportTransaction {
3400    /// The disbursement amount.
3401    #[serde(rename = "disbursementAmount")]
3402    pub disbursement_amount: Option<Price>,
3403    /// The date the disbursement was created, in ISO 8601 format.
3404    #[serde(rename = "disbursementCreationDate")]
3405    pub disbursement_creation_date: Option<String>,
3406    /// The date the disbursement was initiated, in ISO 8601 format.
3407    #[serde(rename = "disbursementDate")]
3408    pub disbursement_date: Option<String>,
3409    /// The ID of the disbursement.
3410    #[serde(rename = "disbursementId")]
3411    pub disbursement_id: Option<String>,
3412    /// The ID of the managing account.
3413    #[serde(rename = "merchantId")]
3414    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3415    pub merchant_id: Option<u64>,
3416    /// Merchant-provided ID of the order.
3417    #[serde(rename = "merchantOrderId")]
3418    pub merchant_order_id: Option<String>,
3419    /// The ID of the order.
3420    #[serde(rename = "orderId")]
3421    pub order_id: Option<String>,
3422    /// Total amount for the items.
3423    #[serde(rename = "productAmount")]
3424    pub product_amount: Option<Amount>,
3425    /// Total amount with remitted tax for the items.
3426    #[serde(rename = "productAmountWithRemittedTax")]
3427    pub product_amount_with_remitted_tax: Option<ProductAmount>,
3428    /// The date of the transaction, in ISO 8601 format.
3429    #[serde(rename = "transactionDate")]
3430    pub transaction_date: Option<String>,
3431}
3432
3433impl common::Part for OrderReportTransaction {}
3434
3435/// There is no detailed description.
3436///
3437/// This type is not used in any activity, and only used as *part* of another schema.
3438///
3439#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3440#[serde_with::serde_as]
3441#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3442pub struct OrderReturn {
3443    /// The actor that created the refund. Acceptable values are: - "`customer`" - "`googleBot`" - "`googleCustomerService`" - "`googlePayments`" - "`googleSabre`" - "`merchant`"
3444    pub actor: Option<String>,
3445    /// Date on which the item has been created, in ISO 8601 format.
3446    #[serde(rename = "creationDate")]
3447    pub creation_date: Option<String>,
3448    /// Quantity that is returned.
3449    pub quantity: Option<u32>,
3450    /// The reason for the return. Acceptable values are: - "`customerDiscretionaryReturn`" - "`customerInitiatedMerchantCancel`" - "`deliveredTooLate`" - "`expiredItem`" - "`invalidCoupon`" - "`malformedShippingAddress`" - "`other`" - "`productArrivedDamaged`" - "`productNotAsDescribed`" - "`qualityNotAsExpected`" - "`undeliverableShippingAddress`" - "`unsupportedPoBoxAddress`" - "`wrongProductShipped`"
3451    pub reason: Option<String>,
3452    /// The explanation of the reason.
3453    #[serde(rename = "reasonText")]
3454    pub reason_text: Option<String>,
3455}
3456
3457impl common::Part for OrderReturn {}
3458
3459/// There is no detailed description.
3460///
3461/// This type is not used in any activity, and only used as *part* of another schema.
3462///
3463#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3464#[serde_with::serde_as]
3465#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3466pub struct OrderShipment {
3467    /// The carrier handling the shipment. For supported carriers, Google includes the carrier name and tracking URL in emails to customers. For select supported carriers, Google also automatically updates the shipment status based on the provided shipment ID. *Note:* You can also use unsupported carriers, but emails to customers will not include the carrier name or tracking URL, and there will be no automatic order status updates. Supported carriers for US are: - "`ups`" (United Parcel Service) *automatic status updates* - "`usps`" (United States Postal Service) *automatic status updates* - "`fedex`" (FedEx) *automatic status updates * - "`dhl`" (DHL eCommerce) *automatic status updates* (US only) - "`ontrac`" (OnTrac) *automatic status updates * - "`dhl express`" (DHL Express) - "`deliv`" (Deliv) - "`dynamex`" (TForce) - "`lasership`" (LaserShip) - "`mpx`" (Military Parcel Xpress) - "`uds`" (United Delivery Service) - "`efw`" (Estes Forwarding Worldwide) - "`jd logistics`" (JD Logistics) - "`yunexpress`" (YunExpress) - "`china post`" (China Post) - "`china ems`" (China Post Express Mail Service) - "`singapore post`" (Singapore Post) - "`pos malaysia`" (Pos Malaysia) - "`postnl`" (PostNL) - "`ptt`" (PTT Turkish Post) - "`eub`" (ePacket) - "`chukou1`" (Chukou1 Logistics) - "`bestex`" (Best Express) - "`canada post`" (Canada Post) - "`purolator`" (Purolator) - "`canpar`" (Canpar) - "`india post`" (India Post) - "`blue dart`" (Blue Dart) - "`delhivery`" (Delhivery) - "`dtdc`" (DTDC) - "`tpc india`" (TPC India) Supported carriers for FR are: - "`la poste`" (La Poste) *automatic status updates * - "`colissimo`" (Colissimo by La Poste) *automatic status updates* - "`ups`" (United Parcel Service) *automatic status updates * - "`chronopost`" (Chronopost by La Poste) - "`gls`" (General Logistics Systems France) - "`dpd`" (DPD Group by GeoPost) - "`bpost`" (Belgian Post Group) - "`colis prive`" (Colis Privé) - "`boxtal`" (Boxtal) - "`geodis`" (GEODIS) - "`tnt`" (TNT) - "`db schenker`" (DB Schenker) - "`aramex`" (Aramex)
3468    pub carrier: Option<String>,
3469    /// Date on which the shipment has been created, in ISO 8601 format.
3470    #[serde(rename = "creationDate")]
3471    pub creation_date: Option<String>,
3472    /// Date on which the shipment has been delivered, in ISO 8601 format. Present only if `status` is `delivered`
3473    #[serde(rename = "deliveryDate")]
3474    pub delivery_date: Option<String>,
3475    /// The ID of the shipment.
3476    pub id: Option<String>,
3477    /// The line items that are shipped.
3478    #[serde(rename = "lineItems")]
3479    pub line_items: Option<Vec<OrderShipmentLineItemShipment>>,
3480    /// Delivery details of the shipment if scheduling is needed.
3481    #[serde(rename = "scheduledDeliveryDetails")]
3482    pub scheduled_delivery_details: Option<OrderShipmentScheduledDeliveryDetails>,
3483    /// The status of the shipment. Acceptable values are: - "`delivered`" - "`readyForPickup`" - "`shipped`" - "`undeliverable`"
3484    pub status: Option<String>,
3485    /// The tracking ID for the shipment.
3486    #[serde(rename = "trackingId")]
3487    pub tracking_id: Option<String>,
3488}
3489
3490impl common::Part for OrderShipment {}
3491
3492/// There is no detailed description.
3493///
3494/// This type is not used in any activity, and only used as *part* of another schema.
3495///
3496#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3497#[serde_with::serde_as]
3498#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3499pub struct OrderShipmentLineItemShipment {
3500    /// The ID of the line item that is shipped. This value is assigned by Google when an order is created. Either lineItemId or productId is required.
3501    #[serde(rename = "lineItemId")]
3502    pub line_item_id: Option<String>,
3503    /// The ID of the product to ship. This is the REST ID used in the products service. Either lineItemId or productId is required.
3504    #[serde(rename = "productId")]
3505    pub product_id: Option<String>,
3506    /// The quantity that is shipped.
3507    pub quantity: Option<u32>,
3508}
3509
3510impl common::Part for OrderShipmentLineItemShipment {}
3511
3512/// There is no detailed description.
3513///
3514/// This type is not used in any activity, and only used as *part* of another schema.
3515///
3516#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3517#[serde_with::serde_as]
3518#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3519pub struct OrderShipmentScheduledDeliveryDetails {
3520    /// The phone number of the carrier fulfilling the delivery. The phone number is formatted as the international notation in ITU-T Recommendation E.123 (e.g., "+41 44 668 1800").
3521    #[serde(rename = "carrierPhoneNumber")]
3522    pub carrier_phone_number: Option<String>,
3523    /// The date a shipment is scheduled for delivery, in ISO 8601 format.
3524    #[serde(rename = "scheduledDate")]
3525    pub scheduled_date: Option<String>,
3526}
3527
3528impl common::Part for OrderShipmentScheduledDeliveryDetails {}
3529
3530/// There is no detailed description.
3531///
3532/// # Activities
3533///
3534/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3535/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3536///
3537/// * [createchargeinvoice orderinvoices](OrderinvoiceCreatechargeinvoiceCall) (request)
3538#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3539#[serde_with::serde_as]
3540#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3541pub struct OrderinvoicesCreateChargeInvoiceRequest {
3542    /// [required] The ID of the invoice.
3543    #[serde(rename = "invoiceId")]
3544    pub invoice_id: Option<String>,
3545    /// [required] Invoice summary.
3546    #[serde(rename = "invoiceSummary")]
3547    pub invoice_summary: Option<InvoiceSummary>,
3548    /// [required] Invoice details per line item.
3549    #[serde(rename = "lineItemInvoices")]
3550    pub line_item_invoices: Option<Vec<ShipmentInvoiceLineItemInvoice>>,
3551    /// [required] The ID of the operation, unique across all operations for a given order.
3552    #[serde(rename = "operationId")]
3553    pub operation_id: Option<String>,
3554    /// [required] ID of the shipment group. It is assigned by the merchant in the `shipLineItems` method and is used to group multiple line items that have the same kind of shipping charges.
3555    #[serde(rename = "shipmentGroupId")]
3556    pub shipment_group_id: Option<String>,
3557}
3558
3559impl common::RequestValue for OrderinvoicesCreateChargeInvoiceRequest {}
3560
3561/// There is no detailed description.
3562///
3563/// # Activities
3564///
3565/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3566/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3567///
3568/// * [createchargeinvoice orderinvoices](OrderinvoiceCreatechargeinvoiceCall) (response)
3569#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3570#[serde_with::serde_as]
3571#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3572pub struct OrderinvoicesCreateChargeInvoiceResponse {
3573    /// The status of the execution. Acceptable values are: - "`duplicate`" - "`executed`"
3574    #[serde(rename = "executionStatus")]
3575    pub execution_status: Option<String>,
3576    /// Identifies what kind of resource this is. Value: the fixed string "content#orderinvoicesCreateChargeInvoiceResponse".
3577    pub kind: Option<String>,
3578}
3579
3580impl common::ResponseResult for OrderinvoicesCreateChargeInvoiceResponse {}
3581
3582/// There is no detailed description.
3583///
3584/// # Activities
3585///
3586/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3587/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3588///
3589/// * [createrefundinvoice orderinvoices](OrderinvoiceCreaterefundinvoiceCall) (request)
3590#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3591#[serde_with::serde_as]
3592#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3593pub struct OrderinvoicesCreateRefundInvoiceRequest {
3594    /// [required] The ID of the invoice.
3595    #[serde(rename = "invoiceId")]
3596    pub invoice_id: Option<String>,
3597    /// [required] The ID of the operation, unique across all operations for a given order.
3598    #[serde(rename = "operationId")]
3599    pub operation_id: Option<String>,
3600    /// Option to create a refund-only invoice. Exactly one of `refundOnlyOption` or `returnOption` must be provided.
3601    #[serde(rename = "refundOnlyOption")]
3602    pub refund_only_option:
3603        Option<OrderinvoicesCustomBatchRequestEntryCreateRefundInvoiceRefundOption>,
3604    /// Option to create an invoice for a refund and mark all items within the invoice as returned. Exactly one of `refundOnlyOption` or `returnOption` must be provided.
3605    #[serde(rename = "returnOption")]
3606    pub return_option: Option<OrderinvoicesCustomBatchRequestEntryCreateRefundInvoiceReturnOption>,
3607    /// Invoice details for different shipment groups.
3608    #[serde(rename = "shipmentInvoices")]
3609    pub shipment_invoices: Option<Vec<ShipmentInvoice>>,
3610}
3611
3612impl common::RequestValue for OrderinvoicesCreateRefundInvoiceRequest {}
3613
3614/// There is no detailed description.
3615///
3616/// # Activities
3617///
3618/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3619/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3620///
3621/// * [createrefundinvoice orderinvoices](OrderinvoiceCreaterefundinvoiceCall) (response)
3622#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3623#[serde_with::serde_as]
3624#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3625pub struct OrderinvoicesCreateRefundInvoiceResponse {
3626    /// The status of the execution. Acceptable values are: - "`duplicate`" - "`executed`"
3627    #[serde(rename = "executionStatus")]
3628    pub execution_status: Option<String>,
3629    /// Identifies what kind of resource this is. Value: the fixed string "content#orderinvoicesCreateRefundInvoiceResponse".
3630    pub kind: Option<String>,
3631}
3632
3633impl common::ResponseResult for OrderinvoicesCreateRefundInvoiceResponse {}
3634
3635/// There is no detailed description.
3636///
3637/// This type is not used in any activity, and only used as *part* of another schema.
3638///
3639#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3640#[serde_with::serde_as]
3641#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3642pub struct OrderinvoicesCustomBatchRequestEntryCreateRefundInvoiceRefundOption {
3643    /// Optional description of the refund reason.
3644    pub description: Option<String>,
3645    /// [required] Reason for the refund. Acceptable values are: - "`adjustment`" - "`autoPostInternal`" - "`autoPostInvalidBillingAddress`" - "`autoPostNoInventory`" - "`autoPostPriceError`" - "`autoPostUndeliverableShippingAddress`" - "`couponAbuse`" - "`courtesyAdjustment`" - "`customerCanceled`" - "`customerDiscretionaryReturn`" - "`customerInitiatedMerchantCancel`" - "`customerSupportRequested`" - "`deliveredLateByCarrier`" - "`deliveredTooLate`" - "`expiredItem`" - "`failToPushOrderGoogleError`" - "`failToPushOrderMerchantError`" - "`failToPushOrderMerchantFulfillmentError`" - "`failToPushOrderToMerchant`" - "`failToPushOrderToMerchantOutOfStock`" - "`feeAdjustment`" - "`invalidCoupon`" - "`lateShipmentCredit`" - "`malformedShippingAddress`" - "`merchantDidNotShipOnTime`" - "`noInventory`" - "`orderTimeout`" - "`other`" - "`paymentAbuse`" - "`paymentDeclined`" - "`priceAdjustment`" - "`priceError`" - "`productArrivedDamaged`" - "`productNotAsDescribed`" - "`promoReallocation`" - "`qualityNotAsExpected`" - "`returnRefundAbuse`" - "`shippingCostAdjustment`" - "`shippingPriceError`" - "`taxAdjustment`" - "`taxError`" - "`undeliverableShippingAddress`" - "`unsupportedPoBoxAddress`" - "`wrongProductShipped`"
3646    pub reason: Option<String>,
3647}
3648
3649impl common::Part for OrderinvoicesCustomBatchRequestEntryCreateRefundInvoiceRefundOption {}
3650
3651/// There is no detailed description.
3652///
3653/// This type is not used in any activity, and only used as *part* of another schema.
3654///
3655#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3656#[serde_with::serde_as]
3657#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3658pub struct OrderinvoicesCustomBatchRequestEntryCreateRefundInvoiceReturnOption {
3659    /// Optional description of the return reason.
3660    pub description: Option<String>,
3661    /// [required] Reason for the return. Acceptable values are: - "`customerDiscretionaryReturn`" - "`customerInitiatedMerchantCancel`" - "`deliveredTooLate`" - "`expiredItem`" - "`invalidCoupon`" - "`malformedShippingAddress`" - "`other`" - "`productArrivedDamaged`" - "`productNotAsDescribed`" - "`qualityNotAsExpected`" - "`undeliverableShippingAddress`" - "`unsupportedPoBoxAddress`" - "`wrongProductShipped`"
3662    pub reason: Option<String>,
3663}
3664
3665impl common::Part for OrderinvoicesCustomBatchRequestEntryCreateRefundInvoiceReturnOption {}
3666
3667/// There is no detailed description.
3668///
3669/// # Activities
3670///
3671/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3672/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3673///
3674/// * [listdisbursements orderreports](OrderreportListdisbursementCall) (response)
3675#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3676#[serde_with::serde_as]
3677#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3678pub struct OrderreportsListDisbursementsResponse {
3679    /// The list of disbursements.
3680    pub disbursements: Option<Vec<OrderReportDisbursement>>,
3681    /// Identifies what kind of resource this is. Value: the fixed string "content#orderreportsListDisbursementsResponse".
3682    pub kind: Option<String>,
3683    /// The token for the retrieval of the next page of disbursements.
3684    #[serde(rename = "nextPageToken")]
3685    pub next_page_token: Option<String>,
3686}
3687
3688impl common::ResponseResult for OrderreportsListDisbursementsResponse {}
3689
3690/// There is no detailed description.
3691///
3692/// # Activities
3693///
3694/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3695/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3696///
3697/// * [listtransactions orderreports](OrderreportListtransactionCall) (response)
3698#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3699#[serde_with::serde_as]
3700#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3701pub struct OrderreportsListTransactionsResponse {
3702    /// Identifies what kind of resource this is. Value: the fixed string "content#orderreportsListTransactionsResponse".
3703    pub kind: Option<String>,
3704    /// The token for the retrieval of the next page of transactions.
3705    #[serde(rename = "nextPageToken")]
3706    pub next_page_token: Option<String>,
3707    /// The list of transactions.
3708    pub transactions: Option<Vec<OrderReportTransaction>>,
3709}
3710
3711impl common::ResponseResult for OrderreportsListTransactionsResponse {}
3712
3713/// There is no detailed description.
3714///
3715/// # Activities
3716///
3717/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3718/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3719///
3720/// * [list orderreturns](OrderreturnListCall) (response)
3721#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3722#[serde_with::serde_as]
3723#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3724pub struct OrderreturnsListResponse {
3725    /// Identifies what kind of resource this is. Value: the fixed string "content#orderreturnsListResponse".
3726    pub kind: Option<String>,
3727    /// The token for the retrieval of the next page of returns.
3728    #[serde(rename = "nextPageToken")]
3729    pub next_page_token: Option<String>,
3730    /// no description provided
3731    pub resources: Option<Vec<MerchantOrderReturn>>,
3732}
3733
3734impl common::ResponseResult for OrderreturnsListResponse {}
3735
3736/// There is no detailed description.
3737///
3738/// # Activities
3739///
3740/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3741/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3742///
3743/// * [acknowledge orders](OrderAcknowledgeCall) (request)
3744#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3745#[serde_with::serde_as]
3746#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3747pub struct OrdersAcknowledgeRequest {
3748    /// The ID of the operation. Unique across all operations for a given order.
3749    #[serde(rename = "operationId")]
3750    pub operation_id: Option<String>,
3751}
3752
3753impl common::RequestValue for OrdersAcknowledgeRequest {}
3754
3755/// There is no detailed description.
3756///
3757/// # Activities
3758///
3759/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3760/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3761///
3762/// * [acknowledge orders](OrderAcknowledgeCall) (response)
3763#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3764#[serde_with::serde_as]
3765#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3766pub struct OrdersAcknowledgeResponse {
3767    /// The status of the execution. Acceptable values are: - "`duplicate`" - "`executed`"
3768    #[serde(rename = "executionStatus")]
3769    pub execution_status: Option<String>,
3770    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersAcknowledgeResponse".
3771    pub kind: Option<String>,
3772}
3773
3774impl common::ResponseResult for OrdersAcknowledgeResponse {}
3775
3776/// There is no detailed description.
3777///
3778/// # Activities
3779///
3780/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3781/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3782///
3783/// * [advancetestorder orders](OrderAdvancetestorderCall) (response)
3784#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3785#[serde_with::serde_as]
3786#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3787pub struct OrdersAdvanceTestOrderResponse {
3788    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersAdvanceTestOrderResponse".
3789    pub kind: Option<String>,
3790}
3791
3792impl common::ResponseResult for OrdersAdvanceTestOrderResponse {}
3793
3794/// There is no detailed description.
3795///
3796/// # Activities
3797///
3798/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3799/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3800///
3801/// * [cancellineitem orders](OrderCancellineitemCall) (request)
3802#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3803#[serde_with::serde_as]
3804#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3805pub struct OrdersCancelLineItemRequest {
3806    /// Deprecated. Please use amountPretax and amountTax instead.
3807    pub amount: Option<Price>,
3808    /// Amount to refund for the cancelation. Optional. If not set, Google will calculate the default based on the price and tax of the items involved. The amount must not be larger than the net amount left on the order.
3809    #[serde(rename = "amountPretax")]
3810    pub amount_pretax: Option<Price>,
3811    /// Tax amount that corresponds to cancellation amount in amountPretax. Optional, but if filled, then amountPretax must be set. Calculated automatically if not provided.
3812    #[serde(rename = "amountTax")]
3813    pub amount_tax: Option<Price>,
3814    /// The ID of the line item to cancel. Either lineItemId or productId is required.
3815    #[serde(rename = "lineItemId")]
3816    pub line_item_id: Option<String>,
3817    /// The ID of the operation. Unique across all operations for a given order.
3818    #[serde(rename = "operationId")]
3819    pub operation_id: Option<String>,
3820    /// The ID of the product to cancel. This is the REST ID used in the products service. Either lineItemId or productId is required.
3821    #[serde(rename = "productId")]
3822    pub product_id: Option<String>,
3823    /// The quantity to cancel.
3824    pub quantity: Option<u32>,
3825    /// The reason for the cancellation. Acceptable values are: - "`customerInitiatedCancel`" - "`invalidCoupon`" - "`malformedShippingAddress`" - "`noInventory`" - "`other`" - "`priceError`" - "`shippingPriceError`" - "`taxError`" - "`undeliverableShippingAddress`" - "`unsupportedPoBoxAddress`"
3826    pub reason: Option<String>,
3827    /// The explanation of the reason.
3828    #[serde(rename = "reasonText")]
3829    pub reason_text: Option<String>,
3830}
3831
3832impl common::RequestValue for OrdersCancelLineItemRequest {}
3833
3834/// There is no detailed description.
3835///
3836/// # Activities
3837///
3838/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3839/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3840///
3841/// * [cancellineitem orders](OrderCancellineitemCall) (response)
3842#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3843#[serde_with::serde_as]
3844#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3845pub struct OrdersCancelLineItemResponse {
3846    /// The status of the execution. Acceptable values are: - "`duplicate`" - "`executed`"
3847    #[serde(rename = "executionStatus")]
3848    pub execution_status: Option<String>,
3849    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersCancelLineItemResponse".
3850    pub kind: Option<String>,
3851}
3852
3853impl common::ResponseResult for OrdersCancelLineItemResponse {}
3854
3855/// There is no detailed description.
3856///
3857/// # Activities
3858///
3859/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3860/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3861///
3862/// * [cancel orders](OrderCancelCall) (request)
3863#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3864#[serde_with::serde_as]
3865#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3866pub struct OrdersCancelRequest {
3867    /// The ID of the operation. Unique across all operations for a given order.
3868    #[serde(rename = "operationId")]
3869    pub operation_id: Option<String>,
3870    /// The reason for the cancellation. Acceptable values are: - "`customerInitiatedCancel`" - "`invalidCoupon`" - "`malformedShippingAddress`" - "`noInventory`" - "`other`" - "`priceError`" - "`shippingPriceError`" - "`taxError`" - "`undeliverableShippingAddress`" - "`unsupportedPoBoxAddress`"
3871    pub reason: Option<String>,
3872    /// The explanation of the reason.
3873    #[serde(rename = "reasonText")]
3874    pub reason_text: Option<String>,
3875}
3876
3877impl common::RequestValue for OrdersCancelRequest {}
3878
3879/// There is no detailed description.
3880///
3881/// # Activities
3882///
3883/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3884/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3885///
3886/// * [cancel orders](OrderCancelCall) (response)
3887#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3888#[serde_with::serde_as]
3889#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3890pub struct OrdersCancelResponse {
3891    /// The status of the execution. Acceptable values are: - "`duplicate`" - "`executed`"
3892    #[serde(rename = "executionStatus")]
3893    pub execution_status: Option<String>,
3894    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersCancelResponse".
3895    pub kind: Option<String>,
3896}
3897
3898impl common::ResponseResult for OrdersCancelResponse {}
3899
3900/// There is no detailed description.
3901///
3902/// # Activities
3903///
3904/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3905/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3906///
3907/// * [canceltestorderbycustomer orders](OrderCanceltestorderbycustomerCall) (request)
3908#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3909#[serde_with::serde_as]
3910#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3911pub struct OrdersCancelTestOrderByCustomerRequest {
3912    /// The reason for the cancellation. Acceptable values are: - "`changedMind`" - "`orderedWrongItem`" - "`other`"
3913    pub reason: Option<String>,
3914}
3915
3916impl common::RequestValue for OrdersCancelTestOrderByCustomerRequest {}
3917
3918/// There is no detailed description.
3919///
3920/// # Activities
3921///
3922/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3923/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3924///
3925/// * [canceltestorderbycustomer orders](OrderCanceltestorderbycustomerCall) (response)
3926#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3927#[serde_with::serde_as]
3928#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3929pub struct OrdersCancelTestOrderByCustomerResponse {
3930    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersCancelTestOrderByCustomerResponse".
3931    pub kind: Option<String>,
3932}
3933
3934impl common::ResponseResult for OrdersCancelTestOrderByCustomerResponse {}
3935
3936/// There is no detailed description.
3937///
3938/// # Activities
3939///
3940/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3941/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3942///
3943/// * [createtestorder orders](OrderCreatetestorderCall) (request)
3944#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3945#[serde_with::serde_as]
3946#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3947pub struct OrdersCreateTestOrderRequest {
3948    /// The CLDR territory code of the country of the test order to create. Affects the currency and addresses of orders created via `template_name`, or the addresses of orders created via `test_order`. Acceptable values are: - "`US`" - "`FR`" Defaults to `US`.
3949    pub country: Option<String>,
3950    /// The test order template to use. Specify as an alternative to `testOrder` as a shortcut for retrieving a template and then creating an order using that template. Acceptable values are: - "`template1`" - "`template1a`" - "`template1b`" - "`template2`" - "`template3`"
3951    #[serde(rename = "templateName")]
3952    pub template_name: Option<String>,
3953    /// The test order to create.
3954    #[serde(rename = "testOrder")]
3955    pub test_order: Option<TestOrder>,
3956}
3957
3958impl common::RequestValue for OrdersCreateTestOrderRequest {}
3959
3960/// There is no detailed description.
3961///
3962/// # Activities
3963///
3964/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3965/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3966///
3967/// * [createtestorder orders](OrderCreatetestorderCall) (response)
3968#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3969#[serde_with::serde_as]
3970#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3971pub struct OrdersCreateTestOrderResponse {
3972    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersCreateTestOrderResponse".
3973    pub kind: Option<String>,
3974    /// The ID of the newly created test order.
3975    #[serde(rename = "orderId")]
3976    pub order_id: Option<String>,
3977}
3978
3979impl common::ResponseResult for OrdersCreateTestOrderResponse {}
3980
3981/// There is no detailed description.
3982///
3983/// # Activities
3984///
3985/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3986/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3987///
3988/// * [createtestreturn orders](OrderCreatetestreturnCall) (request)
3989#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3990#[serde_with::serde_as]
3991#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3992pub struct OrdersCreateTestReturnRequest {
3993    /// Returned items.
3994    pub items: Option<Vec<OrdersCustomBatchRequestEntryCreateTestReturnReturnItem>>,
3995}
3996
3997impl common::RequestValue for OrdersCreateTestReturnRequest {}
3998
3999/// There is no detailed description.
4000///
4001/// # Activities
4002///
4003/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4004/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4005///
4006/// * [createtestreturn orders](OrderCreatetestreturnCall) (response)
4007#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4008#[serde_with::serde_as]
4009#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4010pub struct OrdersCreateTestReturnResponse {
4011    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersCreateTestReturnResponse".
4012    pub kind: Option<String>,
4013    /// The ID of the newly created test order return.
4014    #[serde(rename = "returnId")]
4015    pub return_id: Option<String>,
4016}
4017
4018impl common::ResponseResult for OrdersCreateTestReturnResponse {}
4019
4020/// There is no detailed description.
4021///
4022/// # Activities
4023///
4024/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4025/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4026///
4027/// * [custombatch orders](OrderCustombatchCall) (request)
4028#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4029#[serde_with::serde_as]
4030#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4031pub struct OrdersCustomBatchRequest {
4032    /// The request entries to be processed in the batch.
4033    pub entries: Option<Vec<OrdersCustomBatchRequestEntry>>,
4034}
4035
4036impl common::RequestValue for OrdersCustomBatchRequest {}
4037
4038/// There is no detailed description.
4039///
4040/// This type is not used in any activity, and only used as *part* of another schema.
4041///
4042#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4043#[serde_with::serde_as]
4044#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4045pub struct OrdersCustomBatchRequestEntry {
4046    /// An entry ID, unique within the batch request.
4047    #[serde(rename = "batchId")]
4048    pub batch_id: Option<u32>,
4049    /// Required for `cancel` method.
4050    pub cancel: Option<OrdersCustomBatchRequestEntryCancel>,
4051    /// Required for `cancelLineItem` method.
4052    #[serde(rename = "cancelLineItem")]
4053    pub cancel_line_item: Option<OrdersCustomBatchRequestEntryCancelLineItem>,
4054    /// Required for `inStoreReturnLineItem` method.
4055    #[serde(rename = "inStoreRefundLineItem")]
4056    pub in_store_refund_line_item: Option<OrdersCustomBatchRequestEntryInStoreRefundLineItem>,
4057    /// The ID of the managing account.
4058    #[serde(rename = "merchantId")]
4059    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4060    pub merchant_id: Option<u64>,
4061    /// The merchant order ID. Required for `updateMerchantOrderId` and `getByMerchantOrderId` methods.
4062    #[serde(rename = "merchantOrderId")]
4063    pub merchant_order_id: Option<String>,
4064    /// The method of the batch entry. Acceptable values are: - "`acknowledge`" - "`cancel`" - "`cancelLineItem`" - "`get`" - "`getByMerchantOrderId`" - "`inStoreRefundLineItem`" - "`refund`" - "`rejectReturnLineItem`" - "`returnLineItem`" - "`returnRefundLineItem`" - "`setLineItemMetadata`" - "`shipLineItems`" - "`updateLineItemShippingDetails`" - "`updateMerchantOrderId`" - "`updateShipment`"
4065    pub method: Option<String>,
4066    /// The ID of the operation. Unique across all operations for a given order. Required for all methods beside `get` and `getByMerchantOrderId`.
4067    #[serde(rename = "operationId")]
4068    pub operation_id: Option<String>,
4069    /// The ID of the order. Required for all methods beside `getByMerchantOrderId`.
4070    #[serde(rename = "orderId")]
4071    pub order_id: Option<String>,
4072    /// Required for `refund` method.
4073    pub refund: Option<OrdersCustomBatchRequestEntryRefund>,
4074    /// Required for `rejectReturnLineItem` method.
4075    #[serde(rename = "rejectReturnLineItem")]
4076    pub reject_return_line_item: Option<OrdersCustomBatchRequestEntryRejectReturnLineItem>,
4077    /// Required for `returnLineItem` method.
4078    #[serde(rename = "returnLineItem")]
4079    pub return_line_item: Option<OrdersCustomBatchRequestEntryReturnLineItem>,
4080    /// Required for `returnRefundLineItem` method.
4081    #[serde(rename = "returnRefundLineItem")]
4082    pub return_refund_line_item: Option<OrdersCustomBatchRequestEntryReturnRefundLineItem>,
4083    /// Required for `setLineItemMetadata` method.
4084    #[serde(rename = "setLineItemMetadata")]
4085    pub set_line_item_metadata: Option<OrdersCustomBatchRequestEntrySetLineItemMetadata>,
4086    /// Required for `shipLineItems` method.
4087    #[serde(rename = "shipLineItems")]
4088    pub ship_line_items: Option<OrdersCustomBatchRequestEntryShipLineItems>,
4089    /// Required for `updateLineItemShippingDate` method.
4090    #[serde(rename = "updateLineItemShippingDetails")]
4091    pub update_line_item_shipping_details:
4092        Option<OrdersCustomBatchRequestEntryUpdateLineItemShippingDetails>,
4093    /// Required for `updateShipment` method.
4094    #[serde(rename = "updateShipment")]
4095    pub update_shipment: Option<OrdersCustomBatchRequestEntryUpdateShipment>,
4096}
4097
4098impl common::Part for OrdersCustomBatchRequestEntry {}
4099
4100/// There is no detailed description.
4101///
4102/// This type is not used in any activity, and only used as *part* of another schema.
4103///
4104#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4105#[serde_with::serde_as]
4106#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4107pub struct OrdersCustomBatchRequestEntryCancel {
4108    /// The reason for the cancellation. Acceptable values are: - "`customerInitiatedCancel`" - "`invalidCoupon`" - "`malformedShippingAddress`" - "`noInventory`" - "`other`" - "`priceError`" - "`shippingPriceError`" - "`taxError`" - "`undeliverableShippingAddress`" - "`unsupportedPoBoxAddress`"
4109    pub reason: Option<String>,
4110    /// The explanation of the reason.
4111    #[serde(rename = "reasonText")]
4112    pub reason_text: Option<String>,
4113}
4114
4115impl common::Part for OrdersCustomBatchRequestEntryCancel {}
4116
4117/// There is no detailed description.
4118///
4119/// This type is not used in any activity, and only used as *part* of another schema.
4120///
4121#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4122#[serde_with::serde_as]
4123#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4124pub struct OrdersCustomBatchRequestEntryCancelLineItem {
4125    /// Deprecated. Please use amountPretax and amountTax instead.
4126    pub amount: Option<Price>,
4127    /// Amount to refund for the cancelation. Optional. If not set, Google will calculate the default based on the price and tax of the items involved. The amount must not be larger than the net amount left on the order.
4128    #[serde(rename = "amountPretax")]
4129    pub amount_pretax: Option<Price>,
4130    /// Tax amount that corresponds to cancellation amount in amountPretax. Optional, but if filled, then amountPretax must be set. Calculated automatically if not provided.
4131    #[serde(rename = "amountTax")]
4132    pub amount_tax: Option<Price>,
4133    /// The ID of the line item to cancel. Either lineItemId or productId is required.
4134    #[serde(rename = "lineItemId")]
4135    pub line_item_id: Option<String>,
4136    /// The ID of the product to cancel. This is the REST ID used in the products service. Either lineItemId or productId is required.
4137    #[serde(rename = "productId")]
4138    pub product_id: Option<String>,
4139    /// The quantity to cancel.
4140    pub quantity: Option<u32>,
4141    /// The reason for the cancellation. Acceptable values are: - "`customerInitiatedCancel`" - "`invalidCoupon`" - "`malformedShippingAddress`" - "`noInventory`" - "`other`" - "`priceError`" - "`shippingPriceError`" - "`taxError`" - "`undeliverableShippingAddress`" - "`unsupportedPoBoxAddress`"
4142    pub reason: Option<String>,
4143    /// The explanation of the reason.
4144    #[serde(rename = "reasonText")]
4145    pub reason_text: Option<String>,
4146}
4147
4148impl common::Part for OrdersCustomBatchRequestEntryCancelLineItem {}
4149
4150/// There is no detailed description.
4151///
4152/// This type is not used in any activity, and only used as *part* of another schema.
4153///
4154#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4155#[serde_with::serde_as]
4156#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4157pub struct OrdersCustomBatchRequestEntryCreateTestReturnReturnItem {
4158    /// The ID of the line item to return.
4159    #[serde(rename = "lineItemId")]
4160    pub line_item_id: Option<String>,
4161    /// Quantity that is returned.
4162    pub quantity: Option<u32>,
4163}
4164
4165impl common::Part for OrdersCustomBatchRequestEntryCreateTestReturnReturnItem {}
4166
4167/// There is no detailed description.
4168///
4169/// This type is not used in any activity, and only used as *part* of another schema.
4170///
4171#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4172#[serde_with::serde_as]
4173#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4174pub struct OrdersCustomBatchRequestEntryInStoreRefundLineItem {
4175    /// The amount that is refunded. Required.
4176    #[serde(rename = "amountPretax")]
4177    pub amount_pretax: Option<Price>,
4178    /// Tax amount that correspond to refund amount in amountPretax. Required.
4179    #[serde(rename = "amountTax")]
4180    pub amount_tax: Option<Price>,
4181    /// The ID of the line item to return. Either lineItemId or productId is required.
4182    #[serde(rename = "lineItemId")]
4183    pub line_item_id: Option<String>,
4184    /// The ID of the product to return. This is the REST ID used in the products service. Either lineItemId or productId is required.
4185    #[serde(rename = "productId")]
4186    pub product_id: Option<String>,
4187    /// The quantity to return and refund.
4188    pub quantity: Option<u32>,
4189    /// The reason for the return. Acceptable values are: - "`customerDiscretionaryReturn`" - "`customerInitiatedMerchantCancel`" - "`deliveredTooLate`" - "`expiredItem`" - "`invalidCoupon`" - "`malformedShippingAddress`" - "`other`" - "`productArrivedDamaged`" - "`productNotAsDescribed`" - "`qualityNotAsExpected`" - "`undeliverableShippingAddress`" - "`unsupportedPoBoxAddress`" - "`wrongProductShipped`"
4190    pub reason: Option<String>,
4191    /// The explanation of the reason.
4192    #[serde(rename = "reasonText")]
4193    pub reason_text: Option<String>,
4194}
4195
4196impl common::Part for OrdersCustomBatchRequestEntryInStoreRefundLineItem {}
4197
4198/// There is no detailed description.
4199///
4200/// This type is not used in any activity, and only used as *part* of another schema.
4201///
4202#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4203#[serde_with::serde_as]
4204#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4205pub struct OrdersCustomBatchRequestEntryRefund {
4206    /// Deprecated. Please use amountPretax and amountTax instead.
4207    pub amount: Option<Price>,
4208    /// The amount that is refunded. Either amount or amountPretax should be filled.
4209    #[serde(rename = "amountPretax")]
4210    pub amount_pretax: Option<Price>,
4211    /// Tax amount that corresponds to refund amount in amountPretax. Optional, but if filled, amountPretax must be set. Calculated automatically if not provided.
4212    #[serde(rename = "amountTax")]
4213    pub amount_tax: Option<Price>,
4214    /// The reason for the refund. Acceptable values are: - "`adjustment`" - "`courtesyAdjustment`" - "`customerCanceled`" - "`customerDiscretionaryReturn`" - "`deliveredLateByCarrier`" - "`feeAdjustment`" - "`lateShipmentCredit`" - "`noInventory`" - "`other`" - "`priceError`" - "`productArrivedDamaged`" - "`productNotAsDescribed`" - "`shippingCostAdjustment`" - "`taxAdjustment`" - "`undeliverableShippingAddress`" - "`wrongProductShipped`"
4215    pub reason: Option<String>,
4216    /// The explanation of the reason.
4217    #[serde(rename = "reasonText")]
4218    pub reason_text: Option<String>,
4219}
4220
4221impl common::Part for OrdersCustomBatchRequestEntryRefund {}
4222
4223/// There is no detailed description.
4224///
4225/// This type is not used in any activity, and only used as *part* of another schema.
4226///
4227#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4228#[serde_with::serde_as]
4229#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4230pub struct OrdersCustomBatchRequestEntryRejectReturnLineItem {
4231    /// The ID of the line item to return. Either lineItemId or productId is required.
4232    #[serde(rename = "lineItemId")]
4233    pub line_item_id: Option<String>,
4234    /// The ID of the product to return. This is the REST ID used in the products service. Either lineItemId or productId is required.
4235    #[serde(rename = "productId")]
4236    pub product_id: Option<String>,
4237    /// The quantity to return and refund.
4238    pub quantity: Option<u32>,
4239    /// The reason for the return. Acceptable values are: - "`damagedOrUsed`" - "`missingComponent`" - "`notEligible`" - "`other`" - "`outOfReturnWindow`"
4240    pub reason: Option<String>,
4241    /// The explanation of the reason.
4242    #[serde(rename = "reasonText")]
4243    pub reason_text: Option<String>,
4244}
4245
4246impl common::Part for OrdersCustomBatchRequestEntryRejectReturnLineItem {}
4247
4248/// There is no detailed description.
4249///
4250/// This type is not used in any activity, and only used as *part* of another schema.
4251///
4252#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4253#[serde_with::serde_as]
4254#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4255pub struct OrdersCustomBatchRequestEntryReturnLineItem {
4256    /// The ID of the line item to return. Either lineItemId or productId is required.
4257    #[serde(rename = "lineItemId")]
4258    pub line_item_id: Option<String>,
4259    /// The ID of the product to return. This is the REST ID used in the products service. Either lineItemId or productId is required.
4260    #[serde(rename = "productId")]
4261    pub product_id: Option<String>,
4262    /// The quantity to return.
4263    pub quantity: Option<u32>,
4264    /// The reason for the return. Acceptable values are: - "`customerDiscretionaryReturn`" - "`customerInitiatedMerchantCancel`" - "`deliveredTooLate`" - "`expiredItem`" - "`invalidCoupon`" - "`malformedShippingAddress`" - "`other`" - "`productArrivedDamaged`" - "`productNotAsDescribed`" - "`qualityNotAsExpected`" - "`undeliverableShippingAddress`" - "`unsupportedPoBoxAddress`" - "`wrongProductShipped`"
4265    pub reason: Option<String>,
4266    /// The explanation of the reason.
4267    #[serde(rename = "reasonText")]
4268    pub reason_text: Option<String>,
4269}
4270
4271impl common::Part for OrdersCustomBatchRequestEntryReturnLineItem {}
4272
4273/// There is no detailed description.
4274///
4275/// This type is not used in any activity, and only used as *part* of another schema.
4276///
4277#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4278#[serde_with::serde_as]
4279#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4280pub struct OrdersCustomBatchRequestEntryReturnRefundLineItem {
4281    /// The amount that is refunded. If omitted, refundless return is assumed (same as calling returnLineItem method).
4282    #[serde(rename = "amountPretax")]
4283    pub amount_pretax: Option<Price>,
4284    /// Tax amount that corresponds to refund amount in amountPretax. Optional, but if filled, then amountPretax must be set. Calculated automatically if not provided.
4285    #[serde(rename = "amountTax")]
4286    pub amount_tax: Option<Price>,
4287    /// The ID of the line item to return. Either lineItemId or productId is required.
4288    #[serde(rename = "lineItemId")]
4289    pub line_item_id: Option<String>,
4290    /// The ID of the product to return. This is the REST ID used in the products service. Either lineItemId or productId is required.
4291    #[serde(rename = "productId")]
4292    pub product_id: Option<String>,
4293    /// The quantity to return and refund.
4294    pub quantity: Option<u32>,
4295    /// The reason for the return. Acceptable values are: - "`customerDiscretionaryReturn`" - "`customerInitiatedMerchantCancel`" - "`deliveredTooLate`" - "`expiredItem`" - "`invalidCoupon`" - "`malformedShippingAddress`" - "`other`" - "`productArrivedDamaged`" - "`productNotAsDescribed`" - "`qualityNotAsExpected`" - "`undeliverableShippingAddress`" - "`unsupportedPoBoxAddress`" - "`wrongProductShipped`"
4296    pub reason: Option<String>,
4297    /// The explanation of the reason.
4298    #[serde(rename = "reasonText")]
4299    pub reason_text: Option<String>,
4300}
4301
4302impl common::Part for OrdersCustomBatchRequestEntryReturnRefundLineItem {}
4303
4304/// There is no detailed description.
4305///
4306/// This type is not used in any activity, and only used as *part* of another schema.
4307///
4308#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4309#[serde_with::serde_as]
4310#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4311pub struct OrdersCustomBatchRequestEntrySetLineItemMetadata {
4312    /// no description provided
4313    pub annotations: Option<Vec<OrderMerchantProvidedAnnotation>>,
4314    /// The ID of the line item to set metadata. Either lineItemId or productId is required.
4315    #[serde(rename = "lineItemId")]
4316    pub line_item_id: Option<String>,
4317    /// The ID of the product to set metadata. This is the REST ID used in the products service. Either lineItemId or productId is required.
4318    #[serde(rename = "productId")]
4319    pub product_id: Option<String>,
4320}
4321
4322impl common::Part for OrdersCustomBatchRequestEntrySetLineItemMetadata {}
4323
4324/// There is no detailed description.
4325///
4326/// This type is not used in any activity, and only used as *part* of another schema.
4327///
4328#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4329#[serde_with::serde_as]
4330#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4331pub struct OrdersCustomBatchRequestEntryShipLineItems {
4332    /// Deprecated. Please use shipmentInfo instead. The carrier handling the shipment. See `shipments[].carrier` in the Orders resource representation for a list of acceptable values.
4333    pub carrier: Option<String>,
4334    /// Line items to ship.
4335    #[serde(rename = "lineItems")]
4336    pub line_items: Option<Vec<OrderShipmentLineItemShipment>>,
4337    /// ID of the shipment group. Required for orders that use the orderinvoices service.
4338    #[serde(rename = "shipmentGroupId")]
4339    pub shipment_group_id: Option<String>,
4340    /// Deprecated. Please use shipmentInfo instead. The ID of the shipment.
4341    #[serde(rename = "shipmentId")]
4342    pub shipment_id: Option<String>,
4343    /// Shipment information. This field is repeated because a single line item can be shipped in several packages (and have several tracking IDs).
4344    #[serde(rename = "shipmentInfos")]
4345    pub shipment_infos: Option<Vec<OrdersCustomBatchRequestEntryShipLineItemsShipmentInfo>>,
4346    /// Deprecated. Please use shipmentInfo instead. The tracking ID for the shipment.
4347    #[serde(rename = "trackingId")]
4348    pub tracking_id: Option<String>,
4349}
4350
4351impl common::Part for OrdersCustomBatchRequestEntryShipLineItems {}
4352
4353/// There is no detailed description.
4354///
4355/// This type is not used in any activity, and only used as *part* of another schema.
4356///
4357#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4358#[serde_with::serde_as]
4359#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4360pub struct OrdersCustomBatchRequestEntryShipLineItemsShipmentInfo {
4361    /// The carrier handling the shipment. See `shipments[].carrier` in the Orders resource representation for a list of acceptable values.
4362    pub carrier: Option<String>,
4363    /// Required. The ID of the shipment. This is assigned by the merchant and is unique to each shipment.
4364    #[serde(rename = "shipmentId")]
4365    pub shipment_id: Option<String>,
4366    /// The tracking ID for the shipment.
4367    #[serde(rename = "trackingId")]
4368    pub tracking_id: Option<String>,
4369}
4370
4371impl common::Part for OrdersCustomBatchRequestEntryShipLineItemsShipmentInfo {}
4372
4373/// There is no detailed description.
4374///
4375/// This type is not used in any activity, and only used as *part* of another schema.
4376///
4377#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4378#[serde_with::serde_as]
4379#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4380pub struct OrdersCustomBatchRequestEntryUpdateLineItemShippingDetails {
4381    /// Updated delivery by date, in ISO 8601 format. If not specified only ship by date is updated. Provided date should be within 1 year timeframe and can not be a date in the past.
4382    #[serde(rename = "deliverByDate")]
4383    pub deliver_by_date: Option<String>,
4384    /// The ID of the line item to set metadata. Either lineItemId or productId is required.
4385    #[serde(rename = "lineItemId")]
4386    pub line_item_id: Option<String>,
4387    /// The ID of the product to set metadata. This is the REST ID used in the products service. Either lineItemId or productId is required.
4388    #[serde(rename = "productId")]
4389    pub product_id: Option<String>,
4390    /// Updated ship by date, in ISO 8601 format. If not specified only deliver by date is updated. Provided date should be within 1 year timeframe and can not be a date in the past.
4391    #[serde(rename = "shipByDate")]
4392    pub ship_by_date: Option<String>,
4393}
4394
4395impl common::Part for OrdersCustomBatchRequestEntryUpdateLineItemShippingDetails {}
4396
4397/// There is no detailed description.
4398///
4399/// This type is not used in any activity, and only used as *part* of another schema.
4400///
4401#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4402#[serde_with::serde_as]
4403#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4404pub struct OrdersCustomBatchRequestEntryUpdateShipment {
4405    /// The carrier handling the shipment. Not updated if missing. See `shipments[].carrier` in the Orders resource representation for a list of acceptable values.
4406    pub carrier: Option<String>,
4407    /// Date on which the shipment has been delivered, in ISO 8601 format. Optional and can be provided only if `status` is `delivered`.
4408    #[serde(rename = "deliveryDate")]
4409    pub delivery_date: Option<String>,
4410    /// The ID of the shipment.
4411    #[serde(rename = "shipmentId")]
4412    pub shipment_id: Option<String>,
4413    /// New status for the shipment. Not updated if missing. Acceptable values are: - "`delivered`" - "`undeliverable`" - "`readyForPickup`"
4414    pub status: Option<String>,
4415    /// The tracking ID for the shipment. Not updated if missing.
4416    #[serde(rename = "trackingId")]
4417    pub tracking_id: Option<String>,
4418}
4419
4420impl common::Part for OrdersCustomBatchRequestEntryUpdateShipment {}
4421
4422/// There is no detailed description.
4423///
4424/// # Activities
4425///
4426/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4427/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4428///
4429/// * [custombatch orders](OrderCustombatchCall) (response)
4430#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4431#[serde_with::serde_as]
4432#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4433pub struct OrdersCustomBatchResponse {
4434    /// The result of the execution of the batch requests.
4435    pub entries: Option<Vec<OrdersCustomBatchResponseEntry>>,
4436    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersCustomBatchResponse".
4437    pub kind: Option<String>,
4438}
4439
4440impl common::ResponseResult for OrdersCustomBatchResponse {}
4441
4442/// There is no detailed description.
4443///
4444/// This type is not used in any activity, and only used as *part* of another schema.
4445///
4446#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4447#[serde_with::serde_as]
4448#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4449pub struct OrdersCustomBatchResponseEntry {
4450    /// The ID of the request entry this entry responds to.
4451    #[serde(rename = "batchId")]
4452    pub batch_id: Option<u32>,
4453    /// A list of errors defined if and only if the request failed.
4454    pub errors: Option<Errors>,
4455    /// The status of the execution. Only defined if 1. the request was successful; and 2. the method is not `get`, `getByMerchantOrderId`, or one of the test methods. Acceptable values are: - "`duplicate`" - "`executed`"
4456    #[serde(rename = "executionStatus")]
4457    pub execution_status: Option<String>,
4458    /// Identifies what kind of resource this is. Value: the fixed string "`content#ordersCustomBatchResponseEntry`"
4459    pub kind: Option<String>,
4460    /// The retrieved order. Only defined if the method is `get` and if the request was successful.
4461    pub order: Option<Order>,
4462}
4463
4464impl common::Part for OrdersCustomBatchResponseEntry {}
4465
4466/// There is no detailed description.
4467///
4468/// # Activities
4469///
4470/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4471/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4472///
4473/// * [getbymerchantorderid orders](OrderGetbymerchantorderidCall) (response)
4474#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4475#[serde_with::serde_as]
4476#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4477pub struct OrdersGetByMerchantOrderIdResponse {
4478    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersGetByMerchantOrderIdResponse".
4479    pub kind: Option<String>,
4480    /// The requested order.
4481    pub order: Option<Order>,
4482}
4483
4484impl common::ResponseResult for OrdersGetByMerchantOrderIdResponse {}
4485
4486/// There is no detailed description.
4487///
4488/// # Activities
4489///
4490/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4491/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4492///
4493/// * [gettestordertemplate orders](OrderGettestordertemplateCall) (response)
4494#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4495#[serde_with::serde_as]
4496#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4497pub struct OrdersGetTestOrderTemplateResponse {
4498    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersGetTestOrderTemplateResponse".
4499    pub kind: Option<String>,
4500    /// The requested test order template.
4501    pub template: Option<TestOrder>,
4502}
4503
4504impl common::ResponseResult for OrdersGetTestOrderTemplateResponse {}
4505
4506/// There is no detailed description.
4507///
4508/// # Activities
4509///
4510/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4511/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4512///
4513/// * [instorerefundlineitem orders](OrderInstorerefundlineitemCall) (request)
4514#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4515#[serde_with::serde_as]
4516#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4517pub struct OrdersInStoreRefundLineItemRequest {
4518    /// The amount that is refunded. Required.
4519    #[serde(rename = "amountPretax")]
4520    pub amount_pretax: Option<Price>,
4521    /// Tax amount that correspond to refund amount in amountPretax. Required.
4522    #[serde(rename = "amountTax")]
4523    pub amount_tax: Option<Price>,
4524    /// The ID of the line item to return. Either lineItemId or productId is required.
4525    #[serde(rename = "lineItemId")]
4526    pub line_item_id: Option<String>,
4527    /// The ID of the operation. Unique across all operations for a given order.
4528    #[serde(rename = "operationId")]
4529    pub operation_id: Option<String>,
4530    /// The ID of the product to return. This is the REST ID used in the products service. Either lineItemId or productId is required.
4531    #[serde(rename = "productId")]
4532    pub product_id: Option<String>,
4533    /// The quantity to return and refund.
4534    pub quantity: Option<u32>,
4535    /// The reason for the return. Acceptable values are: - "`customerDiscretionaryReturn`" - "`customerInitiatedMerchantCancel`" - "`deliveredTooLate`" - "`expiredItem`" - "`invalidCoupon`" - "`malformedShippingAddress`" - "`other`" - "`productArrivedDamaged`" - "`productNotAsDescribed`" - "`qualityNotAsExpected`" - "`undeliverableShippingAddress`" - "`unsupportedPoBoxAddress`" - "`wrongProductShipped`"
4536    pub reason: Option<String>,
4537    /// The explanation of the reason.
4538    #[serde(rename = "reasonText")]
4539    pub reason_text: Option<String>,
4540}
4541
4542impl common::RequestValue for OrdersInStoreRefundLineItemRequest {}
4543
4544/// There is no detailed description.
4545///
4546/// # Activities
4547///
4548/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4549/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4550///
4551/// * [instorerefundlineitem orders](OrderInstorerefundlineitemCall) (response)
4552#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4553#[serde_with::serde_as]
4554#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4555pub struct OrdersInStoreRefundLineItemResponse {
4556    /// The status of the execution. Acceptable values are: - "`duplicate`" - "`executed`"
4557    #[serde(rename = "executionStatus")]
4558    pub execution_status: Option<String>,
4559    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersInStoreRefundLineItemResponse".
4560    pub kind: Option<String>,
4561}
4562
4563impl common::ResponseResult for OrdersInStoreRefundLineItemResponse {}
4564
4565/// There is no detailed description.
4566///
4567/// # Activities
4568///
4569/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4570/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4571///
4572/// * [list orders](OrderListCall) (response)
4573#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4574#[serde_with::serde_as]
4575#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4576pub struct OrdersListResponse {
4577    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersListResponse".
4578    pub kind: Option<String>,
4579    /// The token for the retrieval of the next page of orders.
4580    #[serde(rename = "nextPageToken")]
4581    pub next_page_token: Option<String>,
4582    /// no description provided
4583    pub resources: Option<Vec<Order>>,
4584}
4585
4586impl common::ResponseResult for OrdersListResponse {}
4587
4588/// There is no detailed description.
4589///
4590/// # Activities
4591///
4592/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4593/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4594///
4595/// * [refund orders](OrderRefundCall) (request)
4596#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4597#[serde_with::serde_as]
4598#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4599pub struct OrdersRefundRequest {
4600    /// Deprecated. Please use amountPretax and amountTax instead.
4601    pub amount: Option<Price>,
4602    /// The amount that is refunded. Either amount or amountPretax should be filled.
4603    #[serde(rename = "amountPretax")]
4604    pub amount_pretax: Option<Price>,
4605    /// Tax amount that corresponds to refund amount in amountPretax. Optional, but if filled, amountPretax must be set. Calculated automatically if not provided.
4606    #[serde(rename = "amountTax")]
4607    pub amount_tax: Option<Price>,
4608    /// The ID of the operation. Unique across all operations for a given order.
4609    #[serde(rename = "operationId")]
4610    pub operation_id: Option<String>,
4611    /// The reason for the refund. Acceptable values are: - "`adjustment`" - "`courtesyAdjustment`" - "`customerCanceled`" - "`customerDiscretionaryReturn`" - "`deliveredLateByCarrier`" - "`feeAdjustment`" - "`lateShipmentCredit`" - "`noInventory`" - "`other`" - "`priceError`" - "`productArrivedDamaged`" - "`productNotAsDescribed`" - "`shippingCostAdjustment`" - "`taxAdjustment`" - "`undeliverableShippingAddress`" - "`wrongProductShipped`"
4612    pub reason: Option<String>,
4613    /// The explanation of the reason.
4614    #[serde(rename = "reasonText")]
4615    pub reason_text: Option<String>,
4616}
4617
4618impl common::RequestValue for OrdersRefundRequest {}
4619
4620/// There is no detailed description.
4621///
4622/// # Activities
4623///
4624/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4625/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4626///
4627/// * [refund orders](OrderRefundCall) (response)
4628#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4629#[serde_with::serde_as]
4630#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4631pub struct OrdersRefundResponse {
4632    /// The status of the execution. Acceptable values are: - "`duplicate`" - "`executed`"
4633    #[serde(rename = "executionStatus")]
4634    pub execution_status: Option<String>,
4635    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersRefundResponse".
4636    pub kind: Option<String>,
4637}
4638
4639impl common::ResponseResult for OrdersRefundResponse {}
4640
4641/// There is no detailed description.
4642///
4643/// # Activities
4644///
4645/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4646/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4647///
4648/// * [rejectreturnlineitem orders](OrderRejectreturnlineitemCall) (request)
4649#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4650#[serde_with::serde_as]
4651#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4652pub struct OrdersRejectReturnLineItemRequest {
4653    /// The ID of the line item to return. Either lineItemId or productId is required.
4654    #[serde(rename = "lineItemId")]
4655    pub line_item_id: Option<String>,
4656    /// The ID of the operation. Unique across all operations for a given order.
4657    #[serde(rename = "operationId")]
4658    pub operation_id: Option<String>,
4659    /// The ID of the product to return. This is the REST ID used in the products service. Either lineItemId or productId is required.
4660    #[serde(rename = "productId")]
4661    pub product_id: Option<String>,
4662    /// The quantity to return and refund.
4663    pub quantity: Option<u32>,
4664    /// The reason for the return. Acceptable values are: - "`damagedOrUsed`" - "`missingComponent`" - "`notEligible`" - "`other`" - "`outOfReturnWindow`"
4665    pub reason: Option<String>,
4666    /// The explanation of the reason.
4667    #[serde(rename = "reasonText")]
4668    pub reason_text: Option<String>,
4669}
4670
4671impl common::RequestValue for OrdersRejectReturnLineItemRequest {}
4672
4673/// There is no detailed description.
4674///
4675/// # Activities
4676///
4677/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4678/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4679///
4680/// * [rejectreturnlineitem orders](OrderRejectreturnlineitemCall) (response)
4681#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4682#[serde_with::serde_as]
4683#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4684pub struct OrdersRejectReturnLineItemResponse {
4685    /// The status of the execution. Acceptable values are: - "`duplicate`" - "`executed`"
4686    #[serde(rename = "executionStatus")]
4687    pub execution_status: Option<String>,
4688    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersRejectReturnLineItemResponse".
4689    pub kind: Option<String>,
4690}
4691
4692impl common::ResponseResult for OrdersRejectReturnLineItemResponse {}
4693
4694/// There is no detailed description.
4695///
4696/// # Activities
4697///
4698/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4699/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4700///
4701/// * [returnlineitem orders](OrderReturnlineitemCall) (request)
4702#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4703#[serde_with::serde_as]
4704#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4705pub struct OrdersReturnLineItemRequest {
4706    /// The ID of the line item to return. Either lineItemId or productId is required.
4707    #[serde(rename = "lineItemId")]
4708    pub line_item_id: Option<String>,
4709    /// The ID of the operation. Unique across all operations for a given order.
4710    #[serde(rename = "operationId")]
4711    pub operation_id: Option<String>,
4712    /// The ID of the product to return. This is the REST ID used in the products service. Either lineItemId or productId is required.
4713    #[serde(rename = "productId")]
4714    pub product_id: Option<String>,
4715    /// The quantity to return.
4716    pub quantity: Option<u32>,
4717    /// The reason for the return. Acceptable values are: - "`customerDiscretionaryReturn`" - "`customerInitiatedMerchantCancel`" - "`deliveredTooLate`" - "`expiredItem`" - "`invalidCoupon`" - "`malformedShippingAddress`" - "`other`" - "`productArrivedDamaged`" - "`productNotAsDescribed`" - "`qualityNotAsExpected`" - "`undeliverableShippingAddress`" - "`unsupportedPoBoxAddress`" - "`wrongProductShipped`"
4718    pub reason: Option<String>,
4719    /// The explanation of the reason.
4720    #[serde(rename = "reasonText")]
4721    pub reason_text: Option<String>,
4722}
4723
4724impl common::RequestValue for OrdersReturnLineItemRequest {}
4725
4726/// There is no detailed description.
4727///
4728/// # Activities
4729///
4730/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4731/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4732///
4733/// * [returnlineitem orders](OrderReturnlineitemCall) (response)
4734#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4735#[serde_with::serde_as]
4736#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4737pub struct OrdersReturnLineItemResponse {
4738    /// The status of the execution. Acceptable values are: - "`duplicate`" - "`executed`"
4739    #[serde(rename = "executionStatus")]
4740    pub execution_status: Option<String>,
4741    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersReturnLineItemResponse".
4742    pub kind: Option<String>,
4743}
4744
4745impl common::ResponseResult for OrdersReturnLineItemResponse {}
4746
4747/// There is no detailed description.
4748///
4749/// # Activities
4750///
4751/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4752/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4753///
4754/// * [returnrefundlineitem orders](OrderReturnrefundlineitemCall) (request)
4755#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4756#[serde_with::serde_as]
4757#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4758pub struct OrdersReturnRefundLineItemRequest {
4759    /// The amount that is refunded. If omitted, refundless return is assumed (same as calling returnLineItem method).
4760    #[serde(rename = "amountPretax")]
4761    pub amount_pretax: Option<Price>,
4762    /// Tax amount that corresponds to refund amount in amountPretax. Optional, but if filled, then amountPretax must be set. Calculated automatically if not provided.
4763    #[serde(rename = "amountTax")]
4764    pub amount_tax: Option<Price>,
4765    /// The ID of the line item to return. Either lineItemId or productId is required.
4766    #[serde(rename = "lineItemId")]
4767    pub line_item_id: Option<String>,
4768    /// The ID of the operation. Unique across all operations for a given order.
4769    #[serde(rename = "operationId")]
4770    pub operation_id: Option<String>,
4771    /// The ID of the product to return. This is the REST ID used in the products service. Either lineItemId or productId is required.
4772    #[serde(rename = "productId")]
4773    pub product_id: Option<String>,
4774    /// The quantity to return and refund. Quantity is required.
4775    pub quantity: Option<u32>,
4776    /// The reason for the return. Acceptable values are: - "`customerDiscretionaryReturn`" - "`customerInitiatedMerchantCancel`" - "`deliveredTooLate`" - "`expiredItem`" - "`invalidCoupon`" - "`malformedShippingAddress`" - "`other`" - "`productArrivedDamaged`" - "`productNotAsDescribed`" - "`qualityNotAsExpected`" - "`undeliverableShippingAddress`" - "`unsupportedPoBoxAddress`" - "`wrongProductShipped`"
4777    pub reason: Option<String>,
4778    /// The explanation of the reason.
4779    #[serde(rename = "reasonText")]
4780    pub reason_text: Option<String>,
4781}
4782
4783impl common::RequestValue for OrdersReturnRefundLineItemRequest {}
4784
4785/// There is no detailed description.
4786///
4787/// # Activities
4788///
4789/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4790/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4791///
4792/// * [returnrefundlineitem orders](OrderReturnrefundlineitemCall) (response)
4793#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4794#[serde_with::serde_as]
4795#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4796pub struct OrdersReturnRefundLineItemResponse {
4797    /// The status of the execution. Acceptable values are: - "`duplicate`" - "`executed`"
4798    #[serde(rename = "executionStatus")]
4799    pub execution_status: Option<String>,
4800    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersReturnRefundLineItemResponse".
4801    pub kind: Option<String>,
4802}
4803
4804impl common::ResponseResult for OrdersReturnRefundLineItemResponse {}
4805
4806/// There is no detailed description.
4807///
4808/// # Activities
4809///
4810/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4811/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4812///
4813/// * [setlineitemmetadata orders](OrderSetlineitemmetadataCall) (request)
4814#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4815#[serde_with::serde_as]
4816#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4817pub struct OrdersSetLineItemMetadataRequest {
4818    /// no description provided
4819    pub annotations: Option<Vec<OrderMerchantProvidedAnnotation>>,
4820    /// The ID of the line item to set metadata. Either lineItemId or productId is required.
4821    #[serde(rename = "lineItemId")]
4822    pub line_item_id: Option<String>,
4823    /// The ID of the operation. Unique across all operations for a given order.
4824    #[serde(rename = "operationId")]
4825    pub operation_id: Option<String>,
4826    /// The ID of the product to set metadata. This is the REST ID used in the products service. Either lineItemId or productId is required.
4827    #[serde(rename = "productId")]
4828    pub product_id: Option<String>,
4829}
4830
4831impl common::RequestValue for OrdersSetLineItemMetadataRequest {}
4832
4833/// There is no detailed description.
4834///
4835/// # Activities
4836///
4837/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4838/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4839///
4840/// * [setlineitemmetadata orders](OrderSetlineitemmetadataCall) (response)
4841#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4842#[serde_with::serde_as]
4843#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4844pub struct OrdersSetLineItemMetadataResponse {
4845    /// The status of the execution. Acceptable values are: - "`duplicate`" - "`executed`"
4846    #[serde(rename = "executionStatus")]
4847    pub execution_status: Option<String>,
4848    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersSetLineItemMetadataResponse".
4849    pub kind: Option<String>,
4850}
4851
4852impl common::ResponseResult for OrdersSetLineItemMetadataResponse {}
4853
4854/// There is no detailed description.
4855///
4856/// # Activities
4857///
4858/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4859/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4860///
4861/// * [shiplineitems orders](OrderShiplineitemCall) (request)
4862#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4863#[serde_with::serde_as]
4864#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4865pub struct OrdersShipLineItemsRequest {
4866    /// Deprecated. Please use shipmentInfo instead. The carrier handling the shipment. See `shipments[].carrier` in the Orders resource representation for a list of acceptable values.
4867    pub carrier: Option<String>,
4868    /// Line items to ship.
4869    #[serde(rename = "lineItems")]
4870    pub line_items: Option<Vec<OrderShipmentLineItemShipment>>,
4871    /// The ID of the operation. Unique across all operations for a given order.
4872    #[serde(rename = "operationId")]
4873    pub operation_id: Option<String>,
4874    /// ID of the shipment group. Required for orders that use the orderinvoices service.
4875    #[serde(rename = "shipmentGroupId")]
4876    pub shipment_group_id: Option<String>,
4877    /// Deprecated. Please use shipmentInfo instead. The ID of the shipment.
4878    #[serde(rename = "shipmentId")]
4879    pub shipment_id: Option<String>,
4880    /// Shipment information. This field is repeated because a single line item can be shipped in several packages (and have several tracking IDs).
4881    #[serde(rename = "shipmentInfos")]
4882    pub shipment_infos: Option<Vec<OrdersCustomBatchRequestEntryShipLineItemsShipmentInfo>>,
4883    /// Deprecated. Please use shipmentInfo instead. The tracking ID for the shipment.
4884    #[serde(rename = "trackingId")]
4885    pub tracking_id: Option<String>,
4886}
4887
4888impl common::RequestValue for OrdersShipLineItemsRequest {}
4889
4890/// There is no detailed description.
4891///
4892/// # Activities
4893///
4894/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4895/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4896///
4897/// * [shiplineitems orders](OrderShiplineitemCall) (response)
4898#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4899#[serde_with::serde_as]
4900#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4901pub struct OrdersShipLineItemsResponse {
4902    /// The status of the execution. Acceptable values are: - "`duplicate`" - "`executed`"
4903    #[serde(rename = "executionStatus")]
4904    pub execution_status: Option<String>,
4905    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersShipLineItemsResponse".
4906    pub kind: Option<String>,
4907}
4908
4909impl common::ResponseResult for OrdersShipLineItemsResponse {}
4910
4911/// There is no detailed description.
4912///
4913/// # Activities
4914///
4915/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4916/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4917///
4918/// * [updatelineitemshippingdetails orders](OrderUpdatelineitemshippingdetailCall) (request)
4919#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4920#[serde_with::serde_as]
4921#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4922pub struct OrdersUpdateLineItemShippingDetailsRequest {
4923    /// Updated delivery by date, in ISO 8601 format. If not specified only ship by date is updated. Provided date should be within 1 year timeframe and can not be a date in the past.
4924    #[serde(rename = "deliverByDate")]
4925    pub deliver_by_date: Option<String>,
4926    /// The ID of the line item to set metadata. Either lineItemId or productId is required.
4927    #[serde(rename = "lineItemId")]
4928    pub line_item_id: Option<String>,
4929    /// The ID of the operation. Unique across all operations for a given order.
4930    #[serde(rename = "operationId")]
4931    pub operation_id: Option<String>,
4932    /// The ID of the product to set metadata. This is the REST ID used in the products service. Either lineItemId or productId is required.
4933    #[serde(rename = "productId")]
4934    pub product_id: Option<String>,
4935    /// Updated ship by date, in ISO 8601 format. If not specified only deliver by date is updated. Provided date should be within 1 year timeframe and can not be a date in the past.
4936    #[serde(rename = "shipByDate")]
4937    pub ship_by_date: Option<String>,
4938}
4939
4940impl common::RequestValue for OrdersUpdateLineItemShippingDetailsRequest {}
4941
4942/// There is no detailed description.
4943///
4944/// # Activities
4945///
4946/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4947/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4948///
4949/// * [updatelineitemshippingdetails orders](OrderUpdatelineitemshippingdetailCall) (response)
4950#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4951#[serde_with::serde_as]
4952#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4953pub struct OrdersUpdateLineItemShippingDetailsResponse {
4954    /// The status of the execution. Acceptable values are: - "`duplicate`" - "`executed`"
4955    #[serde(rename = "executionStatus")]
4956    pub execution_status: Option<String>,
4957    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersUpdateLineItemShippingDetailsResponse".
4958    pub kind: Option<String>,
4959}
4960
4961impl common::ResponseResult for OrdersUpdateLineItemShippingDetailsResponse {}
4962
4963/// There is no detailed description.
4964///
4965/// # Activities
4966///
4967/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4968/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4969///
4970/// * [updatemerchantorderid orders](OrderUpdatemerchantorderidCall) (request)
4971#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4972#[serde_with::serde_as]
4973#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4974pub struct OrdersUpdateMerchantOrderIdRequest {
4975    /// The merchant order id to be assigned to the order. Must be unique per merchant.
4976    #[serde(rename = "merchantOrderId")]
4977    pub merchant_order_id: Option<String>,
4978    /// The ID of the operation. Unique across all operations for a given order.
4979    #[serde(rename = "operationId")]
4980    pub operation_id: Option<String>,
4981}
4982
4983impl common::RequestValue for OrdersUpdateMerchantOrderIdRequest {}
4984
4985/// There is no detailed description.
4986///
4987/// # Activities
4988///
4989/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4990/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4991///
4992/// * [updatemerchantorderid orders](OrderUpdatemerchantorderidCall) (response)
4993#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4994#[serde_with::serde_as]
4995#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4996pub struct OrdersUpdateMerchantOrderIdResponse {
4997    /// The status of the execution. Acceptable values are: - "`duplicate`" - "`executed`"
4998    #[serde(rename = "executionStatus")]
4999    pub execution_status: Option<String>,
5000    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersUpdateMerchantOrderIdResponse".
5001    pub kind: Option<String>,
5002}
5003
5004impl common::ResponseResult for OrdersUpdateMerchantOrderIdResponse {}
5005
5006/// There is no detailed description.
5007///
5008/// # Activities
5009///
5010/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5011/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5012///
5013/// * [updateshipment orders](OrderUpdateshipmentCall) (request)
5014#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5015#[serde_with::serde_as]
5016#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5017pub struct OrdersUpdateShipmentRequest {
5018    /// The carrier handling the shipment. Not updated if missing. See `shipments[].carrier` in the Orders resource representation for a list of acceptable values.
5019    pub carrier: Option<String>,
5020    /// Date on which the shipment has been delivered, in ISO 8601 format. Optional and can be provided only if `status` is `delivered`.
5021    #[serde(rename = "deliveryDate")]
5022    pub delivery_date: Option<String>,
5023    /// The ID of the operation. Unique across all operations for a given order.
5024    #[serde(rename = "operationId")]
5025    pub operation_id: Option<String>,
5026    /// The ID of the shipment.
5027    #[serde(rename = "shipmentId")]
5028    pub shipment_id: Option<String>,
5029    /// New status for the shipment. Not updated if missing. Acceptable values are: - "`delivered`" - "`undeliverable`" - "`readyForPickup`"
5030    pub status: Option<String>,
5031    /// The tracking ID for the shipment. Not updated if missing.
5032    #[serde(rename = "trackingId")]
5033    pub tracking_id: Option<String>,
5034}
5035
5036impl common::RequestValue for OrdersUpdateShipmentRequest {}
5037
5038/// There is no detailed description.
5039///
5040/// # Activities
5041///
5042/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5043/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5044///
5045/// * [updateshipment orders](OrderUpdateshipmentCall) (response)
5046#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5047#[serde_with::serde_as]
5048#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5049pub struct OrdersUpdateShipmentResponse {
5050    /// The status of the execution. Acceptable values are: - "`duplicate`" - "`executed`"
5051    #[serde(rename = "executionStatus")]
5052    pub execution_status: Option<String>,
5053    /// Identifies what kind of resource this is. Value: the fixed string "content#ordersUpdateShipmentResponse".
5054    pub kind: Option<String>,
5055}
5056
5057impl common::ResponseResult for OrdersUpdateShipmentResponse {}
5058
5059/// There is no detailed description.
5060///
5061/// This type is not used in any activity, and only used as *part* of another schema.
5062///
5063#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5064#[serde_with::serde_as]
5065#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5066pub struct PickupCarrierService {
5067    /// The name of the pickup carrier (e.g., `"UPS"`). Required.
5068    #[serde(rename = "carrierName")]
5069    pub carrier_name: Option<String>,
5070    /// The name of the pickup service (e.g., `"Access point"`). Required.
5071    #[serde(rename = "serviceName")]
5072    pub service_name: Option<String>,
5073}
5074
5075impl common::Part for PickupCarrierService {}
5076
5077/// There is no detailed description.
5078///
5079/// This type is not used in any activity, and only used as *part* of another schema.
5080///
5081#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5082#[serde_with::serde_as]
5083#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5084pub struct PickupServicesPickupService {
5085    /// The name of the carrier (e.g., `"UPS"`). Always present.
5086    #[serde(rename = "carrierName")]
5087    pub carrier_name: Option<String>,
5088    /// The CLDR country code of the carrier (e.g., "US"). Always present.
5089    pub country: Option<String>,
5090    /// The name of the pickup service (e.g., `"Access point"`). Always present.
5091    #[serde(rename = "serviceName")]
5092    pub service_name: Option<String>,
5093}
5094
5095impl common::Part for PickupServicesPickupService {}
5096
5097/// There is no detailed description.
5098///
5099/// # Activities
5100///
5101/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5102/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5103///
5104/// * [custombatch pos](PoCustombatchCall) (request)
5105#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5106#[serde_with::serde_as]
5107#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5108pub struct PosCustomBatchRequest {
5109    /// The request entries to be processed in the batch.
5110    pub entries: Option<Vec<PosCustomBatchRequestEntry>>,
5111}
5112
5113impl common::RequestValue for PosCustomBatchRequest {}
5114
5115/// There is no detailed description.
5116///
5117/// This type is not used in any activity, and only used as *part* of another schema.
5118///
5119#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5120#[serde_with::serde_as]
5121#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5122pub struct PosCustomBatchRequestEntry {
5123    /// An entry ID, unique within the batch request.
5124    #[serde(rename = "batchId")]
5125    pub batch_id: Option<u32>,
5126    /// The inventory to submit. This should be set only if the method is `inventory`.
5127    pub inventory: Option<PosInventory>,
5128    /// The ID of the POS data provider.
5129    #[serde(rename = "merchantId")]
5130    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5131    pub merchant_id: Option<u64>,
5132    /// The method of the batch entry. Acceptable values are: - "`delete`" - "`get`" - "`insert`" - "`inventory`" - "`sale`"
5133    pub method: Option<String>,
5134    /// The sale information to submit. This should be set only if the method is `sale`.
5135    pub sale: Option<PosSale>,
5136    /// The store information to submit. This should be set only if the method is `insert`.
5137    pub store: Option<PosStore>,
5138    /// The store code. This should be set only if the method is `delete` or `get`.
5139    #[serde(rename = "storeCode")]
5140    pub store_code: Option<String>,
5141    /// The ID of the account for which to get/submit data.
5142    #[serde(rename = "targetMerchantId")]
5143    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5144    pub target_merchant_id: Option<u64>,
5145}
5146
5147impl common::Part for PosCustomBatchRequestEntry {}
5148
5149/// There is no detailed description.
5150///
5151/// # Activities
5152///
5153/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5154/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5155///
5156/// * [custombatch pos](PoCustombatchCall) (response)
5157#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5158#[serde_with::serde_as]
5159#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5160pub struct PosCustomBatchResponse {
5161    /// The result of the execution of the batch requests.
5162    pub entries: Option<Vec<PosCustomBatchResponseEntry>>,
5163    /// Identifies what kind of resource this is. Value: the fixed string "content#posCustomBatchResponse".
5164    pub kind: Option<String>,
5165}
5166
5167impl common::ResponseResult for PosCustomBatchResponse {}
5168
5169/// There is no detailed description.
5170///
5171/// This type is not used in any activity, and only used as *part* of another schema.
5172///
5173#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5174#[serde_with::serde_as]
5175#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5176pub struct PosCustomBatchResponseEntry {
5177    /// The ID of the request entry to which this entry responds.
5178    #[serde(rename = "batchId")]
5179    pub batch_id: Option<u32>,
5180    /// A list of errors defined if, and only if, the request failed.
5181    pub errors: Option<Errors>,
5182    /// The updated inventory information.
5183    pub inventory: Option<PosInventory>,
5184    /// Identifies what kind of resource this is. Value: the fixed string "`content#posCustomBatchResponseEntry`"
5185    pub kind: Option<String>,
5186    /// The updated sale information.
5187    pub sale: Option<PosSale>,
5188    /// The retrieved or updated store information.
5189    pub store: Option<PosStore>,
5190}
5191
5192impl common::Part for PosCustomBatchResponseEntry {}
5193
5194/// There is no detailed description.
5195///
5196/// This type is not used in any activity, and only used as *part* of another schema.
5197///
5198#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5199#[serde_with::serde_as]
5200#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5201pub struct PosDataProviders {
5202    /// Country code.
5203    pub country: Option<String>,
5204    /// A list of POS data providers.
5205    #[serde(rename = "posDataProviders")]
5206    pub pos_data_providers: Option<Vec<PosDataProvidersPosDataProvider>>,
5207}
5208
5209impl common::Part for PosDataProviders {}
5210
5211/// There is no detailed description.
5212///
5213/// This type is not used in any activity, and only used as *part* of another schema.
5214///
5215#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5216#[serde_with::serde_as]
5217#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5218pub struct PosDataProvidersPosDataProvider {
5219    /// The display name of Pos data Provider.
5220    #[serde(rename = "displayName")]
5221    pub display_name: Option<String>,
5222    /// The full name of this POS data Provider.
5223    #[serde(rename = "fullName")]
5224    pub full_name: Option<String>,
5225    /// The ID of the account.
5226    #[serde(rename = "providerId")]
5227    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5228    pub provider_id: Option<u64>,
5229}
5230
5231impl common::Part for PosDataProvidersPosDataProvider {}
5232
5233/// The absolute quantity of an item available at the given store.
5234///
5235/// This type is not used in any activity, and only used as *part* of another schema.
5236///
5237#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5238#[serde_with::serde_as]
5239#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5240pub struct PosInventory {
5241    /// Required. The two-letter ISO 639-1 language code for the item.
5242    #[serde(rename = "contentLanguage")]
5243    pub content_language: Option<String>,
5244    /// Global Trade Item Number.
5245    pub gtin: Option<String>,
5246    /// Required. A unique identifier for the item.
5247    #[serde(rename = "itemId")]
5248    pub item_id: Option<String>,
5249    /// Identifies what kind of resource this is. Value: the fixed string "`content#posInventory`"
5250    pub kind: Option<String>,
5251    /// Required. The current price of the item.
5252    pub price: Option<Price>,
5253    /// Required. The available quantity of the item.
5254    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5255    pub quantity: Option<i64>,
5256    /// Required. The identifier of the merchant's store. Either a `storeCode` inserted via the API or the code of the store in Google My Business.
5257    #[serde(rename = "storeCode")]
5258    pub store_code: Option<String>,
5259    /// Required. The CLDR territory code for the item.
5260    #[serde(rename = "targetCountry")]
5261    pub target_country: Option<String>,
5262    /// Required. The inventory timestamp, in ISO 8601 format.
5263    pub timestamp: Option<String>,
5264}
5265
5266impl common::Part for PosInventory {}
5267
5268/// There is no detailed description.
5269///
5270/// # Activities
5271///
5272/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5273/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5274///
5275/// * [inventory pos](PoInventoryCall) (request)
5276#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5277#[serde_with::serde_as]
5278#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5279pub struct PosInventoryRequest {
5280    /// Required. The two-letter ISO 639-1 language code for the item.
5281    #[serde(rename = "contentLanguage")]
5282    pub content_language: Option<String>,
5283    /// Global Trade Item Number.
5284    pub gtin: Option<String>,
5285    /// Required. A unique identifier for the item.
5286    #[serde(rename = "itemId")]
5287    pub item_id: Option<String>,
5288    /// Required. The current price of the item.
5289    pub price: Option<Price>,
5290    /// Required. The available quantity of the item.
5291    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5292    pub quantity: Option<i64>,
5293    /// Required. The identifier of the merchant's store. Either a `storeCode` inserted via the API or the code of the store in Google My Business.
5294    #[serde(rename = "storeCode")]
5295    pub store_code: Option<String>,
5296    /// Required. The CLDR territory code for the item.
5297    #[serde(rename = "targetCountry")]
5298    pub target_country: Option<String>,
5299    /// Required. The inventory timestamp, in ISO 8601 format.
5300    pub timestamp: Option<String>,
5301}
5302
5303impl common::RequestValue for PosInventoryRequest {}
5304
5305/// There is no detailed description.
5306///
5307/// # Activities
5308///
5309/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5310/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5311///
5312/// * [inventory pos](PoInventoryCall) (response)
5313#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5314#[serde_with::serde_as]
5315#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5316pub struct PosInventoryResponse {
5317    /// Required. The two-letter ISO 639-1 language code for the item.
5318    #[serde(rename = "contentLanguage")]
5319    pub content_language: Option<String>,
5320    /// Global Trade Item Number.
5321    pub gtin: Option<String>,
5322    /// Required. A unique identifier for the item.
5323    #[serde(rename = "itemId")]
5324    pub item_id: Option<String>,
5325    /// Identifies what kind of resource this is. Value: the fixed string "content#posInventoryResponse".
5326    pub kind: Option<String>,
5327    /// Required. The current price of the item.
5328    pub price: Option<Price>,
5329    /// Required. The available quantity of the item.
5330    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5331    pub quantity: Option<i64>,
5332    /// Required. The identifier of the merchant's store. Either a `storeCode` inserted via the API or the code of the store in Google My Business.
5333    #[serde(rename = "storeCode")]
5334    pub store_code: Option<String>,
5335    /// Required. The CLDR territory code for the item.
5336    #[serde(rename = "targetCountry")]
5337    pub target_country: Option<String>,
5338    /// Required. The inventory timestamp, in ISO 8601 format.
5339    pub timestamp: Option<String>,
5340}
5341
5342impl common::ResponseResult for PosInventoryResponse {}
5343
5344/// There is no detailed description.
5345///
5346/// # Activities
5347///
5348/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5349/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5350///
5351/// * [list pos](PoListCall) (response)
5352#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5353#[serde_with::serde_as]
5354#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5355pub struct PosListResponse {
5356    /// Identifies what kind of resource this is. Value: the fixed string "content#posListResponse".
5357    pub kind: Option<String>,
5358    /// no description provided
5359    pub resources: Option<Vec<PosStore>>,
5360}
5361
5362impl common::ResponseResult for PosListResponse {}
5363
5364/// The change of the available quantity of an item at the given store.
5365///
5366/// This type is not used in any activity, and only used as *part* of another schema.
5367///
5368#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5369#[serde_with::serde_as]
5370#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5371pub struct PosSale {
5372    /// Required. The two-letter ISO 639-1 language code for the item.
5373    #[serde(rename = "contentLanguage")]
5374    pub content_language: Option<String>,
5375    /// Global Trade Item Number.
5376    pub gtin: Option<String>,
5377    /// Required. A unique identifier for the item.
5378    #[serde(rename = "itemId")]
5379    pub item_id: Option<String>,
5380    /// Identifies what kind of resource this is. Value: the fixed string "`content#posSale`"
5381    pub kind: Option<String>,
5382    /// Required. The price of the item.
5383    pub price: Option<Price>,
5384    /// Required. The relative change of the available quantity. Negative for items returned.
5385    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5386    pub quantity: Option<i64>,
5387    /// A unique ID to group items from the same sale event.
5388    #[serde(rename = "saleId")]
5389    pub sale_id: Option<String>,
5390    /// Required. The identifier of the merchant's store. Either a `storeCode` inserted via the API or the code of the store in Google My Business.
5391    #[serde(rename = "storeCode")]
5392    pub store_code: Option<String>,
5393    /// Required. The CLDR territory code for the item.
5394    #[serde(rename = "targetCountry")]
5395    pub target_country: Option<String>,
5396    /// Required. The inventory timestamp, in ISO 8601 format.
5397    pub timestamp: Option<String>,
5398}
5399
5400impl common::Part for PosSale {}
5401
5402/// There is no detailed description.
5403///
5404/// # Activities
5405///
5406/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5407/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5408///
5409/// * [sale pos](PoSaleCall) (request)
5410#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5411#[serde_with::serde_as]
5412#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5413pub struct PosSaleRequest {
5414    /// Required. The two-letter ISO 639-1 language code for the item.
5415    #[serde(rename = "contentLanguage")]
5416    pub content_language: Option<String>,
5417    /// Global Trade Item Number.
5418    pub gtin: Option<String>,
5419    /// Required. A unique identifier for the item.
5420    #[serde(rename = "itemId")]
5421    pub item_id: Option<String>,
5422    /// Required. The price of the item.
5423    pub price: Option<Price>,
5424    /// Required. The relative change of the available quantity. Negative for items returned.
5425    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5426    pub quantity: Option<i64>,
5427    /// A unique ID to group items from the same sale event.
5428    #[serde(rename = "saleId")]
5429    pub sale_id: Option<String>,
5430    /// Required. The identifier of the merchant's store. Either a `storeCode` inserted via the API or the code of the store in Google My Business.
5431    #[serde(rename = "storeCode")]
5432    pub store_code: Option<String>,
5433    /// Required. The CLDR territory code for the item.
5434    #[serde(rename = "targetCountry")]
5435    pub target_country: Option<String>,
5436    /// Required. The inventory timestamp, in ISO 8601 format.
5437    pub timestamp: Option<String>,
5438}
5439
5440impl common::RequestValue for PosSaleRequest {}
5441
5442/// There is no detailed description.
5443///
5444/// # Activities
5445///
5446/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5447/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5448///
5449/// * [sale pos](PoSaleCall) (response)
5450#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5451#[serde_with::serde_as]
5452#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5453pub struct PosSaleResponse {
5454    /// Required. The two-letter ISO 639-1 language code for the item.
5455    #[serde(rename = "contentLanguage")]
5456    pub content_language: Option<String>,
5457    /// Global Trade Item Number.
5458    pub gtin: Option<String>,
5459    /// Required. A unique identifier for the item.
5460    #[serde(rename = "itemId")]
5461    pub item_id: Option<String>,
5462    /// Identifies what kind of resource this is. Value: the fixed string "content#posSaleResponse".
5463    pub kind: Option<String>,
5464    /// Required. The price of the item.
5465    pub price: Option<Price>,
5466    /// Required. The relative change of the available quantity. Negative for items returned.
5467    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5468    pub quantity: Option<i64>,
5469    /// A unique ID to group items from the same sale event.
5470    #[serde(rename = "saleId")]
5471    pub sale_id: Option<String>,
5472    /// Required. The identifier of the merchant's store. Either a `storeCode` inserted via the API or the code of the store in Google My Business.
5473    #[serde(rename = "storeCode")]
5474    pub store_code: Option<String>,
5475    /// Required. The CLDR territory code for the item.
5476    #[serde(rename = "targetCountry")]
5477    pub target_country: Option<String>,
5478    /// Required. The inventory timestamp, in ISO 8601 format.
5479    pub timestamp: Option<String>,
5480}
5481
5482impl common::ResponseResult for PosSaleResponse {}
5483
5484/// Store resource.
5485///
5486/// # Activities
5487///
5488/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5489/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5490///
5491/// * [get pos](PoGetCall) (response)
5492/// * [insert pos](PoInsertCall) (request|response)
5493#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5494#[serde_with::serde_as]
5495#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5496pub struct PosStore {
5497    /// The business type of the store.
5498    #[serde(rename = "gcidCategory")]
5499    pub gcid_category: Option<Vec<String>>,
5500    /// Identifies what kind of resource this is. Value: the fixed string "`content#posStore`"
5501    pub kind: Option<String>,
5502    /// The store phone number.
5503    #[serde(rename = "phoneNumber")]
5504    pub phone_number: Option<String>,
5505    /// The Google Place Id of the store location.
5506    #[serde(rename = "placeId")]
5507    pub place_id: Option<String>,
5508    /// Required. The street address of the store.
5509    #[serde(rename = "storeAddress")]
5510    pub store_address: Option<String>,
5511    /// Required. A store identifier that is unique for the given merchant.
5512    #[serde(rename = "storeCode")]
5513    pub store_code: Option<String>,
5514    /// The merchant or store name.
5515    #[serde(rename = "storeName")]
5516    pub store_name: Option<String>,
5517    /// The website url for the store or merchant.
5518    #[serde(rename = "websiteUrl")]
5519    pub website_url: Option<String>,
5520}
5521
5522impl common::RequestValue for PosStore {}
5523impl common::ResponseResult for PosStore {}
5524
5525/// There is no detailed description.
5526///
5527/// This type is not used in any activity, and only used as *part* of another schema.
5528///
5529#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5530#[serde_with::serde_as]
5531#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5532pub struct PostalCodeGroup {
5533    /// The CLDR territory code of the country the postal code group applies to. Required.
5534    pub country: Option<String>,
5535    /// The name of the postal code group, referred to in headers. Required.
5536    pub name: Option<String>,
5537    /// A range of postal codes. Required.
5538    #[serde(rename = "postalCodeRanges")]
5539    pub postal_code_ranges: Option<Vec<PostalCodeRange>>,
5540}
5541
5542impl common::Part for PostalCodeGroup {}
5543
5544/// There is no detailed description.
5545///
5546/// This type is not used in any activity, and only used as *part* of another schema.
5547///
5548#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5549#[serde_with::serde_as]
5550#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5551pub struct PostalCodeRange {
5552    /// A postal code or a pattern of the form `prefix*` denoting the inclusive lower bound of the range defining the area. Examples values: `"94108"`, `"9410*"`, `"9*"`. Required.
5553    #[serde(rename = "postalCodeRangeBegin")]
5554    pub postal_code_range_begin: Option<String>,
5555    /// A postal code or a pattern of the form `prefix*` denoting the inclusive upper bound of the range defining the area. It must have the same length as `postalCodeRangeBegin`: if `postalCodeRangeBegin` is a postal code then `postalCodeRangeEnd` must be a postal code too; if `postalCodeRangeBegin` is a pattern then `postalCodeRangeEnd` must be a pattern with the same prefix length. Optional: if not set, then the area is defined as being all the postal codes matching `postalCodeRangeBegin`.
5556    #[serde(rename = "postalCodeRangeEnd")]
5557    pub postal_code_range_end: Option<String>,
5558}
5559
5560impl common::Part for PostalCodeRange {}
5561
5562/// There is no detailed description.
5563///
5564/// This type is not used in any activity, and only used as *part* of another schema.
5565///
5566#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5567#[serde_with::serde_as]
5568#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5569pub struct Price {
5570    /// The currency of the price.
5571    pub currency: Option<String>,
5572    /// The price represented as a number.
5573    pub value: Option<String>,
5574}
5575
5576impl common::Part for Price {}
5577
5578/// Required product attributes are primarily defined by the products data specification. See the Products Data Specification Help Center article for information. Product data. After inserting, updating, or deleting a product, it may take several minutes before changes take effect.
5579///
5580/// # Activities
5581///
5582/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5583/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5584///
5585/// * [custombatch products](ProductCustombatchCall) (none)
5586/// * [delete products](ProductDeleteCall) (none)
5587/// * [get products](ProductGetCall) (response)
5588/// * [insert products](ProductInsertCall) (request|response)
5589/// * [list products](ProductListCall) (none)
5590#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5591#[serde_with::serde_as]
5592#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5593pub struct Product {
5594    /// Additional URLs of images of the item.
5595    #[serde(rename = "additionalImageLinks")]
5596    pub additional_image_links: Option<Vec<String>>,
5597    /// Additional categories of the item (formatted as in products data specification).
5598    #[serde(rename = "additionalProductTypes")]
5599    pub additional_product_types: Option<Vec<String>>,
5600    /// Should be set to true if the item is targeted towards adults.
5601    pub adult: Option<bool>,
5602    /// Used to group items in an arbitrary way. Only for CPA%, discouraged otherwise.
5603    #[serde(rename = "adwordsGrouping")]
5604    pub adwords_grouping: Option<String>,
5605    /// Similar to adwords_grouping, but only works on CPC.
5606    #[serde(rename = "adwordsLabels")]
5607    pub adwords_labels: Option<Vec<String>>,
5608    /// Allows advertisers to override the item URL when the product is shown within the context of Product Ads.
5609    #[serde(rename = "adwordsRedirect")]
5610    pub adwords_redirect: Option<String>,
5611    /// Target age group of the item. Acceptable values are: - "`adult`" - "`infant`" - "`kids`" - "`newborn`" - "`toddler`" - "`youngAdult`"
5612    #[serde(rename = "ageGroup")]
5613    pub age_group: Option<String>,
5614    /// Deprecated. Do not use.
5615    pub aspects: Option<Vec<ProductAspect>>,
5616    /// Availability status of the item. Acceptable values are: - "`in stock`" - "`out of stock`" - "`preorder`"
5617    pub availability: Option<String>,
5618    /// The day a pre-ordered product becomes available for delivery, in ISO 8601 format.
5619    #[serde(rename = "availabilityDate")]
5620    pub availability_date: Option<String>,
5621    /// Brand of the item.
5622    pub brand: Option<String>,
5623    /// URL for the canonical version of your item's landing page.
5624    #[serde(rename = "canonicalLink")]
5625    pub canonical_link: Option<String>,
5626    /// Required. The item's channel (online or local). Acceptable values are: - "`local`" - "`online`"
5627    pub channel: Option<String>,
5628    /// Color of the item.
5629    pub color: Option<String>,
5630    /// Condition or state of the item. Acceptable values are: - "`new`" - "`refurbished`" - "`used`"
5631    pub condition: Option<String>,
5632    /// Required. The two-letter ISO 639-1 language code for the item.
5633    #[serde(rename = "contentLanguage")]
5634    pub content_language: Option<String>,
5635    /// Cost of goods sold. Used for gross profit reporting.
5636    #[serde(rename = "costOfGoodsSold")]
5637    pub cost_of_goods_sold: Option<Price>,
5638    /// A list of custom (merchant-provided) attributes. It can also be used for submitting any attribute of the feed specification in its generic form (e.g., `{ "name": "size type", "value": "regular" }`). This is useful for submitting attributes not explicitly exposed by the API, such as additional attributes used for Buy on Google (formerly known as Shopping Actions).
5639    #[serde(rename = "customAttributes")]
5640    pub custom_attributes: Option<Vec<CustomAttribute>>,
5641    /// A list of custom (merchant-provided) custom attribute groups.
5642    #[serde(rename = "customGroups")]
5643    pub custom_groups: Option<Vec<CustomGroup>>,
5644    /// Custom label 0 for custom grouping of items in a Shopping campaign.
5645    #[serde(rename = "customLabel0")]
5646    pub custom_label0: Option<String>,
5647    /// Custom label 1 for custom grouping of items in a Shopping campaign.
5648    #[serde(rename = "customLabel1")]
5649    pub custom_label1: Option<String>,
5650    /// Custom label 2 for custom grouping of items in a Shopping campaign.
5651    #[serde(rename = "customLabel2")]
5652    pub custom_label2: Option<String>,
5653    /// Custom label 3 for custom grouping of items in a Shopping campaign.
5654    #[serde(rename = "customLabel3")]
5655    pub custom_label3: Option<String>,
5656    /// Custom label 4 for custom grouping of items in a Shopping campaign.
5657    #[serde(rename = "customLabel4")]
5658    pub custom_label4: Option<String>,
5659    /// Description of the item.
5660    pub description: Option<String>,
5661    /// Specifies the intended destinations for the product.
5662    pub destinations: Option<Vec<ProductDestination>>,
5663    /// An identifier for an item for dynamic remarketing campaigns.
5664    #[serde(rename = "displayAdsId")]
5665    pub display_ads_id: Option<String>,
5666    /// URL directly to your item's landing page for dynamic remarketing campaigns.
5667    #[serde(rename = "displayAdsLink")]
5668    pub display_ads_link: Option<String>,
5669    /// Advertiser-specified recommendations.
5670    #[serde(rename = "displayAdsSimilarIds")]
5671    pub display_ads_similar_ids: Option<Vec<String>>,
5672    /// Title of an item for dynamic remarketing campaigns.
5673    #[serde(rename = "displayAdsTitle")]
5674    pub display_ads_title: Option<String>,
5675    /// Offer margin for dynamic remarketing campaigns.
5676    #[serde(rename = "displayAdsValue")]
5677    pub display_ads_value: Option<f64>,
5678    /// The energy efficiency class as defined in EU directive 2010/30/EU. Acceptable values are: - "`A`" - "`A+`" - "`A++`" - "`A+++`" - "`B`" - "`C`" - "`D`" - "`E`" - "`F`" - "`G`"
5679    #[serde(rename = "energyEfficiencyClass")]
5680    pub energy_efficiency_class: Option<String>,
5681    /// Date on which the item should expire, as specified upon insertion, in ISO 8601 format. The actual expiration date in Google Shopping is exposed in `productstatuses` as `googleExpirationDate` and might be earlier if `expirationDate` is too far in the future.
5682    #[serde(rename = "expirationDate")]
5683    pub expiration_date: Option<String>,
5684    /// Target gender of the item. Acceptable values are: - "`female`" - "`male`" - "`unisex`"
5685    pub gender: Option<String>,
5686    /// Google's category of the item (see [Google product taxonomy](https://support.google.com/merchants/answer/1705911)). When querying products, this field will contain the user provided value. There is currently no way to get back the auto assigned google product categories through the API.
5687    #[serde(rename = "googleProductCategory")]
5688    pub google_product_category: Option<String>,
5689    /// Global Trade Item Number (GTIN) of the item.
5690    pub gtin: Option<String>,
5691    /// The REST ID of the product. Content API methods that operate on products take this as their `productId` parameter. The REST ID for a product is of the form channel:contentLanguage: targetCountry: offerId.
5692    pub id: Option<String>,
5693    /// False when the item does not have unique product identifiers appropriate to its category, such as GTIN, MPN, and brand. Required according to the Unique Product Identifier Rules for all target countries except for Canada.
5694    #[serde(rename = "identifierExists")]
5695    pub identifier_exists: Option<bool>,
5696    /// URL of an image of the item.
5697    #[serde(rename = "imageLink")]
5698    pub image_link: Option<String>,
5699    /// Number and amount of installments to pay for an item.
5700    pub installment: Option<Installment>,
5701    /// Whether the item is a merchant-defined bundle. A bundle is a custom grouping of different products sold by a merchant for a single price.
5702    #[serde(rename = "isBundle")]
5703    pub is_bundle: Option<bool>,
5704    /// Shared identifier for all variants of the same product.
5705    #[serde(rename = "itemGroupId")]
5706    pub item_group_id: Option<String>,
5707    /// Identifies what kind of resource this is. Value: the fixed string "`content#product`"
5708    pub kind: Option<String>,
5709    /// URL directly linking to your item's page on your website.
5710    pub link: Option<String>,
5711    /// Loyalty points that users receive after purchasing the item. Japan only.
5712    #[serde(rename = "loyaltyPoints")]
5713    pub loyalty_points: Option<LoyaltyPoints>,
5714    /// The material of which the item is made.
5715    pub material: Option<String>,
5716    /// The energy efficiency class as defined in EU directive 2010/30/EU. Acceptable values are: - "`A`" - "`A+`" - "`A++`" - "`A+++`" - "`B`" - "`C`" - "`D`" - "`E`" - "`F`" - "`G`"
5717    #[serde(rename = "maxEnergyEfficiencyClass")]
5718    pub max_energy_efficiency_class: Option<String>,
5719    /// Maximal product handling time (in business days).
5720    #[serde(rename = "maxHandlingTime")]
5721    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5722    pub max_handling_time: Option<i64>,
5723    /// The energy efficiency class as defined in EU directive 2010/30/EU. Acceptable values are: - "`A`" - "`A+`" - "`A++`" - "`A+++`" - "`B`" - "`C`" - "`D`" - "`E`" - "`F`" - "`G`"
5724    #[serde(rename = "minEnergyEfficiencyClass")]
5725    pub min_energy_efficiency_class: Option<String>,
5726    /// Minimal product handling time (in business days).
5727    #[serde(rename = "minHandlingTime")]
5728    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5729    pub min_handling_time: Option<i64>,
5730    /// URL for the mobile-optimized version of your item's landing page.
5731    #[serde(rename = "mobileLink")]
5732    pub mobile_link: Option<String>,
5733    /// Manufacturer Part Number (MPN) of the item.
5734    pub mpn: Option<String>,
5735    /// The number of identical products in a merchant-defined multipack.
5736    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5737    pub multipack: Option<i64>,
5738    /// Required. A unique identifier for the item. Leading and trailing whitespaces are stripped and multiple whitespaces are replaced by a single whitespace upon submission. Only valid unicode characters are accepted. See the products feed specification for details. *Note:* Content API methods that operate on products take the REST ID of the product, *not* this identifier.
5739    #[serde(rename = "offerId")]
5740    pub offer_id: Option<String>,
5741    /// Deprecated.
5742    #[serde(rename = "onlineOnly")]
5743    pub online_only: Option<bool>,
5744    /// The item's pattern (e.g. polka dots).
5745    pub pattern: Option<String>,
5746    /// Price of the item.
5747    pub price: Option<Price>,
5748    /// Your category of the item (formatted as in products data specification).
5749    #[serde(rename = "productType")]
5750    pub product_type: Option<String>,
5751    /// The unique ID of a promotion.
5752    #[serde(rename = "promotionIds")]
5753    pub promotion_ids: Option<Vec<String>>,
5754    /// Advertised sale price of the item.
5755    #[serde(rename = "salePrice")]
5756    pub sale_price: Option<Price>,
5757    /// Date range during which the item is on sale (see products data specification ).
5758    #[serde(rename = "salePriceEffectiveDate")]
5759    pub sale_price_effective_date: Option<String>,
5760    /// The quantity of the product that is available for selling on Google. Supported only for online products.
5761    #[serde(rename = "sellOnGoogleQuantity")]
5762    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5763    pub sell_on_google_quantity: Option<i64>,
5764    /// Shipping rules.
5765    pub shipping: Option<Vec<ProductShipping>>,
5766    /// Height of the item for shipping.
5767    #[serde(rename = "shippingHeight")]
5768    pub shipping_height: Option<ProductShippingDimension>,
5769    /// The shipping label of the product, used to group product in account-level shipping rules.
5770    #[serde(rename = "shippingLabel")]
5771    pub shipping_label: Option<String>,
5772    /// Length of the item for shipping.
5773    #[serde(rename = "shippingLength")]
5774    pub shipping_length: Option<ProductShippingDimension>,
5775    /// Weight of the item for shipping.
5776    #[serde(rename = "shippingWeight")]
5777    pub shipping_weight: Option<ProductShippingWeight>,
5778    /// Width of the item for shipping.
5779    #[serde(rename = "shippingWidth")]
5780    pub shipping_width: Option<ProductShippingDimension>,
5781    /// System in which the size is specified. Recommended for apparel items. Acceptable values are: - "`AU`" - "`BR`" - "`CN`" - "`DE`" - "`EU`" - "`FR`" - "`IT`" - "`JP`" - "`MEX`" - "`UK`" - "`US`"
5782    #[serde(rename = "sizeSystem")]
5783    pub size_system: Option<String>,
5784    /// The cut of the item. Recommended for apparel items. Acceptable values are: - "`big and tall`" - "`maternity`" - "`oversize`" - "`petite`" - "`plus`" - "`regular`"
5785    #[serde(rename = "sizeType")]
5786    pub size_type: Option<String>,
5787    /// Size of the item. Only one value is allowed. For variants with different sizes, insert a separate product for each size with the same `itemGroupId` value (see size definition).
5788    pub sizes: Option<Vec<String>>,
5789    /// The source of the offer, i.e., how the offer was created. Acceptable values are: - "`api`" - "`crawl`" - "`feed`"
5790    pub source: Option<String>,
5791    /// Required. The CLDR territory code for the item.
5792    #[serde(rename = "targetCountry")]
5793    pub target_country: Option<String>,
5794    /// Tax information.
5795    pub taxes: Option<Vec<ProductTax>>,
5796    /// Title of the item.
5797    pub title: Option<String>,
5798    /// The preference of the denominator of the unit price.
5799    #[serde(rename = "unitPricingBaseMeasure")]
5800    pub unit_pricing_base_measure: Option<ProductUnitPricingBaseMeasure>,
5801    /// The measure and dimension of an item.
5802    #[serde(rename = "unitPricingMeasure")]
5803    pub unit_pricing_measure: Option<ProductUnitPricingMeasure>,
5804    /// Deprecated. The read-only list of intended destinations which passed validation.
5805    #[serde(rename = "validatedDestinations")]
5806    pub validated_destinations: Option<Vec<String>>,
5807    /// Read-only warnings.
5808    pub warnings: Option<Vec<Error>>,
5809}
5810
5811impl common::RequestValue for Product {}
5812impl common::Resource for Product {}
5813impl common::ResponseResult for Product {}
5814
5815/// There is no detailed description.
5816///
5817/// This type is not used in any activity, and only used as *part* of another schema.
5818///
5819#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5820#[serde_with::serde_as]
5821#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5822pub struct ProductAmount {
5823    /// The pre-tax or post-tax price depending on the location of the order.
5824    #[serde(rename = "priceAmount")]
5825    pub price_amount: Option<Price>,
5826    /// Remitted tax value.
5827    #[serde(rename = "remittedTaxAmount")]
5828    pub remitted_tax_amount: Option<Price>,
5829    /// Tax value.
5830    #[serde(rename = "taxAmount")]
5831    pub tax_amount: Option<Price>,
5832}
5833
5834impl common::Part for ProductAmount {}
5835
5836/// There is no detailed description.
5837///
5838/// This type is not used in any activity, and only used as *part* of another schema.
5839///
5840#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5841#[serde_with::serde_as]
5842#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5843pub struct ProductAspect {
5844    /// Deprecated.
5845    #[serde(rename = "aspectName")]
5846    pub aspect_name: Option<String>,
5847    /// Deprecated.
5848    #[serde(rename = "destinationName")]
5849    pub destination_name: Option<String>,
5850    /// Deprecated.
5851    pub intention: Option<String>,
5852}
5853
5854impl common::Part for ProductAspect {}
5855
5856/// There is no detailed description.
5857///
5858/// This type is not used in any activity, and only used as *part* of another schema.
5859///
5860#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5861#[serde_with::serde_as]
5862#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5863pub struct ProductDestination {
5864    /// The name of the destination.
5865    #[serde(rename = "destinationName")]
5866    pub destination_name: Option<String>,
5867    /// Whether the destination is required, excluded or should be validated. Acceptable values are: - "`default`" - "`excluded`" - "`optional`" - "`required`"
5868    pub intention: Option<String>,
5869}
5870
5871impl common::Part for ProductDestination {}
5872
5873/// There is no detailed description.
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 ProductShipping {
5881    /// The CLDR territory code of the country to which an item will ship.
5882    pub country: Option<String>,
5883    /// The location where the shipping is applicable, represented by a location group name.
5884    #[serde(rename = "locationGroupName")]
5885    pub location_group_name: Option<String>,
5886    /// The numeric ID of a location that the shipping rate applies to as defined in the AdWords API.
5887    #[serde(rename = "locationId")]
5888    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5889    pub location_id: Option<i64>,
5890    /// The postal code range that the shipping rate applies to, represented by a postal code, a postal code prefix followed by a * wildcard, a range between two postal codes or two postal code prefixes of equal length.
5891    #[serde(rename = "postalCode")]
5892    pub postal_code: Option<String>,
5893    /// Fixed shipping price, represented as a number.
5894    pub price: Option<Price>,
5895    /// The geographic region to which a shipping rate applies.
5896    pub region: Option<String>,
5897    /// A free-form description of the service class or delivery speed.
5898    pub service: Option<String>,
5899}
5900
5901impl common::Part for ProductShipping {}
5902
5903/// There is no detailed description.
5904///
5905/// This type is not used in any activity, and only used as *part* of another schema.
5906///
5907#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5908#[serde_with::serde_as]
5909#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5910pub struct ProductShippingDimension {
5911    /// The unit of value.
5912    pub unit: Option<String>,
5913    /// The dimension of the product used to calculate the shipping cost of the item.
5914    pub value: Option<f64>,
5915}
5916
5917impl common::Part for ProductShippingDimension {}
5918
5919/// There is no detailed description.
5920///
5921/// This type is not used in any activity, and only used as *part* of another schema.
5922///
5923#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5924#[serde_with::serde_as]
5925#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5926pub struct ProductShippingWeight {
5927    /// The unit of value.
5928    pub unit: Option<String>,
5929    /// The weight of the product used to calculate the shipping cost of the item.
5930    pub value: Option<f64>,
5931}
5932
5933impl common::Part for ProductShippingWeight {}
5934
5935/// The status of a product, i.e., information about a product computed asynchronously.
5936///
5937/// # Activities
5938///
5939/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5940/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5941///
5942/// * [get productstatuses](ProductstatusGetCall) (response)
5943#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5944#[serde_with::serde_as]
5945#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5946pub struct ProductStatus {
5947    /// Date on which the item has been created, in ISO 8601 format.
5948    #[serde(rename = "creationDate")]
5949    pub creation_date: Option<String>,
5950    /// DEPRECATED - never populated
5951    #[serde(rename = "dataQualityIssues")]
5952    pub data_quality_issues: Option<Vec<ProductStatusDataQualityIssue>>,
5953    /// The intended destinations for the product.
5954    #[serde(rename = "destinationStatuses")]
5955    pub destination_statuses: Option<Vec<ProductStatusDestinationStatus>>,
5956    /// Date on which the item expires in Google Shopping, in ISO 8601 format.
5957    #[serde(rename = "googleExpirationDate")]
5958    pub google_expiration_date: Option<String>,
5959    /// A list of all issues associated with the product.
5960    #[serde(rename = "itemLevelIssues")]
5961    pub item_level_issues: Option<Vec<ProductStatusItemLevelIssue>>,
5962    /// Identifies what kind of resource this is. Value: the fixed string "`content#productStatus`"
5963    pub kind: Option<String>,
5964    /// Date on which the item has been last updated, in ISO 8601 format.
5965    #[serde(rename = "lastUpdateDate")]
5966    pub last_update_date: Option<String>,
5967    /// The link to the product.
5968    pub link: Option<String>,
5969    /// Product data after applying all the join inputs.
5970    pub product: Option<Product>,
5971    /// The ID of the product for which status is reported.
5972    #[serde(rename = "productId")]
5973    pub product_id: Option<String>,
5974    /// The title of the product.
5975    pub title: Option<String>,
5976}
5977
5978impl common::ResponseResult for ProductStatus {}
5979
5980/// There is no detailed description.
5981///
5982/// This type is not used in any activity, and only used as *part* of another schema.
5983///
5984#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5985#[serde_with::serde_as]
5986#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5987pub struct ProductStatusDataQualityIssue {
5988    /// no description provided
5989    pub destination: Option<String>,
5990    /// no description provided
5991    pub detail: Option<String>,
5992    /// no description provided
5993    #[serde(rename = "fetchStatus")]
5994    pub fetch_status: Option<String>,
5995    /// no description provided
5996    pub id: Option<String>,
5997    /// no description provided
5998    pub location: Option<String>,
5999    /// no description provided
6000    pub severity: Option<String>,
6001    /// no description provided
6002    pub timestamp: Option<String>,
6003    /// no description provided
6004    #[serde(rename = "valueOnLandingPage")]
6005    pub value_on_landing_page: Option<String>,
6006    /// no description provided
6007    #[serde(rename = "valueProvided")]
6008    pub value_provided: Option<String>,
6009}
6010
6011impl common::Part for ProductStatusDataQualityIssue {}
6012
6013/// There is no detailed description.
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 ProductStatusDestinationStatus {
6021    /// Whether the approval status might change due to further processing.
6022    #[serde(rename = "approvalPending")]
6023    pub approval_pending: Option<bool>,
6024    /// The destination's approval status. Acceptable values are: - "`approved`" - "`disapproved`"
6025    #[serde(rename = "approvalStatus")]
6026    pub approval_status: Option<String>,
6027    /// The name of the destination
6028    pub destination: Option<String>,
6029    /// Provided for backward compatibility only. Always set to "required". Acceptable values are: - "`default`" - "`excluded`" - "`optional`" - "`required`"
6030    pub intention: Option<String>,
6031}
6032
6033impl common::Part for ProductStatusDestinationStatus {}
6034
6035/// There is no detailed description.
6036///
6037/// This type is not used in any activity, and only used as *part* of another schema.
6038///
6039#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6040#[serde_with::serde_as]
6041#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6042pub struct ProductStatusItemLevelIssue {
6043    /// The attribute's name, if the issue is caused by a single attribute.
6044    #[serde(rename = "attributeName")]
6045    pub attribute_name: Option<String>,
6046    /// The error code of the issue.
6047    pub code: Option<String>,
6048    /// A short issue description in English.
6049    pub description: Option<String>,
6050    /// The destination the issue applies to.
6051    pub destination: Option<String>,
6052    /// A detailed issue description in English.
6053    pub detail: Option<String>,
6054    /// The URL of a web page to help with resolving this issue.
6055    pub documentation: Option<String>,
6056    /// Whether the issue can be resolved by the merchant.
6057    pub resolution: Option<String>,
6058    /// How this issue affects serving of the offer.
6059    pub servability: Option<String>,
6060}
6061
6062impl common::Part for ProductStatusItemLevelIssue {}
6063
6064/// There is no detailed description.
6065///
6066/// This type is not used in any activity, and only used as *part* of another schema.
6067///
6068#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6069#[serde_with::serde_as]
6070#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6071pub struct ProductTax {
6072    /// The country within which the item is taxed, specified as a CLDR territory code.
6073    pub country: Option<String>,
6074    /// The numeric ID of a location that the tax rate applies to as defined in the AdWords API.
6075    #[serde(rename = "locationId")]
6076    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6077    pub location_id: Option<i64>,
6078    /// The postal code range that the tax rate applies to, represented by a ZIP code, a ZIP code prefix using * wildcard, a range between two ZIP codes or two ZIP code prefixes of equal length. Examples: 94114, 94*, 94002-95460, 94*-95*.
6079    #[serde(rename = "postalCode")]
6080    pub postal_code: Option<String>,
6081    /// The percentage of tax rate that applies to the item price.
6082    pub rate: Option<f64>,
6083    /// The geographic region to which the tax rate applies.
6084    pub region: Option<String>,
6085    /// Should be set to true if tax is charged on shipping.
6086    #[serde(rename = "taxShip")]
6087    pub tax_ship: Option<bool>,
6088}
6089
6090impl common::Part for ProductTax {}
6091
6092/// There is no detailed description.
6093///
6094/// This type is not used in any activity, and only used as *part* of another schema.
6095///
6096#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6097#[serde_with::serde_as]
6098#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6099pub struct ProductUnitPricingBaseMeasure {
6100    /// The unit of the denominator.
6101    pub unit: Option<String>,
6102    /// The denominator of the unit price.
6103    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6104    pub value: Option<i64>,
6105}
6106
6107impl common::Part for ProductUnitPricingBaseMeasure {}
6108
6109/// There is no detailed description.
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 ProductUnitPricingMeasure {
6117    /// The unit of the measure.
6118    pub unit: Option<String>,
6119    /// The measure of an item.
6120    pub value: Option<f64>,
6121}
6122
6123impl common::Part for ProductUnitPricingMeasure {}
6124
6125/// There is no detailed description.
6126///
6127/// # Activities
6128///
6129/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6130/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6131///
6132/// * [custombatch products](ProductCustombatchCall) (request)
6133#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6134#[serde_with::serde_as]
6135#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6136pub struct ProductsCustomBatchRequest {
6137    /// The request entries to be processed in the batch.
6138    pub entries: Option<Vec<ProductsCustomBatchRequestEntry>>,
6139}
6140
6141impl common::RequestValue for ProductsCustomBatchRequest {}
6142
6143/// A batch entry encoding a single non-batch products request.
6144///
6145/// This type is not used in any activity, and only used as *part* of another schema.
6146///
6147#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6148#[serde_with::serde_as]
6149#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6150pub struct ProductsCustomBatchRequestEntry {
6151    /// An entry ID, unique within the batch request.
6152    #[serde(rename = "batchId")]
6153    pub batch_id: Option<u32>,
6154    /// The ID of the managing account.
6155    #[serde(rename = "merchantId")]
6156    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6157    pub merchant_id: Option<u64>,
6158    /// The method of the batch entry. Acceptable values are: - "`delete`" - "`get`" - "`insert`"
6159    pub method: Option<String>,
6160    /// The product to insert. Only required if the method is `insert`.
6161    pub product: Option<Product>,
6162    /// The ID of the product to get or delete. Only defined if the method is `get` or `delete`.
6163    #[serde(rename = "productId")]
6164    pub product_id: Option<String>,
6165}
6166
6167impl common::Part for ProductsCustomBatchRequestEntry {}
6168
6169/// There is no detailed description.
6170///
6171/// # Activities
6172///
6173/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6174/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6175///
6176/// * [custombatch products](ProductCustombatchCall) (response)
6177#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6178#[serde_with::serde_as]
6179#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6180pub struct ProductsCustomBatchResponse {
6181    /// The result of the execution of the batch requests.
6182    pub entries: Option<Vec<ProductsCustomBatchResponseEntry>>,
6183    /// Identifies what kind of resource this is. Value: the fixed string "content#productsCustomBatchResponse".
6184    pub kind: Option<String>,
6185}
6186
6187impl common::ResponseResult for ProductsCustomBatchResponse {}
6188
6189/// A batch entry encoding a single non-batch products response.
6190///
6191/// This type is not used in any activity, and only used as *part* of another schema.
6192///
6193#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6194#[serde_with::serde_as]
6195#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6196pub struct ProductsCustomBatchResponseEntry {
6197    /// The ID of the request entry this entry responds to.
6198    #[serde(rename = "batchId")]
6199    pub batch_id: Option<u32>,
6200    /// A list of errors defined if and only if the request failed.
6201    pub errors: Option<Errors>,
6202    /// Identifies what kind of resource this is. Value: the fixed string "`content#productsCustomBatchResponseEntry`"
6203    pub kind: Option<String>,
6204    /// The inserted product. Only defined if the method is `insert` and if the request was successful.
6205    pub product: Option<Product>,
6206}
6207
6208impl common::Part for ProductsCustomBatchResponseEntry {}
6209
6210/// There is no detailed description.
6211///
6212/// # Activities
6213///
6214/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6215/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6216///
6217/// * [list products](ProductListCall) (response)
6218#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6219#[serde_with::serde_as]
6220#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6221pub struct ProductsListResponse {
6222    /// Identifies what kind of resource this is. Value: the fixed string "content#productsListResponse".
6223    pub kind: Option<String>,
6224    /// The token for the retrieval of the next page of products.
6225    #[serde(rename = "nextPageToken")]
6226    pub next_page_token: Option<String>,
6227    /// no description provided
6228    pub resources: Option<Vec<Product>>,
6229}
6230
6231impl common::ResponseResult for ProductsListResponse {}
6232
6233/// There is no detailed description.
6234///
6235/// # Activities
6236///
6237/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6238/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6239///
6240/// * [custombatch productstatuses](ProductstatusCustombatchCall) (request)
6241#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6242#[serde_with::serde_as]
6243#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6244pub struct ProductstatusesCustomBatchRequest {
6245    /// The request entries to be processed in the batch.
6246    pub entries: Option<Vec<ProductstatusesCustomBatchRequestEntry>>,
6247}
6248
6249impl common::RequestValue for ProductstatusesCustomBatchRequest {}
6250
6251/// A batch entry encoding a single non-batch productstatuses request.
6252///
6253/// This type is not used in any activity, and only used as *part* of another schema.
6254///
6255#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6256#[serde_with::serde_as]
6257#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6258pub struct ProductstatusesCustomBatchRequestEntry {
6259    /// An entry ID, unique within the batch request.
6260    #[serde(rename = "batchId")]
6261    pub batch_id: Option<u32>,
6262    /// If set, only issues for the specified destinations are returned, otherwise only issues for the Shopping destination.
6263    pub destinations: Option<Vec<String>>,
6264    /// no description provided
6265    #[serde(rename = "includeAttributes")]
6266    pub include_attributes: Option<bool>,
6267    /// The ID of the managing account.
6268    #[serde(rename = "merchantId")]
6269    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6270    pub merchant_id: Option<u64>,
6271    /// The method of the batch entry. Acceptable values are: - "`get`"
6272    pub method: Option<String>,
6273    /// The ID of the product whose status to get.
6274    #[serde(rename = "productId")]
6275    pub product_id: Option<String>,
6276}
6277
6278impl common::Part for ProductstatusesCustomBatchRequestEntry {}
6279
6280/// There is no detailed description.
6281///
6282/// # Activities
6283///
6284/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6285/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6286///
6287/// * [custombatch productstatuses](ProductstatusCustombatchCall) (response)
6288#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6289#[serde_with::serde_as]
6290#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6291pub struct ProductstatusesCustomBatchResponse {
6292    /// The result of the execution of the batch requests.
6293    pub entries: Option<Vec<ProductstatusesCustomBatchResponseEntry>>,
6294    /// Identifies what kind of resource this is. Value: the fixed string "content#productstatusesCustomBatchResponse".
6295    pub kind: Option<String>,
6296}
6297
6298impl common::ResponseResult for ProductstatusesCustomBatchResponse {}
6299
6300/// A batch entry encoding a single non-batch productstatuses response.
6301///
6302/// This type is not used in any activity, and only used as *part* of another schema.
6303///
6304#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6305#[serde_with::serde_as]
6306#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6307pub struct ProductstatusesCustomBatchResponseEntry {
6308    /// The ID of the request entry this entry responds to.
6309    #[serde(rename = "batchId")]
6310    pub batch_id: Option<u32>,
6311    /// A list of errors, if the request failed.
6312    pub errors: Option<Errors>,
6313    /// Identifies what kind of resource this is. Value: the fixed string "`content#productstatusesCustomBatchResponseEntry`"
6314    pub kind: Option<String>,
6315    /// The requested product status. Only defined if the request was successful.
6316    #[serde(rename = "productStatus")]
6317    pub product_status: Option<ProductStatus>,
6318}
6319
6320impl common::Part for ProductstatusesCustomBatchResponseEntry {}
6321
6322/// There is no detailed description.
6323///
6324/// # Activities
6325///
6326/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6327/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6328///
6329/// * [list productstatuses](ProductstatusListCall) (response)
6330#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6331#[serde_with::serde_as]
6332#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6333pub struct ProductstatusesListResponse {
6334    /// Identifies what kind of resource this is. Value: the fixed string "content#productstatusesListResponse".
6335    pub kind: Option<String>,
6336    /// The token for the retrieval of the next page of products statuses.
6337    #[serde(rename = "nextPageToken")]
6338    pub next_page_token: Option<String>,
6339    /// no description provided
6340    pub resources: Option<Vec<ProductStatus>>,
6341}
6342
6343impl common::ResponseResult for ProductstatusesListResponse {}
6344
6345/// There is no detailed description.
6346///
6347/// This type is not used in any activity, and only used as *part* of another schema.
6348///
6349#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6350#[serde_with::serde_as]
6351#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6352pub struct Promotion {
6353    /// [required] Amount of the promotion. The values here are the promotion applied to the unit price pretax and to the total of the tax amounts.
6354    #[serde(rename = "promotionAmount")]
6355    pub promotion_amount: Option<Amount>,
6356    /// [required] ID of the promotion.
6357    #[serde(rename = "promotionId")]
6358    pub promotion_id: Option<String>,
6359}
6360
6361impl common::Part for Promotion {}
6362
6363/// There is no detailed description.
6364///
6365/// This type is not used in any activity, and only used as *part* of another schema.
6366///
6367#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6368#[serde_with::serde_as]
6369#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6370pub struct RateGroup {
6371    /// A list of shipping labels defining the products to which this rate group applies to. This is a disjunction: only one of the labels has to match for the rate group to apply. May only be empty for the last rate group of a service. Required.
6372    #[serde(rename = "applicableShippingLabels")]
6373    pub applicable_shipping_labels: Option<Vec<String>>,
6374    /// A list of carrier rates that can be referred to by `mainTable` or `singleValue`.
6375    #[serde(rename = "carrierRates")]
6376    pub carrier_rates: Option<Vec<CarrierRate>>,
6377    /// A table defining the rate group, when `singleValue` is not expressive enough. Can only be set if `singleValue` is not set.
6378    #[serde(rename = "mainTable")]
6379    pub main_table: Option<Table>,
6380    /// Name of the rate group. Optional. If set has to be unique within shipping service.
6381    pub name: Option<String>,
6382    /// The value of the rate group (e.g. flat rate $10). Can only be set if `mainTable` and `subtables` are not set.
6383    #[serde(rename = "singleValue")]
6384    pub single_value: Option<Value>,
6385    /// A list of subtables referred to by `mainTable`. Can only be set if `mainTable` is set.
6386    pub subtables: Option<Vec<Table>>,
6387}
6388
6389impl common::Part for RateGroup {}
6390
6391/// There is no detailed description.
6392///
6393/// This type is not used in any activity, and only used as *part* of another schema.
6394///
6395#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6396#[serde_with::serde_as]
6397#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6398pub struct RefundReason {
6399    /// Description of the reason.
6400    pub description: Option<String>,
6401    /// Code of the refund reason. Acceptable values are: - "`adjustment`" - "`autoPostInternal`" - "`autoPostInvalidBillingAddress`" - "`autoPostNoInventory`" - "`autoPostPriceError`" - "`autoPostUndeliverableShippingAddress`" - "`couponAbuse`" - "`courtesyAdjustment`" - "`customerCanceled`" - "`customerDiscretionaryReturn`" - "`customerInitiatedMerchantCancel`" - "`customerSupportRequested`" - "`deliveredLateByCarrier`" - "`deliveredTooLate`" - "`expiredItem`" - "`failToPushOrderGoogleError`" - "`failToPushOrderMerchantError`" - "`failToPushOrderMerchantFulfillmentError`" - "`failToPushOrderToMerchant`" - "`failToPushOrderToMerchantOutOfStock`" - "`feeAdjustment`" - "`invalidCoupon`" - "`lateShipmentCredit`" - "`malformedShippingAddress`" - "`merchantDidNotShipOnTime`" - "`noInventory`" - "`orderTimeout`" - "`other`" - "`paymentAbuse`" - "`paymentDeclined`" - "`priceAdjustment`" - "`priceError`" - "`productArrivedDamaged`" - "`productNotAsDescribed`" - "`promoReallocation`" - "`qualityNotAsExpected`" - "`returnRefundAbuse`" - "`shippingCostAdjustment`" - "`shippingPriceError`" - "`taxAdjustment`" - "`taxError`" - "`undeliverableShippingAddress`" - "`unsupportedPoBoxAddress`" - "`wrongProductShipped`"
6402    #[serde(rename = "reasonCode")]
6403    pub reason_code: Option<String>,
6404}
6405
6406impl common::Part for RefundReason {}
6407
6408/// There is no detailed description.
6409///
6410/// This type is not used in any activity, and only used as *part* of another schema.
6411///
6412#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6413#[serde_with::serde_as]
6414#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6415pub struct ReturnShipment {
6416    /// The date of creation of the shipment, in ISO 8601 format.
6417    #[serde(rename = "creationDate")]
6418    pub creation_date: Option<String>,
6419    /// The date of delivery of the shipment, in ISO 8601 format.
6420    #[serde(rename = "deliveryDate")]
6421    pub delivery_date: Option<String>,
6422    /// Type of the return method. Acceptable values are: - "`byMail`" - "`contactCustomerSupport`" - "`returnless`"
6423    #[serde(rename = "returnMethodType")]
6424    pub return_method_type: Option<String>,
6425    /// Shipment ID generated by Google.
6426    #[serde(rename = "shipmentId")]
6427    pub shipment_id: Option<String>,
6428    /// Tracking information of the shipment. One return shipment might be handled by several shipping carriers sequentially.
6429    #[serde(rename = "shipmentTrackingInfos")]
6430    pub shipment_tracking_infos: Option<Vec<ShipmentTrackingInfo>>,
6431    /// The date of shipping of the shipment, in ISO 8601 format.
6432    #[serde(rename = "shippingDate")]
6433    pub shipping_date: Option<String>,
6434    /// State of the shipment. Acceptable values are: - "`completed`" - "`new`" - "`shipped`" - "`undeliverable`" - "`pending`"
6435    pub state: Option<String>,
6436}
6437
6438impl common::Part for ReturnShipment {}
6439
6440/// There is no detailed description.
6441///
6442/// This type is not used in any activity, and only used as *part* of another schema.
6443///
6444#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6445#[serde_with::serde_as]
6446#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6447pub struct Row {
6448    /// The list of cells that constitute the row. Must have the same length as `columnHeaders` for two-dimensional tables, a length of 1 for one-dimensional tables. Required.
6449    pub cells: Option<Vec<Value>>,
6450}
6451
6452impl common::Part for Row {}
6453
6454/// There is no detailed description.
6455///
6456/// This type is not used in any activity, and only used as *part* of another schema.
6457///
6458#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6459#[serde_with::serde_as]
6460#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6461pub struct Service {
6462    /// A boolean exposing the active status of the shipping service. Required.
6463    pub active: Option<bool>,
6464    /// The CLDR code of the currency to which this service applies. Must match that of the prices in rate groups.
6465    pub currency: Option<String>,
6466    /// The CLDR territory code of the country to which the service applies. Required.
6467    #[serde(rename = "deliveryCountry")]
6468    pub delivery_country: Option<String>,
6469    /// Time spent in various aspects from order to the delivery of the product. Required.
6470    #[serde(rename = "deliveryTime")]
6471    pub delivery_time: Option<DeliveryTime>,
6472    /// Eligibility for this service. Acceptable values are: - "`All scenarios`" - "`All scenarios except Shopping Actions`" - "`Shopping Actions`"
6473    pub eligibility: Option<String>,
6474    /// Minimum order value for this service. If set, indicates that customers will have to spend at least this amount. All prices within a service must have the same currency. Cannot be set together with minimum_order_value_table.
6475    #[serde(rename = "minimumOrderValue")]
6476    pub minimum_order_value: Option<Price>,
6477    /// Table of per store minimum order values for the pickup fulfillment type. Cannot be set together with minimum_order_value.
6478    #[serde(rename = "minimumOrderValueTable")]
6479    pub minimum_order_value_table: Option<MinimumOrderValueTable>,
6480    /// Free-form name of the service. Must be unique within target account. Required.
6481    pub name: Option<String>,
6482    /// The carrier-service pair delivering items to collection points. The list of supported pickup services can be retrieved via the `getSupportedPickupServices` method. Required if and only if the service delivery type is `pickup`.
6483    #[serde(rename = "pickupService")]
6484    pub pickup_service: Option<PickupCarrierService>,
6485    /// Shipping rate group definitions. Only the last one is allowed to have an empty `applicableShippingLabels`, which means "everything else". The other `applicableShippingLabels` must not overlap.
6486    #[serde(rename = "rateGroups")]
6487    pub rate_groups: Option<Vec<RateGroup>>,
6488    /// Type of locations this service ships orders to. Acceptable values are: - "`delivery`" - "`pickup`"
6489    #[serde(rename = "shipmentType")]
6490    pub shipment_type: Option<String>,
6491}
6492
6493impl common::Part for Service {}
6494
6495/// There is no detailed description.
6496///
6497/// This type is not used in any activity, and only used as *part* of another schema.
6498///
6499#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6500#[serde_with::serde_as]
6501#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6502pub struct ShipmentInvoice {
6503    /// [required] Invoice summary.
6504    #[serde(rename = "invoiceSummary")]
6505    pub invoice_summary: Option<InvoiceSummary>,
6506    /// [required] Invoice details per line item.
6507    #[serde(rename = "lineItemInvoices")]
6508    pub line_item_invoices: Option<Vec<ShipmentInvoiceLineItemInvoice>>,
6509    /// [required] ID of the shipment group. It is assigned by the merchant in the `shipLineItems` method and is used to group multiple line items that have the same kind of shipping charges.
6510    #[serde(rename = "shipmentGroupId")]
6511    pub shipment_group_id: Option<String>,
6512}
6513
6514impl common::Part for ShipmentInvoice {}
6515
6516/// There is no detailed description.
6517///
6518/// This type is not used in any activity, and only used as *part* of another schema.
6519///
6520#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6521#[serde_with::serde_as]
6522#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6523pub struct ShipmentInvoiceLineItemInvoice {
6524    /// ID of the line item. Either lineItemId or productId must be set.
6525    #[serde(rename = "lineItemId")]
6526    pub line_item_id: Option<String>,
6527    /// ID of the product. This is the REST ID used in the products service. Either lineItemId or productId must be set.
6528    #[serde(rename = "productId")]
6529    pub product_id: Option<String>,
6530    /// [required] The shipment unit ID is assigned by the merchant and defines individual quantities within a line item. The same ID can be assigned to units that are the same while units that differ must be assigned a different ID (for example: free or promotional units).
6531    #[serde(rename = "shipmentUnitIds")]
6532    pub shipment_unit_ids: Option<Vec<String>>,
6533    /// [required] Invoice details for a single unit.
6534    #[serde(rename = "unitInvoice")]
6535    pub unit_invoice: Option<UnitInvoice>,
6536}
6537
6538impl common::Part for ShipmentInvoiceLineItemInvoice {}
6539
6540/// There is no detailed description.
6541///
6542/// This type is not used in any activity, and only used as *part* of another schema.
6543///
6544#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6545#[serde_with::serde_as]
6546#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6547pub struct ShipmentTrackingInfo {
6548    /// The shipping carrier that handles the package. Acceptable values are: - "`boxtal`" - "`bpost`" - "`chronopost`" - "`colisPrive`" - "`colissimo`" - "`cxt`" - "`deliv`" - "`dhl`" - "`dpd`" - "`dynamex`" - "`eCourier`" - "`easypost`" - "`efw`" - "`fedex`" - "`fedexSmartpost`" - "`geodis`" - "`gls`" - "`googleCourier`" - "`gsx`" - "`jdLogistics`" - "`laPoste`" - "`lasership`" - "`manual`" - "`mpx`" - "`onTrac`" - "`other`" - "`tnt`" - "`uds`" - "`ups`" - "`usps`"
6549    pub carrier: Option<String>,
6550    /// The tracking number for the package.
6551    #[serde(rename = "trackingNumber")]
6552    pub tracking_number: Option<String>,
6553}
6554
6555impl common::Part for ShipmentTrackingInfo {}
6556
6557/// The merchant account’s shipping settings. All methods except getsupportedcarriers and getsupportedholidays require the admin role.
6558///
6559/// # Activities
6560///
6561/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6562/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6563///
6564/// * [get shippingsettings](ShippingsettingGetCall) (response)
6565/// * [update shippingsettings](ShippingsettingUpdateCall) (request|response)
6566#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6567#[serde_with::serde_as]
6568#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6569pub struct ShippingSettings {
6570    /// The ID of the account to which these account shipping settings belong. Ignored upon update, always present in get request responses.
6571    #[serde(rename = "accountId")]
6572    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6573    pub account_id: Option<u64>,
6574    /// A list of postal code groups that can be referred to in `services`. Optional.
6575    #[serde(rename = "postalCodeGroups")]
6576    pub postal_code_groups: Option<Vec<PostalCodeGroup>>,
6577    /// The target account's list of services. Optional.
6578    pub services: Option<Vec<Service>>,
6579    /// Optional. A list of warehouses which can be referred to in `services`.
6580    pub warehouses: Option<Vec<Warehouse>>,
6581}
6582
6583impl common::RequestValue for ShippingSettings {}
6584impl common::ResponseResult for ShippingSettings {}
6585
6586/// There is no detailed description.
6587///
6588/// # Activities
6589///
6590/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6591/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6592///
6593/// * [custombatch shippingsettings](ShippingsettingCustombatchCall) (request)
6594#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6595#[serde_with::serde_as]
6596#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6597pub struct ShippingsettingsCustomBatchRequest {
6598    /// The request entries to be processed in the batch.
6599    pub entries: Option<Vec<ShippingsettingsCustomBatchRequestEntry>>,
6600}
6601
6602impl common::RequestValue for ShippingsettingsCustomBatchRequest {}
6603
6604/// A batch entry encoding a single non-batch shippingsettings request.
6605///
6606/// This type is not used in any activity, and only used as *part* of another schema.
6607///
6608#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6609#[serde_with::serde_as]
6610#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6611pub struct ShippingsettingsCustomBatchRequestEntry {
6612    /// The ID of the account for which to get/update account shipping settings.
6613    #[serde(rename = "accountId")]
6614    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6615    pub account_id: Option<u64>,
6616    /// An entry ID, unique within the batch request.
6617    #[serde(rename = "batchId")]
6618    pub batch_id: Option<u32>,
6619    /// The ID of the managing account.
6620    #[serde(rename = "merchantId")]
6621    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6622    pub merchant_id: Option<u64>,
6623    /// The method of the batch entry. Acceptable values are: - "`get`" - "`update`"
6624    pub method: Option<String>,
6625    /// The account shipping settings to update. Only defined if the method is `update`.
6626    #[serde(rename = "shippingSettings")]
6627    pub shipping_settings: Option<ShippingSettings>,
6628}
6629
6630impl common::Part for ShippingsettingsCustomBatchRequestEntry {}
6631
6632/// There is no detailed description.
6633///
6634/// # Activities
6635///
6636/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6637/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6638///
6639/// * [custombatch shippingsettings](ShippingsettingCustombatchCall) (response)
6640#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6641#[serde_with::serde_as]
6642#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6643pub struct ShippingsettingsCustomBatchResponse {
6644    /// The result of the execution of the batch requests.
6645    pub entries: Option<Vec<ShippingsettingsCustomBatchResponseEntry>>,
6646    /// Identifies what kind of resource this is. Value: the fixed string "content#shippingsettingsCustomBatchResponse".
6647    pub kind: Option<String>,
6648}
6649
6650impl common::ResponseResult for ShippingsettingsCustomBatchResponse {}
6651
6652/// A batch entry encoding a single non-batch shipping settings response.
6653///
6654/// This type is not used in any activity, and only used as *part* of another schema.
6655///
6656#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6657#[serde_with::serde_as]
6658#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6659pub struct ShippingsettingsCustomBatchResponseEntry {
6660    /// The ID of the request entry to which this entry responds.
6661    #[serde(rename = "batchId")]
6662    pub batch_id: Option<u32>,
6663    /// A list of errors defined if, and only if, the request failed.
6664    pub errors: Option<Errors>,
6665    /// Identifies what kind of resource this is. Value: the fixed string "`content#shippingsettingsCustomBatchResponseEntry`"
6666    pub kind: Option<String>,
6667    /// The retrieved or updated account shipping settings.
6668    #[serde(rename = "shippingSettings")]
6669    pub shipping_settings: Option<ShippingSettings>,
6670}
6671
6672impl common::Part for ShippingsettingsCustomBatchResponseEntry {}
6673
6674/// There is no detailed description.
6675///
6676/// # Activities
6677///
6678/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6679/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6680///
6681/// * [getsupportedcarriers shippingsettings](ShippingsettingGetsupportedcarrierCall) (response)
6682#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6683#[serde_with::serde_as]
6684#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6685pub struct ShippingsettingsGetSupportedCarriersResponse {
6686    /// A list of supported carriers. May be empty.
6687    pub carriers: Option<Vec<CarriersCarrier>>,
6688    /// Identifies what kind of resource this is. Value: the fixed string "content#shippingsettingsGetSupportedCarriersResponse".
6689    pub kind: Option<String>,
6690}
6691
6692impl common::ResponseResult for ShippingsettingsGetSupportedCarriersResponse {}
6693
6694/// There is no detailed description.
6695///
6696/// # Activities
6697///
6698/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6699/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6700///
6701/// * [getsupportedholidays shippingsettings](ShippingsettingGetsupportedholidayCall) (response)
6702#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6703#[serde_with::serde_as]
6704#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6705pub struct ShippingsettingsGetSupportedHolidaysResponse {
6706    /// A list of holidays applicable for delivery guarantees. May be empty.
6707    pub holidays: Option<Vec<HolidaysHoliday>>,
6708    /// Identifies what kind of resource this is. Value: the fixed string "content#shippingsettingsGetSupportedHolidaysResponse".
6709    pub kind: Option<String>,
6710}
6711
6712impl common::ResponseResult for ShippingsettingsGetSupportedHolidaysResponse {}
6713
6714/// There is no detailed description.
6715///
6716/// # Activities
6717///
6718/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6719/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6720///
6721/// * [getsupportedpickupservices shippingsettings](ShippingsettingGetsupportedpickupserviceCall) (response)
6722#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6723#[serde_with::serde_as]
6724#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6725pub struct ShippingsettingsGetSupportedPickupServicesResponse {
6726    /// Identifies what kind of resource this is. Value: the fixed string "content#shippingsettingsGetSupportedPickupServicesResponse".
6727    pub kind: Option<String>,
6728    /// A list of supported pickup services. May be empty.
6729    #[serde(rename = "pickupServices")]
6730    pub pickup_services: Option<Vec<PickupServicesPickupService>>,
6731}
6732
6733impl common::ResponseResult for ShippingsettingsGetSupportedPickupServicesResponse {}
6734
6735/// There is no detailed description.
6736///
6737/// # Activities
6738///
6739/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6740/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6741///
6742/// * [list shippingsettings](ShippingsettingListCall) (response)
6743#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6744#[serde_with::serde_as]
6745#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6746pub struct ShippingsettingsListResponse {
6747    /// Identifies what kind of resource this is. Value: the fixed string "content#shippingsettingsListResponse".
6748    pub kind: Option<String>,
6749    /// The token for the retrieval of the next page of shipping settings.
6750    #[serde(rename = "nextPageToken")]
6751    pub next_page_token: Option<String>,
6752    /// no description provided
6753    pub resources: Option<Vec<ShippingSettings>>,
6754}
6755
6756impl common::ResponseResult for ShippingsettingsListResponse {}
6757
6758/// There is no detailed description.
6759///
6760/// This type is not used in any activity, and only used as *part* of another schema.
6761///
6762#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6763#[serde_with::serde_as]
6764#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6765pub struct Table {
6766    /// Headers of the table's columns. Optional: if not set then the table has only one dimension.
6767    #[serde(rename = "columnHeaders")]
6768    pub column_headers: Option<Headers>,
6769    /// Name of the table. Required for subtables, ignored for the main table.
6770    pub name: Option<String>,
6771    /// Headers of the table's rows. Required.
6772    #[serde(rename = "rowHeaders")]
6773    pub row_headers: Option<Headers>,
6774    /// The list of rows that constitute the table. Must have the same length as `rowHeaders`. Required.
6775    pub rows: Option<Vec<Row>>,
6776}
6777
6778impl common::Part for Table {}
6779
6780/// There is no detailed description.
6781///
6782/// This type is not used in any activity, and only used as *part* of another schema.
6783///
6784#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6785#[serde_with::serde_as]
6786#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6787pub struct TestOrder {
6788    /// Required. The details of the customer who placed the order.
6789    pub customer: Option<TestOrderCustomer>,
6790    /// Whether the orderinvoices service should support this order.
6791    #[serde(rename = "enableOrderinvoices")]
6792    pub enable_orderinvoices: Option<bool>,
6793    /// Identifies what kind of resource this is. Value: the fixed string "`content#testOrder`"
6794    pub kind: Option<String>,
6795    /// Required. Line items that are ordered. At least one line item must be provided.
6796    #[serde(rename = "lineItems")]
6797    pub line_items: Option<Vec<TestOrderLineItem>>,
6798    /// Restricted. Do not use.
6799    #[serde(rename = "notificationMode")]
6800    pub notification_mode: Option<String>,
6801    /// The details of the payment method.
6802    #[serde(rename = "paymentMethod")]
6803    pub payment_method: Option<TestOrderPaymentMethod>,
6804    /// Required. Identifier of one of the predefined delivery addresses for the delivery. Acceptable values are: - "`dwight`" - "`jim`" - "`pam`"
6805    #[serde(rename = "predefinedDeliveryAddress")]
6806    pub predefined_delivery_address: Option<String>,
6807    /// Identifier of one of the predefined pickup details. Required for orders containing line items with shipping type `pickup`. Acceptable values are: - "`dwight`" - "`jim`" - "`pam`"
6808    #[serde(rename = "predefinedPickupDetails")]
6809    pub predefined_pickup_details: Option<String>,
6810    /// Deprecated. Ignored if provided.
6811    pub promotions: Option<Vec<OrderLegacyPromotion>>,
6812    /// Required. The price of shipping for all items. Shipping tax is automatically calculated for orders where marketplace facilitator tax laws are applicable. Otherwise, tax settings from Merchant Center are applied. Note that shipping is not taxed in certain states.
6813    #[serde(rename = "shippingCost")]
6814    pub shipping_cost: Option<Price>,
6815    /// Deprecated. Ignored if provided.
6816    #[serde(rename = "shippingCostTax")]
6817    pub shipping_cost_tax: Option<Price>,
6818    /// Required. The requested shipping option. Acceptable values are: - "`economy`" - "`expedited`" - "`oneDay`" - "`sameDay`" - "`standard`" - "`twoDay`"
6819    #[serde(rename = "shippingOption")]
6820    pub shipping_option: Option<String>,
6821}
6822
6823impl common::Part for TestOrder {}
6824
6825/// There is no detailed description.
6826///
6827/// This type is not used in any activity, and only used as *part* of another schema.
6828///
6829#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6830#[serde_with::serde_as]
6831#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6832pub struct TestOrderCustomer {
6833    /// Required. Email address of the customer. Acceptable values are: - "`pog.dwight.schrute@gmail.com`" - "`pog.jim.halpert@gmail.com`" - "`penpog.pam.beesly@gmail.comding`"
6834    pub email: Option<String>,
6835    /// Deprecated. Please use marketingRightsInfo instead.
6836    #[serde(rename = "explicitMarketingPreference")]
6837    pub explicit_marketing_preference: Option<bool>,
6838    /// Full name of the customer.
6839    #[serde(rename = "fullName")]
6840    pub full_name: Option<String>,
6841    /// Customer's marketing preferences.
6842    #[serde(rename = "marketingRightsInfo")]
6843    pub marketing_rights_info: Option<TestOrderCustomerMarketingRightsInfo>,
6844}
6845
6846impl common::Part for TestOrderCustomer {}
6847
6848/// There is no detailed description.
6849///
6850/// This type is not used in any activity, and only used as *part* of another schema.
6851///
6852#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6853#[serde_with::serde_as]
6854#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6855pub struct TestOrderCustomerMarketingRightsInfo {
6856    /// Last know user use selection regards marketing preferences. In certain cases selection might not be known, so this field would be empty. Acceptable values are: - "`denied`" - "`granted`"
6857    #[serde(rename = "explicitMarketingPreference")]
6858    pub explicit_marketing_preference: Option<String>,
6859    /// Timestamp when last time marketing preference was updated. Could be empty, if user wasn't offered a selection yet.
6860    #[serde(rename = "lastUpdatedTimestamp")]
6861    pub last_updated_timestamp: Option<String>,
6862}
6863
6864impl common::Part for TestOrderCustomerMarketingRightsInfo {}
6865
6866/// There is no detailed description.
6867///
6868/// This type is not used in any activity, and only used as *part* of another schema.
6869///
6870#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6871#[serde_with::serde_as]
6872#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6873pub struct TestOrderLineItem {
6874    /// Required. Product data from the time of the order placement.
6875    pub product: Option<TestOrderLineItemProduct>,
6876    /// Required. Number of items ordered.
6877    #[serde(rename = "quantityOrdered")]
6878    pub quantity_ordered: Option<u32>,
6879    /// Required. Details of the return policy for the line item.
6880    #[serde(rename = "returnInfo")]
6881    pub return_info: Option<OrderLineItemReturnInfo>,
6882    /// Required. Details of the requested shipping for the line item.
6883    #[serde(rename = "shippingDetails")]
6884    pub shipping_details: Option<OrderLineItemShippingDetails>,
6885    /// Deprecated. Ignored if provided.
6886    #[serde(rename = "unitTax")]
6887    pub unit_tax: Option<Price>,
6888}
6889
6890impl common::Part for TestOrderLineItem {}
6891
6892/// There is no detailed description.
6893///
6894/// This type is not used in any activity, and only used as *part* of another schema.
6895///
6896#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6897#[serde_with::serde_as]
6898#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6899pub struct TestOrderLineItemProduct {
6900    /// Required. Brand of the item.
6901    pub brand: Option<String>,
6902    /// Deprecated. Acceptable values are: - "`online`"
6903    pub channel: Option<String>,
6904    /// Required. Condition or state of the item. Acceptable values are: - "`new`"
6905    pub condition: Option<String>,
6906    /// Required. The two-letter ISO 639-1 language code for the item. Acceptable values are: - "`en`" - "`fr`"
6907    #[serde(rename = "contentLanguage")]
6908    pub content_language: Option<String>,
6909    /// Fees for the item. Optional.
6910    pub fees: Option<Vec<OrderLineItemProductFee>>,
6911    /// Global Trade Item Number (GTIN) of the item. Optional.
6912    pub gtin: Option<String>,
6913    /// Required. URL of an image of the item.
6914    #[serde(rename = "imageLink")]
6915    pub image_link: Option<String>,
6916    /// Shared identifier for all variants of the same product. Optional.
6917    #[serde(rename = "itemGroupId")]
6918    pub item_group_id: Option<String>,
6919    /// Manufacturer Part Number (MPN) of the item. Optional.
6920    pub mpn: Option<String>,
6921    /// Required. An identifier of the item.
6922    #[serde(rename = "offerId")]
6923    pub offer_id: Option<String>,
6924    /// Required. The price for the product. Tax is automatically calculated for orders where marketplace facilitator tax laws are applicable. Otherwise, tax settings from Merchant Center are applied.
6925    pub price: Option<Price>,
6926    /// Required. The CLDR territory // code of the target country of the product.
6927    #[serde(rename = "targetCountry")]
6928    pub target_country: Option<String>,
6929    /// Required. The title of the product.
6930    pub title: Option<String>,
6931    /// Variant attributes for the item. Optional.
6932    #[serde(rename = "variantAttributes")]
6933    pub variant_attributes: Option<Vec<OrderLineItemProductVariantAttribute>>,
6934}
6935
6936impl common::Part for TestOrderLineItemProduct {}
6937
6938/// There is no detailed description.
6939///
6940/// This type is not used in any activity, and only used as *part* of another schema.
6941///
6942#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6943#[serde_with::serde_as]
6944#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6945pub struct TestOrderPaymentMethod {
6946    /// The card expiration month (January = 1, February = 2 etc.).
6947    #[serde(rename = "expirationMonth")]
6948    pub expiration_month: Option<i32>,
6949    /// The card expiration year (4-digit, e.g. 2015).
6950    #[serde(rename = "expirationYear")]
6951    pub expiration_year: Option<i32>,
6952    /// The last four digits of the card number.
6953    #[serde(rename = "lastFourDigits")]
6954    pub last_four_digits: Option<String>,
6955    /// The billing address. Acceptable values are: - "`dwight`" - "`jim`" - "`pam`"
6956    #[serde(rename = "predefinedBillingAddress")]
6957    pub predefined_billing_address: Option<String>,
6958    /// The type of instrument. Note that real orders might have different values than the four values accepted by `createTestOrder`. Acceptable values are: - "`AMEX`" - "`DISCOVER`" - "`MASTERCARD`" - "`VISA`"
6959    #[serde(rename = "type")]
6960    pub type_: Option<String>,
6961}
6962
6963impl common::Part for TestOrderPaymentMethod {}
6964
6965/// There is no detailed description.
6966///
6967/// This type is not used in any activity, and only used as *part* of another schema.
6968///
6969#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6970#[serde_with::serde_as]
6971#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6972pub struct TransitTable {
6973    /// A list of postal group names. The last value can be `"all other locations"`. Example: `["zone 1", "zone 2", "all other locations"]`. The referred postal code groups must match the delivery country of the service.
6974    #[serde(rename = "postalCodeGroupNames")]
6975    pub postal_code_group_names: Option<Vec<String>>,
6976    /// no description provided
6977    pub rows: Option<Vec<TransitTableTransitTimeRow>>,
6978    /// A list of transit time labels. The last value can be `"all other labels"`. Example: `["food", "electronics", "all other labels"]`.
6979    #[serde(rename = "transitTimeLabels")]
6980    pub transit_time_labels: Option<Vec<String>>,
6981}
6982
6983impl common::Part for TransitTable {}
6984
6985/// There is no detailed description.
6986///
6987/// This type is not used in any activity, and only used as *part* of another schema.
6988///
6989#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6990#[serde_with::serde_as]
6991#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6992pub struct TransitTableTransitTimeRow {
6993    /// no description provided
6994    pub values: Option<Vec<TransitTableTransitTimeRowTransitTimeValue>>,
6995}
6996
6997impl common::Part for TransitTableTransitTimeRow {}
6998
6999/// There is no detailed description.
7000///
7001/// This type is not used in any activity, and only used as *part* of another schema.
7002///
7003#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7004#[serde_with::serde_as]
7005#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7006pub struct TransitTableTransitTimeRowTransitTimeValue {
7007    /// Must be greater than or equal to `minTransitTimeInDays`.
7008    #[serde(rename = "maxTransitTimeInDays")]
7009    pub max_transit_time_in_days: Option<u32>,
7010    /// Transit time range (min-max) in business days. 0 means same day delivery, 1 means next day delivery.
7011    #[serde(rename = "minTransitTimeInDays")]
7012    pub min_transit_time_in_days: Option<u32>,
7013}
7014
7015impl common::Part for TransitTableTransitTimeRowTransitTimeValue {}
7016
7017/// There is no detailed description.
7018///
7019/// This type is not used in any activity, and only used as *part* of another schema.
7020///
7021#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7022#[serde_with::serde_as]
7023#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7024pub struct UnitInvoice {
7025    /// Additional charges for a unit, e.g. shipping costs.
7026    #[serde(rename = "additionalCharges")]
7027    pub additional_charges: Option<Vec<UnitInvoiceAdditionalCharge>>,
7028    /// Deprecated.
7029    pub promotions: Option<Vec<Promotion>>,
7030    /// [required] Price of the unit, before applying taxes.
7031    #[serde(rename = "unitPricePretax")]
7032    pub unit_price_pretax: Option<Price>,
7033    /// Tax amounts to apply to the unit price.
7034    #[serde(rename = "unitPriceTaxes")]
7035    pub unit_price_taxes: Option<Vec<UnitInvoiceTaxLine>>,
7036}
7037
7038impl common::Part for UnitInvoice {}
7039
7040/// There is no detailed description.
7041///
7042/// This type is not used in any activity, and only used as *part* of another schema.
7043///
7044#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7045#[serde_with::serde_as]
7046#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7047pub struct UnitInvoiceAdditionalCharge {
7048    /// [required] Amount of the additional charge.
7049    #[serde(rename = "additionalChargeAmount")]
7050    pub additional_charge_amount: Option<Amount>,
7051    /// Deprecated.
7052    #[serde(rename = "additionalChargePromotions")]
7053    pub additional_charge_promotions: Option<Vec<Promotion>>,
7054    /// [required] Type of the additional charge. Acceptable values are: - "`shipping`"
7055    #[serde(rename = "type")]
7056    pub type_: Option<String>,
7057}
7058
7059impl common::Part for UnitInvoiceAdditionalCharge {}
7060
7061/// There is no detailed description.
7062///
7063/// This type is not used in any activity, and only used as *part* of another schema.
7064///
7065#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7066#[serde_with::serde_as]
7067#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7068pub struct UnitInvoiceTaxLine {
7069    /// [required] Tax amount for the tax type.
7070    #[serde(rename = "taxAmount")]
7071    pub tax_amount: Option<Price>,
7072    /// Optional name of the tax type. This should only be provided if `taxType` is `otherFeeTax`.
7073    #[serde(rename = "taxName")]
7074    pub tax_name: Option<String>,
7075    /// [required] Type of the tax. Acceptable values are: - "`otherFee`" - "`otherFeeTax`" - "`sales`"
7076    #[serde(rename = "taxType")]
7077    pub tax_type: Option<String>,
7078}
7079
7080impl common::Part for UnitInvoiceTaxLine {}
7081
7082/// The single value of a rate group or the value of a rate group table's cell. Exactly one of `noShipping`, `flatRate`, `pricePercentage`, `carrierRateName`, `subtableName` must be set.
7083///
7084/// This type is not used in any activity, and only used as *part* of another schema.
7085///
7086#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7087#[serde_with::serde_as]
7088#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7089pub struct Value {
7090    /// The name of a carrier rate referring to a carrier rate defined in the same rate group. Can only be set if all other fields are not set.
7091    #[serde(rename = "carrierRateName")]
7092    pub carrier_rate_name: Option<String>,
7093    /// A flat rate. Can only be set if all other fields are not set.
7094    #[serde(rename = "flatRate")]
7095    pub flat_rate: Option<Price>,
7096    /// If true, then the product can't ship. Must be true when set, can only be set if all other fields are not set.
7097    #[serde(rename = "noShipping")]
7098    pub no_shipping: Option<bool>,
7099    /// A percentage of the price represented as a number in decimal notation (e.g., `"5.4"`). Can only be set if all other fields are not set.
7100    #[serde(rename = "pricePercentage")]
7101    pub price_percentage: Option<String>,
7102    /// The name of a subtable. Can only be set in table cells (i.e., not for single values), and only if all other fields are not set.
7103    #[serde(rename = "subtableName")]
7104    pub subtable_name: Option<String>,
7105}
7106
7107impl common::Part for Value {}
7108
7109/// A fulfillment warehouse, which stores and handles inventory.
7110///
7111/// This type is not used in any activity, and only used as *part* of another schema.
7112///
7113#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7114#[serde_with::serde_as]
7115#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7116pub struct Warehouse {
7117    /// Business days of the warehouse. If not set, will be Monday to Friday by default.
7118    #[serde(rename = "businessDayConfig")]
7119    pub business_day_config: Option<BusinessDayConfig>,
7120    /// Required. The latest time of day that an order can be accepted and begin processing. Later orders will be processed in the next day. The time is based on the warehouse postal code.
7121    #[serde(rename = "cutoffTime")]
7122    pub cutoff_time: Option<WarehouseCutoffTime>,
7123    /// Required. The number of days it takes for this warehouse to pack up and ship an item. This is on the warehouse level, but can be overridden on the offer level based on the attributes of an item.
7124    #[serde(rename = "handlingDays")]
7125    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
7126    pub handling_days: Option<i64>,
7127    /// Required. The name of the warehouse. Must be unique within account.
7128    pub name: Option<String>,
7129    /// Required. Shipping address of the warehouse.
7130    #[serde(rename = "shippingAddress")]
7131    pub shipping_address: Option<Address>,
7132}
7133
7134impl common::Part for Warehouse {}
7135
7136/// There is no detailed description.
7137///
7138/// This type is not used in any activity, and only used as *part* of another schema.
7139///
7140#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7141#[serde_with::serde_as]
7142#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7143pub struct WarehouseBasedDeliveryTime {
7144    /// Required. Carrier, such as `"UPS"` or `"Fedex"`. The list of supported carriers can be retrieved via the `listSupportedCarriers` method.
7145    pub carrier: Option<String>,
7146    /// Required. Carrier service, such as `"ground"` or `"2 days"`. The list of supported services for a carrier can be retrieved via the `listSupportedCarriers` method. The name of the service must be in the eddSupportedServices list.
7147    #[serde(rename = "carrierService")]
7148    pub carrier_service: Option<String>,
7149    /// Shipping origin's state.
7150    #[serde(rename = "originAdministrativeArea")]
7151    pub origin_administrative_area: Option<String>,
7152    /// Shipping origin's city.
7153    #[serde(rename = "originCity")]
7154    pub origin_city: Option<String>,
7155    /// Shipping origin's country represented as a [CLDR territory code](http://www.unicode.org/repos/cldr/tags/latest/common/main/en.xml).
7156    #[serde(rename = "originCountry")]
7157    pub origin_country: Option<String>,
7158    /// Shipping origin.
7159    #[serde(rename = "originPostalCode")]
7160    pub origin_postal_code: Option<String>,
7161    /// Shipping origin's street address
7162    #[serde(rename = "originStreetAddress")]
7163    pub origin_street_address: Option<String>,
7164    /// The name of the warehouse. Warehouse name need to be matched with name. If warehouseName is set, the below fields will be ignored. The warehouse info will be read from warehouse.
7165    #[serde(rename = "warehouseName")]
7166    pub warehouse_name: Option<String>,
7167}
7168
7169impl common::Part for WarehouseBasedDeliveryTime {}
7170
7171/// There is no detailed description.
7172///
7173/// This type is not used in any activity, and only used as *part* of another schema.
7174///
7175#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7176#[serde_with::serde_as]
7177#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7178pub struct WarehouseCutoffTime {
7179    /// Required. Hour (24-hour clock) of the cutoff time until which an order has to be placed to be processed in the same day by the warehouse. Hour is based on the timezone of warehouse.
7180    pub hour: Option<i32>,
7181    /// Required. Minute of the cutoff time until which an order has to be placed to be processed in the same day by the warehouse. Minute is based on the timezone of warehouse.
7182    pub minute: Option<i32>,
7183}
7184
7185impl common::Part for WarehouseCutoffTime {}
7186
7187/// There is no detailed description.
7188///
7189/// This type is not used in any activity, and only used as *part* of another schema.
7190///
7191#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7192#[serde_with::serde_as]
7193#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7194pub struct Weight {
7195    /// Required. The weight unit. Acceptable values are: - "`kg`" - "`lb`"
7196    pub unit: Option<String>,
7197    /// Required. The weight represented as a number. The weight can have a maximum precision of four decimal places.
7198    pub value: Option<String>,
7199}
7200
7201impl common::Part for Weight {}
7202
7203// ###################
7204// MethodBuilders ###
7205// #################
7206
7207/// A builder providing access to all methods supported on *account* resources.
7208/// It is not used directly, but through the [`ShoppingContent`] hub.
7209///
7210/// # Example
7211///
7212/// Instantiate a resource builder
7213///
7214/// ```test_harness,no_run
7215/// extern crate hyper;
7216/// extern crate hyper_rustls;
7217/// extern crate google_content2 as content2;
7218///
7219/// # async fn dox() {
7220/// use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7221///
7222/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7223/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
7224///     .with_native_roots()
7225///     .unwrap()
7226///     .https_only()
7227///     .enable_http2()
7228///     .build();
7229///
7230/// let executor = hyper_util::rt::TokioExecutor::new();
7231/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7232///     secret,
7233///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7234///     yup_oauth2::client::CustomHyperClientBuilder::from(
7235///         hyper_util::client::legacy::Client::builder(executor).build(connector),
7236///     ),
7237/// ).build().await.unwrap();
7238///
7239/// let client = hyper_util::client::legacy::Client::builder(
7240///     hyper_util::rt::TokioExecutor::new()
7241/// )
7242/// .build(
7243///     hyper_rustls::HttpsConnectorBuilder::new()
7244///         .with_native_roots()
7245///         .unwrap()
7246///         .https_or_http()
7247///         .enable_http2()
7248///         .build()
7249/// );
7250/// let mut hub = ShoppingContent::new(client, auth);
7251/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7252/// // like `authinfo(...)`, `claimwebsite(...)`, `custombatch(...)`, `delete(...)`, `get(...)`, `insert(...)`, `link(...)`, `list(...)` and `update(...)`
7253/// // to build up your call.
7254/// let rb = hub.accounts();
7255/// # }
7256/// ```
7257pub struct AccountMethods<'a, C>
7258where
7259    C: 'a,
7260{
7261    hub: &'a ShoppingContent<C>,
7262}
7263
7264impl<'a, C> common::MethodsBuilder for AccountMethods<'a, C> {}
7265
7266impl<'a, C> AccountMethods<'a, C> {
7267    /// Create a builder to help you perform the following task:
7268    ///
7269    /// Returns information about the authenticated user.
7270    pub fn authinfo(&self) -> AccountAuthinfoCall<'a, C> {
7271        AccountAuthinfoCall {
7272            hub: self.hub,
7273            _delegate: Default::default(),
7274            _additional_params: Default::default(),
7275            _scopes: Default::default(),
7276        }
7277    }
7278
7279    /// Create a builder to help you perform the following task:
7280    ///
7281    /// Claims the website of a Merchant Center sub-account.
7282    ///
7283    /// # Arguments
7284    ///
7285    /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
7286    /// * `accountId` - The ID of the account whose website is claimed.
7287    pub fn claimwebsite(
7288        &self,
7289        merchant_id: u64,
7290        account_id: u64,
7291    ) -> AccountClaimwebsiteCall<'a, C> {
7292        AccountClaimwebsiteCall {
7293            hub: self.hub,
7294            _merchant_id: merchant_id,
7295            _account_id: account_id,
7296            _overwrite: Default::default(),
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    /// Retrieves, inserts, updates, and deletes multiple Merchant Center (sub-)accounts in a single request.
7306    ///
7307    /// # Arguments
7308    ///
7309    /// * `request` - No description provided.
7310    pub fn custombatch(
7311        &self,
7312        request: AccountsCustomBatchRequest,
7313    ) -> AccountCustombatchCall<'a, C> {
7314        AccountCustombatchCall {
7315            hub: self.hub,
7316            _request: request,
7317            _dry_run: Default::default(),
7318            _delegate: Default::default(),
7319            _additional_params: Default::default(),
7320            _scopes: Default::default(),
7321        }
7322    }
7323
7324    /// Create a builder to help you perform the following task:
7325    ///
7326    /// Deletes a Merchant Center sub-account.
7327    ///
7328    /// # Arguments
7329    ///
7330    /// * `merchantId` - The ID of the managing account. This must be a multi-client account, and accountId must be the ID of a sub-account of this account.
7331    /// * `accountId` - The ID of the account.
7332    pub fn delete(&self, merchant_id: u64, account_id: u64) -> AccountDeleteCall<'a, C> {
7333        AccountDeleteCall {
7334            hub: self.hub,
7335            _merchant_id: merchant_id,
7336            _account_id: account_id,
7337            _force: Default::default(),
7338            _dry_run: Default::default(),
7339            _delegate: Default::default(),
7340            _additional_params: Default::default(),
7341            _scopes: Default::default(),
7342        }
7343    }
7344
7345    /// Create a builder to help you perform the following task:
7346    ///
7347    /// Retrieves a Merchant Center account.
7348    ///
7349    /// # Arguments
7350    ///
7351    /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
7352    /// * `accountId` - The ID of the account.
7353    pub fn get(&self, merchant_id: u64, account_id: u64) -> AccountGetCall<'a, C> {
7354        AccountGetCall {
7355            hub: self.hub,
7356            _merchant_id: merchant_id,
7357            _account_id: account_id,
7358            _delegate: Default::default(),
7359            _additional_params: Default::default(),
7360            _scopes: Default::default(),
7361        }
7362    }
7363
7364    /// Create a builder to help you perform the following task:
7365    ///
7366    /// Creates a Merchant Center sub-account.
7367    ///
7368    /// # Arguments
7369    ///
7370    /// * `request` - No description provided.
7371    /// * `merchantId` - The ID of the managing account. This must be a multi-client account.
7372    pub fn insert(&self, request: Account, merchant_id: u64) -> AccountInsertCall<'a, C> {
7373        AccountInsertCall {
7374            hub: self.hub,
7375            _request: request,
7376            _merchant_id: merchant_id,
7377            _dry_run: Default::default(),
7378            _delegate: Default::default(),
7379            _additional_params: Default::default(),
7380            _scopes: Default::default(),
7381        }
7382    }
7383
7384    /// Create a builder to help you perform the following task:
7385    ///
7386    /// Performs an action on a link between two Merchant Center accounts, namely accountId and linkedAccountId.
7387    ///
7388    /// # Arguments
7389    ///
7390    /// * `request` - No description provided.
7391    /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
7392    /// * `accountId` - The ID of the account that should be linked.
7393    pub fn link(
7394        &self,
7395        request: AccountsLinkRequest,
7396        merchant_id: u64,
7397        account_id: u64,
7398    ) -> AccountLinkCall<'a, C> {
7399        AccountLinkCall {
7400            hub: self.hub,
7401            _request: request,
7402            _merchant_id: merchant_id,
7403            _account_id: account_id,
7404            _delegate: Default::default(),
7405            _additional_params: Default::default(),
7406            _scopes: Default::default(),
7407        }
7408    }
7409
7410    /// Create a builder to help you perform the following task:
7411    ///
7412    /// Lists the sub-accounts in your Merchant Center account.
7413    ///
7414    /// # Arguments
7415    ///
7416    /// * `merchantId` - The ID of the managing account. This must be a multi-client account.
7417    pub fn list(&self, merchant_id: u64) -> AccountListCall<'a, C> {
7418        AccountListCall {
7419            hub: self.hub,
7420            _merchant_id: merchant_id,
7421            _page_token: Default::default(),
7422            _max_results: Default::default(),
7423            _delegate: Default::default(),
7424            _additional_params: Default::default(),
7425            _scopes: Default::default(),
7426        }
7427    }
7428
7429    /// Create a builder to help you perform the following task:
7430    ///
7431    /// Updates a Merchant Center account. Any fields that are not provided are deleted from the resource.
7432    ///
7433    /// # Arguments
7434    ///
7435    /// * `request` - No description provided.
7436    /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
7437    /// * `accountId` - The ID of the account.
7438    pub fn update(
7439        &self,
7440        request: Account,
7441        merchant_id: u64,
7442        account_id: u64,
7443    ) -> AccountUpdateCall<'a, C> {
7444        AccountUpdateCall {
7445            hub: self.hub,
7446            _request: request,
7447            _merchant_id: merchant_id,
7448            _account_id: account_id,
7449            _dry_run: Default::default(),
7450            _delegate: Default::default(),
7451            _additional_params: Default::default(),
7452            _scopes: Default::default(),
7453        }
7454    }
7455}
7456
7457/// A builder providing access to all methods supported on *accountstatus* resources.
7458/// It is not used directly, but through the [`ShoppingContent`] hub.
7459///
7460/// # Example
7461///
7462/// Instantiate a resource builder
7463///
7464/// ```test_harness,no_run
7465/// extern crate hyper;
7466/// extern crate hyper_rustls;
7467/// extern crate google_content2 as content2;
7468///
7469/// # async fn dox() {
7470/// use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7471///
7472/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7473/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
7474///     .with_native_roots()
7475///     .unwrap()
7476///     .https_only()
7477///     .enable_http2()
7478///     .build();
7479///
7480/// let executor = hyper_util::rt::TokioExecutor::new();
7481/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7482///     secret,
7483///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7484///     yup_oauth2::client::CustomHyperClientBuilder::from(
7485///         hyper_util::client::legacy::Client::builder(executor).build(connector),
7486///     ),
7487/// ).build().await.unwrap();
7488///
7489/// let client = hyper_util::client::legacy::Client::builder(
7490///     hyper_util::rt::TokioExecutor::new()
7491/// )
7492/// .build(
7493///     hyper_rustls::HttpsConnectorBuilder::new()
7494///         .with_native_roots()
7495///         .unwrap()
7496///         .https_or_http()
7497///         .enable_http2()
7498///         .build()
7499/// );
7500/// let mut hub = ShoppingContent::new(client, auth);
7501/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7502/// // like `custombatch(...)`, `get(...)` and `list(...)`
7503/// // to build up your call.
7504/// let rb = hub.accountstatuses();
7505/// # }
7506/// ```
7507pub struct AccountstatusMethods<'a, C>
7508where
7509    C: 'a,
7510{
7511    hub: &'a ShoppingContent<C>,
7512}
7513
7514impl<'a, C> common::MethodsBuilder for AccountstatusMethods<'a, C> {}
7515
7516impl<'a, C> AccountstatusMethods<'a, C> {
7517    /// Create a builder to help you perform the following task:
7518    ///
7519    /// Retrieves multiple Merchant Center account statuses in a single request.
7520    ///
7521    /// # Arguments
7522    ///
7523    /// * `request` - No description provided.
7524    pub fn custombatch(
7525        &self,
7526        request: AccountstatusesCustomBatchRequest,
7527    ) -> AccountstatusCustombatchCall<'a, C> {
7528        AccountstatusCustombatchCall {
7529            hub: self.hub,
7530            _request: request,
7531            _delegate: Default::default(),
7532            _additional_params: Default::default(),
7533            _scopes: Default::default(),
7534        }
7535    }
7536
7537    /// Create a builder to help you perform the following task:
7538    ///
7539    /// Retrieves the status of a Merchant Center account. No itemLevelIssues are returned for multi-client accounts.
7540    ///
7541    /// # Arguments
7542    ///
7543    /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
7544    /// * `accountId` - The ID of the account.
7545    pub fn get(&self, merchant_id: u64, account_id: u64) -> AccountstatusGetCall<'a, C> {
7546        AccountstatusGetCall {
7547            hub: self.hub,
7548            _merchant_id: merchant_id,
7549            _account_id: account_id,
7550            _destinations: Default::default(),
7551            _delegate: Default::default(),
7552            _additional_params: Default::default(),
7553            _scopes: Default::default(),
7554        }
7555    }
7556
7557    /// Create a builder to help you perform the following task:
7558    ///
7559    /// Lists the statuses of the sub-accounts in your Merchant Center account.
7560    ///
7561    /// # Arguments
7562    ///
7563    /// * `merchantId` - The ID of the managing account. This must be a multi-client account.
7564    pub fn list(&self, merchant_id: u64) -> AccountstatusListCall<'a, C> {
7565        AccountstatusListCall {
7566            hub: self.hub,
7567            _merchant_id: merchant_id,
7568            _page_token: Default::default(),
7569            _max_results: Default::default(),
7570            _destinations: Default::default(),
7571            _delegate: Default::default(),
7572            _additional_params: Default::default(),
7573            _scopes: Default::default(),
7574        }
7575    }
7576}
7577
7578/// A builder providing access to all methods supported on *accounttax* resources.
7579/// It is not used directly, but through the [`ShoppingContent`] hub.
7580///
7581/// # Example
7582///
7583/// Instantiate a resource builder
7584///
7585/// ```test_harness,no_run
7586/// extern crate hyper;
7587/// extern crate hyper_rustls;
7588/// extern crate google_content2 as content2;
7589///
7590/// # async fn dox() {
7591/// use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7592///
7593/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7594/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
7595///     .with_native_roots()
7596///     .unwrap()
7597///     .https_only()
7598///     .enable_http2()
7599///     .build();
7600///
7601/// let executor = hyper_util::rt::TokioExecutor::new();
7602/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7603///     secret,
7604///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7605///     yup_oauth2::client::CustomHyperClientBuilder::from(
7606///         hyper_util::client::legacy::Client::builder(executor).build(connector),
7607///     ),
7608/// ).build().await.unwrap();
7609///
7610/// let client = hyper_util::client::legacy::Client::builder(
7611///     hyper_util::rt::TokioExecutor::new()
7612/// )
7613/// .build(
7614///     hyper_rustls::HttpsConnectorBuilder::new()
7615///         .with_native_roots()
7616///         .unwrap()
7617///         .https_or_http()
7618///         .enable_http2()
7619///         .build()
7620/// );
7621/// let mut hub = ShoppingContent::new(client, auth);
7622/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7623/// // like `custombatch(...)`, `get(...)`, `list(...)` and `update(...)`
7624/// // to build up your call.
7625/// let rb = hub.accounttax();
7626/// # }
7627/// ```
7628pub struct AccounttaxMethods<'a, C>
7629where
7630    C: 'a,
7631{
7632    hub: &'a ShoppingContent<C>,
7633}
7634
7635impl<'a, C> common::MethodsBuilder for AccounttaxMethods<'a, C> {}
7636
7637impl<'a, C> AccounttaxMethods<'a, C> {
7638    /// Create a builder to help you perform the following task:
7639    ///
7640    /// Retrieves and updates tax settings of multiple accounts in a single request.
7641    ///
7642    /// # Arguments
7643    ///
7644    /// * `request` - No description provided.
7645    pub fn custombatch(
7646        &self,
7647        request: AccounttaxCustomBatchRequest,
7648    ) -> AccounttaxCustombatchCall<'a, C> {
7649        AccounttaxCustombatchCall {
7650            hub: self.hub,
7651            _request: request,
7652            _dry_run: Default::default(),
7653            _delegate: Default::default(),
7654            _additional_params: Default::default(),
7655            _scopes: Default::default(),
7656        }
7657    }
7658
7659    /// Create a builder to help you perform the following task:
7660    ///
7661    /// Retrieves the tax settings of the account.
7662    ///
7663    /// # Arguments
7664    ///
7665    /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
7666    /// * `accountId` - The ID of the account for which to get/update account tax settings.
7667    pub fn get(&self, merchant_id: u64, account_id: u64) -> AccounttaxGetCall<'a, C> {
7668        AccounttaxGetCall {
7669            hub: self.hub,
7670            _merchant_id: merchant_id,
7671            _account_id: account_id,
7672            _delegate: Default::default(),
7673            _additional_params: Default::default(),
7674            _scopes: Default::default(),
7675        }
7676    }
7677
7678    /// Create a builder to help you perform the following task:
7679    ///
7680    /// Lists the tax settings of the sub-accounts in your Merchant Center account.
7681    ///
7682    /// # Arguments
7683    ///
7684    /// * `merchantId` - The ID of the managing account. This must be a multi-client account.
7685    pub fn list(&self, merchant_id: u64) -> AccounttaxListCall<'a, C> {
7686        AccounttaxListCall {
7687            hub: self.hub,
7688            _merchant_id: merchant_id,
7689            _page_token: Default::default(),
7690            _max_results: Default::default(),
7691            _delegate: Default::default(),
7692            _additional_params: Default::default(),
7693            _scopes: Default::default(),
7694        }
7695    }
7696
7697    /// Create a builder to help you perform the following task:
7698    ///
7699    /// Updates the tax settings of the account. Any fields that are not provided are deleted from the resource.
7700    ///
7701    /// # Arguments
7702    ///
7703    /// * `request` - No description provided.
7704    /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
7705    /// * `accountId` - The ID of the account for which to get/update account tax settings.
7706    pub fn update(
7707        &self,
7708        request: AccountTax,
7709        merchant_id: u64,
7710        account_id: u64,
7711    ) -> AccounttaxUpdateCall<'a, C> {
7712        AccounttaxUpdateCall {
7713            hub: self.hub,
7714            _request: request,
7715            _merchant_id: merchant_id,
7716            _account_id: account_id,
7717            _dry_run: Default::default(),
7718            _delegate: Default::default(),
7719            _additional_params: Default::default(),
7720            _scopes: Default::default(),
7721        }
7722    }
7723}
7724
7725/// A builder providing access to all methods supported on *datafeed* resources.
7726/// It is not used directly, but through the [`ShoppingContent`] hub.
7727///
7728/// # Example
7729///
7730/// Instantiate a resource builder
7731///
7732/// ```test_harness,no_run
7733/// extern crate hyper;
7734/// extern crate hyper_rustls;
7735/// extern crate google_content2 as content2;
7736///
7737/// # async fn dox() {
7738/// use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7739///
7740/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7741/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
7742///     .with_native_roots()
7743///     .unwrap()
7744///     .https_only()
7745///     .enable_http2()
7746///     .build();
7747///
7748/// let executor = hyper_util::rt::TokioExecutor::new();
7749/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7750///     secret,
7751///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7752///     yup_oauth2::client::CustomHyperClientBuilder::from(
7753///         hyper_util::client::legacy::Client::builder(executor).build(connector),
7754///     ),
7755/// ).build().await.unwrap();
7756///
7757/// let client = hyper_util::client::legacy::Client::builder(
7758///     hyper_util::rt::TokioExecutor::new()
7759/// )
7760/// .build(
7761///     hyper_rustls::HttpsConnectorBuilder::new()
7762///         .with_native_roots()
7763///         .unwrap()
7764///         .https_or_http()
7765///         .enable_http2()
7766///         .build()
7767/// );
7768/// let mut hub = ShoppingContent::new(client, auth);
7769/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7770/// // like `custombatch(...)`, `delete(...)`, `fetchnow(...)`, `get(...)`, `insert(...)`, `list(...)` and `update(...)`
7771/// // to build up your call.
7772/// let rb = hub.datafeeds();
7773/// # }
7774/// ```
7775pub struct DatafeedMethods<'a, C>
7776where
7777    C: 'a,
7778{
7779    hub: &'a ShoppingContent<C>,
7780}
7781
7782impl<'a, C> common::MethodsBuilder for DatafeedMethods<'a, C> {}
7783
7784impl<'a, C> DatafeedMethods<'a, C> {
7785    /// Create a builder to help you perform the following task:
7786    ///
7787    /// Deletes, fetches, gets, inserts and updates multiple datafeeds in a single request.
7788    ///
7789    /// # Arguments
7790    ///
7791    /// * `request` - No description provided.
7792    pub fn custombatch(
7793        &self,
7794        request: DatafeedsCustomBatchRequest,
7795    ) -> DatafeedCustombatchCall<'a, C> {
7796        DatafeedCustombatchCall {
7797            hub: self.hub,
7798            _request: request,
7799            _dry_run: Default::default(),
7800            _delegate: Default::default(),
7801            _additional_params: Default::default(),
7802            _scopes: Default::default(),
7803        }
7804    }
7805
7806    /// Create a builder to help you perform the following task:
7807    ///
7808    /// Deletes a datafeed configuration from your Merchant Center account.
7809    ///
7810    /// # Arguments
7811    ///
7812    /// * `merchantId` - The ID of the account that manages the datafeed. This account cannot be a multi-client account.
7813    /// * `datafeedId` - The ID of the datafeed.
7814    pub fn delete(&self, merchant_id: u64, datafeed_id: u64) -> DatafeedDeleteCall<'a, C> {
7815        DatafeedDeleteCall {
7816            hub: self.hub,
7817            _merchant_id: merchant_id,
7818            _datafeed_id: datafeed_id,
7819            _dry_run: Default::default(),
7820            _delegate: Default::default(),
7821            _additional_params: Default::default(),
7822            _scopes: Default::default(),
7823        }
7824    }
7825
7826    /// Create a builder to help you perform the following task:
7827    ///
7828    /// Invokes a fetch for the datafeed in your Merchant Center account. If you need to call this method more than once per day, we recommend you use the Products service to update your product data.
7829    ///
7830    /// # Arguments
7831    ///
7832    /// * `merchantId` - The ID of the account that manages the datafeed. This account cannot be a multi-client account.
7833    /// * `datafeedId` - The ID of the datafeed to be fetched.
7834    pub fn fetchnow(&self, merchant_id: u64, datafeed_id: u64) -> DatafeedFetchnowCall<'a, C> {
7835        DatafeedFetchnowCall {
7836            hub: self.hub,
7837            _merchant_id: merchant_id,
7838            _datafeed_id: datafeed_id,
7839            _dry_run: Default::default(),
7840            _delegate: Default::default(),
7841            _additional_params: Default::default(),
7842            _scopes: Default::default(),
7843        }
7844    }
7845
7846    /// Create a builder to help you perform the following task:
7847    ///
7848    /// Retrieves a datafeed configuration from your Merchant Center account.
7849    ///
7850    /// # Arguments
7851    ///
7852    /// * `merchantId` - The ID of the account that manages the datafeed. This account cannot be a multi-client account.
7853    /// * `datafeedId` - The ID of the datafeed.
7854    pub fn get(&self, merchant_id: u64, datafeed_id: u64) -> DatafeedGetCall<'a, C> {
7855        DatafeedGetCall {
7856            hub: self.hub,
7857            _merchant_id: merchant_id,
7858            _datafeed_id: datafeed_id,
7859            _delegate: Default::default(),
7860            _additional_params: Default::default(),
7861            _scopes: Default::default(),
7862        }
7863    }
7864
7865    /// Create a builder to help you perform the following task:
7866    ///
7867    /// Registers a datafeed configuration with your Merchant Center account.
7868    ///
7869    /// # Arguments
7870    ///
7871    /// * `request` - No description provided.
7872    /// * `merchantId` - The ID of the account that manages the datafeed. This account cannot be a multi-client account.
7873    pub fn insert(&self, request: Datafeed, merchant_id: u64) -> DatafeedInsertCall<'a, C> {
7874        DatafeedInsertCall {
7875            hub: self.hub,
7876            _request: request,
7877            _merchant_id: merchant_id,
7878            _dry_run: Default::default(),
7879            _delegate: Default::default(),
7880            _additional_params: Default::default(),
7881            _scopes: Default::default(),
7882        }
7883    }
7884
7885    /// Create a builder to help you perform the following task:
7886    ///
7887    /// Lists the configurations for datafeeds in your Merchant Center account.
7888    ///
7889    /// # Arguments
7890    ///
7891    /// * `merchantId` - The ID of the account that manages the datafeeds. This account cannot be a multi-client account.
7892    pub fn list(&self, merchant_id: u64) -> DatafeedListCall<'a, C> {
7893        DatafeedListCall {
7894            hub: self.hub,
7895            _merchant_id: merchant_id,
7896            _page_token: Default::default(),
7897            _max_results: Default::default(),
7898            _delegate: Default::default(),
7899            _additional_params: Default::default(),
7900            _scopes: Default::default(),
7901        }
7902    }
7903
7904    /// Create a builder to help you perform the following task:
7905    ///
7906    /// Updates a datafeed configuration of your Merchant Center account. Any fields that are not provided are deleted from the resource.
7907    ///
7908    /// # Arguments
7909    ///
7910    /// * `request` - No description provided.
7911    /// * `merchantId` - The ID of the account that manages the datafeed. This account cannot be a multi-client account.
7912    /// * `datafeedId` - The ID of the datafeed.
7913    pub fn update(
7914        &self,
7915        request: Datafeed,
7916        merchant_id: u64,
7917        datafeed_id: u64,
7918    ) -> DatafeedUpdateCall<'a, C> {
7919        DatafeedUpdateCall {
7920            hub: self.hub,
7921            _request: request,
7922            _merchant_id: merchant_id,
7923            _datafeed_id: datafeed_id,
7924            _dry_run: Default::default(),
7925            _delegate: Default::default(),
7926            _additional_params: Default::default(),
7927            _scopes: Default::default(),
7928        }
7929    }
7930}
7931
7932/// A builder providing access to all methods supported on *datafeedstatus* resources.
7933/// It is not used directly, but through the [`ShoppingContent`] hub.
7934///
7935/// # Example
7936///
7937/// Instantiate a resource builder
7938///
7939/// ```test_harness,no_run
7940/// extern crate hyper;
7941/// extern crate hyper_rustls;
7942/// extern crate google_content2 as content2;
7943///
7944/// # async fn dox() {
7945/// use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7946///
7947/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7948/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
7949///     .with_native_roots()
7950///     .unwrap()
7951///     .https_only()
7952///     .enable_http2()
7953///     .build();
7954///
7955/// let executor = hyper_util::rt::TokioExecutor::new();
7956/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7957///     secret,
7958///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7959///     yup_oauth2::client::CustomHyperClientBuilder::from(
7960///         hyper_util::client::legacy::Client::builder(executor).build(connector),
7961///     ),
7962/// ).build().await.unwrap();
7963///
7964/// let client = hyper_util::client::legacy::Client::builder(
7965///     hyper_util::rt::TokioExecutor::new()
7966/// )
7967/// .build(
7968///     hyper_rustls::HttpsConnectorBuilder::new()
7969///         .with_native_roots()
7970///         .unwrap()
7971///         .https_or_http()
7972///         .enable_http2()
7973///         .build()
7974/// );
7975/// let mut hub = ShoppingContent::new(client, auth);
7976/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7977/// // like `custombatch(...)`, `get(...)` and `list(...)`
7978/// // to build up your call.
7979/// let rb = hub.datafeedstatuses();
7980/// # }
7981/// ```
7982pub struct DatafeedstatusMethods<'a, C>
7983where
7984    C: 'a,
7985{
7986    hub: &'a ShoppingContent<C>,
7987}
7988
7989impl<'a, C> common::MethodsBuilder for DatafeedstatusMethods<'a, C> {}
7990
7991impl<'a, C> DatafeedstatusMethods<'a, C> {
7992    /// Create a builder to help you perform the following task:
7993    ///
7994    /// Gets multiple Merchant Center datafeed statuses in a single request.
7995    ///
7996    /// # Arguments
7997    ///
7998    /// * `request` - No description provided.
7999    pub fn custombatch(
8000        &self,
8001        request: DatafeedstatusesCustomBatchRequest,
8002    ) -> DatafeedstatusCustombatchCall<'a, C> {
8003        DatafeedstatusCustombatchCall {
8004            hub: self.hub,
8005            _request: request,
8006            _delegate: Default::default(),
8007            _additional_params: Default::default(),
8008            _scopes: Default::default(),
8009        }
8010    }
8011
8012    /// Create a builder to help you perform the following task:
8013    ///
8014    /// Retrieves the status of a datafeed from your Merchant Center account.
8015    ///
8016    /// # Arguments
8017    ///
8018    /// * `merchantId` - The ID of the account that manages the datafeed. This account cannot be a multi-client account.
8019    /// * `datafeedId` - The ID of the datafeed.
8020    pub fn get(&self, merchant_id: u64, datafeed_id: u64) -> DatafeedstatusGetCall<'a, C> {
8021        DatafeedstatusGetCall {
8022            hub: self.hub,
8023            _merchant_id: merchant_id,
8024            _datafeed_id: datafeed_id,
8025            _language: Default::default(),
8026            _country: Default::default(),
8027            _delegate: Default::default(),
8028            _additional_params: Default::default(),
8029            _scopes: Default::default(),
8030        }
8031    }
8032
8033    /// Create a builder to help you perform the following task:
8034    ///
8035    /// Lists the statuses of the datafeeds in your Merchant Center account.
8036    ///
8037    /// # Arguments
8038    ///
8039    /// * `merchantId` - The ID of the account that manages the datafeeds. This account cannot be a multi-client account.
8040    pub fn list(&self, merchant_id: u64) -> DatafeedstatusListCall<'a, C> {
8041        DatafeedstatusListCall {
8042            hub: self.hub,
8043            _merchant_id: merchant_id,
8044            _page_token: Default::default(),
8045            _max_results: Default::default(),
8046            _delegate: Default::default(),
8047            _additional_params: Default::default(),
8048            _scopes: Default::default(),
8049        }
8050    }
8051}
8052
8053/// A builder providing access to all methods supported on *inventory* resources.
8054/// It is not used directly, but through the [`ShoppingContent`] hub.
8055///
8056/// # Example
8057///
8058/// Instantiate a resource builder
8059///
8060/// ```test_harness,no_run
8061/// extern crate hyper;
8062/// extern crate hyper_rustls;
8063/// extern crate google_content2 as content2;
8064///
8065/// # async fn dox() {
8066/// use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8067///
8068/// let secret: yup_oauth2::ApplicationSecret = Default::default();
8069/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
8070///     .with_native_roots()
8071///     .unwrap()
8072///     .https_only()
8073///     .enable_http2()
8074///     .build();
8075///
8076/// let executor = hyper_util::rt::TokioExecutor::new();
8077/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8078///     secret,
8079///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8080///     yup_oauth2::client::CustomHyperClientBuilder::from(
8081///         hyper_util::client::legacy::Client::builder(executor).build(connector),
8082///     ),
8083/// ).build().await.unwrap();
8084///
8085/// let client = hyper_util::client::legacy::Client::builder(
8086///     hyper_util::rt::TokioExecutor::new()
8087/// )
8088/// .build(
8089///     hyper_rustls::HttpsConnectorBuilder::new()
8090///         .with_native_roots()
8091///         .unwrap()
8092///         .https_or_http()
8093///         .enable_http2()
8094///         .build()
8095/// );
8096/// let mut hub = ShoppingContent::new(client, auth);
8097/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
8098/// // like `custombatch(...)` and `set(...)`
8099/// // to build up your call.
8100/// let rb = hub.inventory();
8101/// # }
8102/// ```
8103pub struct InventoryMethods<'a, C>
8104where
8105    C: 'a,
8106{
8107    hub: &'a ShoppingContent<C>,
8108}
8109
8110impl<'a, C> common::MethodsBuilder for InventoryMethods<'a, C> {}
8111
8112impl<'a, C> InventoryMethods<'a, C> {
8113    /// Create a builder to help you perform the following task:
8114    ///
8115    /// Updates price and availability for multiple products or stores in a single request. This operation does not update the expiration date of the products.
8116    ///
8117    /// # Arguments
8118    ///
8119    /// * `request` - No description provided.
8120    pub fn custombatch(
8121        &self,
8122        request: InventoryCustomBatchRequest,
8123    ) -> InventoryCustombatchCall<'a, C> {
8124        InventoryCustombatchCall {
8125            hub: self.hub,
8126            _request: request,
8127            _dry_run: Default::default(),
8128            _delegate: Default::default(),
8129            _additional_params: Default::default(),
8130            _scopes: Default::default(),
8131        }
8132    }
8133
8134    /// Create a builder to help you perform the following task:
8135    ///
8136    /// Updates price and availability of a product in your Merchant Center account.
8137    ///
8138    /// # Arguments
8139    ///
8140    /// * `request` - No description provided.
8141    /// * `merchantId` - The ID of the account that contains the product. This account cannot be a multi-client account.
8142    /// * `storeCode` - The code of the store for which to update price and availability. Use `online` to update price and availability of an online product.
8143    /// * `productId` - The REST ID of the product for which to update price and availability.
8144    pub fn set(
8145        &self,
8146        request: InventorySetRequest,
8147        merchant_id: u64,
8148        store_code: &str,
8149        product_id: &str,
8150    ) -> InventorySetCall<'a, C> {
8151        InventorySetCall {
8152            hub: self.hub,
8153            _request: request,
8154            _merchant_id: merchant_id,
8155            _store_code: store_code.to_string(),
8156            _product_id: product_id.to_string(),
8157            _dry_run: Default::default(),
8158            _delegate: Default::default(),
8159            _additional_params: Default::default(),
8160            _scopes: Default::default(),
8161        }
8162    }
8163}
8164
8165/// A builder providing access to all methods supported on *liasetting* resources.
8166/// It is not used directly, but through the [`ShoppingContent`] hub.
8167///
8168/// # Example
8169///
8170/// Instantiate a resource builder
8171///
8172/// ```test_harness,no_run
8173/// extern crate hyper;
8174/// extern crate hyper_rustls;
8175/// extern crate google_content2 as content2;
8176///
8177/// # async fn dox() {
8178/// use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8179///
8180/// let secret: yup_oauth2::ApplicationSecret = Default::default();
8181/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
8182///     .with_native_roots()
8183///     .unwrap()
8184///     .https_only()
8185///     .enable_http2()
8186///     .build();
8187///
8188/// let executor = hyper_util::rt::TokioExecutor::new();
8189/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8190///     secret,
8191///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8192///     yup_oauth2::client::CustomHyperClientBuilder::from(
8193///         hyper_util::client::legacy::Client::builder(executor).build(connector),
8194///     ),
8195/// ).build().await.unwrap();
8196///
8197/// let client = hyper_util::client::legacy::Client::builder(
8198///     hyper_util::rt::TokioExecutor::new()
8199/// )
8200/// .build(
8201///     hyper_rustls::HttpsConnectorBuilder::new()
8202///         .with_native_roots()
8203///         .unwrap()
8204///         .https_or_http()
8205///         .enable_http2()
8206///         .build()
8207/// );
8208/// let mut hub = ShoppingContent::new(client, auth);
8209/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
8210/// // like `custombatch(...)`, `get(...)`, `getaccessiblegmbaccounts(...)`, `list(...)`, `listposdataproviders(...)`, `requestgmbaccess(...)`, `requestinventoryverification(...)`, `setinventoryverificationcontact(...)`, `setposdataprovider(...)` and `update(...)`
8211/// // to build up your call.
8212/// let rb = hub.liasettings();
8213/// # }
8214/// ```
8215pub struct LiasettingMethods<'a, C>
8216where
8217    C: 'a,
8218{
8219    hub: &'a ShoppingContent<C>,
8220}
8221
8222impl<'a, C> common::MethodsBuilder for LiasettingMethods<'a, C> {}
8223
8224impl<'a, C> LiasettingMethods<'a, C> {
8225    /// Create a builder to help you perform the following task:
8226    ///
8227    /// Retrieves and/or updates the LIA settings of multiple accounts in a single request.
8228    ///
8229    /// # Arguments
8230    ///
8231    /// * `request` - No description provided.
8232    pub fn custombatch(
8233        &self,
8234        request: LiasettingsCustomBatchRequest,
8235    ) -> LiasettingCustombatchCall<'a, C> {
8236        LiasettingCustombatchCall {
8237            hub: self.hub,
8238            _request: request,
8239            _dry_run: Default::default(),
8240            _delegate: Default::default(),
8241            _additional_params: Default::default(),
8242            _scopes: Default::default(),
8243        }
8244    }
8245
8246    /// Create a builder to help you perform the following task:
8247    ///
8248    /// Retrieves the LIA settings of the account.
8249    ///
8250    /// # Arguments
8251    ///
8252    /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
8253    /// * `accountId` - The ID of the account for which to get or update LIA settings.
8254    pub fn get(&self, merchant_id: u64, account_id: u64) -> LiasettingGetCall<'a, C> {
8255        LiasettingGetCall {
8256            hub: self.hub,
8257            _merchant_id: merchant_id,
8258            _account_id: account_id,
8259            _delegate: Default::default(),
8260            _additional_params: Default::default(),
8261            _scopes: Default::default(),
8262        }
8263    }
8264
8265    /// Create a builder to help you perform the following task:
8266    ///
8267    /// Retrieves the list of accessible Google My Business accounts.
8268    ///
8269    /// # Arguments
8270    ///
8271    /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
8272    /// * `accountId` - The ID of the account for which to retrieve accessible Google My Business accounts.
8273    pub fn getaccessiblegmbaccounts(
8274        &self,
8275        merchant_id: u64,
8276        account_id: u64,
8277    ) -> LiasettingGetaccessiblegmbaccountCall<'a, C> {
8278        LiasettingGetaccessiblegmbaccountCall {
8279            hub: self.hub,
8280            _merchant_id: merchant_id,
8281            _account_id: account_id,
8282            _delegate: Default::default(),
8283            _additional_params: Default::default(),
8284            _scopes: Default::default(),
8285        }
8286    }
8287
8288    /// Create a builder to help you perform the following task:
8289    ///
8290    /// Lists the LIA settings of the sub-accounts in your Merchant Center account.
8291    ///
8292    /// # Arguments
8293    ///
8294    /// * `merchantId` - The ID of the managing account. This must be a multi-client account.
8295    pub fn list(&self, merchant_id: u64) -> LiasettingListCall<'a, C> {
8296        LiasettingListCall {
8297            hub: self.hub,
8298            _merchant_id: merchant_id,
8299            _page_token: Default::default(),
8300            _max_results: Default::default(),
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    /// Retrieves the list of POS data providers that have active settings for the all eiligible countries.
8310    pub fn listposdataproviders(&self) -> LiasettingListposdataproviderCall<'a, C> {
8311        LiasettingListposdataproviderCall {
8312            hub: self.hub,
8313            _delegate: Default::default(),
8314            _additional_params: Default::default(),
8315            _scopes: Default::default(),
8316        }
8317    }
8318
8319    /// Create a builder to help you perform the following task:
8320    ///
8321    /// Requests access to a specified Google My Business account.
8322    ///
8323    /// # Arguments
8324    ///
8325    /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
8326    /// * `accountId` - The ID of the account for which GMB access is requested.
8327    /// * `gmbEmail` - The email of the Google My Business account.
8328    pub fn requestgmbaccess(
8329        &self,
8330        merchant_id: u64,
8331        account_id: u64,
8332        gmb_email: &str,
8333    ) -> LiasettingRequestgmbaccesCall<'a, C> {
8334        LiasettingRequestgmbaccesCall {
8335            hub: self.hub,
8336            _merchant_id: merchant_id,
8337            _account_id: account_id,
8338            _gmb_email: gmb_email.to_string(),
8339            _delegate: Default::default(),
8340            _additional_params: Default::default(),
8341            _scopes: Default::default(),
8342        }
8343    }
8344
8345    /// Create a builder to help you perform the following task:
8346    ///
8347    /// Requests inventory validation for the specified country.
8348    ///
8349    /// # Arguments
8350    ///
8351    /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
8352    /// * `accountId` - The ID of the account that manages the order. This cannot be a multi-client account.
8353    /// * `country` - The country for which inventory validation is requested.
8354    pub fn requestinventoryverification(
8355        &self,
8356        merchant_id: u64,
8357        account_id: u64,
8358        country: &str,
8359    ) -> LiasettingRequestinventoryverificationCall<'a, C> {
8360        LiasettingRequestinventoryverificationCall {
8361            hub: self.hub,
8362            _merchant_id: merchant_id,
8363            _account_id: account_id,
8364            _country: country.to_string(),
8365            _delegate: Default::default(),
8366            _additional_params: Default::default(),
8367            _scopes: Default::default(),
8368        }
8369    }
8370
8371    /// Create a builder to help you perform the following task:
8372    ///
8373    /// Sets the inventory verification contract for the specified country.
8374    ///
8375    /// # Arguments
8376    ///
8377    /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
8378    /// * `accountId` - The ID of the account that manages the order. This cannot be a multi-client account.
8379    /// * `country` - The country for which inventory verification is requested.
8380    /// * `language` - The language for which inventory verification is requested.
8381    /// * `contactName` - The name of the inventory verification contact.
8382    /// * `contactEmail` - The email of the inventory verification contact.
8383    pub fn setinventoryverificationcontact(
8384        &self,
8385        merchant_id: u64,
8386        account_id: u64,
8387        country: &str,
8388        language: &str,
8389        contact_name: &str,
8390        contact_email: &str,
8391    ) -> LiasettingSetinventoryverificationcontactCall<'a, C> {
8392        LiasettingSetinventoryverificationcontactCall {
8393            hub: self.hub,
8394            _merchant_id: merchant_id,
8395            _account_id: account_id,
8396            _country: country.to_string(),
8397            _language: language.to_string(),
8398            _contact_name: contact_name.to_string(),
8399            _contact_email: contact_email.to_string(),
8400            _delegate: Default::default(),
8401            _additional_params: Default::default(),
8402            _scopes: Default::default(),
8403        }
8404    }
8405
8406    /// Create a builder to help you perform the following task:
8407    ///
8408    /// Sets the POS data provider for the specified country.
8409    ///
8410    /// # Arguments
8411    ///
8412    /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
8413    /// * `accountId` - The ID of the account for which to retrieve accessible Google My Business accounts.
8414    /// * `country` - The country for which the POS data provider is selected.
8415    pub fn setposdataprovider(
8416        &self,
8417        merchant_id: u64,
8418        account_id: u64,
8419        country: &str,
8420    ) -> LiasettingSetposdataproviderCall<'a, C> {
8421        LiasettingSetposdataproviderCall {
8422            hub: self.hub,
8423            _merchant_id: merchant_id,
8424            _account_id: account_id,
8425            _country: country.to_string(),
8426            _pos_external_account_id: Default::default(),
8427            _pos_data_provider_id: Default::default(),
8428            _delegate: Default::default(),
8429            _additional_params: Default::default(),
8430            _scopes: Default::default(),
8431        }
8432    }
8433
8434    /// Create a builder to help you perform the following task:
8435    ///
8436    /// Updates the LIA settings of the account. Any fields that are not provided are deleted from the resource.
8437    ///
8438    /// # Arguments
8439    ///
8440    /// * `request` - No description provided.
8441    /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
8442    /// * `accountId` - The ID of the account for which to get or update LIA settings.
8443    pub fn update(
8444        &self,
8445        request: LiaSettings,
8446        merchant_id: u64,
8447        account_id: u64,
8448    ) -> LiasettingUpdateCall<'a, C> {
8449        LiasettingUpdateCall {
8450            hub: self.hub,
8451            _request: request,
8452            _merchant_id: merchant_id,
8453            _account_id: account_id,
8454            _dry_run: Default::default(),
8455            _delegate: Default::default(),
8456            _additional_params: Default::default(),
8457            _scopes: Default::default(),
8458        }
8459    }
8460}
8461
8462/// A builder providing access to all methods supported on *orderinvoice* resources.
8463/// It is not used directly, but through the [`ShoppingContent`] hub.
8464///
8465/// # Example
8466///
8467/// Instantiate a resource builder
8468///
8469/// ```test_harness,no_run
8470/// extern crate hyper;
8471/// extern crate hyper_rustls;
8472/// extern crate google_content2 as content2;
8473///
8474/// # async fn dox() {
8475/// use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8476///
8477/// let secret: yup_oauth2::ApplicationSecret = Default::default();
8478/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
8479///     .with_native_roots()
8480///     .unwrap()
8481///     .https_only()
8482///     .enable_http2()
8483///     .build();
8484///
8485/// let executor = hyper_util::rt::TokioExecutor::new();
8486/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8487///     secret,
8488///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8489///     yup_oauth2::client::CustomHyperClientBuilder::from(
8490///         hyper_util::client::legacy::Client::builder(executor).build(connector),
8491///     ),
8492/// ).build().await.unwrap();
8493///
8494/// let client = hyper_util::client::legacy::Client::builder(
8495///     hyper_util::rt::TokioExecutor::new()
8496/// )
8497/// .build(
8498///     hyper_rustls::HttpsConnectorBuilder::new()
8499///         .with_native_roots()
8500///         .unwrap()
8501///         .https_or_http()
8502///         .enable_http2()
8503///         .build()
8504/// );
8505/// let mut hub = ShoppingContent::new(client, auth);
8506/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
8507/// // like `createchargeinvoice(...)` and `createrefundinvoice(...)`
8508/// // to build up your call.
8509/// let rb = hub.orderinvoices();
8510/// # }
8511/// ```
8512pub struct OrderinvoiceMethods<'a, C>
8513where
8514    C: 'a,
8515{
8516    hub: &'a ShoppingContent<C>,
8517}
8518
8519impl<'a, C> common::MethodsBuilder for OrderinvoiceMethods<'a, C> {}
8520
8521impl<'a, C> OrderinvoiceMethods<'a, C> {
8522    /// Create a builder to help you perform the following task:
8523    ///
8524    /// Creates a charge invoice for a shipment group, and triggers a charge capture for orderinvoice enabled orders.
8525    ///
8526    /// # Arguments
8527    ///
8528    /// * `request` - No description provided.
8529    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
8530    /// * `orderId` - The ID of the order.
8531    pub fn createchargeinvoice(
8532        &self,
8533        request: OrderinvoicesCreateChargeInvoiceRequest,
8534        merchant_id: u64,
8535        order_id: &str,
8536    ) -> OrderinvoiceCreatechargeinvoiceCall<'a, C> {
8537        OrderinvoiceCreatechargeinvoiceCall {
8538            hub: self.hub,
8539            _request: request,
8540            _merchant_id: merchant_id,
8541            _order_id: order_id.to_string(),
8542            _delegate: Default::default(),
8543            _additional_params: Default::default(),
8544            _scopes: Default::default(),
8545        }
8546    }
8547
8548    /// Create a builder to help you perform the following task:
8549    ///
8550    /// Creates a refund invoice for one or more shipment groups, and triggers a refund for orderinvoice enabled orders. This can only be used for line items that have previously been charged using `createChargeInvoice`. All amounts (except for the summary) are incremental with respect to the previous invoice.
8551    ///
8552    /// # Arguments
8553    ///
8554    /// * `request` - No description provided.
8555    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
8556    /// * `orderId` - The ID of the order.
8557    pub fn createrefundinvoice(
8558        &self,
8559        request: OrderinvoicesCreateRefundInvoiceRequest,
8560        merchant_id: u64,
8561        order_id: &str,
8562    ) -> OrderinvoiceCreaterefundinvoiceCall<'a, C> {
8563        OrderinvoiceCreaterefundinvoiceCall {
8564            hub: self.hub,
8565            _request: request,
8566            _merchant_id: merchant_id,
8567            _order_id: order_id.to_string(),
8568            _delegate: Default::default(),
8569            _additional_params: Default::default(),
8570            _scopes: Default::default(),
8571        }
8572    }
8573}
8574
8575/// A builder providing access to all methods supported on *orderreport* resources.
8576/// It is not used directly, but through the [`ShoppingContent`] hub.
8577///
8578/// # Example
8579///
8580/// Instantiate a resource builder
8581///
8582/// ```test_harness,no_run
8583/// extern crate hyper;
8584/// extern crate hyper_rustls;
8585/// extern crate google_content2 as content2;
8586///
8587/// # async fn dox() {
8588/// use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8589///
8590/// let secret: yup_oauth2::ApplicationSecret = Default::default();
8591/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
8592///     .with_native_roots()
8593///     .unwrap()
8594///     .https_only()
8595///     .enable_http2()
8596///     .build();
8597///
8598/// let executor = hyper_util::rt::TokioExecutor::new();
8599/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8600///     secret,
8601///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8602///     yup_oauth2::client::CustomHyperClientBuilder::from(
8603///         hyper_util::client::legacy::Client::builder(executor).build(connector),
8604///     ),
8605/// ).build().await.unwrap();
8606///
8607/// let client = hyper_util::client::legacy::Client::builder(
8608///     hyper_util::rt::TokioExecutor::new()
8609/// )
8610/// .build(
8611///     hyper_rustls::HttpsConnectorBuilder::new()
8612///         .with_native_roots()
8613///         .unwrap()
8614///         .https_or_http()
8615///         .enable_http2()
8616///         .build()
8617/// );
8618/// let mut hub = ShoppingContent::new(client, auth);
8619/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
8620/// // like `listdisbursements(...)` and `listtransactions(...)`
8621/// // to build up your call.
8622/// let rb = hub.orderreports();
8623/// # }
8624/// ```
8625pub struct OrderreportMethods<'a, C>
8626where
8627    C: 'a,
8628{
8629    hub: &'a ShoppingContent<C>,
8630}
8631
8632impl<'a, C> common::MethodsBuilder for OrderreportMethods<'a, C> {}
8633
8634impl<'a, C> OrderreportMethods<'a, C> {
8635    /// Create a builder to help you perform the following task:
8636    ///
8637    /// Retrieves a report for disbursements from your Merchant Center account.
8638    ///
8639    /// # Arguments
8640    ///
8641    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
8642    pub fn listdisbursements(&self, merchant_id: u64) -> OrderreportListdisbursementCall<'a, C> {
8643        OrderreportListdisbursementCall {
8644            hub: self.hub,
8645            _merchant_id: merchant_id,
8646            _page_token: Default::default(),
8647            _max_results: Default::default(),
8648            _disbursement_start_date: Default::default(),
8649            _disbursement_end_date: Default::default(),
8650            _delegate: Default::default(),
8651            _additional_params: Default::default(),
8652            _scopes: Default::default(),
8653        }
8654    }
8655
8656    /// Create a builder to help you perform the following task:
8657    ///
8658    /// Retrieves a list of transactions for a disbursement from your Merchant Center account.
8659    ///
8660    /// # Arguments
8661    ///
8662    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
8663    /// * `disbursementId` - The Google-provided ID of the disbursement (found in Wallet).
8664    pub fn listtransactions(
8665        &self,
8666        merchant_id: u64,
8667        disbursement_id: &str,
8668    ) -> OrderreportListtransactionCall<'a, C> {
8669        OrderreportListtransactionCall {
8670            hub: self.hub,
8671            _merchant_id: merchant_id,
8672            _disbursement_id: disbursement_id.to_string(),
8673            _transaction_start_date: Default::default(),
8674            _transaction_end_date: Default::default(),
8675            _page_token: Default::default(),
8676            _max_results: Default::default(),
8677            _delegate: Default::default(),
8678            _additional_params: Default::default(),
8679            _scopes: Default::default(),
8680        }
8681    }
8682}
8683
8684/// A builder providing access to all methods supported on *orderreturn* resources.
8685/// It is not used directly, but through the [`ShoppingContent`] hub.
8686///
8687/// # Example
8688///
8689/// Instantiate a resource builder
8690///
8691/// ```test_harness,no_run
8692/// extern crate hyper;
8693/// extern crate hyper_rustls;
8694/// extern crate google_content2 as content2;
8695///
8696/// # async fn dox() {
8697/// use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8698///
8699/// let secret: yup_oauth2::ApplicationSecret = Default::default();
8700/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
8701///     .with_native_roots()
8702///     .unwrap()
8703///     .https_only()
8704///     .enable_http2()
8705///     .build();
8706///
8707/// let executor = hyper_util::rt::TokioExecutor::new();
8708/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8709///     secret,
8710///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8711///     yup_oauth2::client::CustomHyperClientBuilder::from(
8712///         hyper_util::client::legacy::Client::builder(executor).build(connector),
8713///     ),
8714/// ).build().await.unwrap();
8715///
8716/// let client = hyper_util::client::legacy::Client::builder(
8717///     hyper_util::rt::TokioExecutor::new()
8718/// )
8719/// .build(
8720///     hyper_rustls::HttpsConnectorBuilder::new()
8721///         .with_native_roots()
8722///         .unwrap()
8723///         .https_or_http()
8724///         .enable_http2()
8725///         .build()
8726/// );
8727/// let mut hub = ShoppingContent::new(client, auth);
8728/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
8729/// // like `get(...)` and `list(...)`
8730/// // to build up your call.
8731/// let rb = hub.orderreturns();
8732/// # }
8733/// ```
8734pub struct OrderreturnMethods<'a, C>
8735where
8736    C: 'a,
8737{
8738    hub: &'a ShoppingContent<C>,
8739}
8740
8741impl<'a, C> common::MethodsBuilder for OrderreturnMethods<'a, C> {}
8742
8743impl<'a, C> OrderreturnMethods<'a, C> {
8744    /// Create a builder to help you perform the following task:
8745    ///
8746    /// Retrieves an order return from your Merchant Center account.
8747    ///
8748    /// # Arguments
8749    ///
8750    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
8751    /// * `returnId` - Merchant order return ID generated by Google.
8752    pub fn get(&self, merchant_id: u64, return_id: &str) -> OrderreturnGetCall<'a, C> {
8753        OrderreturnGetCall {
8754            hub: self.hub,
8755            _merchant_id: merchant_id,
8756            _return_id: return_id.to_string(),
8757            _delegate: Default::default(),
8758            _additional_params: Default::default(),
8759            _scopes: Default::default(),
8760        }
8761    }
8762
8763    /// Create a builder to help you perform the following task:
8764    ///
8765    /// Lists order returns in your Merchant Center account.
8766    ///
8767    /// # Arguments
8768    ///
8769    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
8770    pub fn list(&self, merchant_id: u64) -> OrderreturnListCall<'a, C> {
8771        OrderreturnListCall {
8772            hub: self.hub,
8773            _merchant_id: merchant_id,
8774            _page_token: Default::default(),
8775            _order_by: Default::default(),
8776            _max_results: Default::default(),
8777            _created_start_date: Default::default(),
8778            _created_end_date: Default::default(),
8779            _delegate: Default::default(),
8780            _additional_params: Default::default(),
8781            _scopes: Default::default(),
8782        }
8783    }
8784}
8785
8786/// A builder providing access to all methods supported on *order* resources.
8787/// It is not used directly, but through the [`ShoppingContent`] hub.
8788///
8789/// # Example
8790///
8791/// Instantiate a resource builder
8792///
8793/// ```test_harness,no_run
8794/// extern crate hyper;
8795/// extern crate hyper_rustls;
8796/// extern crate google_content2 as content2;
8797///
8798/// # async fn dox() {
8799/// use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8800///
8801/// let secret: yup_oauth2::ApplicationSecret = Default::default();
8802/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
8803///     .with_native_roots()
8804///     .unwrap()
8805///     .https_only()
8806///     .enable_http2()
8807///     .build();
8808///
8809/// let executor = hyper_util::rt::TokioExecutor::new();
8810/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8811///     secret,
8812///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8813///     yup_oauth2::client::CustomHyperClientBuilder::from(
8814///         hyper_util::client::legacy::Client::builder(executor).build(connector),
8815///     ),
8816/// ).build().await.unwrap();
8817///
8818/// let client = hyper_util::client::legacy::Client::builder(
8819///     hyper_util::rt::TokioExecutor::new()
8820/// )
8821/// .build(
8822///     hyper_rustls::HttpsConnectorBuilder::new()
8823///         .with_native_roots()
8824///         .unwrap()
8825///         .https_or_http()
8826///         .enable_http2()
8827///         .build()
8828/// );
8829/// let mut hub = ShoppingContent::new(client, auth);
8830/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
8831/// // like `acknowledge(...)`, `advancetestorder(...)`, `cancel(...)`, `cancellineitem(...)`, `canceltestorderbycustomer(...)`, `createtestorder(...)`, `createtestreturn(...)`, `custombatch(...)`, `get(...)`, `getbymerchantorderid(...)`, `gettestordertemplate(...)`, `instorerefundlineitem(...)`, `list(...)`, `refund(...)`, `rejectreturnlineitem(...)`, `returnlineitem(...)`, `returnrefundlineitem(...)`, `setlineitemmetadata(...)`, `shiplineitems(...)`, `updatelineitemshippingdetails(...)`, `updatemerchantorderid(...)` and `updateshipment(...)`
8832/// // to build up your call.
8833/// let rb = hub.orders();
8834/// # }
8835/// ```
8836pub struct OrderMethods<'a, C>
8837where
8838    C: 'a,
8839{
8840    hub: &'a ShoppingContent<C>,
8841}
8842
8843impl<'a, C> common::MethodsBuilder for OrderMethods<'a, C> {}
8844
8845impl<'a, C> OrderMethods<'a, C> {
8846    /// Create a builder to help you perform the following task:
8847    ///
8848    /// Marks an order as acknowledged.
8849    ///
8850    /// # Arguments
8851    ///
8852    /// * `request` - No description provided.
8853    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
8854    /// * `orderId` - The ID of the order.
8855    pub fn acknowledge(
8856        &self,
8857        request: OrdersAcknowledgeRequest,
8858        merchant_id: u64,
8859        order_id: &str,
8860    ) -> OrderAcknowledgeCall<'a, C> {
8861        OrderAcknowledgeCall {
8862            hub: self.hub,
8863            _request: request,
8864            _merchant_id: merchant_id,
8865            _order_id: order_id.to_string(),
8866            _delegate: Default::default(),
8867            _additional_params: Default::default(),
8868            _scopes: Default::default(),
8869        }
8870    }
8871
8872    /// Create a builder to help you perform the following task:
8873    ///
8874    /// Sandbox only. Moves a test order from state "`inProgress`" to state "`pendingShipment`".
8875    ///
8876    /// # Arguments
8877    ///
8878    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
8879    /// * `orderId` - The ID of the test order to modify.
8880    pub fn advancetestorder(
8881        &self,
8882        merchant_id: u64,
8883        order_id: &str,
8884    ) -> OrderAdvancetestorderCall<'a, C> {
8885        OrderAdvancetestorderCall {
8886            hub: self.hub,
8887            _merchant_id: merchant_id,
8888            _order_id: order_id.to_string(),
8889            _delegate: Default::default(),
8890            _additional_params: Default::default(),
8891            _scopes: Default::default(),
8892        }
8893    }
8894
8895    /// Create a builder to help you perform the following task:
8896    ///
8897    /// Cancels all line items in an order, making a full refund.
8898    ///
8899    /// # Arguments
8900    ///
8901    /// * `request` - No description provided.
8902    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
8903    /// * `orderId` - The ID of the order to cancel.
8904    pub fn cancel(
8905        &self,
8906        request: OrdersCancelRequest,
8907        merchant_id: u64,
8908        order_id: &str,
8909    ) -> OrderCancelCall<'a, C> {
8910        OrderCancelCall {
8911            hub: self.hub,
8912            _request: request,
8913            _merchant_id: merchant_id,
8914            _order_id: order_id.to_string(),
8915            _delegate: Default::default(),
8916            _additional_params: Default::default(),
8917            _scopes: Default::default(),
8918        }
8919    }
8920
8921    /// Create a builder to help you perform the following task:
8922    ///
8923    /// Cancels a line item, making a full refund.
8924    ///
8925    /// # Arguments
8926    ///
8927    /// * `request` - No description provided.
8928    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
8929    /// * `orderId` - The ID of the order.
8930    pub fn cancellineitem(
8931        &self,
8932        request: OrdersCancelLineItemRequest,
8933        merchant_id: u64,
8934        order_id: &str,
8935    ) -> OrderCancellineitemCall<'a, C> {
8936        OrderCancellineitemCall {
8937            hub: self.hub,
8938            _request: request,
8939            _merchant_id: merchant_id,
8940            _order_id: order_id.to_string(),
8941            _delegate: Default::default(),
8942            _additional_params: Default::default(),
8943            _scopes: Default::default(),
8944        }
8945    }
8946
8947    /// Create a builder to help you perform the following task:
8948    ///
8949    /// Sandbox only. Cancels a test order for customer-initiated cancellation.
8950    ///
8951    /// # Arguments
8952    ///
8953    /// * `request` - No description provided.
8954    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
8955    /// * `orderId` - The ID of the test order to cancel.
8956    pub fn canceltestorderbycustomer(
8957        &self,
8958        request: OrdersCancelTestOrderByCustomerRequest,
8959        merchant_id: u64,
8960        order_id: &str,
8961    ) -> OrderCanceltestorderbycustomerCall<'a, C> {
8962        OrderCanceltestorderbycustomerCall {
8963            hub: self.hub,
8964            _request: request,
8965            _merchant_id: merchant_id,
8966            _order_id: order_id.to_string(),
8967            _delegate: Default::default(),
8968            _additional_params: Default::default(),
8969            _scopes: Default::default(),
8970        }
8971    }
8972
8973    /// Create a builder to help you perform the following task:
8974    ///
8975    /// Sandbox only. Creates a test order.
8976    ///
8977    /// # Arguments
8978    ///
8979    /// * `request` - No description provided.
8980    /// * `merchantId` - The ID of the account that should manage the order. This cannot be a multi-client account.
8981    pub fn createtestorder(
8982        &self,
8983        request: OrdersCreateTestOrderRequest,
8984        merchant_id: u64,
8985    ) -> OrderCreatetestorderCall<'a, C> {
8986        OrderCreatetestorderCall {
8987            hub: self.hub,
8988            _request: request,
8989            _merchant_id: merchant_id,
8990            _delegate: Default::default(),
8991            _additional_params: Default::default(),
8992            _scopes: Default::default(),
8993        }
8994    }
8995
8996    /// Create a builder to help you perform the following task:
8997    ///
8998    /// Sandbox only. Creates a test return.
8999    ///
9000    /// # Arguments
9001    ///
9002    /// * `request` - No description provided.
9003    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
9004    /// * `orderId` - The ID of the order.
9005    pub fn createtestreturn(
9006        &self,
9007        request: OrdersCreateTestReturnRequest,
9008        merchant_id: u64,
9009        order_id: &str,
9010    ) -> OrderCreatetestreturnCall<'a, C> {
9011        OrderCreatetestreturnCall {
9012            hub: self.hub,
9013            _request: request,
9014            _merchant_id: merchant_id,
9015            _order_id: order_id.to_string(),
9016            _delegate: Default::default(),
9017            _additional_params: Default::default(),
9018            _scopes: Default::default(),
9019        }
9020    }
9021
9022    /// Create a builder to help you perform the following task:
9023    ///
9024    /// Retrieves or modifies multiple orders in a single request.
9025    ///
9026    /// # Arguments
9027    ///
9028    /// * `request` - No description provided.
9029    pub fn custombatch(&self, request: OrdersCustomBatchRequest) -> OrderCustombatchCall<'a, C> {
9030        OrderCustombatchCall {
9031            hub: self.hub,
9032            _request: request,
9033            _delegate: Default::default(),
9034            _additional_params: Default::default(),
9035            _scopes: Default::default(),
9036        }
9037    }
9038
9039    /// Create a builder to help you perform the following task:
9040    ///
9041    /// Retrieves an order from your Merchant Center account.
9042    ///
9043    /// # Arguments
9044    ///
9045    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
9046    /// * `orderId` - The ID of the order.
9047    pub fn get(&self, merchant_id: u64, order_id: &str) -> OrderGetCall<'a, C> {
9048        OrderGetCall {
9049            hub: self.hub,
9050            _merchant_id: merchant_id,
9051            _order_id: order_id.to_string(),
9052            _delegate: Default::default(),
9053            _additional_params: Default::default(),
9054            _scopes: Default::default(),
9055        }
9056    }
9057
9058    /// Create a builder to help you perform the following task:
9059    ///
9060    /// Retrieves an order using merchant order ID.
9061    ///
9062    /// # Arguments
9063    ///
9064    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
9065    /// * `merchantOrderId` - The merchant order ID to be looked for.
9066    pub fn getbymerchantorderid(
9067        &self,
9068        merchant_id: u64,
9069        merchant_order_id: &str,
9070    ) -> OrderGetbymerchantorderidCall<'a, C> {
9071        OrderGetbymerchantorderidCall {
9072            hub: self.hub,
9073            _merchant_id: merchant_id,
9074            _merchant_order_id: merchant_order_id.to_string(),
9075            _delegate: Default::default(),
9076            _additional_params: Default::default(),
9077            _scopes: Default::default(),
9078        }
9079    }
9080
9081    /// Create a builder to help you perform the following task:
9082    ///
9083    /// Sandbox only. Retrieves an order template that can be used to quickly create a new order in sandbox.
9084    ///
9085    /// # Arguments
9086    ///
9087    /// * `merchantId` - The ID of the account that should manage the order. This cannot be a multi-client account.
9088    /// * `templateName` - The name of the template to retrieve.
9089    pub fn gettestordertemplate(
9090        &self,
9091        merchant_id: u64,
9092        template_name: &str,
9093    ) -> OrderGettestordertemplateCall<'a, C> {
9094        OrderGettestordertemplateCall {
9095            hub: self.hub,
9096            _merchant_id: merchant_id,
9097            _template_name: template_name.to_string(),
9098            _country: Default::default(),
9099            _delegate: Default::default(),
9100            _additional_params: Default::default(),
9101            _scopes: Default::default(),
9102        }
9103    }
9104
9105    /// Create a builder to help you perform the following task:
9106    ///
9107    /// Deprecated. Notifies that item return and refund was handled directly by merchant outside of Google payments processing (e.g. cash refund done in store). Note: We recommend calling the returnrefundlineitem method to refund in-store returns. We will issue the refund directly to the customer. This helps to prevent possible differences arising between merchant and Google transaction records. We also recommend having the point of sale system communicate with Google to ensure that customers do not receive a double refund by first refunding via Google then via an in-store return.
9108    ///
9109    /// # Arguments
9110    ///
9111    /// * `request` - No description provided.
9112    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
9113    /// * `orderId` - The ID of the order.
9114    pub fn instorerefundlineitem(
9115        &self,
9116        request: OrdersInStoreRefundLineItemRequest,
9117        merchant_id: u64,
9118        order_id: &str,
9119    ) -> OrderInstorerefundlineitemCall<'a, C> {
9120        OrderInstorerefundlineitemCall {
9121            hub: self.hub,
9122            _request: request,
9123            _merchant_id: merchant_id,
9124            _order_id: order_id.to_string(),
9125            _delegate: Default::default(),
9126            _additional_params: Default::default(),
9127            _scopes: Default::default(),
9128        }
9129    }
9130
9131    /// Create a builder to help you perform the following task:
9132    ///
9133    /// Lists the orders in your Merchant Center account.
9134    ///
9135    /// # Arguments
9136    ///
9137    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
9138    pub fn list(&self, merchant_id: u64) -> OrderListCall<'a, C> {
9139        OrderListCall {
9140            hub: self.hub,
9141            _merchant_id: merchant_id,
9142            _statuses: Default::default(),
9143            _placed_date_start: Default::default(),
9144            _placed_date_end: Default::default(),
9145            _page_token: Default::default(),
9146            _order_by: Default::default(),
9147            _max_results: Default::default(),
9148            _acknowledged: Default::default(),
9149            _delegate: Default::default(),
9150            _additional_params: Default::default(),
9151            _scopes: Default::default(),
9152        }
9153    }
9154
9155    /// Create a builder to help you perform the following task:
9156    ///
9157    /// Deprecated, please use returnRefundLineItem instead.
9158    ///
9159    /// # Arguments
9160    ///
9161    /// * `request` - No description provided.
9162    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
9163    /// * `orderId` - The ID of the order to refund.
9164    pub fn refund(
9165        &self,
9166        request: OrdersRefundRequest,
9167        merchant_id: u64,
9168        order_id: &str,
9169    ) -> OrderRefundCall<'a, C> {
9170        OrderRefundCall {
9171            hub: self.hub,
9172            _request: request,
9173            _merchant_id: merchant_id,
9174            _order_id: order_id.to_string(),
9175            _delegate: Default::default(),
9176            _additional_params: Default::default(),
9177            _scopes: Default::default(),
9178        }
9179    }
9180
9181    /// Create a builder to help you perform the following task:
9182    ///
9183    /// Rejects return on an line item.
9184    ///
9185    /// # Arguments
9186    ///
9187    /// * `request` - No description provided.
9188    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
9189    /// * `orderId` - The ID of the order.
9190    pub fn rejectreturnlineitem(
9191        &self,
9192        request: OrdersRejectReturnLineItemRequest,
9193        merchant_id: u64,
9194        order_id: &str,
9195    ) -> OrderRejectreturnlineitemCall<'a, C> {
9196        OrderRejectreturnlineitemCall {
9197            hub: self.hub,
9198            _request: request,
9199            _merchant_id: merchant_id,
9200            _order_id: order_id.to_string(),
9201            _delegate: Default::default(),
9202            _additional_params: Default::default(),
9203            _scopes: Default::default(),
9204        }
9205    }
9206
9207    /// Create a builder to help you perform the following task:
9208    ///
9209    /// Returns a line item.
9210    ///
9211    /// # Arguments
9212    ///
9213    /// * `request` - No description provided.
9214    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
9215    /// * `orderId` - The ID of the order.
9216    pub fn returnlineitem(
9217        &self,
9218        request: OrdersReturnLineItemRequest,
9219        merchant_id: u64,
9220        order_id: &str,
9221    ) -> OrderReturnlineitemCall<'a, C> {
9222        OrderReturnlineitemCall {
9223            hub: self.hub,
9224            _request: request,
9225            _merchant_id: merchant_id,
9226            _order_id: order_id.to_string(),
9227            _delegate: Default::default(),
9228            _additional_params: Default::default(),
9229            _scopes: Default::default(),
9230        }
9231    }
9232
9233    /// Create a builder to help you perform the following task:
9234    ///
9235    /// Returns and refunds a line item. Note that this method can only be called on fully shipped orders. Please also note that the Orderreturns API is the preferred way to handle returns after you receive a return from a customer. You can use Orderreturns.list or Orderreturns.get to search for the return, and then use Orderreturns.processreturn to issue the refund. If the return cannot be found, then we recommend using this API to issue a refund.
9236    ///
9237    /// # Arguments
9238    ///
9239    /// * `request` - No description provided.
9240    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
9241    /// * `orderId` - The ID of the order.
9242    pub fn returnrefundlineitem(
9243        &self,
9244        request: OrdersReturnRefundLineItemRequest,
9245        merchant_id: u64,
9246        order_id: &str,
9247    ) -> OrderReturnrefundlineitemCall<'a, C> {
9248        OrderReturnrefundlineitemCall {
9249            hub: self.hub,
9250            _request: request,
9251            _merchant_id: merchant_id,
9252            _order_id: order_id.to_string(),
9253            _delegate: Default::default(),
9254            _additional_params: Default::default(),
9255            _scopes: Default::default(),
9256        }
9257    }
9258
9259    /// Create a builder to help you perform the following task:
9260    ///
9261    /// Sets (or overrides if it already exists) merchant provided annotations in the form of key-value pairs. A common use case would be to supply us with additional structured information about a line item that cannot be provided via other methods. Submitted key-value pairs can be retrieved as part of the orders resource.
9262    ///
9263    /// # Arguments
9264    ///
9265    /// * `request` - No description provided.
9266    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
9267    /// * `orderId` - The ID of the order.
9268    pub fn setlineitemmetadata(
9269        &self,
9270        request: OrdersSetLineItemMetadataRequest,
9271        merchant_id: u64,
9272        order_id: &str,
9273    ) -> OrderSetlineitemmetadataCall<'a, C> {
9274        OrderSetlineitemmetadataCall {
9275            hub: self.hub,
9276            _request: request,
9277            _merchant_id: merchant_id,
9278            _order_id: order_id.to_string(),
9279            _delegate: Default::default(),
9280            _additional_params: Default::default(),
9281            _scopes: Default::default(),
9282        }
9283    }
9284
9285    /// Create a builder to help you perform the following task:
9286    ///
9287    /// Marks line item(s) as shipped.
9288    ///
9289    /// # Arguments
9290    ///
9291    /// * `request` - No description provided.
9292    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
9293    /// * `orderId` - The ID of the order.
9294    pub fn shiplineitems(
9295        &self,
9296        request: OrdersShipLineItemsRequest,
9297        merchant_id: u64,
9298        order_id: &str,
9299    ) -> OrderShiplineitemCall<'a, C> {
9300        OrderShiplineitemCall {
9301            hub: self.hub,
9302            _request: request,
9303            _merchant_id: merchant_id,
9304            _order_id: order_id.to_string(),
9305            _delegate: Default::default(),
9306            _additional_params: Default::default(),
9307            _scopes: Default::default(),
9308        }
9309    }
9310
9311    /// Create a builder to help you perform the following task:
9312    ///
9313    /// Updates ship by and delivery by dates for a line item.
9314    ///
9315    /// # Arguments
9316    ///
9317    /// * `request` - No description provided.
9318    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
9319    /// * `orderId` - The ID of the order.
9320    pub fn updatelineitemshippingdetails(
9321        &self,
9322        request: OrdersUpdateLineItemShippingDetailsRequest,
9323        merchant_id: u64,
9324        order_id: &str,
9325    ) -> OrderUpdatelineitemshippingdetailCall<'a, C> {
9326        OrderUpdatelineitemshippingdetailCall {
9327            hub: self.hub,
9328            _request: request,
9329            _merchant_id: merchant_id,
9330            _order_id: order_id.to_string(),
9331            _delegate: Default::default(),
9332            _additional_params: Default::default(),
9333            _scopes: Default::default(),
9334        }
9335    }
9336
9337    /// Create a builder to help you perform the following task:
9338    ///
9339    /// Updates the merchant order ID for a given order.
9340    ///
9341    /// # Arguments
9342    ///
9343    /// * `request` - No description provided.
9344    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
9345    /// * `orderId` - The ID of the order.
9346    pub fn updatemerchantorderid(
9347        &self,
9348        request: OrdersUpdateMerchantOrderIdRequest,
9349        merchant_id: u64,
9350        order_id: &str,
9351    ) -> OrderUpdatemerchantorderidCall<'a, C> {
9352        OrderUpdatemerchantorderidCall {
9353            hub: self.hub,
9354            _request: request,
9355            _merchant_id: merchant_id,
9356            _order_id: order_id.to_string(),
9357            _delegate: Default::default(),
9358            _additional_params: Default::default(),
9359            _scopes: Default::default(),
9360        }
9361    }
9362
9363    /// Create a builder to help you perform the following task:
9364    ///
9365    /// Updates a shipment's status, carrier, and/or tracking ID.
9366    ///
9367    /// # Arguments
9368    ///
9369    /// * `request` - No description provided.
9370    /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account.
9371    /// * `orderId` - The ID of the order.
9372    pub fn updateshipment(
9373        &self,
9374        request: OrdersUpdateShipmentRequest,
9375        merchant_id: u64,
9376        order_id: &str,
9377    ) -> OrderUpdateshipmentCall<'a, C> {
9378        OrderUpdateshipmentCall {
9379            hub: self.hub,
9380            _request: request,
9381            _merchant_id: merchant_id,
9382            _order_id: order_id.to_string(),
9383            _delegate: Default::default(),
9384            _additional_params: Default::default(),
9385            _scopes: Default::default(),
9386        }
9387    }
9388}
9389
9390/// A builder providing access to all methods supported on *po* resources.
9391/// It is not used directly, but through the [`ShoppingContent`] hub.
9392///
9393/// # Example
9394///
9395/// Instantiate a resource builder
9396///
9397/// ```test_harness,no_run
9398/// extern crate hyper;
9399/// extern crate hyper_rustls;
9400/// extern crate google_content2 as content2;
9401///
9402/// # async fn dox() {
9403/// use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9404///
9405/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9406/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
9407///     .with_native_roots()
9408///     .unwrap()
9409///     .https_only()
9410///     .enable_http2()
9411///     .build();
9412///
9413/// let executor = hyper_util::rt::TokioExecutor::new();
9414/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9415///     secret,
9416///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9417///     yup_oauth2::client::CustomHyperClientBuilder::from(
9418///         hyper_util::client::legacy::Client::builder(executor).build(connector),
9419///     ),
9420/// ).build().await.unwrap();
9421///
9422/// let client = hyper_util::client::legacy::Client::builder(
9423///     hyper_util::rt::TokioExecutor::new()
9424/// )
9425/// .build(
9426///     hyper_rustls::HttpsConnectorBuilder::new()
9427///         .with_native_roots()
9428///         .unwrap()
9429///         .https_or_http()
9430///         .enable_http2()
9431///         .build()
9432/// );
9433/// let mut hub = ShoppingContent::new(client, auth);
9434/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9435/// // like `custombatch(...)`, `delete(...)`, `get(...)`, `insert(...)`, `inventory(...)`, `list(...)` and `sale(...)`
9436/// // to build up your call.
9437/// let rb = hub.pos();
9438/// # }
9439/// ```
9440pub struct PoMethods<'a, C>
9441where
9442    C: 'a,
9443{
9444    hub: &'a ShoppingContent<C>,
9445}
9446
9447impl<'a, C> common::MethodsBuilder for PoMethods<'a, C> {}
9448
9449impl<'a, C> PoMethods<'a, C> {
9450    /// Create a builder to help you perform the following task:
9451    ///
9452    /// Batches multiple POS-related calls in a single request.
9453    ///
9454    /// # Arguments
9455    ///
9456    /// * `request` - No description provided.
9457    pub fn custombatch(&self, request: PosCustomBatchRequest) -> PoCustombatchCall<'a, C> {
9458        PoCustombatchCall {
9459            hub: self.hub,
9460            _request: request,
9461            _dry_run: Default::default(),
9462            _delegate: Default::default(),
9463            _additional_params: Default::default(),
9464            _scopes: Default::default(),
9465        }
9466    }
9467
9468    /// Create a builder to help you perform the following task:
9469    ///
9470    /// Deletes a store for the given merchant.
9471    ///
9472    /// # Arguments
9473    ///
9474    /// * `merchantId` - The ID of the POS or inventory data provider.
9475    /// * `targetMerchantId` - The ID of the target merchant.
9476    /// * `storeCode` - A store code that is unique per merchant.
9477    pub fn delete(
9478        &self,
9479        merchant_id: u64,
9480        target_merchant_id: u64,
9481        store_code: &str,
9482    ) -> PoDeleteCall<'a, C> {
9483        PoDeleteCall {
9484            hub: self.hub,
9485            _merchant_id: merchant_id,
9486            _target_merchant_id: target_merchant_id,
9487            _store_code: store_code.to_string(),
9488            _dry_run: Default::default(),
9489            _delegate: Default::default(),
9490            _additional_params: Default::default(),
9491            _scopes: Default::default(),
9492        }
9493    }
9494
9495    /// Create a builder to help you perform the following task:
9496    ///
9497    /// Retrieves information about the given store.
9498    ///
9499    /// # Arguments
9500    ///
9501    /// * `merchantId` - The ID of the POS or inventory data provider.
9502    /// * `targetMerchantId` - The ID of the target merchant.
9503    /// * `storeCode` - A store code that is unique per merchant.
9504    pub fn get(
9505        &self,
9506        merchant_id: u64,
9507        target_merchant_id: u64,
9508        store_code: &str,
9509    ) -> PoGetCall<'a, C> {
9510        PoGetCall {
9511            hub: self.hub,
9512            _merchant_id: merchant_id,
9513            _target_merchant_id: target_merchant_id,
9514            _store_code: store_code.to_string(),
9515            _delegate: Default::default(),
9516            _additional_params: Default::default(),
9517            _scopes: Default::default(),
9518        }
9519    }
9520
9521    /// Create a builder to help you perform the following task:
9522    ///
9523    /// Creates a store for the given merchant.
9524    ///
9525    /// # Arguments
9526    ///
9527    /// * `request` - No description provided.
9528    /// * `merchantId` - The ID of the POS or inventory data provider.
9529    /// * `targetMerchantId` - The ID of the target merchant.
9530    pub fn insert(
9531        &self,
9532        request: PosStore,
9533        merchant_id: u64,
9534        target_merchant_id: u64,
9535    ) -> PoInsertCall<'a, C> {
9536        PoInsertCall {
9537            hub: self.hub,
9538            _request: request,
9539            _merchant_id: merchant_id,
9540            _target_merchant_id: target_merchant_id,
9541            _dry_run: Default::default(),
9542            _delegate: Default::default(),
9543            _additional_params: Default::default(),
9544            _scopes: Default::default(),
9545        }
9546    }
9547
9548    /// Create a builder to help you perform the following task:
9549    ///
9550    /// Submit inventory for the given merchant.
9551    ///
9552    /// # Arguments
9553    ///
9554    /// * `request` - No description provided.
9555    /// * `merchantId` - The ID of the POS or inventory data provider.
9556    /// * `targetMerchantId` - The ID of the target merchant.
9557    pub fn inventory(
9558        &self,
9559        request: PosInventoryRequest,
9560        merchant_id: u64,
9561        target_merchant_id: u64,
9562    ) -> PoInventoryCall<'a, C> {
9563        PoInventoryCall {
9564            hub: self.hub,
9565            _request: request,
9566            _merchant_id: merchant_id,
9567            _target_merchant_id: target_merchant_id,
9568            _dry_run: Default::default(),
9569            _delegate: Default::default(),
9570            _additional_params: Default::default(),
9571            _scopes: Default::default(),
9572        }
9573    }
9574
9575    /// Create a builder to help you perform the following task:
9576    ///
9577    /// Lists the stores of the target merchant.
9578    ///
9579    /// # Arguments
9580    ///
9581    /// * `merchantId` - The ID of the POS or inventory data provider.
9582    /// * `targetMerchantId` - The ID of the target merchant.
9583    pub fn list(&self, merchant_id: u64, target_merchant_id: u64) -> PoListCall<'a, C> {
9584        PoListCall {
9585            hub: self.hub,
9586            _merchant_id: merchant_id,
9587            _target_merchant_id: target_merchant_id,
9588            _delegate: Default::default(),
9589            _additional_params: Default::default(),
9590            _scopes: Default::default(),
9591        }
9592    }
9593
9594    /// Create a builder to help you perform the following task:
9595    ///
9596    /// Submit a sale event for the given merchant.
9597    ///
9598    /// # Arguments
9599    ///
9600    /// * `request` - No description provided.
9601    /// * `merchantId` - The ID of the POS or inventory data provider.
9602    /// * `targetMerchantId` - The ID of the target merchant.
9603    pub fn sale(
9604        &self,
9605        request: PosSaleRequest,
9606        merchant_id: u64,
9607        target_merchant_id: u64,
9608    ) -> PoSaleCall<'a, C> {
9609        PoSaleCall {
9610            hub: self.hub,
9611            _request: request,
9612            _merchant_id: merchant_id,
9613            _target_merchant_id: target_merchant_id,
9614            _dry_run: Default::default(),
9615            _delegate: Default::default(),
9616            _additional_params: Default::default(),
9617            _scopes: Default::default(),
9618        }
9619    }
9620}
9621
9622/// A builder providing access to all methods supported on *product* resources.
9623/// It is not used directly, but through the [`ShoppingContent`] hub.
9624///
9625/// # Example
9626///
9627/// Instantiate a resource builder
9628///
9629/// ```test_harness,no_run
9630/// extern crate hyper;
9631/// extern crate hyper_rustls;
9632/// extern crate google_content2 as content2;
9633///
9634/// # async fn dox() {
9635/// use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9636///
9637/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9638/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
9639///     .with_native_roots()
9640///     .unwrap()
9641///     .https_only()
9642///     .enable_http2()
9643///     .build();
9644///
9645/// let executor = hyper_util::rt::TokioExecutor::new();
9646/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9647///     secret,
9648///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9649///     yup_oauth2::client::CustomHyperClientBuilder::from(
9650///         hyper_util::client::legacy::Client::builder(executor).build(connector),
9651///     ),
9652/// ).build().await.unwrap();
9653///
9654/// let client = hyper_util::client::legacy::Client::builder(
9655///     hyper_util::rt::TokioExecutor::new()
9656/// )
9657/// .build(
9658///     hyper_rustls::HttpsConnectorBuilder::new()
9659///         .with_native_roots()
9660///         .unwrap()
9661///         .https_or_http()
9662///         .enable_http2()
9663///         .build()
9664/// );
9665/// let mut hub = ShoppingContent::new(client, auth);
9666/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9667/// // like `custombatch(...)`, `delete(...)`, `get(...)`, `insert(...)` and `list(...)`
9668/// // to build up your call.
9669/// let rb = hub.products();
9670/// # }
9671/// ```
9672pub struct ProductMethods<'a, C>
9673where
9674    C: 'a,
9675{
9676    hub: &'a ShoppingContent<C>,
9677}
9678
9679impl<'a, C> common::MethodsBuilder for ProductMethods<'a, C> {}
9680
9681impl<'a, C> ProductMethods<'a, C> {
9682    /// Create a builder to help you perform the following task:
9683    ///
9684    /// Retrieves, inserts, and deletes multiple products in a single request.
9685    ///
9686    /// # Arguments
9687    ///
9688    /// * `request` - No description provided.
9689    pub fn custombatch(
9690        &self,
9691        request: ProductsCustomBatchRequest,
9692    ) -> ProductCustombatchCall<'a, C> {
9693        ProductCustombatchCall {
9694            hub: self.hub,
9695            _request: request,
9696            _dry_run: Default::default(),
9697            _delegate: Default::default(),
9698            _additional_params: Default::default(),
9699            _scopes: Default::default(),
9700        }
9701    }
9702
9703    /// Create a builder to help you perform the following task:
9704    ///
9705    /// Deletes a product from your Merchant Center account.
9706    ///
9707    /// # Arguments
9708    ///
9709    /// * `merchantId` - The ID of the account that contains the product. This account cannot be a multi-client account.
9710    /// * `productId` - The REST ID of the product.
9711    pub fn delete(&self, merchant_id: u64, product_id: &str) -> ProductDeleteCall<'a, C> {
9712        ProductDeleteCall {
9713            hub: self.hub,
9714            _merchant_id: merchant_id,
9715            _product_id: product_id.to_string(),
9716            _dry_run: Default::default(),
9717            _delegate: Default::default(),
9718            _additional_params: Default::default(),
9719            _scopes: Default::default(),
9720        }
9721    }
9722
9723    /// Create a builder to help you perform the following task:
9724    ///
9725    /// Retrieves a product from your Merchant Center account.
9726    ///
9727    /// # Arguments
9728    ///
9729    /// * `merchantId` - The ID of the account that contains the product. This account cannot be a multi-client account.
9730    /// * `productId` - The REST ID of the product.
9731    pub fn get(&self, merchant_id: u64, product_id: &str) -> ProductGetCall<'a, C> {
9732        ProductGetCall {
9733            hub: self.hub,
9734            _merchant_id: merchant_id,
9735            _product_id: product_id.to_string(),
9736            _delegate: Default::default(),
9737            _additional_params: Default::default(),
9738            _scopes: Default::default(),
9739        }
9740    }
9741
9742    /// Create a builder to help you perform the following task:
9743    ///
9744    /// Uploads a product to your Merchant Center account. If an item with the same channel, contentLanguage, offerId, and targetCountry already exists, this method updates that entry.
9745    ///
9746    /// # Arguments
9747    ///
9748    /// * `request` - No description provided.
9749    /// * `merchantId` - The ID of the account that contains the product. This account cannot be a multi-client account.
9750    pub fn insert(&self, request: Product, merchant_id: u64) -> ProductInsertCall<'a, C> {
9751        ProductInsertCall {
9752            hub: self.hub,
9753            _request: request,
9754            _merchant_id: merchant_id,
9755            _dry_run: Default::default(),
9756            _delegate: Default::default(),
9757            _additional_params: Default::default(),
9758            _scopes: Default::default(),
9759        }
9760    }
9761
9762    /// Create a builder to help you perform the following task:
9763    ///
9764    /// Lists the products in your Merchant Center account. The response might contain fewer items than specified by maxResults. Rely on nextPageToken to determine if there are more items to be requested.
9765    ///
9766    /// # Arguments
9767    ///
9768    /// * `merchantId` - The ID of the account that contains the products. This account cannot be a multi-client account.
9769    pub fn list(&self, merchant_id: u64) -> ProductListCall<'a, C> {
9770        ProductListCall {
9771            hub: self.hub,
9772            _merchant_id: merchant_id,
9773            _page_token: Default::default(),
9774            _max_results: Default::default(),
9775            _include_invalid_inserted_items: Default::default(),
9776            _delegate: Default::default(),
9777            _additional_params: Default::default(),
9778            _scopes: Default::default(),
9779        }
9780    }
9781}
9782
9783/// A builder providing access to all methods supported on *productstatus* resources.
9784/// It is not used directly, but through the [`ShoppingContent`] hub.
9785///
9786/// # Example
9787///
9788/// Instantiate a resource builder
9789///
9790/// ```test_harness,no_run
9791/// extern crate hyper;
9792/// extern crate hyper_rustls;
9793/// extern crate google_content2 as content2;
9794///
9795/// # async fn dox() {
9796/// use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9797///
9798/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9799/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
9800///     .with_native_roots()
9801///     .unwrap()
9802///     .https_only()
9803///     .enable_http2()
9804///     .build();
9805///
9806/// let executor = hyper_util::rt::TokioExecutor::new();
9807/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9808///     secret,
9809///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9810///     yup_oauth2::client::CustomHyperClientBuilder::from(
9811///         hyper_util::client::legacy::Client::builder(executor).build(connector),
9812///     ),
9813/// ).build().await.unwrap();
9814///
9815/// let client = hyper_util::client::legacy::Client::builder(
9816///     hyper_util::rt::TokioExecutor::new()
9817/// )
9818/// .build(
9819///     hyper_rustls::HttpsConnectorBuilder::new()
9820///         .with_native_roots()
9821///         .unwrap()
9822///         .https_or_http()
9823///         .enable_http2()
9824///         .build()
9825/// );
9826/// let mut hub = ShoppingContent::new(client, auth);
9827/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9828/// // like `custombatch(...)`, `get(...)` and `list(...)`
9829/// // to build up your call.
9830/// let rb = hub.productstatuses();
9831/// # }
9832/// ```
9833pub struct ProductstatusMethods<'a, C>
9834where
9835    C: 'a,
9836{
9837    hub: &'a ShoppingContent<C>,
9838}
9839
9840impl<'a, C> common::MethodsBuilder for ProductstatusMethods<'a, C> {}
9841
9842impl<'a, C> ProductstatusMethods<'a, C> {
9843    /// Create a builder to help you perform the following task:
9844    ///
9845    /// Gets the statuses of multiple products in a single request.
9846    ///
9847    /// # Arguments
9848    ///
9849    /// * `request` - No description provided.
9850    pub fn custombatch(
9851        &self,
9852        request: ProductstatusesCustomBatchRequest,
9853    ) -> ProductstatusCustombatchCall<'a, C> {
9854        ProductstatusCustombatchCall {
9855            hub: self.hub,
9856            _request: request,
9857            _include_attributes: Default::default(),
9858            _delegate: Default::default(),
9859            _additional_params: Default::default(),
9860            _scopes: Default::default(),
9861        }
9862    }
9863
9864    /// Create a builder to help you perform the following task:
9865    ///
9866    /// Gets the status of a product from your Merchant Center account.
9867    ///
9868    /// # Arguments
9869    ///
9870    /// * `merchantId` - The ID of the account that contains the product. This account cannot be a multi-client account.
9871    /// * `productId` - The REST ID of the product.
9872    pub fn get(&self, merchant_id: u64, product_id: &str) -> ProductstatusGetCall<'a, C> {
9873        ProductstatusGetCall {
9874            hub: self.hub,
9875            _merchant_id: merchant_id,
9876            _product_id: product_id.to_string(),
9877            _include_attributes: Default::default(),
9878            _destinations: Default::default(),
9879            _delegate: Default::default(),
9880            _additional_params: Default::default(),
9881            _scopes: Default::default(),
9882        }
9883    }
9884
9885    /// Create a builder to help you perform the following task:
9886    ///
9887    /// Lists the statuses of the products in your Merchant Center account.
9888    ///
9889    /// # Arguments
9890    ///
9891    /// * `merchantId` - The ID of the account that contains the products. This account cannot be a multi-client account.
9892    pub fn list(&self, merchant_id: u64) -> ProductstatusListCall<'a, C> {
9893        ProductstatusListCall {
9894            hub: self.hub,
9895            _merchant_id: merchant_id,
9896            _page_token: Default::default(),
9897            _max_results: Default::default(),
9898            _include_invalid_inserted_items: Default::default(),
9899            _include_attributes: Default::default(),
9900            _destinations: Default::default(),
9901            _delegate: Default::default(),
9902            _additional_params: Default::default(),
9903            _scopes: Default::default(),
9904        }
9905    }
9906}
9907
9908/// A builder providing access to all methods supported on *shippingsetting* resources.
9909/// It is not used directly, but through the [`ShoppingContent`] hub.
9910///
9911/// # Example
9912///
9913/// Instantiate a resource builder
9914///
9915/// ```test_harness,no_run
9916/// extern crate hyper;
9917/// extern crate hyper_rustls;
9918/// extern crate google_content2 as content2;
9919///
9920/// # async fn dox() {
9921/// use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9922///
9923/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9924/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
9925///     .with_native_roots()
9926///     .unwrap()
9927///     .https_only()
9928///     .enable_http2()
9929///     .build();
9930///
9931/// let executor = hyper_util::rt::TokioExecutor::new();
9932/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9933///     secret,
9934///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9935///     yup_oauth2::client::CustomHyperClientBuilder::from(
9936///         hyper_util::client::legacy::Client::builder(executor).build(connector),
9937///     ),
9938/// ).build().await.unwrap();
9939///
9940/// let client = hyper_util::client::legacy::Client::builder(
9941///     hyper_util::rt::TokioExecutor::new()
9942/// )
9943/// .build(
9944///     hyper_rustls::HttpsConnectorBuilder::new()
9945///         .with_native_roots()
9946///         .unwrap()
9947///         .https_or_http()
9948///         .enable_http2()
9949///         .build()
9950/// );
9951/// let mut hub = ShoppingContent::new(client, auth);
9952/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9953/// // like `custombatch(...)`, `get(...)`, `getsupportedcarriers(...)`, `getsupportedholidays(...)`, `getsupportedpickupservices(...)`, `list(...)` and `update(...)`
9954/// // to build up your call.
9955/// let rb = hub.shippingsettings();
9956/// # }
9957/// ```
9958pub struct ShippingsettingMethods<'a, C>
9959where
9960    C: 'a,
9961{
9962    hub: &'a ShoppingContent<C>,
9963}
9964
9965impl<'a, C> common::MethodsBuilder for ShippingsettingMethods<'a, C> {}
9966
9967impl<'a, C> ShippingsettingMethods<'a, C> {
9968    /// Create a builder to help you perform the following task:
9969    ///
9970    /// Retrieves and updates the shipping settings of multiple accounts in a single request.
9971    ///
9972    /// # Arguments
9973    ///
9974    /// * `request` - No description provided.
9975    pub fn custombatch(
9976        &self,
9977        request: ShippingsettingsCustomBatchRequest,
9978    ) -> ShippingsettingCustombatchCall<'a, C> {
9979        ShippingsettingCustombatchCall {
9980            hub: self.hub,
9981            _request: request,
9982            _dry_run: Default::default(),
9983            _delegate: Default::default(),
9984            _additional_params: Default::default(),
9985            _scopes: Default::default(),
9986        }
9987    }
9988
9989    /// Create a builder to help you perform the following task:
9990    ///
9991    /// Retrieves the shipping settings of the account.
9992    ///
9993    /// # Arguments
9994    ///
9995    /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
9996    /// * `accountId` - The ID of the account for which to get/update shipping settings.
9997    pub fn get(&self, merchant_id: u64, account_id: u64) -> ShippingsettingGetCall<'a, C> {
9998        ShippingsettingGetCall {
9999            hub: self.hub,
10000            _merchant_id: merchant_id,
10001            _account_id: account_id,
10002            _delegate: Default::default(),
10003            _additional_params: Default::default(),
10004            _scopes: Default::default(),
10005        }
10006    }
10007
10008    /// Create a builder to help you perform the following task:
10009    ///
10010    /// Retrieves supported carriers and carrier services for an account.
10011    ///
10012    /// # Arguments
10013    ///
10014    /// * `merchantId` - The ID of the account for which to retrieve the supported carriers.
10015    pub fn getsupportedcarriers(
10016        &self,
10017        merchant_id: u64,
10018    ) -> ShippingsettingGetsupportedcarrierCall<'a, C> {
10019        ShippingsettingGetsupportedcarrierCall {
10020            hub: self.hub,
10021            _merchant_id: merchant_id,
10022            _delegate: Default::default(),
10023            _additional_params: Default::default(),
10024            _scopes: Default::default(),
10025        }
10026    }
10027
10028    /// Create a builder to help you perform the following task:
10029    ///
10030    /// Retrieves supported holidays for an account.
10031    ///
10032    /// # Arguments
10033    ///
10034    /// * `merchantId` - The ID of the account for which to retrieve the supported holidays.
10035    pub fn getsupportedholidays(
10036        &self,
10037        merchant_id: u64,
10038    ) -> ShippingsettingGetsupportedholidayCall<'a, C> {
10039        ShippingsettingGetsupportedholidayCall {
10040            hub: self.hub,
10041            _merchant_id: merchant_id,
10042            _delegate: Default::default(),
10043            _additional_params: Default::default(),
10044            _scopes: Default::default(),
10045        }
10046    }
10047
10048    /// Create a builder to help you perform the following task:
10049    ///
10050    /// Retrieves supported pickup services for an account.
10051    ///
10052    /// # Arguments
10053    ///
10054    /// * `merchantId` - The ID of the account for which to retrieve the supported pickup services.
10055    pub fn getsupportedpickupservices(
10056        &self,
10057        merchant_id: u64,
10058    ) -> ShippingsettingGetsupportedpickupserviceCall<'a, C> {
10059        ShippingsettingGetsupportedpickupserviceCall {
10060            hub: self.hub,
10061            _merchant_id: merchant_id,
10062            _delegate: Default::default(),
10063            _additional_params: Default::default(),
10064            _scopes: Default::default(),
10065        }
10066    }
10067
10068    /// Create a builder to help you perform the following task:
10069    ///
10070    /// Lists the shipping settings of the sub-accounts in your Merchant Center account.
10071    ///
10072    /// # Arguments
10073    ///
10074    /// * `merchantId` - The ID of the managing account. This must be a multi-client account.
10075    pub fn list(&self, merchant_id: u64) -> ShippingsettingListCall<'a, C> {
10076        ShippingsettingListCall {
10077            hub: self.hub,
10078            _merchant_id: merchant_id,
10079            _page_token: Default::default(),
10080            _max_results: Default::default(),
10081            _delegate: Default::default(),
10082            _additional_params: Default::default(),
10083            _scopes: Default::default(),
10084        }
10085    }
10086
10087    /// Create a builder to help you perform the following task:
10088    ///
10089    /// Updates the shipping settings of the account. Any fields that are not provided are deleted from the resource.
10090    ///
10091    /// # Arguments
10092    ///
10093    /// * `request` - No description provided.
10094    /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
10095    /// * `accountId` - The ID of the account for which to get/update shipping settings.
10096    pub fn update(
10097        &self,
10098        request: ShippingSettings,
10099        merchant_id: u64,
10100        account_id: u64,
10101    ) -> ShippingsettingUpdateCall<'a, C> {
10102        ShippingsettingUpdateCall {
10103            hub: self.hub,
10104            _request: request,
10105            _merchant_id: merchant_id,
10106            _account_id: account_id,
10107            _dry_run: Default::default(),
10108            _delegate: Default::default(),
10109            _additional_params: Default::default(),
10110            _scopes: Default::default(),
10111        }
10112    }
10113}
10114
10115// ###################
10116// CallBuilders   ###
10117// #################
10118
10119/// Returns information about the authenticated user.
10120///
10121/// A builder for the *authinfo* method supported by a *account* resource.
10122/// It is not used directly, but through a [`AccountMethods`] instance.
10123///
10124/// # Example
10125///
10126/// Instantiate a resource method builder
10127///
10128/// ```test_harness,no_run
10129/// # extern crate hyper;
10130/// # extern crate hyper_rustls;
10131/// # extern crate google_content2 as content2;
10132/// # async fn dox() {
10133/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10134///
10135/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10136/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10137/// #     .with_native_roots()
10138/// #     .unwrap()
10139/// #     .https_only()
10140/// #     .enable_http2()
10141/// #     .build();
10142///
10143/// # let executor = hyper_util::rt::TokioExecutor::new();
10144/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10145/// #     secret,
10146/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10147/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10148/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10149/// #     ),
10150/// # ).build().await.unwrap();
10151///
10152/// # let client = hyper_util::client::legacy::Client::builder(
10153/// #     hyper_util::rt::TokioExecutor::new()
10154/// # )
10155/// # .build(
10156/// #     hyper_rustls::HttpsConnectorBuilder::new()
10157/// #         .with_native_roots()
10158/// #         .unwrap()
10159/// #         .https_or_http()
10160/// #         .enable_http2()
10161/// #         .build()
10162/// # );
10163/// # let mut hub = ShoppingContent::new(client, auth);
10164/// // You can configure optional parameters by calling the respective setters at will, and
10165/// // execute the final call using `doit()`.
10166/// // Values shown here are possibly random and not representative !
10167/// let result = hub.accounts().authinfo()
10168///              .doit().await;
10169/// # }
10170/// ```
10171pub struct AccountAuthinfoCall<'a, C>
10172where
10173    C: 'a,
10174{
10175    hub: &'a ShoppingContent<C>,
10176    _delegate: Option<&'a mut dyn common::Delegate>,
10177    _additional_params: HashMap<String, String>,
10178    _scopes: BTreeSet<String>,
10179}
10180
10181impl<'a, C> common::CallBuilder for AccountAuthinfoCall<'a, C> {}
10182
10183impl<'a, C> AccountAuthinfoCall<'a, C>
10184where
10185    C: common::Connector,
10186{
10187    /// Perform the operation you have build so far.
10188    pub async fn doit(mut self) -> common::Result<(common::Response, AccountsAuthInfoResponse)> {
10189        use std::borrow::Cow;
10190        use std::io::{Read, Seek};
10191
10192        use common::{url::Params, ToParts};
10193        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10194
10195        let mut dd = common::DefaultDelegate;
10196        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10197        dlg.begin(common::MethodInfo {
10198            id: "content.accounts.authinfo",
10199            http_method: hyper::Method::GET,
10200        });
10201
10202        for &field in ["alt"].iter() {
10203            if self._additional_params.contains_key(field) {
10204                dlg.finished(false);
10205                return Err(common::Error::FieldClash(field));
10206            }
10207        }
10208
10209        let mut params = Params::with_capacity(2 + self._additional_params.len());
10210
10211        params.extend(self._additional_params.iter());
10212
10213        params.push("alt", "json");
10214        let mut url = self.hub._base_url.clone() + "accounts/authinfo";
10215        if self._scopes.is_empty() {
10216            self._scopes.insert(Scope::Full.as_ref().to_string());
10217        }
10218
10219        let url = params.parse_with_url(&url);
10220
10221        loop {
10222            let token = match self
10223                .hub
10224                .auth
10225                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10226                .await
10227            {
10228                Ok(token) => token,
10229                Err(e) => match dlg.token(e) {
10230                    Ok(token) => token,
10231                    Err(e) => {
10232                        dlg.finished(false);
10233                        return Err(common::Error::MissingToken(e));
10234                    }
10235                },
10236            };
10237            let mut req_result = {
10238                let client = &self.hub.client;
10239                dlg.pre_request();
10240                let mut req_builder = hyper::Request::builder()
10241                    .method(hyper::Method::GET)
10242                    .uri(url.as_str())
10243                    .header(USER_AGENT, self.hub._user_agent.clone());
10244
10245                if let Some(token) = token.as_ref() {
10246                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10247                }
10248
10249                let request = req_builder
10250                    .header(CONTENT_LENGTH, 0_u64)
10251                    .body(common::to_body::<String>(None));
10252
10253                client.request(request.unwrap()).await
10254            };
10255
10256            match req_result {
10257                Err(err) => {
10258                    if let common::Retry::After(d) = dlg.http_error(&err) {
10259                        sleep(d).await;
10260                        continue;
10261                    }
10262                    dlg.finished(false);
10263                    return Err(common::Error::HttpError(err));
10264                }
10265                Ok(res) => {
10266                    let (mut parts, body) = res.into_parts();
10267                    let mut body = common::Body::new(body);
10268                    if !parts.status.is_success() {
10269                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10270                        let error = serde_json::from_str(&common::to_string(&bytes));
10271                        let response = common::to_response(parts, bytes.into());
10272
10273                        if let common::Retry::After(d) =
10274                            dlg.http_failure(&response, error.as_ref().ok())
10275                        {
10276                            sleep(d).await;
10277                            continue;
10278                        }
10279
10280                        dlg.finished(false);
10281
10282                        return Err(match error {
10283                            Ok(value) => common::Error::BadRequest(value),
10284                            _ => common::Error::Failure(response),
10285                        });
10286                    }
10287                    let response = {
10288                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10289                        let encoded = common::to_string(&bytes);
10290                        match serde_json::from_str(&encoded) {
10291                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10292                            Err(error) => {
10293                                dlg.response_json_decode_error(&encoded, &error);
10294                                return Err(common::Error::JsonDecodeError(
10295                                    encoded.to_string(),
10296                                    error,
10297                                ));
10298                            }
10299                        }
10300                    };
10301
10302                    dlg.finished(true);
10303                    return Ok(response);
10304                }
10305            }
10306        }
10307    }
10308
10309    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10310    /// while executing the actual API request.
10311    ///
10312    /// ````text
10313    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10314    /// ````
10315    ///
10316    /// Sets the *delegate* property to the given value.
10317    pub fn delegate(
10318        mut self,
10319        new_value: &'a mut dyn common::Delegate,
10320    ) -> AccountAuthinfoCall<'a, C> {
10321        self._delegate = Some(new_value);
10322        self
10323    }
10324
10325    /// Set any additional parameter of the query string used in the request.
10326    /// It should be used to set parameters which are not yet available through their own
10327    /// setters.
10328    ///
10329    /// Please note that this method must not be used to set any of the known parameters
10330    /// which have their own setter method. If done anyway, the request will fail.
10331    ///
10332    /// # Additional Parameters
10333    ///
10334    /// * *$.xgafv* (query-string) - V1 error format.
10335    /// * *access_token* (query-string) - OAuth access token.
10336    /// * *alt* (query-string) - Data format for response.
10337    /// * *callback* (query-string) - JSONP
10338    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10339    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10340    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10341    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10342    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10343    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10344    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10345    pub fn param<T>(mut self, name: T, value: T) -> AccountAuthinfoCall<'a, C>
10346    where
10347        T: AsRef<str>,
10348    {
10349        self._additional_params
10350            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10351        self
10352    }
10353
10354    /// Identifies the authorization scope for the method you are building.
10355    ///
10356    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10357    /// [`Scope::Full`].
10358    ///
10359    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10360    /// tokens for more than one scope.
10361    ///
10362    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10363    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10364    /// sufficient, a read-write scope will do as well.
10365    pub fn add_scope<St>(mut self, scope: St) -> AccountAuthinfoCall<'a, C>
10366    where
10367        St: AsRef<str>,
10368    {
10369        self._scopes.insert(String::from(scope.as_ref()));
10370        self
10371    }
10372    /// Identifies the authorization scope(s) for the method you are building.
10373    ///
10374    /// See [`Self::add_scope()`] for details.
10375    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountAuthinfoCall<'a, C>
10376    where
10377        I: IntoIterator<Item = St>,
10378        St: AsRef<str>,
10379    {
10380        self._scopes
10381            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10382        self
10383    }
10384
10385    /// Removes all scopes, and no default scope will be used either.
10386    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10387    /// for details).
10388    pub fn clear_scopes(mut self) -> AccountAuthinfoCall<'a, C> {
10389        self._scopes.clear();
10390        self
10391    }
10392}
10393
10394/// Claims the website of a Merchant Center sub-account.
10395///
10396/// A builder for the *claimwebsite* method supported by a *account* resource.
10397/// It is not used directly, but through a [`AccountMethods`] instance.
10398///
10399/// # Example
10400///
10401/// Instantiate a resource method builder
10402///
10403/// ```test_harness,no_run
10404/// # extern crate hyper;
10405/// # extern crate hyper_rustls;
10406/// # extern crate google_content2 as content2;
10407/// # async fn dox() {
10408/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10409///
10410/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10411/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10412/// #     .with_native_roots()
10413/// #     .unwrap()
10414/// #     .https_only()
10415/// #     .enable_http2()
10416/// #     .build();
10417///
10418/// # let executor = hyper_util::rt::TokioExecutor::new();
10419/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10420/// #     secret,
10421/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10422/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10423/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10424/// #     ),
10425/// # ).build().await.unwrap();
10426///
10427/// # let client = hyper_util::client::legacy::Client::builder(
10428/// #     hyper_util::rt::TokioExecutor::new()
10429/// # )
10430/// # .build(
10431/// #     hyper_rustls::HttpsConnectorBuilder::new()
10432/// #         .with_native_roots()
10433/// #         .unwrap()
10434/// #         .https_or_http()
10435/// #         .enable_http2()
10436/// #         .build()
10437/// # );
10438/// # let mut hub = ShoppingContent::new(client, auth);
10439/// // You can configure optional parameters by calling the respective setters at will, and
10440/// // execute the final call using `doit()`.
10441/// // Values shown here are possibly random and not representative !
10442/// let result = hub.accounts().claimwebsite(64, 89)
10443///              .overwrite(true)
10444///              .doit().await;
10445/// # }
10446/// ```
10447pub struct AccountClaimwebsiteCall<'a, C>
10448where
10449    C: 'a,
10450{
10451    hub: &'a ShoppingContent<C>,
10452    _merchant_id: u64,
10453    _account_id: u64,
10454    _overwrite: Option<bool>,
10455    _delegate: Option<&'a mut dyn common::Delegate>,
10456    _additional_params: HashMap<String, String>,
10457    _scopes: BTreeSet<String>,
10458}
10459
10460impl<'a, C> common::CallBuilder for AccountClaimwebsiteCall<'a, C> {}
10461
10462impl<'a, C> AccountClaimwebsiteCall<'a, C>
10463where
10464    C: common::Connector,
10465{
10466    /// Perform the operation you have build so far.
10467    pub async fn doit(
10468        mut self,
10469    ) -> common::Result<(common::Response, AccountsClaimWebsiteResponse)> {
10470        use std::borrow::Cow;
10471        use std::io::{Read, Seek};
10472
10473        use common::{url::Params, ToParts};
10474        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10475
10476        let mut dd = common::DefaultDelegate;
10477        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10478        dlg.begin(common::MethodInfo {
10479            id: "content.accounts.claimwebsite",
10480            http_method: hyper::Method::POST,
10481        });
10482
10483        for &field in ["alt", "merchantId", "accountId", "overwrite"].iter() {
10484            if self._additional_params.contains_key(field) {
10485                dlg.finished(false);
10486                return Err(common::Error::FieldClash(field));
10487            }
10488        }
10489
10490        let mut params = Params::with_capacity(5 + self._additional_params.len());
10491        params.push("merchantId", self._merchant_id.to_string());
10492        params.push("accountId", self._account_id.to_string());
10493        if let Some(value) = self._overwrite.as_ref() {
10494            params.push("overwrite", value.to_string());
10495        }
10496
10497        params.extend(self._additional_params.iter());
10498
10499        params.push("alt", "json");
10500        let mut url = self.hub._base_url.clone() + "{merchantId}/accounts/{accountId}/claimwebsite";
10501        if self._scopes.is_empty() {
10502            self._scopes.insert(Scope::Full.as_ref().to_string());
10503        }
10504
10505        #[allow(clippy::single_element_loop)]
10506        for &(find_this, param_name) in
10507            [("{merchantId}", "merchantId"), ("{accountId}", "accountId")].iter()
10508        {
10509            url = params.uri_replacement(url, param_name, find_this, false);
10510        }
10511        {
10512            let to_remove = ["accountId", "merchantId"];
10513            params.remove_params(&to_remove);
10514        }
10515
10516        let url = params.parse_with_url(&url);
10517
10518        loop {
10519            let token = match self
10520                .hub
10521                .auth
10522                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10523                .await
10524            {
10525                Ok(token) => token,
10526                Err(e) => match dlg.token(e) {
10527                    Ok(token) => token,
10528                    Err(e) => {
10529                        dlg.finished(false);
10530                        return Err(common::Error::MissingToken(e));
10531                    }
10532                },
10533            };
10534            let mut req_result = {
10535                let client = &self.hub.client;
10536                dlg.pre_request();
10537                let mut req_builder = hyper::Request::builder()
10538                    .method(hyper::Method::POST)
10539                    .uri(url.as_str())
10540                    .header(USER_AGENT, self.hub._user_agent.clone());
10541
10542                if let Some(token) = token.as_ref() {
10543                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10544                }
10545
10546                let request = req_builder
10547                    .header(CONTENT_LENGTH, 0_u64)
10548                    .body(common::to_body::<String>(None));
10549
10550                client.request(request.unwrap()).await
10551            };
10552
10553            match req_result {
10554                Err(err) => {
10555                    if let common::Retry::After(d) = dlg.http_error(&err) {
10556                        sleep(d).await;
10557                        continue;
10558                    }
10559                    dlg.finished(false);
10560                    return Err(common::Error::HttpError(err));
10561                }
10562                Ok(res) => {
10563                    let (mut parts, body) = res.into_parts();
10564                    let mut body = common::Body::new(body);
10565                    if !parts.status.is_success() {
10566                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10567                        let error = serde_json::from_str(&common::to_string(&bytes));
10568                        let response = common::to_response(parts, bytes.into());
10569
10570                        if let common::Retry::After(d) =
10571                            dlg.http_failure(&response, error.as_ref().ok())
10572                        {
10573                            sleep(d).await;
10574                            continue;
10575                        }
10576
10577                        dlg.finished(false);
10578
10579                        return Err(match error {
10580                            Ok(value) => common::Error::BadRequest(value),
10581                            _ => common::Error::Failure(response),
10582                        });
10583                    }
10584                    let response = {
10585                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10586                        let encoded = common::to_string(&bytes);
10587                        match serde_json::from_str(&encoded) {
10588                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10589                            Err(error) => {
10590                                dlg.response_json_decode_error(&encoded, &error);
10591                                return Err(common::Error::JsonDecodeError(
10592                                    encoded.to_string(),
10593                                    error,
10594                                ));
10595                            }
10596                        }
10597                    };
10598
10599                    dlg.finished(true);
10600                    return Ok(response);
10601                }
10602            }
10603        }
10604    }
10605
10606    /// The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
10607    ///
10608    /// Sets the *merchant id* path property to the given value.
10609    ///
10610    /// Even though the property as already been set when instantiating this call,
10611    /// we provide this method for API completeness.
10612    pub fn merchant_id(mut self, new_value: u64) -> AccountClaimwebsiteCall<'a, C> {
10613        self._merchant_id = new_value;
10614        self
10615    }
10616    /// The ID of the account whose website is claimed.
10617    ///
10618    /// Sets the *account id* path property to the given value.
10619    ///
10620    /// Even though the property as already been set when instantiating this call,
10621    /// we provide this method for API completeness.
10622    pub fn account_id(mut self, new_value: u64) -> AccountClaimwebsiteCall<'a, C> {
10623        self._account_id = new_value;
10624        self
10625    }
10626    /// Only available to selected merchants. When set to `True`, this flag removes any existing claim on the requested website by another account and replaces it with a claim from this account.
10627    ///
10628    /// Sets the *overwrite* query property to the given value.
10629    pub fn overwrite(mut self, new_value: bool) -> AccountClaimwebsiteCall<'a, C> {
10630        self._overwrite = Some(new_value);
10631        self
10632    }
10633    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10634    /// while executing the actual API request.
10635    ///
10636    /// ````text
10637    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10638    /// ````
10639    ///
10640    /// Sets the *delegate* property to the given value.
10641    pub fn delegate(
10642        mut self,
10643        new_value: &'a mut dyn common::Delegate,
10644    ) -> AccountClaimwebsiteCall<'a, C> {
10645        self._delegate = Some(new_value);
10646        self
10647    }
10648
10649    /// Set any additional parameter of the query string used in the request.
10650    /// It should be used to set parameters which are not yet available through their own
10651    /// setters.
10652    ///
10653    /// Please note that this method must not be used to set any of the known parameters
10654    /// which have their own setter method. If done anyway, the request will fail.
10655    ///
10656    /// # Additional Parameters
10657    ///
10658    /// * *$.xgafv* (query-string) - V1 error format.
10659    /// * *access_token* (query-string) - OAuth access token.
10660    /// * *alt* (query-string) - Data format for response.
10661    /// * *callback* (query-string) - JSONP
10662    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10663    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10664    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10665    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10666    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10667    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10668    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10669    pub fn param<T>(mut self, name: T, value: T) -> AccountClaimwebsiteCall<'a, C>
10670    where
10671        T: AsRef<str>,
10672    {
10673        self._additional_params
10674            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10675        self
10676    }
10677
10678    /// Identifies the authorization scope for the method you are building.
10679    ///
10680    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10681    /// [`Scope::Full`].
10682    ///
10683    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10684    /// tokens for more than one scope.
10685    ///
10686    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10687    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10688    /// sufficient, a read-write scope will do as well.
10689    pub fn add_scope<St>(mut self, scope: St) -> AccountClaimwebsiteCall<'a, C>
10690    where
10691        St: AsRef<str>,
10692    {
10693        self._scopes.insert(String::from(scope.as_ref()));
10694        self
10695    }
10696    /// Identifies the authorization scope(s) for the method you are building.
10697    ///
10698    /// See [`Self::add_scope()`] for details.
10699    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountClaimwebsiteCall<'a, C>
10700    where
10701        I: IntoIterator<Item = St>,
10702        St: AsRef<str>,
10703    {
10704        self._scopes
10705            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10706        self
10707    }
10708
10709    /// Removes all scopes, and no default scope will be used either.
10710    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10711    /// for details).
10712    pub fn clear_scopes(mut self) -> AccountClaimwebsiteCall<'a, C> {
10713        self._scopes.clear();
10714        self
10715    }
10716}
10717
10718/// Retrieves, inserts, updates, and deletes multiple Merchant Center (sub-)accounts in a single request.
10719///
10720/// A builder for the *custombatch* method supported by a *account* resource.
10721/// It is not used directly, but through a [`AccountMethods`] instance.
10722///
10723/// # Example
10724///
10725/// Instantiate a resource method builder
10726///
10727/// ```test_harness,no_run
10728/// # extern crate hyper;
10729/// # extern crate hyper_rustls;
10730/// # extern crate google_content2 as content2;
10731/// use content2::api::AccountsCustomBatchRequest;
10732/// # async fn dox() {
10733/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10734///
10735/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10736/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10737/// #     .with_native_roots()
10738/// #     .unwrap()
10739/// #     .https_only()
10740/// #     .enable_http2()
10741/// #     .build();
10742///
10743/// # let executor = hyper_util::rt::TokioExecutor::new();
10744/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10745/// #     secret,
10746/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10747/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10748/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10749/// #     ),
10750/// # ).build().await.unwrap();
10751///
10752/// # let client = hyper_util::client::legacy::Client::builder(
10753/// #     hyper_util::rt::TokioExecutor::new()
10754/// # )
10755/// # .build(
10756/// #     hyper_rustls::HttpsConnectorBuilder::new()
10757/// #         .with_native_roots()
10758/// #         .unwrap()
10759/// #         .https_or_http()
10760/// #         .enable_http2()
10761/// #         .build()
10762/// # );
10763/// # let mut hub = ShoppingContent::new(client, auth);
10764/// // As the method needs a request, you would usually fill it with the desired information
10765/// // into the respective structure. Some of the parts shown here might not be applicable !
10766/// // Values shown here are possibly random and not representative !
10767/// let mut req = AccountsCustomBatchRequest::default();
10768///
10769/// // You can configure optional parameters by calling the respective setters at will, and
10770/// // execute the final call using `doit()`.
10771/// // Values shown here are possibly random and not representative !
10772/// let result = hub.accounts().custombatch(req)
10773///              .dry_run(true)
10774///              .doit().await;
10775/// # }
10776/// ```
10777pub struct AccountCustombatchCall<'a, C>
10778where
10779    C: 'a,
10780{
10781    hub: &'a ShoppingContent<C>,
10782    _request: AccountsCustomBatchRequest,
10783    _dry_run: Option<bool>,
10784    _delegate: Option<&'a mut dyn common::Delegate>,
10785    _additional_params: HashMap<String, String>,
10786    _scopes: BTreeSet<String>,
10787}
10788
10789impl<'a, C> common::CallBuilder for AccountCustombatchCall<'a, C> {}
10790
10791impl<'a, C> AccountCustombatchCall<'a, C>
10792where
10793    C: common::Connector,
10794{
10795    /// Perform the operation you have build so far.
10796    pub async fn doit(mut self) -> common::Result<(common::Response, AccountsCustomBatchResponse)> {
10797        use std::borrow::Cow;
10798        use std::io::{Read, Seek};
10799
10800        use common::{url::Params, ToParts};
10801        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10802
10803        let mut dd = common::DefaultDelegate;
10804        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10805        dlg.begin(common::MethodInfo {
10806            id: "content.accounts.custombatch",
10807            http_method: hyper::Method::POST,
10808        });
10809
10810        for &field in ["alt", "dryRun"].iter() {
10811            if self._additional_params.contains_key(field) {
10812                dlg.finished(false);
10813                return Err(common::Error::FieldClash(field));
10814            }
10815        }
10816
10817        let mut params = Params::with_capacity(4 + self._additional_params.len());
10818        if let Some(value) = self._dry_run.as_ref() {
10819            params.push("dryRun", value.to_string());
10820        }
10821
10822        params.extend(self._additional_params.iter());
10823
10824        params.push("alt", "json");
10825        let mut url = self.hub._base_url.clone() + "accounts/batch";
10826        if self._scopes.is_empty() {
10827            self._scopes.insert(Scope::Full.as_ref().to_string());
10828        }
10829
10830        let url = params.parse_with_url(&url);
10831
10832        let mut json_mime_type = mime::APPLICATION_JSON;
10833        let mut request_value_reader = {
10834            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10835            common::remove_json_null_values(&mut value);
10836            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10837            serde_json::to_writer(&mut dst, &value).unwrap();
10838            dst
10839        };
10840        let request_size = request_value_reader
10841            .seek(std::io::SeekFrom::End(0))
10842            .unwrap();
10843        request_value_reader
10844            .seek(std::io::SeekFrom::Start(0))
10845            .unwrap();
10846
10847        loop {
10848            let token = match self
10849                .hub
10850                .auth
10851                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10852                .await
10853            {
10854                Ok(token) => token,
10855                Err(e) => match dlg.token(e) {
10856                    Ok(token) => token,
10857                    Err(e) => {
10858                        dlg.finished(false);
10859                        return Err(common::Error::MissingToken(e));
10860                    }
10861                },
10862            };
10863            request_value_reader
10864                .seek(std::io::SeekFrom::Start(0))
10865                .unwrap();
10866            let mut req_result = {
10867                let client = &self.hub.client;
10868                dlg.pre_request();
10869                let mut req_builder = hyper::Request::builder()
10870                    .method(hyper::Method::POST)
10871                    .uri(url.as_str())
10872                    .header(USER_AGENT, self.hub._user_agent.clone());
10873
10874                if let Some(token) = token.as_ref() {
10875                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10876                }
10877
10878                let request = req_builder
10879                    .header(CONTENT_TYPE, json_mime_type.to_string())
10880                    .header(CONTENT_LENGTH, request_size as u64)
10881                    .body(common::to_body(
10882                        request_value_reader.get_ref().clone().into(),
10883                    ));
10884
10885                client.request(request.unwrap()).await
10886            };
10887
10888            match req_result {
10889                Err(err) => {
10890                    if let common::Retry::After(d) = dlg.http_error(&err) {
10891                        sleep(d).await;
10892                        continue;
10893                    }
10894                    dlg.finished(false);
10895                    return Err(common::Error::HttpError(err));
10896                }
10897                Ok(res) => {
10898                    let (mut parts, body) = res.into_parts();
10899                    let mut body = common::Body::new(body);
10900                    if !parts.status.is_success() {
10901                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10902                        let error = serde_json::from_str(&common::to_string(&bytes));
10903                        let response = common::to_response(parts, bytes.into());
10904
10905                        if let common::Retry::After(d) =
10906                            dlg.http_failure(&response, error.as_ref().ok())
10907                        {
10908                            sleep(d).await;
10909                            continue;
10910                        }
10911
10912                        dlg.finished(false);
10913
10914                        return Err(match error {
10915                            Ok(value) => common::Error::BadRequest(value),
10916                            _ => common::Error::Failure(response),
10917                        });
10918                    }
10919                    let response = {
10920                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10921                        let encoded = common::to_string(&bytes);
10922                        match serde_json::from_str(&encoded) {
10923                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10924                            Err(error) => {
10925                                dlg.response_json_decode_error(&encoded, &error);
10926                                return Err(common::Error::JsonDecodeError(
10927                                    encoded.to_string(),
10928                                    error,
10929                                ));
10930                            }
10931                        }
10932                    };
10933
10934                    dlg.finished(true);
10935                    return Ok(response);
10936                }
10937            }
10938        }
10939    }
10940
10941    ///
10942    /// Sets the *request* property to the given value.
10943    ///
10944    /// Even though the property as already been set when instantiating this call,
10945    /// we provide this method for API completeness.
10946    pub fn request(
10947        mut self,
10948        new_value: AccountsCustomBatchRequest,
10949    ) -> AccountCustombatchCall<'a, C> {
10950        self._request = new_value;
10951        self
10952    }
10953    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
10954    ///
10955    /// Sets the *dry run* query property to the given value.
10956    pub fn dry_run(mut self, new_value: bool) -> AccountCustombatchCall<'a, C> {
10957        self._dry_run = Some(new_value);
10958        self
10959    }
10960    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10961    /// while executing the actual API request.
10962    ///
10963    /// ````text
10964    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10965    /// ````
10966    ///
10967    /// Sets the *delegate* property to the given value.
10968    pub fn delegate(
10969        mut self,
10970        new_value: &'a mut dyn common::Delegate,
10971    ) -> AccountCustombatchCall<'a, C> {
10972        self._delegate = Some(new_value);
10973        self
10974    }
10975
10976    /// Set any additional parameter of the query string used in the request.
10977    /// It should be used to set parameters which are not yet available through their own
10978    /// setters.
10979    ///
10980    /// Please note that this method must not be used to set any of the known parameters
10981    /// which have their own setter method. If done anyway, the request will fail.
10982    ///
10983    /// # Additional Parameters
10984    ///
10985    /// * *$.xgafv* (query-string) - V1 error format.
10986    /// * *access_token* (query-string) - OAuth access token.
10987    /// * *alt* (query-string) - Data format for response.
10988    /// * *callback* (query-string) - JSONP
10989    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10990    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10991    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10992    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10993    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10994    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10995    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10996    pub fn param<T>(mut self, name: T, value: T) -> AccountCustombatchCall<'a, C>
10997    where
10998        T: AsRef<str>,
10999    {
11000        self._additional_params
11001            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11002        self
11003    }
11004
11005    /// Identifies the authorization scope for the method you are building.
11006    ///
11007    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11008    /// [`Scope::Full`].
11009    ///
11010    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11011    /// tokens for more than one scope.
11012    ///
11013    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11014    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11015    /// sufficient, a read-write scope will do as well.
11016    pub fn add_scope<St>(mut self, scope: St) -> AccountCustombatchCall<'a, C>
11017    where
11018        St: AsRef<str>,
11019    {
11020        self._scopes.insert(String::from(scope.as_ref()));
11021        self
11022    }
11023    /// Identifies the authorization scope(s) for the method you are building.
11024    ///
11025    /// See [`Self::add_scope()`] for details.
11026    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountCustombatchCall<'a, C>
11027    where
11028        I: IntoIterator<Item = St>,
11029        St: AsRef<str>,
11030    {
11031        self._scopes
11032            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11033        self
11034    }
11035
11036    /// Removes all scopes, and no default scope will be used either.
11037    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11038    /// for details).
11039    pub fn clear_scopes(mut self) -> AccountCustombatchCall<'a, C> {
11040        self._scopes.clear();
11041        self
11042    }
11043}
11044
11045/// Deletes a Merchant Center sub-account.
11046///
11047/// A builder for the *delete* method supported by a *account* resource.
11048/// It is not used directly, but through a [`AccountMethods`] instance.
11049///
11050/// # Example
11051///
11052/// Instantiate a resource method builder
11053///
11054/// ```test_harness,no_run
11055/// # extern crate hyper;
11056/// # extern crate hyper_rustls;
11057/// # extern crate google_content2 as content2;
11058/// # async fn dox() {
11059/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11060///
11061/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11062/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11063/// #     .with_native_roots()
11064/// #     .unwrap()
11065/// #     .https_only()
11066/// #     .enable_http2()
11067/// #     .build();
11068///
11069/// # let executor = hyper_util::rt::TokioExecutor::new();
11070/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11071/// #     secret,
11072/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11073/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11074/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11075/// #     ),
11076/// # ).build().await.unwrap();
11077///
11078/// # let client = hyper_util::client::legacy::Client::builder(
11079/// #     hyper_util::rt::TokioExecutor::new()
11080/// # )
11081/// # .build(
11082/// #     hyper_rustls::HttpsConnectorBuilder::new()
11083/// #         .with_native_roots()
11084/// #         .unwrap()
11085/// #         .https_or_http()
11086/// #         .enable_http2()
11087/// #         .build()
11088/// # );
11089/// # let mut hub = ShoppingContent::new(client, auth);
11090/// // You can configure optional parameters by calling the respective setters at will, and
11091/// // execute the final call using `doit()`.
11092/// // Values shown here are possibly random and not representative !
11093/// let result = hub.accounts().delete(51, 94)
11094///              .force(true)
11095///              .dry_run(false)
11096///              .doit().await;
11097/// # }
11098/// ```
11099pub struct AccountDeleteCall<'a, C>
11100where
11101    C: 'a,
11102{
11103    hub: &'a ShoppingContent<C>,
11104    _merchant_id: u64,
11105    _account_id: u64,
11106    _force: Option<bool>,
11107    _dry_run: Option<bool>,
11108    _delegate: Option<&'a mut dyn common::Delegate>,
11109    _additional_params: HashMap<String, String>,
11110    _scopes: BTreeSet<String>,
11111}
11112
11113impl<'a, C> common::CallBuilder for AccountDeleteCall<'a, C> {}
11114
11115impl<'a, C> AccountDeleteCall<'a, C>
11116where
11117    C: common::Connector,
11118{
11119    /// Perform the operation you have build so far.
11120    pub async fn doit(mut self) -> common::Result<common::Response> {
11121        use std::borrow::Cow;
11122        use std::io::{Read, Seek};
11123
11124        use common::{url::Params, ToParts};
11125        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11126
11127        let mut dd = common::DefaultDelegate;
11128        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11129        dlg.begin(common::MethodInfo {
11130            id: "content.accounts.delete",
11131            http_method: hyper::Method::DELETE,
11132        });
11133
11134        for &field in ["merchantId", "accountId", "force", "dryRun"].iter() {
11135            if self._additional_params.contains_key(field) {
11136                dlg.finished(false);
11137                return Err(common::Error::FieldClash(field));
11138            }
11139        }
11140
11141        let mut params = Params::with_capacity(5 + self._additional_params.len());
11142        params.push("merchantId", self._merchant_id.to_string());
11143        params.push("accountId", self._account_id.to_string());
11144        if let Some(value) = self._force.as_ref() {
11145            params.push("force", value.to_string());
11146        }
11147        if let Some(value) = self._dry_run.as_ref() {
11148            params.push("dryRun", value.to_string());
11149        }
11150
11151        params.extend(self._additional_params.iter());
11152
11153        let mut url = self.hub._base_url.clone() + "{merchantId}/accounts/{accountId}";
11154        if self._scopes.is_empty() {
11155            self._scopes.insert(Scope::Full.as_ref().to_string());
11156        }
11157
11158        #[allow(clippy::single_element_loop)]
11159        for &(find_this, param_name) in
11160            [("{merchantId}", "merchantId"), ("{accountId}", "accountId")].iter()
11161        {
11162            url = params.uri_replacement(url, param_name, find_this, false);
11163        }
11164        {
11165            let to_remove = ["accountId", "merchantId"];
11166            params.remove_params(&to_remove);
11167        }
11168
11169        let url = params.parse_with_url(&url);
11170
11171        loop {
11172            let token = match self
11173                .hub
11174                .auth
11175                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11176                .await
11177            {
11178                Ok(token) => token,
11179                Err(e) => match dlg.token(e) {
11180                    Ok(token) => token,
11181                    Err(e) => {
11182                        dlg.finished(false);
11183                        return Err(common::Error::MissingToken(e));
11184                    }
11185                },
11186            };
11187            let mut req_result = {
11188                let client = &self.hub.client;
11189                dlg.pre_request();
11190                let mut req_builder = hyper::Request::builder()
11191                    .method(hyper::Method::DELETE)
11192                    .uri(url.as_str())
11193                    .header(USER_AGENT, self.hub._user_agent.clone());
11194
11195                if let Some(token) = token.as_ref() {
11196                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11197                }
11198
11199                let request = req_builder
11200                    .header(CONTENT_LENGTH, 0_u64)
11201                    .body(common::to_body::<String>(None));
11202
11203                client.request(request.unwrap()).await
11204            };
11205
11206            match req_result {
11207                Err(err) => {
11208                    if let common::Retry::After(d) = dlg.http_error(&err) {
11209                        sleep(d).await;
11210                        continue;
11211                    }
11212                    dlg.finished(false);
11213                    return Err(common::Error::HttpError(err));
11214                }
11215                Ok(res) => {
11216                    let (mut parts, body) = res.into_parts();
11217                    let mut body = common::Body::new(body);
11218                    if !parts.status.is_success() {
11219                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11220                        let error = serde_json::from_str(&common::to_string(&bytes));
11221                        let response = common::to_response(parts, bytes.into());
11222
11223                        if let common::Retry::After(d) =
11224                            dlg.http_failure(&response, error.as_ref().ok())
11225                        {
11226                            sleep(d).await;
11227                            continue;
11228                        }
11229
11230                        dlg.finished(false);
11231
11232                        return Err(match error {
11233                            Ok(value) => common::Error::BadRequest(value),
11234                            _ => common::Error::Failure(response),
11235                        });
11236                    }
11237                    let response = common::Response::from_parts(parts, body);
11238
11239                    dlg.finished(true);
11240                    return Ok(response);
11241                }
11242            }
11243        }
11244    }
11245
11246    /// The ID of the managing account. This must be a multi-client account, and accountId must be the ID of a sub-account of this account.
11247    ///
11248    /// Sets the *merchant id* path property to the given value.
11249    ///
11250    /// Even though the property as already been set when instantiating this call,
11251    /// we provide this method for API completeness.
11252    pub fn merchant_id(mut self, new_value: u64) -> AccountDeleteCall<'a, C> {
11253        self._merchant_id = new_value;
11254        self
11255    }
11256    /// The ID of the account.
11257    ///
11258    /// Sets the *account id* path property to the given value.
11259    ///
11260    /// Even though the property as already been set when instantiating this call,
11261    /// we provide this method for API completeness.
11262    pub fn account_id(mut self, new_value: u64) -> AccountDeleteCall<'a, C> {
11263        self._account_id = new_value;
11264        self
11265    }
11266    /// Flag to delete sub-accounts with products. The default value is false.
11267    ///
11268    /// Sets the *force* query property to the given value.
11269    pub fn force(mut self, new_value: bool) -> AccountDeleteCall<'a, C> {
11270        self._force = Some(new_value);
11271        self
11272    }
11273    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
11274    ///
11275    /// Sets the *dry run* query property to the given value.
11276    pub fn dry_run(mut self, new_value: bool) -> AccountDeleteCall<'a, C> {
11277        self._dry_run = Some(new_value);
11278        self
11279    }
11280    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11281    /// while executing the actual API request.
11282    ///
11283    /// ````text
11284    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11285    /// ````
11286    ///
11287    /// Sets the *delegate* property to the given value.
11288    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountDeleteCall<'a, C> {
11289        self._delegate = Some(new_value);
11290        self
11291    }
11292
11293    /// Set any additional parameter of the query string used in the request.
11294    /// It should be used to set parameters which are not yet available through their own
11295    /// setters.
11296    ///
11297    /// Please note that this method must not be used to set any of the known parameters
11298    /// which have their own setter method. If done anyway, the request will fail.
11299    ///
11300    /// # Additional Parameters
11301    ///
11302    /// * *$.xgafv* (query-string) - V1 error format.
11303    /// * *access_token* (query-string) - OAuth access token.
11304    /// * *alt* (query-string) - Data format for response.
11305    /// * *callback* (query-string) - JSONP
11306    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11307    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11308    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11309    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11310    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11311    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11312    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11313    pub fn param<T>(mut self, name: T, value: T) -> AccountDeleteCall<'a, C>
11314    where
11315        T: AsRef<str>,
11316    {
11317        self._additional_params
11318            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11319        self
11320    }
11321
11322    /// Identifies the authorization scope for the method you are building.
11323    ///
11324    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11325    /// [`Scope::Full`].
11326    ///
11327    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11328    /// tokens for more than one scope.
11329    ///
11330    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11331    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11332    /// sufficient, a read-write scope will do as well.
11333    pub fn add_scope<St>(mut self, scope: St) -> AccountDeleteCall<'a, C>
11334    where
11335        St: AsRef<str>,
11336    {
11337        self._scopes.insert(String::from(scope.as_ref()));
11338        self
11339    }
11340    /// Identifies the authorization scope(s) for the method you are building.
11341    ///
11342    /// See [`Self::add_scope()`] for details.
11343    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountDeleteCall<'a, C>
11344    where
11345        I: IntoIterator<Item = St>,
11346        St: AsRef<str>,
11347    {
11348        self._scopes
11349            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11350        self
11351    }
11352
11353    /// Removes all scopes, and no default scope will be used either.
11354    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11355    /// for details).
11356    pub fn clear_scopes(mut self) -> AccountDeleteCall<'a, C> {
11357        self._scopes.clear();
11358        self
11359    }
11360}
11361
11362/// Retrieves a Merchant Center account.
11363///
11364/// A builder for the *get* method supported by a *account* resource.
11365/// It is not used directly, but through a [`AccountMethods`] instance.
11366///
11367/// # Example
11368///
11369/// Instantiate a resource method builder
11370///
11371/// ```test_harness,no_run
11372/// # extern crate hyper;
11373/// # extern crate hyper_rustls;
11374/// # extern crate google_content2 as content2;
11375/// # async fn dox() {
11376/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11377///
11378/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11379/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11380/// #     .with_native_roots()
11381/// #     .unwrap()
11382/// #     .https_only()
11383/// #     .enable_http2()
11384/// #     .build();
11385///
11386/// # let executor = hyper_util::rt::TokioExecutor::new();
11387/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11388/// #     secret,
11389/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11390/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11391/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11392/// #     ),
11393/// # ).build().await.unwrap();
11394///
11395/// # let client = hyper_util::client::legacy::Client::builder(
11396/// #     hyper_util::rt::TokioExecutor::new()
11397/// # )
11398/// # .build(
11399/// #     hyper_rustls::HttpsConnectorBuilder::new()
11400/// #         .with_native_roots()
11401/// #         .unwrap()
11402/// #         .https_or_http()
11403/// #         .enable_http2()
11404/// #         .build()
11405/// # );
11406/// # let mut hub = ShoppingContent::new(client, auth);
11407/// // You can configure optional parameters by calling the respective setters at will, and
11408/// // execute the final call using `doit()`.
11409/// // Values shown here are possibly random and not representative !
11410/// let result = hub.accounts().get(45, 76)
11411///              .doit().await;
11412/// # }
11413/// ```
11414pub struct AccountGetCall<'a, C>
11415where
11416    C: 'a,
11417{
11418    hub: &'a ShoppingContent<C>,
11419    _merchant_id: u64,
11420    _account_id: u64,
11421    _delegate: Option<&'a mut dyn common::Delegate>,
11422    _additional_params: HashMap<String, String>,
11423    _scopes: BTreeSet<String>,
11424}
11425
11426impl<'a, C> common::CallBuilder for AccountGetCall<'a, C> {}
11427
11428impl<'a, C> AccountGetCall<'a, C>
11429where
11430    C: common::Connector,
11431{
11432    /// Perform the operation you have build so far.
11433    pub async fn doit(mut self) -> common::Result<(common::Response, Account)> {
11434        use std::borrow::Cow;
11435        use std::io::{Read, Seek};
11436
11437        use common::{url::Params, ToParts};
11438        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11439
11440        let mut dd = common::DefaultDelegate;
11441        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11442        dlg.begin(common::MethodInfo {
11443            id: "content.accounts.get",
11444            http_method: hyper::Method::GET,
11445        });
11446
11447        for &field in ["alt", "merchantId", "accountId"].iter() {
11448            if self._additional_params.contains_key(field) {
11449                dlg.finished(false);
11450                return Err(common::Error::FieldClash(field));
11451            }
11452        }
11453
11454        let mut params = Params::with_capacity(4 + self._additional_params.len());
11455        params.push("merchantId", self._merchant_id.to_string());
11456        params.push("accountId", self._account_id.to_string());
11457
11458        params.extend(self._additional_params.iter());
11459
11460        params.push("alt", "json");
11461        let mut url = self.hub._base_url.clone() + "{merchantId}/accounts/{accountId}";
11462        if self._scopes.is_empty() {
11463            self._scopes.insert(Scope::Full.as_ref().to_string());
11464        }
11465
11466        #[allow(clippy::single_element_loop)]
11467        for &(find_this, param_name) in
11468            [("{merchantId}", "merchantId"), ("{accountId}", "accountId")].iter()
11469        {
11470            url = params.uri_replacement(url, param_name, find_this, false);
11471        }
11472        {
11473            let to_remove = ["accountId", "merchantId"];
11474            params.remove_params(&to_remove);
11475        }
11476
11477        let url = params.parse_with_url(&url);
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            let mut req_result = {
11496                let client = &self.hub.client;
11497                dlg.pre_request();
11498                let mut req_builder = hyper::Request::builder()
11499                    .method(hyper::Method::GET)
11500                    .uri(url.as_str())
11501                    .header(USER_AGENT, self.hub._user_agent.clone());
11502
11503                if let Some(token) = token.as_ref() {
11504                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11505                }
11506
11507                let request = req_builder
11508                    .header(CONTENT_LENGTH, 0_u64)
11509                    .body(common::to_body::<String>(None));
11510
11511                client.request(request.unwrap()).await
11512            };
11513
11514            match req_result {
11515                Err(err) => {
11516                    if let common::Retry::After(d) = dlg.http_error(&err) {
11517                        sleep(d).await;
11518                        continue;
11519                    }
11520                    dlg.finished(false);
11521                    return Err(common::Error::HttpError(err));
11522                }
11523                Ok(res) => {
11524                    let (mut parts, body) = res.into_parts();
11525                    let mut body = common::Body::new(body);
11526                    if !parts.status.is_success() {
11527                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11528                        let error = serde_json::from_str(&common::to_string(&bytes));
11529                        let response = common::to_response(parts, bytes.into());
11530
11531                        if let common::Retry::After(d) =
11532                            dlg.http_failure(&response, error.as_ref().ok())
11533                        {
11534                            sleep(d).await;
11535                            continue;
11536                        }
11537
11538                        dlg.finished(false);
11539
11540                        return Err(match error {
11541                            Ok(value) => common::Error::BadRequest(value),
11542                            _ => common::Error::Failure(response),
11543                        });
11544                    }
11545                    let response = {
11546                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11547                        let encoded = common::to_string(&bytes);
11548                        match serde_json::from_str(&encoded) {
11549                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11550                            Err(error) => {
11551                                dlg.response_json_decode_error(&encoded, &error);
11552                                return Err(common::Error::JsonDecodeError(
11553                                    encoded.to_string(),
11554                                    error,
11555                                ));
11556                            }
11557                        }
11558                    };
11559
11560                    dlg.finished(true);
11561                    return Ok(response);
11562                }
11563            }
11564        }
11565    }
11566
11567    /// The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
11568    ///
11569    /// Sets the *merchant id* path property to the given value.
11570    ///
11571    /// Even though the property as already been set when instantiating this call,
11572    /// we provide this method for API completeness.
11573    pub fn merchant_id(mut self, new_value: u64) -> AccountGetCall<'a, C> {
11574        self._merchant_id = new_value;
11575        self
11576    }
11577    /// The ID of the account.
11578    ///
11579    /// Sets the *account id* path property to the given value.
11580    ///
11581    /// Even though the property as already been set when instantiating this call,
11582    /// we provide this method for API completeness.
11583    pub fn account_id(mut self, new_value: u64) -> AccountGetCall<'a, C> {
11584        self._account_id = new_value;
11585        self
11586    }
11587    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11588    /// while executing the actual API request.
11589    ///
11590    /// ````text
11591    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11592    /// ````
11593    ///
11594    /// Sets the *delegate* property to the given value.
11595    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountGetCall<'a, C> {
11596        self._delegate = Some(new_value);
11597        self
11598    }
11599
11600    /// Set any additional parameter of the query string used in the request.
11601    /// It should be used to set parameters which are not yet available through their own
11602    /// setters.
11603    ///
11604    /// Please note that this method must not be used to set any of the known parameters
11605    /// which have their own setter method. If done anyway, the request will fail.
11606    ///
11607    /// # Additional Parameters
11608    ///
11609    /// * *$.xgafv* (query-string) - V1 error format.
11610    /// * *access_token* (query-string) - OAuth access token.
11611    /// * *alt* (query-string) - Data format for response.
11612    /// * *callback* (query-string) - JSONP
11613    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11614    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11615    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11616    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11617    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11618    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11619    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11620    pub fn param<T>(mut self, name: T, value: T) -> AccountGetCall<'a, C>
11621    where
11622        T: AsRef<str>,
11623    {
11624        self._additional_params
11625            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11626        self
11627    }
11628
11629    /// Identifies the authorization scope for the method you are building.
11630    ///
11631    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11632    /// [`Scope::Full`].
11633    ///
11634    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11635    /// tokens for more than one scope.
11636    ///
11637    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11638    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11639    /// sufficient, a read-write scope will do as well.
11640    pub fn add_scope<St>(mut self, scope: St) -> AccountGetCall<'a, C>
11641    where
11642        St: AsRef<str>,
11643    {
11644        self._scopes.insert(String::from(scope.as_ref()));
11645        self
11646    }
11647    /// Identifies the authorization scope(s) for the method you are building.
11648    ///
11649    /// See [`Self::add_scope()`] for details.
11650    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountGetCall<'a, C>
11651    where
11652        I: IntoIterator<Item = St>,
11653        St: AsRef<str>,
11654    {
11655        self._scopes
11656            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11657        self
11658    }
11659
11660    /// Removes all scopes, and no default scope will be used either.
11661    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11662    /// for details).
11663    pub fn clear_scopes(mut self) -> AccountGetCall<'a, C> {
11664        self._scopes.clear();
11665        self
11666    }
11667}
11668
11669/// Creates a Merchant Center sub-account.
11670///
11671/// A builder for the *insert* method supported by a *account* resource.
11672/// It is not used directly, but through a [`AccountMethods`] instance.
11673///
11674/// # Example
11675///
11676/// Instantiate a resource method builder
11677///
11678/// ```test_harness,no_run
11679/// # extern crate hyper;
11680/// # extern crate hyper_rustls;
11681/// # extern crate google_content2 as content2;
11682/// use content2::api::Account;
11683/// # async fn dox() {
11684/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11685///
11686/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11687/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11688/// #     .with_native_roots()
11689/// #     .unwrap()
11690/// #     .https_only()
11691/// #     .enable_http2()
11692/// #     .build();
11693///
11694/// # let executor = hyper_util::rt::TokioExecutor::new();
11695/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11696/// #     secret,
11697/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11698/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11699/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11700/// #     ),
11701/// # ).build().await.unwrap();
11702///
11703/// # let client = hyper_util::client::legacy::Client::builder(
11704/// #     hyper_util::rt::TokioExecutor::new()
11705/// # )
11706/// # .build(
11707/// #     hyper_rustls::HttpsConnectorBuilder::new()
11708/// #         .with_native_roots()
11709/// #         .unwrap()
11710/// #         .https_or_http()
11711/// #         .enable_http2()
11712/// #         .build()
11713/// # );
11714/// # let mut hub = ShoppingContent::new(client, auth);
11715/// // As the method needs a request, you would usually fill it with the desired information
11716/// // into the respective structure. Some of the parts shown here might not be applicable !
11717/// // Values shown here are possibly random and not representative !
11718/// let mut req = Account::default();
11719///
11720/// // You can configure optional parameters by calling the respective setters at will, and
11721/// // execute the final call using `doit()`.
11722/// // Values shown here are possibly random and not representative !
11723/// let result = hub.accounts().insert(req, 15)
11724///              .dry_run(true)
11725///              .doit().await;
11726/// # }
11727/// ```
11728pub struct AccountInsertCall<'a, C>
11729where
11730    C: 'a,
11731{
11732    hub: &'a ShoppingContent<C>,
11733    _request: Account,
11734    _merchant_id: u64,
11735    _dry_run: Option<bool>,
11736    _delegate: Option<&'a mut dyn common::Delegate>,
11737    _additional_params: HashMap<String, String>,
11738    _scopes: BTreeSet<String>,
11739}
11740
11741impl<'a, C> common::CallBuilder for AccountInsertCall<'a, C> {}
11742
11743impl<'a, C> AccountInsertCall<'a, C>
11744where
11745    C: common::Connector,
11746{
11747    /// Perform the operation you have build so far.
11748    pub async fn doit(mut self) -> common::Result<(common::Response, Account)> {
11749        use std::borrow::Cow;
11750        use std::io::{Read, Seek};
11751
11752        use common::{url::Params, ToParts};
11753        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11754
11755        let mut dd = common::DefaultDelegate;
11756        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11757        dlg.begin(common::MethodInfo {
11758            id: "content.accounts.insert",
11759            http_method: hyper::Method::POST,
11760        });
11761
11762        for &field in ["alt", "merchantId", "dryRun"].iter() {
11763            if self._additional_params.contains_key(field) {
11764                dlg.finished(false);
11765                return Err(common::Error::FieldClash(field));
11766            }
11767        }
11768
11769        let mut params = Params::with_capacity(5 + self._additional_params.len());
11770        params.push("merchantId", self._merchant_id.to_string());
11771        if let Some(value) = self._dry_run.as_ref() {
11772            params.push("dryRun", value.to_string());
11773        }
11774
11775        params.extend(self._additional_params.iter());
11776
11777        params.push("alt", "json");
11778        let mut url = self.hub._base_url.clone() + "{merchantId}/accounts";
11779        if self._scopes.is_empty() {
11780            self._scopes.insert(Scope::Full.as_ref().to_string());
11781        }
11782
11783        #[allow(clippy::single_element_loop)]
11784        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
11785            url = params.uri_replacement(url, param_name, find_this, false);
11786        }
11787        {
11788            let to_remove = ["merchantId"];
11789            params.remove_params(&to_remove);
11790        }
11791
11792        let url = params.parse_with_url(&url);
11793
11794        let mut json_mime_type = mime::APPLICATION_JSON;
11795        let mut request_value_reader = {
11796            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11797            common::remove_json_null_values(&mut value);
11798            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11799            serde_json::to_writer(&mut dst, &value).unwrap();
11800            dst
11801        };
11802        let request_size = request_value_reader
11803            .seek(std::io::SeekFrom::End(0))
11804            .unwrap();
11805        request_value_reader
11806            .seek(std::io::SeekFrom::Start(0))
11807            .unwrap();
11808
11809        loop {
11810            let token = match self
11811                .hub
11812                .auth
11813                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11814                .await
11815            {
11816                Ok(token) => token,
11817                Err(e) => match dlg.token(e) {
11818                    Ok(token) => token,
11819                    Err(e) => {
11820                        dlg.finished(false);
11821                        return Err(common::Error::MissingToken(e));
11822                    }
11823                },
11824            };
11825            request_value_reader
11826                .seek(std::io::SeekFrom::Start(0))
11827                .unwrap();
11828            let mut req_result = {
11829                let client = &self.hub.client;
11830                dlg.pre_request();
11831                let mut req_builder = hyper::Request::builder()
11832                    .method(hyper::Method::POST)
11833                    .uri(url.as_str())
11834                    .header(USER_AGENT, self.hub._user_agent.clone());
11835
11836                if let Some(token) = token.as_ref() {
11837                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11838                }
11839
11840                let request = req_builder
11841                    .header(CONTENT_TYPE, json_mime_type.to_string())
11842                    .header(CONTENT_LENGTH, request_size as u64)
11843                    .body(common::to_body(
11844                        request_value_reader.get_ref().clone().into(),
11845                    ));
11846
11847                client.request(request.unwrap()).await
11848            };
11849
11850            match req_result {
11851                Err(err) => {
11852                    if let common::Retry::After(d) = dlg.http_error(&err) {
11853                        sleep(d).await;
11854                        continue;
11855                    }
11856                    dlg.finished(false);
11857                    return Err(common::Error::HttpError(err));
11858                }
11859                Ok(res) => {
11860                    let (mut parts, body) = res.into_parts();
11861                    let mut body = common::Body::new(body);
11862                    if !parts.status.is_success() {
11863                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11864                        let error = serde_json::from_str(&common::to_string(&bytes));
11865                        let response = common::to_response(parts, bytes.into());
11866
11867                        if let common::Retry::After(d) =
11868                            dlg.http_failure(&response, error.as_ref().ok())
11869                        {
11870                            sleep(d).await;
11871                            continue;
11872                        }
11873
11874                        dlg.finished(false);
11875
11876                        return Err(match error {
11877                            Ok(value) => common::Error::BadRequest(value),
11878                            _ => common::Error::Failure(response),
11879                        });
11880                    }
11881                    let response = {
11882                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11883                        let encoded = common::to_string(&bytes);
11884                        match serde_json::from_str(&encoded) {
11885                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11886                            Err(error) => {
11887                                dlg.response_json_decode_error(&encoded, &error);
11888                                return Err(common::Error::JsonDecodeError(
11889                                    encoded.to_string(),
11890                                    error,
11891                                ));
11892                            }
11893                        }
11894                    };
11895
11896                    dlg.finished(true);
11897                    return Ok(response);
11898                }
11899            }
11900        }
11901    }
11902
11903    ///
11904    /// Sets the *request* property to the given value.
11905    ///
11906    /// Even though the property as already been set when instantiating this call,
11907    /// we provide this method for API completeness.
11908    pub fn request(mut self, new_value: Account) -> AccountInsertCall<'a, C> {
11909        self._request = new_value;
11910        self
11911    }
11912    /// The ID of the managing account. This must be a multi-client account.
11913    ///
11914    /// Sets the *merchant id* path property to the given value.
11915    ///
11916    /// Even though the property as already been set when instantiating this call,
11917    /// we provide this method for API completeness.
11918    pub fn merchant_id(mut self, new_value: u64) -> AccountInsertCall<'a, C> {
11919        self._merchant_id = new_value;
11920        self
11921    }
11922    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
11923    ///
11924    /// Sets the *dry run* query property to the given value.
11925    pub fn dry_run(mut self, new_value: bool) -> AccountInsertCall<'a, C> {
11926        self._dry_run = Some(new_value);
11927        self
11928    }
11929    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11930    /// while executing the actual API request.
11931    ///
11932    /// ````text
11933    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11934    /// ````
11935    ///
11936    /// Sets the *delegate* property to the given value.
11937    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountInsertCall<'a, C> {
11938        self._delegate = Some(new_value);
11939        self
11940    }
11941
11942    /// Set any additional parameter of the query string used in the request.
11943    /// It should be used to set parameters which are not yet available through their own
11944    /// setters.
11945    ///
11946    /// Please note that this method must not be used to set any of the known parameters
11947    /// which have their own setter method. If done anyway, the request will fail.
11948    ///
11949    /// # Additional Parameters
11950    ///
11951    /// * *$.xgafv* (query-string) - V1 error format.
11952    /// * *access_token* (query-string) - OAuth access token.
11953    /// * *alt* (query-string) - Data format for response.
11954    /// * *callback* (query-string) - JSONP
11955    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11956    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11957    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11958    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11959    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11960    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11961    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11962    pub fn param<T>(mut self, name: T, value: T) -> AccountInsertCall<'a, C>
11963    where
11964        T: AsRef<str>,
11965    {
11966        self._additional_params
11967            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11968        self
11969    }
11970
11971    /// Identifies the authorization scope for the method you are building.
11972    ///
11973    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11974    /// [`Scope::Full`].
11975    ///
11976    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11977    /// tokens for more than one scope.
11978    ///
11979    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11980    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11981    /// sufficient, a read-write scope will do as well.
11982    pub fn add_scope<St>(mut self, scope: St) -> AccountInsertCall<'a, C>
11983    where
11984        St: AsRef<str>,
11985    {
11986        self._scopes.insert(String::from(scope.as_ref()));
11987        self
11988    }
11989    /// Identifies the authorization scope(s) for the method you are building.
11990    ///
11991    /// See [`Self::add_scope()`] for details.
11992    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountInsertCall<'a, C>
11993    where
11994        I: IntoIterator<Item = St>,
11995        St: AsRef<str>,
11996    {
11997        self._scopes
11998            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11999        self
12000    }
12001
12002    /// Removes all scopes, and no default scope will be used either.
12003    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12004    /// for details).
12005    pub fn clear_scopes(mut self) -> AccountInsertCall<'a, C> {
12006        self._scopes.clear();
12007        self
12008    }
12009}
12010
12011/// Performs an action on a link between two Merchant Center accounts, namely accountId and linkedAccountId.
12012///
12013/// A builder for the *link* method supported by a *account* resource.
12014/// It is not used directly, but through a [`AccountMethods`] instance.
12015///
12016/// # Example
12017///
12018/// Instantiate a resource method builder
12019///
12020/// ```test_harness,no_run
12021/// # extern crate hyper;
12022/// # extern crate hyper_rustls;
12023/// # extern crate google_content2 as content2;
12024/// use content2::api::AccountsLinkRequest;
12025/// # async fn dox() {
12026/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12027///
12028/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12029/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12030/// #     .with_native_roots()
12031/// #     .unwrap()
12032/// #     .https_only()
12033/// #     .enable_http2()
12034/// #     .build();
12035///
12036/// # let executor = hyper_util::rt::TokioExecutor::new();
12037/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12038/// #     secret,
12039/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12040/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12041/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12042/// #     ),
12043/// # ).build().await.unwrap();
12044///
12045/// # let client = hyper_util::client::legacy::Client::builder(
12046/// #     hyper_util::rt::TokioExecutor::new()
12047/// # )
12048/// # .build(
12049/// #     hyper_rustls::HttpsConnectorBuilder::new()
12050/// #         .with_native_roots()
12051/// #         .unwrap()
12052/// #         .https_or_http()
12053/// #         .enable_http2()
12054/// #         .build()
12055/// # );
12056/// # let mut hub = ShoppingContent::new(client, auth);
12057/// // As the method needs a request, you would usually fill it with the desired information
12058/// // into the respective structure. Some of the parts shown here might not be applicable !
12059/// // Values shown here are possibly random and not representative !
12060/// let mut req = AccountsLinkRequest::default();
12061///
12062/// // You can configure optional parameters by calling the respective setters at will, and
12063/// // execute the final call using `doit()`.
12064/// // Values shown here are possibly random and not representative !
12065/// let result = hub.accounts().link(req, 31, 21)
12066///              .doit().await;
12067/// # }
12068/// ```
12069pub struct AccountLinkCall<'a, C>
12070where
12071    C: 'a,
12072{
12073    hub: &'a ShoppingContent<C>,
12074    _request: AccountsLinkRequest,
12075    _merchant_id: u64,
12076    _account_id: u64,
12077    _delegate: Option<&'a mut dyn common::Delegate>,
12078    _additional_params: HashMap<String, String>,
12079    _scopes: BTreeSet<String>,
12080}
12081
12082impl<'a, C> common::CallBuilder for AccountLinkCall<'a, C> {}
12083
12084impl<'a, C> AccountLinkCall<'a, C>
12085where
12086    C: common::Connector,
12087{
12088    /// Perform the operation you have build so far.
12089    pub async fn doit(mut self) -> common::Result<(common::Response, AccountsLinkResponse)> {
12090        use std::borrow::Cow;
12091        use std::io::{Read, Seek};
12092
12093        use common::{url::Params, ToParts};
12094        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12095
12096        let mut dd = common::DefaultDelegate;
12097        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12098        dlg.begin(common::MethodInfo {
12099            id: "content.accounts.link",
12100            http_method: hyper::Method::POST,
12101        });
12102
12103        for &field in ["alt", "merchantId", "accountId"].iter() {
12104            if self._additional_params.contains_key(field) {
12105                dlg.finished(false);
12106                return Err(common::Error::FieldClash(field));
12107            }
12108        }
12109
12110        let mut params = Params::with_capacity(5 + self._additional_params.len());
12111        params.push("merchantId", self._merchant_id.to_string());
12112        params.push("accountId", self._account_id.to_string());
12113
12114        params.extend(self._additional_params.iter());
12115
12116        params.push("alt", "json");
12117        let mut url = self.hub._base_url.clone() + "{merchantId}/accounts/{accountId}/link";
12118        if self._scopes.is_empty() {
12119            self._scopes.insert(Scope::Full.as_ref().to_string());
12120        }
12121
12122        #[allow(clippy::single_element_loop)]
12123        for &(find_this, param_name) in
12124            [("{merchantId}", "merchantId"), ("{accountId}", "accountId")].iter()
12125        {
12126            url = params.uri_replacement(url, param_name, find_this, false);
12127        }
12128        {
12129            let to_remove = ["accountId", "merchantId"];
12130            params.remove_params(&to_remove);
12131        }
12132
12133        let url = params.parse_with_url(&url);
12134
12135        let mut json_mime_type = mime::APPLICATION_JSON;
12136        let mut request_value_reader = {
12137            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12138            common::remove_json_null_values(&mut value);
12139            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12140            serde_json::to_writer(&mut dst, &value).unwrap();
12141            dst
12142        };
12143        let request_size = request_value_reader
12144            .seek(std::io::SeekFrom::End(0))
12145            .unwrap();
12146        request_value_reader
12147            .seek(std::io::SeekFrom::Start(0))
12148            .unwrap();
12149
12150        loop {
12151            let token = match self
12152                .hub
12153                .auth
12154                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12155                .await
12156            {
12157                Ok(token) => token,
12158                Err(e) => match dlg.token(e) {
12159                    Ok(token) => token,
12160                    Err(e) => {
12161                        dlg.finished(false);
12162                        return Err(common::Error::MissingToken(e));
12163                    }
12164                },
12165            };
12166            request_value_reader
12167                .seek(std::io::SeekFrom::Start(0))
12168                .unwrap();
12169            let mut req_result = {
12170                let client = &self.hub.client;
12171                dlg.pre_request();
12172                let mut req_builder = hyper::Request::builder()
12173                    .method(hyper::Method::POST)
12174                    .uri(url.as_str())
12175                    .header(USER_AGENT, self.hub._user_agent.clone());
12176
12177                if let Some(token) = token.as_ref() {
12178                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12179                }
12180
12181                let request = req_builder
12182                    .header(CONTENT_TYPE, json_mime_type.to_string())
12183                    .header(CONTENT_LENGTH, request_size as u64)
12184                    .body(common::to_body(
12185                        request_value_reader.get_ref().clone().into(),
12186                    ));
12187
12188                client.request(request.unwrap()).await
12189            };
12190
12191            match req_result {
12192                Err(err) => {
12193                    if let common::Retry::After(d) = dlg.http_error(&err) {
12194                        sleep(d).await;
12195                        continue;
12196                    }
12197                    dlg.finished(false);
12198                    return Err(common::Error::HttpError(err));
12199                }
12200                Ok(res) => {
12201                    let (mut parts, body) = res.into_parts();
12202                    let mut body = common::Body::new(body);
12203                    if !parts.status.is_success() {
12204                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12205                        let error = serde_json::from_str(&common::to_string(&bytes));
12206                        let response = common::to_response(parts, bytes.into());
12207
12208                        if let common::Retry::After(d) =
12209                            dlg.http_failure(&response, error.as_ref().ok())
12210                        {
12211                            sleep(d).await;
12212                            continue;
12213                        }
12214
12215                        dlg.finished(false);
12216
12217                        return Err(match error {
12218                            Ok(value) => common::Error::BadRequest(value),
12219                            _ => common::Error::Failure(response),
12220                        });
12221                    }
12222                    let response = {
12223                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12224                        let encoded = common::to_string(&bytes);
12225                        match serde_json::from_str(&encoded) {
12226                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12227                            Err(error) => {
12228                                dlg.response_json_decode_error(&encoded, &error);
12229                                return Err(common::Error::JsonDecodeError(
12230                                    encoded.to_string(),
12231                                    error,
12232                                ));
12233                            }
12234                        }
12235                    };
12236
12237                    dlg.finished(true);
12238                    return Ok(response);
12239                }
12240            }
12241        }
12242    }
12243
12244    ///
12245    /// Sets the *request* property to the given value.
12246    ///
12247    /// Even though the property as already been set when instantiating this call,
12248    /// we provide this method for API completeness.
12249    pub fn request(mut self, new_value: AccountsLinkRequest) -> AccountLinkCall<'a, C> {
12250        self._request = new_value;
12251        self
12252    }
12253    /// The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
12254    ///
12255    /// Sets the *merchant id* path property to the given value.
12256    ///
12257    /// Even though the property as already been set when instantiating this call,
12258    /// we provide this method for API completeness.
12259    pub fn merchant_id(mut self, new_value: u64) -> AccountLinkCall<'a, C> {
12260        self._merchant_id = new_value;
12261        self
12262    }
12263    /// The ID of the account that should be linked.
12264    ///
12265    /// Sets the *account id* path property to the given value.
12266    ///
12267    /// Even though the property as already been set when instantiating this call,
12268    /// we provide this method for API completeness.
12269    pub fn account_id(mut self, new_value: u64) -> AccountLinkCall<'a, C> {
12270        self._account_id = new_value;
12271        self
12272    }
12273    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12274    /// while executing the actual API request.
12275    ///
12276    /// ````text
12277    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12278    /// ````
12279    ///
12280    /// Sets the *delegate* property to the given value.
12281    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountLinkCall<'a, C> {
12282        self._delegate = Some(new_value);
12283        self
12284    }
12285
12286    /// Set any additional parameter of the query string used in the request.
12287    /// It should be used to set parameters which are not yet available through their own
12288    /// setters.
12289    ///
12290    /// Please note that this method must not be used to set any of the known parameters
12291    /// which have their own setter method. If done anyway, the request will fail.
12292    ///
12293    /// # Additional Parameters
12294    ///
12295    /// * *$.xgafv* (query-string) - V1 error format.
12296    /// * *access_token* (query-string) - OAuth access token.
12297    /// * *alt* (query-string) - Data format for response.
12298    /// * *callback* (query-string) - JSONP
12299    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12300    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12301    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12302    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12303    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12304    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12305    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12306    pub fn param<T>(mut self, name: T, value: T) -> AccountLinkCall<'a, C>
12307    where
12308        T: AsRef<str>,
12309    {
12310        self._additional_params
12311            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12312        self
12313    }
12314
12315    /// Identifies the authorization scope for the method you are building.
12316    ///
12317    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12318    /// [`Scope::Full`].
12319    ///
12320    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12321    /// tokens for more than one scope.
12322    ///
12323    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12324    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12325    /// sufficient, a read-write scope will do as well.
12326    pub fn add_scope<St>(mut self, scope: St) -> AccountLinkCall<'a, C>
12327    where
12328        St: AsRef<str>,
12329    {
12330        self._scopes.insert(String::from(scope.as_ref()));
12331        self
12332    }
12333    /// Identifies the authorization scope(s) for the method you are building.
12334    ///
12335    /// See [`Self::add_scope()`] for details.
12336    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountLinkCall<'a, C>
12337    where
12338        I: IntoIterator<Item = St>,
12339        St: AsRef<str>,
12340    {
12341        self._scopes
12342            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12343        self
12344    }
12345
12346    /// Removes all scopes, and no default scope will be used either.
12347    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12348    /// for details).
12349    pub fn clear_scopes(mut self) -> AccountLinkCall<'a, C> {
12350        self._scopes.clear();
12351        self
12352    }
12353}
12354
12355/// Lists the sub-accounts in your Merchant Center account.
12356///
12357/// A builder for the *list* method supported by a *account* resource.
12358/// It is not used directly, but through a [`AccountMethods`] instance.
12359///
12360/// # Example
12361///
12362/// Instantiate a resource method builder
12363///
12364/// ```test_harness,no_run
12365/// # extern crate hyper;
12366/// # extern crate hyper_rustls;
12367/// # extern crate google_content2 as content2;
12368/// # async fn dox() {
12369/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12370///
12371/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12372/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12373/// #     .with_native_roots()
12374/// #     .unwrap()
12375/// #     .https_only()
12376/// #     .enable_http2()
12377/// #     .build();
12378///
12379/// # let executor = hyper_util::rt::TokioExecutor::new();
12380/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12381/// #     secret,
12382/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12383/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12384/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12385/// #     ),
12386/// # ).build().await.unwrap();
12387///
12388/// # let client = hyper_util::client::legacy::Client::builder(
12389/// #     hyper_util::rt::TokioExecutor::new()
12390/// # )
12391/// # .build(
12392/// #     hyper_rustls::HttpsConnectorBuilder::new()
12393/// #         .with_native_roots()
12394/// #         .unwrap()
12395/// #         .https_or_http()
12396/// #         .enable_http2()
12397/// #         .build()
12398/// # );
12399/// # let mut hub = ShoppingContent::new(client, auth);
12400/// // You can configure optional parameters by calling the respective setters at will, and
12401/// // execute the final call using `doit()`.
12402/// // Values shown here are possibly random and not representative !
12403/// let result = hub.accounts().list(40)
12404///              .page_token("Stet")
12405///              .max_results(88)
12406///              .doit().await;
12407/// # }
12408/// ```
12409pub struct AccountListCall<'a, C>
12410where
12411    C: 'a,
12412{
12413    hub: &'a ShoppingContent<C>,
12414    _merchant_id: u64,
12415    _page_token: Option<String>,
12416    _max_results: Option<u32>,
12417    _delegate: Option<&'a mut dyn common::Delegate>,
12418    _additional_params: HashMap<String, String>,
12419    _scopes: BTreeSet<String>,
12420}
12421
12422impl<'a, C> common::CallBuilder for AccountListCall<'a, C> {}
12423
12424impl<'a, C> AccountListCall<'a, C>
12425where
12426    C: common::Connector,
12427{
12428    /// Perform the operation you have build so far.
12429    pub async fn doit(mut self) -> common::Result<(common::Response, AccountsListResponse)> {
12430        use std::borrow::Cow;
12431        use std::io::{Read, Seek};
12432
12433        use common::{url::Params, ToParts};
12434        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12435
12436        let mut dd = common::DefaultDelegate;
12437        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12438        dlg.begin(common::MethodInfo {
12439            id: "content.accounts.list",
12440            http_method: hyper::Method::GET,
12441        });
12442
12443        for &field in ["alt", "merchantId", "pageToken", "maxResults"].iter() {
12444            if self._additional_params.contains_key(field) {
12445                dlg.finished(false);
12446                return Err(common::Error::FieldClash(field));
12447            }
12448        }
12449
12450        let mut params = Params::with_capacity(5 + self._additional_params.len());
12451        params.push("merchantId", self._merchant_id.to_string());
12452        if let Some(value) = self._page_token.as_ref() {
12453            params.push("pageToken", value);
12454        }
12455        if let Some(value) = self._max_results.as_ref() {
12456            params.push("maxResults", value.to_string());
12457        }
12458
12459        params.extend(self._additional_params.iter());
12460
12461        params.push("alt", "json");
12462        let mut url = self.hub._base_url.clone() + "{merchantId}/accounts";
12463        if self._scopes.is_empty() {
12464            self._scopes.insert(Scope::Full.as_ref().to_string());
12465        }
12466
12467        #[allow(clippy::single_element_loop)]
12468        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
12469            url = params.uri_replacement(url, param_name, find_this, false);
12470        }
12471        {
12472            let to_remove = ["merchantId"];
12473            params.remove_params(&to_remove);
12474        }
12475
12476        let url = params.parse_with_url(&url);
12477
12478        loop {
12479            let token = match self
12480                .hub
12481                .auth
12482                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12483                .await
12484            {
12485                Ok(token) => token,
12486                Err(e) => match dlg.token(e) {
12487                    Ok(token) => token,
12488                    Err(e) => {
12489                        dlg.finished(false);
12490                        return Err(common::Error::MissingToken(e));
12491                    }
12492                },
12493            };
12494            let mut req_result = {
12495                let client = &self.hub.client;
12496                dlg.pre_request();
12497                let mut req_builder = hyper::Request::builder()
12498                    .method(hyper::Method::GET)
12499                    .uri(url.as_str())
12500                    .header(USER_AGENT, self.hub._user_agent.clone());
12501
12502                if let Some(token) = token.as_ref() {
12503                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12504                }
12505
12506                let request = req_builder
12507                    .header(CONTENT_LENGTH, 0_u64)
12508                    .body(common::to_body::<String>(None));
12509
12510                client.request(request.unwrap()).await
12511            };
12512
12513            match req_result {
12514                Err(err) => {
12515                    if let common::Retry::After(d) = dlg.http_error(&err) {
12516                        sleep(d).await;
12517                        continue;
12518                    }
12519                    dlg.finished(false);
12520                    return Err(common::Error::HttpError(err));
12521                }
12522                Ok(res) => {
12523                    let (mut parts, body) = res.into_parts();
12524                    let mut body = common::Body::new(body);
12525                    if !parts.status.is_success() {
12526                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12527                        let error = serde_json::from_str(&common::to_string(&bytes));
12528                        let response = common::to_response(parts, bytes.into());
12529
12530                        if let common::Retry::After(d) =
12531                            dlg.http_failure(&response, error.as_ref().ok())
12532                        {
12533                            sleep(d).await;
12534                            continue;
12535                        }
12536
12537                        dlg.finished(false);
12538
12539                        return Err(match error {
12540                            Ok(value) => common::Error::BadRequest(value),
12541                            _ => common::Error::Failure(response),
12542                        });
12543                    }
12544                    let response = {
12545                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12546                        let encoded = common::to_string(&bytes);
12547                        match serde_json::from_str(&encoded) {
12548                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12549                            Err(error) => {
12550                                dlg.response_json_decode_error(&encoded, &error);
12551                                return Err(common::Error::JsonDecodeError(
12552                                    encoded.to_string(),
12553                                    error,
12554                                ));
12555                            }
12556                        }
12557                    };
12558
12559                    dlg.finished(true);
12560                    return Ok(response);
12561                }
12562            }
12563        }
12564    }
12565
12566    /// The ID of the managing account. This must be a multi-client account.
12567    ///
12568    /// Sets the *merchant id* path property to the given value.
12569    ///
12570    /// Even though the property as already been set when instantiating this call,
12571    /// we provide this method for API completeness.
12572    pub fn merchant_id(mut self, new_value: u64) -> AccountListCall<'a, C> {
12573        self._merchant_id = new_value;
12574        self
12575    }
12576    /// The token returned by the previous request.
12577    ///
12578    /// Sets the *page token* query property to the given value.
12579    pub fn page_token(mut self, new_value: &str) -> AccountListCall<'a, C> {
12580        self._page_token = Some(new_value.to_string());
12581        self
12582    }
12583    /// The maximum number of accounts to return in the response, used for paging.
12584    ///
12585    /// Sets the *max results* query property to the given value.
12586    pub fn max_results(mut self, new_value: u32) -> AccountListCall<'a, C> {
12587        self._max_results = Some(new_value);
12588        self
12589    }
12590    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12591    /// while executing the actual API request.
12592    ///
12593    /// ````text
12594    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12595    /// ````
12596    ///
12597    /// Sets the *delegate* property to the given value.
12598    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountListCall<'a, C> {
12599        self._delegate = Some(new_value);
12600        self
12601    }
12602
12603    /// Set any additional parameter of the query string used in the request.
12604    /// It should be used to set parameters which are not yet available through their own
12605    /// setters.
12606    ///
12607    /// Please note that this method must not be used to set any of the known parameters
12608    /// which have their own setter method. If done anyway, the request will fail.
12609    ///
12610    /// # Additional Parameters
12611    ///
12612    /// * *$.xgafv* (query-string) - V1 error format.
12613    /// * *access_token* (query-string) - OAuth access token.
12614    /// * *alt* (query-string) - Data format for response.
12615    /// * *callback* (query-string) - JSONP
12616    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12617    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12618    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12619    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12620    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12621    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12622    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12623    pub fn param<T>(mut self, name: T, value: T) -> AccountListCall<'a, C>
12624    where
12625        T: AsRef<str>,
12626    {
12627        self._additional_params
12628            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12629        self
12630    }
12631
12632    /// Identifies the authorization scope for the method you are building.
12633    ///
12634    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12635    /// [`Scope::Full`].
12636    ///
12637    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12638    /// tokens for more than one scope.
12639    ///
12640    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12641    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12642    /// sufficient, a read-write scope will do as well.
12643    pub fn add_scope<St>(mut self, scope: St) -> AccountListCall<'a, C>
12644    where
12645        St: AsRef<str>,
12646    {
12647        self._scopes.insert(String::from(scope.as_ref()));
12648        self
12649    }
12650    /// Identifies the authorization scope(s) for the method you are building.
12651    ///
12652    /// See [`Self::add_scope()`] for details.
12653    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountListCall<'a, C>
12654    where
12655        I: IntoIterator<Item = St>,
12656        St: AsRef<str>,
12657    {
12658        self._scopes
12659            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12660        self
12661    }
12662
12663    /// Removes all scopes, and no default scope will be used either.
12664    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12665    /// for details).
12666    pub fn clear_scopes(mut self) -> AccountListCall<'a, C> {
12667        self._scopes.clear();
12668        self
12669    }
12670}
12671
12672/// Updates a Merchant Center account. Any fields that are not provided are deleted from the resource.
12673///
12674/// A builder for the *update* method supported by a *account* resource.
12675/// It is not used directly, but through a [`AccountMethods`] instance.
12676///
12677/// # Example
12678///
12679/// Instantiate a resource method builder
12680///
12681/// ```test_harness,no_run
12682/// # extern crate hyper;
12683/// # extern crate hyper_rustls;
12684/// # extern crate google_content2 as content2;
12685/// use content2::api::Account;
12686/// # async fn dox() {
12687/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12688///
12689/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12690/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12691/// #     .with_native_roots()
12692/// #     .unwrap()
12693/// #     .https_only()
12694/// #     .enable_http2()
12695/// #     .build();
12696///
12697/// # let executor = hyper_util::rt::TokioExecutor::new();
12698/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12699/// #     secret,
12700/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12701/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12702/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12703/// #     ),
12704/// # ).build().await.unwrap();
12705///
12706/// # let client = hyper_util::client::legacy::Client::builder(
12707/// #     hyper_util::rt::TokioExecutor::new()
12708/// # )
12709/// # .build(
12710/// #     hyper_rustls::HttpsConnectorBuilder::new()
12711/// #         .with_native_roots()
12712/// #         .unwrap()
12713/// #         .https_or_http()
12714/// #         .enable_http2()
12715/// #         .build()
12716/// # );
12717/// # let mut hub = ShoppingContent::new(client, auth);
12718/// // As the method needs a request, you would usually fill it with the desired information
12719/// // into the respective structure. Some of the parts shown here might not be applicable !
12720/// // Values shown here are possibly random and not representative !
12721/// let mut req = Account::default();
12722///
12723/// // You can configure optional parameters by calling the respective setters at will, and
12724/// // execute the final call using `doit()`.
12725/// // Values shown here are possibly random and not representative !
12726/// let result = hub.accounts().update(req, 77, 58)
12727///              .dry_run(true)
12728///              .doit().await;
12729/// # }
12730/// ```
12731pub struct AccountUpdateCall<'a, C>
12732where
12733    C: 'a,
12734{
12735    hub: &'a ShoppingContent<C>,
12736    _request: Account,
12737    _merchant_id: u64,
12738    _account_id: u64,
12739    _dry_run: Option<bool>,
12740    _delegate: Option<&'a mut dyn common::Delegate>,
12741    _additional_params: HashMap<String, String>,
12742    _scopes: BTreeSet<String>,
12743}
12744
12745impl<'a, C> common::CallBuilder for AccountUpdateCall<'a, C> {}
12746
12747impl<'a, C> AccountUpdateCall<'a, C>
12748where
12749    C: common::Connector,
12750{
12751    /// Perform the operation you have build so far.
12752    pub async fn doit(mut self) -> common::Result<(common::Response, Account)> {
12753        use std::borrow::Cow;
12754        use std::io::{Read, Seek};
12755
12756        use common::{url::Params, ToParts};
12757        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12758
12759        let mut dd = common::DefaultDelegate;
12760        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12761        dlg.begin(common::MethodInfo {
12762            id: "content.accounts.update",
12763            http_method: hyper::Method::PUT,
12764        });
12765
12766        for &field in ["alt", "merchantId", "accountId", "dryRun"].iter() {
12767            if self._additional_params.contains_key(field) {
12768                dlg.finished(false);
12769                return Err(common::Error::FieldClash(field));
12770            }
12771        }
12772
12773        let mut params = Params::with_capacity(6 + self._additional_params.len());
12774        params.push("merchantId", self._merchant_id.to_string());
12775        params.push("accountId", self._account_id.to_string());
12776        if let Some(value) = self._dry_run.as_ref() {
12777            params.push("dryRun", value.to_string());
12778        }
12779
12780        params.extend(self._additional_params.iter());
12781
12782        params.push("alt", "json");
12783        let mut url = self.hub._base_url.clone() + "{merchantId}/accounts/{accountId}";
12784        if self._scopes.is_empty() {
12785            self._scopes.insert(Scope::Full.as_ref().to_string());
12786        }
12787
12788        #[allow(clippy::single_element_loop)]
12789        for &(find_this, param_name) in
12790            [("{merchantId}", "merchantId"), ("{accountId}", "accountId")].iter()
12791        {
12792            url = params.uri_replacement(url, param_name, find_this, false);
12793        }
12794        {
12795            let to_remove = ["accountId", "merchantId"];
12796            params.remove_params(&to_remove);
12797        }
12798
12799        let url = params.parse_with_url(&url);
12800
12801        let mut json_mime_type = mime::APPLICATION_JSON;
12802        let mut request_value_reader = {
12803            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12804            common::remove_json_null_values(&mut value);
12805            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12806            serde_json::to_writer(&mut dst, &value).unwrap();
12807            dst
12808        };
12809        let request_size = request_value_reader
12810            .seek(std::io::SeekFrom::End(0))
12811            .unwrap();
12812        request_value_reader
12813            .seek(std::io::SeekFrom::Start(0))
12814            .unwrap();
12815
12816        loop {
12817            let token = match self
12818                .hub
12819                .auth
12820                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12821                .await
12822            {
12823                Ok(token) => token,
12824                Err(e) => match dlg.token(e) {
12825                    Ok(token) => token,
12826                    Err(e) => {
12827                        dlg.finished(false);
12828                        return Err(common::Error::MissingToken(e));
12829                    }
12830                },
12831            };
12832            request_value_reader
12833                .seek(std::io::SeekFrom::Start(0))
12834                .unwrap();
12835            let mut req_result = {
12836                let client = &self.hub.client;
12837                dlg.pre_request();
12838                let mut req_builder = hyper::Request::builder()
12839                    .method(hyper::Method::PUT)
12840                    .uri(url.as_str())
12841                    .header(USER_AGENT, self.hub._user_agent.clone());
12842
12843                if let Some(token) = token.as_ref() {
12844                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12845                }
12846
12847                let request = req_builder
12848                    .header(CONTENT_TYPE, json_mime_type.to_string())
12849                    .header(CONTENT_LENGTH, request_size as u64)
12850                    .body(common::to_body(
12851                        request_value_reader.get_ref().clone().into(),
12852                    ));
12853
12854                client.request(request.unwrap()).await
12855            };
12856
12857            match req_result {
12858                Err(err) => {
12859                    if let common::Retry::After(d) = dlg.http_error(&err) {
12860                        sleep(d).await;
12861                        continue;
12862                    }
12863                    dlg.finished(false);
12864                    return Err(common::Error::HttpError(err));
12865                }
12866                Ok(res) => {
12867                    let (mut parts, body) = res.into_parts();
12868                    let mut body = common::Body::new(body);
12869                    if !parts.status.is_success() {
12870                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12871                        let error = serde_json::from_str(&common::to_string(&bytes));
12872                        let response = common::to_response(parts, bytes.into());
12873
12874                        if let common::Retry::After(d) =
12875                            dlg.http_failure(&response, error.as_ref().ok())
12876                        {
12877                            sleep(d).await;
12878                            continue;
12879                        }
12880
12881                        dlg.finished(false);
12882
12883                        return Err(match error {
12884                            Ok(value) => common::Error::BadRequest(value),
12885                            _ => common::Error::Failure(response),
12886                        });
12887                    }
12888                    let response = {
12889                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12890                        let encoded = common::to_string(&bytes);
12891                        match serde_json::from_str(&encoded) {
12892                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12893                            Err(error) => {
12894                                dlg.response_json_decode_error(&encoded, &error);
12895                                return Err(common::Error::JsonDecodeError(
12896                                    encoded.to_string(),
12897                                    error,
12898                                ));
12899                            }
12900                        }
12901                    };
12902
12903                    dlg.finished(true);
12904                    return Ok(response);
12905                }
12906            }
12907        }
12908    }
12909
12910    ///
12911    /// Sets the *request* property to the given value.
12912    ///
12913    /// Even though the property as already been set when instantiating this call,
12914    /// we provide this method for API completeness.
12915    pub fn request(mut self, new_value: Account) -> AccountUpdateCall<'a, C> {
12916        self._request = new_value;
12917        self
12918    }
12919    /// The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
12920    ///
12921    /// Sets the *merchant id* path property to the given value.
12922    ///
12923    /// Even though the property as already been set when instantiating this call,
12924    /// we provide this method for API completeness.
12925    pub fn merchant_id(mut self, new_value: u64) -> AccountUpdateCall<'a, C> {
12926        self._merchant_id = new_value;
12927        self
12928    }
12929    /// The ID of the account.
12930    ///
12931    /// Sets the *account id* path property to the given value.
12932    ///
12933    /// Even though the property as already been set when instantiating this call,
12934    /// we provide this method for API completeness.
12935    pub fn account_id(mut self, new_value: u64) -> AccountUpdateCall<'a, C> {
12936        self._account_id = new_value;
12937        self
12938    }
12939    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
12940    ///
12941    /// Sets the *dry run* query property to the given value.
12942    pub fn dry_run(mut self, new_value: bool) -> AccountUpdateCall<'a, C> {
12943        self._dry_run = Some(new_value);
12944        self
12945    }
12946    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12947    /// while executing the actual API request.
12948    ///
12949    /// ````text
12950    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12951    /// ````
12952    ///
12953    /// Sets the *delegate* property to the given value.
12954    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountUpdateCall<'a, C> {
12955        self._delegate = Some(new_value);
12956        self
12957    }
12958
12959    /// Set any additional parameter of the query string used in the request.
12960    /// It should be used to set parameters which are not yet available through their own
12961    /// setters.
12962    ///
12963    /// Please note that this method must not be used to set any of the known parameters
12964    /// which have their own setter method. If done anyway, the request will fail.
12965    ///
12966    /// # Additional Parameters
12967    ///
12968    /// * *$.xgafv* (query-string) - V1 error format.
12969    /// * *access_token* (query-string) - OAuth access token.
12970    /// * *alt* (query-string) - Data format for response.
12971    /// * *callback* (query-string) - JSONP
12972    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12973    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12974    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12975    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12976    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12977    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12978    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12979    pub fn param<T>(mut self, name: T, value: T) -> AccountUpdateCall<'a, C>
12980    where
12981        T: AsRef<str>,
12982    {
12983        self._additional_params
12984            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12985        self
12986    }
12987
12988    /// Identifies the authorization scope for the method you are building.
12989    ///
12990    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12991    /// [`Scope::Full`].
12992    ///
12993    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12994    /// tokens for more than one scope.
12995    ///
12996    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12997    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12998    /// sufficient, a read-write scope will do as well.
12999    pub fn add_scope<St>(mut self, scope: St) -> AccountUpdateCall<'a, C>
13000    where
13001        St: AsRef<str>,
13002    {
13003        self._scopes.insert(String::from(scope.as_ref()));
13004        self
13005    }
13006    /// Identifies the authorization scope(s) for the method you are building.
13007    ///
13008    /// See [`Self::add_scope()`] for details.
13009    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUpdateCall<'a, C>
13010    where
13011        I: IntoIterator<Item = St>,
13012        St: AsRef<str>,
13013    {
13014        self._scopes
13015            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13016        self
13017    }
13018
13019    /// Removes all scopes, and no default scope will be used either.
13020    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13021    /// for details).
13022    pub fn clear_scopes(mut self) -> AccountUpdateCall<'a, C> {
13023        self._scopes.clear();
13024        self
13025    }
13026}
13027
13028/// Retrieves multiple Merchant Center account statuses in a single request.
13029///
13030/// A builder for the *custombatch* method supported by a *accountstatus* resource.
13031/// It is not used directly, but through a [`AccountstatusMethods`] instance.
13032///
13033/// # Example
13034///
13035/// Instantiate a resource method builder
13036///
13037/// ```test_harness,no_run
13038/// # extern crate hyper;
13039/// # extern crate hyper_rustls;
13040/// # extern crate google_content2 as content2;
13041/// use content2::api::AccountstatusesCustomBatchRequest;
13042/// # async fn dox() {
13043/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13044///
13045/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13046/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13047/// #     .with_native_roots()
13048/// #     .unwrap()
13049/// #     .https_only()
13050/// #     .enable_http2()
13051/// #     .build();
13052///
13053/// # let executor = hyper_util::rt::TokioExecutor::new();
13054/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13055/// #     secret,
13056/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13057/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13058/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13059/// #     ),
13060/// # ).build().await.unwrap();
13061///
13062/// # let client = hyper_util::client::legacy::Client::builder(
13063/// #     hyper_util::rt::TokioExecutor::new()
13064/// # )
13065/// # .build(
13066/// #     hyper_rustls::HttpsConnectorBuilder::new()
13067/// #         .with_native_roots()
13068/// #         .unwrap()
13069/// #         .https_or_http()
13070/// #         .enable_http2()
13071/// #         .build()
13072/// # );
13073/// # let mut hub = ShoppingContent::new(client, auth);
13074/// // As the method needs a request, you would usually fill it with the desired information
13075/// // into the respective structure. Some of the parts shown here might not be applicable !
13076/// // Values shown here are possibly random and not representative !
13077/// let mut req = AccountstatusesCustomBatchRequest::default();
13078///
13079/// // You can configure optional parameters by calling the respective setters at will, and
13080/// // execute the final call using `doit()`.
13081/// // Values shown here are possibly random and not representative !
13082/// let result = hub.accountstatuses().custombatch(req)
13083///              .doit().await;
13084/// # }
13085/// ```
13086pub struct AccountstatusCustombatchCall<'a, C>
13087where
13088    C: 'a,
13089{
13090    hub: &'a ShoppingContent<C>,
13091    _request: AccountstatusesCustomBatchRequest,
13092    _delegate: Option<&'a mut dyn common::Delegate>,
13093    _additional_params: HashMap<String, String>,
13094    _scopes: BTreeSet<String>,
13095}
13096
13097impl<'a, C> common::CallBuilder for AccountstatusCustombatchCall<'a, C> {}
13098
13099impl<'a, C> AccountstatusCustombatchCall<'a, C>
13100where
13101    C: common::Connector,
13102{
13103    /// Perform the operation you have build so far.
13104    pub async fn doit(
13105        mut self,
13106    ) -> common::Result<(common::Response, AccountstatusesCustomBatchResponse)> {
13107        use std::borrow::Cow;
13108        use std::io::{Read, Seek};
13109
13110        use common::{url::Params, ToParts};
13111        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13112
13113        let mut dd = common::DefaultDelegate;
13114        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13115        dlg.begin(common::MethodInfo {
13116            id: "content.accountstatuses.custombatch",
13117            http_method: hyper::Method::POST,
13118        });
13119
13120        for &field in ["alt"].iter() {
13121            if self._additional_params.contains_key(field) {
13122                dlg.finished(false);
13123                return Err(common::Error::FieldClash(field));
13124            }
13125        }
13126
13127        let mut params = Params::with_capacity(3 + self._additional_params.len());
13128
13129        params.extend(self._additional_params.iter());
13130
13131        params.push("alt", "json");
13132        let mut url = self.hub._base_url.clone() + "accountstatuses/batch";
13133        if self._scopes.is_empty() {
13134            self._scopes.insert(Scope::Full.as_ref().to_string());
13135        }
13136
13137        let url = params.parse_with_url(&url);
13138
13139        let mut json_mime_type = mime::APPLICATION_JSON;
13140        let mut request_value_reader = {
13141            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13142            common::remove_json_null_values(&mut value);
13143            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13144            serde_json::to_writer(&mut dst, &value).unwrap();
13145            dst
13146        };
13147        let request_size = request_value_reader
13148            .seek(std::io::SeekFrom::End(0))
13149            .unwrap();
13150        request_value_reader
13151            .seek(std::io::SeekFrom::Start(0))
13152            .unwrap();
13153
13154        loop {
13155            let token = match self
13156                .hub
13157                .auth
13158                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13159                .await
13160            {
13161                Ok(token) => token,
13162                Err(e) => match dlg.token(e) {
13163                    Ok(token) => token,
13164                    Err(e) => {
13165                        dlg.finished(false);
13166                        return Err(common::Error::MissingToken(e));
13167                    }
13168                },
13169            };
13170            request_value_reader
13171                .seek(std::io::SeekFrom::Start(0))
13172                .unwrap();
13173            let mut req_result = {
13174                let client = &self.hub.client;
13175                dlg.pre_request();
13176                let mut req_builder = hyper::Request::builder()
13177                    .method(hyper::Method::POST)
13178                    .uri(url.as_str())
13179                    .header(USER_AGENT, self.hub._user_agent.clone());
13180
13181                if let Some(token) = token.as_ref() {
13182                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13183                }
13184
13185                let request = req_builder
13186                    .header(CONTENT_TYPE, json_mime_type.to_string())
13187                    .header(CONTENT_LENGTH, request_size as u64)
13188                    .body(common::to_body(
13189                        request_value_reader.get_ref().clone().into(),
13190                    ));
13191
13192                client.request(request.unwrap()).await
13193            };
13194
13195            match req_result {
13196                Err(err) => {
13197                    if let common::Retry::After(d) = dlg.http_error(&err) {
13198                        sleep(d).await;
13199                        continue;
13200                    }
13201                    dlg.finished(false);
13202                    return Err(common::Error::HttpError(err));
13203                }
13204                Ok(res) => {
13205                    let (mut parts, body) = res.into_parts();
13206                    let mut body = common::Body::new(body);
13207                    if !parts.status.is_success() {
13208                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13209                        let error = serde_json::from_str(&common::to_string(&bytes));
13210                        let response = common::to_response(parts, bytes.into());
13211
13212                        if let common::Retry::After(d) =
13213                            dlg.http_failure(&response, error.as_ref().ok())
13214                        {
13215                            sleep(d).await;
13216                            continue;
13217                        }
13218
13219                        dlg.finished(false);
13220
13221                        return Err(match error {
13222                            Ok(value) => common::Error::BadRequest(value),
13223                            _ => common::Error::Failure(response),
13224                        });
13225                    }
13226                    let response = {
13227                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13228                        let encoded = common::to_string(&bytes);
13229                        match serde_json::from_str(&encoded) {
13230                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13231                            Err(error) => {
13232                                dlg.response_json_decode_error(&encoded, &error);
13233                                return Err(common::Error::JsonDecodeError(
13234                                    encoded.to_string(),
13235                                    error,
13236                                ));
13237                            }
13238                        }
13239                    };
13240
13241                    dlg.finished(true);
13242                    return Ok(response);
13243                }
13244            }
13245        }
13246    }
13247
13248    ///
13249    /// Sets the *request* property to the given value.
13250    ///
13251    /// Even though the property as already been set when instantiating this call,
13252    /// we provide this method for API completeness.
13253    pub fn request(
13254        mut self,
13255        new_value: AccountstatusesCustomBatchRequest,
13256    ) -> AccountstatusCustombatchCall<'a, C> {
13257        self._request = new_value;
13258        self
13259    }
13260    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13261    /// while executing the actual API request.
13262    ///
13263    /// ````text
13264    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13265    /// ````
13266    ///
13267    /// Sets the *delegate* property to the given value.
13268    pub fn delegate(
13269        mut self,
13270        new_value: &'a mut dyn common::Delegate,
13271    ) -> AccountstatusCustombatchCall<'a, C> {
13272        self._delegate = Some(new_value);
13273        self
13274    }
13275
13276    /// Set any additional parameter of the query string used in the request.
13277    /// It should be used to set parameters which are not yet available through their own
13278    /// setters.
13279    ///
13280    /// Please note that this method must not be used to set any of the known parameters
13281    /// which have their own setter method. If done anyway, the request will fail.
13282    ///
13283    /// # Additional Parameters
13284    ///
13285    /// * *$.xgafv* (query-string) - V1 error format.
13286    /// * *access_token* (query-string) - OAuth access token.
13287    /// * *alt* (query-string) - Data format for response.
13288    /// * *callback* (query-string) - JSONP
13289    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13290    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13291    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13292    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13293    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13294    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13295    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13296    pub fn param<T>(mut self, name: T, value: T) -> AccountstatusCustombatchCall<'a, C>
13297    where
13298        T: AsRef<str>,
13299    {
13300        self._additional_params
13301            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13302        self
13303    }
13304
13305    /// Identifies the authorization scope for the method you are building.
13306    ///
13307    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13308    /// [`Scope::Full`].
13309    ///
13310    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13311    /// tokens for more than one scope.
13312    ///
13313    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13314    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13315    /// sufficient, a read-write scope will do as well.
13316    pub fn add_scope<St>(mut self, scope: St) -> AccountstatusCustombatchCall<'a, C>
13317    where
13318        St: AsRef<str>,
13319    {
13320        self._scopes.insert(String::from(scope.as_ref()));
13321        self
13322    }
13323    /// Identifies the authorization scope(s) for the method you are building.
13324    ///
13325    /// See [`Self::add_scope()`] for details.
13326    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountstatusCustombatchCall<'a, C>
13327    where
13328        I: IntoIterator<Item = St>,
13329        St: AsRef<str>,
13330    {
13331        self._scopes
13332            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13333        self
13334    }
13335
13336    /// Removes all scopes, and no default scope will be used either.
13337    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13338    /// for details).
13339    pub fn clear_scopes(mut self) -> AccountstatusCustombatchCall<'a, C> {
13340        self._scopes.clear();
13341        self
13342    }
13343}
13344
13345/// Retrieves the status of a Merchant Center account. No itemLevelIssues are returned for multi-client accounts.
13346///
13347/// A builder for the *get* method supported by a *accountstatus* resource.
13348/// It is not used directly, but through a [`AccountstatusMethods`] instance.
13349///
13350/// # Example
13351///
13352/// Instantiate a resource method builder
13353///
13354/// ```test_harness,no_run
13355/// # extern crate hyper;
13356/// # extern crate hyper_rustls;
13357/// # extern crate google_content2 as content2;
13358/// # async fn dox() {
13359/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13360///
13361/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13362/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13363/// #     .with_native_roots()
13364/// #     .unwrap()
13365/// #     .https_only()
13366/// #     .enable_http2()
13367/// #     .build();
13368///
13369/// # let executor = hyper_util::rt::TokioExecutor::new();
13370/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13371/// #     secret,
13372/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13373/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13374/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13375/// #     ),
13376/// # ).build().await.unwrap();
13377///
13378/// # let client = hyper_util::client::legacy::Client::builder(
13379/// #     hyper_util::rt::TokioExecutor::new()
13380/// # )
13381/// # .build(
13382/// #     hyper_rustls::HttpsConnectorBuilder::new()
13383/// #         .with_native_roots()
13384/// #         .unwrap()
13385/// #         .https_or_http()
13386/// #         .enable_http2()
13387/// #         .build()
13388/// # );
13389/// # let mut hub = ShoppingContent::new(client, auth);
13390/// // You can configure optional parameters by calling the respective setters at will, and
13391/// // execute the final call using `doit()`.
13392/// // Values shown here are possibly random and not representative !
13393/// let result = hub.accountstatuses().get(25, 70)
13394///              .add_destinations("sed")
13395///              .doit().await;
13396/// # }
13397/// ```
13398pub struct AccountstatusGetCall<'a, C>
13399where
13400    C: 'a,
13401{
13402    hub: &'a ShoppingContent<C>,
13403    _merchant_id: u64,
13404    _account_id: u64,
13405    _destinations: Vec<String>,
13406    _delegate: Option<&'a mut dyn common::Delegate>,
13407    _additional_params: HashMap<String, String>,
13408    _scopes: BTreeSet<String>,
13409}
13410
13411impl<'a, C> common::CallBuilder for AccountstatusGetCall<'a, C> {}
13412
13413impl<'a, C> AccountstatusGetCall<'a, C>
13414where
13415    C: common::Connector,
13416{
13417    /// Perform the operation you have build so far.
13418    pub async fn doit(mut self) -> common::Result<(common::Response, AccountStatus)> {
13419        use std::borrow::Cow;
13420        use std::io::{Read, Seek};
13421
13422        use common::{url::Params, ToParts};
13423        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13424
13425        let mut dd = common::DefaultDelegate;
13426        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13427        dlg.begin(common::MethodInfo {
13428            id: "content.accountstatuses.get",
13429            http_method: hyper::Method::GET,
13430        });
13431
13432        for &field in ["alt", "merchantId", "accountId", "destinations"].iter() {
13433            if self._additional_params.contains_key(field) {
13434                dlg.finished(false);
13435                return Err(common::Error::FieldClash(field));
13436            }
13437        }
13438
13439        let mut params = Params::with_capacity(5 + self._additional_params.len());
13440        params.push("merchantId", self._merchant_id.to_string());
13441        params.push("accountId", self._account_id.to_string());
13442        if !self._destinations.is_empty() {
13443            for f in self._destinations.iter() {
13444                params.push("destinations", f);
13445            }
13446        }
13447
13448        params.extend(self._additional_params.iter());
13449
13450        params.push("alt", "json");
13451        let mut url = self.hub._base_url.clone() + "{merchantId}/accountstatuses/{accountId}";
13452        if self._scopes.is_empty() {
13453            self._scopes.insert(Scope::Full.as_ref().to_string());
13454        }
13455
13456        #[allow(clippy::single_element_loop)]
13457        for &(find_this, param_name) in
13458            [("{merchantId}", "merchantId"), ("{accountId}", "accountId")].iter()
13459        {
13460            url = params.uri_replacement(url, param_name, find_this, false);
13461        }
13462        {
13463            let to_remove = ["accountId", "merchantId"];
13464            params.remove_params(&to_remove);
13465        }
13466
13467        let url = params.parse_with_url(&url);
13468
13469        loop {
13470            let token = match self
13471                .hub
13472                .auth
13473                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13474                .await
13475            {
13476                Ok(token) => token,
13477                Err(e) => match dlg.token(e) {
13478                    Ok(token) => token,
13479                    Err(e) => {
13480                        dlg.finished(false);
13481                        return Err(common::Error::MissingToken(e));
13482                    }
13483                },
13484            };
13485            let mut req_result = {
13486                let client = &self.hub.client;
13487                dlg.pre_request();
13488                let mut req_builder = hyper::Request::builder()
13489                    .method(hyper::Method::GET)
13490                    .uri(url.as_str())
13491                    .header(USER_AGENT, self.hub._user_agent.clone());
13492
13493                if let Some(token) = token.as_ref() {
13494                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13495                }
13496
13497                let request = req_builder
13498                    .header(CONTENT_LENGTH, 0_u64)
13499                    .body(common::to_body::<String>(None));
13500
13501                client.request(request.unwrap()).await
13502            };
13503
13504            match req_result {
13505                Err(err) => {
13506                    if let common::Retry::After(d) = dlg.http_error(&err) {
13507                        sleep(d).await;
13508                        continue;
13509                    }
13510                    dlg.finished(false);
13511                    return Err(common::Error::HttpError(err));
13512                }
13513                Ok(res) => {
13514                    let (mut parts, body) = res.into_parts();
13515                    let mut body = common::Body::new(body);
13516                    if !parts.status.is_success() {
13517                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13518                        let error = serde_json::from_str(&common::to_string(&bytes));
13519                        let response = common::to_response(parts, bytes.into());
13520
13521                        if let common::Retry::After(d) =
13522                            dlg.http_failure(&response, error.as_ref().ok())
13523                        {
13524                            sleep(d).await;
13525                            continue;
13526                        }
13527
13528                        dlg.finished(false);
13529
13530                        return Err(match error {
13531                            Ok(value) => common::Error::BadRequest(value),
13532                            _ => common::Error::Failure(response),
13533                        });
13534                    }
13535                    let response = {
13536                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13537                        let encoded = common::to_string(&bytes);
13538                        match serde_json::from_str(&encoded) {
13539                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13540                            Err(error) => {
13541                                dlg.response_json_decode_error(&encoded, &error);
13542                                return Err(common::Error::JsonDecodeError(
13543                                    encoded.to_string(),
13544                                    error,
13545                                ));
13546                            }
13547                        }
13548                    };
13549
13550                    dlg.finished(true);
13551                    return Ok(response);
13552                }
13553            }
13554        }
13555    }
13556
13557    /// The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
13558    ///
13559    /// Sets the *merchant id* path property to the given value.
13560    ///
13561    /// Even though the property as already been set when instantiating this call,
13562    /// we provide this method for API completeness.
13563    pub fn merchant_id(mut self, new_value: u64) -> AccountstatusGetCall<'a, C> {
13564        self._merchant_id = new_value;
13565        self
13566    }
13567    /// The ID of the account.
13568    ///
13569    /// Sets the *account id* path property to the given value.
13570    ///
13571    /// Even though the property as already been set when instantiating this call,
13572    /// we provide this method for API completeness.
13573    pub fn account_id(mut self, new_value: u64) -> AccountstatusGetCall<'a, C> {
13574        self._account_id = new_value;
13575        self
13576    }
13577    /// If set, only issues for the specified destinations are returned, otherwise only issues for the Shopping destination.
13578    ///
13579    /// Append the given value to the *destinations* query property.
13580    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
13581    pub fn add_destinations(mut self, new_value: &str) -> AccountstatusGetCall<'a, C> {
13582        self._destinations.push(new_value.to_string());
13583        self
13584    }
13585    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13586    /// while executing the actual API request.
13587    ///
13588    /// ````text
13589    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13590    /// ````
13591    ///
13592    /// Sets the *delegate* property to the given value.
13593    pub fn delegate(
13594        mut self,
13595        new_value: &'a mut dyn common::Delegate,
13596    ) -> AccountstatusGetCall<'a, C> {
13597        self._delegate = Some(new_value);
13598        self
13599    }
13600
13601    /// Set any additional parameter of the query string used in the request.
13602    /// It should be used to set parameters which are not yet available through their own
13603    /// setters.
13604    ///
13605    /// Please note that this method must not be used to set any of the known parameters
13606    /// which have their own setter method. If done anyway, the request will fail.
13607    ///
13608    /// # Additional Parameters
13609    ///
13610    /// * *$.xgafv* (query-string) - V1 error format.
13611    /// * *access_token* (query-string) - OAuth access token.
13612    /// * *alt* (query-string) - Data format for response.
13613    /// * *callback* (query-string) - JSONP
13614    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13615    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13616    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13617    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13618    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13619    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13620    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13621    pub fn param<T>(mut self, name: T, value: T) -> AccountstatusGetCall<'a, C>
13622    where
13623        T: AsRef<str>,
13624    {
13625        self._additional_params
13626            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13627        self
13628    }
13629
13630    /// Identifies the authorization scope for the method you are building.
13631    ///
13632    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13633    /// [`Scope::Full`].
13634    ///
13635    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13636    /// tokens for more than one scope.
13637    ///
13638    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13639    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13640    /// sufficient, a read-write scope will do as well.
13641    pub fn add_scope<St>(mut self, scope: St) -> AccountstatusGetCall<'a, C>
13642    where
13643        St: AsRef<str>,
13644    {
13645        self._scopes.insert(String::from(scope.as_ref()));
13646        self
13647    }
13648    /// Identifies the authorization scope(s) for the method you are building.
13649    ///
13650    /// See [`Self::add_scope()`] for details.
13651    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountstatusGetCall<'a, C>
13652    where
13653        I: IntoIterator<Item = St>,
13654        St: AsRef<str>,
13655    {
13656        self._scopes
13657            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13658        self
13659    }
13660
13661    /// Removes all scopes, and no default scope will be used either.
13662    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13663    /// for details).
13664    pub fn clear_scopes(mut self) -> AccountstatusGetCall<'a, C> {
13665        self._scopes.clear();
13666        self
13667    }
13668}
13669
13670/// Lists the statuses of the sub-accounts in your Merchant Center account.
13671///
13672/// A builder for the *list* method supported by a *accountstatus* resource.
13673/// It is not used directly, but through a [`AccountstatusMethods`] instance.
13674///
13675/// # Example
13676///
13677/// Instantiate a resource method builder
13678///
13679/// ```test_harness,no_run
13680/// # extern crate hyper;
13681/// # extern crate hyper_rustls;
13682/// # extern crate google_content2 as content2;
13683/// # async fn dox() {
13684/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13685///
13686/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13687/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13688/// #     .with_native_roots()
13689/// #     .unwrap()
13690/// #     .https_only()
13691/// #     .enable_http2()
13692/// #     .build();
13693///
13694/// # let executor = hyper_util::rt::TokioExecutor::new();
13695/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13696/// #     secret,
13697/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13698/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13699/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13700/// #     ),
13701/// # ).build().await.unwrap();
13702///
13703/// # let client = hyper_util::client::legacy::Client::builder(
13704/// #     hyper_util::rt::TokioExecutor::new()
13705/// # )
13706/// # .build(
13707/// #     hyper_rustls::HttpsConnectorBuilder::new()
13708/// #         .with_native_roots()
13709/// #         .unwrap()
13710/// #         .https_or_http()
13711/// #         .enable_http2()
13712/// #         .build()
13713/// # );
13714/// # let mut hub = ShoppingContent::new(client, auth);
13715/// // You can configure optional parameters by calling the respective setters at will, and
13716/// // execute the final call using `doit()`.
13717/// // Values shown here are possibly random and not representative !
13718/// let result = hub.accountstatuses().list(81)
13719///              .page_token("dolore")
13720///              .max_results(79)
13721///              .add_destinations("voluptua.")
13722///              .doit().await;
13723/// # }
13724/// ```
13725pub struct AccountstatusListCall<'a, C>
13726where
13727    C: 'a,
13728{
13729    hub: &'a ShoppingContent<C>,
13730    _merchant_id: u64,
13731    _page_token: Option<String>,
13732    _max_results: Option<u32>,
13733    _destinations: Vec<String>,
13734    _delegate: Option<&'a mut dyn common::Delegate>,
13735    _additional_params: HashMap<String, String>,
13736    _scopes: BTreeSet<String>,
13737}
13738
13739impl<'a, C> common::CallBuilder for AccountstatusListCall<'a, C> {}
13740
13741impl<'a, C> AccountstatusListCall<'a, C>
13742where
13743    C: common::Connector,
13744{
13745    /// Perform the operation you have build so far.
13746    pub async fn doit(mut self) -> common::Result<(common::Response, AccountstatusesListResponse)> {
13747        use std::borrow::Cow;
13748        use std::io::{Read, Seek};
13749
13750        use common::{url::Params, ToParts};
13751        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13752
13753        let mut dd = common::DefaultDelegate;
13754        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13755        dlg.begin(common::MethodInfo {
13756            id: "content.accountstatuses.list",
13757            http_method: hyper::Method::GET,
13758        });
13759
13760        for &field in [
13761            "alt",
13762            "merchantId",
13763            "pageToken",
13764            "maxResults",
13765            "destinations",
13766        ]
13767        .iter()
13768        {
13769            if self._additional_params.contains_key(field) {
13770                dlg.finished(false);
13771                return Err(common::Error::FieldClash(field));
13772            }
13773        }
13774
13775        let mut params = Params::with_capacity(6 + self._additional_params.len());
13776        params.push("merchantId", self._merchant_id.to_string());
13777        if let Some(value) = self._page_token.as_ref() {
13778            params.push("pageToken", value);
13779        }
13780        if let Some(value) = self._max_results.as_ref() {
13781            params.push("maxResults", value.to_string());
13782        }
13783        if !self._destinations.is_empty() {
13784            for f in self._destinations.iter() {
13785                params.push("destinations", f);
13786            }
13787        }
13788
13789        params.extend(self._additional_params.iter());
13790
13791        params.push("alt", "json");
13792        let mut url = self.hub._base_url.clone() + "{merchantId}/accountstatuses";
13793        if self._scopes.is_empty() {
13794            self._scopes.insert(Scope::Full.as_ref().to_string());
13795        }
13796
13797        #[allow(clippy::single_element_loop)]
13798        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
13799            url = params.uri_replacement(url, param_name, find_this, false);
13800        }
13801        {
13802            let to_remove = ["merchantId"];
13803            params.remove_params(&to_remove);
13804        }
13805
13806        let url = params.parse_with_url(&url);
13807
13808        loop {
13809            let token = match self
13810                .hub
13811                .auth
13812                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13813                .await
13814            {
13815                Ok(token) => token,
13816                Err(e) => match dlg.token(e) {
13817                    Ok(token) => token,
13818                    Err(e) => {
13819                        dlg.finished(false);
13820                        return Err(common::Error::MissingToken(e));
13821                    }
13822                },
13823            };
13824            let mut req_result = {
13825                let client = &self.hub.client;
13826                dlg.pre_request();
13827                let mut req_builder = hyper::Request::builder()
13828                    .method(hyper::Method::GET)
13829                    .uri(url.as_str())
13830                    .header(USER_AGENT, self.hub._user_agent.clone());
13831
13832                if let Some(token) = token.as_ref() {
13833                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13834                }
13835
13836                let request = req_builder
13837                    .header(CONTENT_LENGTH, 0_u64)
13838                    .body(common::to_body::<String>(None));
13839
13840                client.request(request.unwrap()).await
13841            };
13842
13843            match req_result {
13844                Err(err) => {
13845                    if let common::Retry::After(d) = dlg.http_error(&err) {
13846                        sleep(d).await;
13847                        continue;
13848                    }
13849                    dlg.finished(false);
13850                    return Err(common::Error::HttpError(err));
13851                }
13852                Ok(res) => {
13853                    let (mut parts, body) = res.into_parts();
13854                    let mut body = common::Body::new(body);
13855                    if !parts.status.is_success() {
13856                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13857                        let error = serde_json::from_str(&common::to_string(&bytes));
13858                        let response = common::to_response(parts, bytes.into());
13859
13860                        if let common::Retry::After(d) =
13861                            dlg.http_failure(&response, error.as_ref().ok())
13862                        {
13863                            sleep(d).await;
13864                            continue;
13865                        }
13866
13867                        dlg.finished(false);
13868
13869                        return Err(match error {
13870                            Ok(value) => common::Error::BadRequest(value),
13871                            _ => common::Error::Failure(response),
13872                        });
13873                    }
13874                    let response = {
13875                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13876                        let encoded = common::to_string(&bytes);
13877                        match serde_json::from_str(&encoded) {
13878                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13879                            Err(error) => {
13880                                dlg.response_json_decode_error(&encoded, &error);
13881                                return Err(common::Error::JsonDecodeError(
13882                                    encoded.to_string(),
13883                                    error,
13884                                ));
13885                            }
13886                        }
13887                    };
13888
13889                    dlg.finished(true);
13890                    return Ok(response);
13891                }
13892            }
13893        }
13894    }
13895
13896    /// The ID of the managing account. This must be a multi-client account.
13897    ///
13898    /// Sets the *merchant id* path property to the given value.
13899    ///
13900    /// Even though the property as already been set when instantiating this call,
13901    /// we provide this method for API completeness.
13902    pub fn merchant_id(mut self, new_value: u64) -> AccountstatusListCall<'a, C> {
13903        self._merchant_id = new_value;
13904        self
13905    }
13906    /// The token returned by the previous request.
13907    ///
13908    /// Sets the *page token* query property to the given value.
13909    pub fn page_token(mut self, new_value: &str) -> AccountstatusListCall<'a, C> {
13910        self._page_token = Some(new_value.to_string());
13911        self
13912    }
13913    /// The maximum number of account statuses to return in the response, used for paging.
13914    ///
13915    /// Sets the *max results* query property to the given value.
13916    pub fn max_results(mut self, new_value: u32) -> AccountstatusListCall<'a, C> {
13917        self._max_results = Some(new_value);
13918        self
13919    }
13920    /// If set, only issues for the specified destinations are returned, otherwise only issues for the Shopping destination.
13921    ///
13922    /// Append the given value to the *destinations* query property.
13923    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
13924    pub fn add_destinations(mut self, new_value: &str) -> AccountstatusListCall<'a, C> {
13925        self._destinations.push(new_value.to_string());
13926        self
13927    }
13928    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13929    /// while executing the actual API request.
13930    ///
13931    /// ````text
13932    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13933    /// ````
13934    ///
13935    /// Sets the *delegate* property to the given value.
13936    pub fn delegate(
13937        mut self,
13938        new_value: &'a mut dyn common::Delegate,
13939    ) -> AccountstatusListCall<'a, C> {
13940        self._delegate = Some(new_value);
13941        self
13942    }
13943
13944    /// Set any additional parameter of the query string used in the request.
13945    /// It should be used to set parameters which are not yet available through their own
13946    /// setters.
13947    ///
13948    /// Please note that this method must not be used to set any of the known parameters
13949    /// which have their own setter method. If done anyway, the request will fail.
13950    ///
13951    /// # Additional Parameters
13952    ///
13953    /// * *$.xgafv* (query-string) - V1 error format.
13954    /// * *access_token* (query-string) - OAuth access token.
13955    /// * *alt* (query-string) - Data format for response.
13956    /// * *callback* (query-string) - JSONP
13957    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13958    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13959    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13960    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13961    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13962    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13963    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13964    pub fn param<T>(mut self, name: T, value: T) -> AccountstatusListCall<'a, C>
13965    where
13966        T: AsRef<str>,
13967    {
13968        self._additional_params
13969            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13970        self
13971    }
13972
13973    /// Identifies the authorization scope for the method you are building.
13974    ///
13975    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13976    /// [`Scope::Full`].
13977    ///
13978    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13979    /// tokens for more than one scope.
13980    ///
13981    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13982    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13983    /// sufficient, a read-write scope will do as well.
13984    pub fn add_scope<St>(mut self, scope: St) -> AccountstatusListCall<'a, C>
13985    where
13986        St: AsRef<str>,
13987    {
13988        self._scopes.insert(String::from(scope.as_ref()));
13989        self
13990    }
13991    /// Identifies the authorization scope(s) for the method you are building.
13992    ///
13993    /// See [`Self::add_scope()`] for details.
13994    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountstatusListCall<'a, C>
13995    where
13996        I: IntoIterator<Item = St>,
13997        St: AsRef<str>,
13998    {
13999        self._scopes
14000            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14001        self
14002    }
14003
14004    /// Removes all scopes, and no default scope will be used either.
14005    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14006    /// for details).
14007    pub fn clear_scopes(mut self) -> AccountstatusListCall<'a, C> {
14008        self._scopes.clear();
14009        self
14010    }
14011}
14012
14013/// Retrieves and updates tax settings of multiple accounts in a single request.
14014///
14015/// A builder for the *custombatch* method supported by a *accounttax* resource.
14016/// It is not used directly, but through a [`AccounttaxMethods`] instance.
14017///
14018/// # Example
14019///
14020/// Instantiate a resource method builder
14021///
14022/// ```test_harness,no_run
14023/// # extern crate hyper;
14024/// # extern crate hyper_rustls;
14025/// # extern crate google_content2 as content2;
14026/// use content2::api::AccounttaxCustomBatchRequest;
14027/// # async fn dox() {
14028/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14029///
14030/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14031/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14032/// #     .with_native_roots()
14033/// #     .unwrap()
14034/// #     .https_only()
14035/// #     .enable_http2()
14036/// #     .build();
14037///
14038/// # let executor = hyper_util::rt::TokioExecutor::new();
14039/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14040/// #     secret,
14041/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14042/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14043/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14044/// #     ),
14045/// # ).build().await.unwrap();
14046///
14047/// # let client = hyper_util::client::legacy::Client::builder(
14048/// #     hyper_util::rt::TokioExecutor::new()
14049/// # )
14050/// # .build(
14051/// #     hyper_rustls::HttpsConnectorBuilder::new()
14052/// #         .with_native_roots()
14053/// #         .unwrap()
14054/// #         .https_or_http()
14055/// #         .enable_http2()
14056/// #         .build()
14057/// # );
14058/// # let mut hub = ShoppingContent::new(client, auth);
14059/// // As the method needs a request, you would usually fill it with the desired information
14060/// // into the respective structure. Some of the parts shown here might not be applicable !
14061/// // Values shown here are possibly random and not representative !
14062/// let mut req = AccounttaxCustomBatchRequest::default();
14063///
14064/// // You can configure optional parameters by calling the respective setters at will, and
14065/// // execute the final call using `doit()`.
14066/// // Values shown here are possibly random and not representative !
14067/// let result = hub.accounttax().custombatch(req)
14068///              .dry_run(false)
14069///              .doit().await;
14070/// # }
14071/// ```
14072pub struct AccounttaxCustombatchCall<'a, C>
14073where
14074    C: 'a,
14075{
14076    hub: &'a ShoppingContent<C>,
14077    _request: AccounttaxCustomBatchRequest,
14078    _dry_run: Option<bool>,
14079    _delegate: Option<&'a mut dyn common::Delegate>,
14080    _additional_params: HashMap<String, String>,
14081    _scopes: BTreeSet<String>,
14082}
14083
14084impl<'a, C> common::CallBuilder for AccounttaxCustombatchCall<'a, C> {}
14085
14086impl<'a, C> AccounttaxCustombatchCall<'a, C>
14087where
14088    C: common::Connector,
14089{
14090    /// Perform the operation you have build so far.
14091    pub async fn doit(
14092        mut self,
14093    ) -> common::Result<(common::Response, AccounttaxCustomBatchResponse)> {
14094        use std::borrow::Cow;
14095        use std::io::{Read, Seek};
14096
14097        use common::{url::Params, ToParts};
14098        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14099
14100        let mut dd = common::DefaultDelegate;
14101        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14102        dlg.begin(common::MethodInfo {
14103            id: "content.accounttax.custombatch",
14104            http_method: hyper::Method::POST,
14105        });
14106
14107        for &field in ["alt", "dryRun"].iter() {
14108            if self._additional_params.contains_key(field) {
14109                dlg.finished(false);
14110                return Err(common::Error::FieldClash(field));
14111            }
14112        }
14113
14114        let mut params = Params::with_capacity(4 + self._additional_params.len());
14115        if let Some(value) = self._dry_run.as_ref() {
14116            params.push("dryRun", value.to_string());
14117        }
14118
14119        params.extend(self._additional_params.iter());
14120
14121        params.push("alt", "json");
14122        let mut url = self.hub._base_url.clone() + "accounttax/batch";
14123        if self._scopes.is_empty() {
14124            self._scopes.insert(Scope::Full.as_ref().to_string());
14125        }
14126
14127        let url = params.parse_with_url(&url);
14128
14129        let mut json_mime_type = mime::APPLICATION_JSON;
14130        let mut request_value_reader = {
14131            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14132            common::remove_json_null_values(&mut value);
14133            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14134            serde_json::to_writer(&mut dst, &value).unwrap();
14135            dst
14136        };
14137        let request_size = request_value_reader
14138            .seek(std::io::SeekFrom::End(0))
14139            .unwrap();
14140        request_value_reader
14141            .seek(std::io::SeekFrom::Start(0))
14142            .unwrap();
14143
14144        loop {
14145            let token = match self
14146                .hub
14147                .auth
14148                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14149                .await
14150            {
14151                Ok(token) => token,
14152                Err(e) => match dlg.token(e) {
14153                    Ok(token) => token,
14154                    Err(e) => {
14155                        dlg.finished(false);
14156                        return Err(common::Error::MissingToken(e));
14157                    }
14158                },
14159            };
14160            request_value_reader
14161                .seek(std::io::SeekFrom::Start(0))
14162                .unwrap();
14163            let mut req_result = {
14164                let client = &self.hub.client;
14165                dlg.pre_request();
14166                let mut req_builder = hyper::Request::builder()
14167                    .method(hyper::Method::POST)
14168                    .uri(url.as_str())
14169                    .header(USER_AGENT, self.hub._user_agent.clone());
14170
14171                if let Some(token) = token.as_ref() {
14172                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14173                }
14174
14175                let request = req_builder
14176                    .header(CONTENT_TYPE, json_mime_type.to_string())
14177                    .header(CONTENT_LENGTH, request_size as u64)
14178                    .body(common::to_body(
14179                        request_value_reader.get_ref().clone().into(),
14180                    ));
14181
14182                client.request(request.unwrap()).await
14183            };
14184
14185            match req_result {
14186                Err(err) => {
14187                    if let common::Retry::After(d) = dlg.http_error(&err) {
14188                        sleep(d).await;
14189                        continue;
14190                    }
14191                    dlg.finished(false);
14192                    return Err(common::Error::HttpError(err));
14193                }
14194                Ok(res) => {
14195                    let (mut parts, body) = res.into_parts();
14196                    let mut body = common::Body::new(body);
14197                    if !parts.status.is_success() {
14198                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14199                        let error = serde_json::from_str(&common::to_string(&bytes));
14200                        let response = common::to_response(parts, bytes.into());
14201
14202                        if let common::Retry::After(d) =
14203                            dlg.http_failure(&response, error.as_ref().ok())
14204                        {
14205                            sleep(d).await;
14206                            continue;
14207                        }
14208
14209                        dlg.finished(false);
14210
14211                        return Err(match error {
14212                            Ok(value) => common::Error::BadRequest(value),
14213                            _ => common::Error::Failure(response),
14214                        });
14215                    }
14216                    let response = {
14217                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14218                        let encoded = common::to_string(&bytes);
14219                        match serde_json::from_str(&encoded) {
14220                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14221                            Err(error) => {
14222                                dlg.response_json_decode_error(&encoded, &error);
14223                                return Err(common::Error::JsonDecodeError(
14224                                    encoded.to_string(),
14225                                    error,
14226                                ));
14227                            }
14228                        }
14229                    };
14230
14231                    dlg.finished(true);
14232                    return Ok(response);
14233                }
14234            }
14235        }
14236    }
14237
14238    ///
14239    /// Sets the *request* property to the given value.
14240    ///
14241    /// Even though the property as already been set when instantiating this call,
14242    /// we provide this method for API completeness.
14243    pub fn request(
14244        mut self,
14245        new_value: AccounttaxCustomBatchRequest,
14246    ) -> AccounttaxCustombatchCall<'a, C> {
14247        self._request = new_value;
14248        self
14249    }
14250    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
14251    ///
14252    /// Sets the *dry run* query property to the given value.
14253    pub fn dry_run(mut self, new_value: bool) -> AccounttaxCustombatchCall<'a, C> {
14254        self._dry_run = Some(new_value);
14255        self
14256    }
14257    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14258    /// while executing the actual API request.
14259    ///
14260    /// ````text
14261    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14262    /// ````
14263    ///
14264    /// Sets the *delegate* property to the given value.
14265    pub fn delegate(
14266        mut self,
14267        new_value: &'a mut dyn common::Delegate,
14268    ) -> AccounttaxCustombatchCall<'a, C> {
14269        self._delegate = Some(new_value);
14270        self
14271    }
14272
14273    /// Set any additional parameter of the query string used in the request.
14274    /// It should be used to set parameters which are not yet available through their own
14275    /// setters.
14276    ///
14277    /// Please note that this method must not be used to set any of the known parameters
14278    /// which have their own setter method. If done anyway, the request will fail.
14279    ///
14280    /// # Additional Parameters
14281    ///
14282    /// * *$.xgafv* (query-string) - V1 error format.
14283    /// * *access_token* (query-string) - OAuth access token.
14284    /// * *alt* (query-string) - Data format for response.
14285    /// * *callback* (query-string) - JSONP
14286    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14287    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14288    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14289    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14290    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14291    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14292    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14293    pub fn param<T>(mut self, name: T, value: T) -> AccounttaxCustombatchCall<'a, C>
14294    where
14295        T: AsRef<str>,
14296    {
14297        self._additional_params
14298            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14299        self
14300    }
14301
14302    /// Identifies the authorization scope for the method you are building.
14303    ///
14304    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14305    /// [`Scope::Full`].
14306    ///
14307    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14308    /// tokens for more than one scope.
14309    ///
14310    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14311    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14312    /// sufficient, a read-write scope will do as well.
14313    pub fn add_scope<St>(mut self, scope: St) -> AccounttaxCustombatchCall<'a, C>
14314    where
14315        St: AsRef<str>,
14316    {
14317        self._scopes.insert(String::from(scope.as_ref()));
14318        self
14319    }
14320    /// Identifies the authorization scope(s) for the method you are building.
14321    ///
14322    /// See [`Self::add_scope()`] for details.
14323    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccounttaxCustombatchCall<'a, C>
14324    where
14325        I: IntoIterator<Item = St>,
14326        St: AsRef<str>,
14327    {
14328        self._scopes
14329            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14330        self
14331    }
14332
14333    /// Removes all scopes, and no default scope will be used either.
14334    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14335    /// for details).
14336    pub fn clear_scopes(mut self) -> AccounttaxCustombatchCall<'a, C> {
14337        self._scopes.clear();
14338        self
14339    }
14340}
14341
14342/// Retrieves the tax settings of the account.
14343///
14344/// A builder for the *get* method supported by a *accounttax* resource.
14345/// It is not used directly, but through a [`AccounttaxMethods`] instance.
14346///
14347/// # Example
14348///
14349/// Instantiate a resource method builder
14350///
14351/// ```test_harness,no_run
14352/// # extern crate hyper;
14353/// # extern crate hyper_rustls;
14354/// # extern crate google_content2 as content2;
14355/// # async fn dox() {
14356/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14357///
14358/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14359/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14360/// #     .with_native_roots()
14361/// #     .unwrap()
14362/// #     .https_only()
14363/// #     .enable_http2()
14364/// #     .build();
14365///
14366/// # let executor = hyper_util::rt::TokioExecutor::new();
14367/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14368/// #     secret,
14369/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14370/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14371/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14372/// #     ),
14373/// # ).build().await.unwrap();
14374///
14375/// # let client = hyper_util::client::legacy::Client::builder(
14376/// #     hyper_util::rt::TokioExecutor::new()
14377/// # )
14378/// # .build(
14379/// #     hyper_rustls::HttpsConnectorBuilder::new()
14380/// #         .with_native_roots()
14381/// #         .unwrap()
14382/// #         .https_or_http()
14383/// #         .enable_http2()
14384/// #         .build()
14385/// # );
14386/// # let mut hub = ShoppingContent::new(client, auth);
14387/// // You can configure optional parameters by calling the respective setters at will, and
14388/// // execute the final call using `doit()`.
14389/// // Values shown here are possibly random and not representative !
14390/// let result = hub.accounttax().get(9, 52)
14391///              .doit().await;
14392/// # }
14393/// ```
14394pub struct AccounttaxGetCall<'a, C>
14395where
14396    C: 'a,
14397{
14398    hub: &'a ShoppingContent<C>,
14399    _merchant_id: u64,
14400    _account_id: u64,
14401    _delegate: Option<&'a mut dyn common::Delegate>,
14402    _additional_params: HashMap<String, String>,
14403    _scopes: BTreeSet<String>,
14404}
14405
14406impl<'a, C> common::CallBuilder for AccounttaxGetCall<'a, C> {}
14407
14408impl<'a, C> AccounttaxGetCall<'a, C>
14409where
14410    C: common::Connector,
14411{
14412    /// Perform the operation you have build so far.
14413    pub async fn doit(mut self) -> common::Result<(common::Response, AccountTax)> {
14414        use std::borrow::Cow;
14415        use std::io::{Read, Seek};
14416
14417        use common::{url::Params, ToParts};
14418        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14419
14420        let mut dd = common::DefaultDelegate;
14421        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14422        dlg.begin(common::MethodInfo {
14423            id: "content.accounttax.get",
14424            http_method: hyper::Method::GET,
14425        });
14426
14427        for &field in ["alt", "merchantId", "accountId"].iter() {
14428            if self._additional_params.contains_key(field) {
14429                dlg.finished(false);
14430                return Err(common::Error::FieldClash(field));
14431            }
14432        }
14433
14434        let mut params = Params::with_capacity(4 + self._additional_params.len());
14435        params.push("merchantId", self._merchant_id.to_string());
14436        params.push("accountId", self._account_id.to_string());
14437
14438        params.extend(self._additional_params.iter());
14439
14440        params.push("alt", "json");
14441        let mut url = self.hub._base_url.clone() + "{merchantId}/accounttax/{accountId}";
14442        if self._scopes.is_empty() {
14443            self._scopes.insert(Scope::Full.as_ref().to_string());
14444        }
14445
14446        #[allow(clippy::single_element_loop)]
14447        for &(find_this, param_name) in
14448            [("{merchantId}", "merchantId"), ("{accountId}", "accountId")].iter()
14449        {
14450            url = params.uri_replacement(url, param_name, find_this, false);
14451        }
14452        {
14453            let to_remove = ["accountId", "merchantId"];
14454            params.remove_params(&to_remove);
14455        }
14456
14457        let url = params.parse_with_url(&url);
14458
14459        loop {
14460            let token = match self
14461                .hub
14462                .auth
14463                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14464                .await
14465            {
14466                Ok(token) => token,
14467                Err(e) => match dlg.token(e) {
14468                    Ok(token) => token,
14469                    Err(e) => {
14470                        dlg.finished(false);
14471                        return Err(common::Error::MissingToken(e));
14472                    }
14473                },
14474            };
14475            let mut req_result = {
14476                let client = &self.hub.client;
14477                dlg.pre_request();
14478                let mut req_builder = hyper::Request::builder()
14479                    .method(hyper::Method::GET)
14480                    .uri(url.as_str())
14481                    .header(USER_AGENT, self.hub._user_agent.clone());
14482
14483                if let Some(token) = token.as_ref() {
14484                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14485                }
14486
14487                let request = req_builder
14488                    .header(CONTENT_LENGTH, 0_u64)
14489                    .body(common::to_body::<String>(None));
14490
14491                client.request(request.unwrap()).await
14492            };
14493
14494            match req_result {
14495                Err(err) => {
14496                    if let common::Retry::After(d) = dlg.http_error(&err) {
14497                        sleep(d).await;
14498                        continue;
14499                    }
14500                    dlg.finished(false);
14501                    return Err(common::Error::HttpError(err));
14502                }
14503                Ok(res) => {
14504                    let (mut parts, body) = res.into_parts();
14505                    let mut body = common::Body::new(body);
14506                    if !parts.status.is_success() {
14507                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14508                        let error = serde_json::from_str(&common::to_string(&bytes));
14509                        let response = common::to_response(parts, bytes.into());
14510
14511                        if let common::Retry::After(d) =
14512                            dlg.http_failure(&response, error.as_ref().ok())
14513                        {
14514                            sleep(d).await;
14515                            continue;
14516                        }
14517
14518                        dlg.finished(false);
14519
14520                        return Err(match error {
14521                            Ok(value) => common::Error::BadRequest(value),
14522                            _ => common::Error::Failure(response),
14523                        });
14524                    }
14525                    let response = {
14526                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14527                        let encoded = common::to_string(&bytes);
14528                        match serde_json::from_str(&encoded) {
14529                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14530                            Err(error) => {
14531                                dlg.response_json_decode_error(&encoded, &error);
14532                                return Err(common::Error::JsonDecodeError(
14533                                    encoded.to_string(),
14534                                    error,
14535                                ));
14536                            }
14537                        }
14538                    };
14539
14540                    dlg.finished(true);
14541                    return Ok(response);
14542                }
14543            }
14544        }
14545    }
14546
14547    /// The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
14548    ///
14549    /// Sets the *merchant id* path property to the given value.
14550    ///
14551    /// Even though the property as already been set when instantiating this call,
14552    /// we provide this method for API completeness.
14553    pub fn merchant_id(mut self, new_value: u64) -> AccounttaxGetCall<'a, C> {
14554        self._merchant_id = new_value;
14555        self
14556    }
14557    /// The ID of the account for which to get/update account tax settings.
14558    ///
14559    /// Sets the *account id* path property to the given value.
14560    ///
14561    /// Even though the property as already been set when instantiating this call,
14562    /// we provide this method for API completeness.
14563    pub fn account_id(mut self, new_value: u64) -> AccounttaxGetCall<'a, C> {
14564        self._account_id = new_value;
14565        self
14566    }
14567    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14568    /// while executing the actual API request.
14569    ///
14570    /// ````text
14571    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14572    /// ````
14573    ///
14574    /// Sets the *delegate* property to the given value.
14575    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccounttaxGetCall<'a, C> {
14576        self._delegate = Some(new_value);
14577        self
14578    }
14579
14580    /// Set any additional parameter of the query string used in the request.
14581    /// It should be used to set parameters which are not yet available through their own
14582    /// setters.
14583    ///
14584    /// Please note that this method must not be used to set any of the known parameters
14585    /// which have their own setter method. If done anyway, the request will fail.
14586    ///
14587    /// # Additional Parameters
14588    ///
14589    /// * *$.xgafv* (query-string) - V1 error format.
14590    /// * *access_token* (query-string) - OAuth access token.
14591    /// * *alt* (query-string) - Data format for response.
14592    /// * *callback* (query-string) - JSONP
14593    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14594    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14595    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14596    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14597    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14598    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14599    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14600    pub fn param<T>(mut self, name: T, value: T) -> AccounttaxGetCall<'a, C>
14601    where
14602        T: AsRef<str>,
14603    {
14604        self._additional_params
14605            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14606        self
14607    }
14608
14609    /// Identifies the authorization scope for the method you are building.
14610    ///
14611    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14612    /// [`Scope::Full`].
14613    ///
14614    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14615    /// tokens for more than one scope.
14616    ///
14617    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14618    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14619    /// sufficient, a read-write scope will do as well.
14620    pub fn add_scope<St>(mut self, scope: St) -> AccounttaxGetCall<'a, C>
14621    where
14622        St: AsRef<str>,
14623    {
14624        self._scopes.insert(String::from(scope.as_ref()));
14625        self
14626    }
14627    /// Identifies the authorization scope(s) for the method you are building.
14628    ///
14629    /// See [`Self::add_scope()`] for details.
14630    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccounttaxGetCall<'a, C>
14631    where
14632        I: IntoIterator<Item = St>,
14633        St: AsRef<str>,
14634    {
14635        self._scopes
14636            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14637        self
14638    }
14639
14640    /// Removes all scopes, and no default scope will be used either.
14641    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14642    /// for details).
14643    pub fn clear_scopes(mut self) -> AccounttaxGetCall<'a, C> {
14644        self._scopes.clear();
14645        self
14646    }
14647}
14648
14649/// Lists the tax settings of the sub-accounts in your Merchant Center account.
14650///
14651/// A builder for the *list* method supported by a *accounttax* resource.
14652/// It is not used directly, but through a [`AccounttaxMethods`] instance.
14653///
14654/// # Example
14655///
14656/// Instantiate a resource method builder
14657///
14658/// ```test_harness,no_run
14659/// # extern crate hyper;
14660/// # extern crate hyper_rustls;
14661/// # extern crate google_content2 as content2;
14662/// # async fn dox() {
14663/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14664///
14665/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14666/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14667/// #     .with_native_roots()
14668/// #     .unwrap()
14669/// #     .https_only()
14670/// #     .enable_http2()
14671/// #     .build();
14672///
14673/// # let executor = hyper_util::rt::TokioExecutor::new();
14674/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14675/// #     secret,
14676/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14677/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14678/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14679/// #     ),
14680/// # ).build().await.unwrap();
14681///
14682/// # let client = hyper_util::client::legacy::Client::builder(
14683/// #     hyper_util::rt::TokioExecutor::new()
14684/// # )
14685/// # .build(
14686/// #     hyper_rustls::HttpsConnectorBuilder::new()
14687/// #         .with_native_roots()
14688/// #         .unwrap()
14689/// #         .https_or_http()
14690/// #         .enable_http2()
14691/// #         .build()
14692/// # );
14693/// # let mut hub = ShoppingContent::new(client, auth);
14694/// // You can configure optional parameters by calling the respective setters at will, and
14695/// // execute the final call using `doit()`.
14696/// // Values shown here are possibly random and not representative !
14697/// let result = hub.accounttax().list(83)
14698///              .page_token("et")
14699///              .max_results(6)
14700///              .doit().await;
14701/// # }
14702/// ```
14703pub struct AccounttaxListCall<'a, C>
14704where
14705    C: 'a,
14706{
14707    hub: &'a ShoppingContent<C>,
14708    _merchant_id: u64,
14709    _page_token: Option<String>,
14710    _max_results: Option<u32>,
14711    _delegate: Option<&'a mut dyn common::Delegate>,
14712    _additional_params: HashMap<String, String>,
14713    _scopes: BTreeSet<String>,
14714}
14715
14716impl<'a, C> common::CallBuilder for AccounttaxListCall<'a, C> {}
14717
14718impl<'a, C> AccounttaxListCall<'a, C>
14719where
14720    C: common::Connector,
14721{
14722    /// Perform the operation you have build so far.
14723    pub async fn doit(mut self) -> common::Result<(common::Response, AccounttaxListResponse)> {
14724        use std::borrow::Cow;
14725        use std::io::{Read, Seek};
14726
14727        use common::{url::Params, ToParts};
14728        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14729
14730        let mut dd = common::DefaultDelegate;
14731        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14732        dlg.begin(common::MethodInfo {
14733            id: "content.accounttax.list",
14734            http_method: hyper::Method::GET,
14735        });
14736
14737        for &field in ["alt", "merchantId", "pageToken", "maxResults"].iter() {
14738            if self._additional_params.contains_key(field) {
14739                dlg.finished(false);
14740                return Err(common::Error::FieldClash(field));
14741            }
14742        }
14743
14744        let mut params = Params::with_capacity(5 + self._additional_params.len());
14745        params.push("merchantId", self._merchant_id.to_string());
14746        if let Some(value) = self._page_token.as_ref() {
14747            params.push("pageToken", value);
14748        }
14749        if let Some(value) = self._max_results.as_ref() {
14750            params.push("maxResults", value.to_string());
14751        }
14752
14753        params.extend(self._additional_params.iter());
14754
14755        params.push("alt", "json");
14756        let mut url = self.hub._base_url.clone() + "{merchantId}/accounttax";
14757        if self._scopes.is_empty() {
14758            self._scopes.insert(Scope::Full.as_ref().to_string());
14759        }
14760
14761        #[allow(clippy::single_element_loop)]
14762        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
14763            url = params.uri_replacement(url, param_name, find_this, false);
14764        }
14765        {
14766            let to_remove = ["merchantId"];
14767            params.remove_params(&to_remove);
14768        }
14769
14770        let url = params.parse_with_url(&url);
14771
14772        loop {
14773            let token = match self
14774                .hub
14775                .auth
14776                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14777                .await
14778            {
14779                Ok(token) => token,
14780                Err(e) => match dlg.token(e) {
14781                    Ok(token) => token,
14782                    Err(e) => {
14783                        dlg.finished(false);
14784                        return Err(common::Error::MissingToken(e));
14785                    }
14786                },
14787            };
14788            let mut req_result = {
14789                let client = &self.hub.client;
14790                dlg.pre_request();
14791                let mut req_builder = hyper::Request::builder()
14792                    .method(hyper::Method::GET)
14793                    .uri(url.as_str())
14794                    .header(USER_AGENT, self.hub._user_agent.clone());
14795
14796                if let Some(token) = token.as_ref() {
14797                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14798                }
14799
14800                let request = req_builder
14801                    .header(CONTENT_LENGTH, 0_u64)
14802                    .body(common::to_body::<String>(None));
14803
14804                client.request(request.unwrap()).await
14805            };
14806
14807            match req_result {
14808                Err(err) => {
14809                    if let common::Retry::After(d) = dlg.http_error(&err) {
14810                        sleep(d).await;
14811                        continue;
14812                    }
14813                    dlg.finished(false);
14814                    return Err(common::Error::HttpError(err));
14815                }
14816                Ok(res) => {
14817                    let (mut parts, body) = res.into_parts();
14818                    let mut body = common::Body::new(body);
14819                    if !parts.status.is_success() {
14820                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14821                        let error = serde_json::from_str(&common::to_string(&bytes));
14822                        let response = common::to_response(parts, bytes.into());
14823
14824                        if let common::Retry::After(d) =
14825                            dlg.http_failure(&response, error.as_ref().ok())
14826                        {
14827                            sleep(d).await;
14828                            continue;
14829                        }
14830
14831                        dlg.finished(false);
14832
14833                        return Err(match error {
14834                            Ok(value) => common::Error::BadRequest(value),
14835                            _ => common::Error::Failure(response),
14836                        });
14837                    }
14838                    let response = {
14839                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14840                        let encoded = common::to_string(&bytes);
14841                        match serde_json::from_str(&encoded) {
14842                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14843                            Err(error) => {
14844                                dlg.response_json_decode_error(&encoded, &error);
14845                                return Err(common::Error::JsonDecodeError(
14846                                    encoded.to_string(),
14847                                    error,
14848                                ));
14849                            }
14850                        }
14851                    };
14852
14853                    dlg.finished(true);
14854                    return Ok(response);
14855                }
14856            }
14857        }
14858    }
14859
14860    /// The ID of the managing account. This must be a multi-client account.
14861    ///
14862    /// Sets the *merchant id* path property to the given value.
14863    ///
14864    /// Even though the property as already been set when instantiating this call,
14865    /// we provide this method for API completeness.
14866    pub fn merchant_id(mut self, new_value: u64) -> AccounttaxListCall<'a, C> {
14867        self._merchant_id = new_value;
14868        self
14869    }
14870    /// The token returned by the previous request.
14871    ///
14872    /// Sets the *page token* query property to the given value.
14873    pub fn page_token(mut self, new_value: &str) -> AccounttaxListCall<'a, C> {
14874        self._page_token = Some(new_value.to_string());
14875        self
14876    }
14877    /// The maximum number of tax settings to return in the response, used for paging.
14878    ///
14879    /// Sets the *max results* query property to the given value.
14880    pub fn max_results(mut self, new_value: u32) -> AccounttaxListCall<'a, C> {
14881        self._max_results = Some(new_value);
14882        self
14883    }
14884    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14885    /// while executing the actual API request.
14886    ///
14887    /// ````text
14888    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14889    /// ````
14890    ///
14891    /// Sets the *delegate* property to the given value.
14892    pub fn delegate(
14893        mut self,
14894        new_value: &'a mut dyn common::Delegate,
14895    ) -> AccounttaxListCall<'a, C> {
14896        self._delegate = Some(new_value);
14897        self
14898    }
14899
14900    /// Set any additional parameter of the query string used in the request.
14901    /// It should be used to set parameters which are not yet available through their own
14902    /// setters.
14903    ///
14904    /// Please note that this method must not be used to set any of the known parameters
14905    /// which have their own setter method. If done anyway, the request will fail.
14906    ///
14907    /// # Additional Parameters
14908    ///
14909    /// * *$.xgafv* (query-string) - V1 error format.
14910    /// * *access_token* (query-string) - OAuth access token.
14911    /// * *alt* (query-string) - Data format for response.
14912    /// * *callback* (query-string) - JSONP
14913    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14914    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14915    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14916    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14917    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14918    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14919    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14920    pub fn param<T>(mut self, name: T, value: T) -> AccounttaxListCall<'a, C>
14921    where
14922        T: AsRef<str>,
14923    {
14924        self._additional_params
14925            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14926        self
14927    }
14928
14929    /// Identifies the authorization scope for the method you are building.
14930    ///
14931    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14932    /// [`Scope::Full`].
14933    ///
14934    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14935    /// tokens for more than one scope.
14936    ///
14937    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14938    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14939    /// sufficient, a read-write scope will do as well.
14940    pub fn add_scope<St>(mut self, scope: St) -> AccounttaxListCall<'a, C>
14941    where
14942        St: AsRef<str>,
14943    {
14944        self._scopes.insert(String::from(scope.as_ref()));
14945        self
14946    }
14947    /// Identifies the authorization scope(s) for the method you are building.
14948    ///
14949    /// See [`Self::add_scope()`] for details.
14950    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccounttaxListCall<'a, C>
14951    where
14952        I: IntoIterator<Item = St>,
14953        St: AsRef<str>,
14954    {
14955        self._scopes
14956            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14957        self
14958    }
14959
14960    /// Removes all scopes, and no default scope will be used either.
14961    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14962    /// for details).
14963    pub fn clear_scopes(mut self) -> AccounttaxListCall<'a, C> {
14964        self._scopes.clear();
14965        self
14966    }
14967}
14968
14969/// Updates the tax settings of the account. Any fields that are not provided are deleted from the resource.
14970///
14971/// A builder for the *update* method supported by a *accounttax* resource.
14972/// It is not used directly, but through a [`AccounttaxMethods`] instance.
14973///
14974/// # Example
14975///
14976/// Instantiate a resource method builder
14977///
14978/// ```test_harness,no_run
14979/// # extern crate hyper;
14980/// # extern crate hyper_rustls;
14981/// # extern crate google_content2 as content2;
14982/// use content2::api::AccountTax;
14983/// # async fn dox() {
14984/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14985///
14986/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14987/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14988/// #     .with_native_roots()
14989/// #     .unwrap()
14990/// #     .https_only()
14991/// #     .enable_http2()
14992/// #     .build();
14993///
14994/// # let executor = hyper_util::rt::TokioExecutor::new();
14995/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14996/// #     secret,
14997/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14998/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14999/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15000/// #     ),
15001/// # ).build().await.unwrap();
15002///
15003/// # let client = hyper_util::client::legacy::Client::builder(
15004/// #     hyper_util::rt::TokioExecutor::new()
15005/// # )
15006/// # .build(
15007/// #     hyper_rustls::HttpsConnectorBuilder::new()
15008/// #         .with_native_roots()
15009/// #         .unwrap()
15010/// #         .https_or_http()
15011/// #         .enable_http2()
15012/// #         .build()
15013/// # );
15014/// # let mut hub = ShoppingContent::new(client, auth);
15015/// // As the method needs a request, you would usually fill it with the desired information
15016/// // into the respective structure. Some of the parts shown here might not be applicable !
15017/// // Values shown here are possibly random and not representative !
15018/// let mut req = AccountTax::default();
15019///
15020/// // You can configure optional parameters by calling the respective setters at will, and
15021/// // execute the final call using `doit()`.
15022/// // Values shown here are possibly random and not representative !
15023/// let result = hub.accounttax().update(req, 86, 2)
15024///              .dry_run(false)
15025///              .doit().await;
15026/// # }
15027/// ```
15028pub struct AccounttaxUpdateCall<'a, C>
15029where
15030    C: 'a,
15031{
15032    hub: &'a ShoppingContent<C>,
15033    _request: AccountTax,
15034    _merchant_id: u64,
15035    _account_id: u64,
15036    _dry_run: Option<bool>,
15037    _delegate: Option<&'a mut dyn common::Delegate>,
15038    _additional_params: HashMap<String, String>,
15039    _scopes: BTreeSet<String>,
15040}
15041
15042impl<'a, C> common::CallBuilder for AccounttaxUpdateCall<'a, C> {}
15043
15044impl<'a, C> AccounttaxUpdateCall<'a, C>
15045where
15046    C: common::Connector,
15047{
15048    /// Perform the operation you have build so far.
15049    pub async fn doit(mut self) -> common::Result<(common::Response, AccountTax)> {
15050        use std::borrow::Cow;
15051        use std::io::{Read, Seek};
15052
15053        use common::{url::Params, ToParts};
15054        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15055
15056        let mut dd = common::DefaultDelegate;
15057        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15058        dlg.begin(common::MethodInfo {
15059            id: "content.accounttax.update",
15060            http_method: hyper::Method::PUT,
15061        });
15062
15063        for &field in ["alt", "merchantId", "accountId", "dryRun"].iter() {
15064            if self._additional_params.contains_key(field) {
15065                dlg.finished(false);
15066                return Err(common::Error::FieldClash(field));
15067            }
15068        }
15069
15070        let mut params = Params::with_capacity(6 + self._additional_params.len());
15071        params.push("merchantId", self._merchant_id.to_string());
15072        params.push("accountId", self._account_id.to_string());
15073        if let Some(value) = self._dry_run.as_ref() {
15074            params.push("dryRun", value.to_string());
15075        }
15076
15077        params.extend(self._additional_params.iter());
15078
15079        params.push("alt", "json");
15080        let mut url = self.hub._base_url.clone() + "{merchantId}/accounttax/{accountId}";
15081        if self._scopes.is_empty() {
15082            self._scopes.insert(Scope::Full.as_ref().to_string());
15083        }
15084
15085        #[allow(clippy::single_element_loop)]
15086        for &(find_this, param_name) in
15087            [("{merchantId}", "merchantId"), ("{accountId}", "accountId")].iter()
15088        {
15089            url = params.uri_replacement(url, param_name, find_this, false);
15090        }
15091        {
15092            let to_remove = ["accountId", "merchantId"];
15093            params.remove_params(&to_remove);
15094        }
15095
15096        let url = params.parse_with_url(&url);
15097
15098        let mut json_mime_type = mime::APPLICATION_JSON;
15099        let mut request_value_reader = {
15100            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15101            common::remove_json_null_values(&mut value);
15102            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15103            serde_json::to_writer(&mut dst, &value).unwrap();
15104            dst
15105        };
15106        let request_size = request_value_reader
15107            .seek(std::io::SeekFrom::End(0))
15108            .unwrap();
15109        request_value_reader
15110            .seek(std::io::SeekFrom::Start(0))
15111            .unwrap();
15112
15113        loop {
15114            let token = match self
15115                .hub
15116                .auth
15117                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15118                .await
15119            {
15120                Ok(token) => token,
15121                Err(e) => match dlg.token(e) {
15122                    Ok(token) => token,
15123                    Err(e) => {
15124                        dlg.finished(false);
15125                        return Err(common::Error::MissingToken(e));
15126                    }
15127                },
15128            };
15129            request_value_reader
15130                .seek(std::io::SeekFrom::Start(0))
15131                .unwrap();
15132            let mut req_result = {
15133                let client = &self.hub.client;
15134                dlg.pre_request();
15135                let mut req_builder = hyper::Request::builder()
15136                    .method(hyper::Method::PUT)
15137                    .uri(url.as_str())
15138                    .header(USER_AGENT, self.hub._user_agent.clone());
15139
15140                if let Some(token) = token.as_ref() {
15141                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15142                }
15143
15144                let request = req_builder
15145                    .header(CONTENT_TYPE, json_mime_type.to_string())
15146                    .header(CONTENT_LENGTH, request_size as u64)
15147                    .body(common::to_body(
15148                        request_value_reader.get_ref().clone().into(),
15149                    ));
15150
15151                client.request(request.unwrap()).await
15152            };
15153
15154            match req_result {
15155                Err(err) => {
15156                    if let common::Retry::After(d) = dlg.http_error(&err) {
15157                        sleep(d).await;
15158                        continue;
15159                    }
15160                    dlg.finished(false);
15161                    return Err(common::Error::HttpError(err));
15162                }
15163                Ok(res) => {
15164                    let (mut parts, body) = res.into_parts();
15165                    let mut body = common::Body::new(body);
15166                    if !parts.status.is_success() {
15167                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15168                        let error = serde_json::from_str(&common::to_string(&bytes));
15169                        let response = common::to_response(parts, bytes.into());
15170
15171                        if let common::Retry::After(d) =
15172                            dlg.http_failure(&response, error.as_ref().ok())
15173                        {
15174                            sleep(d).await;
15175                            continue;
15176                        }
15177
15178                        dlg.finished(false);
15179
15180                        return Err(match error {
15181                            Ok(value) => common::Error::BadRequest(value),
15182                            _ => common::Error::Failure(response),
15183                        });
15184                    }
15185                    let response = {
15186                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15187                        let encoded = common::to_string(&bytes);
15188                        match serde_json::from_str(&encoded) {
15189                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15190                            Err(error) => {
15191                                dlg.response_json_decode_error(&encoded, &error);
15192                                return Err(common::Error::JsonDecodeError(
15193                                    encoded.to_string(),
15194                                    error,
15195                                ));
15196                            }
15197                        }
15198                    };
15199
15200                    dlg.finished(true);
15201                    return Ok(response);
15202                }
15203            }
15204        }
15205    }
15206
15207    ///
15208    /// Sets the *request* property to the given value.
15209    ///
15210    /// Even though the property as already been set when instantiating this call,
15211    /// we provide this method for API completeness.
15212    pub fn request(mut self, new_value: AccountTax) -> AccounttaxUpdateCall<'a, C> {
15213        self._request = new_value;
15214        self
15215    }
15216    /// The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
15217    ///
15218    /// Sets the *merchant id* path property to the given value.
15219    ///
15220    /// Even though the property as already been set when instantiating this call,
15221    /// we provide this method for API completeness.
15222    pub fn merchant_id(mut self, new_value: u64) -> AccounttaxUpdateCall<'a, C> {
15223        self._merchant_id = new_value;
15224        self
15225    }
15226    /// The ID of the account for which to get/update account tax settings.
15227    ///
15228    /// Sets the *account id* path property to the given value.
15229    ///
15230    /// Even though the property as already been set when instantiating this call,
15231    /// we provide this method for API completeness.
15232    pub fn account_id(mut self, new_value: u64) -> AccounttaxUpdateCall<'a, C> {
15233        self._account_id = new_value;
15234        self
15235    }
15236    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
15237    ///
15238    /// Sets the *dry run* query property to the given value.
15239    pub fn dry_run(mut self, new_value: bool) -> AccounttaxUpdateCall<'a, C> {
15240        self._dry_run = Some(new_value);
15241        self
15242    }
15243    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15244    /// while executing the actual API request.
15245    ///
15246    /// ````text
15247    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15248    /// ````
15249    ///
15250    /// Sets the *delegate* property to the given value.
15251    pub fn delegate(
15252        mut self,
15253        new_value: &'a mut dyn common::Delegate,
15254    ) -> AccounttaxUpdateCall<'a, C> {
15255        self._delegate = Some(new_value);
15256        self
15257    }
15258
15259    /// Set any additional parameter of the query string used in the request.
15260    /// It should be used to set parameters which are not yet available through their own
15261    /// setters.
15262    ///
15263    /// Please note that this method must not be used to set any of the known parameters
15264    /// which have their own setter method. If done anyway, the request will fail.
15265    ///
15266    /// # Additional Parameters
15267    ///
15268    /// * *$.xgafv* (query-string) - V1 error format.
15269    /// * *access_token* (query-string) - OAuth access token.
15270    /// * *alt* (query-string) - Data format for response.
15271    /// * *callback* (query-string) - JSONP
15272    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15273    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15274    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15275    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15276    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15277    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15278    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15279    pub fn param<T>(mut self, name: T, value: T) -> AccounttaxUpdateCall<'a, C>
15280    where
15281        T: AsRef<str>,
15282    {
15283        self._additional_params
15284            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15285        self
15286    }
15287
15288    /// Identifies the authorization scope for the method you are building.
15289    ///
15290    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15291    /// [`Scope::Full`].
15292    ///
15293    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15294    /// tokens for more than one scope.
15295    ///
15296    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15297    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15298    /// sufficient, a read-write scope will do as well.
15299    pub fn add_scope<St>(mut self, scope: St) -> AccounttaxUpdateCall<'a, C>
15300    where
15301        St: AsRef<str>,
15302    {
15303        self._scopes.insert(String::from(scope.as_ref()));
15304        self
15305    }
15306    /// Identifies the authorization scope(s) for the method you are building.
15307    ///
15308    /// See [`Self::add_scope()`] for details.
15309    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccounttaxUpdateCall<'a, C>
15310    where
15311        I: IntoIterator<Item = St>,
15312        St: AsRef<str>,
15313    {
15314        self._scopes
15315            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15316        self
15317    }
15318
15319    /// Removes all scopes, and no default scope will be used either.
15320    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15321    /// for details).
15322    pub fn clear_scopes(mut self) -> AccounttaxUpdateCall<'a, C> {
15323        self._scopes.clear();
15324        self
15325    }
15326}
15327
15328/// Deletes, fetches, gets, inserts and updates multiple datafeeds in a single request.
15329///
15330/// A builder for the *custombatch* method supported by a *datafeed* resource.
15331/// It is not used directly, but through a [`DatafeedMethods`] instance.
15332///
15333/// # Example
15334///
15335/// Instantiate a resource method builder
15336///
15337/// ```test_harness,no_run
15338/// # extern crate hyper;
15339/// # extern crate hyper_rustls;
15340/// # extern crate google_content2 as content2;
15341/// use content2::api::DatafeedsCustomBatchRequest;
15342/// # async fn dox() {
15343/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15344///
15345/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15346/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15347/// #     .with_native_roots()
15348/// #     .unwrap()
15349/// #     .https_only()
15350/// #     .enable_http2()
15351/// #     .build();
15352///
15353/// # let executor = hyper_util::rt::TokioExecutor::new();
15354/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15355/// #     secret,
15356/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15357/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15358/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15359/// #     ),
15360/// # ).build().await.unwrap();
15361///
15362/// # let client = hyper_util::client::legacy::Client::builder(
15363/// #     hyper_util::rt::TokioExecutor::new()
15364/// # )
15365/// # .build(
15366/// #     hyper_rustls::HttpsConnectorBuilder::new()
15367/// #         .with_native_roots()
15368/// #         .unwrap()
15369/// #         .https_or_http()
15370/// #         .enable_http2()
15371/// #         .build()
15372/// # );
15373/// # let mut hub = ShoppingContent::new(client, auth);
15374/// // As the method needs a request, you would usually fill it with the desired information
15375/// // into the respective structure. Some of the parts shown here might not be applicable !
15376/// // Values shown here are possibly random and not representative !
15377/// let mut req = DatafeedsCustomBatchRequest::default();
15378///
15379/// // You can configure optional parameters by calling the respective setters at will, and
15380/// // execute the final call using `doit()`.
15381/// // Values shown here are possibly random and not representative !
15382/// let result = hub.datafeeds().custombatch(req)
15383///              .dry_run(false)
15384///              .doit().await;
15385/// # }
15386/// ```
15387pub struct DatafeedCustombatchCall<'a, C>
15388where
15389    C: 'a,
15390{
15391    hub: &'a ShoppingContent<C>,
15392    _request: DatafeedsCustomBatchRequest,
15393    _dry_run: Option<bool>,
15394    _delegate: Option<&'a mut dyn common::Delegate>,
15395    _additional_params: HashMap<String, String>,
15396    _scopes: BTreeSet<String>,
15397}
15398
15399impl<'a, C> common::CallBuilder for DatafeedCustombatchCall<'a, C> {}
15400
15401impl<'a, C> DatafeedCustombatchCall<'a, C>
15402where
15403    C: common::Connector,
15404{
15405    /// Perform the operation you have build so far.
15406    pub async fn doit(
15407        mut self,
15408    ) -> common::Result<(common::Response, DatafeedsCustomBatchResponse)> {
15409        use std::borrow::Cow;
15410        use std::io::{Read, Seek};
15411
15412        use common::{url::Params, ToParts};
15413        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15414
15415        let mut dd = common::DefaultDelegate;
15416        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15417        dlg.begin(common::MethodInfo {
15418            id: "content.datafeeds.custombatch",
15419            http_method: hyper::Method::POST,
15420        });
15421
15422        for &field in ["alt", "dryRun"].iter() {
15423            if self._additional_params.contains_key(field) {
15424                dlg.finished(false);
15425                return Err(common::Error::FieldClash(field));
15426            }
15427        }
15428
15429        let mut params = Params::with_capacity(4 + self._additional_params.len());
15430        if let Some(value) = self._dry_run.as_ref() {
15431            params.push("dryRun", value.to_string());
15432        }
15433
15434        params.extend(self._additional_params.iter());
15435
15436        params.push("alt", "json");
15437        let mut url = self.hub._base_url.clone() + "datafeeds/batch";
15438        if self._scopes.is_empty() {
15439            self._scopes.insert(Scope::Full.as_ref().to_string());
15440        }
15441
15442        let url = params.parse_with_url(&url);
15443
15444        let mut json_mime_type = mime::APPLICATION_JSON;
15445        let mut request_value_reader = {
15446            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15447            common::remove_json_null_values(&mut value);
15448            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15449            serde_json::to_writer(&mut dst, &value).unwrap();
15450            dst
15451        };
15452        let request_size = request_value_reader
15453            .seek(std::io::SeekFrom::End(0))
15454            .unwrap();
15455        request_value_reader
15456            .seek(std::io::SeekFrom::Start(0))
15457            .unwrap();
15458
15459        loop {
15460            let token = match self
15461                .hub
15462                .auth
15463                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15464                .await
15465            {
15466                Ok(token) => token,
15467                Err(e) => match dlg.token(e) {
15468                    Ok(token) => token,
15469                    Err(e) => {
15470                        dlg.finished(false);
15471                        return Err(common::Error::MissingToken(e));
15472                    }
15473                },
15474            };
15475            request_value_reader
15476                .seek(std::io::SeekFrom::Start(0))
15477                .unwrap();
15478            let mut req_result = {
15479                let client = &self.hub.client;
15480                dlg.pre_request();
15481                let mut req_builder = hyper::Request::builder()
15482                    .method(hyper::Method::POST)
15483                    .uri(url.as_str())
15484                    .header(USER_AGENT, self.hub._user_agent.clone());
15485
15486                if let Some(token) = token.as_ref() {
15487                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15488                }
15489
15490                let request = req_builder
15491                    .header(CONTENT_TYPE, json_mime_type.to_string())
15492                    .header(CONTENT_LENGTH, request_size as u64)
15493                    .body(common::to_body(
15494                        request_value_reader.get_ref().clone().into(),
15495                    ));
15496
15497                client.request(request.unwrap()).await
15498            };
15499
15500            match req_result {
15501                Err(err) => {
15502                    if let common::Retry::After(d) = dlg.http_error(&err) {
15503                        sleep(d).await;
15504                        continue;
15505                    }
15506                    dlg.finished(false);
15507                    return Err(common::Error::HttpError(err));
15508                }
15509                Ok(res) => {
15510                    let (mut parts, body) = res.into_parts();
15511                    let mut body = common::Body::new(body);
15512                    if !parts.status.is_success() {
15513                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15514                        let error = serde_json::from_str(&common::to_string(&bytes));
15515                        let response = common::to_response(parts, bytes.into());
15516
15517                        if let common::Retry::After(d) =
15518                            dlg.http_failure(&response, error.as_ref().ok())
15519                        {
15520                            sleep(d).await;
15521                            continue;
15522                        }
15523
15524                        dlg.finished(false);
15525
15526                        return Err(match error {
15527                            Ok(value) => common::Error::BadRequest(value),
15528                            _ => common::Error::Failure(response),
15529                        });
15530                    }
15531                    let response = {
15532                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15533                        let encoded = common::to_string(&bytes);
15534                        match serde_json::from_str(&encoded) {
15535                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15536                            Err(error) => {
15537                                dlg.response_json_decode_error(&encoded, &error);
15538                                return Err(common::Error::JsonDecodeError(
15539                                    encoded.to_string(),
15540                                    error,
15541                                ));
15542                            }
15543                        }
15544                    };
15545
15546                    dlg.finished(true);
15547                    return Ok(response);
15548                }
15549            }
15550        }
15551    }
15552
15553    ///
15554    /// Sets the *request* property to the given value.
15555    ///
15556    /// Even though the property as already been set when instantiating this call,
15557    /// we provide this method for API completeness.
15558    pub fn request(
15559        mut self,
15560        new_value: DatafeedsCustomBatchRequest,
15561    ) -> DatafeedCustombatchCall<'a, C> {
15562        self._request = new_value;
15563        self
15564    }
15565    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
15566    ///
15567    /// Sets the *dry run* query property to the given value.
15568    pub fn dry_run(mut self, new_value: bool) -> DatafeedCustombatchCall<'a, C> {
15569        self._dry_run = Some(new_value);
15570        self
15571    }
15572    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15573    /// while executing the actual API request.
15574    ///
15575    /// ````text
15576    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15577    /// ````
15578    ///
15579    /// Sets the *delegate* property to the given value.
15580    pub fn delegate(
15581        mut self,
15582        new_value: &'a mut dyn common::Delegate,
15583    ) -> DatafeedCustombatchCall<'a, C> {
15584        self._delegate = Some(new_value);
15585        self
15586    }
15587
15588    /// Set any additional parameter of the query string used in the request.
15589    /// It should be used to set parameters which are not yet available through their own
15590    /// setters.
15591    ///
15592    /// Please note that this method must not be used to set any of the known parameters
15593    /// which have their own setter method. If done anyway, the request will fail.
15594    ///
15595    /// # Additional Parameters
15596    ///
15597    /// * *$.xgafv* (query-string) - V1 error format.
15598    /// * *access_token* (query-string) - OAuth access token.
15599    /// * *alt* (query-string) - Data format for response.
15600    /// * *callback* (query-string) - JSONP
15601    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15602    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15603    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15604    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15605    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15606    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15607    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15608    pub fn param<T>(mut self, name: T, value: T) -> DatafeedCustombatchCall<'a, C>
15609    where
15610        T: AsRef<str>,
15611    {
15612        self._additional_params
15613            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15614        self
15615    }
15616
15617    /// Identifies the authorization scope for the method you are building.
15618    ///
15619    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15620    /// [`Scope::Full`].
15621    ///
15622    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15623    /// tokens for more than one scope.
15624    ///
15625    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15626    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15627    /// sufficient, a read-write scope will do as well.
15628    pub fn add_scope<St>(mut self, scope: St) -> DatafeedCustombatchCall<'a, C>
15629    where
15630        St: AsRef<str>,
15631    {
15632        self._scopes.insert(String::from(scope.as_ref()));
15633        self
15634    }
15635    /// Identifies the authorization scope(s) for the method you are building.
15636    ///
15637    /// See [`Self::add_scope()`] for details.
15638    pub fn add_scopes<I, St>(mut self, scopes: I) -> DatafeedCustombatchCall<'a, C>
15639    where
15640        I: IntoIterator<Item = St>,
15641        St: AsRef<str>,
15642    {
15643        self._scopes
15644            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15645        self
15646    }
15647
15648    /// Removes all scopes, and no default scope will be used either.
15649    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15650    /// for details).
15651    pub fn clear_scopes(mut self) -> DatafeedCustombatchCall<'a, C> {
15652        self._scopes.clear();
15653        self
15654    }
15655}
15656
15657/// Deletes a datafeed configuration from your Merchant Center account.
15658///
15659/// A builder for the *delete* method supported by a *datafeed* resource.
15660/// It is not used directly, but through a [`DatafeedMethods`] instance.
15661///
15662/// # Example
15663///
15664/// Instantiate a resource method builder
15665///
15666/// ```test_harness,no_run
15667/// # extern crate hyper;
15668/// # extern crate hyper_rustls;
15669/// # extern crate google_content2 as content2;
15670/// # async fn dox() {
15671/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15672///
15673/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15674/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15675/// #     .with_native_roots()
15676/// #     .unwrap()
15677/// #     .https_only()
15678/// #     .enable_http2()
15679/// #     .build();
15680///
15681/// # let executor = hyper_util::rt::TokioExecutor::new();
15682/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15683/// #     secret,
15684/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15685/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15686/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15687/// #     ),
15688/// # ).build().await.unwrap();
15689///
15690/// # let client = hyper_util::client::legacy::Client::builder(
15691/// #     hyper_util::rt::TokioExecutor::new()
15692/// # )
15693/// # .build(
15694/// #     hyper_rustls::HttpsConnectorBuilder::new()
15695/// #         .with_native_roots()
15696/// #         .unwrap()
15697/// #         .https_or_http()
15698/// #         .enable_http2()
15699/// #         .build()
15700/// # );
15701/// # let mut hub = ShoppingContent::new(client, auth);
15702/// // You can configure optional parameters by calling the respective setters at will, and
15703/// // execute the final call using `doit()`.
15704/// // Values shown here are possibly random and not representative !
15705/// let result = hub.datafeeds().delete(13, 36)
15706///              .dry_run(false)
15707///              .doit().await;
15708/// # }
15709/// ```
15710pub struct DatafeedDeleteCall<'a, C>
15711where
15712    C: 'a,
15713{
15714    hub: &'a ShoppingContent<C>,
15715    _merchant_id: u64,
15716    _datafeed_id: u64,
15717    _dry_run: Option<bool>,
15718    _delegate: Option<&'a mut dyn common::Delegate>,
15719    _additional_params: HashMap<String, String>,
15720    _scopes: BTreeSet<String>,
15721}
15722
15723impl<'a, C> common::CallBuilder for DatafeedDeleteCall<'a, C> {}
15724
15725impl<'a, C> DatafeedDeleteCall<'a, C>
15726where
15727    C: common::Connector,
15728{
15729    /// Perform the operation you have build so far.
15730    pub async fn doit(mut self) -> common::Result<common::Response> {
15731        use std::borrow::Cow;
15732        use std::io::{Read, Seek};
15733
15734        use common::{url::Params, ToParts};
15735        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15736
15737        let mut dd = common::DefaultDelegate;
15738        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15739        dlg.begin(common::MethodInfo {
15740            id: "content.datafeeds.delete",
15741            http_method: hyper::Method::DELETE,
15742        });
15743
15744        for &field in ["merchantId", "datafeedId", "dryRun"].iter() {
15745            if self._additional_params.contains_key(field) {
15746                dlg.finished(false);
15747                return Err(common::Error::FieldClash(field));
15748            }
15749        }
15750
15751        let mut params = Params::with_capacity(4 + self._additional_params.len());
15752        params.push("merchantId", self._merchant_id.to_string());
15753        params.push("datafeedId", self._datafeed_id.to_string());
15754        if let Some(value) = self._dry_run.as_ref() {
15755            params.push("dryRun", value.to_string());
15756        }
15757
15758        params.extend(self._additional_params.iter());
15759
15760        let mut url = self.hub._base_url.clone() + "{merchantId}/datafeeds/{datafeedId}";
15761        if self._scopes.is_empty() {
15762            self._scopes.insert(Scope::Full.as_ref().to_string());
15763        }
15764
15765        #[allow(clippy::single_element_loop)]
15766        for &(find_this, param_name) in [
15767            ("{merchantId}", "merchantId"),
15768            ("{datafeedId}", "datafeedId"),
15769        ]
15770        .iter()
15771        {
15772            url = params.uri_replacement(url, param_name, find_this, false);
15773        }
15774        {
15775            let to_remove = ["datafeedId", "merchantId"];
15776            params.remove_params(&to_remove);
15777        }
15778
15779        let url = params.parse_with_url(&url);
15780
15781        loop {
15782            let token = match self
15783                .hub
15784                .auth
15785                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15786                .await
15787            {
15788                Ok(token) => token,
15789                Err(e) => match dlg.token(e) {
15790                    Ok(token) => token,
15791                    Err(e) => {
15792                        dlg.finished(false);
15793                        return Err(common::Error::MissingToken(e));
15794                    }
15795                },
15796            };
15797            let mut req_result = {
15798                let client = &self.hub.client;
15799                dlg.pre_request();
15800                let mut req_builder = hyper::Request::builder()
15801                    .method(hyper::Method::DELETE)
15802                    .uri(url.as_str())
15803                    .header(USER_AGENT, self.hub._user_agent.clone());
15804
15805                if let Some(token) = token.as_ref() {
15806                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15807                }
15808
15809                let request = req_builder
15810                    .header(CONTENT_LENGTH, 0_u64)
15811                    .body(common::to_body::<String>(None));
15812
15813                client.request(request.unwrap()).await
15814            };
15815
15816            match req_result {
15817                Err(err) => {
15818                    if let common::Retry::After(d) = dlg.http_error(&err) {
15819                        sleep(d).await;
15820                        continue;
15821                    }
15822                    dlg.finished(false);
15823                    return Err(common::Error::HttpError(err));
15824                }
15825                Ok(res) => {
15826                    let (mut parts, body) = res.into_parts();
15827                    let mut body = common::Body::new(body);
15828                    if !parts.status.is_success() {
15829                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15830                        let error = serde_json::from_str(&common::to_string(&bytes));
15831                        let response = common::to_response(parts, bytes.into());
15832
15833                        if let common::Retry::After(d) =
15834                            dlg.http_failure(&response, error.as_ref().ok())
15835                        {
15836                            sleep(d).await;
15837                            continue;
15838                        }
15839
15840                        dlg.finished(false);
15841
15842                        return Err(match error {
15843                            Ok(value) => common::Error::BadRequest(value),
15844                            _ => common::Error::Failure(response),
15845                        });
15846                    }
15847                    let response = common::Response::from_parts(parts, body);
15848
15849                    dlg.finished(true);
15850                    return Ok(response);
15851                }
15852            }
15853        }
15854    }
15855
15856    /// The ID of the account that manages the datafeed. This account cannot be a multi-client account.
15857    ///
15858    /// Sets the *merchant id* path property to the given value.
15859    ///
15860    /// Even though the property as already been set when instantiating this call,
15861    /// we provide this method for API completeness.
15862    pub fn merchant_id(mut self, new_value: u64) -> DatafeedDeleteCall<'a, C> {
15863        self._merchant_id = new_value;
15864        self
15865    }
15866    /// The ID of the datafeed.
15867    ///
15868    /// Sets the *datafeed id* path property to the given value.
15869    ///
15870    /// Even though the property as already been set when instantiating this call,
15871    /// we provide this method for API completeness.
15872    pub fn datafeed_id(mut self, new_value: u64) -> DatafeedDeleteCall<'a, C> {
15873        self._datafeed_id = new_value;
15874        self
15875    }
15876    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
15877    ///
15878    /// Sets the *dry run* query property to the given value.
15879    pub fn dry_run(mut self, new_value: bool) -> DatafeedDeleteCall<'a, C> {
15880        self._dry_run = Some(new_value);
15881        self
15882    }
15883    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15884    /// while executing the actual API request.
15885    ///
15886    /// ````text
15887    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15888    /// ````
15889    ///
15890    /// Sets the *delegate* property to the given value.
15891    pub fn delegate(
15892        mut self,
15893        new_value: &'a mut dyn common::Delegate,
15894    ) -> DatafeedDeleteCall<'a, C> {
15895        self._delegate = Some(new_value);
15896        self
15897    }
15898
15899    /// Set any additional parameter of the query string used in the request.
15900    /// It should be used to set parameters which are not yet available through their own
15901    /// setters.
15902    ///
15903    /// Please note that this method must not be used to set any of the known parameters
15904    /// which have their own setter method. If done anyway, the request will fail.
15905    ///
15906    /// # Additional Parameters
15907    ///
15908    /// * *$.xgafv* (query-string) - V1 error format.
15909    /// * *access_token* (query-string) - OAuth access token.
15910    /// * *alt* (query-string) - Data format for response.
15911    /// * *callback* (query-string) - JSONP
15912    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15913    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15914    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15915    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15916    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15917    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15918    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15919    pub fn param<T>(mut self, name: T, value: T) -> DatafeedDeleteCall<'a, C>
15920    where
15921        T: AsRef<str>,
15922    {
15923        self._additional_params
15924            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15925        self
15926    }
15927
15928    /// Identifies the authorization scope for the method you are building.
15929    ///
15930    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15931    /// [`Scope::Full`].
15932    ///
15933    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15934    /// tokens for more than one scope.
15935    ///
15936    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15937    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15938    /// sufficient, a read-write scope will do as well.
15939    pub fn add_scope<St>(mut self, scope: St) -> DatafeedDeleteCall<'a, C>
15940    where
15941        St: AsRef<str>,
15942    {
15943        self._scopes.insert(String::from(scope.as_ref()));
15944        self
15945    }
15946    /// Identifies the authorization scope(s) for the method you are building.
15947    ///
15948    /// See [`Self::add_scope()`] for details.
15949    pub fn add_scopes<I, St>(mut self, scopes: I) -> DatafeedDeleteCall<'a, C>
15950    where
15951        I: IntoIterator<Item = St>,
15952        St: AsRef<str>,
15953    {
15954        self._scopes
15955            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15956        self
15957    }
15958
15959    /// Removes all scopes, and no default scope will be used either.
15960    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15961    /// for details).
15962    pub fn clear_scopes(mut self) -> DatafeedDeleteCall<'a, C> {
15963        self._scopes.clear();
15964        self
15965    }
15966}
15967
15968/// Invokes a fetch for the datafeed in your Merchant Center account. If you need to call this method more than once per day, we recommend you use the Products service to update your product data.
15969///
15970/// A builder for the *fetchnow* method supported by a *datafeed* resource.
15971/// It is not used directly, but through a [`DatafeedMethods`] instance.
15972///
15973/// # Example
15974///
15975/// Instantiate a resource method builder
15976///
15977/// ```test_harness,no_run
15978/// # extern crate hyper;
15979/// # extern crate hyper_rustls;
15980/// # extern crate google_content2 as content2;
15981/// # async fn dox() {
15982/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15983///
15984/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15985/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15986/// #     .with_native_roots()
15987/// #     .unwrap()
15988/// #     .https_only()
15989/// #     .enable_http2()
15990/// #     .build();
15991///
15992/// # let executor = hyper_util::rt::TokioExecutor::new();
15993/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15994/// #     secret,
15995/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15996/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15997/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15998/// #     ),
15999/// # ).build().await.unwrap();
16000///
16001/// # let client = hyper_util::client::legacy::Client::builder(
16002/// #     hyper_util::rt::TokioExecutor::new()
16003/// # )
16004/// # .build(
16005/// #     hyper_rustls::HttpsConnectorBuilder::new()
16006/// #         .with_native_roots()
16007/// #         .unwrap()
16008/// #         .https_or_http()
16009/// #         .enable_http2()
16010/// #         .build()
16011/// # );
16012/// # let mut hub = ShoppingContent::new(client, auth);
16013/// // You can configure optional parameters by calling the respective setters at will, and
16014/// // execute the final call using `doit()`.
16015/// // Values shown here are possibly random and not representative !
16016/// let result = hub.datafeeds().fetchnow(57, 95)
16017///              .dry_run(true)
16018///              .doit().await;
16019/// # }
16020/// ```
16021pub struct DatafeedFetchnowCall<'a, C>
16022where
16023    C: 'a,
16024{
16025    hub: &'a ShoppingContent<C>,
16026    _merchant_id: u64,
16027    _datafeed_id: u64,
16028    _dry_run: Option<bool>,
16029    _delegate: Option<&'a mut dyn common::Delegate>,
16030    _additional_params: HashMap<String, String>,
16031    _scopes: BTreeSet<String>,
16032}
16033
16034impl<'a, C> common::CallBuilder for DatafeedFetchnowCall<'a, C> {}
16035
16036impl<'a, C> DatafeedFetchnowCall<'a, C>
16037where
16038    C: common::Connector,
16039{
16040    /// Perform the operation you have build so far.
16041    pub async fn doit(mut self) -> common::Result<(common::Response, DatafeedsFetchNowResponse)> {
16042        use std::borrow::Cow;
16043        use std::io::{Read, Seek};
16044
16045        use common::{url::Params, ToParts};
16046        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16047
16048        let mut dd = common::DefaultDelegate;
16049        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16050        dlg.begin(common::MethodInfo {
16051            id: "content.datafeeds.fetchnow",
16052            http_method: hyper::Method::POST,
16053        });
16054
16055        for &field in ["alt", "merchantId", "datafeedId", "dryRun"].iter() {
16056            if self._additional_params.contains_key(field) {
16057                dlg.finished(false);
16058                return Err(common::Error::FieldClash(field));
16059            }
16060        }
16061
16062        let mut params = Params::with_capacity(5 + self._additional_params.len());
16063        params.push("merchantId", self._merchant_id.to_string());
16064        params.push("datafeedId", self._datafeed_id.to_string());
16065        if let Some(value) = self._dry_run.as_ref() {
16066            params.push("dryRun", value.to_string());
16067        }
16068
16069        params.extend(self._additional_params.iter());
16070
16071        params.push("alt", "json");
16072        let mut url = self.hub._base_url.clone() + "{merchantId}/datafeeds/{datafeedId}/fetchNow";
16073        if self._scopes.is_empty() {
16074            self._scopes.insert(Scope::Full.as_ref().to_string());
16075        }
16076
16077        #[allow(clippy::single_element_loop)]
16078        for &(find_this, param_name) in [
16079            ("{merchantId}", "merchantId"),
16080            ("{datafeedId}", "datafeedId"),
16081        ]
16082        .iter()
16083        {
16084            url = params.uri_replacement(url, param_name, find_this, false);
16085        }
16086        {
16087            let to_remove = ["datafeedId", "merchantId"];
16088            params.remove_params(&to_remove);
16089        }
16090
16091        let url = params.parse_with_url(&url);
16092
16093        loop {
16094            let token = match self
16095                .hub
16096                .auth
16097                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16098                .await
16099            {
16100                Ok(token) => token,
16101                Err(e) => match dlg.token(e) {
16102                    Ok(token) => token,
16103                    Err(e) => {
16104                        dlg.finished(false);
16105                        return Err(common::Error::MissingToken(e));
16106                    }
16107                },
16108            };
16109            let mut req_result = {
16110                let client = &self.hub.client;
16111                dlg.pre_request();
16112                let mut req_builder = hyper::Request::builder()
16113                    .method(hyper::Method::POST)
16114                    .uri(url.as_str())
16115                    .header(USER_AGENT, self.hub._user_agent.clone());
16116
16117                if let Some(token) = token.as_ref() {
16118                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16119                }
16120
16121                let request = req_builder
16122                    .header(CONTENT_LENGTH, 0_u64)
16123                    .body(common::to_body::<String>(None));
16124
16125                client.request(request.unwrap()).await
16126            };
16127
16128            match req_result {
16129                Err(err) => {
16130                    if let common::Retry::After(d) = dlg.http_error(&err) {
16131                        sleep(d).await;
16132                        continue;
16133                    }
16134                    dlg.finished(false);
16135                    return Err(common::Error::HttpError(err));
16136                }
16137                Ok(res) => {
16138                    let (mut parts, body) = res.into_parts();
16139                    let mut body = common::Body::new(body);
16140                    if !parts.status.is_success() {
16141                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16142                        let error = serde_json::from_str(&common::to_string(&bytes));
16143                        let response = common::to_response(parts, bytes.into());
16144
16145                        if let common::Retry::After(d) =
16146                            dlg.http_failure(&response, error.as_ref().ok())
16147                        {
16148                            sleep(d).await;
16149                            continue;
16150                        }
16151
16152                        dlg.finished(false);
16153
16154                        return Err(match error {
16155                            Ok(value) => common::Error::BadRequest(value),
16156                            _ => common::Error::Failure(response),
16157                        });
16158                    }
16159                    let response = {
16160                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16161                        let encoded = common::to_string(&bytes);
16162                        match serde_json::from_str(&encoded) {
16163                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16164                            Err(error) => {
16165                                dlg.response_json_decode_error(&encoded, &error);
16166                                return Err(common::Error::JsonDecodeError(
16167                                    encoded.to_string(),
16168                                    error,
16169                                ));
16170                            }
16171                        }
16172                    };
16173
16174                    dlg.finished(true);
16175                    return Ok(response);
16176                }
16177            }
16178        }
16179    }
16180
16181    /// The ID of the account that manages the datafeed. This account cannot be a multi-client account.
16182    ///
16183    /// Sets the *merchant id* path property to the given value.
16184    ///
16185    /// Even though the property as already been set when instantiating this call,
16186    /// we provide this method for API completeness.
16187    pub fn merchant_id(mut self, new_value: u64) -> DatafeedFetchnowCall<'a, C> {
16188        self._merchant_id = new_value;
16189        self
16190    }
16191    /// The ID of the datafeed to be fetched.
16192    ///
16193    /// Sets the *datafeed id* path property to the given value.
16194    ///
16195    /// Even though the property as already been set when instantiating this call,
16196    /// we provide this method for API completeness.
16197    pub fn datafeed_id(mut self, new_value: u64) -> DatafeedFetchnowCall<'a, C> {
16198        self._datafeed_id = new_value;
16199        self
16200    }
16201    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
16202    ///
16203    /// Sets the *dry run* query property to the given value.
16204    pub fn dry_run(mut self, new_value: bool) -> DatafeedFetchnowCall<'a, C> {
16205        self._dry_run = Some(new_value);
16206        self
16207    }
16208    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16209    /// while executing the actual API request.
16210    ///
16211    /// ````text
16212    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16213    /// ````
16214    ///
16215    /// Sets the *delegate* property to the given value.
16216    pub fn delegate(
16217        mut self,
16218        new_value: &'a mut dyn common::Delegate,
16219    ) -> DatafeedFetchnowCall<'a, C> {
16220        self._delegate = Some(new_value);
16221        self
16222    }
16223
16224    /// Set any additional parameter of the query string used in the request.
16225    /// It should be used to set parameters which are not yet available through their own
16226    /// setters.
16227    ///
16228    /// Please note that this method must not be used to set any of the known parameters
16229    /// which have their own setter method. If done anyway, the request will fail.
16230    ///
16231    /// # Additional Parameters
16232    ///
16233    /// * *$.xgafv* (query-string) - V1 error format.
16234    /// * *access_token* (query-string) - OAuth access token.
16235    /// * *alt* (query-string) - Data format for response.
16236    /// * *callback* (query-string) - JSONP
16237    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16238    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16239    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16240    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16241    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16242    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16243    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16244    pub fn param<T>(mut self, name: T, value: T) -> DatafeedFetchnowCall<'a, C>
16245    where
16246        T: AsRef<str>,
16247    {
16248        self._additional_params
16249            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16250        self
16251    }
16252
16253    /// Identifies the authorization scope for the method you are building.
16254    ///
16255    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16256    /// [`Scope::Full`].
16257    ///
16258    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16259    /// tokens for more than one scope.
16260    ///
16261    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16262    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16263    /// sufficient, a read-write scope will do as well.
16264    pub fn add_scope<St>(mut self, scope: St) -> DatafeedFetchnowCall<'a, C>
16265    where
16266        St: AsRef<str>,
16267    {
16268        self._scopes.insert(String::from(scope.as_ref()));
16269        self
16270    }
16271    /// Identifies the authorization scope(s) for the method you are building.
16272    ///
16273    /// See [`Self::add_scope()`] for details.
16274    pub fn add_scopes<I, St>(mut self, scopes: I) -> DatafeedFetchnowCall<'a, C>
16275    where
16276        I: IntoIterator<Item = St>,
16277        St: AsRef<str>,
16278    {
16279        self._scopes
16280            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16281        self
16282    }
16283
16284    /// Removes all scopes, and no default scope will be used either.
16285    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16286    /// for details).
16287    pub fn clear_scopes(mut self) -> DatafeedFetchnowCall<'a, C> {
16288        self._scopes.clear();
16289        self
16290    }
16291}
16292
16293/// Retrieves a datafeed configuration from your Merchant Center account.
16294///
16295/// A builder for the *get* method supported by a *datafeed* resource.
16296/// It is not used directly, but through a [`DatafeedMethods`] instance.
16297///
16298/// # Example
16299///
16300/// Instantiate a resource method builder
16301///
16302/// ```test_harness,no_run
16303/// # extern crate hyper;
16304/// # extern crate hyper_rustls;
16305/// # extern crate google_content2 as content2;
16306/// # async fn dox() {
16307/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16308///
16309/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16310/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16311/// #     .with_native_roots()
16312/// #     .unwrap()
16313/// #     .https_only()
16314/// #     .enable_http2()
16315/// #     .build();
16316///
16317/// # let executor = hyper_util::rt::TokioExecutor::new();
16318/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16319/// #     secret,
16320/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16321/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16322/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16323/// #     ),
16324/// # ).build().await.unwrap();
16325///
16326/// # let client = hyper_util::client::legacy::Client::builder(
16327/// #     hyper_util::rt::TokioExecutor::new()
16328/// # )
16329/// # .build(
16330/// #     hyper_rustls::HttpsConnectorBuilder::new()
16331/// #         .with_native_roots()
16332/// #         .unwrap()
16333/// #         .https_or_http()
16334/// #         .enable_http2()
16335/// #         .build()
16336/// # );
16337/// # let mut hub = ShoppingContent::new(client, auth);
16338/// // You can configure optional parameters by calling the respective setters at will, and
16339/// // execute the final call using `doit()`.
16340/// // Values shown here are possibly random and not representative !
16341/// let result = hub.datafeeds().get(1, 78)
16342///              .doit().await;
16343/// # }
16344/// ```
16345pub struct DatafeedGetCall<'a, C>
16346where
16347    C: 'a,
16348{
16349    hub: &'a ShoppingContent<C>,
16350    _merchant_id: u64,
16351    _datafeed_id: u64,
16352    _delegate: Option<&'a mut dyn common::Delegate>,
16353    _additional_params: HashMap<String, String>,
16354    _scopes: BTreeSet<String>,
16355}
16356
16357impl<'a, C> common::CallBuilder for DatafeedGetCall<'a, C> {}
16358
16359impl<'a, C> DatafeedGetCall<'a, C>
16360where
16361    C: common::Connector,
16362{
16363    /// Perform the operation you have build so far.
16364    pub async fn doit(mut self) -> common::Result<(common::Response, Datafeed)> {
16365        use std::borrow::Cow;
16366        use std::io::{Read, Seek};
16367
16368        use common::{url::Params, ToParts};
16369        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16370
16371        let mut dd = common::DefaultDelegate;
16372        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16373        dlg.begin(common::MethodInfo {
16374            id: "content.datafeeds.get",
16375            http_method: hyper::Method::GET,
16376        });
16377
16378        for &field in ["alt", "merchantId", "datafeedId"].iter() {
16379            if self._additional_params.contains_key(field) {
16380                dlg.finished(false);
16381                return Err(common::Error::FieldClash(field));
16382            }
16383        }
16384
16385        let mut params = Params::with_capacity(4 + self._additional_params.len());
16386        params.push("merchantId", self._merchant_id.to_string());
16387        params.push("datafeedId", self._datafeed_id.to_string());
16388
16389        params.extend(self._additional_params.iter());
16390
16391        params.push("alt", "json");
16392        let mut url = self.hub._base_url.clone() + "{merchantId}/datafeeds/{datafeedId}";
16393        if self._scopes.is_empty() {
16394            self._scopes.insert(Scope::Full.as_ref().to_string());
16395        }
16396
16397        #[allow(clippy::single_element_loop)]
16398        for &(find_this, param_name) in [
16399            ("{merchantId}", "merchantId"),
16400            ("{datafeedId}", "datafeedId"),
16401        ]
16402        .iter()
16403        {
16404            url = params.uri_replacement(url, param_name, find_this, false);
16405        }
16406        {
16407            let to_remove = ["datafeedId", "merchantId"];
16408            params.remove_params(&to_remove);
16409        }
16410
16411        let url = params.parse_with_url(&url);
16412
16413        loop {
16414            let token = match self
16415                .hub
16416                .auth
16417                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16418                .await
16419            {
16420                Ok(token) => token,
16421                Err(e) => match dlg.token(e) {
16422                    Ok(token) => token,
16423                    Err(e) => {
16424                        dlg.finished(false);
16425                        return Err(common::Error::MissingToken(e));
16426                    }
16427                },
16428            };
16429            let mut req_result = {
16430                let client = &self.hub.client;
16431                dlg.pre_request();
16432                let mut req_builder = hyper::Request::builder()
16433                    .method(hyper::Method::GET)
16434                    .uri(url.as_str())
16435                    .header(USER_AGENT, self.hub._user_agent.clone());
16436
16437                if let Some(token) = token.as_ref() {
16438                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16439                }
16440
16441                let request = req_builder
16442                    .header(CONTENT_LENGTH, 0_u64)
16443                    .body(common::to_body::<String>(None));
16444
16445                client.request(request.unwrap()).await
16446            };
16447
16448            match req_result {
16449                Err(err) => {
16450                    if let common::Retry::After(d) = dlg.http_error(&err) {
16451                        sleep(d).await;
16452                        continue;
16453                    }
16454                    dlg.finished(false);
16455                    return Err(common::Error::HttpError(err));
16456                }
16457                Ok(res) => {
16458                    let (mut parts, body) = res.into_parts();
16459                    let mut body = common::Body::new(body);
16460                    if !parts.status.is_success() {
16461                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16462                        let error = serde_json::from_str(&common::to_string(&bytes));
16463                        let response = common::to_response(parts, bytes.into());
16464
16465                        if let common::Retry::After(d) =
16466                            dlg.http_failure(&response, error.as_ref().ok())
16467                        {
16468                            sleep(d).await;
16469                            continue;
16470                        }
16471
16472                        dlg.finished(false);
16473
16474                        return Err(match error {
16475                            Ok(value) => common::Error::BadRequest(value),
16476                            _ => common::Error::Failure(response),
16477                        });
16478                    }
16479                    let response = {
16480                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16481                        let encoded = common::to_string(&bytes);
16482                        match serde_json::from_str(&encoded) {
16483                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16484                            Err(error) => {
16485                                dlg.response_json_decode_error(&encoded, &error);
16486                                return Err(common::Error::JsonDecodeError(
16487                                    encoded.to_string(),
16488                                    error,
16489                                ));
16490                            }
16491                        }
16492                    };
16493
16494                    dlg.finished(true);
16495                    return Ok(response);
16496                }
16497            }
16498        }
16499    }
16500
16501    /// The ID of the account that manages the datafeed. This account cannot be a multi-client account.
16502    ///
16503    /// Sets the *merchant id* path property to the given value.
16504    ///
16505    /// Even though the property as already been set when instantiating this call,
16506    /// we provide this method for API completeness.
16507    pub fn merchant_id(mut self, new_value: u64) -> DatafeedGetCall<'a, C> {
16508        self._merchant_id = new_value;
16509        self
16510    }
16511    /// The ID of the datafeed.
16512    ///
16513    /// Sets the *datafeed id* path 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 datafeed_id(mut self, new_value: u64) -> DatafeedGetCall<'a, C> {
16518        self._datafeed_id = new_value;
16519        self
16520    }
16521    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16522    /// while executing the actual API request.
16523    ///
16524    /// ````text
16525    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16526    /// ````
16527    ///
16528    /// Sets the *delegate* property to the given value.
16529    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DatafeedGetCall<'a, C> {
16530        self._delegate = Some(new_value);
16531        self
16532    }
16533
16534    /// Set any additional parameter of the query string used in the request.
16535    /// It should be used to set parameters which are not yet available through their own
16536    /// setters.
16537    ///
16538    /// Please note that this method must not be used to set any of the known parameters
16539    /// which have their own setter method. If done anyway, the request will fail.
16540    ///
16541    /// # Additional Parameters
16542    ///
16543    /// * *$.xgafv* (query-string) - V1 error format.
16544    /// * *access_token* (query-string) - OAuth access token.
16545    /// * *alt* (query-string) - Data format for response.
16546    /// * *callback* (query-string) - JSONP
16547    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16548    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16549    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16550    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16551    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16552    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16553    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16554    pub fn param<T>(mut self, name: T, value: T) -> DatafeedGetCall<'a, C>
16555    where
16556        T: AsRef<str>,
16557    {
16558        self._additional_params
16559            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16560        self
16561    }
16562
16563    /// Identifies the authorization scope for the method you are building.
16564    ///
16565    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16566    /// [`Scope::Full`].
16567    ///
16568    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16569    /// tokens for more than one scope.
16570    ///
16571    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16572    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16573    /// sufficient, a read-write scope will do as well.
16574    pub fn add_scope<St>(mut self, scope: St) -> DatafeedGetCall<'a, C>
16575    where
16576        St: AsRef<str>,
16577    {
16578        self._scopes.insert(String::from(scope.as_ref()));
16579        self
16580    }
16581    /// Identifies the authorization scope(s) for the method you are building.
16582    ///
16583    /// See [`Self::add_scope()`] for details.
16584    pub fn add_scopes<I, St>(mut self, scopes: I) -> DatafeedGetCall<'a, C>
16585    where
16586        I: IntoIterator<Item = St>,
16587        St: AsRef<str>,
16588    {
16589        self._scopes
16590            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16591        self
16592    }
16593
16594    /// Removes all scopes, and no default scope will be used either.
16595    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16596    /// for details).
16597    pub fn clear_scopes(mut self) -> DatafeedGetCall<'a, C> {
16598        self._scopes.clear();
16599        self
16600    }
16601}
16602
16603/// Registers a datafeed configuration with your Merchant Center account.
16604///
16605/// A builder for the *insert* method supported by a *datafeed* resource.
16606/// It is not used directly, but through a [`DatafeedMethods`] instance.
16607///
16608/// # Example
16609///
16610/// Instantiate a resource method builder
16611///
16612/// ```test_harness,no_run
16613/// # extern crate hyper;
16614/// # extern crate hyper_rustls;
16615/// # extern crate google_content2 as content2;
16616/// use content2::api::Datafeed;
16617/// # async fn dox() {
16618/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16619///
16620/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16621/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16622/// #     .with_native_roots()
16623/// #     .unwrap()
16624/// #     .https_only()
16625/// #     .enable_http2()
16626/// #     .build();
16627///
16628/// # let executor = hyper_util::rt::TokioExecutor::new();
16629/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16630/// #     secret,
16631/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16632/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16633/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16634/// #     ),
16635/// # ).build().await.unwrap();
16636///
16637/// # let client = hyper_util::client::legacy::Client::builder(
16638/// #     hyper_util::rt::TokioExecutor::new()
16639/// # )
16640/// # .build(
16641/// #     hyper_rustls::HttpsConnectorBuilder::new()
16642/// #         .with_native_roots()
16643/// #         .unwrap()
16644/// #         .https_or_http()
16645/// #         .enable_http2()
16646/// #         .build()
16647/// # );
16648/// # let mut hub = ShoppingContent::new(client, auth);
16649/// // As the method needs a request, you would usually fill it with the desired information
16650/// // into the respective structure. Some of the parts shown here might not be applicable !
16651/// // Values shown here are possibly random and not representative !
16652/// let mut req = Datafeed::default();
16653///
16654/// // You can configure optional parameters by calling the respective setters at will, and
16655/// // execute the final call using `doit()`.
16656/// // Values shown here are possibly random and not representative !
16657/// let result = hub.datafeeds().insert(req, 42)
16658///              .dry_run(true)
16659///              .doit().await;
16660/// # }
16661/// ```
16662pub struct DatafeedInsertCall<'a, C>
16663where
16664    C: 'a,
16665{
16666    hub: &'a ShoppingContent<C>,
16667    _request: Datafeed,
16668    _merchant_id: u64,
16669    _dry_run: Option<bool>,
16670    _delegate: Option<&'a mut dyn common::Delegate>,
16671    _additional_params: HashMap<String, String>,
16672    _scopes: BTreeSet<String>,
16673}
16674
16675impl<'a, C> common::CallBuilder for DatafeedInsertCall<'a, C> {}
16676
16677impl<'a, C> DatafeedInsertCall<'a, C>
16678where
16679    C: common::Connector,
16680{
16681    /// Perform the operation you have build so far.
16682    pub async fn doit(mut self) -> common::Result<(common::Response, Datafeed)> {
16683        use std::borrow::Cow;
16684        use std::io::{Read, Seek};
16685
16686        use common::{url::Params, ToParts};
16687        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16688
16689        let mut dd = common::DefaultDelegate;
16690        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16691        dlg.begin(common::MethodInfo {
16692            id: "content.datafeeds.insert",
16693            http_method: hyper::Method::POST,
16694        });
16695
16696        for &field in ["alt", "merchantId", "dryRun"].iter() {
16697            if self._additional_params.contains_key(field) {
16698                dlg.finished(false);
16699                return Err(common::Error::FieldClash(field));
16700            }
16701        }
16702
16703        let mut params = Params::with_capacity(5 + self._additional_params.len());
16704        params.push("merchantId", self._merchant_id.to_string());
16705        if let Some(value) = self._dry_run.as_ref() {
16706            params.push("dryRun", value.to_string());
16707        }
16708
16709        params.extend(self._additional_params.iter());
16710
16711        params.push("alt", "json");
16712        let mut url = self.hub._base_url.clone() + "{merchantId}/datafeeds";
16713        if self._scopes.is_empty() {
16714            self._scopes.insert(Scope::Full.as_ref().to_string());
16715        }
16716
16717        #[allow(clippy::single_element_loop)]
16718        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
16719            url = params.uri_replacement(url, param_name, find_this, false);
16720        }
16721        {
16722            let to_remove = ["merchantId"];
16723            params.remove_params(&to_remove);
16724        }
16725
16726        let url = params.parse_with_url(&url);
16727
16728        let mut json_mime_type = mime::APPLICATION_JSON;
16729        let mut request_value_reader = {
16730            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16731            common::remove_json_null_values(&mut value);
16732            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16733            serde_json::to_writer(&mut dst, &value).unwrap();
16734            dst
16735        };
16736        let request_size = request_value_reader
16737            .seek(std::io::SeekFrom::End(0))
16738            .unwrap();
16739        request_value_reader
16740            .seek(std::io::SeekFrom::Start(0))
16741            .unwrap();
16742
16743        loop {
16744            let token = match self
16745                .hub
16746                .auth
16747                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16748                .await
16749            {
16750                Ok(token) => token,
16751                Err(e) => match dlg.token(e) {
16752                    Ok(token) => token,
16753                    Err(e) => {
16754                        dlg.finished(false);
16755                        return Err(common::Error::MissingToken(e));
16756                    }
16757                },
16758            };
16759            request_value_reader
16760                .seek(std::io::SeekFrom::Start(0))
16761                .unwrap();
16762            let mut req_result = {
16763                let client = &self.hub.client;
16764                dlg.pre_request();
16765                let mut req_builder = hyper::Request::builder()
16766                    .method(hyper::Method::POST)
16767                    .uri(url.as_str())
16768                    .header(USER_AGENT, self.hub._user_agent.clone());
16769
16770                if let Some(token) = token.as_ref() {
16771                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16772                }
16773
16774                let request = req_builder
16775                    .header(CONTENT_TYPE, json_mime_type.to_string())
16776                    .header(CONTENT_LENGTH, request_size as u64)
16777                    .body(common::to_body(
16778                        request_value_reader.get_ref().clone().into(),
16779                    ));
16780
16781                client.request(request.unwrap()).await
16782            };
16783
16784            match req_result {
16785                Err(err) => {
16786                    if let common::Retry::After(d) = dlg.http_error(&err) {
16787                        sleep(d).await;
16788                        continue;
16789                    }
16790                    dlg.finished(false);
16791                    return Err(common::Error::HttpError(err));
16792                }
16793                Ok(res) => {
16794                    let (mut parts, body) = res.into_parts();
16795                    let mut body = common::Body::new(body);
16796                    if !parts.status.is_success() {
16797                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16798                        let error = serde_json::from_str(&common::to_string(&bytes));
16799                        let response = common::to_response(parts, bytes.into());
16800
16801                        if let common::Retry::After(d) =
16802                            dlg.http_failure(&response, error.as_ref().ok())
16803                        {
16804                            sleep(d).await;
16805                            continue;
16806                        }
16807
16808                        dlg.finished(false);
16809
16810                        return Err(match error {
16811                            Ok(value) => common::Error::BadRequest(value),
16812                            _ => common::Error::Failure(response),
16813                        });
16814                    }
16815                    let response = {
16816                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16817                        let encoded = common::to_string(&bytes);
16818                        match serde_json::from_str(&encoded) {
16819                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16820                            Err(error) => {
16821                                dlg.response_json_decode_error(&encoded, &error);
16822                                return Err(common::Error::JsonDecodeError(
16823                                    encoded.to_string(),
16824                                    error,
16825                                ));
16826                            }
16827                        }
16828                    };
16829
16830                    dlg.finished(true);
16831                    return Ok(response);
16832                }
16833            }
16834        }
16835    }
16836
16837    ///
16838    /// Sets the *request* property to the given value.
16839    ///
16840    /// Even though the property as already been set when instantiating this call,
16841    /// we provide this method for API completeness.
16842    pub fn request(mut self, new_value: Datafeed) -> DatafeedInsertCall<'a, C> {
16843        self._request = new_value;
16844        self
16845    }
16846    /// The ID of the account that manages the datafeed. This account cannot be a multi-client account.
16847    ///
16848    /// Sets the *merchant id* path property to the given value.
16849    ///
16850    /// Even though the property as already been set when instantiating this call,
16851    /// we provide this method for API completeness.
16852    pub fn merchant_id(mut self, new_value: u64) -> DatafeedInsertCall<'a, C> {
16853        self._merchant_id = new_value;
16854        self
16855    }
16856    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
16857    ///
16858    /// Sets the *dry run* query property to the given value.
16859    pub fn dry_run(mut self, new_value: bool) -> DatafeedInsertCall<'a, C> {
16860        self._dry_run = Some(new_value);
16861        self
16862    }
16863    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16864    /// while executing the actual API request.
16865    ///
16866    /// ````text
16867    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16868    /// ````
16869    ///
16870    /// Sets the *delegate* property to the given value.
16871    pub fn delegate(
16872        mut self,
16873        new_value: &'a mut dyn common::Delegate,
16874    ) -> DatafeedInsertCall<'a, C> {
16875        self._delegate = Some(new_value);
16876        self
16877    }
16878
16879    /// Set any additional parameter of the query string used in the request.
16880    /// It should be used to set parameters which are not yet available through their own
16881    /// setters.
16882    ///
16883    /// Please note that this method must not be used to set any of the known parameters
16884    /// which have their own setter method. If done anyway, the request will fail.
16885    ///
16886    /// # Additional Parameters
16887    ///
16888    /// * *$.xgafv* (query-string) - V1 error format.
16889    /// * *access_token* (query-string) - OAuth access token.
16890    /// * *alt* (query-string) - Data format for response.
16891    /// * *callback* (query-string) - JSONP
16892    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16893    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16894    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16895    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16896    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16897    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16898    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16899    pub fn param<T>(mut self, name: T, value: T) -> DatafeedInsertCall<'a, C>
16900    where
16901        T: AsRef<str>,
16902    {
16903        self._additional_params
16904            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16905        self
16906    }
16907
16908    /// Identifies the authorization scope for the method you are building.
16909    ///
16910    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16911    /// [`Scope::Full`].
16912    ///
16913    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16914    /// tokens for more than one scope.
16915    ///
16916    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16917    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16918    /// sufficient, a read-write scope will do as well.
16919    pub fn add_scope<St>(mut self, scope: St) -> DatafeedInsertCall<'a, C>
16920    where
16921        St: AsRef<str>,
16922    {
16923        self._scopes.insert(String::from(scope.as_ref()));
16924        self
16925    }
16926    /// Identifies the authorization scope(s) for the method you are building.
16927    ///
16928    /// See [`Self::add_scope()`] for details.
16929    pub fn add_scopes<I, St>(mut self, scopes: I) -> DatafeedInsertCall<'a, C>
16930    where
16931        I: IntoIterator<Item = St>,
16932        St: AsRef<str>,
16933    {
16934        self._scopes
16935            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16936        self
16937    }
16938
16939    /// Removes all scopes, and no default scope will be used either.
16940    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16941    /// for details).
16942    pub fn clear_scopes(mut self) -> DatafeedInsertCall<'a, C> {
16943        self._scopes.clear();
16944        self
16945    }
16946}
16947
16948/// Lists the configurations for datafeeds in your Merchant Center account.
16949///
16950/// A builder for the *list* method supported by a *datafeed* resource.
16951/// It is not used directly, but through a [`DatafeedMethods`] instance.
16952///
16953/// # Example
16954///
16955/// Instantiate a resource method builder
16956///
16957/// ```test_harness,no_run
16958/// # extern crate hyper;
16959/// # extern crate hyper_rustls;
16960/// # extern crate google_content2 as content2;
16961/// # async fn dox() {
16962/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16963///
16964/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16965/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16966/// #     .with_native_roots()
16967/// #     .unwrap()
16968/// #     .https_only()
16969/// #     .enable_http2()
16970/// #     .build();
16971///
16972/// # let executor = hyper_util::rt::TokioExecutor::new();
16973/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16974/// #     secret,
16975/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16976/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16977/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16978/// #     ),
16979/// # ).build().await.unwrap();
16980///
16981/// # let client = hyper_util::client::legacy::Client::builder(
16982/// #     hyper_util::rt::TokioExecutor::new()
16983/// # )
16984/// # .build(
16985/// #     hyper_rustls::HttpsConnectorBuilder::new()
16986/// #         .with_native_roots()
16987/// #         .unwrap()
16988/// #         .https_or_http()
16989/// #         .enable_http2()
16990/// #         .build()
16991/// # );
16992/// # let mut hub = ShoppingContent::new(client, auth);
16993/// // You can configure optional parameters by calling the respective setters at will, and
16994/// // execute the final call using `doit()`.
16995/// // Values shown here are possibly random and not representative !
16996/// let result = hub.datafeeds().list(73)
16997///              .page_token("et")
16998///              .max_results(70)
16999///              .doit().await;
17000/// # }
17001/// ```
17002pub struct DatafeedListCall<'a, C>
17003where
17004    C: 'a,
17005{
17006    hub: &'a ShoppingContent<C>,
17007    _merchant_id: u64,
17008    _page_token: Option<String>,
17009    _max_results: Option<u32>,
17010    _delegate: Option<&'a mut dyn common::Delegate>,
17011    _additional_params: HashMap<String, String>,
17012    _scopes: BTreeSet<String>,
17013}
17014
17015impl<'a, C> common::CallBuilder for DatafeedListCall<'a, C> {}
17016
17017impl<'a, C> DatafeedListCall<'a, C>
17018where
17019    C: common::Connector,
17020{
17021    /// Perform the operation you have build so far.
17022    pub async fn doit(mut self) -> common::Result<(common::Response, DatafeedsListResponse)> {
17023        use std::borrow::Cow;
17024        use std::io::{Read, Seek};
17025
17026        use common::{url::Params, ToParts};
17027        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17028
17029        let mut dd = common::DefaultDelegate;
17030        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17031        dlg.begin(common::MethodInfo {
17032            id: "content.datafeeds.list",
17033            http_method: hyper::Method::GET,
17034        });
17035
17036        for &field in ["alt", "merchantId", "pageToken", "maxResults"].iter() {
17037            if self._additional_params.contains_key(field) {
17038                dlg.finished(false);
17039                return Err(common::Error::FieldClash(field));
17040            }
17041        }
17042
17043        let mut params = Params::with_capacity(5 + self._additional_params.len());
17044        params.push("merchantId", self._merchant_id.to_string());
17045        if let Some(value) = self._page_token.as_ref() {
17046            params.push("pageToken", value);
17047        }
17048        if let Some(value) = self._max_results.as_ref() {
17049            params.push("maxResults", value.to_string());
17050        }
17051
17052        params.extend(self._additional_params.iter());
17053
17054        params.push("alt", "json");
17055        let mut url = self.hub._base_url.clone() + "{merchantId}/datafeeds";
17056        if self._scopes.is_empty() {
17057            self._scopes.insert(Scope::Full.as_ref().to_string());
17058        }
17059
17060        #[allow(clippy::single_element_loop)]
17061        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
17062            url = params.uri_replacement(url, param_name, find_this, false);
17063        }
17064        {
17065            let to_remove = ["merchantId"];
17066            params.remove_params(&to_remove);
17067        }
17068
17069        let url = params.parse_with_url(&url);
17070
17071        loop {
17072            let token = match self
17073                .hub
17074                .auth
17075                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17076                .await
17077            {
17078                Ok(token) => token,
17079                Err(e) => match dlg.token(e) {
17080                    Ok(token) => token,
17081                    Err(e) => {
17082                        dlg.finished(false);
17083                        return Err(common::Error::MissingToken(e));
17084                    }
17085                },
17086            };
17087            let mut req_result = {
17088                let client = &self.hub.client;
17089                dlg.pre_request();
17090                let mut req_builder = hyper::Request::builder()
17091                    .method(hyper::Method::GET)
17092                    .uri(url.as_str())
17093                    .header(USER_AGENT, self.hub._user_agent.clone());
17094
17095                if let Some(token) = token.as_ref() {
17096                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17097                }
17098
17099                let request = req_builder
17100                    .header(CONTENT_LENGTH, 0_u64)
17101                    .body(common::to_body::<String>(None));
17102
17103                client.request(request.unwrap()).await
17104            };
17105
17106            match req_result {
17107                Err(err) => {
17108                    if let common::Retry::After(d) = dlg.http_error(&err) {
17109                        sleep(d).await;
17110                        continue;
17111                    }
17112                    dlg.finished(false);
17113                    return Err(common::Error::HttpError(err));
17114                }
17115                Ok(res) => {
17116                    let (mut parts, body) = res.into_parts();
17117                    let mut body = common::Body::new(body);
17118                    if !parts.status.is_success() {
17119                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17120                        let error = serde_json::from_str(&common::to_string(&bytes));
17121                        let response = common::to_response(parts, bytes.into());
17122
17123                        if let common::Retry::After(d) =
17124                            dlg.http_failure(&response, error.as_ref().ok())
17125                        {
17126                            sleep(d).await;
17127                            continue;
17128                        }
17129
17130                        dlg.finished(false);
17131
17132                        return Err(match error {
17133                            Ok(value) => common::Error::BadRequest(value),
17134                            _ => common::Error::Failure(response),
17135                        });
17136                    }
17137                    let response = {
17138                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17139                        let encoded = common::to_string(&bytes);
17140                        match serde_json::from_str(&encoded) {
17141                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17142                            Err(error) => {
17143                                dlg.response_json_decode_error(&encoded, &error);
17144                                return Err(common::Error::JsonDecodeError(
17145                                    encoded.to_string(),
17146                                    error,
17147                                ));
17148                            }
17149                        }
17150                    };
17151
17152                    dlg.finished(true);
17153                    return Ok(response);
17154                }
17155            }
17156        }
17157    }
17158
17159    /// The ID of the account that manages the datafeeds. This account cannot be a multi-client account.
17160    ///
17161    /// Sets the *merchant id* path property to the given value.
17162    ///
17163    /// Even though the property as already been set when instantiating this call,
17164    /// we provide this method for API completeness.
17165    pub fn merchant_id(mut self, new_value: u64) -> DatafeedListCall<'a, C> {
17166        self._merchant_id = new_value;
17167        self
17168    }
17169    /// The token returned by the previous request.
17170    ///
17171    /// Sets the *page token* query property to the given value.
17172    pub fn page_token(mut self, new_value: &str) -> DatafeedListCall<'a, C> {
17173        self._page_token = Some(new_value.to_string());
17174        self
17175    }
17176    /// The maximum number of products to return in the response, used for paging.
17177    ///
17178    /// Sets the *max results* query property to the given value.
17179    pub fn max_results(mut self, new_value: u32) -> DatafeedListCall<'a, C> {
17180        self._max_results = Some(new_value);
17181        self
17182    }
17183    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17184    /// while executing the actual API request.
17185    ///
17186    /// ````text
17187    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17188    /// ````
17189    ///
17190    /// Sets the *delegate* property to the given value.
17191    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DatafeedListCall<'a, C> {
17192        self._delegate = Some(new_value);
17193        self
17194    }
17195
17196    /// Set any additional parameter of the query string used in the request.
17197    /// It should be used to set parameters which are not yet available through their own
17198    /// setters.
17199    ///
17200    /// Please note that this method must not be used to set any of the known parameters
17201    /// which have their own setter method. If done anyway, the request will fail.
17202    ///
17203    /// # Additional Parameters
17204    ///
17205    /// * *$.xgafv* (query-string) - V1 error format.
17206    /// * *access_token* (query-string) - OAuth access token.
17207    /// * *alt* (query-string) - Data format for response.
17208    /// * *callback* (query-string) - JSONP
17209    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17210    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17211    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17212    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17213    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17214    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17215    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17216    pub fn param<T>(mut self, name: T, value: T) -> DatafeedListCall<'a, C>
17217    where
17218        T: AsRef<str>,
17219    {
17220        self._additional_params
17221            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17222        self
17223    }
17224
17225    /// Identifies the authorization scope for the method you are building.
17226    ///
17227    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17228    /// [`Scope::Full`].
17229    ///
17230    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17231    /// tokens for more than one scope.
17232    ///
17233    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17234    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17235    /// sufficient, a read-write scope will do as well.
17236    pub fn add_scope<St>(mut self, scope: St) -> DatafeedListCall<'a, C>
17237    where
17238        St: AsRef<str>,
17239    {
17240        self._scopes.insert(String::from(scope.as_ref()));
17241        self
17242    }
17243    /// Identifies the authorization scope(s) for the method you are building.
17244    ///
17245    /// See [`Self::add_scope()`] for details.
17246    pub fn add_scopes<I, St>(mut self, scopes: I) -> DatafeedListCall<'a, C>
17247    where
17248        I: IntoIterator<Item = St>,
17249        St: AsRef<str>,
17250    {
17251        self._scopes
17252            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17253        self
17254    }
17255
17256    /// Removes all scopes, and no default scope will be used either.
17257    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17258    /// for details).
17259    pub fn clear_scopes(mut self) -> DatafeedListCall<'a, C> {
17260        self._scopes.clear();
17261        self
17262    }
17263}
17264
17265/// Updates a datafeed configuration of your Merchant Center account. Any fields that are not provided are deleted from the resource.
17266///
17267/// A builder for the *update* method supported by a *datafeed* resource.
17268/// It is not used directly, but through a [`DatafeedMethods`] instance.
17269///
17270/// # Example
17271///
17272/// Instantiate a resource method builder
17273///
17274/// ```test_harness,no_run
17275/// # extern crate hyper;
17276/// # extern crate hyper_rustls;
17277/// # extern crate google_content2 as content2;
17278/// use content2::api::Datafeed;
17279/// # async fn dox() {
17280/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17281///
17282/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17283/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17284/// #     .with_native_roots()
17285/// #     .unwrap()
17286/// #     .https_only()
17287/// #     .enable_http2()
17288/// #     .build();
17289///
17290/// # let executor = hyper_util::rt::TokioExecutor::new();
17291/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17292/// #     secret,
17293/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17294/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17295/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17296/// #     ),
17297/// # ).build().await.unwrap();
17298///
17299/// # let client = hyper_util::client::legacy::Client::builder(
17300/// #     hyper_util::rt::TokioExecutor::new()
17301/// # )
17302/// # .build(
17303/// #     hyper_rustls::HttpsConnectorBuilder::new()
17304/// #         .with_native_roots()
17305/// #         .unwrap()
17306/// #         .https_or_http()
17307/// #         .enable_http2()
17308/// #         .build()
17309/// # );
17310/// # let mut hub = ShoppingContent::new(client, auth);
17311/// // As the method needs a request, you would usually fill it with the desired information
17312/// // into the respective structure. Some of the parts shown here might not be applicable !
17313/// // Values shown here are possibly random and not representative !
17314/// let mut req = Datafeed::default();
17315///
17316/// // You can configure optional parameters by calling the respective setters at will, and
17317/// // execute the final call using `doit()`.
17318/// // Values shown here are possibly random and not representative !
17319/// let result = hub.datafeeds().update(req, 5, 99)
17320///              .dry_run(true)
17321///              .doit().await;
17322/// # }
17323/// ```
17324pub struct DatafeedUpdateCall<'a, C>
17325where
17326    C: 'a,
17327{
17328    hub: &'a ShoppingContent<C>,
17329    _request: Datafeed,
17330    _merchant_id: u64,
17331    _datafeed_id: u64,
17332    _dry_run: Option<bool>,
17333    _delegate: Option<&'a mut dyn common::Delegate>,
17334    _additional_params: HashMap<String, String>,
17335    _scopes: BTreeSet<String>,
17336}
17337
17338impl<'a, C> common::CallBuilder for DatafeedUpdateCall<'a, C> {}
17339
17340impl<'a, C> DatafeedUpdateCall<'a, C>
17341where
17342    C: common::Connector,
17343{
17344    /// Perform the operation you have build so far.
17345    pub async fn doit(mut self) -> common::Result<(common::Response, Datafeed)> {
17346        use std::borrow::Cow;
17347        use std::io::{Read, Seek};
17348
17349        use common::{url::Params, ToParts};
17350        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17351
17352        let mut dd = common::DefaultDelegate;
17353        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17354        dlg.begin(common::MethodInfo {
17355            id: "content.datafeeds.update",
17356            http_method: hyper::Method::PUT,
17357        });
17358
17359        for &field in ["alt", "merchantId", "datafeedId", "dryRun"].iter() {
17360            if self._additional_params.contains_key(field) {
17361                dlg.finished(false);
17362                return Err(common::Error::FieldClash(field));
17363            }
17364        }
17365
17366        let mut params = Params::with_capacity(6 + self._additional_params.len());
17367        params.push("merchantId", self._merchant_id.to_string());
17368        params.push("datafeedId", self._datafeed_id.to_string());
17369        if let Some(value) = self._dry_run.as_ref() {
17370            params.push("dryRun", value.to_string());
17371        }
17372
17373        params.extend(self._additional_params.iter());
17374
17375        params.push("alt", "json");
17376        let mut url = self.hub._base_url.clone() + "{merchantId}/datafeeds/{datafeedId}";
17377        if self._scopes.is_empty() {
17378            self._scopes.insert(Scope::Full.as_ref().to_string());
17379        }
17380
17381        #[allow(clippy::single_element_loop)]
17382        for &(find_this, param_name) in [
17383            ("{merchantId}", "merchantId"),
17384            ("{datafeedId}", "datafeedId"),
17385        ]
17386        .iter()
17387        {
17388            url = params.uri_replacement(url, param_name, find_this, false);
17389        }
17390        {
17391            let to_remove = ["datafeedId", "merchantId"];
17392            params.remove_params(&to_remove);
17393        }
17394
17395        let url = params.parse_with_url(&url);
17396
17397        let mut json_mime_type = mime::APPLICATION_JSON;
17398        let mut request_value_reader = {
17399            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17400            common::remove_json_null_values(&mut value);
17401            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17402            serde_json::to_writer(&mut dst, &value).unwrap();
17403            dst
17404        };
17405        let request_size = request_value_reader
17406            .seek(std::io::SeekFrom::End(0))
17407            .unwrap();
17408        request_value_reader
17409            .seek(std::io::SeekFrom::Start(0))
17410            .unwrap();
17411
17412        loop {
17413            let token = match self
17414                .hub
17415                .auth
17416                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17417                .await
17418            {
17419                Ok(token) => token,
17420                Err(e) => match dlg.token(e) {
17421                    Ok(token) => token,
17422                    Err(e) => {
17423                        dlg.finished(false);
17424                        return Err(common::Error::MissingToken(e));
17425                    }
17426                },
17427            };
17428            request_value_reader
17429                .seek(std::io::SeekFrom::Start(0))
17430                .unwrap();
17431            let mut req_result = {
17432                let client = &self.hub.client;
17433                dlg.pre_request();
17434                let mut req_builder = hyper::Request::builder()
17435                    .method(hyper::Method::PUT)
17436                    .uri(url.as_str())
17437                    .header(USER_AGENT, self.hub._user_agent.clone());
17438
17439                if let Some(token) = token.as_ref() {
17440                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17441                }
17442
17443                let request = req_builder
17444                    .header(CONTENT_TYPE, json_mime_type.to_string())
17445                    .header(CONTENT_LENGTH, request_size as u64)
17446                    .body(common::to_body(
17447                        request_value_reader.get_ref().clone().into(),
17448                    ));
17449
17450                client.request(request.unwrap()).await
17451            };
17452
17453            match req_result {
17454                Err(err) => {
17455                    if let common::Retry::After(d) = dlg.http_error(&err) {
17456                        sleep(d).await;
17457                        continue;
17458                    }
17459                    dlg.finished(false);
17460                    return Err(common::Error::HttpError(err));
17461                }
17462                Ok(res) => {
17463                    let (mut parts, body) = res.into_parts();
17464                    let mut body = common::Body::new(body);
17465                    if !parts.status.is_success() {
17466                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17467                        let error = serde_json::from_str(&common::to_string(&bytes));
17468                        let response = common::to_response(parts, bytes.into());
17469
17470                        if let common::Retry::After(d) =
17471                            dlg.http_failure(&response, error.as_ref().ok())
17472                        {
17473                            sleep(d).await;
17474                            continue;
17475                        }
17476
17477                        dlg.finished(false);
17478
17479                        return Err(match error {
17480                            Ok(value) => common::Error::BadRequest(value),
17481                            _ => common::Error::Failure(response),
17482                        });
17483                    }
17484                    let response = {
17485                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17486                        let encoded = common::to_string(&bytes);
17487                        match serde_json::from_str(&encoded) {
17488                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17489                            Err(error) => {
17490                                dlg.response_json_decode_error(&encoded, &error);
17491                                return Err(common::Error::JsonDecodeError(
17492                                    encoded.to_string(),
17493                                    error,
17494                                ));
17495                            }
17496                        }
17497                    };
17498
17499                    dlg.finished(true);
17500                    return Ok(response);
17501                }
17502            }
17503        }
17504    }
17505
17506    ///
17507    /// Sets the *request* property to the given value.
17508    ///
17509    /// Even though the property as already been set when instantiating this call,
17510    /// we provide this method for API completeness.
17511    pub fn request(mut self, new_value: Datafeed) -> DatafeedUpdateCall<'a, C> {
17512        self._request = new_value;
17513        self
17514    }
17515    /// The ID of the account that manages the datafeed. This account cannot be a multi-client account.
17516    ///
17517    /// Sets the *merchant id* path property to the given value.
17518    ///
17519    /// Even though the property as already been set when instantiating this call,
17520    /// we provide this method for API completeness.
17521    pub fn merchant_id(mut self, new_value: u64) -> DatafeedUpdateCall<'a, C> {
17522        self._merchant_id = new_value;
17523        self
17524    }
17525    /// The ID of the datafeed.
17526    ///
17527    /// Sets the *datafeed id* path property to the given value.
17528    ///
17529    /// Even though the property as already been set when instantiating this call,
17530    /// we provide this method for API completeness.
17531    pub fn datafeed_id(mut self, new_value: u64) -> DatafeedUpdateCall<'a, C> {
17532        self._datafeed_id = new_value;
17533        self
17534    }
17535    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
17536    ///
17537    /// Sets the *dry run* query property to the given value.
17538    pub fn dry_run(mut self, new_value: bool) -> DatafeedUpdateCall<'a, C> {
17539        self._dry_run = Some(new_value);
17540        self
17541    }
17542    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17543    /// while executing the actual API request.
17544    ///
17545    /// ````text
17546    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17547    /// ````
17548    ///
17549    /// Sets the *delegate* property to the given value.
17550    pub fn delegate(
17551        mut self,
17552        new_value: &'a mut dyn common::Delegate,
17553    ) -> DatafeedUpdateCall<'a, C> {
17554        self._delegate = Some(new_value);
17555        self
17556    }
17557
17558    /// Set any additional parameter of the query string used in the request.
17559    /// It should be used to set parameters which are not yet available through their own
17560    /// setters.
17561    ///
17562    /// Please note that this method must not be used to set any of the known parameters
17563    /// which have their own setter method. If done anyway, the request will fail.
17564    ///
17565    /// # Additional Parameters
17566    ///
17567    /// * *$.xgafv* (query-string) - V1 error format.
17568    /// * *access_token* (query-string) - OAuth access token.
17569    /// * *alt* (query-string) - Data format for response.
17570    /// * *callback* (query-string) - JSONP
17571    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17572    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17573    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17574    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17575    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17576    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17577    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17578    pub fn param<T>(mut self, name: T, value: T) -> DatafeedUpdateCall<'a, C>
17579    where
17580        T: AsRef<str>,
17581    {
17582        self._additional_params
17583            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17584        self
17585    }
17586
17587    /// Identifies the authorization scope for the method you are building.
17588    ///
17589    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17590    /// [`Scope::Full`].
17591    ///
17592    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17593    /// tokens for more than one scope.
17594    ///
17595    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17596    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17597    /// sufficient, a read-write scope will do as well.
17598    pub fn add_scope<St>(mut self, scope: St) -> DatafeedUpdateCall<'a, C>
17599    where
17600        St: AsRef<str>,
17601    {
17602        self._scopes.insert(String::from(scope.as_ref()));
17603        self
17604    }
17605    /// Identifies the authorization scope(s) for the method you are building.
17606    ///
17607    /// See [`Self::add_scope()`] for details.
17608    pub fn add_scopes<I, St>(mut self, scopes: I) -> DatafeedUpdateCall<'a, C>
17609    where
17610        I: IntoIterator<Item = St>,
17611        St: AsRef<str>,
17612    {
17613        self._scopes
17614            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17615        self
17616    }
17617
17618    /// Removes all scopes, and no default scope will be used either.
17619    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17620    /// for details).
17621    pub fn clear_scopes(mut self) -> DatafeedUpdateCall<'a, C> {
17622        self._scopes.clear();
17623        self
17624    }
17625}
17626
17627/// Gets multiple Merchant Center datafeed statuses in a single request.
17628///
17629/// A builder for the *custombatch* method supported by a *datafeedstatus* resource.
17630/// It is not used directly, but through a [`DatafeedstatusMethods`] instance.
17631///
17632/// # Example
17633///
17634/// Instantiate a resource method builder
17635///
17636/// ```test_harness,no_run
17637/// # extern crate hyper;
17638/// # extern crate hyper_rustls;
17639/// # extern crate google_content2 as content2;
17640/// use content2::api::DatafeedstatusesCustomBatchRequest;
17641/// # async fn dox() {
17642/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17643///
17644/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17645/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17646/// #     .with_native_roots()
17647/// #     .unwrap()
17648/// #     .https_only()
17649/// #     .enable_http2()
17650/// #     .build();
17651///
17652/// # let executor = hyper_util::rt::TokioExecutor::new();
17653/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17654/// #     secret,
17655/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17656/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17657/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17658/// #     ),
17659/// # ).build().await.unwrap();
17660///
17661/// # let client = hyper_util::client::legacy::Client::builder(
17662/// #     hyper_util::rt::TokioExecutor::new()
17663/// # )
17664/// # .build(
17665/// #     hyper_rustls::HttpsConnectorBuilder::new()
17666/// #         .with_native_roots()
17667/// #         .unwrap()
17668/// #         .https_or_http()
17669/// #         .enable_http2()
17670/// #         .build()
17671/// # );
17672/// # let mut hub = ShoppingContent::new(client, auth);
17673/// // As the method needs a request, you would usually fill it with the desired information
17674/// // into the respective structure. Some of the parts shown here might not be applicable !
17675/// // Values shown here are possibly random and not representative !
17676/// let mut req = DatafeedstatusesCustomBatchRequest::default();
17677///
17678/// // You can configure optional parameters by calling the respective setters at will, and
17679/// // execute the final call using `doit()`.
17680/// // Values shown here are possibly random and not representative !
17681/// let result = hub.datafeedstatuses().custombatch(req)
17682///              .doit().await;
17683/// # }
17684/// ```
17685pub struct DatafeedstatusCustombatchCall<'a, C>
17686where
17687    C: 'a,
17688{
17689    hub: &'a ShoppingContent<C>,
17690    _request: DatafeedstatusesCustomBatchRequest,
17691    _delegate: Option<&'a mut dyn common::Delegate>,
17692    _additional_params: HashMap<String, String>,
17693    _scopes: BTreeSet<String>,
17694}
17695
17696impl<'a, C> common::CallBuilder for DatafeedstatusCustombatchCall<'a, C> {}
17697
17698impl<'a, C> DatafeedstatusCustombatchCall<'a, C>
17699where
17700    C: common::Connector,
17701{
17702    /// Perform the operation you have build so far.
17703    pub async fn doit(
17704        mut self,
17705    ) -> common::Result<(common::Response, DatafeedstatusesCustomBatchResponse)> {
17706        use std::borrow::Cow;
17707        use std::io::{Read, Seek};
17708
17709        use common::{url::Params, ToParts};
17710        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17711
17712        let mut dd = common::DefaultDelegate;
17713        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17714        dlg.begin(common::MethodInfo {
17715            id: "content.datafeedstatuses.custombatch",
17716            http_method: hyper::Method::POST,
17717        });
17718
17719        for &field in ["alt"].iter() {
17720            if self._additional_params.contains_key(field) {
17721                dlg.finished(false);
17722                return Err(common::Error::FieldClash(field));
17723            }
17724        }
17725
17726        let mut params = Params::with_capacity(3 + self._additional_params.len());
17727
17728        params.extend(self._additional_params.iter());
17729
17730        params.push("alt", "json");
17731        let mut url = self.hub._base_url.clone() + "datafeedstatuses/batch";
17732        if self._scopes.is_empty() {
17733            self._scopes.insert(Scope::Full.as_ref().to_string());
17734        }
17735
17736        let url = params.parse_with_url(&url);
17737
17738        let mut json_mime_type = mime::APPLICATION_JSON;
17739        let mut request_value_reader = {
17740            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17741            common::remove_json_null_values(&mut value);
17742            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17743            serde_json::to_writer(&mut dst, &value).unwrap();
17744            dst
17745        };
17746        let request_size = request_value_reader
17747            .seek(std::io::SeekFrom::End(0))
17748            .unwrap();
17749        request_value_reader
17750            .seek(std::io::SeekFrom::Start(0))
17751            .unwrap();
17752
17753        loop {
17754            let token = match self
17755                .hub
17756                .auth
17757                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17758                .await
17759            {
17760                Ok(token) => token,
17761                Err(e) => match dlg.token(e) {
17762                    Ok(token) => token,
17763                    Err(e) => {
17764                        dlg.finished(false);
17765                        return Err(common::Error::MissingToken(e));
17766                    }
17767                },
17768            };
17769            request_value_reader
17770                .seek(std::io::SeekFrom::Start(0))
17771                .unwrap();
17772            let mut req_result = {
17773                let client = &self.hub.client;
17774                dlg.pre_request();
17775                let mut req_builder = hyper::Request::builder()
17776                    .method(hyper::Method::POST)
17777                    .uri(url.as_str())
17778                    .header(USER_AGENT, self.hub._user_agent.clone());
17779
17780                if let Some(token) = token.as_ref() {
17781                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17782                }
17783
17784                let request = req_builder
17785                    .header(CONTENT_TYPE, json_mime_type.to_string())
17786                    .header(CONTENT_LENGTH, request_size as u64)
17787                    .body(common::to_body(
17788                        request_value_reader.get_ref().clone().into(),
17789                    ));
17790
17791                client.request(request.unwrap()).await
17792            };
17793
17794            match req_result {
17795                Err(err) => {
17796                    if let common::Retry::After(d) = dlg.http_error(&err) {
17797                        sleep(d).await;
17798                        continue;
17799                    }
17800                    dlg.finished(false);
17801                    return Err(common::Error::HttpError(err));
17802                }
17803                Ok(res) => {
17804                    let (mut parts, body) = res.into_parts();
17805                    let mut body = common::Body::new(body);
17806                    if !parts.status.is_success() {
17807                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17808                        let error = serde_json::from_str(&common::to_string(&bytes));
17809                        let response = common::to_response(parts, bytes.into());
17810
17811                        if let common::Retry::After(d) =
17812                            dlg.http_failure(&response, error.as_ref().ok())
17813                        {
17814                            sleep(d).await;
17815                            continue;
17816                        }
17817
17818                        dlg.finished(false);
17819
17820                        return Err(match error {
17821                            Ok(value) => common::Error::BadRequest(value),
17822                            _ => common::Error::Failure(response),
17823                        });
17824                    }
17825                    let response = {
17826                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17827                        let encoded = common::to_string(&bytes);
17828                        match serde_json::from_str(&encoded) {
17829                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17830                            Err(error) => {
17831                                dlg.response_json_decode_error(&encoded, &error);
17832                                return Err(common::Error::JsonDecodeError(
17833                                    encoded.to_string(),
17834                                    error,
17835                                ));
17836                            }
17837                        }
17838                    };
17839
17840                    dlg.finished(true);
17841                    return Ok(response);
17842                }
17843            }
17844        }
17845    }
17846
17847    ///
17848    /// Sets the *request* property to the given value.
17849    ///
17850    /// Even though the property as already been set when instantiating this call,
17851    /// we provide this method for API completeness.
17852    pub fn request(
17853        mut self,
17854        new_value: DatafeedstatusesCustomBatchRequest,
17855    ) -> DatafeedstatusCustombatchCall<'a, C> {
17856        self._request = new_value;
17857        self
17858    }
17859    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17860    /// while executing the actual API request.
17861    ///
17862    /// ````text
17863    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17864    /// ````
17865    ///
17866    /// Sets the *delegate* property to the given value.
17867    pub fn delegate(
17868        mut self,
17869        new_value: &'a mut dyn common::Delegate,
17870    ) -> DatafeedstatusCustombatchCall<'a, C> {
17871        self._delegate = Some(new_value);
17872        self
17873    }
17874
17875    /// Set any additional parameter of the query string used in the request.
17876    /// It should be used to set parameters which are not yet available through their own
17877    /// setters.
17878    ///
17879    /// Please note that this method must not be used to set any of the known parameters
17880    /// which have their own setter method. If done anyway, the request will fail.
17881    ///
17882    /// # Additional Parameters
17883    ///
17884    /// * *$.xgafv* (query-string) - V1 error format.
17885    /// * *access_token* (query-string) - OAuth access token.
17886    /// * *alt* (query-string) - Data format for response.
17887    /// * *callback* (query-string) - JSONP
17888    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17889    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17890    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17891    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17892    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17893    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17894    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17895    pub fn param<T>(mut self, name: T, value: T) -> DatafeedstatusCustombatchCall<'a, C>
17896    where
17897        T: AsRef<str>,
17898    {
17899        self._additional_params
17900            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17901        self
17902    }
17903
17904    /// Identifies the authorization scope for the method you are building.
17905    ///
17906    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17907    /// [`Scope::Full`].
17908    ///
17909    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17910    /// tokens for more than one scope.
17911    ///
17912    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17913    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17914    /// sufficient, a read-write scope will do as well.
17915    pub fn add_scope<St>(mut self, scope: St) -> DatafeedstatusCustombatchCall<'a, C>
17916    where
17917        St: AsRef<str>,
17918    {
17919        self._scopes.insert(String::from(scope.as_ref()));
17920        self
17921    }
17922    /// Identifies the authorization scope(s) for the method you are building.
17923    ///
17924    /// See [`Self::add_scope()`] for details.
17925    pub fn add_scopes<I, St>(mut self, scopes: I) -> DatafeedstatusCustombatchCall<'a, C>
17926    where
17927        I: IntoIterator<Item = St>,
17928        St: AsRef<str>,
17929    {
17930        self._scopes
17931            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17932        self
17933    }
17934
17935    /// Removes all scopes, and no default scope will be used either.
17936    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17937    /// for details).
17938    pub fn clear_scopes(mut self) -> DatafeedstatusCustombatchCall<'a, C> {
17939        self._scopes.clear();
17940        self
17941    }
17942}
17943
17944/// Retrieves the status of a datafeed from your Merchant Center account.
17945///
17946/// A builder for the *get* method supported by a *datafeedstatus* resource.
17947/// It is not used directly, but through a [`DatafeedstatusMethods`] instance.
17948///
17949/// # Example
17950///
17951/// Instantiate a resource method builder
17952///
17953/// ```test_harness,no_run
17954/// # extern crate hyper;
17955/// # extern crate hyper_rustls;
17956/// # extern crate google_content2 as content2;
17957/// # async fn dox() {
17958/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17959///
17960/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17961/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17962/// #     .with_native_roots()
17963/// #     .unwrap()
17964/// #     .https_only()
17965/// #     .enable_http2()
17966/// #     .build();
17967///
17968/// # let executor = hyper_util::rt::TokioExecutor::new();
17969/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17970/// #     secret,
17971/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17972/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17973/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17974/// #     ),
17975/// # ).build().await.unwrap();
17976///
17977/// # let client = hyper_util::client::legacy::Client::builder(
17978/// #     hyper_util::rt::TokioExecutor::new()
17979/// # )
17980/// # .build(
17981/// #     hyper_rustls::HttpsConnectorBuilder::new()
17982/// #         .with_native_roots()
17983/// #         .unwrap()
17984/// #         .https_or_http()
17985/// #         .enable_http2()
17986/// #         .build()
17987/// # );
17988/// # let mut hub = ShoppingContent::new(client, auth);
17989/// // You can configure optional parameters by calling the respective setters at will, and
17990/// // execute the final call using `doit()`.
17991/// // Values shown here are possibly random and not representative !
17992/// let result = hub.datafeedstatuses().get(27, 78)
17993///              .language("voluptua.")
17994///              .country("dolore")
17995///              .doit().await;
17996/// # }
17997/// ```
17998pub struct DatafeedstatusGetCall<'a, C>
17999where
18000    C: 'a,
18001{
18002    hub: &'a ShoppingContent<C>,
18003    _merchant_id: u64,
18004    _datafeed_id: u64,
18005    _language: Option<String>,
18006    _country: Option<String>,
18007    _delegate: Option<&'a mut dyn common::Delegate>,
18008    _additional_params: HashMap<String, String>,
18009    _scopes: BTreeSet<String>,
18010}
18011
18012impl<'a, C> common::CallBuilder for DatafeedstatusGetCall<'a, C> {}
18013
18014impl<'a, C> DatafeedstatusGetCall<'a, C>
18015where
18016    C: common::Connector,
18017{
18018    /// Perform the operation you have build so far.
18019    pub async fn doit(mut self) -> common::Result<(common::Response, DatafeedStatus)> {
18020        use std::borrow::Cow;
18021        use std::io::{Read, Seek};
18022
18023        use common::{url::Params, ToParts};
18024        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18025
18026        let mut dd = common::DefaultDelegate;
18027        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18028        dlg.begin(common::MethodInfo {
18029            id: "content.datafeedstatuses.get",
18030            http_method: hyper::Method::GET,
18031        });
18032
18033        for &field in ["alt", "merchantId", "datafeedId", "language", "country"].iter() {
18034            if self._additional_params.contains_key(field) {
18035                dlg.finished(false);
18036                return Err(common::Error::FieldClash(field));
18037            }
18038        }
18039
18040        let mut params = Params::with_capacity(6 + self._additional_params.len());
18041        params.push("merchantId", self._merchant_id.to_string());
18042        params.push("datafeedId", self._datafeed_id.to_string());
18043        if let Some(value) = self._language.as_ref() {
18044            params.push("language", value);
18045        }
18046        if let Some(value) = self._country.as_ref() {
18047            params.push("country", value);
18048        }
18049
18050        params.extend(self._additional_params.iter());
18051
18052        params.push("alt", "json");
18053        let mut url = self.hub._base_url.clone() + "{merchantId}/datafeedstatuses/{datafeedId}";
18054        if self._scopes.is_empty() {
18055            self._scopes.insert(Scope::Full.as_ref().to_string());
18056        }
18057
18058        #[allow(clippy::single_element_loop)]
18059        for &(find_this, param_name) in [
18060            ("{merchantId}", "merchantId"),
18061            ("{datafeedId}", "datafeedId"),
18062        ]
18063        .iter()
18064        {
18065            url = params.uri_replacement(url, param_name, find_this, false);
18066        }
18067        {
18068            let to_remove = ["datafeedId", "merchantId"];
18069            params.remove_params(&to_remove);
18070        }
18071
18072        let url = params.parse_with_url(&url);
18073
18074        loop {
18075            let token = match self
18076                .hub
18077                .auth
18078                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18079                .await
18080            {
18081                Ok(token) => token,
18082                Err(e) => match dlg.token(e) {
18083                    Ok(token) => token,
18084                    Err(e) => {
18085                        dlg.finished(false);
18086                        return Err(common::Error::MissingToken(e));
18087                    }
18088                },
18089            };
18090            let mut req_result = {
18091                let client = &self.hub.client;
18092                dlg.pre_request();
18093                let mut req_builder = hyper::Request::builder()
18094                    .method(hyper::Method::GET)
18095                    .uri(url.as_str())
18096                    .header(USER_AGENT, self.hub._user_agent.clone());
18097
18098                if let Some(token) = token.as_ref() {
18099                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18100                }
18101
18102                let request = req_builder
18103                    .header(CONTENT_LENGTH, 0_u64)
18104                    .body(common::to_body::<String>(None));
18105
18106                client.request(request.unwrap()).await
18107            };
18108
18109            match req_result {
18110                Err(err) => {
18111                    if let common::Retry::After(d) = dlg.http_error(&err) {
18112                        sleep(d).await;
18113                        continue;
18114                    }
18115                    dlg.finished(false);
18116                    return Err(common::Error::HttpError(err));
18117                }
18118                Ok(res) => {
18119                    let (mut parts, body) = res.into_parts();
18120                    let mut body = common::Body::new(body);
18121                    if !parts.status.is_success() {
18122                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18123                        let error = serde_json::from_str(&common::to_string(&bytes));
18124                        let response = common::to_response(parts, bytes.into());
18125
18126                        if let common::Retry::After(d) =
18127                            dlg.http_failure(&response, error.as_ref().ok())
18128                        {
18129                            sleep(d).await;
18130                            continue;
18131                        }
18132
18133                        dlg.finished(false);
18134
18135                        return Err(match error {
18136                            Ok(value) => common::Error::BadRequest(value),
18137                            _ => common::Error::Failure(response),
18138                        });
18139                    }
18140                    let response = {
18141                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18142                        let encoded = common::to_string(&bytes);
18143                        match serde_json::from_str(&encoded) {
18144                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18145                            Err(error) => {
18146                                dlg.response_json_decode_error(&encoded, &error);
18147                                return Err(common::Error::JsonDecodeError(
18148                                    encoded.to_string(),
18149                                    error,
18150                                ));
18151                            }
18152                        }
18153                    };
18154
18155                    dlg.finished(true);
18156                    return Ok(response);
18157                }
18158            }
18159        }
18160    }
18161
18162    /// The ID of the account that manages the datafeed. This account cannot be a multi-client account.
18163    ///
18164    /// Sets the *merchant id* path property to the given value.
18165    ///
18166    /// Even though the property as already been set when instantiating this call,
18167    /// we provide this method for API completeness.
18168    pub fn merchant_id(mut self, new_value: u64) -> DatafeedstatusGetCall<'a, C> {
18169        self._merchant_id = new_value;
18170        self
18171    }
18172    /// The ID of the datafeed.
18173    ///
18174    /// Sets the *datafeed id* path property to the given value.
18175    ///
18176    /// Even though the property as already been set when instantiating this call,
18177    /// we provide this method for API completeness.
18178    pub fn datafeed_id(mut self, new_value: u64) -> DatafeedstatusGetCall<'a, C> {
18179        self._datafeed_id = new_value;
18180        self
18181    }
18182    /// The language for which to get the datafeed status. If this parameter is provided then country must also be provided. Note that this parameter is required for feeds targeting multiple countries and languages, since a feed may have a different status for each target.
18183    ///
18184    /// Sets the *language* query property to the given value.
18185    pub fn language(mut self, new_value: &str) -> DatafeedstatusGetCall<'a, C> {
18186        self._language = Some(new_value.to_string());
18187        self
18188    }
18189    /// The country for which to get the datafeed status. If this parameter is provided then language must also be provided. Note that this parameter is required for feeds targeting multiple countries and languages, since a feed may have a different status for each target.
18190    ///
18191    /// Sets the *country* query property to the given value.
18192    pub fn country(mut self, new_value: &str) -> DatafeedstatusGetCall<'a, C> {
18193        self._country = Some(new_value.to_string());
18194        self
18195    }
18196    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18197    /// while executing the actual API request.
18198    ///
18199    /// ````text
18200    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18201    /// ````
18202    ///
18203    /// Sets the *delegate* property to the given value.
18204    pub fn delegate(
18205        mut self,
18206        new_value: &'a mut dyn common::Delegate,
18207    ) -> DatafeedstatusGetCall<'a, C> {
18208        self._delegate = Some(new_value);
18209        self
18210    }
18211
18212    /// Set any additional parameter of the query string used in the request.
18213    /// It should be used to set parameters which are not yet available through their own
18214    /// setters.
18215    ///
18216    /// Please note that this method must not be used to set any of the known parameters
18217    /// which have their own setter method. If done anyway, the request will fail.
18218    ///
18219    /// # Additional Parameters
18220    ///
18221    /// * *$.xgafv* (query-string) - V1 error format.
18222    /// * *access_token* (query-string) - OAuth access token.
18223    /// * *alt* (query-string) - Data format for response.
18224    /// * *callback* (query-string) - JSONP
18225    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18226    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18227    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18228    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18229    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18230    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18231    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18232    pub fn param<T>(mut self, name: T, value: T) -> DatafeedstatusGetCall<'a, C>
18233    where
18234        T: AsRef<str>,
18235    {
18236        self._additional_params
18237            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18238        self
18239    }
18240
18241    /// Identifies the authorization scope for the method you are building.
18242    ///
18243    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18244    /// [`Scope::Full`].
18245    ///
18246    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18247    /// tokens for more than one scope.
18248    ///
18249    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18250    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18251    /// sufficient, a read-write scope will do as well.
18252    pub fn add_scope<St>(mut self, scope: St) -> DatafeedstatusGetCall<'a, C>
18253    where
18254        St: AsRef<str>,
18255    {
18256        self._scopes.insert(String::from(scope.as_ref()));
18257        self
18258    }
18259    /// Identifies the authorization scope(s) for the method you are building.
18260    ///
18261    /// See [`Self::add_scope()`] for details.
18262    pub fn add_scopes<I, St>(mut self, scopes: I) -> DatafeedstatusGetCall<'a, C>
18263    where
18264        I: IntoIterator<Item = St>,
18265        St: AsRef<str>,
18266    {
18267        self._scopes
18268            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18269        self
18270    }
18271
18272    /// Removes all scopes, and no default scope will be used either.
18273    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18274    /// for details).
18275    pub fn clear_scopes(mut self) -> DatafeedstatusGetCall<'a, C> {
18276        self._scopes.clear();
18277        self
18278    }
18279}
18280
18281/// Lists the statuses of the datafeeds in your Merchant Center account.
18282///
18283/// A builder for the *list* method supported by a *datafeedstatus* resource.
18284/// It is not used directly, but through a [`DatafeedstatusMethods`] instance.
18285///
18286/// # Example
18287///
18288/// Instantiate a resource method builder
18289///
18290/// ```test_harness,no_run
18291/// # extern crate hyper;
18292/// # extern crate hyper_rustls;
18293/// # extern crate google_content2 as content2;
18294/// # async fn dox() {
18295/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18296///
18297/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18298/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18299/// #     .with_native_roots()
18300/// #     .unwrap()
18301/// #     .https_only()
18302/// #     .enable_http2()
18303/// #     .build();
18304///
18305/// # let executor = hyper_util::rt::TokioExecutor::new();
18306/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18307/// #     secret,
18308/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18309/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18310/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18311/// #     ),
18312/// # ).build().await.unwrap();
18313///
18314/// # let client = hyper_util::client::legacy::Client::builder(
18315/// #     hyper_util::rt::TokioExecutor::new()
18316/// # )
18317/// # .build(
18318/// #     hyper_rustls::HttpsConnectorBuilder::new()
18319/// #         .with_native_roots()
18320/// #         .unwrap()
18321/// #         .https_or_http()
18322/// #         .enable_http2()
18323/// #         .build()
18324/// # );
18325/// # let mut hub = ShoppingContent::new(client, auth);
18326/// // You can configure optional parameters by calling the respective setters at will, and
18327/// // execute the final call using `doit()`.
18328/// // Values shown here are possibly random and not representative !
18329/// let result = hub.datafeedstatuses().list(67)
18330///              .page_token("dolore")
18331///              .max_results(23)
18332///              .doit().await;
18333/// # }
18334/// ```
18335pub struct DatafeedstatusListCall<'a, C>
18336where
18337    C: 'a,
18338{
18339    hub: &'a ShoppingContent<C>,
18340    _merchant_id: u64,
18341    _page_token: Option<String>,
18342    _max_results: Option<u32>,
18343    _delegate: Option<&'a mut dyn common::Delegate>,
18344    _additional_params: HashMap<String, String>,
18345    _scopes: BTreeSet<String>,
18346}
18347
18348impl<'a, C> common::CallBuilder for DatafeedstatusListCall<'a, C> {}
18349
18350impl<'a, C> DatafeedstatusListCall<'a, C>
18351where
18352    C: common::Connector,
18353{
18354    /// Perform the operation you have build so far.
18355    pub async fn doit(
18356        mut self,
18357    ) -> common::Result<(common::Response, DatafeedstatusesListResponse)> {
18358        use std::borrow::Cow;
18359        use std::io::{Read, Seek};
18360
18361        use common::{url::Params, ToParts};
18362        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18363
18364        let mut dd = common::DefaultDelegate;
18365        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18366        dlg.begin(common::MethodInfo {
18367            id: "content.datafeedstatuses.list",
18368            http_method: hyper::Method::GET,
18369        });
18370
18371        for &field in ["alt", "merchantId", "pageToken", "maxResults"].iter() {
18372            if self._additional_params.contains_key(field) {
18373                dlg.finished(false);
18374                return Err(common::Error::FieldClash(field));
18375            }
18376        }
18377
18378        let mut params = Params::with_capacity(5 + self._additional_params.len());
18379        params.push("merchantId", self._merchant_id.to_string());
18380        if let Some(value) = self._page_token.as_ref() {
18381            params.push("pageToken", value);
18382        }
18383        if let Some(value) = self._max_results.as_ref() {
18384            params.push("maxResults", value.to_string());
18385        }
18386
18387        params.extend(self._additional_params.iter());
18388
18389        params.push("alt", "json");
18390        let mut url = self.hub._base_url.clone() + "{merchantId}/datafeedstatuses";
18391        if self._scopes.is_empty() {
18392            self._scopes.insert(Scope::Full.as_ref().to_string());
18393        }
18394
18395        #[allow(clippy::single_element_loop)]
18396        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
18397            url = params.uri_replacement(url, param_name, find_this, false);
18398        }
18399        {
18400            let to_remove = ["merchantId"];
18401            params.remove_params(&to_remove);
18402        }
18403
18404        let url = params.parse_with_url(&url);
18405
18406        loop {
18407            let token = match self
18408                .hub
18409                .auth
18410                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18411                .await
18412            {
18413                Ok(token) => token,
18414                Err(e) => match dlg.token(e) {
18415                    Ok(token) => token,
18416                    Err(e) => {
18417                        dlg.finished(false);
18418                        return Err(common::Error::MissingToken(e));
18419                    }
18420                },
18421            };
18422            let mut req_result = {
18423                let client = &self.hub.client;
18424                dlg.pre_request();
18425                let mut req_builder = hyper::Request::builder()
18426                    .method(hyper::Method::GET)
18427                    .uri(url.as_str())
18428                    .header(USER_AGENT, self.hub._user_agent.clone());
18429
18430                if let Some(token) = token.as_ref() {
18431                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18432                }
18433
18434                let request = req_builder
18435                    .header(CONTENT_LENGTH, 0_u64)
18436                    .body(common::to_body::<String>(None));
18437
18438                client.request(request.unwrap()).await
18439            };
18440
18441            match req_result {
18442                Err(err) => {
18443                    if let common::Retry::After(d) = dlg.http_error(&err) {
18444                        sleep(d).await;
18445                        continue;
18446                    }
18447                    dlg.finished(false);
18448                    return Err(common::Error::HttpError(err));
18449                }
18450                Ok(res) => {
18451                    let (mut parts, body) = res.into_parts();
18452                    let mut body = common::Body::new(body);
18453                    if !parts.status.is_success() {
18454                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18455                        let error = serde_json::from_str(&common::to_string(&bytes));
18456                        let response = common::to_response(parts, bytes.into());
18457
18458                        if let common::Retry::After(d) =
18459                            dlg.http_failure(&response, error.as_ref().ok())
18460                        {
18461                            sleep(d).await;
18462                            continue;
18463                        }
18464
18465                        dlg.finished(false);
18466
18467                        return Err(match error {
18468                            Ok(value) => common::Error::BadRequest(value),
18469                            _ => common::Error::Failure(response),
18470                        });
18471                    }
18472                    let response = {
18473                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18474                        let encoded = common::to_string(&bytes);
18475                        match serde_json::from_str(&encoded) {
18476                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18477                            Err(error) => {
18478                                dlg.response_json_decode_error(&encoded, &error);
18479                                return Err(common::Error::JsonDecodeError(
18480                                    encoded.to_string(),
18481                                    error,
18482                                ));
18483                            }
18484                        }
18485                    };
18486
18487                    dlg.finished(true);
18488                    return Ok(response);
18489                }
18490            }
18491        }
18492    }
18493
18494    /// The ID of the account that manages the datafeeds. This account cannot be a multi-client account.
18495    ///
18496    /// Sets the *merchant id* path property to the given value.
18497    ///
18498    /// Even though the property as already been set when instantiating this call,
18499    /// we provide this method for API completeness.
18500    pub fn merchant_id(mut self, new_value: u64) -> DatafeedstatusListCall<'a, C> {
18501        self._merchant_id = new_value;
18502        self
18503    }
18504    /// The token returned by the previous request.
18505    ///
18506    /// Sets the *page token* query property to the given value.
18507    pub fn page_token(mut self, new_value: &str) -> DatafeedstatusListCall<'a, C> {
18508        self._page_token = Some(new_value.to_string());
18509        self
18510    }
18511    /// The maximum number of products to return in the response, used for paging.
18512    ///
18513    /// Sets the *max results* query property to the given value.
18514    pub fn max_results(mut self, new_value: u32) -> DatafeedstatusListCall<'a, C> {
18515        self._max_results = Some(new_value);
18516        self
18517    }
18518    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18519    /// while executing the actual API request.
18520    ///
18521    /// ````text
18522    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18523    /// ````
18524    ///
18525    /// Sets the *delegate* property to the given value.
18526    pub fn delegate(
18527        mut self,
18528        new_value: &'a mut dyn common::Delegate,
18529    ) -> DatafeedstatusListCall<'a, C> {
18530        self._delegate = Some(new_value);
18531        self
18532    }
18533
18534    /// Set any additional parameter of the query string used in the request.
18535    /// It should be used to set parameters which are not yet available through their own
18536    /// setters.
18537    ///
18538    /// Please note that this method must not be used to set any of the known parameters
18539    /// which have their own setter method. If done anyway, the request will fail.
18540    ///
18541    /// # Additional Parameters
18542    ///
18543    /// * *$.xgafv* (query-string) - V1 error format.
18544    /// * *access_token* (query-string) - OAuth access token.
18545    /// * *alt* (query-string) - Data format for response.
18546    /// * *callback* (query-string) - JSONP
18547    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18548    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18549    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18550    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18551    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18552    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18553    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18554    pub fn param<T>(mut self, name: T, value: T) -> DatafeedstatusListCall<'a, C>
18555    where
18556        T: AsRef<str>,
18557    {
18558        self._additional_params
18559            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18560        self
18561    }
18562
18563    /// Identifies the authorization scope for the method you are building.
18564    ///
18565    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18566    /// [`Scope::Full`].
18567    ///
18568    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18569    /// tokens for more than one scope.
18570    ///
18571    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18572    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18573    /// sufficient, a read-write scope will do as well.
18574    pub fn add_scope<St>(mut self, scope: St) -> DatafeedstatusListCall<'a, C>
18575    where
18576        St: AsRef<str>,
18577    {
18578        self._scopes.insert(String::from(scope.as_ref()));
18579        self
18580    }
18581    /// Identifies the authorization scope(s) for the method you are building.
18582    ///
18583    /// See [`Self::add_scope()`] for details.
18584    pub fn add_scopes<I, St>(mut self, scopes: I) -> DatafeedstatusListCall<'a, C>
18585    where
18586        I: IntoIterator<Item = St>,
18587        St: AsRef<str>,
18588    {
18589        self._scopes
18590            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18591        self
18592    }
18593
18594    /// Removes all scopes, and no default scope will be used either.
18595    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18596    /// for details).
18597    pub fn clear_scopes(mut self) -> DatafeedstatusListCall<'a, C> {
18598        self._scopes.clear();
18599        self
18600    }
18601}
18602
18603/// Updates price and availability for multiple products or stores in a single request. This operation does not update the expiration date of the products.
18604///
18605/// A builder for the *custombatch* method supported by a *inventory* resource.
18606/// It is not used directly, but through a [`InventoryMethods`] instance.
18607///
18608/// # Example
18609///
18610/// Instantiate a resource method builder
18611///
18612/// ```test_harness,no_run
18613/// # extern crate hyper;
18614/// # extern crate hyper_rustls;
18615/// # extern crate google_content2 as content2;
18616/// use content2::api::InventoryCustomBatchRequest;
18617/// # async fn dox() {
18618/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18619///
18620/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18621/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18622/// #     .with_native_roots()
18623/// #     .unwrap()
18624/// #     .https_only()
18625/// #     .enable_http2()
18626/// #     .build();
18627///
18628/// # let executor = hyper_util::rt::TokioExecutor::new();
18629/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18630/// #     secret,
18631/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18632/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18633/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18634/// #     ),
18635/// # ).build().await.unwrap();
18636///
18637/// # let client = hyper_util::client::legacy::Client::builder(
18638/// #     hyper_util::rt::TokioExecutor::new()
18639/// # )
18640/// # .build(
18641/// #     hyper_rustls::HttpsConnectorBuilder::new()
18642/// #         .with_native_roots()
18643/// #         .unwrap()
18644/// #         .https_or_http()
18645/// #         .enable_http2()
18646/// #         .build()
18647/// # );
18648/// # let mut hub = ShoppingContent::new(client, auth);
18649/// // As the method needs a request, you would usually fill it with the desired information
18650/// // into the respective structure. Some of the parts shown here might not be applicable !
18651/// // Values shown here are possibly random and not representative !
18652/// let mut req = InventoryCustomBatchRequest::default();
18653///
18654/// // You can configure optional parameters by calling the respective setters at will, and
18655/// // execute the final call using `doit()`.
18656/// // Values shown here are possibly random and not representative !
18657/// let result = hub.inventory().custombatch(req)
18658///              .dry_run(false)
18659///              .doit().await;
18660/// # }
18661/// ```
18662pub struct InventoryCustombatchCall<'a, C>
18663where
18664    C: 'a,
18665{
18666    hub: &'a ShoppingContent<C>,
18667    _request: InventoryCustomBatchRequest,
18668    _dry_run: Option<bool>,
18669    _delegate: Option<&'a mut dyn common::Delegate>,
18670    _additional_params: HashMap<String, String>,
18671    _scopes: BTreeSet<String>,
18672}
18673
18674impl<'a, C> common::CallBuilder for InventoryCustombatchCall<'a, C> {}
18675
18676impl<'a, C> InventoryCustombatchCall<'a, C>
18677where
18678    C: common::Connector,
18679{
18680    /// Perform the operation you have build so far.
18681    pub async fn doit(
18682        mut self,
18683    ) -> common::Result<(common::Response, InventoryCustomBatchResponse)> {
18684        use std::borrow::Cow;
18685        use std::io::{Read, Seek};
18686
18687        use common::{url::Params, ToParts};
18688        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18689
18690        let mut dd = common::DefaultDelegate;
18691        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18692        dlg.begin(common::MethodInfo {
18693            id: "content.inventory.custombatch",
18694            http_method: hyper::Method::POST,
18695        });
18696
18697        for &field in ["alt", "dryRun"].iter() {
18698            if self._additional_params.contains_key(field) {
18699                dlg.finished(false);
18700                return Err(common::Error::FieldClash(field));
18701            }
18702        }
18703
18704        let mut params = Params::with_capacity(4 + self._additional_params.len());
18705        if let Some(value) = self._dry_run.as_ref() {
18706            params.push("dryRun", value.to_string());
18707        }
18708
18709        params.extend(self._additional_params.iter());
18710
18711        params.push("alt", "json");
18712        let mut url = self.hub._base_url.clone() + "inventory/batch";
18713        if self._scopes.is_empty() {
18714            self._scopes.insert(Scope::Full.as_ref().to_string());
18715        }
18716
18717        let url = params.parse_with_url(&url);
18718
18719        let mut json_mime_type = mime::APPLICATION_JSON;
18720        let mut request_value_reader = {
18721            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18722            common::remove_json_null_values(&mut value);
18723            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18724            serde_json::to_writer(&mut dst, &value).unwrap();
18725            dst
18726        };
18727        let request_size = request_value_reader
18728            .seek(std::io::SeekFrom::End(0))
18729            .unwrap();
18730        request_value_reader
18731            .seek(std::io::SeekFrom::Start(0))
18732            .unwrap();
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            request_value_reader
18751                .seek(std::io::SeekFrom::Start(0))
18752                .unwrap();
18753            let mut req_result = {
18754                let client = &self.hub.client;
18755                dlg.pre_request();
18756                let mut req_builder = hyper::Request::builder()
18757                    .method(hyper::Method::POST)
18758                    .uri(url.as_str())
18759                    .header(USER_AGENT, self.hub._user_agent.clone());
18760
18761                if let Some(token) = token.as_ref() {
18762                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18763                }
18764
18765                let request = req_builder
18766                    .header(CONTENT_TYPE, json_mime_type.to_string())
18767                    .header(CONTENT_LENGTH, request_size as u64)
18768                    .body(common::to_body(
18769                        request_value_reader.get_ref().clone().into(),
18770                    ));
18771
18772                client.request(request.unwrap()).await
18773            };
18774
18775            match req_result {
18776                Err(err) => {
18777                    if let common::Retry::After(d) = dlg.http_error(&err) {
18778                        sleep(d).await;
18779                        continue;
18780                    }
18781                    dlg.finished(false);
18782                    return Err(common::Error::HttpError(err));
18783                }
18784                Ok(res) => {
18785                    let (mut parts, body) = res.into_parts();
18786                    let mut body = common::Body::new(body);
18787                    if !parts.status.is_success() {
18788                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18789                        let error = serde_json::from_str(&common::to_string(&bytes));
18790                        let response = common::to_response(parts, bytes.into());
18791
18792                        if let common::Retry::After(d) =
18793                            dlg.http_failure(&response, error.as_ref().ok())
18794                        {
18795                            sleep(d).await;
18796                            continue;
18797                        }
18798
18799                        dlg.finished(false);
18800
18801                        return Err(match error {
18802                            Ok(value) => common::Error::BadRequest(value),
18803                            _ => common::Error::Failure(response),
18804                        });
18805                    }
18806                    let response = {
18807                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18808                        let encoded = common::to_string(&bytes);
18809                        match serde_json::from_str(&encoded) {
18810                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18811                            Err(error) => {
18812                                dlg.response_json_decode_error(&encoded, &error);
18813                                return Err(common::Error::JsonDecodeError(
18814                                    encoded.to_string(),
18815                                    error,
18816                                ));
18817                            }
18818                        }
18819                    };
18820
18821                    dlg.finished(true);
18822                    return Ok(response);
18823                }
18824            }
18825        }
18826    }
18827
18828    ///
18829    /// Sets the *request* property to the given value.
18830    ///
18831    /// Even though the property as already been set when instantiating this call,
18832    /// we provide this method for API completeness.
18833    pub fn request(
18834        mut self,
18835        new_value: InventoryCustomBatchRequest,
18836    ) -> InventoryCustombatchCall<'a, C> {
18837        self._request = new_value;
18838        self
18839    }
18840    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
18841    ///
18842    /// Sets the *dry run* query property to the given value.
18843    pub fn dry_run(mut self, new_value: bool) -> InventoryCustombatchCall<'a, C> {
18844        self._dry_run = Some(new_value);
18845        self
18846    }
18847    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18848    /// while executing the actual API request.
18849    ///
18850    /// ````text
18851    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18852    /// ````
18853    ///
18854    /// Sets the *delegate* property to the given value.
18855    pub fn delegate(
18856        mut self,
18857        new_value: &'a mut dyn common::Delegate,
18858    ) -> InventoryCustombatchCall<'a, C> {
18859        self._delegate = Some(new_value);
18860        self
18861    }
18862
18863    /// Set any additional parameter of the query string used in the request.
18864    /// It should be used to set parameters which are not yet available through their own
18865    /// setters.
18866    ///
18867    /// Please note that this method must not be used to set any of the known parameters
18868    /// which have their own setter method. If done anyway, the request will fail.
18869    ///
18870    /// # Additional Parameters
18871    ///
18872    /// * *$.xgafv* (query-string) - V1 error format.
18873    /// * *access_token* (query-string) - OAuth access token.
18874    /// * *alt* (query-string) - Data format for response.
18875    /// * *callback* (query-string) - JSONP
18876    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18877    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18878    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18879    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18880    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18881    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18882    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18883    pub fn param<T>(mut self, name: T, value: T) -> InventoryCustombatchCall<'a, C>
18884    where
18885        T: AsRef<str>,
18886    {
18887        self._additional_params
18888            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18889        self
18890    }
18891
18892    /// Identifies the authorization scope for the method you are building.
18893    ///
18894    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18895    /// [`Scope::Full`].
18896    ///
18897    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18898    /// tokens for more than one scope.
18899    ///
18900    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18901    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18902    /// sufficient, a read-write scope will do as well.
18903    pub fn add_scope<St>(mut self, scope: St) -> InventoryCustombatchCall<'a, C>
18904    where
18905        St: AsRef<str>,
18906    {
18907        self._scopes.insert(String::from(scope.as_ref()));
18908        self
18909    }
18910    /// Identifies the authorization scope(s) for the method you are building.
18911    ///
18912    /// See [`Self::add_scope()`] for details.
18913    pub fn add_scopes<I, St>(mut self, scopes: I) -> InventoryCustombatchCall<'a, C>
18914    where
18915        I: IntoIterator<Item = St>,
18916        St: AsRef<str>,
18917    {
18918        self._scopes
18919            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18920        self
18921    }
18922
18923    /// Removes all scopes, and no default scope will be used either.
18924    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18925    /// for details).
18926    pub fn clear_scopes(mut self) -> InventoryCustombatchCall<'a, C> {
18927        self._scopes.clear();
18928        self
18929    }
18930}
18931
18932/// Updates price and availability of a product in your Merchant Center account.
18933///
18934/// A builder for the *set* method supported by a *inventory* resource.
18935/// It is not used directly, but through a [`InventoryMethods`] instance.
18936///
18937/// # Example
18938///
18939/// Instantiate a resource method builder
18940///
18941/// ```test_harness,no_run
18942/// # extern crate hyper;
18943/// # extern crate hyper_rustls;
18944/// # extern crate google_content2 as content2;
18945/// use content2::api::InventorySetRequest;
18946/// # async fn dox() {
18947/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18948///
18949/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18950/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18951/// #     .with_native_roots()
18952/// #     .unwrap()
18953/// #     .https_only()
18954/// #     .enable_http2()
18955/// #     .build();
18956///
18957/// # let executor = hyper_util::rt::TokioExecutor::new();
18958/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18959/// #     secret,
18960/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18961/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18962/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18963/// #     ),
18964/// # ).build().await.unwrap();
18965///
18966/// # let client = hyper_util::client::legacy::Client::builder(
18967/// #     hyper_util::rt::TokioExecutor::new()
18968/// # )
18969/// # .build(
18970/// #     hyper_rustls::HttpsConnectorBuilder::new()
18971/// #         .with_native_roots()
18972/// #         .unwrap()
18973/// #         .https_or_http()
18974/// #         .enable_http2()
18975/// #         .build()
18976/// # );
18977/// # let mut hub = ShoppingContent::new(client, auth);
18978/// // As the method needs a request, you would usually fill it with the desired information
18979/// // into the respective structure. Some of the parts shown here might not be applicable !
18980/// // Values shown here are possibly random and not representative !
18981/// let mut req = InventorySetRequest::default();
18982///
18983/// // You can configure optional parameters by calling the respective setters at will, and
18984/// // execute the final call using `doit()`.
18985/// // Values shown here are possibly random and not representative !
18986/// let result = hub.inventory().set(req, 95, "storeCode", "productId")
18987///              .dry_run(true)
18988///              .doit().await;
18989/// # }
18990/// ```
18991pub struct InventorySetCall<'a, C>
18992where
18993    C: 'a,
18994{
18995    hub: &'a ShoppingContent<C>,
18996    _request: InventorySetRequest,
18997    _merchant_id: u64,
18998    _store_code: String,
18999    _product_id: String,
19000    _dry_run: Option<bool>,
19001    _delegate: Option<&'a mut dyn common::Delegate>,
19002    _additional_params: HashMap<String, String>,
19003    _scopes: BTreeSet<String>,
19004}
19005
19006impl<'a, C> common::CallBuilder for InventorySetCall<'a, C> {}
19007
19008impl<'a, C> InventorySetCall<'a, C>
19009where
19010    C: common::Connector,
19011{
19012    /// Perform the operation you have build so far.
19013    pub async fn doit(mut self) -> common::Result<(common::Response, InventorySetResponse)> {
19014        use std::borrow::Cow;
19015        use std::io::{Read, Seek};
19016
19017        use common::{url::Params, ToParts};
19018        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19019
19020        let mut dd = common::DefaultDelegate;
19021        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19022        dlg.begin(common::MethodInfo {
19023            id: "content.inventory.set",
19024            http_method: hyper::Method::POST,
19025        });
19026
19027        for &field in ["alt", "merchantId", "storeCode", "productId", "dryRun"].iter() {
19028            if self._additional_params.contains_key(field) {
19029                dlg.finished(false);
19030                return Err(common::Error::FieldClash(field));
19031            }
19032        }
19033
19034        let mut params = Params::with_capacity(7 + self._additional_params.len());
19035        params.push("merchantId", self._merchant_id.to_string());
19036        params.push("storeCode", self._store_code);
19037        params.push("productId", self._product_id);
19038        if let Some(value) = self._dry_run.as_ref() {
19039            params.push("dryRun", 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() + "{merchantId}/inventory/{storeCode}/products/{productId}";
19047        if self._scopes.is_empty() {
19048            self._scopes.insert(Scope::Full.as_ref().to_string());
19049        }
19050
19051        #[allow(clippy::single_element_loop)]
19052        for &(find_this, param_name) in [
19053            ("{merchantId}", "merchantId"),
19054            ("{storeCode}", "storeCode"),
19055            ("{productId}", "productId"),
19056        ]
19057        .iter()
19058        {
19059            url = params.uri_replacement(url, param_name, find_this, false);
19060        }
19061        {
19062            let to_remove = ["productId", "storeCode", "merchantId"];
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::POST)
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: InventorySetRequest) -> InventorySetCall<'a, C> {
19183        self._request = new_value;
19184        self
19185    }
19186    /// The ID of the account that contains the product. This account cannot be a multi-client account.
19187    ///
19188    /// Sets the *merchant 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 merchant_id(mut self, new_value: u64) -> InventorySetCall<'a, C> {
19193        self._merchant_id = new_value;
19194        self
19195    }
19196    /// The code of the store for which to update price and availability. Use `online` to update price and availability of an online product.
19197    ///
19198    /// Sets the *store code* 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 store_code(mut self, new_value: &str) -> InventorySetCall<'a, C> {
19203        self._store_code = new_value.to_string();
19204        self
19205    }
19206    /// The REST ID of the product for which to update price and availability.
19207    ///
19208    /// Sets the *product id* path property to the given value.
19209    ///
19210    /// Even though the property as already been set when instantiating this call,
19211    /// we provide this method for API completeness.
19212    pub fn product_id(mut self, new_value: &str) -> InventorySetCall<'a, C> {
19213        self._product_id = new_value.to_string();
19214        self
19215    }
19216    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
19217    ///
19218    /// Sets the *dry run* query property to the given value.
19219    pub fn dry_run(mut self, new_value: bool) -> InventorySetCall<'a, C> {
19220        self._dry_run = Some(new_value);
19221        self
19222    }
19223    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19224    /// while executing the actual API request.
19225    ///
19226    /// ````text
19227    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19228    /// ````
19229    ///
19230    /// Sets the *delegate* property to the given value.
19231    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> InventorySetCall<'a, C> {
19232        self._delegate = Some(new_value);
19233        self
19234    }
19235
19236    /// Set any additional parameter of the query string used in the request.
19237    /// It should be used to set parameters which are not yet available through their own
19238    /// setters.
19239    ///
19240    /// Please note that this method must not be used to set any of the known parameters
19241    /// which have their own setter method. If done anyway, the request will fail.
19242    ///
19243    /// # Additional Parameters
19244    ///
19245    /// * *$.xgafv* (query-string) - V1 error format.
19246    /// * *access_token* (query-string) - OAuth access token.
19247    /// * *alt* (query-string) - Data format for response.
19248    /// * *callback* (query-string) - JSONP
19249    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19250    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19251    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19252    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19253    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19254    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19255    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19256    pub fn param<T>(mut self, name: T, value: T) -> InventorySetCall<'a, C>
19257    where
19258        T: AsRef<str>,
19259    {
19260        self._additional_params
19261            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19262        self
19263    }
19264
19265    /// Identifies the authorization scope for the method you are building.
19266    ///
19267    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19268    /// [`Scope::Full`].
19269    ///
19270    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19271    /// tokens for more than one scope.
19272    ///
19273    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19274    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19275    /// sufficient, a read-write scope will do as well.
19276    pub fn add_scope<St>(mut self, scope: St) -> InventorySetCall<'a, C>
19277    where
19278        St: AsRef<str>,
19279    {
19280        self._scopes.insert(String::from(scope.as_ref()));
19281        self
19282    }
19283    /// Identifies the authorization scope(s) for the method you are building.
19284    ///
19285    /// See [`Self::add_scope()`] for details.
19286    pub fn add_scopes<I, St>(mut self, scopes: I) -> InventorySetCall<'a, C>
19287    where
19288        I: IntoIterator<Item = St>,
19289        St: AsRef<str>,
19290    {
19291        self._scopes
19292            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19293        self
19294    }
19295
19296    /// Removes all scopes, and no default scope will be used either.
19297    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19298    /// for details).
19299    pub fn clear_scopes(mut self) -> InventorySetCall<'a, C> {
19300        self._scopes.clear();
19301        self
19302    }
19303}
19304
19305/// Retrieves and/or updates the LIA settings of multiple accounts in a single request.
19306///
19307/// A builder for the *custombatch* method supported by a *liasetting* resource.
19308/// It is not used directly, but through a [`LiasettingMethods`] instance.
19309///
19310/// # Example
19311///
19312/// Instantiate a resource method builder
19313///
19314/// ```test_harness,no_run
19315/// # extern crate hyper;
19316/// # extern crate hyper_rustls;
19317/// # extern crate google_content2 as content2;
19318/// use content2::api::LiasettingsCustomBatchRequest;
19319/// # async fn dox() {
19320/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19321///
19322/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19323/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19324/// #     .with_native_roots()
19325/// #     .unwrap()
19326/// #     .https_only()
19327/// #     .enable_http2()
19328/// #     .build();
19329///
19330/// # let executor = hyper_util::rt::TokioExecutor::new();
19331/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19332/// #     secret,
19333/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19334/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19335/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19336/// #     ),
19337/// # ).build().await.unwrap();
19338///
19339/// # let client = hyper_util::client::legacy::Client::builder(
19340/// #     hyper_util::rt::TokioExecutor::new()
19341/// # )
19342/// # .build(
19343/// #     hyper_rustls::HttpsConnectorBuilder::new()
19344/// #         .with_native_roots()
19345/// #         .unwrap()
19346/// #         .https_or_http()
19347/// #         .enable_http2()
19348/// #         .build()
19349/// # );
19350/// # let mut hub = ShoppingContent::new(client, auth);
19351/// // As the method needs a request, you would usually fill it with the desired information
19352/// // into the respective structure. Some of the parts shown here might not be applicable !
19353/// // Values shown here are possibly random and not representative !
19354/// let mut req = LiasettingsCustomBatchRequest::default();
19355///
19356/// // You can configure optional parameters by calling the respective setters at will, and
19357/// // execute the final call using `doit()`.
19358/// // Values shown here are possibly random and not representative !
19359/// let result = hub.liasettings().custombatch(req)
19360///              .dry_run(false)
19361///              .doit().await;
19362/// # }
19363/// ```
19364pub struct LiasettingCustombatchCall<'a, C>
19365where
19366    C: 'a,
19367{
19368    hub: &'a ShoppingContent<C>,
19369    _request: LiasettingsCustomBatchRequest,
19370    _dry_run: Option<bool>,
19371    _delegate: Option<&'a mut dyn common::Delegate>,
19372    _additional_params: HashMap<String, String>,
19373    _scopes: BTreeSet<String>,
19374}
19375
19376impl<'a, C> common::CallBuilder for LiasettingCustombatchCall<'a, C> {}
19377
19378impl<'a, C> LiasettingCustombatchCall<'a, C>
19379where
19380    C: common::Connector,
19381{
19382    /// Perform the operation you have build so far.
19383    pub async fn doit(
19384        mut self,
19385    ) -> common::Result<(common::Response, LiasettingsCustomBatchResponse)> {
19386        use std::borrow::Cow;
19387        use std::io::{Read, Seek};
19388
19389        use common::{url::Params, ToParts};
19390        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19391
19392        let mut dd = common::DefaultDelegate;
19393        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19394        dlg.begin(common::MethodInfo {
19395            id: "content.liasettings.custombatch",
19396            http_method: hyper::Method::POST,
19397        });
19398
19399        for &field in ["alt", "dryRun"].iter() {
19400            if self._additional_params.contains_key(field) {
19401                dlg.finished(false);
19402                return Err(common::Error::FieldClash(field));
19403            }
19404        }
19405
19406        let mut params = Params::with_capacity(4 + self._additional_params.len());
19407        if let Some(value) = self._dry_run.as_ref() {
19408            params.push("dryRun", value.to_string());
19409        }
19410
19411        params.extend(self._additional_params.iter());
19412
19413        params.push("alt", "json");
19414        let mut url = self.hub._base_url.clone() + "liasettings/batch";
19415        if self._scopes.is_empty() {
19416            self._scopes.insert(Scope::Full.as_ref().to_string());
19417        }
19418
19419        let url = params.parse_with_url(&url);
19420
19421        let mut json_mime_type = mime::APPLICATION_JSON;
19422        let mut request_value_reader = {
19423            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19424            common::remove_json_null_values(&mut value);
19425            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19426            serde_json::to_writer(&mut dst, &value).unwrap();
19427            dst
19428        };
19429        let request_size = request_value_reader
19430            .seek(std::io::SeekFrom::End(0))
19431            .unwrap();
19432        request_value_reader
19433            .seek(std::io::SeekFrom::Start(0))
19434            .unwrap();
19435
19436        loop {
19437            let token = match self
19438                .hub
19439                .auth
19440                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19441                .await
19442            {
19443                Ok(token) => token,
19444                Err(e) => match dlg.token(e) {
19445                    Ok(token) => token,
19446                    Err(e) => {
19447                        dlg.finished(false);
19448                        return Err(common::Error::MissingToken(e));
19449                    }
19450                },
19451            };
19452            request_value_reader
19453                .seek(std::io::SeekFrom::Start(0))
19454                .unwrap();
19455            let mut req_result = {
19456                let client = &self.hub.client;
19457                dlg.pre_request();
19458                let mut req_builder = hyper::Request::builder()
19459                    .method(hyper::Method::POST)
19460                    .uri(url.as_str())
19461                    .header(USER_AGENT, self.hub._user_agent.clone());
19462
19463                if let Some(token) = token.as_ref() {
19464                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19465                }
19466
19467                let request = req_builder
19468                    .header(CONTENT_TYPE, json_mime_type.to_string())
19469                    .header(CONTENT_LENGTH, request_size as u64)
19470                    .body(common::to_body(
19471                        request_value_reader.get_ref().clone().into(),
19472                    ));
19473
19474                client.request(request.unwrap()).await
19475            };
19476
19477            match req_result {
19478                Err(err) => {
19479                    if let common::Retry::After(d) = dlg.http_error(&err) {
19480                        sleep(d).await;
19481                        continue;
19482                    }
19483                    dlg.finished(false);
19484                    return Err(common::Error::HttpError(err));
19485                }
19486                Ok(res) => {
19487                    let (mut parts, body) = res.into_parts();
19488                    let mut body = common::Body::new(body);
19489                    if !parts.status.is_success() {
19490                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19491                        let error = serde_json::from_str(&common::to_string(&bytes));
19492                        let response = common::to_response(parts, bytes.into());
19493
19494                        if let common::Retry::After(d) =
19495                            dlg.http_failure(&response, error.as_ref().ok())
19496                        {
19497                            sleep(d).await;
19498                            continue;
19499                        }
19500
19501                        dlg.finished(false);
19502
19503                        return Err(match error {
19504                            Ok(value) => common::Error::BadRequest(value),
19505                            _ => common::Error::Failure(response),
19506                        });
19507                    }
19508                    let response = {
19509                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19510                        let encoded = common::to_string(&bytes);
19511                        match serde_json::from_str(&encoded) {
19512                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19513                            Err(error) => {
19514                                dlg.response_json_decode_error(&encoded, &error);
19515                                return Err(common::Error::JsonDecodeError(
19516                                    encoded.to_string(),
19517                                    error,
19518                                ));
19519                            }
19520                        }
19521                    };
19522
19523                    dlg.finished(true);
19524                    return Ok(response);
19525                }
19526            }
19527        }
19528    }
19529
19530    ///
19531    /// Sets the *request* property to the given value.
19532    ///
19533    /// Even though the property as already been set when instantiating this call,
19534    /// we provide this method for API completeness.
19535    pub fn request(
19536        mut self,
19537        new_value: LiasettingsCustomBatchRequest,
19538    ) -> LiasettingCustombatchCall<'a, C> {
19539        self._request = new_value;
19540        self
19541    }
19542    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
19543    ///
19544    /// Sets the *dry run* query property to the given value.
19545    pub fn dry_run(mut self, new_value: bool) -> LiasettingCustombatchCall<'a, C> {
19546        self._dry_run = Some(new_value);
19547        self
19548    }
19549    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19550    /// while executing the actual API request.
19551    ///
19552    /// ````text
19553    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19554    /// ````
19555    ///
19556    /// Sets the *delegate* property to the given value.
19557    pub fn delegate(
19558        mut self,
19559        new_value: &'a mut dyn common::Delegate,
19560    ) -> LiasettingCustombatchCall<'a, C> {
19561        self._delegate = Some(new_value);
19562        self
19563    }
19564
19565    /// Set any additional parameter of the query string used in the request.
19566    /// It should be used to set parameters which are not yet available through their own
19567    /// setters.
19568    ///
19569    /// Please note that this method must not be used to set any of the known parameters
19570    /// which have their own setter method. If done anyway, the request will fail.
19571    ///
19572    /// # Additional Parameters
19573    ///
19574    /// * *$.xgafv* (query-string) - V1 error format.
19575    /// * *access_token* (query-string) - OAuth access token.
19576    /// * *alt* (query-string) - Data format for response.
19577    /// * *callback* (query-string) - JSONP
19578    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19579    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19580    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19581    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19582    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19583    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19584    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19585    pub fn param<T>(mut self, name: T, value: T) -> LiasettingCustombatchCall<'a, C>
19586    where
19587        T: AsRef<str>,
19588    {
19589        self._additional_params
19590            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19591        self
19592    }
19593
19594    /// Identifies the authorization scope for the method you are building.
19595    ///
19596    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19597    /// [`Scope::Full`].
19598    ///
19599    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19600    /// tokens for more than one scope.
19601    ///
19602    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19603    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19604    /// sufficient, a read-write scope will do as well.
19605    pub fn add_scope<St>(mut self, scope: St) -> LiasettingCustombatchCall<'a, C>
19606    where
19607        St: AsRef<str>,
19608    {
19609        self._scopes.insert(String::from(scope.as_ref()));
19610        self
19611    }
19612    /// Identifies the authorization scope(s) for the method you are building.
19613    ///
19614    /// See [`Self::add_scope()`] for details.
19615    pub fn add_scopes<I, St>(mut self, scopes: I) -> LiasettingCustombatchCall<'a, C>
19616    where
19617        I: IntoIterator<Item = St>,
19618        St: AsRef<str>,
19619    {
19620        self._scopes
19621            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19622        self
19623    }
19624
19625    /// Removes all scopes, and no default scope will be used either.
19626    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19627    /// for details).
19628    pub fn clear_scopes(mut self) -> LiasettingCustombatchCall<'a, C> {
19629        self._scopes.clear();
19630        self
19631    }
19632}
19633
19634/// Retrieves the LIA settings of the account.
19635///
19636/// A builder for the *get* method supported by a *liasetting* resource.
19637/// It is not used directly, but through a [`LiasettingMethods`] instance.
19638///
19639/// # Example
19640///
19641/// Instantiate a resource method builder
19642///
19643/// ```test_harness,no_run
19644/// # extern crate hyper;
19645/// # extern crate hyper_rustls;
19646/// # extern crate google_content2 as content2;
19647/// # async fn dox() {
19648/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19649///
19650/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19651/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19652/// #     .with_native_roots()
19653/// #     .unwrap()
19654/// #     .https_only()
19655/// #     .enable_http2()
19656/// #     .build();
19657///
19658/// # let executor = hyper_util::rt::TokioExecutor::new();
19659/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19660/// #     secret,
19661/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19662/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19663/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19664/// #     ),
19665/// # ).build().await.unwrap();
19666///
19667/// # let client = hyper_util::client::legacy::Client::builder(
19668/// #     hyper_util::rt::TokioExecutor::new()
19669/// # )
19670/// # .build(
19671/// #     hyper_rustls::HttpsConnectorBuilder::new()
19672/// #         .with_native_roots()
19673/// #         .unwrap()
19674/// #         .https_or_http()
19675/// #         .enable_http2()
19676/// #         .build()
19677/// # );
19678/// # let mut hub = ShoppingContent::new(client, auth);
19679/// // You can configure optional parameters by calling the respective setters at will, and
19680/// // execute the final call using `doit()`.
19681/// // Values shown here are possibly random and not representative !
19682/// let result = hub.liasettings().get(66, 62)
19683///              .doit().await;
19684/// # }
19685/// ```
19686pub struct LiasettingGetCall<'a, C>
19687where
19688    C: 'a,
19689{
19690    hub: &'a ShoppingContent<C>,
19691    _merchant_id: u64,
19692    _account_id: u64,
19693    _delegate: Option<&'a mut dyn common::Delegate>,
19694    _additional_params: HashMap<String, String>,
19695    _scopes: BTreeSet<String>,
19696}
19697
19698impl<'a, C> common::CallBuilder for LiasettingGetCall<'a, C> {}
19699
19700impl<'a, C> LiasettingGetCall<'a, C>
19701where
19702    C: common::Connector,
19703{
19704    /// Perform the operation you have build so far.
19705    pub async fn doit(mut self) -> common::Result<(common::Response, LiaSettings)> {
19706        use std::borrow::Cow;
19707        use std::io::{Read, Seek};
19708
19709        use common::{url::Params, ToParts};
19710        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19711
19712        let mut dd = common::DefaultDelegate;
19713        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19714        dlg.begin(common::MethodInfo {
19715            id: "content.liasettings.get",
19716            http_method: hyper::Method::GET,
19717        });
19718
19719        for &field in ["alt", "merchantId", "accountId"].iter() {
19720            if self._additional_params.contains_key(field) {
19721                dlg.finished(false);
19722                return Err(common::Error::FieldClash(field));
19723            }
19724        }
19725
19726        let mut params = Params::with_capacity(4 + self._additional_params.len());
19727        params.push("merchantId", self._merchant_id.to_string());
19728        params.push("accountId", self._account_id.to_string());
19729
19730        params.extend(self._additional_params.iter());
19731
19732        params.push("alt", "json");
19733        let mut url = self.hub._base_url.clone() + "{merchantId}/liasettings/{accountId}";
19734        if self._scopes.is_empty() {
19735            self._scopes.insert(Scope::Full.as_ref().to_string());
19736        }
19737
19738        #[allow(clippy::single_element_loop)]
19739        for &(find_this, param_name) in
19740            [("{merchantId}", "merchantId"), ("{accountId}", "accountId")].iter()
19741        {
19742            url = params.uri_replacement(url, param_name, find_this, false);
19743        }
19744        {
19745            let to_remove = ["accountId", "merchantId"];
19746            params.remove_params(&to_remove);
19747        }
19748
19749        let url = params.parse_with_url(&url);
19750
19751        loop {
19752            let token = match self
19753                .hub
19754                .auth
19755                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19756                .await
19757            {
19758                Ok(token) => token,
19759                Err(e) => match dlg.token(e) {
19760                    Ok(token) => token,
19761                    Err(e) => {
19762                        dlg.finished(false);
19763                        return Err(common::Error::MissingToken(e));
19764                    }
19765                },
19766            };
19767            let mut req_result = {
19768                let client = &self.hub.client;
19769                dlg.pre_request();
19770                let mut req_builder = hyper::Request::builder()
19771                    .method(hyper::Method::GET)
19772                    .uri(url.as_str())
19773                    .header(USER_AGENT, self.hub._user_agent.clone());
19774
19775                if let Some(token) = token.as_ref() {
19776                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19777                }
19778
19779                let request = req_builder
19780                    .header(CONTENT_LENGTH, 0_u64)
19781                    .body(common::to_body::<String>(None));
19782
19783                client.request(request.unwrap()).await
19784            };
19785
19786            match req_result {
19787                Err(err) => {
19788                    if let common::Retry::After(d) = dlg.http_error(&err) {
19789                        sleep(d).await;
19790                        continue;
19791                    }
19792                    dlg.finished(false);
19793                    return Err(common::Error::HttpError(err));
19794                }
19795                Ok(res) => {
19796                    let (mut parts, body) = res.into_parts();
19797                    let mut body = common::Body::new(body);
19798                    if !parts.status.is_success() {
19799                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19800                        let error = serde_json::from_str(&common::to_string(&bytes));
19801                        let response = common::to_response(parts, bytes.into());
19802
19803                        if let common::Retry::After(d) =
19804                            dlg.http_failure(&response, error.as_ref().ok())
19805                        {
19806                            sleep(d).await;
19807                            continue;
19808                        }
19809
19810                        dlg.finished(false);
19811
19812                        return Err(match error {
19813                            Ok(value) => common::Error::BadRequest(value),
19814                            _ => common::Error::Failure(response),
19815                        });
19816                    }
19817                    let response = {
19818                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19819                        let encoded = common::to_string(&bytes);
19820                        match serde_json::from_str(&encoded) {
19821                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19822                            Err(error) => {
19823                                dlg.response_json_decode_error(&encoded, &error);
19824                                return Err(common::Error::JsonDecodeError(
19825                                    encoded.to_string(),
19826                                    error,
19827                                ));
19828                            }
19829                        }
19830                    };
19831
19832                    dlg.finished(true);
19833                    return Ok(response);
19834                }
19835            }
19836        }
19837    }
19838
19839    /// The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
19840    ///
19841    /// Sets the *merchant id* path property to the given value.
19842    ///
19843    /// Even though the property as already been set when instantiating this call,
19844    /// we provide this method for API completeness.
19845    pub fn merchant_id(mut self, new_value: u64) -> LiasettingGetCall<'a, C> {
19846        self._merchant_id = new_value;
19847        self
19848    }
19849    /// The ID of the account for which to get or update LIA settings.
19850    ///
19851    /// Sets the *account id* path property to the given value.
19852    ///
19853    /// Even though the property as already been set when instantiating this call,
19854    /// we provide this method for API completeness.
19855    pub fn account_id(mut self, new_value: u64) -> LiasettingGetCall<'a, C> {
19856        self._account_id = new_value;
19857        self
19858    }
19859    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19860    /// while executing the actual API request.
19861    ///
19862    /// ````text
19863    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19864    /// ````
19865    ///
19866    /// Sets the *delegate* property to the given value.
19867    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> LiasettingGetCall<'a, C> {
19868        self._delegate = Some(new_value);
19869        self
19870    }
19871
19872    /// Set any additional parameter of the query string used in the request.
19873    /// It should be used to set parameters which are not yet available through their own
19874    /// setters.
19875    ///
19876    /// Please note that this method must not be used to set any of the known parameters
19877    /// which have their own setter method. If done anyway, the request will fail.
19878    ///
19879    /// # Additional Parameters
19880    ///
19881    /// * *$.xgafv* (query-string) - V1 error format.
19882    /// * *access_token* (query-string) - OAuth access token.
19883    /// * *alt* (query-string) - Data format for response.
19884    /// * *callback* (query-string) - JSONP
19885    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19886    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19887    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19888    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19889    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19890    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19891    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19892    pub fn param<T>(mut self, name: T, value: T) -> LiasettingGetCall<'a, C>
19893    where
19894        T: AsRef<str>,
19895    {
19896        self._additional_params
19897            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19898        self
19899    }
19900
19901    /// Identifies the authorization scope for the method you are building.
19902    ///
19903    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19904    /// [`Scope::Full`].
19905    ///
19906    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19907    /// tokens for more than one scope.
19908    ///
19909    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19910    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19911    /// sufficient, a read-write scope will do as well.
19912    pub fn add_scope<St>(mut self, scope: St) -> LiasettingGetCall<'a, C>
19913    where
19914        St: AsRef<str>,
19915    {
19916        self._scopes.insert(String::from(scope.as_ref()));
19917        self
19918    }
19919    /// Identifies the authorization scope(s) for the method you are building.
19920    ///
19921    /// See [`Self::add_scope()`] for details.
19922    pub fn add_scopes<I, St>(mut self, scopes: I) -> LiasettingGetCall<'a, C>
19923    where
19924        I: IntoIterator<Item = St>,
19925        St: AsRef<str>,
19926    {
19927        self._scopes
19928            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19929        self
19930    }
19931
19932    /// Removes all scopes, and no default scope will be used either.
19933    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19934    /// for details).
19935    pub fn clear_scopes(mut self) -> LiasettingGetCall<'a, C> {
19936        self._scopes.clear();
19937        self
19938    }
19939}
19940
19941/// Retrieves the list of accessible Google My Business accounts.
19942///
19943/// A builder for the *getaccessiblegmbaccounts* method supported by a *liasetting* resource.
19944/// It is not used directly, but through a [`LiasettingMethods`] instance.
19945///
19946/// # Example
19947///
19948/// Instantiate a resource method builder
19949///
19950/// ```test_harness,no_run
19951/// # extern crate hyper;
19952/// # extern crate hyper_rustls;
19953/// # extern crate google_content2 as content2;
19954/// # async fn dox() {
19955/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19956///
19957/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19958/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19959/// #     .with_native_roots()
19960/// #     .unwrap()
19961/// #     .https_only()
19962/// #     .enable_http2()
19963/// #     .build();
19964///
19965/// # let executor = hyper_util::rt::TokioExecutor::new();
19966/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19967/// #     secret,
19968/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19969/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19970/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19971/// #     ),
19972/// # ).build().await.unwrap();
19973///
19974/// # let client = hyper_util::client::legacy::Client::builder(
19975/// #     hyper_util::rt::TokioExecutor::new()
19976/// # )
19977/// # .build(
19978/// #     hyper_rustls::HttpsConnectorBuilder::new()
19979/// #         .with_native_roots()
19980/// #         .unwrap()
19981/// #         .https_or_http()
19982/// #         .enable_http2()
19983/// #         .build()
19984/// # );
19985/// # let mut hub = ShoppingContent::new(client, auth);
19986/// // You can configure optional parameters by calling the respective setters at will, and
19987/// // execute the final call using `doit()`.
19988/// // Values shown here are possibly random and not representative !
19989/// let result = hub.liasettings().getaccessiblegmbaccounts(69, 96)
19990///              .doit().await;
19991/// # }
19992/// ```
19993pub struct LiasettingGetaccessiblegmbaccountCall<'a, C>
19994where
19995    C: 'a,
19996{
19997    hub: &'a ShoppingContent<C>,
19998    _merchant_id: u64,
19999    _account_id: u64,
20000    _delegate: Option<&'a mut dyn common::Delegate>,
20001    _additional_params: HashMap<String, String>,
20002    _scopes: BTreeSet<String>,
20003}
20004
20005impl<'a, C> common::CallBuilder for LiasettingGetaccessiblegmbaccountCall<'a, C> {}
20006
20007impl<'a, C> LiasettingGetaccessiblegmbaccountCall<'a, C>
20008where
20009    C: common::Connector,
20010{
20011    /// Perform the operation you have build so far.
20012    pub async fn doit(
20013        mut self,
20014    ) -> common::Result<(
20015        common::Response,
20016        LiasettingsGetAccessibleGmbAccountsResponse,
20017    )> {
20018        use std::borrow::Cow;
20019        use std::io::{Read, Seek};
20020
20021        use common::{url::Params, ToParts};
20022        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20023
20024        let mut dd = common::DefaultDelegate;
20025        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20026        dlg.begin(common::MethodInfo {
20027            id: "content.liasettings.getaccessiblegmbaccounts",
20028            http_method: hyper::Method::GET,
20029        });
20030
20031        for &field in ["alt", "merchantId", "accountId"].iter() {
20032            if self._additional_params.contains_key(field) {
20033                dlg.finished(false);
20034                return Err(common::Error::FieldClash(field));
20035            }
20036        }
20037
20038        let mut params = Params::with_capacity(4 + self._additional_params.len());
20039        params.push("merchantId", self._merchant_id.to_string());
20040        params.push("accountId", self._account_id.to_string());
20041
20042        params.extend(self._additional_params.iter());
20043
20044        params.push("alt", "json");
20045        let mut url = self.hub._base_url.clone()
20046            + "{merchantId}/liasettings/{accountId}/accessiblegmbaccounts";
20047        if self._scopes.is_empty() {
20048            self._scopes.insert(Scope::Full.as_ref().to_string());
20049        }
20050
20051        #[allow(clippy::single_element_loop)]
20052        for &(find_this, param_name) in
20053            [("{merchantId}", "merchantId"), ("{accountId}", "accountId")].iter()
20054        {
20055            url = params.uri_replacement(url, param_name, find_this, false);
20056        }
20057        {
20058            let to_remove = ["accountId", "merchantId"];
20059            params.remove_params(&to_remove);
20060        }
20061
20062        let url = params.parse_with_url(&url);
20063
20064        loop {
20065            let token = match self
20066                .hub
20067                .auth
20068                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20069                .await
20070            {
20071                Ok(token) => token,
20072                Err(e) => match dlg.token(e) {
20073                    Ok(token) => token,
20074                    Err(e) => {
20075                        dlg.finished(false);
20076                        return Err(common::Error::MissingToken(e));
20077                    }
20078                },
20079            };
20080            let mut req_result = {
20081                let client = &self.hub.client;
20082                dlg.pre_request();
20083                let mut req_builder = hyper::Request::builder()
20084                    .method(hyper::Method::GET)
20085                    .uri(url.as_str())
20086                    .header(USER_AGENT, self.hub._user_agent.clone());
20087
20088                if let Some(token) = token.as_ref() {
20089                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20090                }
20091
20092                let request = req_builder
20093                    .header(CONTENT_LENGTH, 0_u64)
20094                    .body(common::to_body::<String>(None));
20095
20096                client.request(request.unwrap()).await
20097            };
20098
20099            match req_result {
20100                Err(err) => {
20101                    if let common::Retry::After(d) = dlg.http_error(&err) {
20102                        sleep(d).await;
20103                        continue;
20104                    }
20105                    dlg.finished(false);
20106                    return Err(common::Error::HttpError(err));
20107                }
20108                Ok(res) => {
20109                    let (mut parts, body) = res.into_parts();
20110                    let mut body = common::Body::new(body);
20111                    if !parts.status.is_success() {
20112                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20113                        let error = serde_json::from_str(&common::to_string(&bytes));
20114                        let response = common::to_response(parts, bytes.into());
20115
20116                        if let common::Retry::After(d) =
20117                            dlg.http_failure(&response, error.as_ref().ok())
20118                        {
20119                            sleep(d).await;
20120                            continue;
20121                        }
20122
20123                        dlg.finished(false);
20124
20125                        return Err(match error {
20126                            Ok(value) => common::Error::BadRequest(value),
20127                            _ => common::Error::Failure(response),
20128                        });
20129                    }
20130                    let response = {
20131                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20132                        let encoded = common::to_string(&bytes);
20133                        match serde_json::from_str(&encoded) {
20134                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20135                            Err(error) => {
20136                                dlg.response_json_decode_error(&encoded, &error);
20137                                return Err(common::Error::JsonDecodeError(
20138                                    encoded.to_string(),
20139                                    error,
20140                                ));
20141                            }
20142                        }
20143                    };
20144
20145                    dlg.finished(true);
20146                    return Ok(response);
20147                }
20148            }
20149        }
20150    }
20151
20152    /// The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
20153    ///
20154    /// Sets the *merchant id* path property to the given value.
20155    ///
20156    /// Even though the property as already been set when instantiating this call,
20157    /// we provide this method for API completeness.
20158    pub fn merchant_id(mut self, new_value: u64) -> LiasettingGetaccessiblegmbaccountCall<'a, C> {
20159        self._merchant_id = new_value;
20160        self
20161    }
20162    /// The ID of the account for which to retrieve accessible Google My Business accounts.
20163    ///
20164    /// Sets the *account id* path property to the given value.
20165    ///
20166    /// Even though the property as already been set when instantiating this call,
20167    /// we provide this method for API completeness.
20168    pub fn account_id(mut self, new_value: u64) -> LiasettingGetaccessiblegmbaccountCall<'a, C> {
20169        self._account_id = new_value;
20170        self
20171    }
20172    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20173    /// while executing the actual API request.
20174    ///
20175    /// ````text
20176    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20177    /// ````
20178    ///
20179    /// Sets the *delegate* property to the given value.
20180    pub fn delegate(
20181        mut self,
20182        new_value: &'a mut dyn common::Delegate,
20183    ) -> LiasettingGetaccessiblegmbaccountCall<'a, C> {
20184        self._delegate = Some(new_value);
20185        self
20186    }
20187
20188    /// Set any additional parameter of the query string used in the request.
20189    /// It should be used to set parameters which are not yet available through their own
20190    /// setters.
20191    ///
20192    /// Please note that this method must not be used to set any of the known parameters
20193    /// which have their own setter method. If done anyway, the request will fail.
20194    ///
20195    /// # Additional Parameters
20196    ///
20197    /// * *$.xgafv* (query-string) - V1 error format.
20198    /// * *access_token* (query-string) - OAuth access token.
20199    /// * *alt* (query-string) - Data format for response.
20200    /// * *callback* (query-string) - JSONP
20201    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20202    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20203    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20204    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20205    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20206    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20207    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20208    pub fn param<T>(mut self, name: T, value: T) -> LiasettingGetaccessiblegmbaccountCall<'a, C>
20209    where
20210        T: AsRef<str>,
20211    {
20212        self._additional_params
20213            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20214        self
20215    }
20216
20217    /// Identifies the authorization scope for the method you are building.
20218    ///
20219    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20220    /// [`Scope::Full`].
20221    ///
20222    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20223    /// tokens for more than one scope.
20224    ///
20225    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20226    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20227    /// sufficient, a read-write scope will do as well.
20228    pub fn add_scope<St>(mut self, scope: St) -> LiasettingGetaccessiblegmbaccountCall<'a, C>
20229    where
20230        St: AsRef<str>,
20231    {
20232        self._scopes.insert(String::from(scope.as_ref()));
20233        self
20234    }
20235    /// Identifies the authorization scope(s) for the method you are building.
20236    ///
20237    /// See [`Self::add_scope()`] for details.
20238    pub fn add_scopes<I, St>(mut self, scopes: I) -> LiasettingGetaccessiblegmbaccountCall<'a, C>
20239    where
20240        I: IntoIterator<Item = St>,
20241        St: AsRef<str>,
20242    {
20243        self._scopes
20244            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20245        self
20246    }
20247
20248    /// Removes all scopes, and no default scope will be used either.
20249    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20250    /// for details).
20251    pub fn clear_scopes(mut self) -> LiasettingGetaccessiblegmbaccountCall<'a, C> {
20252        self._scopes.clear();
20253        self
20254    }
20255}
20256
20257/// Lists the LIA settings of the sub-accounts in your Merchant Center account.
20258///
20259/// A builder for the *list* method supported by a *liasetting* resource.
20260/// It is not used directly, but through a [`LiasettingMethods`] instance.
20261///
20262/// # Example
20263///
20264/// Instantiate a resource method builder
20265///
20266/// ```test_harness,no_run
20267/// # extern crate hyper;
20268/// # extern crate hyper_rustls;
20269/// # extern crate google_content2 as content2;
20270/// # async fn dox() {
20271/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20272///
20273/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20274/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20275/// #     .with_native_roots()
20276/// #     .unwrap()
20277/// #     .https_only()
20278/// #     .enable_http2()
20279/// #     .build();
20280///
20281/// # let executor = hyper_util::rt::TokioExecutor::new();
20282/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20283/// #     secret,
20284/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20285/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20286/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20287/// #     ),
20288/// # ).build().await.unwrap();
20289///
20290/// # let client = hyper_util::client::legacy::Client::builder(
20291/// #     hyper_util::rt::TokioExecutor::new()
20292/// # )
20293/// # .build(
20294/// #     hyper_rustls::HttpsConnectorBuilder::new()
20295/// #         .with_native_roots()
20296/// #         .unwrap()
20297/// #         .https_or_http()
20298/// #         .enable_http2()
20299/// #         .build()
20300/// # );
20301/// # let mut hub = ShoppingContent::new(client, auth);
20302/// // You can configure optional parameters by calling the respective setters at will, and
20303/// // execute the final call using `doit()`.
20304/// // Values shown here are possibly random and not representative !
20305/// let result = hub.liasettings().list(83)
20306///              .page_token("sanctus")
20307///              .max_results(45)
20308///              .doit().await;
20309/// # }
20310/// ```
20311pub struct LiasettingListCall<'a, C>
20312where
20313    C: 'a,
20314{
20315    hub: &'a ShoppingContent<C>,
20316    _merchant_id: u64,
20317    _page_token: Option<String>,
20318    _max_results: Option<u32>,
20319    _delegate: Option<&'a mut dyn common::Delegate>,
20320    _additional_params: HashMap<String, String>,
20321    _scopes: BTreeSet<String>,
20322}
20323
20324impl<'a, C> common::CallBuilder for LiasettingListCall<'a, C> {}
20325
20326impl<'a, C> LiasettingListCall<'a, C>
20327where
20328    C: common::Connector,
20329{
20330    /// Perform the operation you have build so far.
20331    pub async fn doit(mut self) -> common::Result<(common::Response, LiasettingsListResponse)> {
20332        use std::borrow::Cow;
20333        use std::io::{Read, Seek};
20334
20335        use common::{url::Params, ToParts};
20336        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20337
20338        let mut dd = common::DefaultDelegate;
20339        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20340        dlg.begin(common::MethodInfo {
20341            id: "content.liasettings.list",
20342            http_method: hyper::Method::GET,
20343        });
20344
20345        for &field in ["alt", "merchantId", "pageToken", "maxResults"].iter() {
20346            if self._additional_params.contains_key(field) {
20347                dlg.finished(false);
20348                return Err(common::Error::FieldClash(field));
20349            }
20350        }
20351
20352        let mut params = Params::with_capacity(5 + self._additional_params.len());
20353        params.push("merchantId", self._merchant_id.to_string());
20354        if let Some(value) = self._page_token.as_ref() {
20355            params.push("pageToken", value);
20356        }
20357        if let Some(value) = self._max_results.as_ref() {
20358            params.push("maxResults", value.to_string());
20359        }
20360
20361        params.extend(self._additional_params.iter());
20362
20363        params.push("alt", "json");
20364        let mut url = self.hub._base_url.clone() + "{merchantId}/liasettings";
20365        if self._scopes.is_empty() {
20366            self._scopes.insert(Scope::Full.as_ref().to_string());
20367        }
20368
20369        #[allow(clippy::single_element_loop)]
20370        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
20371            url = params.uri_replacement(url, param_name, find_this, false);
20372        }
20373        {
20374            let to_remove = ["merchantId"];
20375            params.remove_params(&to_remove);
20376        }
20377
20378        let url = params.parse_with_url(&url);
20379
20380        loop {
20381            let token = match self
20382                .hub
20383                .auth
20384                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20385                .await
20386            {
20387                Ok(token) => token,
20388                Err(e) => match dlg.token(e) {
20389                    Ok(token) => token,
20390                    Err(e) => {
20391                        dlg.finished(false);
20392                        return Err(common::Error::MissingToken(e));
20393                    }
20394                },
20395            };
20396            let mut req_result = {
20397                let client = &self.hub.client;
20398                dlg.pre_request();
20399                let mut req_builder = hyper::Request::builder()
20400                    .method(hyper::Method::GET)
20401                    .uri(url.as_str())
20402                    .header(USER_AGENT, self.hub._user_agent.clone());
20403
20404                if let Some(token) = token.as_ref() {
20405                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20406                }
20407
20408                let request = req_builder
20409                    .header(CONTENT_LENGTH, 0_u64)
20410                    .body(common::to_body::<String>(None));
20411
20412                client.request(request.unwrap()).await
20413            };
20414
20415            match req_result {
20416                Err(err) => {
20417                    if let common::Retry::After(d) = dlg.http_error(&err) {
20418                        sleep(d).await;
20419                        continue;
20420                    }
20421                    dlg.finished(false);
20422                    return Err(common::Error::HttpError(err));
20423                }
20424                Ok(res) => {
20425                    let (mut parts, body) = res.into_parts();
20426                    let mut body = common::Body::new(body);
20427                    if !parts.status.is_success() {
20428                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20429                        let error = serde_json::from_str(&common::to_string(&bytes));
20430                        let response = common::to_response(parts, bytes.into());
20431
20432                        if let common::Retry::After(d) =
20433                            dlg.http_failure(&response, error.as_ref().ok())
20434                        {
20435                            sleep(d).await;
20436                            continue;
20437                        }
20438
20439                        dlg.finished(false);
20440
20441                        return Err(match error {
20442                            Ok(value) => common::Error::BadRequest(value),
20443                            _ => common::Error::Failure(response),
20444                        });
20445                    }
20446                    let response = {
20447                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20448                        let encoded = common::to_string(&bytes);
20449                        match serde_json::from_str(&encoded) {
20450                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20451                            Err(error) => {
20452                                dlg.response_json_decode_error(&encoded, &error);
20453                                return Err(common::Error::JsonDecodeError(
20454                                    encoded.to_string(),
20455                                    error,
20456                                ));
20457                            }
20458                        }
20459                    };
20460
20461                    dlg.finished(true);
20462                    return Ok(response);
20463                }
20464            }
20465        }
20466    }
20467
20468    /// The ID of the managing account. This must be a multi-client account.
20469    ///
20470    /// Sets the *merchant id* path property to the given value.
20471    ///
20472    /// Even though the property as already been set when instantiating this call,
20473    /// we provide this method for API completeness.
20474    pub fn merchant_id(mut self, new_value: u64) -> LiasettingListCall<'a, C> {
20475        self._merchant_id = new_value;
20476        self
20477    }
20478    /// The token returned by the previous request.
20479    ///
20480    /// Sets the *page token* query property to the given value.
20481    pub fn page_token(mut self, new_value: &str) -> LiasettingListCall<'a, C> {
20482        self._page_token = Some(new_value.to_string());
20483        self
20484    }
20485    /// The maximum number of LIA settings to return in the response, used for paging.
20486    ///
20487    /// Sets the *max results* query property to the given value.
20488    pub fn max_results(mut self, new_value: u32) -> LiasettingListCall<'a, C> {
20489        self._max_results = Some(new_value);
20490        self
20491    }
20492    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20493    /// while executing the actual API request.
20494    ///
20495    /// ````text
20496    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20497    /// ````
20498    ///
20499    /// Sets the *delegate* property to the given value.
20500    pub fn delegate(
20501        mut self,
20502        new_value: &'a mut dyn common::Delegate,
20503    ) -> LiasettingListCall<'a, C> {
20504        self._delegate = Some(new_value);
20505        self
20506    }
20507
20508    /// Set any additional parameter of the query string used in the request.
20509    /// It should be used to set parameters which are not yet available through their own
20510    /// setters.
20511    ///
20512    /// Please note that this method must not be used to set any of the known parameters
20513    /// which have their own setter method. If done anyway, the request will fail.
20514    ///
20515    /// # Additional Parameters
20516    ///
20517    /// * *$.xgafv* (query-string) - V1 error format.
20518    /// * *access_token* (query-string) - OAuth access token.
20519    /// * *alt* (query-string) - Data format for response.
20520    /// * *callback* (query-string) - JSONP
20521    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20522    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20523    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20524    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20525    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20526    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20527    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20528    pub fn param<T>(mut self, name: T, value: T) -> LiasettingListCall<'a, C>
20529    where
20530        T: AsRef<str>,
20531    {
20532        self._additional_params
20533            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20534        self
20535    }
20536
20537    /// Identifies the authorization scope for the method you are building.
20538    ///
20539    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20540    /// [`Scope::Full`].
20541    ///
20542    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20543    /// tokens for more than one scope.
20544    ///
20545    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20546    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20547    /// sufficient, a read-write scope will do as well.
20548    pub fn add_scope<St>(mut self, scope: St) -> LiasettingListCall<'a, C>
20549    where
20550        St: AsRef<str>,
20551    {
20552        self._scopes.insert(String::from(scope.as_ref()));
20553        self
20554    }
20555    /// Identifies the authorization scope(s) for the method you are building.
20556    ///
20557    /// See [`Self::add_scope()`] for details.
20558    pub fn add_scopes<I, St>(mut self, scopes: I) -> LiasettingListCall<'a, C>
20559    where
20560        I: IntoIterator<Item = St>,
20561        St: AsRef<str>,
20562    {
20563        self._scopes
20564            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20565        self
20566    }
20567
20568    /// Removes all scopes, and no default scope will be used either.
20569    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20570    /// for details).
20571    pub fn clear_scopes(mut self) -> LiasettingListCall<'a, C> {
20572        self._scopes.clear();
20573        self
20574    }
20575}
20576
20577/// Retrieves the list of POS data providers that have active settings for the all eiligible countries.
20578///
20579/// A builder for the *listposdataproviders* method supported by a *liasetting* resource.
20580/// It is not used directly, but through a [`LiasettingMethods`] instance.
20581///
20582/// # Example
20583///
20584/// Instantiate a resource method builder
20585///
20586/// ```test_harness,no_run
20587/// # extern crate hyper;
20588/// # extern crate hyper_rustls;
20589/// # extern crate google_content2 as content2;
20590/// # async fn dox() {
20591/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20592///
20593/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20594/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20595/// #     .with_native_roots()
20596/// #     .unwrap()
20597/// #     .https_only()
20598/// #     .enable_http2()
20599/// #     .build();
20600///
20601/// # let executor = hyper_util::rt::TokioExecutor::new();
20602/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20603/// #     secret,
20604/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20605/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20606/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20607/// #     ),
20608/// # ).build().await.unwrap();
20609///
20610/// # let client = hyper_util::client::legacy::Client::builder(
20611/// #     hyper_util::rt::TokioExecutor::new()
20612/// # )
20613/// # .build(
20614/// #     hyper_rustls::HttpsConnectorBuilder::new()
20615/// #         .with_native_roots()
20616/// #         .unwrap()
20617/// #         .https_or_http()
20618/// #         .enable_http2()
20619/// #         .build()
20620/// # );
20621/// # let mut hub = ShoppingContent::new(client, auth);
20622/// // You can configure optional parameters by calling the respective setters at will, and
20623/// // execute the final call using `doit()`.
20624/// // Values shown here are possibly random and not representative !
20625/// let result = hub.liasettings().listposdataproviders()
20626///              .doit().await;
20627/// # }
20628/// ```
20629pub struct LiasettingListposdataproviderCall<'a, C>
20630where
20631    C: 'a,
20632{
20633    hub: &'a ShoppingContent<C>,
20634    _delegate: Option<&'a mut dyn common::Delegate>,
20635    _additional_params: HashMap<String, String>,
20636    _scopes: BTreeSet<String>,
20637}
20638
20639impl<'a, C> common::CallBuilder for LiasettingListposdataproviderCall<'a, C> {}
20640
20641impl<'a, C> LiasettingListposdataproviderCall<'a, C>
20642where
20643    C: common::Connector,
20644{
20645    /// Perform the operation you have build so far.
20646    pub async fn doit(
20647        mut self,
20648    ) -> common::Result<(common::Response, LiasettingsListPosDataProvidersResponse)> {
20649        use std::borrow::Cow;
20650        use std::io::{Read, Seek};
20651
20652        use common::{url::Params, ToParts};
20653        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20654
20655        let mut dd = common::DefaultDelegate;
20656        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20657        dlg.begin(common::MethodInfo {
20658            id: "content.liasettings.listposdataproviders",
20659            http_method: hyper::Method::GET,
20660        });
20661
20662        for &field in ["alt"].iter() {
20663            if self._additional_params.contains_key(field) {
20664                dlg.finished(false);
20665                return Err(common::Error::FieldClash(field));
20666            }
20667        }
20668
20669        let mut params = Params::with_capacity(2 + self._additional_params.len());
20670
20671        params.extend(self._additional_params.iter());
20672
20673        params.push("alt", "json");
20674        let mut url = self.hub._base_url.clone() + "liasettings/posdataproviders";
20675        if self._scopes.is_empty() {
20676            self._scopes.insert(Scope::Full.as_ref().to_string());
20677        }
20678
20679        let url = params.parse_with_url(&url);
20680
20681        loop {
20682            let token = match self
20683                .hub
20684                .auth
20685                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20686                .await
20687            {
20688                Ok(token) => token,
20689                Err(e) => match dlg.token(e) {
20690                    Ok(token) => token,
20691                    Err(e) => {
20692                        dlg.finished(false);
20693                        return Err(common::Error::MissingToken(e));
20694                    }
20695                },
20696            };
20697            let mut req_result = {
20698                let client = &self.hub.client;
20699                dlg.pre_request();
20700                let mut req_builder = hyper::Request::builder()
20701                    .method(hyper::Method::GET)
20702                    .uri(url.as_str())
20703                    .header(USER_AGENT, self.hub._user_agent.clone());
20704
20705                if let Some(token) = token.as_ref() {
20706                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20707                }
20708
20709                let request = req_builder
20710                    .header(CONTENT_LENGTH, 0_u64)
20711                    .body(common::to_body::<String>(None));
20712
20713                client.request(request.unwrap()).await
20714            };
20715
20716            match req_result {
20717                Err(err) => {
20718                    if let common::Retry::After(d) = dlg.http_error(&err) {
20719                        sleep(d).await;
20720                        continue;
20721                    }
20722                    dlg.finished(false);
20723                    return Err(common::Error::HttpError(err));
20724                }
20725                Ok(res) => {
20726                    let (mut parts, body) = res.into_parts();
20727                    let mut body = common::Body::new(body);
20728                    if !parts.status.is_success() {
20729                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20730                        let error = serde_json::from_str(&common::to_string(&bytes));
20731                        let response = common::to_response(parts, bytes.into());
20732
20733                        if let common::Retry::After(d) =
20734                            dlg.http_failure(&response, error.as_ref().ok())
20735                        {
20736                            sleep(d).await;
20737                            continue;
20738                        }
20739
20740                        dlg.finished(false);
20741
20742                        return Err(match error {
20743                            Ok(value) => common::Error::BadRequest(value),
20744                            _ => common::Error::Failure(response),
20745                        });
20746                    }
20747                    let response = {
20748                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20749                        let encoded = common::to_string(&bytes);
20750                        match serde_json::from_str(&encoded) {
20751                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20752                            Err(error) => {
20753                                dlg.response_json_decode_error(&encoded, &error);
20754                                return Err(common::Error::JsonDecodeError(
20755                                    encoded.to_string(),
20756                                    error,
20757                                ));
20758                            }
20759                        }
20760                    };
20761
20762                    dlg.finished(true);
20763                    return Ok(response);
20764                }
20765            }
20766        }
20767    }
20768
20769    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20770    /// while executing the actual API request.
20771    ///
20772    /// ````text
20773    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20774    /// ````
20775    ///
20776    /// Sets the *delegate* property to the given value.
20777    pub fn delegate(
20778        mut self,
20779        new_value: &'a mut dyn common::Delegate,
20780    ) -> LiasettingListposdataproviderCall<'a, C> {
20781        self._delegate = Some(new_value);
20782        self
20783    }
20784
20785    /// Set any additional parameter of the query string used in the request.
20786    /// It should be used to set parameters which are not yet available through their own
20787    /// setters.
20788    ///
20789    /// Please note that this method must not be used to set any of the known parameters
20790    /// which have their own setter method. If done anyway, the request will fail.
20791    ///
20792    /// # Additional Parameters
20793    ///
20794    /// * *$.xgafv* (query-string) - V1 error format.
20795    /// * *access_token* (query-string) - OAuth access token.
20796    /// * *alt* (query-string) - Data format for response.
20797    /// * *callback* (query-string) - JSONP
20798    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20799    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20800    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20801    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20802    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20803    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20804    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20805    pub fn param<T>(mut self, name: T, value: T) -> LiasettingListposdataproviderCall<'a, C>
20806    where
20807        T: AsRef<str>,
20808    {
20809        self._additional_params
20810            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20811        self
20812    }
20813
20814    /// Identifies the authorization scope for the method you are building.
20815    ///
20816    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20817    /// [`Scope::Full`].
20818    ///
20819    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20820    /// tokens for more than one scope.
20821    ///
20822    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20823    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20824    /// sufficient, a read-write scope will do as well.
20825    pub fn add_scope<St>(mut self, scope: St) -> LiasettingListposdataproviderCall<'a, C>
20826    where
20827        St: AsRef<str>,
20828    {
20829        self._scopes.insert(String::from(scope.as_ref()));
20830        self
20831    }
20832    /// Identifies the authorization scope(s) for the method you are building.
20833    ///
20834    /// See [`Self::add_scope()`] for details.
20835    pub fn add_scopes<I, St>(mut self, scopes: I) -> LiasettingListposdataproviderCall<'a, C>
20836    where
20837        I: IntoIterator<Item = St>,
20838        St: AsRef<str>,
20839    {
20840        self._scopes
20841            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20842        self
20843    }
20844
20845    /// Removes all scopes, and no default scope will be used either.
20846    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20847    /// for details).
20848    pub fn clear_scopes(mut self) -> LiasettingListposdataproviderCall<'a, C> {
20849        self._scopes.clear();
20850        self
20851    }
20852}
20853
20854/// Requests access to a specified Google My Business account.
20855///
20856/// A builder for the *requestgmbaccess* method supported by a *liasetting* resource.
20857/// It is not used directly, but through a [`LiasettingMethods`] instance.
20858///
20859/// # Example
20860///
20861/// Instantiate a resource method builder
20862///
20863/// ```test_harness,no_run
20864/// # extern crate hyper;
20865/// # extern crate hyper_rustls;
20866/// # extern crate google_content2 as content2;
20867/// # async fn dox() {
20868/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20869///
20870/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20871/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20872/// #     .with_native_roots()
20873/// #     .unwrap()
20874/// #     .https_only()
20875/// #     .enable_http2()
20876/// #     .build();
20877///
20878/// # let executor = hyper_util::rt::TokioExecutor::new();
20879/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20880/// #     secret,
20881/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20882/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20883/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20884/// #     ),
20885/// # ).build().await.unwrap();
20886///
20887/// # let client = hyper_util::client::legacy::Client::builder(
20888/// #     hyper_util::rt::TokioExecutor::new()
20889/// # )
20890/// # .build(
20891/// #     hyper_rustls::HttpsConnectorBuilder::new()
20892/// #         .with_native_roots()
20893/// #         .unwrap()
20894/// #         .https_or_http()
20895/// #         .enable_http2()
20896/// #         .build()
20897/// # );
20898/// # let mut hub = ShoppingContent::new(client, auth);
20899/// // You can configure optional parameters by calling the respective setters at will, and
20900/// // execute the final call using `doit()`.
20901/// // Values shown here are possibly random and not representative !
20902/// let result = hub.liasettings().requestgmbaccess(94, 71, "gmbEmail")
20903///              .doit().await;
20904/// # }
20905/// ```
20906pub struct LiasettingRequestgmbaccesCall<'a, C>
20907where
20908    C: 'a,
20909{
20910    hub: &'a ShoppingContent<C>,
20911    _merchant_id: u64,
20912    _account_id: u64,
20913    _gmb_email: String,
20914    _delegate: Option<&'a mut dyn common::Delegate>,
20915    _additional_params: HashMap<String, String>,
20916    _scopes: BTreeSet<String>,
20917}
20918
20919impl<'a, C> common::CallBuilder for LiasettingRequestgmbaccesCall<'a, C> {}
20920
20921impl<'a, C> LiasettingRequestgmbaccesCall<'a, C>
20922where
20923    C: common::Connector,
20924{
20925    /// Perform the operation you have build so far.
20926    pub async fn doit(
20927        mut self,
20928    ) -> common::Result<(common::Response, LiasettingsRequestGmbAccessResponse)> {
20929        use std::borrow::Cow;
20930        use std::io::{Read, Seek};
20931
20932        use common::{url::Params, ToParts};
20933        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20934
20935        let mut dd = common::DefaultDelegate;
20936        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20937        dlg.begin(common::MethodInfo {
20938            id: "content.liasettings.requestgmbaccess",
20939            http_method: hyper::Method::POST,
20940        });
20941
20942        for &field in ["alt", "merchantId", "accountId", "gmbEmail"].iter() {
20943            if self._additional_params.contains_key(field) {
20944                dlg.finished(false);
20945                return Err(common::Error::FieldClash(field));
20946            }
20947        }
20948
20949        let mut params = Params::with_capacity(5 + self._additional_params.len());
20950        params.push("merchantId", self._merchant_id.to_string());
20951        params.push("accountId", self._account_id.to_string());
20952        params.push("gmbEmail", self._gmb_email);
20953
20954        params.extend(self._additional_params.iter());
20955
20956        params.push("alt", "json");
20957        let mut url =
20958            self.hub._base_url.clone() + "{merchantId}/liasettings/{accountId}/requestgmbaccess";
20959        if self._scopes.is_empty() {
20960            self._scopes.insert(Scope::Full.as_ref().to_string());
20961        }
20962
20963        #[allow(clippy::single_element_loop)]
20964        for &(find_this, param_name) in
20965            [("{merchantId}", "merchantId"), ("{accountId}", "accountId")].iter()
20966        {
20967            url = params.uri_replacement(url, param_name, find_this, false);
20968        }
20969        {
20970            let to_remove = ["accountId", "merchantId"];
20971            params.remove_params(&to_remove);
20972        }
20973
20974        let url = params.parse_with_url(&url);
20975
20976        loop {
20977            let token = match self
20978                .hub
20979                .auth
20980                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20981                .await
20982            {
20983                Ok(token) => token,
20984                Err(e) => match dlg.token(e) {
20985                    Ok(token) => token,
20986                    Err(e) => {
20987                        dlg.finished(false);
20988                        return Err(common::Error::MissingToken(e));
20989                    }
20990                },
20991            };
20992            let mut req_result = {
20993                let client = &self.hub.client;
20994                dlg.pre_request();
20995                let mut req_builder = hyper::Request::builder()
20996                    .method(hyper::Method::POST)
20997                    .uri(url.as_str())
20998                    .header(USER_AGENT, self.hub._user_agent.clone());
20999
21000                if let Some(token) = token.as_ref() {
21001                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21002                }
21003
21004                let request = req_builder
21005                    .header(CONTENT_LENGTH, 0_u64)
21006                    .body(common::to_body::<String>(None));
21007
21008                client.request(request.unwrap()).await
21009            };
21010
21011            match req_result {
21012                Err(err) => {
21013                    if let common::Retry::After(d) = dlg.http_error(&err) {
21014                        sleep(d).await;
21015                        continue;
21016                    }
21017                    dlg.finished(false);
21018                    return Err(common::Error::HttpError(err));
21019                }
21020                Ok(res) => {
21021                    let (mut parts, body) = res.into_parts();
21022                    let mut body = common::Body::new(body);
21023                    if !parts.status.is_success() {
21024                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21025                        let error = serde_json::from_str(&common::to_string(&bytes));
21026                        let response = common::to_response(parts, bytes.into());
21027
21028                        if let common::Retry::After(d) =
21029                            dlg.http_failure(&response, error.as_ref().ok())
21030                        {
21031                            sleep(d).await;
21032                            continue;
21033                        }
21034
21035                        dlg.finished(false);
21036
21037                        return Err(match error {
21038                            Ok(value) => common::Error::BadRequest(value),
21039                            _ => common::Error::Failure(response),
21040                        });
21041                    }
21042                    let response = {
21043                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21044                        let encoded = common::to_string(&bytes);
21045                        match serde_json::from_str(&encoded) {
21046                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21047                            Err(error) => {
21048                                dlg.response_json_decode_error(&encoded, &error);
21049                                return Err(common::Error::JsonDecodeError(
21050                                    encoded.to_string(),
21051                                    error,
21052                                ));
21053                            }
21054                        }
21055                    };
21056
21057                    dlg.finished(true);
21058                    return Ok(response);
21059                }
21060            }
21061        }
21062    }
21063
21064    /// The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
21065    ///
21066    /// Sets the *merchant id* path property to the given value.
21067    ///
21068    /// Even though the property as already been set when instantiating this call,
21069    /// we provide this method for API completeness.
21070    pub fn merchant_id(mut self, new_value: u64) -> LiasettingRequestgmbaccesCall<'a, C> {
21071        self._merchant_id = new_value;
21072        self
21073    }
21074    /// The ID of the account for which GMB access is requested.
21075    ///
21076    /// Sets the *account id* path property to the given value.
21077    ///
21078    /// Even though the property as already been set when instantiating this call,
21079    /// we provide this method for API completeness.
21080    pub fn account_id(mut self, new_value: u64) -> LiasettingRequestgmbaccesCall<'a, C> {
21081        self._account_id = new_value;
21082        self
21083    }
21084    /// The email of the Google My Business account.
21085    ///
21086    /// Sets the *gmb email* query property to the given value.
21087    ///
21088    /// Even though the property as already been set when instantiating this call,
21089    /// we provide this method for API completeness.
21090    pub fn gmb_email(mut self, new_value: &str) -> LiasettingRequestgmbaccesCall<'a, C> {
21091        self._gmb_email = new_value.to_string();
21092        self
21093    }
21094    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21095    /// while executing the actual API request.
21096    ///
21097    /// ````text
21098    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21099    /// ````
21100    ///
21101    /// Sets the *delegate* property to the given value.
21102    pub fn delegate(
21103        mut self,
21104        new_value: &'a mut dyn common::Delegate,
21105    ) -> LiasettingRequestgmbaccesCall<'a, C> {
21106        self._delegate = Some(new_value);
21107        self
21108    }
21109
21110    /// Set any additional parameter of the query string used in the request.
21111    /// It should be used to set parameters which are not yet available through their own
21112    /// setters.
21113    ///
21114    /// Please note that this method must not be used to set any of the known parameters
21115    /// which have their own setter method. If done anyway, the request will fail.
21116    ///
21117    /// # Additional Parameters
21118    ///
21119    /// * *$.xgafv* (query-string) - V1 error format.
21120    /// * *access_token* (query-string) - OAuth access token.
21121    /// * *alt* (query-string) - Data format for response.
21122    /// * *callback* (query-string) - JSONP
21123    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21124    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21125    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21126    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21127    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21128    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21129    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21130    pub fn param<T>(mut self, name: T, value: T) -> LiasettingRequestgmbaccesCall<'a, C>
21131    where
21132        T: AsRef<str>,
21133    {
21134        self._additional_params
21135            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21136        self
21137    }
21138
21139    /// Identifies the authorization scope for the method you are building.
21140    ///
21141    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21142    /// [`Scope::Full`].
21143    ///
21144    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21145    /// tokens for more than one scope.
21146    ///
21147    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21148    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21149    /// sufficient, a read-write scope will do as well.
21150    pub fn add_scope<St>(mut self, scope: St) -> LiasettingRequestgmbaccesCall<'a, C>
21151    where
21152        St: AsRef<str>,
21153    {
21154        self._scopes.insert(String::from(scope.as_ref()));
21155        self
21156    }
21157    /// Identifies the authorization scope(s) for the method you are building.
21158    ///
21159    /// See [`Self::add_scope()`] for details.
21160    pub fn add_scopes<I, St>(mut self, scopes: I) -> LiasettingRequestgmbaccesCall<'a, C>
21161    where
21162        I: IntoIterator<Item = St>,
21163        St: AsRef<str>,
21164    {
21165        self._scopes
21166            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21167        self
21168    }
21169
21170    /// Removes all scopes, and no default scope will be used either.
21171    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21172    /// for details).
21173    pub fn clear_scopes(mut self) -> LiasettingRequestgmbaccesCall<'a, C> {
21174        self._scopes.clear();
21175        self
21176    }
21177}
21178
21179/// Requests inventory validation for the specified country.
21180///
21181/// A builder for the *requestinventoryverification* method supported by a *liasetting* resource.
21182/// It is not used directly, but through a [`LiasettingMethods`] instance.
21183///
21184/// # Example
21185///
21186/// Instantiate a resource method builder
21187///
21188/// ```test_harness,no_run
21189/// # extern crate hyper;
21190/// # extern crate hyper_rustls;
21191/// # extern crate google_content2 as content2;
21192/// # async fn dox() {
21193/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21194///
21195/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21196/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21197/// #     .with_native_roots()
21198/// #     .unwrap()
21199/// #     .https_only()
21200/// #     .enable_http2()
21201/// #     .build();
21202///
21203/// # let executor = hyper_util::rt::TokioExecutor::new();
21204/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21205/// #     secret,
21206/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21207/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21208/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21209/// #     ),
21210/// # ).build().await.unwrap();
21211///
21212/// # let client = hyper_util::client::legacy::Client::builder(
21213/// #     hyper_util::rt::TokioExecutor::new()
21214/// # )
21215/// # .build(
21216/// #     hyper_rustls::HttpsConnectorBuilder::new()
21217/// #         .with_native_roots()
21218/// #         .unwrap()
21219/// #         .https_or_http()
21220/// #         .enable_http2()
21221/// #         .build()
21222/// # );
21223/// # let mut hub = ShoppingContent::new(client, auth);
21224/// // You can configure optional parameters by calling the respective setters at will, and
21225/// // execute the final call using `doit()`.
21226/// // Values shown here are possibly random and not representative !
21227/// let result = hub.liasettings().requestinventoryverification(82, 32, "country")
21228///              .doit().await;
21229/// # }
21230/// ```
21231pub struct LiasettingRequestinventoryverificationCall<'a, C>
21232where
21233    C: 'a,
21234{
21235    hub: &'a ShoppingContent<C>,
21236    _merchant_id: u64,
21237    _account_id: u64,
21238    _country: String,
21239    _delegate: Option<&'a mut dyn common::Delegate>,
21240    _additional_params: HashMap<String, String>,
21241    _scopes: BTreeSet<String>,
21242}
21243
21244impl<'a, C> common::CallBuilder for LiasettingRequestinventoryverificationCall<'a, C> {}
21245
21246impl<'a, C> LiasettingRequestinventoryverificationCall<'a, C>
21247where
21248    C: common::Connector,
21249{
21250    /// Perform the operation you have build so far.
21251    pub async fn doit(
21252        mut self,
21253    ) -> common::Result<(
21254        common::Response,
21255        LiasettingsRequestInventoryVerificationResponse,
21256    )> {
21257        use std::borrow::Cow;
21258        use std::io::{Read, Seek};
21259
21260        use common::{url::Params, ToParts};
21261        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21262
21263        let mut dd = common::DefaultDelegate;
21264        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21265        dlg.begin(common::MethodInfo {
21266            id: "content.liasettings.requestinventoryverification",
21267            http_method: hyper::Method::POST,
21268        });
21269
21270        for &field in ["alt", "merchantId", "accountId", "country"].iter() {
21271            if self._additional_params.contains_key(field) {
21272                dlg.finished(false);
21273                return Err(common::Error::FieldClash(field));
21274            }
21275        }
21276
21277        let mut params = Params::with_capacity(5 + self._additional_params.len());
21278        params.push("merchantId", self._merchant_id.to_string());
21279        params.push("accountId", self._account_id.to_string());
21280        params.push("country", self._country);
21281
21282        params.extend(self._additional_params.iter());
21283
21284        params.push("alt", "json");
21285        let mut url = self.hub._base_url.clone()
21286            + "{merchantId}/liasettings/{accountId}/requestinventoryverification/{country}";
21287        if self._scopes.is_empty() {
21288            self._scopes.insert(Scope::Full.as_ref().to_string());
21289        }
21290
21291        #[allow(clippy::single_element_loop)]
21292        for &(find_this, param_name) in [
21293            ("{merchantId}", "merchantId"),
21294            ("{accountId}", "accountId"),
21295            ("{country}", "country"),
21296        ]
21297        .iter()
21298        {
21299            url = params.uri_replacement(url, param_name, find_this, false);
21300        }
21301        {
21302            let to_remove = ["country", "accountId", "merchantId"];
21303            params.remove_params(&to_remove);
21304        }
21305
21306        let url = params.parse_with_url(&url);
21307
21308        loop {
21309            let token = match self
21310                .hub
21311                .auth
21312                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21313                .await
21314            {
21315                Ok(token) => token,
21316                Err(e) => match dlg.token(e) {
21317                    Ok(token) => token,
21318                    Err(e) => {
21319                        dlg.finished(false);
21320                        return Err(common::Error::MissingToken(e));
21321                    }
21322                },
21323            };
21324            let mut req_result = {
21325                let client = &self.hub.client;
21326                dlg.pre_request();
21327                let mut req_builder = hyper::Request::builder()
21328                    .method(hyper::Method::POST)
21329                    .uri(url.as_str())
21330                    .header(USER_AGENT, self.hub._user_agent.clone());
21331
21332                if let Some(token) = token.as_ref() {
21333                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21334                }
21335
21336                let request = req_builder
21337                    .header(CONTENT_LENGTH, 0_u64)
21338                    .body(common::to_body::<String>(None));
21339
21340                client.request(request.unwrap()).await
21341            };
21342
21343            match req_result {
21344                Err(err) => {
21345                    if let common::Retry::After(d) = dlg.http_error(&err) {
21346                        sleep(d).await;
21347                        continue;
21348                    }
21349                    dlg.finished(false);
21350                    return Err(common::Error::HttpError(err));
21351                }
21352                Ok(res) => {
21353                    let (mut parts, body) = res.into_parts();
21354                    let mut body = common::Body::new(body);
21355                    if !parts.status.is_success() {
21356                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21357                        let error = serde_json::from_str(&common::to_string(&bytes));
21358                        let response = common::to_response(parts, bytes.into());
21359
21360                        if let common::Retry::After(d) =
21361                            dlg.http_failure(&response, error.as_ref().ok())
21362                        {
21363                            sleep(d).await;
21364                            continue;
21365                        }
21366
21367                        dlg.finished(false);
21368
21369                        return Err(match error {
21370                            Ok(value) => common::Error::BadRequest(value),
21371                            _ => common::Error::Failure(response),
21372                        });
21373                    }
21374                    let response = {
21375                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21376                        let encoded = common::to_string(&bytes);
21377                        match serde_json::from_str(&encoded) {
21378                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21379                            Err(error) => {
21380                                dlg.response_json_decode_error(&encoded, &error);
21381                                return Err(common::Error::JsonDecodeError(
21382                                    encoded.to_string(),
21383                                    error,
21384                                ));
21385                            }
21386                        }
21387                    };
21388
21389                    dlg.finished(true);
21390                    return Ok(response);
21391                }
21392            }
21393        }
21394    }
21395
21396    /// The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
21397    ///
21398    /// Sets the *merchant id* path property to the given value.
21399    ///
21400    /// Even though the property as already been set when instantiating this call,
21401    /// we provide this method for API completeness.
21402    pub fn merchant_id(
21403        mut self,
21404        new_value: u64,
21405    ) -> LiasettingRequestinventoryverificationCall<'a, C> {
21406        self._merchant_id = new_value;
21407        self
21408    }
21409    /// The ID of the account that manages the order. This cannot be a multi-client account.
21410    ///
21411    /// Sets the *account id* path property to the given value.
21412    ///
21413    /// Even though the property as already been set when instantiating this call,
21414    /// we provide this method for API completeness.
21415    pub fn account_id(
21416        mut self,
21417        new_value: u64,
21418    ) -> LiasettingRequestinventoryverificationCall<'a, C> {
21419        self._account_id = new_value;
21420        self
21421    }
21422    /// The country for which inventory validation is requested.
21423    ///
21424    /// Sets the *country* path property to the given value.
21425    ///
21426    /// Even though the property as already been set when instantiating this call,
21427    /// we provide this method for API completeness.
21428    pub fn country(mut self, new_value: &str) -> LiasettingRequestinventoryverificationCall<'a, C> {
21429        self._country = new_value.to_string();
21430        self
21431    }
21432    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21433    /// while executing the actual API request.
21434    ///
21435    /// ````text
21436    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21437    /// ````
21438    ///
21439    /// Sets the *delegate* property to the given value.
21440    pub fn delegate(
21441        mut self,
21442        new_value: &'a mut dyn common::Delegate,
21443    ) -> LiasettingRequestinventoryverificationCall<'a, C> {
21444        self._delegate = Some(new_value);
21445        self
21446    }
21447
21448    /// Set any additional parameter of the query string used in the request.
21449    /// It should be used to set parameters which are not yet available through their own
21450    /// setters.
21451    ///
21452    /// Please note that this method must not be used to set any of the known parameters
21453    /// which have their own setter method. If done anyway, the request will fail.
21454    ///
21455    /// # Additional Parameters
21456    ///
21457    /// * *$.xgafv* (query-string) - V1 error format.
21458    /// * *access_token* (query-string) - OAuth access token.
21459    /// * *alt* (query-string) - Data format for response.
21460    /// * *callback* (query-string) - JSONP
21461    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21462    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21463    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21464    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21465    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21466    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21467    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21468    pub fn param<T>(
21469        mut self,
21470        name: T,
21471        value: T,
21472    ) -> LiasettingRequestinventoryverificationCall<'a, C>
21473    where
21474        T: AsRef<str>,
21475    {
21476        self._additional_params
21477            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21478        self
21479    }
21480
21481    /// Identifies the authorization scope for the method you are building.
21482    ///
21483    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21484    /// [`Scope::Full`].
21485    ///
21486    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21487    /// tokens for more than one scope.
21488    ///
21489    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21490    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21491    /// sufficient, a read-write scope will do as well.
21492    pub fn add_scope<St>(mut self, scope: St) -> LiasettingRequestinventoryverificationCall<'a, C>
21493    where
21494        St: AsRef<str>,
21495    {
21496        self._scopes.insert(String::from(scope.as_ref()));
21497        self
21498    }
21499    /// Identifies the authorization scope(s) for the method you are building.
21500    ///
21501    /// See [`Self::add_scope()`] for details.
21502    pub fn add_scopes<I, St>(
21503        mut self,
21504        scopes: I,
21505    ) -> LiasettingRequestinventoryverificationCall<'a, C>
21506    where
21507        I: IntoIterator<Item = St>,
21508        St: AsRef<str>,
21509    {
21510        self._scopes
21511            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21512        self
21513    }
21514
21515    /// Removes all scopes, and no default scope will be used either.
21516    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21517    /// for details).
21518    pub fn clear_scopes(mut self) -> LiasettingRequestinventoryverificationCall<'a, C> {
21519        self._scopes.clear();
21520        self
21521    }
21522}
21523
21524/// Sets the inventory verification contract for the specified country.
21525///
21526/// A builder for the *setinventoryverificationcontact* method supported by a *liasetting* resource.
21527/// It is not used directly, but through a [`LiasettingMethods`] instance.
21528///
21529/// # Example
21530///
21531/// Instantiate a resource method builder
21532///
21533/// ```test_harness,no_run
21534/// # extern crate hyper;
21535/// # extern crate hyper_rustls;
21536/// # extern crate google_content2 as content2;
21537/// # async fn dox() {
21538/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21539///
21540/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21541/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21542/// #     .with_native_roots()
21543/// #     .unwrap()
21544/// #     .https_only()
21545/// #     .enable_http2()
21546/// #     .build();
21547///
21548/// # let executor = hyper_util::rt::TokioExecutor::new();
21549/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21550/// #     secret,
21551/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21552/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21553/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21554/// #     ),
21555/// # ).build().await.unwrap();
21556///
21557/// # let client = hyper_util::client::legacy::Client::builder(
21558/// #     hyper_util::rt::TokioExecutor::new()
21559/// # )
21560/// # .build(
21561/// #     hyper_rustls::HttpsConnectorBuilder::new()
21562/// #         .with_native_roots()
21563/// #         .unwrap()
21564/// #         .https_or_http()
21565/// #         .enable_http2()
21566/// #         .build()
21567/// # );
21568/// # let mut hub = ShoppingContent::new(client, auth);
21569/// // You can configure optional parameters by calling the respective setters at will, and
21570/// // execute the final call using `doit()`.
21571/// // Values shown here are possibly random and not representative !
21572/// let result = hub.liasettings().setinventoryverificationcontact(8, 90, "country", "language", "contactName", "contactEmail")
21573///              .doit().await;
21574/// # }
21575/// ```
21576pub struct LiasettingSetinventoryverificationcontactCall<'a, C>
21577where
21578    C: 'a,
21579{
21580    hub: &'a ShoppingContent<C>,
21581    _merchant_id: u64,
21582    _account_id: u64,
21583    _country: String,
21584    _language: String,
21585    _contact_name: String,
21586    _contact_email: String,
21587    _delegate: Option<&'a mut dyn common::Delegate>,
21588    _additional_params: HashMap<String, String>,
21589    _scopes: BTreeSet<String>,
21590}
21591
21592impl<'a, C> common::CallBuilder for LiasettingSetinventoryverificationcontactCall<'a, C> {}
21593
21594impl<'a, C> LiasettingSetinventoryverificationcontactCall<'a, C>
21595where
21596    C: common::Connector,
21597{
21598    /// Perform the operation you have build so far.
21599    pub async fn doit(
21600        mut self,
21601    ) -> common::Result<(
21602        common::Response,
21603        LiasettingsSetInventoryVerificationContactResponse,
21604    )> {
21605        use std::borrow::Cow;
21606        use std::io::{Read, Seek};
21607
21608        use common::{url::Params, ToParts};
21609        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21610
21611        let mut dd = common::DefaultDelegate;
21612        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21613        dlg.begin(common::MethodInfo {
21614            id: "content.liasettings.setinventoryverificationcontact",
21615            http_method: hyper::Method::POST,
21616        });
21617
21618        for &field in [
21619            "alt",
21620            "merchantId",
21621            "accountId",
21622            "country",
21623            "language",
21624            "contactName",
21625            "contactEmail",
21626        ]
21627        .iter()
21628        {
21629            if self._additional_params.contains_key(field) {
21630                dlg.finished(false);
21631                return Err(common::Error::FieldClash(field));
21632            }
21633        }
21634
21635        let mut params = Params::with_capacity(8 + self._additional_params.len());
21636        params.push("merchantId", self._merchant_id.to_string());
21637        params.push("accountId", self._account_id.to_string());
21638        params.push("country", self._country);
21639        params.push("language", self._language);
21640        params.push("contactName", self._contact_name);
21641        params.push("contactEmail", self._contact_email);
21642
21643        params.extend(self._additional_params.iter());
21644
21645        params.push("alt", "json");
21646        let mut url = self.hub._base_url.clone()
21647            + "{merchantId}/liasettings/{accountId}/setinventoryverificationcontact";
21648        if self._scopes.is_empty() {
21649            self._scopes.insert(Scope::Full.as_ref().to_string());
21650        }
21651
21652        #[allow(clippy::single_element_loop)]
21653        for &(find_this, param_name) in
21654            [("{merchantId}", "merchantId"), ("{accountId}", "accountId")].iter()
21655        {
21656            url = params.uri_replacement(url, param_name, find_this, false);
21657        }
21658        {
21659            let to_remove = ["accountId", "merchantId"];
21660            params.remove_params(&to_remove);
21661        }
21662
21663        let url = params.parse_with_url(&url);
21664
21665        loop {
21666            let token = match self
21667                .hub
21668                .auth
21669                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21670                .await
21671            {
21672                Ok(token) => token,
21673                Err(e) => match dlg.token(e) {
21674                    Ok(token) => token,
21675                    Err(e) => {
21676                        dlg.finished(false);
21677                        return Err(common::Error::MissingToken(e));
21678                    }
21679                },
21680            };
21681            let mut req_result = {
21682                let client = &self.hub.client;
21683                dlg.pre_request();
21684                let mut req_builder = hyper::Request::builder()
21685                    .method(hyper::Method::POST)
21686                    .uri(url.as_str())
21687                    .header(USER_AGENT, self.hub._user_agent.clone());
21688
21689                if let Some(token) = token.as_ref() {
21690                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21691                }
21692
21693                let request = req_builder
21694                    .header(CONTENT_LENGTH, 0_u64)
21695                    .body(common::to_body::<String>(None));
21696
21697                client.request(request.unwrap()).await
21698            };
21699
21700            match req_result {
21701                Err(err) => {
21702                    if let common::Retry::After(d) = dlg.http_error(&err) {
21703                        sleep(d).await;
21704                        continue;
21705                    }
21706                    dlg.finished(false);
21707                    return Err(common::Error::HttpError(err));
21708                }
21709                Ok(res) => {
21710                    let (mut parts, body) = res.into_parts();
21711                    let mut body = common::Body::new(body);
21712                    if !parts.status.is_success() {
21713                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21714                        let error = serde_json::from_str(&common::to_string(&bytes));
21715                        let response = common::to_response(parts, bytes.into());
21716
21717                        if let common::Retry::After(d) =
21718                            dlg.http_failure(&response, error.as_ref().ok())
21719                        {
21720                            sleep(d).await;
21721                            continue;
21722                        }
21723
21724                        dlg.finished(false);
21725
21726                        return Err(match error {
21727                            Ok(value) => common::Error::BadRequest(value),
21728                            _ => common::Error::Failure(response),
21729                        });
21730                    }
21731                    let response = {
21732                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21733                        let encoded = common::to_string(&bytes);
21734                        match serde_json::from_str(&encoded) {
21735                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21736                            Err(error) => {
21737                                dlg.response_json_decode_error(&encoded, &error);
21738                                return Err(common::Error::JsonDecodeError(
21739                                    encoded.to_string(),
21740                                    error,
21741                                ));
21742                            }
21743                        }
21744                    };
21745
21746                    dlg.finished(true);
21747                    return Ok(response);
21748                }
21749            }
21750        }
21751    }
21752
21753    /// The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
21754    ///
21755    /// Sets the *merchant id* path property to the given value.
21756    ///
21757    /// Even though the property as already been set when instantiating this call,
21758    /// we provide this method for API completeness.
21759    pub fn merchant_id(
21760        mut self,
21761        new_value: u64,
21762    ) -> LiasettingSetinventoryverificationcontactCall<'a, C> {
21763        self._merchant_id = new_value;
21764        self
21765    }
21766    /// The ID of the account that manages the order. This cannot be a multi-client account.
21767    ///
21768    /// Sets the *account id* path property to the given value.
21769    ///
21770    /// Even though the property as already been set when instantiating this call,
21771    /// we provide this method for API completeness.
21772    pub fn account_id(
21773        mut self,
21774        new_value: u64,
21775    ) -> LiasettingSetinventoryverificationcontactCall<'a, C> {
21776        self._account_id = new_value;
21777        self
21778    }
21779    /// The country for which inventory verification is requested.
21780    ///
21781    /// Sets the *country* query property to the given value.
21782    ///
21783    /// Even though the property as already been set when instantiating this call,
21784    /// we provide this method for API completeness.
21785    pub fn country(
21786        mut self,
21787        new_value: &str,
21788    ) -> LiasettingSetinventoryverificationcontactCall<'a, C> {
21789        self._country = new_value.to_string();
21790        self
21791    }
21792    /// The language for which inventory verification is requested.
21793    ///
21794    /// Sets the *language* query property to the given value.
21795    ///
21796    /// Even though the property as already been set when instantiating this call,
21797    /// we provide this method for API completeness.
21798    pub fn language(
21799        mut self,
21800        new_value: &str,
21801    ) -> LiasettingSetinventoryverificationcontactCall<'a, C> {
21802        self._language = new_value.to_string();
21803        self
21804    }
21805    /// The name of the inventory verification contact.
21806    ///
21807    /// Sets the *contact name* query property to the given value.
21808    ///
21809    /// Even though the property as already been set when instantiating this call,
21810    /// we provide this method for API completeness.
21811    pub fn contact_name(
21812        mut self,
21813        new_value: &str,
21814    ) -> LiasettingSetinventoryverificationcontactCall<'a, C> {
21815        self._contact_name = new_value.to_string();
21816        self
21817    }
21818    /// The email of the inventory verification contact.
21819    ///
21820    /// Sets the *contact email* query property to the given value.
21821    ///
21822    /// Even though the property as already been set when instantiating this call,
21823    /// we provide this method for API completeness.
21824    pub fn contact_email(
21825        mut self,
21826        new_value: &str,
21827    ) -> LiasettingSetinventoryverificationcontactCall<'a, C> {
21828        self._contact_email = new_value.to_string();
21829        self
21830    }
21831    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21832    /// while executing the actual API request.
21833    ///
21834    /// ````text
21835    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21836    /// ````
21837    ///
21838    /// Sets the *delegate* property to the given value.
21839    pub fn delegate(
21840        mut self,
21841        new_value: &'a mut dyn common::Delegate,
21842    ) -> LiasettingSetinventoryverificationcontactCall<'a, C> {
21843        self._delegate = Some(new_value);
21844        self
21845    }
21846
21847    /// Set any additional parameter of the query string used in the request.
21848    /// It should be used to set parameters which are not yet available through their own
21849    /// setters.
21850    ///
21851    /// Please note that this method must not be used to set any of the known parameters
21852    /// which have their own setter method. If done anyway, the request will fail.
21853    ///
21854    /// # Additional Parameters
21855    ///
21856    /// * *$.xgafv* (query-string) - V1 error format.
21857    /// * *access_token* (query-string) - OAuth access token.
21858    /// * *alt* (query-string) - Data format for response.
21859    /// * *callback* (query-string) - JSONP
21860    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21861    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21862    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21863    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21864    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21865    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21866    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21867    pub fn param<T>(
21868        mut self,
21869        name: T,
21870        value: T,
21871    ) -> LiasettingSetinventoryverificationcontactCall<'a, C>
21872    where
21873        T: AsRef<str>,
21874    {
21875        self._additional_params
21876            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21877        self
21878    }
21879
21880    /// Identifies the authorization scope for the method you are building.
21881    ///
21882    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21883    /// [`Scope::Full`].
21884    ///
21885    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21886    /// tokens for more than one scope.
21887    ///
21888    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21889    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21890    /// sufficient, a read-write scope will do as well.
21891    pub fn add_scope<St>(
21892        mut self,
21893        scope: St,
21894    ) -> LiasettingSetinventoryverificationcontactCall<'a, C>
21895    where
21896        St: AsRef<str>,
21897    {
21898        self._scopes.insert(String::from(scope.as_ref()));
21899        self
21900    }
21901    /// Identifies the authorization scope(s) for the method you are building.
21902    ///
21903    /// See [`Self::add_scope()`] for details.
21904    pub fn add_scopes<I, St>(
21905        mut self,
21906        scopes: I,
21907    ) -> LiasettingSetinventoryverificationcontactCall<'a, C>
21908    where
21909        I: IntoIterator<Item = St>,
21910        St: AsRef<str>,
21911    {
21912        self._scopes
21913            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21914        self
21915    }
21916
21917    /// Removes all scopes, and no default scope will be used either.
21918    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21919    /// for details).
21920    pub fn clear_scopes(mut self) -> LiasettingSetinventoryverificationcontactCall<'a, C> {
21921        self._scopes.clear();
21922        self
21923    }
21924}
21925
21926/// Sets the POS data provider for the specified country.
21927///
21928/// A builder for the *setposdataprovider* method supported by a *liasetting* resource.
21929/// It is not used directly, but through a [`LiasettingMethods`] instance.
21930///
21931/// # Example
21932///
21933/// Instantiate a resource method builder
21934///
21935/// ```test_harness,no_run
21936/// # extern crate hyper;
21937/// # extern crate hyper_rustls;
21938/// # extern crate google_content2 as content2;
21939/// # async fn dox() {
21940/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21941///
21942/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21943/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21944/// #     .with_native_roots()
21945/// #     .unwrap()
21946/// #     .https_only()
21947/// #     .enable_http2()
21948/// #     .build();
21949///
21950/// # let executor = hyper_util::rt::TokioExecutor::new();
21951/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21952/// #     secret,
21953/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21954/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21955/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21956/// #     ),
21957/// # ).build().await.unwrap();
21958///
21959/// # let client = hyper_util::client::legacy::Client::builder(
21960/// #     hyper_util::rt::TokioExecutor::new()
21961/// # )
21962/// # .build(
21963/// #     hyper_rustls::HttpsConnectorBuilder::new()
21964/// #         .with_native_roots()
21965/// #         .unwrap()
21966/// #         .https_or_http()
21967/// #         .enable_http2()
21968/// #         .build()
21969/// # );
21970/// # let mut hub = ShoppingContent::new(client, auth);
21971/// // You can configure optional parameters by calling the respective setters at will, and
21972/// // execute the final call using `doit()`.
21973/// // Values shown here are possibly random and not representative !
21974/// let result = hub.liasettings().setposdataprovider(10, 24, "country")
21975///              .pos_external_account_id("aliquyam")
21976///              .pos_data_provider_id(32)
21977///              .doit().await;
21978/// # }
21979/// ```
21980pub struct LiasettingSetposdataproviderCall<'a, C>
21981where
21982    C: 'a,
21983{
21984    hub: &'a ShoppingContent<C>,
21985    _merchant_id: u64,
21986    _account_id: u64,
21987    _country: String,
21988    _pos_external_account_id: Option<String>,
21989    _pos_data_provider_id: Option<u64>,
21990    _delegate: Option<&'a mut dyn common::Delegate>,
21991    _additional_params: HashMap<String, String>,
21992    _scopes: BTreeSet<String>,
21993}
21994
21995impl<'a, C> common::CallBuilder for LiasettingSetposdataproviderCall<'a, C> {}
21996
21997impl<'a, C> LiasettingSetposdataproviderCall<'a, C>
21998where
21999    C: common::Connector,
22000{
22001    /// Perform the operation you have build so far.
22002    pub async fn doit(
22003        mut self,
22004    ) -> common::Result<(common::Response, LiasettingsSetPosDataProviderResponse)> {
22005        use std::borrow::Cow;
22006        use std::io::{Read, Seek};
22007
22008        use common::{url::Params, ToParts};
22009        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22010
22011        let mut dd = common::DefaultDelegate;
22012        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22013        dlg.begin(common::MethodInfo {
22014            id: "content.liasettings.setposdataprovider",
22015            http_method: hyper::Method::POST,
22016        });
22017
22018        for &field in [
22019            "alt",
22020            "merchantId",
22021            "accountId",
22022            "country",
22023            "posExternalAccountId",
22024            "posDataProviderId",
22025        ]
22026        .iter()
22027        {
22028            if self._additional_params.contains_key(field) {
22029                dlg.finished(false);
22030                return Err(common::Error::FieldClash(field));
22031            }
22032        }
22033
22034        let mut params = Params::with_capacity(7 + self._additional_params.len());
22035        params.push("merchantId", self._merchant_id.to_string());
22036        params.push("accountId", self._account_id.to_string());
22037        params.push("country", self._country);
22038        if let Some(value) = self._pos_external_account_id.as_ref() {
22039            params.push("posExternalAccountId", value);
22040        }
22041        if let Some(value) = self._pos_data_provider_id.as_ref() {
22042            params.push("posDataProviderId", value.to_string());
22043        }
22044
22045        params.extend(self._additional_params.iter());
22046
22047        params.push("alt", "json");
22048        let mut url =
22049            self.hub._base_url.clone() + "{merchantId}/liasettings/{accountId}/setposdataprovider";
22050        if self._scopes.is_empty() {
22051            self._scopes.insert(Scope::Full.as_ref().to_string());
22052        }
22053
22054        #[allow(clippy::single_element_loop)]
22055        for &(find_this, param_name) in
22056            [("{merchantId}", "merchantId"), ("{accountId}", "accountId")].iter()
22057        {
22058            url = params.uri_replacement(url, param_name, find_this, false);
22059        }
22060        {
22061            let to_remove = ["accountId", "merchantId"];
22062            params.remove_params(&to_remove);
22063        }
22064
22065        let url = params.parse_with_url(&url);
22066
22067        loop {
22068            let token = match self
22069                .hub
22070                .auth
22071                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22072                .await
22073            {
22074                Ok(token) => token,
22075                Err(e) => match dlg.token(e) {
22076                    Ok(token) => token,
22077                    Err(e) => {
22078                        dlg.finished(false);
22079                        return Err(common::Error::MissingToken(e));
22080                    }
22081                },
22082            };
22083            let mut req_result = {
22084                let client = &self.hub.client;
22085                dlg.pre_request();
22086                let mut req_builder = hyper::Request::builder()
22087                    .method(hyper::Method::POST)
22088                    .uri(url.as_str())
22089                    .header(USER_AGENT, self.hub._user_agent.clone());
22090
22091                if let Some(token) = token.as_ref() {
22092                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22093                }
22094
22095                let request = req_builder
22096                    .header(CONTENT_LENGTH, 0_u64)
22097                    .body(common::to_body::<String>(None));
22098
22099                client.request(request.unwrap()).await
22100            };
22101
22102            match req_result {
22103                Err(err) => {
22104                    if let common::Retry::After(d) = dlg.http_error(&err) {
22105                        sleep(d).await;
22106                        continue;
22107                    }
22108                    dlg.finished(false);
22109                    return Err(common::Error::HttpError(err));
22110                }
22111                Ok(res) => {
22112                    let (mut parts, body) = res.into_parts();
22113                    let mut body = common::Body::new(body);
22114                    if !parts.status.is_success() {
22115                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22116                        let error = serde_json::from_str(&common::to_string(&bytes));
22117                        let response = common::to_response(parts, bytes.into());
22118
22119                        if let common::Retry::After(d) =
22120                            dlg.http_failure(&response, error.as_ref().ok())
22121                        {
22122                            sleep(d).await;
22123                            continue;
22124                        }
22125
22126                        dlg.finished(false);
22127
22128                        return Err(match error {
22129                            Ok(value) => common::Error::BadRequest(value),
22130                            _ => common::Error::Failure(response),
22131                        });
22132                    }
22133                    let response = {
22134                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22135                        let encoded = common::to_string(&bytes);
22136                        match serde_json::from_str(&encoded) {
22137                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22138                            Err(error) => {
22139                                dlg.response_json_decode_error(&encoded, &error);
22140                                return Err(common::Error::JsonDecodeError(
22141                                    encoded.to_string(),
22142                                    error,
22143                                ));
22144                            }
22145                        }
22146                    };
22147
22148                    dlg.finished(true);
22149                    return Ok(response);
22150                }
22151            }
22152        }
22153    }
22154
22155    /// The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
22156    ///
22157    /// Sets the *merchant id* path property to the given value.
22158    ///
22159    /// Even though the property as already been set when instantiating this call,
22160    /// we provide this method for API completeness.
22161    pub fn merchant_id(mut self, new_value: u64) -> LiasettingSetposdataproviderCall<'a, C> {
22162        self._merchant_id = new_value;
22163        self
22164    }
22165    /// The ID of the account for which to retrieve accessible Google My Business accounts.
22166    ///
22167    /// Sets the *account id* path property to the given value.
22168    ///
22169    /// Even though the property as already been set when instantiating this call,
22170    /// we provide this method for API completeness.
22171    pub fn account_id(mut self, new_value: u64) -> LiasettingSetposdataproviderCall<'a, C> {
22172        self._account_id = new_value;
22173        self
22174    }
22175    /// The country for which the POS data provider is selected.
22176    ///
22177    /// Sets the *country* query property to the given value.
22178    ///
22179    /// Even though the property as already been set when instantiating this call,
22180    /// we provide this method for API completeness.
22181    pub fn country(mut self, new_value: &str) -> LiasettingSetposdataproviderCall<'a, C> {
22182        self._country = new_value.to_string();
22183        self
22184    }
22185    /// The account ID by which this merchant is known to the POS data provider.
22186    ///
22187    /// Sets the *pos external account id* query property to the given value.
22188    pub fn pos_external_account_id(
22189        mut self,
22190        new_value: &str,
22191    ) -> LiasettingSetposdataproviderCall<'a, C> {
22192        self._pos_external_account_id = Some(new_value.to_string());
22193        self
22194    }
22195    /// The ID of POS data provider.
22196    ///
22197    /// Sets the *pos data provider id* query property to the given value.
22198    pub fn pos_data_provider_id(
22199        mut self,
22200        new_value: u64,
22201    ) -> LiasettingSetposdataproviderCall<'a, C> {
22202        self._pos_data_provider_id = Some(new_value);
22203        self
22204    }
22205    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22206    /// while executing the actual API request.
22207    ///
22208    /// ````text
22209    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22210    /// ````
22211    ///
22212    /// Sets the *delegate* property to the given value.
22213    pub fn delegate(
22214        mut self,
22215        new_value: &'a mut dyn common::Delegate,
22216    ) -> LiasettingSetposdataproviderCall<'a, C> {
22217        self._delegate = Some(new_value);
22218        self
22219    }
22220
22221    /// Set any additional parameter of the query string used in the request.
22222    /// It should be used to set parameters which are not yet available through their own
22223    /// setters.
22224    ///
22225    /// Please note that this method must not be used to set any of the known parameters
22226    /// which have their own setter method. If done anyway, the request will fail.
22227    ///
22228    /// # Additional Parameters
22229    ///
22230    /// * *$.xgafv* (query-string) - V1 error format.
22231    /// * *access_token* (query-string) - OAuth access token.
22232    /// * *alt* (query-string) - Data format for response.
22233    /// * *callback* (query-string) - JSONP
22234    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22235    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22236    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22237    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22238    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22239    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22240    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22241    pub fn param<T>(mut self, name: T, value: T) -> LiasettingSetposdataproviderCall<'a, C>
22242    where
22243        T: AsRef<str>,
22244    {
22245        self._additional_params
22246            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22247        self
22248    }
22249
22250    /// Identifies the authorization scope for the method you are building.
22251    ///
22252    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22253    /// [`Scope::Full`].
22254    ///
22255    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22256    /// tokens for more than one scope.
22257    ///
22258    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22259    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22260    /// sufficient, a read-write scope will do as well.
22261    pub fn add_scope<St>(mut self, scope: St) -> LiasettingSetposdataproviderCall<'a, C>
22262    where
22263        St: AsRef<str>,
22264    {
22265        self._scopes.insert(String::from(scope.as_ref()));
22266        self
22267    }
22268    /// Identifies the authorization scope(s) for the method you are building.
22269    ///
22270    /// See [`Self::add_scope()`] for details.
22271    pub fn add_scopes<I, St>(mut self, scopes: I) -> LiasettingSetposdataproviderCall<'a, C>
22272    where
22273        I: IntoIterator<Item = St>,
22274        St: AsRef<str>,
22275    {
22276        self._scopes
22277            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22278        self
22279    }
22280
22281    /// Removes all scopes, and no default scope will be used either.
22282    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22283    /// for details).
22284    pub fn clear_scopes(mut self) -> LiasettingSetposdataproviderCall<'a, C> {
22285        self._scopes.clear();
22286        self
22287    }
22288}
22289
22290/// Updates the LIA settings of the account. Any fields that are not provided are deleted from the resource.
22291///
22292/// A builder for the *update* method supported by a *liasetting* resource.
22293/// It is not used directly, but through a [`LiasettingMethods`] instance.
22294///
22295/// # Example
22296///
22297/// Instantiate a resource method builder
22298///
22299/// ```test_harness,no_run
22300/// # extern crate hyper;
22301/// # extern crate hyper_rustls;
22302/// # extern crate google_content2 as content2;
22303/// use content2::api::LiaSettings;
22304/// # async fn dox() {
22305/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22306///
22307/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22308/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22309/// #     .with_native_roots()
22310/// #     .unwrap()
22311/// #     .https_only()
22312/// #     .enable_http2()
22313/// #     .build();
22314///
22315/// # let executor = hyper_util::rt::TokioExecutor::new();
22316/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22317/// #     secret,
22318/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22319/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22320/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22321/// #     ),
22322/// # ).build().await.unwrap();
22323///
22324/// # let client = hyper_util::client::legacy::Client::builder(
22325/// #     hyper_util::rt::TokioExecutor::new()
22326/// # )
22327/// # .build(
22328/// #     hyper_rustls::HttpsConnectorBuilder::new()
22329/// #         .with_native_roots()
22330/// #         .unwrap()
22331/// #         .https_or_http()
22332/// #         .enable_http2()
22333/// #         .build()
22334/// # );
22335/// # let mut hub = ShoppingContent::new(client, auth);
22336/// // As the method needs a request, you would usually fill it with the desired information
22337/// // into the respective structure. Some of the parts shown here might not be applicable !
22338/// // Values shown here are possibly random and not representative !
22339/// let mut req = LiaSettings::default();
22340///
22341/// // You can configure optional parameters by calling the respective setters at will, and
22342/// // execute the final call using `doit()`.
22343/// // Values shown here are possibly random and not representative !
22344/// let result = hub.liasettings().update(req, 6, 70)
22345///              .dry_run(false)
22346///              .doit().await;
22347/// # }
22348/// ```
22349pub struct LiasettingUpdateCall<'a, C>
22350where
22351    C: 'a,
22352{
22353    hub: &'a ShoppingContent<C>,
22354    _request: LiaSettings,
22355    _merchant_id: u64,
22356    _account_id: u64,
22357    _dry_run: Option<bool>,
22358    _delegate: Option<&'a mut dyn common::Delegate>,
22359    _additional_params: HashMap<String, String>,
22360    _scopes: BTreeSet<String>,
22361}
22362
22363impl<'a, C> common::CallBuilder for LiasettingUpdateCall<'a, C> {}
22364
22365impl<'a, C> LiasettingUpdateCall<'a, C>
22366where
22367    C: common::Connector,
22368{
22369    /// Perform the operation you have build so far.
22370    pub async fn doit(mut self) -> common::Result<(common::Response, LiaSettings)> {
22371        use std::borrow::Cow;
22372        use std::io::{Read, Seek};
22373
22374        use common::{url::Params, ToParts};
22375        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22376
22377        let mut dd = common::DefaultDelegate;
22378        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22379        dlg.begin(common::MethodInfo {
22380            id: "content.liasettings.update",
22381            http_method: hyper::Method::PUT,
22382        });
22383
22384        for &field in ["alt", "merchantId", "accountId", "dryRun"].iter() {
22385            if self._additional_params.contains_key(field) {
22386                dlg.finished(false);
22387                return Err(common::Error::FieldClash(field));
22388            }
22389        }
22390
22391        let mut params = Params::with_capacity(6 + self._additional_params.len());
22392        params.push("merchantId", self._merchant_id.to_string());
22393        params.push("accountId", self._account_id.to_string());
22394        if let Some(value) = self._dry_run.as_ref() {
22395            params.push("dryRun", value.to_string());
22396        }
22397
22398        params.extend(self._additional_params.iter());
22399
22400        params.push("alt", "json");
22401        let mut url = self.hub._base_url.clone() + "{merchantId}/liasettings/{accountId}";
22402        if self._scopes.is_empty() {
22403            self._scopes.insert(Scope::Full.as_ref().to_string());
22404        }
22405
22406        #[allow(clippy::single_element_loop)]
22407        for &(find_this, param_name) in
22408            [("{merchantId}", "merchantId"), ("{accountId}", "accountId")].iter()
22409        {
22410            url = params.uri_replacement(url, param_name, find_this, false);
22411        }
22412        {
22413            let to_remove = ["accountId", "merchantId"];
22414            params.remove_params(&to_remove);
22415        }
22416
22417        let url = params.parse_with_url(&url);
22418
22419        let mut json_mime_type = mime::APPLICATION_JSON;
22420        let mut request_value_reader = {
22421            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22422            common::remove_json_null_values(&mut value);
22423            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22424            serde_json::to_writer(&mut dst, &value).unwrap();
22425            dst
22426        };
22427        let request_size = request_value_reader
22428            .seek(std::io::SeekFrom::End(0))
22429            .unwrap();
22430        request_value_reader
22431            .seek(std::io::SeekFrom::Start(0))
22432            .unwrap();
22433
22434        loop {
22435            let token = match self
22436                .hub
22437                .auth
22438                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22439                .await
22440            {
22441                Ok(token) => token,
22442                Err(e) => match dlg.token(e) {
22443                    Ok(token) => token,
22444                    Err(e) => {
22445                        dlg.finished(false);
22446                        return Err(common::Error::MissingToken(e));
22447                    }
22448                },
22449            };
22450            request_value_reader
22451                .seek(std::io::SeekFrom::Start(0))
22452                .unwrap();
22453            let mut req_result = {
22454                let client = &self.hub.client;
22455                dlg.pre_request();
22456                let mut req_builder = hyper::Request::builder()
22457                    .method(hyper::Method::PUT)
22458                    .uri(url.as_str())
22459                    .header(USER_AGENT, self.hub._user_agent.clone());
22460
22461                if let Some(token) = token.as_ref() {
22462                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22463                }
22464
22465                let request = req_builder
22466                    .header(CONTENT_TYPE, json_mime_type.to_string())
22467                    .header(CONTENT_LENGTH, request_size as u64)
22468                    .body(common::to_body(
22469                        request_value_reader.get_ref().clone().into(),
22470                    ));
22471
22472                client.request(request.unwrap()).await
22473            };
22474
22475            match req_result {
22476                Err(err) => {
22477                    if let common::Retry::After(d) = dlg.http_error(&err) {
22478                        sleep(d).await;
22479                        continue;
22480                    }
22481                    dlg.finished(false);
22482                    return Err(common::Error::HttpError(err));
22483                }
22484                Ok(res) => {
22485                    let (mut parts, body) = res.into_parts();
22486                    let mut body = common::Body::new(body);
22487                    if !parts.status.is_success() {
22488                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22489                        let error = serde_json::from_str(&common::to_string(&bytes));
22490                        let response = common::to_response(parts, bytes.into());
22491
22492                        if let common::Retry::After(d) =
22493                            dlg.http_failure(&response, error.as_ref().ok())
22494                        {
22495                            sleep(d).await;
22496                            continue;
22497                        }
22498
22499                        dlg.finished(false);
22500
22501                        return Err(match error {
22502                            Ok(value) => common::Error::BadRequest(value),
22503                            _ => common::Error::Failure(response),
22504                        });
22505                    }
22506                    let response = {
22507                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22508                        let encoded = common::to_string(&bytes);
22509                        match serde_json::from_str(&encoded) {
22510                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22511                            Err(error) => {
22512                                dlg.response_json_decode_error(&encoded, &error);
22513                                return Err(common::Error::JsonDecodeError(
22514                                    encoded.to_string(),
22515                                    error,
22516                                ));
22517                            }
22518                        }
22519                    };
22520
22521                    dlg.finished(true);
22522                    return Ok(response);
22523                }
22524            }
22525        }
22526    }
22527
22528    ///
22529    /// Sets the *request* property to the given value.
22530    ///
22531    /// Even though the property as already been set when instantiating this call,
22532    /// we provide this method for API completeness.
22533    pub fn request(mut self, new_value: LiaSettings) -> LiasettingUpdateCall<'a, C> {
22534        self._request = new_value;
22535        self
22536    }
22537    /// The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
22538    ///
22539    /// Sets the *merchant id* path property to the given value.
22540    ///
22541    /// Even though the property as already been set when instantiating this call,
22542    /// we provide this method for API completeness.
22543    pub fn merchant_id(mut self, new_value: u64) -> LiasettingUpdateCall<'a, C> {
22544        self._merchant_id = new_value;
22545        self
22546    }
22547    /// The ID of the account for which to get or update LIA settings.
22548    ///
22549    /// Sets the *account id* path property to the given value.
22550    ///
22551    /// Even though the property as already been set when instantiating this call,
22552    /// we provide this method for API completeness.
22553    pub fn account_id(mut self, new_value: u64) -> LiasettingUpdateCall<'a, C> {
22554        self._account_id = new_value;
22555        self
22556    }
22557    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
22558    ///
22559    /// Sets the *dry run* query property to the given value.
22560    pub fn dry_run(mut self, new_value: bool) -> LiasettingUpdateCall<'a, C> {
22561        self._dry_run = Some(new_value);
22562        self
22563    }
22564    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22565    /// while executing the actual API request.
22566    ///
22567    /// ````text
22568    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22569    /// ````
22570    ///
22571    /// Sets the *delegate* property to the given value.
22572    pub fn delegate(
22573        mut self,
22574        new_value: &'a mut dyn common::Delegate,
22575    ) -> LiasettingUpdateCall<'a, C> {
22576        self._delegate = Some(new_value);
22577        self
22578    }
22579
22580    /// Set any additional parameter of the query string used in the request.
22581    /// It should be used to set parameters which are not yet available through their own
22582    /// setters.
22583    ///
22584    /// Please note that this method must not be used to set any of the known parameters
22585    /// which have their own setter method. If done anyway, the request will fail.
22586    ///
22587    /// # Additional Parameters
22588    ///
22589    /// * *$.xgafv* (query-string) - V1 error format.
22590    /// * *access_token* (query-string) - OAuth access token.
22591    /// * *alt* (query-string) - Data format for response.
22592    /// * *callback* (query-string) - JSONP
22593    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22594    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22595    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22596    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22597    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22598    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22599    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22600    pub fn param<T>(mut self, name: T, value: T) -> LiasettingUpdateCall<'a, C>
22601    where
22602        T: AsRef<str>,
22603    {
22604        self._additional_params
22605            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22606        self
22607    }
22608
22609    /// Identifies the authorization scope for the method you are building.
22610    ///
22611    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22612    /// [`Scope::Full`].
22613    ///
22614    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22615    /// tokens for more than one scope.
22616    ///
22617    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22618    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22619    /// sufficient, a read-write scope will do as well.
22620    pub fn add_scope<St>(mut self, scope: St) -> LiasettingUpdateCall<'a, C>
22621    where
22622        St: AsRef<str>,
22623    {
22624        self._scopes.insert(String::from(scope.as_ref()));
22625        self
22626    }
22627    /// Identifies the authorization scope(s) for the method you are building.
22628    ///
22629    /// See [`Self::add_scope()`] for details.
22630    pub fn add_scopes<I, St>(mut self, scopes: I) -> LiasettingUpdateCall<'a, C>
22631    where
22632        I: IntoIterator<Item = St>,
22633        St: AsRef<str>,
22634    {
22635        self._scopes
22636            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22637        self
22638    }
22639
22640    /// Removes all scopes, and no default scope will be used either.
22641    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22642    /// for details).
22643    pub fn clear_scopes(mut self) -> LiasettingUpdateCall<'a, C> {
22644        self._scopes.clear();
22645        self
22646    }
22647}
22648
22649/// Creates a charge invoice for a shipment group, and triggers a charge capture for orderinvoice enabled orders.
22650///
22651/// A builder for the *createchargeinvoice* method supported by a *orderinvoice* resource.
22652/// It is not used directly, but through a [`OrderinvoiceMethods`] instance.
22653///
22654/// # Example
22655///
22656/// Instantiate a resource method builder
22657///
22658/// ```test_harness,no_run
22659/// # extern crate hyper;
22660/// # extern crate hyper_rustls;
22661/// # extern crate google_content2 as content2;
22662/// use content2::api::OrderinvoicesCreateChargeInvoiceRequest;
22663/// # async fn dox() {
22664/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22665///
22666/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22667/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22668/// #     .with_native_roots()
22669/// #     .unwrap()
22670/// #     .https_only()
22671/// #     .enable_http2()
22672/// #     .build();
22673///
22674/// # let executor = hyper_util::rt::TokioExecutor::new();
22675/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22676/// #     secret,
22677/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22678/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22679/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22680/// #     ),
22681/// # ).build().await.unwrap();
22682///
22683/// # let client = hyper_util::client::legacy::Client::builder(
22684/// #     hyper_util::rt::TokioExecutor::new()
22685/// # )
22686/// # .build(
22687/// #     hyper_rustls::HttpsConnectorBuilder::new()
22688/// #         .with_native_roots()
22689/// #         .unwrap()
22690/// #         .https_or_http()
22691/// #         .enable_http2()
22692/// #         .build()
22693/// # );
22694/// # let mut hub = ShoppingContent::new(client, auth);
22695/// // As the method needs a request, you would usually fill it with the desired information
22696/// // into the respective structure. Some of the parts shown here might not be applicable !
22697/// // Values shown here are possibly random and not representative !
22698/// let mut req = OrderinvoicesCreateChargeInvoiceRequest::default();
22699///
22700/// // You can configure optional parameters by calling the respective setters at will, and
22701/// // execute the final call using `doit()`.
22702/// // Values shown here are possibly random and not representative !
22703/// let result = hub.orderinvoices().createchargeinvoice(req, 54, "orderId")
22704///              .doit().await;
22705/// # }
22706/// ```
22707pub struct OrderinvoiceCreatechargeinvoiceCall<'a, C>
22708where
22709    C: 'a,
22710{
22711    hub: &'a ShoppingContent<C>,
22712    _request: OrderinvoicesCreateChargeInvoiceRequest,
22713    _merchant_id: u64,
22714    _order_id: String,
22715    _delegate: Option<&'a mut dyn common::Delegate>,
22716    _additional_params: HashMap<String, String>,
22717    _scopes: BTreeSet<String>,
22718}
22719
22720impl<'a, C> common::CallBuilder for OrderinvoiceCreatechargeinvoiceCall<'a, C> {}
22721
22722impl<'a, C> OrderinvoiceCreatechargeinvoiceCall<'a, C>
22723where
22724    C: common::Connector,
22725{
22726    /// Perform the operation you have build so far.
22727    pub async fn doit(
22728        mut self,
22729    ) -> common::Result<(common::Response, OrderinvoicesCreateChargeInvoiceResponse)> {
22730        use std::borrow::Cow;
22731        use std::io::{Read, Seek};
22732
22733        use common::{url::Params, ToParts};
22734        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22735
22736        let mut dd = common::DefaultDelegate;
22737        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22738        dlg.begin(common::MethodInfo {
22739            id: "content.orderinvoices.createchargeinvoice",
22740            http_method: hyper::Method::POST,
22741        });
22742
22743        for &field in ["alt", "merchantId", "orderId"].iter() {
22744            if self._additional_params.contains_key(field) {
22745                dlg.finished(false);
22746                return Err(common::Error::FieldClash(field));
22747            }
22748        }
22749
22750        let mut params = Params::with_capacity(5 + self._additional_params.len());
22751        params.push("merchantId", self._merchant_id.to_string());
22752        params.push("orderId", self._order_id);
22753
22754        params.extend(self._additional_params.iter());
22755
22756        params.push("alt", "json");
22757        let mut url =
22758            self.hub._base_url.clone() + "{merchantId}/orderinvoices/{orderId}/createChargeInvoice";
22759        if self._scopes.is_empty() {
22760            self._scopes.insert(Scope::Full.as_ref().to_string());
22761        }
22762
22763        #[allow(clippy::single_element_loop)]
22764        for &(find_this, param_name) in
22765            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
22766        {
22767            url = params.uri_replacement(url, param_name, find_this, false);
22768        }
22769        {
22770            let to_remove = ["orderId", "merchantId"];
22771            params.remove_params(&to_remove);
22772        }
22773
22774        let url = params.parse_with_url(&url);
22775
22776        let mut json_mime_type = mime::APPLICATION_JSON;
22777        let mut request_value_reader = {
22778            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22779            common::remove_json_null_values(&mut value);
22780            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22781            serde_json::to_writer(&mut dst, &value).unwrap();
22782            dst
22783        };
22784        let request_size = request_value_reader
22785            .seek(std::io::SeekFrom::End(0))
22786            .unwrap();
22787        request_value_reader
22788            .seek(std::io::SeekFrom::Start(0))
22789            .unwrap();
22790
22791        loop {
22792            let token = match self
22793                .hub
22794                .auth
22795                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22796                .await
22797            {
22798                Ok(token) => token,
22799                Err(e) => match dlg.token(e) {
22800                    Ok(token) => token,
22801                    Err(e) => {
22802                        dlg.finished(false);
22803                        return Err(common::Error::MissingToken(e));
22804                    }
22805                },
22806            };
22807            request_value_reader
22808                .seek(std::io::SeekFrom::Start(0))
22809                .unwrap();
22810            let mut req_result = {
22811                let client = &self.hub.client;
22812                dlg.pre_request();
22813                let mut req_builder = hyper::Request::builder()
22814                    .method(hyper::Method::POST)
22815                    .uri(url.as_str())
22816                    .header(USER_AGENT, self.hub._user_agent.clone());
22817
22818                if let Some(token) = token.as_ref() {
22819                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22820                }
22821
22822                let request = req_builder
22823                    .header(CONTENT_TYPE, json_mime_type.to_string())
22824                    .header(CONTENT_LENGTH, request_size as u64)
22825                    .body(common::to_body(
22826                        request_value_reader.get_ref().clone().into(),
22827                    ));
22828
22829                client.request(request.unwrap()).await
22830            };
22831
22832            match req_result {
22833                Err(err) => {
22834                    if let common::Retry::After(d) = dlg.http_error(&err) {
22835                        sleep(d).await;
22836                        continue;
22837                    }
22838                    dlg.finished(false);
22839                    return Err(common::Error::HttpError(err));
22840                }
22841                Ok(res) => {
22842                    let (mut parts, body) = res.into_parts();
22843                    let mut body = common::Body::new(body);
22844                    if !parts.status.is_success() {
22845                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22846                        let error = serde_json::from_str(&common::to_string(&bytes));
22847                        let response = common::to_response(parts, bytes.into());
22848
22849                        if let common::Retry::After(d) =
22850                            dlg.http_failure(&response, error.as_ref().ok())
22851                        {
22852                            sleep(d).await;
22853                            continue;
22854                        }
22855
22856                        dlg.finished(false);
22857
22858                        return Err(match error {
22859                            Ok(value) => common::Error::BadRequest(value),
22860                            _ => common::Error::Failure(response),
22861                        });
22862                    }
22863                    let response = {
22864                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22865                        let encoded = common::to_string(&bytes);
22866                        match serde_json::from_str(&encoded) {
22867                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22868                            Err(error) => {
22869                                dlg.response_json_decode_error(&encoded, &error);
22870                                return Err(common::Error::JsonDecodeError(
22871                                    encoded.to_string(),
22872                                    error,
22873                                ));
22874                            }
22875                        }
22876                    };
22877
22878                    dlg.finished(true);
22879                    return Ok(response);
22880                }
22881            }
22882        }
22883    }
22884
22885    ///
22886    /// Sets the *request* property to the given value.
22887    ///
22888    /// Even though the property as already been set when instantiating this call,
22889    /// we provide this method for API completeness.
22890    pub fn request(
22891        mut self,
22892        new_value: OrderinvoicesCreateChargeInvoiceRequest,
22893    ) -> OrderinvoiceCreatechargeinvoiceCall<'a, C> {
22894        self._request = new_value;
22895        self
22896    }
22897    /// The ID of the account that manages the order. This cannot be a multi-client account.
22898    ///
22899    /// Sets the *merchant id* path property to the given value.
22900    ///
22901    /// Even though the property as already been set when instantiating this call,
22902    /// we provide this method for API completeness.
22903    pub fn merchant_id(mut self, new_value: u64) -> OrderinvoiceCreatechargeinvoiceCall<'a, C> {
22904        self._merchant_id = new_value;
22905        self
22906    }
22907    /// The ID of the order.
22908    ///
22909    /// Sets the *order id* path property to the given value.
22910    ///
22911    /// Even though the property as already been set when instantiating this call,
22912    /// we provide this method for API completeness.
22913    pub fn order_id(mut self, new_value: &str) -> OrderinvoiceCreatechargeinvoiceCall<'a, C> {
22914        self._order_id = new_value.to_string();
22915        self
22916    }
22917    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22918    /// while executing the actual API request.
22919    ///
22920    /// ````text
22921    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22922    /// ````
22923    ///
22924    /// Sets the *delegate* property to the given value.
22925    pub fn delegate(
22926        mut self,
22927        new_value: &'a mut dyn common::Delegate,
22928    ) -> OrderinvoiceCreatechargeinvoiceCall<'a, C> {
22929        self._delegate = Some(new_value);
22930        self
22931    }
22932
22933    /// Set any additional parameter of the query string used in the request.
22934    /// It should be used to set parameters which are not yet available through their own
22935    /// setters.
22936    ///
22937    /// Please note that this method must not be used to set any of the known parameters
22938    /// which have their own setter method. If done anyway, the request will fail.
22939    ///
22940    /// # Additional Parameters
22941    ///
22942    /// * *$.xgafv* (query-string) - V1 error format.
22943    /// * *access_token* (query-string) - OAuth access token.
22944    /// * *alt* (query-string) - Data format for response.
22945    /// * *callback* (query-string) - JSONP
22946    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22947    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22948    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22949    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22950    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22951    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22952    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22953    pub fn param<T>(mut self, name: T, value: T) -> OrderinvoiceCreatechargeinvoiceCall<'a, C>
22954    where
22955        T: AsRef<str>,
22956    {
22957        self._additional_params
22958            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22959        self
22960    }
22961
22962    /// Identifies the authorization scope for the method you are building.
22963    ///
22964    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22965    /// [`Scope::Full`].
22966    ///
22967    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22968    /// tokens for more than one scope.
22969    ///
22970    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22971    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22972    /// sufficient, a read-write scope will do as well.
22973    pub fn add_scope<St>(mut self, scope: St) -> OrderinvoiceCreatechargeinvoiceCall<'a, C>
22974    where
22975        St: AsRef<str>,
22976    {
22977        self._scopes.insert(String::from(scope.as_ref()));
22978        self
22979    }
22980    /// Identifies the authorization scope(s) for the method you are building.
22981    ///
22982    /// See [`Self::add_scope()`] for details.
22983    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderinvoiceCreatechargeinvoiceCall<'a, C>
22984    where
22985        I: IntoIterator<Item = St>,
22986        St: AsRef<str>,
22987    {
22988        self._scopes
22989            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22990        self
22991    }
22992
22993    /// Removes all scopes, and no default scope will be used either.
22994    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22995    /// for details).
22996    pub fn clear_scopes(mut self) -> OrderinvoiceCreatechargeinvoiceCall<'a, C> {
22997        self._scopes.clear();
22998        self
22999    }
23000}
23001
23002/// Creates a refund invoice for one or more shipment groups, and triggers a refund for orderinvoice enabled orders. This can only be used for line items that have previously been charged using `createChargeInvoice`. All amounts (except for the summary) are incremental with respect to the previous invoice.
23003///
23004/// A builder for the *createrefundinvoice* method supported by a *orderinvoice* resource.
23005/// It is not used directly, but through a [`OrderinvoiceMethods`] instance.
23006///
23007/// # Example
23008///
23009/// Instantiate a resource method builder
23010///
23011/// ```test_harness,no_run
23012/// # extern crate hyper;
23013/// # extern crate hyper_rustls;
23014/// # extern crate google_content2 as content2;
23015/// use content2::api::OrderinvoicesCreateRefundInvoiceRequest;
23016/// # async fn dox() {
23017/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23018///
23019/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23020/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23021/// #     .with_native_roots()
23022/// #     .unwrap()
23023/// #     .https_only()
23024/// #     .enable_http2()
23025/// #     .build();
23026///
23027/// # let executor = hyper_util::rt::TokioExecutor::new();
23028/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23029/// #     secret,
23030/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23031/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23032/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23033/// #     ),
23034/// # ).build().await.unwrap();
23035///
23036/// # let client = hyper_util::client::legacy::Client::builder(
23037/// #     hyper_util::rt::TokioExecutor::new()
23038/// # )
23039/// # .build(
23040/// #     hyper_rustls::HttpsConnectorBuilder::new()
23041/// #         .with_native_roots()
23042/// #         .unwrap()
23043/// #         .https_or_http()
23044/// #         .enable_http2()
23045/// #         .build()
23046/// # );
23047/// # let mut hub = ShoppingContent::new(client, auth);
23048/// // As the method needs a request, you would usually fill it with the desired information
23049/// // into the respective structure. Some of the parts shown here might not be applicable !
23050/// // Values shown here are possibly random and not representative !
23051/// let mut req = OrderinvoicesCreateRefundInvoiceRequest::default();
23052///
23053/// // You can configure optional parameters by calling the respective setters at will, and
23054/// // execute the final call using `doit()`.
23055/// // Values shown here are possibly random and not representative !
23056/// let result = hub.orderinvoices().createrefundinvoice(req, 77, "orderId")
23057///              .doit().await;
23058/// # }
23059/// ```
23060pub struct OrderinvoiceCreaterefundinvoiceCall<'a, C>
23061where
23062    C: 'a,
23063{
23064    hub: &'a ShoppingContent<C>,
23065    _request: OrderinvoicesCreateRefundInvoiceRequest,
23066    _merchant_id: u64,
23067    _order_id: String,
23068    _delegate: Option<&'a mut dyn common::Delegate>,
23069    _additional_params: HashMap<String, String>,
23070    _scopes: BTreeSet<String>,
23071}
23072
23073impl<'a, C> common::CallBuilder for OrderinvoiceCreaterefundinvoiceCall<'a, C> {}
23074
23075impl<'a, C> OrderinvoiceCreaterefundinvoiceCall<'a, C>
23076where
23077    C: common::Connector,
23078{
23079    /// Perform the operation you have build so far.
23080    pub async fn doit(
23081        mut self,
23082    ) -> common::Result<(common::Response, OrderinvoicesCreateRefundInvoiceResponse)> {
23083        use std::borrow::Cow;
23084        use std::io::{Read, Seek};
23085
23086        use common::{url::Params, ToParts};
23087        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23088
23089        let mut dd = common::DefaultDelegate;
23090        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23091        dlg.begin(common::MethodInfo {
23092            id: "content.orderinvoices.createrefundinvoice",
23093            http_method: hyper::Method::POST,
23094        });
23095
23096        for &field in ["alt", "merchantId", "orderId"].iter() {
23097            if self._additional_params.contains_key(field) {
23098                dlg.finished(false);
23099                return Err(common::Error::FieldClash(field));
23100            }
23101        }
23102
23103        let mut params = Params::with_capacity(5 + self._additional_params.len());
23104        params.push("merchantId", self._merchant_id.to_string());
23105        params.push("orderId", self._order_id);
23106
23107        params.extend(self._additional_params.iter());
23108
23109        params.push("alt", "json");
23110        let mut url =
23111            self.hub._base_url.clone() + "{merchantId}/orderinvoices/{orderId}/createRefundInvoice";
23112        if self._scopes.is_empty() {
23113            self._scopes.insert(Scope::Full.as_ref().to_string());
23114        }
23115
23116        #[allow(clippy::single_element_loop)]
23117        for &(find_this, param_name) in
23118            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
23119        {
23120            url = params.uri_replacement(url, param_name, find_this, false);
23121        }
23122        {
23123            let to_remove = ["orderId", "merchantId"];
23124            params.remove_params(&to_remove);
23125        }
23126
23127        let url = params.parse_with_url(&url);
23128
23129        let mut json_mime_type = mime::APPLICATION_JSON;
23130        let mut request_value_reader = {
23131            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23132            common::remove_json_null_values(&mut value);
23133            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23134            serde_json::to_writer(&mut dst, &value).unwrap();
23135            dst
23136        };
23137        let request_size = request_value_reader
23138            .seek(std::io::SeekFrom::End(0))
23139            .unwrap();
23140        request_value_reader
23141            .seek(std::io::SeekFrom::Start(0))
23142            .unwrap();
23143
23144        loop {
23145            let token = match self
23146                .hub
23147                .auth
23148                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23149                .await
23150            {
23151                Ok(token) => token,
23152                Err(e) => match dlg.token(e) {
23153                    Ok(token) => token,
23154                    Err(e) => {
23155                        dlg.finished(false);
23156                        return Err(common::Error::MissingToken(e));
23157                    }
23158                },
23159            };
23160            request_value_reader
23161                .seek(std::io::SeekFrom::Start(0))
23162                .unwrap();
23163            let mut req_result = {
23164                let client = &self.hub.client;
23165                dlg.pre_request();
23166                let mut req_builder = hyper::Request::builder()
23167                    .method(hyper::Method::POST)
23168                    .uri(url.as_str())
23169                    .header(USER_AGENT, self.hub._user_agent.clone());
23170
23171                if let Some(token) = token.as_ref() {
23172                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23173                }
23174
23175                let request = req_builder
23176                    .header(CONTENT_TYPE, json_mime_type.to_string())
23177                    .header(CONTENT_LENGTH, request_size as u64)
23178                    .body(common::to_body(
23179                        request_value_reader.get_ref().clone().into(),
23180                    ));
23181
23182                client.request(request.unwrap()).await
23183            };
23184
23185            match req_result {
23186                Err(err) => {
23187                    if let common::Retry::After(d) = dlg.http_error(&err) {
23188                        sleep(d).await;
23189                        continue;
23190                    }
23191                    dlg.finished(false);
23192                    return Err(common::Error::HttpError(err));
23193                }
23194                Ok(res) => {
23195                    let (mut parts, body) = res.into_parts();
23196                    let mut body = common::Body::new(body);
23197                    if !parts.status.is_success() {
23198                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23199                        let error = serde_json::from_str(&common::to_string(&bytes));
23200                        let response = common::to_response(parts, bytes.into());
23201
23202                        if let common::Retry::After(d) =
23203                            dlg.http_failure(&response, error.as_ref().ok())
23204                        {
23205                            sleep(d).await;
23206                            continue;
23207                        }
23208
23209                        dlg.finished(false);
23210
23211                        return Err(match error {
23212                            Ok(value) => common::Error::BadRequest(value),
23213                            _ => common::Error::Failure(response),
23214                        });
23215                    }
23216                    let response = {
23217                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23218                        let encoded = common::to_string(&bytes);
23219                        match serde_json::from_str(&encoded) {
23220                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23221                            Err(error) => {
23222                                dlg.response_json_decode_error(&encoded, &error);
23223                                return Err(common::Error::JsonDecodeError(
23224                                    encoded.to_string(),
23225                                    error,
23226                                ));
23227                            }
23228                        }
23229                    };
23230
23231                    dlg.finished(true);
23232                    return Ok(response);
23233                }
23234            }
23235        }
23236    }
23237
23238    ///
23239    /// Sets the *request* property to the given value.
23240    ///
23241    /// Even though the property as already been set when instantiating this call,
23242    /// we provide this method for API completeness.
23243    pub fn request(
23244        mut self,
23245        new_value: OrderinvoicesCreateRefundInvoiceRequest,
23246    ) -> OrderinvoiceCreaterefundinvoiceCall<'a, C> {
23247        self._request = new_value;
23248        self
23249    }
23250    /// The ID of the account that manages the order. This cannot be a multi-client account.
23251    ///
23252    /// Sets the *merchant id* path property to the given value.
23253    ///
23254    /// Even though the property as already been set when instantiating this call,
23255    /// we provide this method for API completeness.
23256    pub fn merchant_id(mut self, new_value: u64) -> OrderinvoiceCreaterefundinvoiceCall<'a, C> {
23257        self._merchant_id = new_value;
23258        self
23259    }
23260    /// The ID of the order.
23261    ///
23262    /// Sets the *order id* path property to the given value.
23263    ///
23264    /// Even though the property as already been set when instantiating this call,
23265    /// we provide this method for API completeness.
23266    pub fn order_id(mut self, new_value: &str) -> OrderinvoiceCreaterefundinvoiceCall<'a, C> {
23267        self._order_id = new_value.to_string();
23268        self
23269    }
23270    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23271    /// while executing the actual API request.
23272    ///
23273    /// ````text
23274    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23275    /// ````
23276    ///
23277    /// Sets the *delegate* property to the given value.
23278    pub fn delegate(
23279        mut self,
23280        new_value: &'a mut dyn common::Delegate,
23281    ) -> OrderinvoiceCreaterefundinvoiceCall<'a, C> {
23282        self._delegate = Some(new_value);
23283        self
23284    }
23285
23286    /// Set any additional parameter of the query string used in the request.
23287    /// It should be used to set parameters which are not yet available through their own
23288    /// setters.
23289    ///
23290    /// Please note that this method must not be used to set any of the known parameters
23291    /// which have their own setter method. If done anyway, the request will fail.
23292    ///
23293    /// # Additional Parameters
23294    ///
23295    /// * *$.xgafv* (query-string) - V1 error format.
23296    /// * *access_token* (query-string) - OAuth access token.
23297    /// * *alt* (query-string) - Data format for response.
23298    /// * *callback* (query-string) - JSONP
23299    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23300    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23301    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23302    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23303    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23304    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23305    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23306    pub fn param<T>(mut self, name: T, value: T) -> OrderinvoiceCreaterefundinvoiceCall<'a, C>
23307    where
23308        T: AsRef<str>,
23309    {
23310        self._additional_params
23311            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23312        self
23313    }
23314
23315    /// Identifies the authorization scope for the method you are building.
23316    ///
23317    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23318    /// [`Scope::Full`].
23319    ///
23320    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23321    /// tokens for more than one scope.
23322    ///
23323    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23324    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23325    /// sufficient, a read-write scope will do as well.
23326    pub fn add_scope<St>(mut self, scope: St) -> OrderinvoiceCreaterefundinvoiceCall<'a, C>
23327    where
23328        St: AsRef<str>,
23329    {
23330        self._scopes.insert(String::from(scope.as_ref()));
23331        self
23332    }
23333    /// Identifies the authorization scope(s) for the method you are building.
23334    ///
23335    /// See [`Self::add_scope()`] for details.
23336    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderinvoiceCreaterefundinvoiceCall<'a, C>
23337    where
23338        I: IntoIterator<Item = St>,
23339        St: AsRef<str>,
23340    {
23341        self._scopes
23342            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23343        self
23344    }
23345
23346    /// Removes all scopes, and no default scope will be used either.
23347    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23348    /// for details).
23349    pub fn clear_scopes(mut self) -> OrderinvoiceCreaterefundinvoiceCall<'a, C> {
23350        self._scopes.clear();
23351        self
23352    }
23353}
23354
23355/// Retrieves a report for disbursements from your Merchant Center account.
23356///
23357/// A builder for the *listdisbursements* method supported by a *orderreport* resource.
23358/// It is not used directly, but through a [`OrderreportMethods`] instance.
23359///
23360/// # Example
23361///
23362/// Instantiate a resource method builder
23363///
23364/// ```test_harness,no_run
23365/// # extern crate hyper;
23366/// # extern crate hyper_rustls;
23367/// # extern crate google_content2 as content2;
23368/// # async fn dox() {
23369/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23370///
23371/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23372/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23373/// #     .with_native_roots()
23374/// #     .unwrap()
23375/// #     .https_only()
23376/// #     .enable_http2()
23377/// #     .build();
23378///
23379/// # let executor = hyper_util::rt::TokioExecutor::new();
23380/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23381/// #     secret,
23382/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23383/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23384/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23385/// #     ),
23386/// # ).build().await.unwrap();
23387///
23388/// # let client = hyper_util::client::legacy::Client::builder(
23389/// #     hyper_util::rt::TokioExecutor::new()
23390/// # )
23391/// # .build(
23392/// #     hyper_rustls::HttpsConnectorBuilder::new()
23393/// #         .with_native_roots()
23394/// #         .unwrap()
23395/// #         .https_or_http()
23396/// #         .enable_http2()
23397/// #         .build()
23398/// # );
23399/// # let mut hub = ShoppingContent::new(client, auth);
23400/// // You can configure optional parameters by calling the respective setters at will, and
23401/// // execute the final call using `doit()`.
23402/// // Values shown here are possibly random and not representative !
23403/// let result = hub.orderreports().listdisbursements(5)
23404///              .page_token("consetetur")
23405///              .max_results(36)
23406///              .disbursement_start_date("est")
23407///              .disbursement_end_date("aliquyam")
23408///              .doit().await;
23409/// # }
23410/// ```
23411pub struct OrderreportListdisbursementCall<'a, C>
23412where
23413    C: 'a,
23414{
23415    hub: &'a ShoppingContent<C>,
23416    _merchant_id: u64,
23417    _page_token: Option<String>,
23418    _max_results: Option<u32>,
23419    _disbursement_start_date: Option<String>,
23420    _disbursement_end_date: Option<String>,
23421    _delegate: Option<&'a mut dyn common::Delegate>,
23422    _additional_params: HashMap<String, String>,
23423    _scopes: BTreeSet<String>,
23424}
23425
23426impl<'a, C> common::CallBuilder for OrderreportListdisbursementCall<'a, C> {}
23427
23428impl<'a, C> OrderreportListdisbursementCall<'a, C>
23429where
23430    C: common::Connector,
23431{
23432    /// Perform the operation you have build so far.
23433    pub async fn doit(
23434        mut self,
23435    ) -> common::Result<(common::Response, OrderreportsListDisbursementsResponse)> {
23436        use std::borrow::Cow;
23437        use std::io::{Read, Seek};
23438
23439        use common::{url::Params, ToParts};
23440        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23441
23442        let mut dd = common::DefaultDelegate;
23443        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23444        dlg.begin(common::MethodInfo {
23445            id: "content.orderreports.listdisbursements",
23446            http_method: hyper::Method::GET,
23447        });
23448
23449        for &field in [
23450            "alt",
23451            "merchantId",
23452            "pageToken",
23453            "maxResults",
23454            "disbursementStartDate",
23455            "disbursementEndDate",
23456        ]
23457        .iter()
23458        {
23459            if self._additional_params.contains_key(field) {
23460                dlg.finished(false);
23461                return Err(common::Error::FieldClash(field));
23462            }
23463        }
23464
23465        let mut params = Params::with_capacity(7 + self._additional_params.len());
23466        params.push("merchantId", self._merchant_id.to_string());
23467        if let Some(value) = self._page_token.as_ref() {
23468            params.push("pageToken", value);
23469        }
23470        if let Some(value) = self._max_results.as_ref() {
23471            params.push("maxResults", value.to_string());
23472        }
23473        if let Some(value) = self._disbursement_start_date.as_ref() {
23474            params.push("disbursementStartDate", value);
23475        }
23476        if let Some(value) = self._disbursement_end_date.as_ref() {
23477            params.push("disbursementEndDate", value);
23478        }
23479
23480        params.extend(self._additional_params.iter());
23481
23482        params.push("alt", "json");
23483        let mut url = self.hub._base_url.clone() + "{merchantId}/orderreports/disbursements";
23484        if self._scopes.is_empty() {
23485            self._scopes.insert(Scope::Full.as_ref().to_string());
23486        }
23487
23488        #[allow(clippy::single_element_loop)]
23489        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
23490            url = params.uri_replacement(url, param_name, find_this, false);
23491        }
23492        {
23493            let to_remove = ["merchantId"];
23494            params.remove_params(&to_remove);
23495        }
23496
23497        let url = params.parse_with_url(&url);
23498
23499        loop {
23500            let token = match self
23501                .hub
23502                .auth
23503                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23504                .await
23505            {
23506                Ok(token) => token,
23507                Err(e) => match dlg.token(e) {
23508                    Ok(token) => token,
23509                    Err(e) => {
23510                        dlg.finished(false);
23511                        return Err(common::Error::MissingToken(e));
23512                    }
23513                },
23514            };
23515            let mut req_result = {
23516                let client = &self.hub.client;
23517                dlg.pre_request();
23518                let mut req_builder = hyper::Request::builder()
23519                    .method(hyper::Method::GET)
23520                    .uri(url.as_str())
23521                    .header(USER_AGENT, self.hub._user_agent.clone());
23522
23523                if let Some(token) = token.as_ref() {
23524                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23525                }
23526
23527                let request = req_builder
23528                    .header(CONTENT_LENGTH, 0_u64)
23529                    .body(common::to_body::<String>(None));
23530
23531                client.request(request.unwrap()).await
23532            };
23533
23534            match req_result {
23535                Err(err) => {
23536                    if let common::Retry::After(d) = dlg.http_error(&err) {
23537                        sleep(d).await;
23538                        continue;
23539                    }
23540                    dlg.finished(false);
23541                    return Err(common::Error::HttpError(err));
23542                }
23543                Ok(res) => {
23544                    let (mut parts, body) = res.into_parts();
23545                    let mut body = common::Body::new(body);
23546                    if !parts.status.is_success() {
23547                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23548                        let error = serde_json::from_str(&common::to_string(&bytes));
23549                        let response = common::to_response(parts, bytes.into());
23550
23551                        if let common::Retry::After(d) =
23552                            dlg.http_failure(&response, error.as_ref().ok())
23553                        {
23554                            sleep(d).await;
23555                            continue;
23556                        }
23557
23558                        dlg.finished(false);
23559
23560                        return Err(match error {
23561                            Ok(value) => common::Error::BadRequest(value),
23562                            _ => common::Error::Failure(response),
23563                        });
23564                    }
23565                    let response = {
23566                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23567                        let encoded = common::to_string(&bytes);
23568                        match serde_json::from_str(&encoded) {
23569                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23570                            Err(error) => {
23571                                dlg.response_json_decode_error(&encoded, &error);
23572                                return Err(common::Error::JsonDecodeError(
23573                                    encoded.to_string(),
23574                                    error,
23575                                ));
23576                            }
23577                        }
23578                    };
23579
23580                    dlg.finished(true);
23581                    return Ok(response);
23582                }
23583            }
23584        }
23585    }
23586
23587    /// The ID of the account that manages the order. This cannot be a multi-client account.
23588    ///
23589    /// Sets the *merchant id* path property to the given value.
23590    ///
23591    /// Even though the property as already been set when instantiating this call,
23592    /// we provide this method for API completeness.
23593    pub fn merchant_id(mut self, new_value: u64) -> OrderreportListdisbursementCall<'a, C> {
23594        self._merchant_id = new_value;
23595        self
23596    }
23597    /// The token returned by the previous request.
23598    ///
23599    /// Sets the *page token* query property to the given value.
23600    pub fn page_token(mut self, new_value: &str) -> OrderreportListdisbursementCall<'a, C> {
23601        self._page_token = Some(new_value.to_string());
23602        self
23603    }
23604    /// The maximum number of disbursements to return in the response, used for paging.
23605    ///
23606    /// Sets the *max results* query property to the given value.
23607    pub fn max_results(mut self, new_value: u32) -> OrderreportListdisbursementCall<'a, C> {
23608        self._max_results = Some(new_value);
23609        self
23610    }
23611    /// The first date which disbursements occurred. In ISO 8601 format.
23612    ///
23613    /// Sets the *disbursement start date* query property to the given value.
23614    pub fn disbursement_start_date(
23615        mut self,
23616        new_value: &str,
23617    ) -> OrderreportListdisbursementCall<'a, C> {
23618        self._disbursement_start_date = Some(new_value.to_string());
23619        self
23620    }
23621    /// The last date which disbursements occurred. In ISO 8601 format. Default: current date.
23622    ///
23623    /// Sets the *disbursement end date* query property to the given value.
23624    pub fn disbursement_end_date(
23625        mut self,
23626        new_value: &str,
23627    ) -> OrderreportListdisbursementCall<'a, C> {
23628        self._disbursement_end_date = Some(new_value.to_string());
23629        self
23630    }
23631    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23632    /// while executing the actual API request.
23633    ///
23634    /// ````text
23635    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23636    /// ````
23637    ///
23638    /// Sets the *delegate* property to the given value.
23639    pub fn delegate(
23640        mut self,
23641        new_value: &'a mut dyn common::Delegate,
23642    ) -> OrderreportListdisbursementCall<'a, C> {
23643        self._delegate = Some(new_value);
23644        self
23645    }
23646
23647    /// Set any additional parameter of the query string used in the request.
23648    /// It should be used to set parameters which are not yet available through their own
23649    /// setters.
23650    ///
23651    /// Please note that this method must not be used to set any of the known parameters
23652    /// which have their own setter method. If done anyway, the request will fail.
23653    ///
23654    /// # Additional Parameters
23655    ///
23656    /// * *$.xgafv* (query-string) - V1 error format.
23657    /// * *access_token* (query-string) - OAuth access token.
23658    /// * *alt* (query-string) - Data format for response.
23659    /// * *callback* (query-string) - JSONP
23660    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23661    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23662    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23663    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23664    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23665    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23666    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23667    pub fn param<T>(mut self, name: T, value: T) -> OrderreportListdisbursementCall<'a, C>
23668    where
23669        T: AsRef<str>,
23670    {
23671        self._additional_params
23672            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23673        self
23674    }
23675
23676    /// Identifies the authorization scope for the method you are building.
23677    ///
23678    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23679    /// [`Scope::Full`].
23680    ///
23681    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23682    /// tokens for more than one scope.
23683    ///
23684    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23685    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23686    /// sufficient, a read-write scope will do as well.
23687    pub fn add_scope<St>(mut self, scope: St) -> OrderreportListdisbursementCall<'a, C>
23688    where
23689        St: AsRef<str>,
23690    {
23691        self._scopes.insert(String::from(scope.as_ref()));
23692        self
23693    }
23694    /// Identifies the authorization scope(s) for the method you are building.
23695    ///
23696    /// See [`Self::add_scope()`] for details.
23697    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderreportListdisbursementCall<'a, C>
23698    where
23699        I: IntoIterator<Item = St>,
23700        St: AsRef<str>,
23701    {
23702        self._scopes
23703            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23704        self
23705    }
23706
23707    /// Removes all scopes, and no default scope will be used either.
23708    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23709    /// for details).
23710    pub fn clear_scopes(mut self) -> OrderreportListdisbursementCall<'a, C> {
23711        self._scopes.clear();
23712        self
23713    }
23714}
23715
23716/// Retrieves a list of transactions for a disbursement from your Merchant Center account.
23717///
23718/// A builder for the *listtransactions* method supported by a *orderreport* resource.
23719/// It is not used directly, but through a [`OrderreportMethods`] instance.
23720///
23721/// # Example
23722///
23723/// Instantiate a resource method builder
23724///
23725/// ```test_harness,no_run
23726/// # extern crate hyper;
23727/// # extern crate hyper_rustls;
23728/// # extern crate google_content2 as content2;
23729/// # async fn dox() {
23730/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23731///
23732/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23733/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23734/// #     .with_native_roots()
23735/// #     .unwrap()
23736/// #     .https_only()
23737/// #     .enable_http2()
23738/// #     .build();
23739///
23740/// # let executor = hyper_util::rt::TokioExecutor::new();
23741/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23742/// #     secret,
23743/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23744/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23745/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23746/// #     ),
23747/// # ).build().await.unwrap();
23748///
23749/// # let client = hyper_util::client::legacy::Client::builder(
23750/// #     hyper_util::rt::TokioExecutor::new()
23751/// # )
23752/// # .build(
23753/// #     hyper_rustls::HttpsConnectorBuilder::new()
23754/// #         .with_native_roots()
23755/// #         .unwrap()
23756/// #         .https_or_http()
23757/// #         .enable_http2()
23758/// #         .build()
23759/// # );
23760/// # let mut hub = ShoppingContent::new(client, auth);
23761/// // You can configure optional parameters by calling the respective setters at will, and
23762/// // execute the final call using `doit()`.
23763/// // Values shown here are possibly random and not representative !
23764/// let result = hub.orderreports().listtransactions(7, "disbursementId")
23765///              .transaction_start_date("diam")
23766///              .transaction_end_date("est")
23767///              .page_token("sit")
23768///              .max_results(8)
23769///              .doit().await;
23770/// # }
23771/// ```
23772pub struct OrderreportListtransactionCall<'a, C>
23773where
23774    C: 'a,
23775{
23776    hub: &'a ShoppingContent<C>,
23777    _merchant_id: u64,
23778    _disbursement_id: String,
23779    _transaction_start_date: Option<String>,
23780    _transaction_end_date: Option<String>,
23781    _page_token: Option<String>,
23782    _max_results: Option<u32>,
23783    _delegate: Option<&'a mut dyn common::Delegate>,
23784    _additional_params: HashMap<String, String>,
23785    _scopes: BTreeSet<String>,
23786}
23787
23788impl<'a, C> common::CallBuilder for OrderreportListtransactionCall<'a, C> {}
23789
23790impl<'a, C> OrderreportListtransactionCall<'a, C>
23791where
23792    C: common::Connector,
23793{
23794    /// Perform the operation you have build so far.
23795    pub async fn doit(
23796        mut self,
23797    ) -> common::Result<(common::Response, OrderreportsListTransactionsResponse)> {
23798        use std::borrow::Cow;
23799        use std::io::{Read, Seek};
23800
23801        use common::{url::Params, ToParts};
23802        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23803
23804        let mut dd = common::DefaultDelegate;
23805        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23806        dlg.begin(common::MethodInfo {
23807            id: "content.orderreports.listtransactions",
23808            http_method: hyper::Method::GET,
23809        });
23810
23811        for &field in [
23812            "alt",
23813            "merchantId",
23814            "disbursementId",
23815            "transactionStartDate",
23816            "transactionEndDate",
23817            "pageToken",
23818            "maxResults",
23819        ]
23820        .iter()
23821        {
23822            if self._additional_params.contains_key(field) {
23823                dlg.finished(false);
23824                return Err(common::Error::FieldClash(field));
23825            }
23826        }
23827
23828        let mut params = Params::with_capacity(8 + self._additional_params.len());
23829        params.push("merchantId", self._merchant_id.to_string());
23830        params.push("disbursementId", self._disbursement_id);
23831        if let Some(value) = self._transaction_start_date.as_ref() {
23832            params.push("transactionStartDate", value);
23833        }
23834        if let Some(value) = self._transaction_end_date.as_ref() {
23835            params.push("transactionEndDate", value);
23836        }
23837        if let Some(value) = self._page_token.as_ref() {
23838            params.push("pageToken", value);
23839        }
23840        if let Some(value) = self._max_results.as_ref() {
23841            params.push("maxResults", value.to_string());
23842        }
23843
23844        params.extend(self._additional_params.iter());
23845
23846        params.push("alt", "json");
23847        let mut url = self.hub._base_url.clone()
23848            + "{merchantId}/orderreports/disbursements/{disbursementId}/transactions";
23849        if self._scopes.is_empty() {
23850            self._scopes.insert(Scope::Full.as_ref().to_string());
23851        }
23852
23853        #[allow(clippy::single_element_loop)]
23854        for &(find_this, param_name) in [
23855            ("{merchantId}", "merchantId"),
23856            ("{disbursementId}", "disbursementId"),
23857        ]
23858        .iter()
23859        {
23860            url = params.uri_replacement(url, param_name, find_this, false);
23861        }
23862        {
23863            let to_remove = ["disbursementId", "merchantId"];
23864            params.remove_params(&to_remove);
23865        }
23866
23867        let url = params.parse_with_url(&url);
23868
23869        loop {
23870            let token = match self
23871                .hub
23872                .auth
23873                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23874                .await
23875            {
23876                Ok(token) => token,
23877                Err(e) => match dlg.token(e) {
23878                    Ok(token) => token,
23879                    Err(e) => {
23880                        dlg.finished(false);
23881                        return Err(common::Error::MissingToken(e));
23882                    }
23883                },
23884            };
23885            let mut req_result = {
23886                let client = &self.hub.client;
23887                dlg.pre_request();
23888                let mut req_builder = hyper::Request::builder()
23889                    .method(hyper::Method::GET)
23890                    .uri(url.as_str())
23891                    .header(USER_AGENT, self.hub._user_agent.clone());
23892
23893                if let Some(token) = token.as_ref() {
23894                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23895                }
23896
23897                let request = req_builder
23898                    .header(CONTENT_LENGTH, 0_u64)
23899                    .body(common::to_body::<String>(None));
23900
23901                client.request(request.unwrap()).await
23902            };
23903
23904            match req_result {
23905                Err(err) => {
23906                    if let common::Retry::After(d) = dlg.http_error(&err) {
23907                        sleep(d).await;
23908                        continue;
23909                    }
23910                    dlg.finished(false);
23911                    return Err(common::Error::HttpError(err));
23912                }
23913                Ok(res) => {
23914                    let (mut parts, body) = res.into_parts();
23915                    let mut body = common::Body::new(body);
23916                    if !parts.status.is_success() {
23917                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23918                        let error = serde_json::from_str(&common::to_string(&bytes));
23919                        let response = common::to_response(parts, bytes.into());
23920
23921                        if let common::Retry::After(d) =
23922                            dlg.http_failure(&response, error.as_ref().ok())
23923                        {
23924                            sleep(d).await;
23925                            continue;
23926                        }
23927
23928                        dlg.finished(false);
23929
23930                        return Err(match error {
23931                            Ok(value) => common::Error::BadRequest(value),
23932                            _ => common::Error::Failure(response),
23933                        });
23934                    }
23935                    let response = {
23936                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23937                        let encoded = common::to_string(&bytes);
23938                        match serde_json::from_str(&encoded) {
23939                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23940                            Err(error) => {
23941                                dlg.response_json_decode_error(&encoded, &error);
23942                                return Err(common::Error::JsonDecodeError(
23943                                    encoded.to_string(),
23944                                    error,
23945                                ));
23946                            }
23947                        }
23948                    };
23949
23950                    dlg.finished(true);
23951                    return Ok(response);
23952                }
23953            }
23954        }
23955    }
23956
23957    /// The ID of the account that manages the order. This cannot be a multi-client account.
23958    ///
23959    /// Sets the *merchant id* path property to the given value.
23960    ///
23961    /// Even though the property as already been set when instantiating this call,
23962    /// we provide this method for API completeness.
23963    pub fn merchant_id(mut self, new_value: u64) -> OrderreportListtransactionCall<'a, C> {
23964        self._merchant_id = new_value;
23965        self
23966    }
23967    /// The Google-provided ID of the disbursement (found in Wallet).
23968    ///
23969    /// Sets the *disbursement id* path property to the given value.
23970    ///
23971    /// Even though the property as already been set when instantiating this call,
23972    /// we provide this method for API completeness.
23973    pub fn disbursement_id(mut self, new_value: &str) -> OrderreportListtransactionCall<'a, C> {
23974        self._disbursement_id = new_value.to_string();
23975        self
23976    }
23977    /// The first date in which transaction occurred. In ISO 8601 format.
23978    ///
23979    /// Sets the *transaction start date* query property to the given value.
23980    pub fn transaction_start_date(
23981        mut self,
23982        new_value: &str,
23983    ) -> OrderreportListtransactionCall<'a, C> {
23984        self._transaction_start_date = Some(new_value.to_string());
23985        self
23986    }
23987    /// The last date in which transaction occurred. In ISO 8601 format. Default: current date.
23988    ///
23989    /// Sets the *transaction end date* query property to the given value.
23990    pub fn transaction_end_date(
23991        mut self,
23992        new_value: &str,
23993    ) -> OrderreportListtransactionCall<'a, C> {
23994        self._transaction_end_date = Some(new_value.to_string());
23995        self
23996    }
23997    /// The token returned by the previous request.
23998    ///
23999    /// Sets the *page token* query property to the given value.
24000    pub fn page_token(mut self, new_value: &str) -> OrderreportListtransactionCall<'a, C> {
24001        self._page_token = Some(new_value.to_string());
24002        self
24003    }
24004    /// The maximum number of disbursements to return in the response, used for paging.
24005    ///
24006    /// Sets the *max results* query property to the given value.
24007    pub fn max_results(mut self, new_value: u32) -> OrderreportListtransactionCall<'a, C> {
24008        self._max_results = Some(new_value);
24009        self
24010    }
24011    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24012    /// while executing the actual API request.
24013    ///
24014    /// ````text
24015    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24016    /// ````
24017    ///
24018    /// Sets the *delegate* property to the given value.
24019    pub fn delegate(
24020        mut self,
24021        new_value: &'a mut dyn common::Delegate,
24022    ) -> OrderreportListtransactionCall<'a, C> {
24023        self._delegate = Some(new_value);
24024        self
24025    }
24026
24027    /// Set any additional parameter of the query string used in the request.
24028    /// It should be used to set parameters which are not yet available through their own
24029    /// setters.
24030    ///
24031    /// Please note that this method must not be used to set any of the known parameters
24032    /// which have their own setter method. If done anyway, the request will fail.
24033    ///
24034    /// # Additional Parameters
24035    ///
24036    /// * *$.xgafv* (query-string) - V1 error format.
24037    /// * *access_token* (query-string) - OAuth access token.
24038    /// * *alt* (query-string) - Data format for response.
24039    /// * *callback* (query-string) - JSONP
24040    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24041    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24042    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24043    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24044    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24045    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24046    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24047    pub fn param<T>(mut self, name: T, value: T) -> OrderreportListtransactionCall<'a, C>
24048    where
24049        T: AsRef<str>,
24050    {
24051        self._additional_params
24052            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24053        self
24054    }
24055
24056    /// Identifies the authorization scope for the method you are building.
24057    ///
24058    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24059    /// [`Scope::Full`].
24060    ///
24061    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24062    /// tokens for more than one scope.
24063    ///
24064    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24065    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24066    /// sufficient, a read-write scope will do as well.
24067    pub fn add_scope<St>(mut self, scope: St) -> OrderreportListtransactionCall<'a, C>
24068    where
24069        St: AsRef<str>,
24070    {
24071        self._scopes.insert(String::from(scope.as_ref()));
24072        self
24073    }
24074    /// Identifies the authorization scope(s) for the method you are building.
24075    ///
24076    /// See [`Self::add_scope()`] for details.
24077    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderreportListtransactionCall<'a, C>
24078    where
24079        I: IntoIterator<Item = St>,
24080        St: AsRef<str>,
24081    {
24082        self._scopes
24083            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24084        self
24085    }
24086
24087    /// Removes all scopes, and no default scope will be used either.
24088    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24089    /// for details).
24090    pub fn clear_scopes(mut self) -> OrderreportListtransactionCall<'a, C> {
24091        self._scopes.clear();
24092        self
24093    }
24094}
24095
24096/// Retrieves an order return from your Merchant Center account.
24097///
24098/// A builder for the *get* method supported by a *orderreturn* resource.
24099/// It is not used directly, but through a [`OrderreturnMethods`] instance.
24100///
24101/// # Example
24102///
24103/// Instantiate a resource method builder
24104///
24105/// ```test_harness,no_run
24106/// # extern crate hyper;
24107/// # extern crate hyper_rustls;
24108/// # extern crate google_content2 as content2;
24109/// # async fn dox() {
24110/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24111///
24112/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24113/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24114/// #     .with_native_roots()
24115/// #     .unwrap()
24116/// #     .https_only()
24117/// #     .enable_http2()
24118/// #     .build();
24119///
24120/// # let executor = hyper_util::rt::TokioExecutor::new();
24121/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24122/// #     secret,
24123/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24124/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
24125/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
24126/// #     ),
24127/// # ).build().await.unwrap();
24128///
24129/// # let client = hyper_util::client::legacy::Client::builder(
24130/// #     hyper_util::rt::TokioExecutor::new()
24131/// # )
24132/// # .build(
24133/// #     hyper_rustls::HttpsConnectorBuilder::new()
24134/// #         .with_native_roots()
24135/// #         .unwrap()
24136/// #         .https_or_http()
24137/// #         .enable_http2()
24138/// #         .build()
24139/// # );
24140/// # let mut hub = ShoppingContent::new(client, auth);
24141/// // You can configure optional parameters by calling the respective setters at will, and
24142/// // execute the final call using `doit()`.
24143/// // Values shown here are possibly random and not representative !
24144/// let result = hub.orderreturns().get(26, "returnId")
24145///              .doit().await;
24146/// # }
24147/// ```
24148pub struct OrderreturnGetCall<'a, C>
24149where
24150    C: 'a,
24151{
24152    hub: &'a ShoppingContent<C>,
24153    _merchant_id: u64,
24154    _return_id: String,
24155    _delegate: Option<&'a mut dyn common::Delegate>,
24156    _additional_params: HashMap<String, String>,
24157    _scopes: BTreeSet<String>,
24158}
24159
24160impl<'a, C> common::CallBuilder for OrderreturnGetCall<'a, C> {}
24161
24162impl<'a, C> OrderreturnGetCall<'a, C>
24163where
24164    C: common::Connector,
24165{
24166    /// Perform the operation you have build so far.
24167    pub async fn doit(mut self) -> common::Result<(common::Response, MerchantOrderReturn)> {
24168        use std::borrow::Cow;
24169        use std::io::{Read, Seek};
24170
24171        use common::{url::Params, ToParts};
24172        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24173
24174        let mut dd = common::DefaultDelegate;
24175        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24176        dlg.begin(common::MethodInfo {
24177            id: "content.orderreturns.get",
24178            http_method: hyper::Method::GET,
24179        });
24180
24181        for &field in ["alt", "merchantId", "returnId"].iter() {
24182            if self._additional_params.contains_key(field) {
24183                dlg.finished(false);
24184                return Err(common::Error::FieldClash(field));
24185            }
24186        }
24187
24188        let mut params = Params::with_capacity(4 + self._additional_params.len());
24189        params.push("merchantId", self._merchant_id.to_string());
24190        params.push("returnId", self._return_id);
24191
24192        params.extend(self._additional_params.iter());
24193
24194        params.push("alt", "json");
24195        let mut url = self.hub._base_url.clone() + "{merchantId}/orderreturns/{returnId}";
24196        if self._scopes.is_empty() {
24197            self._scopes.insert(Scope::Full.as_ref().to_string());
24198        }
24199
24200        #[allow(clippy::single_element_loop)]
24201        for &(find_this, param_name) in
24202            [("{merchantId}", "merchantId"), ("{returnId}", "returnId")].iter()
24203        {
24204            url = params.uri_replacement(url, param_name, find_this, false);
24205        }
24206        {
24207            let to_remove = ["returnId", "merchantId"];
24208            params.remove_params(&to_remove);
24209        }
24210
24211        let url = params.parse_with_url(&url);
24212
24213        loop {
24214            let token = match self
24215                .hub
24216                .auth
24217                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24218                .await
24219            {
24220                Ok(token) => token,
24221                Err(e) => match dlg.token(e) {
24222                    Ok(token) => token,
24223                    Err(e) => {
24224                        dlg.finished(false);
24225                        return Err(common::Error::MissingToken(e));
24226                    }
24227                },
24228            };
24229            let mut req_result = {
24230                let client = &self.hub.client;
24231                dlg.pre_request();
24232                let mut req_builder = hyper::Request::builder()
24233                    .method(hyper::Method::GET)
24234                    .uri(url.as_str())
24235                    .header(USER_AGENT, self.hub._user_agent.clone());
24236
24237                if let Some(token) = token.as_ref() {
24238                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24239                }
24240
24241                let request = req_builder
24242                    .header(CONTENT_LENGTH, 0_u64)
24243                    .body(common::to_body::<String>(None));
24244
24245                client.request(request.unwrap()).await
24246            };
24247
24248            match req_result {
24249                Err(err) => {
24250                    if let common::Retry::After(d) = dlg.http_error(&err) {
24251                        sleep(d).await;
24252                        continue;
24253                    }
24254                    dlg.finished(false);
24255                    return Err(common::Error::HttpError(err));
24256                }
24257                Ok(res) => {
24258                    let (mut parts, body) = res.into_parts();
24259                    let mut body = common::Body::new(body);
24260                    if !parts.status.is_success() {
24261                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24262                        let error = serde_json::from_str(&common::to_string(&bytes));
24263                        let response = common::to_response(parts, bytes.into());
24264
24265                        if let common::Retry::After(d) =
24266                            dlg.http_failure(&response, error.as_ref().ok())
24267                        {
24268                            sleep(d).await;
24269                            continue;
24270                        }
24271
24272                        dlg.finished(false);
24273
24274                        return Err(match error {
24275                            Ok(value) => common::Error::BadRequest(value),
24276                            _ => common::Error::Failure(response),
24277                        });
24278                    }
24279                    let response = {
24280                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24281                        let encoded = common::to_string(&bytes);
24282                        match serde_json::from_str(&encoded) {
24283                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24284                            Err(error) => {
24285                                dlg.response_json_decode_error(&encoded, &error);
24286                                return Err(common::Error::JsonDecodeError(
24287                                    encoded.to_string(),
24288                                    error,
24289                                ));
24290                            }
24291                        }
24292                    };
24293
24294                    dlg.finished(true);
24295                    return Ok(response);
24296                }
24297            }
24298        }
24299    }
24300
24301    /// The ID of the account that manages the order. This cannot be a multi-client account.
24302    ///
24303    /// Sets the *merchant id* path property to the given value.
24304    ///
24305    /// Even though the property as already been set when instantiating this call,
24306    /// we provide this method for API completeness.
24307    pub fn merchant_id(mut self, new_value: u64) -> OrderreturnGetCall<'a, C> {
24308        self._merchant_id = new_value;
24309        self
24310    }
24311    /// Merchant order return ID generated by Google.
24312    ///
24313    /// Sets the *return id* path property to the given value.
24314    ///
24315    /// Even though the property as already been set when instantiating this call,
24316    /// we provide this method for API completeness.
24317    pub fn return_id(mut self, new_value: &str) -> OrderreturnGetCall<'a, C> {
24318        self._return_id = new_value.to_string();
24319        self
24320    }
24321    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24322    /// while executing the actual API request.
24323    ///
24324    /// ````text
24325    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24326    /// ````
24327    ///
24328    /// Sets the *delegate* property to the given value.
24329    pub fn delegate(
24330        mut self,
24331        new_value: &'a mut dyn common::Delegate,
24332    ) -> OrderreturnGetCall<'a, C> {
24333        self._delegate = Some(new_value);
24334        self
24335    }
24336
24337    /// Set any additional parameter of the query string used in the request.
24338    /// It should be used to set parameters which are not yet available through their own
24339    /// setters.
24340    ///
24341    /// Please note that this method must not be used to set any of the known parameters
24342    /// which have their own setter method. If done anyway, the request will fail.
24343    ///
24344    /// # Additional Parameters
24345    ///
24346    /// * *$.xgafv* (query-string) - V1 error format.
24347    /// * *access_token* (query-string) - OAuth access token.
24348    /// * *alt* (query-string) - Data format for response.
24349    /// * *callback* (query-string) - JSONP
24350    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24351    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24352    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24353    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24354    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24355    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24356    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24357    pub fn param<T>(mut self, name: T, value: T) -> OrderreturnGetCall<'a, C>
24358    where
24359        T: AsRef<str>,
24360    {
24361        self._additional_params
24362            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24363        self
24364    }
24365
24366    /// Identifies the authorization scope for the method you are building.
24367    ///
24368    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24369    /// [`Scope::Full`].
24370    ///
24371    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24372    /// tokens for more than one scope.
24373    ///
24374    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24375    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24376    /// sufficient, a read-write scope will do as well.
24377    pub fn add_scope<St>(mut self, scope: St) -> OrderreturnGetCall<'a, C>
24378    where
24379        St: AsRef<str>,
24380    {
24381        self._scopes.insert(String::from(scope.as_ref()));
24382        self
24383    }
24384    /// Identifies the authorization scope(s) for the method you are building.
24385    ///
24386    /// See [`Self::add_scope()`] for details.
24387    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderreturnGetCall<'a, C>
24388    where
24389        I: IntoIterator<Item = St>,
24390        St: AsRef<str>,
24391    {
24392        self._scopes
24393            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24394        self
24395    }
24396
24397    /// Removes all scopes, and no default scope will be used either.
24398    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24399    /// for details).
24400    pub fn clear_scopes(mut self) -> OrderreturnGetCall<'a, C> {
24401        self._scopes.clear();
24402        self
24403    }
24404}
24405
24406/// Lists order returns in your Merchant Center account.
24407///
24408/// A builder for the *list* method supported by a *orderreturn* resource.
24409/// It is not used directly, but through a [`OrderreturnMethods`] instance.
24410///
24411/// # Example
24412///
24413/// Instantiate a resource method builder
24414///
24415/// ```test_harness,no_run
24416/// # extern crate hyper;
24417/// # extern crate hyper_rustls;
24418/// # extern crate google_content2 as content2;
24419/// # async fn dox() {
24420/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24421///
24422/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24423/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24424/// #     .with_native_roots()
24425/// #     .unwrap()
24426/// #     .https_only()
24427/// #     .enable_http2()
24428/// #     .build();
24429///
24430/// # let executor = hyper_util::rt::TokioExecutor::new();
24431/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24432/// #     secret,
24433/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24434/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
24435/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
24436/// #     ),
24437/// # ).build().await.unwrap();
24438///
24439/// # let client = hyper_util::client::legacy::Client::builder(
24440/// #     hyper_util::rt::TokioExecutor::new()
24441/// # )
24442/// # .build(
24443/// #     hyper_rustls::HttpsConnectorBuilder::new()
24444/// #         .with_native_roots()
24445/// #         .unwrap()
24446/// #         .https_or_http()
24447/// #         .enable_http2()
24448/// #         .build()
24449/// # );
24450/// # let mut hub = ShoppingContent::new(client, auth);
24451/// // You can configure optional parameters by calling the respective setters at will, and
24452/// // execute the final call using `doit()`.
24453/// // Values shown here are possibly random and not representative !
24454/// let result = hub.orderreturns().list(84)
24455///              .page_token("Stet")
24456///              .order_by("dolores")
24457///              .max_results(76)
24458///              .created_start_date("et")
24459///              .created_end_date("sea")
24460///              .doit().await;
24461/// # }
24462/// ```
24463pub struct OrderreturnListCall<'a, C>
24464where
24465    C: 'a,
24466{
24467    hub: &'a ShoppingContent<C>,
24468    _merchant_id: u64,
24469    _page_token: Option<String>,
24470    _order_by: Option<String>,
24471    _max_results: Option<u32>,
24472    _created_start_date: Option<String>,
24473    _created_end_date: Option<String>,
24474    _delegate: Option<&'a mut dyn common::Delegate>,
24475    _additional_params: HashMap<String, String>,
24476    _scopes: BTreeSet<String>,
24477}
24478
24479impl<'a, C> common::CallBuilder for OrderreturnListCall<'a, C> {}
24480
24481impl<'a, C> OrderreturnListCall<'a, C>
24482where
24483    C: common::Connector,
24484{
24485    /// Perform the operation you have build so far.
24486    pub async fn doit(mut self) -> common::Result<(common::Response, OrderreturnsListResponse)> {
24487        use std::borrow::Cow;
24488        use std::io::{Read, Seek};
24489
24490        use common::{url::Params, ToParts};
24491        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24492
24493        let mut dd = common::DefaultDelegate;
24494        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24495        dlg.begin(common::MethodInfo {
24496            id: "content.orderreturns.list",
24497            http_method: hyper::Method::GET,
24498        });
24499
24500        for &field in [
24501            "alt",
24502            "merchantId",
24503            "pageToken",
24504            "orderBy",
24505            "maxResults",
24506            "createdStartDate",
24507            "createdEndDate",
24508        ]
24509        .iter()
24510        {
24511            if self._additional_params.contains_key(field) {
24512                dlg.finished(false);
24513                return Err(common::Error::FieldClash(field));
24514            }
24515        }
24516
24517        let mut params = Params::with_capacity(8 + self._additional_params.len());
24518        params.push("merchantId", self._merchant_id.to_string());
24519        if let Some(value) = self._page_token.as_ref() {
24520            params.push("pageToken", value);
24521        }
24522        if let Some(value) = self._order_by.as_ref() {
24523            params.push("orderBy", value);
24524        }
24525        if let Some(value) = self._max_results.as_ref() {
24526            params.push("maxResults", value.to_string());
24527        }
24528        if let Some(value) = self._created_start_date.as_ref() {
24529            params.push("createdStartDate", value);
24530        }
24531        if let Some(value) = self._created_end_date.as_ref() {
24532            params.push("createdEndDate", value);
24533        }
24534
24535        params.extend(self._additional_params.iter());
24536
24537        params.push("alt", "json");
24538        let mut url = self.hub._base_url.clone() + "{merchantId}/orderreturns";
24539        if self._scopes.is_empty() {
24540            self._scopes.insert(Scope::Full.as_ref().to_string());
24541        }
24542
24543        #[allow(clippy::single_element_loop)]
24544        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
24545            url = params.uri_replacement(url, param_name, find_this, false);
24546        }
24547        {
24548            let to_remove = ["merchantId"];
24549            params.remove_params(&to_remove);
24550        }
24551
24552        let url = params.parse_with_url(&url);
24553
24554        loop {
24555            let token = match self
24556                .hub
24557                .auth
24558                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24559                .await
24560            {
24561                Ok(token) => token,
24562                Err(e) => match dlg.token(e) {
24563                    Ok(token) => token,
24564                    Err(e) => {
24565                        dlg.finished(false);
24566                        return Err(common::Error::MissingToken(e));
24567                    }
24568                },
24569            };
24570            let mut req_result = {
24571                let client = &self.hub.client;
24572                dlg.pre_request();
24573                let mut req_builder = hyper::Request::builder()
24574                    .method(hyper::Method::GET)
24575                    .uri(url.as_str())
24576                    .header(USER_AGENT, self.hub._user_agent.clone());
24577
24578                if let Some(token) = token.as_ref() {
24579                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24580                }
24581
24582                let request = req_builder
24583                    .header(CONTENT_LENGTH, 0_u64)
24584                    .body(common::to_body::<String>(None));
24585
24586                client.request(request.unwrap()).await
24587            };
24588
24589            match req_result {
24590                Err(err) => {
24591                    if let common::Retry::After(d) = dlg.http_error(&err) {
24592                        sleep(d).await;
24593                        continue;
24594                    }
24595                    dlg.finished(false);
24596                    return Err(common::Error::HttpError(err));
24597                }
24598                Ok(res) => {
24599                    let (mut parts, body) = res.into_parts();
24600                    let mut body = common::Body::new(body);
24601                    if !parts.status.is_success() {
24602                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24603                        let error = serde_json::from_str(&common::to_string(&bytes));
24604                        let response = common::to_response(parts, bytes.into());
24605
24606                        if let common::Retry::After(d) =
24607                            dlg.http_failure(&response, error.as_ref().ok())
24608                        {
24609                            sleep(d).await;
24610                            continue;
24611                        }
24612
24613                        dlg.finished(false);
24614
24615                        return Err(match error {
24616                            Ok(value) => common::Error::BadRequest(value),
24617                            _ => common::Error::Failure(response),
24618                        });
24619                    }
24620                    let response = {
24621                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24622                        let encoded = common::to_string(&bytes);
24623                        match serde_json::from_str(&encoded) {
24624                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24625                            Err(error) => {
24626                                dlg.response_json_decode_error(&encoded, &error);
24627                                return Err(common::Error::JsonDecodeError(
24628                                    encoded.to_string(),
24629                                    error,
24630                                ));
24631                            }
24632                        }
24633                    };
24634
24635                    dlg.finished(true);
24636                    return Ok(response);
24637                }
24638            }
24639        }
24640    }
24641
24642    /// The ID of the account that manages the order. This cannot be a multi-client account.
24643    ///
24644    /// Sets the *merchant id* path property to the given value.
24645    ///
24646    /// Even though the property as already been set when instantiating this call,
24647    /// we provide this method for API completeness.
24648    pub fn merchant_id(mut self, new_value: u64) -> OrderreturnListCall<'a, C> {
24649        self._merchant_id = new_value;
24650        self
24651    }
24652    /// The token returned by the previous request.
24653    ///
24654    /// Sets the *page token* query property to the given value.
24655    pub fn page_token(mut self, new_value: &str) -> OrderreturnListCall<'a, C> {
24656        self._page_token = Some(new_value.to_string());
24657        self
24658    }
24659    /// Return the results in the specified order.
24660    ///
24661    /// Sets the *order by* query property to the given value.
24662    pub fn order_by(mut self, new_value: &str) -> OrderreturnListCall<'a, C> {
24663        self._order_by = Some(new_value.to_string());
24664        self
24665    }
24666    /// The maximum number of order returns to return in the response, used for paging. The default value is 25 returns per page, and the maximum allowed value is 250 returns per page.
24667    ///
24668    /// Sets the *max results* query property to the given value.
24669    pub fn max_results(mut self, new_value: u32) -> OrderreturnListCall<'a, C> {
24670        self._max_results = Some(new_value);
24671        self
24672    }
24673    /// Obtains order returns created after this date (inclusively), in ISO 8601 format.
24674    ///
24675    /// Sets the *created start date* query property to the given value.
24676    pub fn created_start_date(mut self, new_value: &str) -> OrderreturnListCall<'a, C> {
24677        self._created_start_date = Some(new_value.to_string());
24678        self
24679    }
24680    /// Obtains order returns created before this date (inclusively), in ISO 8601 format.
24681    ///
24682    /// Sets the *created end date* query property to the given value.
24683    pub fn created_end_date(mut self, new_value: &str) -> OrderreturnListCall<'a, C> {
24684        self._created_end_date = Some(new_value.to_string());
24685        self
24686    }
24687    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24688    /// while executing the actual API request.
24689    ///
24690    /// ````text
24691    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24692    /// ````
24693    ///
24694    /// Sets the *delegate* property to the given value.
24695    pub fn delegate(
24696        mut self,
24697        new_value: &'a mut dyn common::Delegate,
24698    ) -> OrderreturnListCall<'a, C> {
24699        self._delegate = Some(new_value);
24700        self
24701    }
24702
24703    /// Set any additional parameter of the query string used in the request.
24704    /// It should be used to set parameters which are not yet available through their own
24705    /// setters.
24706    ///
24707    /// Please note that this method must not be used to set any of the known parameters
24708    /// which have their own setter method. If done anyway, the request will fail.
24709    ///
24710    /// # Additional Parameters
24711    ///
24712    /// * *$.xgafv* (query-string) - V1 error format.
24713    /// * *access_token* (query-string) - OAuth access token.
24714    /// * *alt* (query-string) - Data format for response.
24715    /// * *callback* (query-string) - JSONP
24716    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24717    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24718    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24719    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24720    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24721    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24722    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24723    pub fn param<T>(mut self, name: T, value: T) -> OrderreturnListCall<'a, C>
24724    where
24725        T: AsRef<str>,
24726    {
24727        self._additional_params
24728            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24729        self
24730    }
24731
24732    /// Identifies the authorization scope for the method you are building.
24733    ///
24734    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24735    /// [`Scope::Full`].
24736    ///
24737    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24738    /// tokens for more than one scope.
24739    ///
24740    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24741    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24742    /// sufficient, a read-write scope will do as well.
24743    pub fn add_scope<St>(mut self, scope: St) -> OrderreturnListCall<'a, C>
24744    where
24745        St: AsRef<str>,
24746    {
24747        self._scopes.insert(String::from(scope.as_ref()));
24748        self
24749    }
24750    /// Identifies the authorization scope(s) for the method you are building.
24751    ///
24752    /// See [`Self::add_scope()`] for details.
24753    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderreturnListCall<'a, C>
24754    where
24755        I: IntoIterator<Item = St>,
24756        St: AsRef<str>,
24757    {
24758        self._scopes
24759            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24760        self
24761    }
24762
24763    /// Removes all scopes, and no default scope will be used either.
24764    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24765    /// for details).
24766    pub fn clear_scopes(mut self) -> OrderreturnListCall<'a, C> {
24767        self._scopes.clear();
24768        self
24769    }
24770}
24771
24772/// Marks an order as acknowledged.
24773///
24774/// A builder for the *acknowledge* method supported by a *order* resource.
24775/// It is not used directly, but through a [`OrderMethods`] instance.
24776///
24777/// # Example
24778///
24779/// Instantiate a resource method builder
24780///
24781/// ```test_harness,no_run
24782/// # extern crate hyper;
24783/// # extern crate hyper_rustls;
24784/// # extern crate google_content2 as content2;
24785/// use content2::api::OrdersAcknowledgeRequest;
24786/// # async fn dox() {
24787/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24788///
24789/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24790/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24791/// #     .with_native_roots()
24792/// #     .unwrap()
24793/// #     .https_only()
24794/// #     .enable_http2()
24795/// #     .build();
24796///
24797/// # let executor = hyper_util::rt::TokioExecutor::new();
24798/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24799/// #     secret,
24800/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24801/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
24802/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
24803/// #     ),
24804/// # ).build().await.unwrap();
24805///
24806/// # let client = hyper_util::client::legacy::Client::builder(
24807/// #     hyper_util::rt::TokioExecutor::new()
24808/// # )
24809/// # .build(
24810/// #     hyper_rustls::HttpsConnectorBuilder::new()
24811/// #         .with_native_roots()
24812/// #         .unwrap()
24813/// #         .https_or_http()
24814/// #         .enable_http2()
24815/// #         .build()
24816/// # );
24817/// # let mut hub = ShoppingContent::new(client, auth);
24818/// // As the method needs a request, you would usually fill it with the desired information
24819/// // into the respective structure. Some of the parts shown here might not be applicable !
24820/// // Values shown here are possibly random and not representative !
24821/// let mut req = OrdersAcknowledgeRequest::default();
24822///
24823/// // You can configure optional parameters by calling the respective setters at will, and
24824/// // execute the final call using `doit()`.
24825/// // Values shown here are possibly random and not representative !
24826/// let result = hub.orders().acknowledge(req, 27, "orderId")
24827///              .doit().await;
24828/// # }
24829/// ```
24830pub struct OrderAcknowledgeCall<'a, C>
24831where
24832    C: 'a,
24833{
24834    hub: &'a ShoppingContent<C>,
24835    _request: OrdersAcknowledgeRequest,
24836    _merchant_id: u64,
24837    _order_id: String,
24838    _delegate: Option<&'a mut dyn common::Delegate>,
24839    _additional_params: HashMap<String, String>,
24840    _scopes: BTreeSet<String>,
24841}
24842
24843impl<'a, C> common::CallBuilder for OrderAcknowledgeCall<'a, C> {}
24844
24845impl<'a, C> OrderAcknowledgeCall<'a, C>
24846where
24847    C: common::Connector,
24848{
24849    /// Perform the operation you have build so far.
24850    pub async fn doit(mut self) -> common::Result<(common::Response, OrdersAcknowledgeResponse)> {
24851        use std::borrow::Cow;
24852        use std::io::{Read, Seek};
24853
24854        use common::{url::Params, ToParts};
24855        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24856
24857        let mut dd = common::DefaultDelegate;
24858        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24859        dlg.begin(common::MethodInfo {
24860            id: "content.orders.acknowledge",
24861            http_method: hyper::Method::POST,
24862        });
24863
24864        for &field in ["alt", "merchantId", "orderId"].iter() {
24865            if self._additional_params.contains_key(field) {
24866                dlg.finished(false);
24867                return Err(common::Error::FieldClash(field));
24868            }
24869        }
24870
24871        let mut params = Params::with_capacity(5 + self._additional_params.len());
24872        params.push("merchantId", self._merchant_id.to_string());
24873        params.push("orderId", self._order_id);
24874
24875        params.extend(self._additional_params.iter());
24876
24877        params.push("alt", "json");
24878        let mut url = self.hub._base_url.clone() + "{merchantId}/orders/{orderId}/acknowledge";
24879        if self._scopes.is_empty() {
24880            self._scopes.insert(Scope::Full.as_ref().to_string());
24881        }
24882
24883        #[allow(clippy::single_element_loop)]
24884        for &(find_this, param_name) in
24885            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
24886        {
24887            url = params.uri_replacement(url, param_name, find_this, false);
24888        }
24889        {
24890            let to_remove = ["orderId", "merchantId"];
24891            params.remove_params(&to_remove);
24892        }
24893
24894        let url = params.parse_with_url(&url);
24895
24896        let mut json_mime_type = mime::APPLICATION_JSON;
24897        let mut request_value_reader = {
24898            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24899            common::remove_json_null_values(&mut value);
24900            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24901            serde_json::to_writer(&mut dst, &value).unwrap();
24902            dst
24903        };
24904        let request_size = request_value_reader
24905            .seek(std::io::SeekFrom::End(0))
24906            .unwrap();
24907        request_value_reader
24908            .seek(std::io::SeekFrom::Start(0))
24909            .unwrap();
24910
24911        loop {
24912            let token = match self
24913                .hub
24914                .auth
24915                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24916                .await
24917            {
24918                Ok(token) => token,
24919                Err(e) => match dlg.token(e) {
24920                    Ok(token) => token,
24921                    Err(e) => {
24922                        dlg.finished(false);
24923                        return Err(common::Error::MissingToken(e));
24924                    }
24925                },
24926            };
24927            request_value_reader
24928                .seek(std::io::SeekFrom::Start(0))
24929                .unwrap();
24930            let mut req_result = {
24931                let client = &self.hub.client;
24932                dlg.pre_request();
24933                let mut req_builder = hyper::Request::builder()
24934                    .method(hyper::Method::POST)
24935                    .uri(url.as_str())
24936                    .header(USER_AGENT, self.hub._user_agent.clone());
24937
24938                if let Some(token) = token.as_ref() {
24939                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24940                }
24941
24942                let request = req_builder
24943                    .header(CONTENT_TYPE, json_mime_type.to_string())
24944                    .header(CONTENT_LENGTH, request_size as u64)
24945                    .body(common::to_body(
24946                        request_value_reader.get_ref().clone().into(),
24947                    ));
24948
24949                client.request(request.unwrap()).await
24950            };
24951
24952            match req_result {
24953                Err(err) => {
24954                    if let common::Retry::After(d) = dlg.http_error(&err) {
24955                        sleep(d).await;
24956                        continue;
24957                    }
24958                    dlg.finished(false);
24959                    return Err(common::Error::HttpError(err));
24960                }
24961                Ok(res) => {
24962                    let (mut parts, body) = res.into_parts();
24963                    let mut body = common::Body::new(body);
24964                    if !parts.status.is_success() {
24965                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24966                        let error = serde_json::from_str(&common::to_string(&bytes));
24967                        let response = common::to_response(parts, bytes.into());
24968
24969                        if let common::Retry::After(d) =
24970                            dlg.http_failure(&response, error.as_ref().ok())
24971                        {
24972                            sleep(d).await;
24973                            continue;
24974                        }
24975
24976                        dlg.finished(false);
24977
24978                        return Err(match error {
24979                            Ok(value) => common::Error::BadRequest(value),
24980                            _ => common::Error::Failure(response),
24981                        });
24982                    }
24983                    let response = {
24984                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24985                        let encoded = common::to_string(&bytes);
24986                        match serde_json::from_str(&encoded) {
24987                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24988                            Err(error) => {
24989                                dlg.response_json_decode_error(&encoded, &error);
24990                                return Err(common::Error::JsonDecodeError(
24991                                    encoded.to_string(),
24992                                    error,
24993                                ));
24994                            }
24995                        }
24996                    };
24997
24998                    dlg.finished(true);
24999                    return Ok(response);
25000                }
25001            }
25002        }
25003    }
25004
25005    ///
25006    /// Sets the *request* property to the given value.
25007    ///
25008    /// Even though the property as already been set when instantiating this call,
25009    /// we provide this method for API completeness.
25010    pub fn request(mut self, new_value: OrdersAcknowledgeRequest) -> OrderAcknowledgeCall<'a, C> {
25011        self._request = new_value;
25012        self
25013    }
25014    /// The ID of the account that manages the order. This cannot be a multi-client account.
25015    ///
25016    /// Sets the *merchant id* path property to the given value.
25017    ///
25018    /// Even though the property as already been set when instantiating this call,
25019    /// we provide this method for API completeness.
25020    pub fn merchant_id(mut self, new_value: u64) -> OrderAcknowledgeCall<'a, C> {
25021        self._merchant_id = new_value;
25022        self
25023    }
25024    /// The ID of the order.
25025    ///
25026    /// Sets the *order id* path property to the given value.
25027    ///
25028    /// Even though the property as already been set when instantiating this call,
25029    /// we provide this method for API completeness.
25030    pub fn order_id(mut self, new_value: &str) -> OrderAcknowledgeCall<'a, C> {
25031        self._order_id = new_value.to_string();
25032        self
25033    }
25034    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25035    /// while executing the actual API request.
25036    ///
25037    /// ````text
25038    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25039    /// ````
25040    ///
25041    /// Sets the *delegate* property to the given value.
25042    pub fn delegate(
25043        mut self,
25044        new_value: &'a mut dyn common::Delegate,
25045    ) -> OrderAcknowledgeCall<'a, C> {
25046        self._delegate = Some(new_value);
25047        self
25048    }
25049
25050    /// Set any additional parameter of the query string used in the request.
25051    /// It should be used to set parameters which are not yet available through their own
25052    /// setters.
25053    ///
25054    /// Please note that this method must not be used to set any of the known parameters
25055    /// which have their own setter method. If done anyway, the request will fail.
25056    ///
25057    /// # Additional Parameters
25058    ///
25059    /// * *$.xgafv* (query-string) - V1 error format.
25060    /// * *access_token* (query-string) - OAuth access token.
25061    /// * *alt* (query-string) - Data format for response.
25062    /// * *callback* (query-string) - JSONP
25063    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25064    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25065    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25066    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25067    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25068    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25069    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25070    pub fn param<T>(mut self, name: T, value: T) -> OrderAcknowledgeCall<'a, C>
25071    where
25072        T: AsRef<str>,
25073    {
25074        self._additional_params
25075            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25076        self
25077    }
25078
25079    /// Identifies the authorization scope for the method you are building.
25080    ///
25081    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25082    /// [`Scope::Full`].
25083    ///
25084    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25085    /// tokens for more than one scope.
25086    ///
25087    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25088    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25089    /// sufficient, a read-write scope will do as well.
25090    pub fn add_scope<St>(mut self, scope: St) -> OrderAcknowledgeCall<'a, C>
25091    where
25092        St: AsRef<str>,
25093    {
25094        self._scopes.insert(String::from(scope.as_ref()));
25095        self
25096    }
25097    /// Identifies the authorization scope(s) for the method you are building.
25098    ///
25099    /// See [`Self::add_scope()`] for details.
25100    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderAcknowledgeCall<'a, C>
25101    where
25102        I: IntoIterator<Item = St>,
25103        St: AsRef<str>,
25104    {
25105        self._scopes
25106            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25107        self
25108    }
25109
25110    /// Removes all scopes, and no default scope will be used either.
25111    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25112    /// for details).
25113    pub fn clear_scopes(mut self) -> OrderAcknowledgeCall<'a, C> {
25114        self._scopes.clear();
25115        self
25116    }
25117}
25118
25119/// Sandbox only. Moves a test order from state "`inProgress`" to state "`pendingShipment`".
25120///
25121/// A builder for the *advancetestorder* method supported by a *order* resource.
25122/// It is not used directly, but through a [`OrderMethods`] instance.
25123///
25124/// # Example
25125///
25126/// Instantiate a resource method builder
25127///
25128/// ```test_harness,no_run
25129/// # extern crate hyper;
25130/// # extern crate hyper_rustls;
25131/// # extern crate google_content2 as content2;
25132/// # async fn dox() {
25133/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25134///
25135/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25136/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25137/// #     .with_native_roots()
25138/// #     .unwrap()
25139/// #     .https_only()
25140/// #     .enable_http2()
25141/// #     .build();
25142///
25143/// # let executor = hyper_util::rt::TokioExecutor::new();
25144/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25145/// #     secret,
25146/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25147/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
25148/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
25149/// #     ),
25150/// # ).build().await.unwrap();
25151///
25152/// # let client = hyper_util::client::legacy::Client::builder(
25153/// #     hyper_util::rt::TokioExecutor::new()
25154/// # )
25155/// # .build(
25156/// #     hyper_rustls::HttpsConnectorBuilder::new()
25157/// #         .with_native_roots()
25158/// #         .unwrap()
25159/// #         .https_or_http()
25160/// #         .enable_http2()
25161/// #         .build()
25162/// # );
25163/// # let mut hub = ShoppingContent::new(client, auth);
25164/// // You can configure optional parameters by calling the respective setters at will, and
25165/// // execute the final call using `doit()`.
25166/// // Values shown here are possibly random and not representative !
25167/// let result = hub.orders().advancetestorder(17, "orderId")
25168///              .doit().await;
25169/// # }
25170/// ```
25171pub struct OrderAdvancetestorderCall<'a, C>
25172where
25173    C: 'a,
25174{
25175    hub: &'a ShoppingContent<C>,
25176    _merchant_id: u64,
25177    _order_id: String,
25178    _delegate: Option<&'a mut dyn common::Delegate>,
25179    _additional_params: HashMap<String, String>,
25180    _scopes: BTreeSet<String>,
25181}
25182
25183impl<'a, C> common::CallBuilder for OrderAdvancetestorderCall<'a, C> {}
25184
25185impl<'a, C> OrderAdvancetestorderCall<'a, C>
25186where
25187    C: common::Connector,
25188{
25189    /// Perform the operation you have build so far.
25190    pub async fn doit(
25191        mut self,
25192    ) -> common::Result<(common::Response, OrdersAdvanceTestOrderResponse)> {
25193        use std::borrow::Cow;
25194        use std::io::{Read, Seek};
25195
25196        use common::{url::Params, ToParts};
25197        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25198
25199        let mut dd = common::DefaultDelegate;
25200        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25201        dlg.begin(common::MethodInfo {
25202            id: "content.orders.advancetestorder",
25203            http_method: hyper::Method::POST,
25204        });
25205
25206        for &field in ["alt", "merchantId", "orderId"].iter() {
25207            if self._additional_params.contains_key(field) {
25208                dlg.finished(false);
25209                return Err(common::Error::FieldClash(field));
25210            }
25211        }
25212
25213        let mut params = Params::with_capacity(4 + self._additional_params.len());
25214        params.push("merchantId", self._merchant_id.to_string());
25215        params.push("orderId", self._order_id);
25216
25217        params.extend(self._additional_params.iter());
25218
25219        params.push("alt", "json");
25220        let mut url = self.hub._base_url.clone() + "{merchantId}/testorders/{orderId}/advance";
25221        if self._scopes.is_empty() {
25222            self._scopes.insert(Scope::Full.as_ref().to_string());
25223        }
25224
25225        #[allow(clippy::single_element_loop)]
25226        for &(find_this, param_name) in
25227            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
25228        {
25229            url = params.uri_replacement(url, param_name, find_this, false);
25230        }
25231        {
25232            let to_remove = ["orderId", "merchantId"];
25233            params.remove_params(&to_remove);
25234        }
25235
25236        let url = params.parse_with_url(&url);
25237
25238        loop {
25239            let token = match self
25240                .hub
25241                .auth
25242                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25243                .await
25244            {
25245                Ok(token) => token,
25246                Err(e) => match dlg.token(e) {
25247                    Ok(token) => token,
25248                    Err(e) => {
25249                        dlg.finished(false);
25250                        return Err(common::Error::MissingToken(e));
25251                    }
25252                },
25253            };
25254            let mut req_result = {
25255                let client = &self.hub.client;
25256                dlg.pre_request();
25257                let mut req_builder = hyper::Request::builder()
25258                    .method(hyper::Method::POST)
25259                    .uri(url.as_str())
25260                    .header(USER_AGENT, self.hub._user_agent.clone());
25261
25262                if let Some(token) = token.as_ref() {
25263                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25264                }
25265
25266                let request = req_builder
25267                    .header(CONTENT_LENGTH, 0_u64)
25268                    .body(common::to_body::<String>(None));
25269
25270                client.request(request.unwrap()).await
25271            };
25272
25273            match req_result {
25274                Err(err) => {
25275                    if let common::Retry::After(d) = dlg.http_error(&err) {
25276                        sleep(d).await;
25277                        continue;
25278                    }
25279                    dlg.finished(false);
25280                    return Err(common::Error::HttpError(err));
25281                }
25282                Ok(res) => {
25283                    let (mut parts, body) = res.into_parts();
25284                    let mut body = common::Body::new(body);
25285                    if !parts.status.is_success() {
25286                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25287                        let error = serde_json::from_str(&common::to_string(&bytes));
25288                        let response = common::to_response(parts, bytes.into());
25289
25290                        if let common::Retry::After(d) =
25291                            dlg.http_failure(&response, error.as_ref().ok())
25292                        {
25293                            sleep(d).await;
25294                            continue;
25295                        }
25296
25297                        dlg.finished(false);
25298
25299                        return Err(match error {
25300                            Ok(value) => common::Error::BadRequest(value),
25301                            _ => common::Error::Failure(response),
25302                        });
25303                    }
25304                    let response = {
25305                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25306                        let encoded = common::to_string(&bytes);
25307                        match serde_json::from_str(&encoded) {
25308                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25309                            Err(error) => {
25310                                dlg.response_json_decode_error(&encoded, &error);
25311                                return Err(common::Error::JsonDecodeError(
25312                                    encoded.to_string(),
25313                                    error,
25314                                ));
25315                            }
25316                        }
25317                    };
25318
25319                    dlg.finished(true);
25320                    return Ok(response);
25321                }
25322            }
25323        }
25324    }
25325
25326    /// The ID of the account that manages the order. This cannot be a multi-client account.
25327    ///
25328    /// Sets the *merchant id* path property to the given value.
25329    ///
25330    /// Even though the property as already been set when instantiating this call,
25331    /// we provide this method for API completeness.
25332    pub fn merchant_id(mut self, new_value: u64) -> OrderAdvancetestorderCall<'a, C> {
25333        self._merchant_id = new_value;
25334        self
25335    }
25336    /// The ID of the test order to modify.
25337    ///
25338    /// Sets the *order id* path property to the given value.
25339    ///
25340    /// Even though the property as already been set when instantiating this call,
25341    /// we provide this method for API completeness.
25342    pub fn order_id(mut self, new_value: &str) -> OrderAdvancetestorderCall<'a, C> {
25343        self._order_id = new_value.to_string();
25344        self
25345    }
25346    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25347    /// while executing the actual API request.
25348    ///
25349    /// ````text
25350    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25351    /// ````
25352    ///
25353    /// Sets the *delegate* property to the given value.
25354    pub fn delegate(
25355        mut self,
25356        new_value: &'a mut dyn common::Delegate,
25357    ) -> OrderAdvancetestorderCall<'a, C> {
25358        self._delegate = Some(new_value);
25359        self
25360    }
25361
25362    /// Set any additional parameter of the query string used in the request.
25363    /// It should be used to set parameters which are not yet available through their own
25364    /// setters.
25365    ///
25366    /// Please note that this method must not be used to set any of the known parameters
25367    /// which have their own setter method. If done anyway, the request will fail.
25368    ///
25369    /// # Additional Parameters
25370    ///
25371    /// * *$.xgafv* (query-string) - V1 error format.
25372    /// * *access_token* (query-string) - OAuth access token.
25373    /// * *alt* (query-string) - Data format for response.
25374    /// * *callback* (query-string) - JSONP
25375    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25376    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25377    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25378    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25379    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25380    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25381    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25382    pub fn param<T>(mut self, name: T, value: T) -> OrderAdvancetestorderCall<'a, C>
25383    where
25384        T: AsRef<str>,
25385    {
25386        self._additional_params
25387            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25388        self
25389    }
25390
25391    /// Identifies the authorization scope for the method you are building.
25392    ///
25393    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25394    /// [`Scope::Full`].
25395    ///
25396    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25397    /// tokens for more than one scope.
25398    ///
25399    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25400    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25401    /// sufficient, a read-write scope will do as well.
25402    pub fn add_scope<St>(mut self, scope: St) -> OrderAdvancetestorderCall<'a, C>
25403    where
25404        St: AsRef<str>,
25405    {
25406        self._scopes.insert(String::from(scope.as_ref()));
25407        self
25408    }
25409    /// Identifies the authorization scope(s) for the method you are building.
25410    ///
25411    /// See [`Self::add_scope()`] for details.
25412    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderAdvancetestorderCall<'a, C>
25413    where
25414        I: IntoIterator<Item = St>,
25415        St: AsRef<str>,
25416    {
25417        self._scopes
25418            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25419        self
25420    }
25421
25422    /// Removes all scopes, and no default scope will be used either.
25423    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25424    /// for details).
25425    pub fn clear_scopes(mut self) -> OrderAdvancetestorderCall<'a, C> {
25426        self._scopes.clear();
25427        self
25428    }
25429}
25430
25431/// Cancels all line items in an order, making a full refund.
25432///
25433/// A builder for the *cancel* method supported by a *order* resource.
25434/// It is not used directly, but through a [`OrderMethods`] instance.
25435///
25436/// # Example
25437///
25438/// Instantiate a resource method builder
25439///
25440/// ```test_harness,no_run
25441/// # extern crate hyper;
25442/// # extern crate hyper_rustls;
25443/// # extern crate google_content2 as content2;
25444/// use content2::api::OrdersCancelRequest;
25445/// # async fn dox() {
25446/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25447///
25448/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25449/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25450/// #     .with_native_roots()
25451/// #     .unwrap()
25452/// #     .https_only()
25453/// #     .enable_http2()
25454/// #     .build();
25455///
25456/// # let executor = hyper_util::rt::TokioExecutor::new();
25457/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25458/// #     secret,
25459/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25460/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
25461/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
25462/// #     ),
25463/// # ).build().await.unwrap();
25464///
25465/// # let client = hyper_util::client::legacy::Client::builder(
25466/// #     hyper_util::rt::TokioExecutor::new()
25467/// # )
25468/// # .build(
25469/// #     hyper_rustls::HttpsConnectorBuilder::new()
25470/// #         .with_native_roots()
25471/// #         .unwrap()
25472/// #         .https_or_http()
25473/// #         .enable_http2()
25474/// #         .build()
25475/// # );
25476/// # let mut hub = ShoppingContent::new(client, auth);
25477/// // As the method needs a request, you would usually fill it with the desired information
25478/// // into the respective structure. Some of the parts shown here might not be applicable !
25479/// // Values shown here are possibly random and not representative !
25480/// let mut req = OrdersCancelRequest::default();
25481///
25482/// // You can configure optional parameters by calling the respective setters at will, and
25483/// // execute the final call using `doit()`.
25484/// // Values shown here are possibly random and not representative !
25485/// let result = hub.orders().cancel(req, 50, "orderId")
25486///              .doit().await;
25487/// # }
25488/// ```
25489pub struct OrderCancelCall<'a, C>
25490where
25491    C: 'a,
25492{
25493    hub: &'a ShoppingContent<C>,
25494    _request: OrdersCancelRequest,
25495    _merchant_id: u64,
25496    _order_id: String,
25497    _delegate: Option<&'a mut dyn common::Delegate>,
25498    _additional_params: HashMap<String, String>,
25499    _scopes: BTreeSet<String>,
25500}
25501
25502impl<'a, C> common::CallBuilder for OrderCancelCall<'a, C> {}
25503
25504impl<'a, C> OrderCancelCall<'a, C>
25505where
25506    C: common::Connector,
25507{
25508    /// Perform the operation you have build so far.
25509    pub async fn doit(mut self) -> common::Result<(common::Response, OrdersCancelResponse)> {
25510        use std::borrow::Cow;
25511        use std::io::{Read, Seek};
25512
25513        use common::{url::Params, ToParts};
25514        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25515
25516        let mut dd = common::DefaultDelegate;
25517        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25518        dlg.begin(common::MethodInfo {
25519            id: "content.orders.cancel",
25520            http_method: hyper::Method::POST,
25521        });
25522
25523        for &field in ["alt", "merchantId", "orderId"].iter() {
25524            if self._additional_params.contains_key(field) {
25525                dlg.finished(false);
25526                return Err(common::Error::FieldClash(field));
25527            }
25528        }
25529
25530        let mut params = Params::with_capacity(5 + self._additional_params.len());
25531        params.push("merchantId", self._merchant_id.to_string());
25532        params.push("orderId", self._order_id);
25533
25534        params.extend(self._additional_params.iter());
25535
25536        params.push("alt", "json");
25537        let mut url = self.hub._base_url.clone() + "{merchantId}/orders/{orderId}/cancel";
25538        if self._scopes.is_empty() {
25539            self._scopes.insert(Scope::Full.as_ref().to_string());
25540        }
25541
25542        #[allow(clippy::single_element_loop)]
25543        for &(find_this, param_name) in
25544            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
25545        {
25546            url = params.uri_replacement(url, param_name, find_this, false);
25547        }
25548        {
25549            let to_remove = ["orderId", "merchantId"];
25550            params.remove_params(&to_remove);
25551        }
25552
25553        let url = params.parse_with_url(&url);
25554
25555        let mut json_mime_type = mime::APPLICATION_JSON;
25556        let mut request_value_reader = {
25557            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25558            common::remove_json_null_values(&mut value);
25559            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25560            serde_json::to_writer(&mut dst, &value).unwrap();
25561            dst
25562        };
25563        let request_size = request_value_reader
25564            .seek(std::io::SeekFrom::End(0))
25565            .unwrap();
25566        request_value_reader
25567            .seek(std::io::SeekFrom::Start(0))
25568            .unwrap();
25569
25570        loop {
25571            let token = match self
25572                .hub
25573                .auth
25574                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25575                .await
25576            {
25577                Ok(token) => token,
25578                Err(e) => match dlg.token(e) {
25579                    Ok(token) => token,
25580                    Err(e) => {
25581                        dlg.finished(false);
25582                        return Err(common::Error::MissingToken(e));
25583                    }
25584                },
25585            };
25586            request_value_reader
25587                .seek(std::io::SeekFrom::Start(0))
25588                .unwrap();
25589            let mut req_result = {
25590                let client = &self.hub.client;
25591                dlg.pre_request();
25592                let mut req_builder = hyper::Request::builder()
25593                    .method(hyper::Method::POST)
25594                    .uri(url.as_str())
25595                    .header(USER_AGENT, self.hub._user_agent.clone());
25596
25597                if let Some(token) = token.as_ref() {
25598                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25599                }
25600
25601                let request = req_builder
25602                    .header(CONTENT_TYPE, json_mime_type.to_string())
25603                    .header(CONTENT_LENGTH, request_size as u64)
25604                    .body(common::to_body(
25605                        request_value_reader.get_ref().clone().into(),
25606                    ));
25607
25608                client.request(request.unwrap()).await
25609            };
25610
25611            match req_result {
25612                Err(err) => {
25613                    if let common::Retry::After(d) = dlg.http_error(&err) {
25614                        sleep(d).await;
25615                        continue;
25616                    }
25617                    dlg.finished(false);
25618                    return Err(common::Error::HttpError(err));
25619                }
25620                Ok(res) => {
25621                    let (mut parts, body) = res.into_parts();
25622                    let mut body = common::Body::new(body);
25623                    if !parts.status.is_success() {
25624                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25625                        let error = serde_json::from_str(&common::to_string(&bytes));
25626                        let response = common::to_response(parts, bytes.into());
25627
25628                        if let common::Retry::After(d) =
25629                            dlg.http_failure(&response, error.as_ref().ok())
25630                        {
25631                            sleep(d).await;
25632                            continue;
25633                        }
25634
25635                        dlg.finished(false);
25636
25637                        return Err(match error {
25638                            Ok(value) => common::Error::BadRequest(value),
25639                            _ => common::Error::Failure(response),
25640                        });
25641                    }
25642                    let response = {
25643                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25644                        let encoded = common::to_string(&bytes);
25645                        match serde_json::from_str(&encoded) {
25646                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25647                            Err(error) => {
25648                                dlg.response_json_decode_error(&encoded, &error);
25649                                return Err(common::Error::JsonDecodeError(
25650                                    encoded.to_string(),
25651                                    error,
25652                                ));
25653                            }
25654                        }
25655                    };
25656
25657                    dlg.finished(true);
25658                    return Ok(response);
25659                }
25660            }
25661        }
25662    }
25663
25664    ///
25665    /// Sets the *request* property to the given value.
25666    ///
25667    /// Even though the property as already been set when instantiating this call,
25668    /// we provide this method for API completeness.
25669    pub fn request(mut self, new_value: OrdersCancelRequest) -> OrderCancelCall<'a, C> {
25670        self._request = new_value;
25671        self
25672    }
25673    /// The ID of the account that manages the order. This cannot be a multi-client account.
25674    ///
25675    /// Sets the *merchant id* path property to the given value.
25676    ///
25677    /// Even though the property as already been set when instantiating this call,
25678    /// we provide this method for API completeness.
25679    pub fn merchant_id(mut self, new_value: u64) -> OrderCancelCall<'a, C> {
25680        self._merchant_id = new_value;
25681        self
25682    }
25683    /// The ID of the order to cancel.
25684    ///
25685    /// Sets the *order id* path property to the given value.
25686    ///
25687    /// Even though the property as already been set when instantiating this call,
25688    /// we provide this method for API completeness.
25689    pub fn order_id(mut self, new_value: &str) -> OrderCancelCall<'a, C> {
25690        self._order_id = new_value.to_string();
25691        self
25692    }
25693    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25694    /// while executing the actual API request.
25695    ///
25696    /// ````text
25697    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25698    /// ````
25699    ///
25700    /// Sets the *delegate* property to the given value.
25701    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OrderCancelCall<'a, C> {
25702        self._delegate = Some(new_value);
25703        self
25704    }
25705
25706    /// Set any additional parameter of the query string used in the request.
25707    /// It should be used to set parameters which are not yet available through their own
25708    /// setters.
25709    ///
25710    /// Please note that this method must not be used to set any of the known parameters
25711    /// which have their own setter method. If done anyway, the request will fail.
25712    ///
25713    /// # Additional Parameters
25714    ///
25715    /// * *$.xgafv* (query-string) - V1 error format.
25716    /// * *access_token* (query-string) - OAuth access token.
25717    /// * *alt* (query-string) - Data format for response.
25718    /// * *callback* (query-string) - JSONP
25719    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25720    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25721    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25722    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25723    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25724    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25725    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25726    pub fn param<T>(mut self, name: T, value: T) -> OrderCancelCall<'a, C>
25727    where
25728        T: AsRef<str>,
25729    {
25730        self._additional_params
25731            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25732        self
25733    }
25734
25735    /// Identifies the authorization scope for the method you are building.
25736    ///
25737    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25738    /// [`Scope::Full`].
25739    ///
25740    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25741    /// tokens for more than one scope.
25742    ///
25743    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25744    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25745    /// sufficient, a read-write scope will do as well.
25746    pub fn add_scope<St>(mut self, scope: St) -> OrderCancelCall<'a, C>
25747    where
25748        St: AsRef<str>,
25749    {
25750        self._scopes.insert(String::from(scope.as_ref()));
25751        self
25752    }
25753    /// Identifies the authorization scope(s) for the method you are building.
25754    ///
25755    /// See [`Self::add_scope()`] for details.
25756    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderCancelCall<'a, C>
25757    where
25758        I: IntoIterator<Item = St>,
25759        St: AsRef<str>,
25760    {
25761        self._scopes
25762            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25763        self
25764    }
25765
25766    /// Removes all scopes, and no default scope will be used either.
25767    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25768    /// for details).
25769    pub fn clear_scopes(mut self) -> OrderCancelCall<'a, C> {
25770        self._scopes.clear();
25771        self
25772    }
25773}
25774
25775/// Cancels a line item, making a full refund.
25776///
25777/// A builder for the *cancellineitem* method supported by a *order* resource.
25778/// It is not used directly, but through a [`OrderMethods`] instance.
25779///
25780/// # Example
25781///
25782/// Instantiate a resource method builder
25783///
25784/// ```test_harness,no_run
25785/// # extern crate hyper;
25786/// # extern crate hyper_rustls;
25787/// # extern crate google_content2 as content2;
25788/// use content2::api::OrdersCancelLineItemRequest;
25789/// # async fn dox() {
25790/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25791///
25792/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25793/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25794/// #     .with_native_roots()
25795/// #     .unwrap()
25796/// #     .https_only()
25797/// #     .enable_http2()
25798/// #     .build();
25799///
25800/// # let executor = hyper_util::rt::TokioExecutor::new();
25801/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25802/// #     secret,
25803/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25804/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
25805/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
25806/// #     ),
25807/// # ).build().await.unwrap();
25808///
25809/// # let client = hyper_util::client::legacy::Client::builder(
25810/// #     hyper_util::rt::TokioExecutor::new()
25811/// # )
25812/// # .build(
25813/// #     hyper_rustls::HttpsConnectorBuilder::new()
25814/// #         .with_native_roots()
25815/// #         .unwrap()
25816/// #         .https_or_http()
25817/// #         .enable_http2()
25818/// #         .build()
25819/// # );
25820/// # let mut hub = ShoppingContent::new(client, auth);
25821/// // As the method needs a request, you would usually fill it with the desired information
25822/// // into the respective structure. Some of the parts shown here might not be applicable !
25823/// // Values shown here are possibly random and not representative !
25824/// let mut req = OrdersCancelLineItemRequest::default();
25825///
25826/// // You can configure optional parameters by calling the respective setters at will, and
25827/// // execute the final call using `doit()`.
25828/// // Values shown here are possibly random and not representative !
25829/// let result = hub.orders().cancellineitem(req, 54, "orderId")
25830///              .doit().await;
25831/// # }
25832/// ```
25833pub struct OrderCancellineitemCall<'a, C>
25834where
25835    C: 'a,
25836{
25837    hub: &'a ShoppingContent<C>,
25838    _request: OrdersCancelLineItemRequest,
25839    _merchant_id: u64,
25840    _order_id: String,
25841    _delegate: Option<&'a mut dyn common::Delegate>,
25842    _additional_params: HashMap<String, String>,
25843    _scopes: BTreeSet<String>,
25844}
25845
25846impl<'a, C> common::CallBuilder for OrderCancellineitemCall<'a, C> {}
25847
25848impl<'a, C> OrderCancellineitemCall<'a, C>
25849where
25850    C: common::Connector,
25851{
25852    /// Perform the operation you have build so far.
25853    pub async fn doit(
25854        mut self,
25855    ) -> common::Result<(common::Response, OrdersCancelLineItemResponse)> {
25856        use std::borrow::Cow;
25857        use std::io::{Read, Seek};
25858
25859        use common::{url::Params, ToParts};
25860        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25861
25862        let mut dd = common::DefaultDelegate;
25863        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25864        dlg.begin(common::MethodInfo {
25865            id: "content.orders.cancellineitem",
25866            http_method: hyper::Method::POST,
25867        });
25868
25869        for &field in ["alt", "merchantId", "orderId"].iter() {
25870            if self._additional_params.contains_key(field) {
25871                dlg.finished(false);
25872                return Err(common::Error::FieldClash(field));
25873            }
25874        }
25875
25876        let mut params = Params::with_capacity(5 + self._additional_params.len());
25877        params.push("merchantId", self._merchant_id.to_string());
25878        params.push("orderId", self._order_id);
25879
25880        params.extend(self._additional_params.iter());
25881
25882        params.push("alt", "json");
25883        let mut url = self.hub._base_url.clone() + "{merchantId}/orders/{orderId}/cancelLineItem";
25884        if self._scopes.is_empty() {
25885            self._scopes.insert(Scope::Full.as_ref().to_string());
25886        }
25887
25888        #[allow(clippy::single_element_loop)]
25889        for &(find_this, param_name) in
25890            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
25891        {
25892            url = params.uri_replacement(url, param_name, find_this, false);
25893        }
25894        {
25895            let to_remove = ["orderId", "merchantId"];
25896            params.remove_params(&to_remove);
25897        }
25898
25899        let url = params.parse_with_url(&url);
25900
25901        let mut json_mime_type = mime::APPLICATION_JSON;
25902        let mut request_value_reader = {
25903            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25904            common::remove_json_null_values(&mut value);
25905            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25906            serde_json::to_writer(&mut dst, &value).unwrap();
25907            dst
25908        };
25909        let request_size = request_value_reader
25910            .seek(std::io::SeekFrom::End(0))
25911            .unwrap();
25912        request_value_reader
25913            .seek(std::io::SeekFrom::Start(0))
25914            .unwrap();
25915
25916        loop {
25917            let token = match self
25918                .hub
25919                .auth
25920                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25921                .await
25922            {
25923                Ok(token) => token,
25924                Err(e) => match dlg.token(e) {
25925                    Ok(token) => token,
25926                    Err(e) => {
25927                        dlg.finished(false);
25928                        return Err(common::Error::MissingToken(e));
25929                    }
25930                },
25931            };
25932            request_value_reader
25933                .seek(std::io::SeekFrom::Start(0))
25934                .unwrap();
25935            let mut req_result = {
25936                let client = &self.hub.client;
25937                dlg.pre_request();
25938                let mut req_builder = hyper::Request::builder()
25939                    .method(hyper::Method::POST)
25940                    .uri(url.as_str())
25941                    .header(USER_AGENT, self.hub._user_agent.clone());
25942
25943                if let Some(token) = token.as_ref() {
25944                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25945                }
25946
25947                let request = req_builder
25948                    .header(CONTENT_TYPE, json_mime_type.to_string())
25949                    .header(CONTENT_LENGTH, request_size as u64)
25950                    .body(common::to_body(
25951                        request_value_reader.get_ref().clone().into(),
25952                    ));
25953
25954                client.request(request.unwrap()).await
25955            };
25956
25957            match req_result {
25958                Err(err) => {
25959                    if let common::Retry::After(d) = dlg.http_error(&err) {
25960                        sleep(d).await;
25961                        continue;
25962                    }
25963                    dlg.finished(false);
25964                    return Err(common::Error::HttpError(err));
25965                }
25966                Ok(res) => {
25967                    let (mut parts, body) = res.into_parts();
25968                    let mut body = common::Body::new(body);
25969                    if !parts.status.is_success() {
25970                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25971                        let error = serde_json::from_str(&common::to_string(&bytes));
25972                        let response = common::to_response(parts, bytes.into());
25973
25974                        if let common::Retry::After(d) =
25975                            dlg.http_failure(&response, error.as_ref().ok())
25976                        {
25977                            sleep(d).await;
25978                            continue;
25979                        }
25980
25981                        dlg.finished(false);
25982
25983                        return Err(match error {
25984                            Ok(value) => common::Error::BadRequest(value),
25985                            _ => common::Error::Failure(response),
25986                        });
25987                    }
25988                    let response = {
25989                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25990                        let encoded = common::to_string(&bytes);
25991                        match serde_json::from_str(&encoded) {
25992                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25993                            Err(error) => {
25994                                dlg.response_json_decode_error(&encoded, &error);
25995                                return Err(common::Error::JsonDecodeError(
25996                                    encoded.to_string(),
25997                                    error,
25998                                ));
25999                            }
26000                        }
26001                    };
26002
26003                    dlg.finished(true);
26004                    return Ok(response);
26005                }
26006            }
26007        }
26008    }
26009
26010    ///
26011    /// Sets the *request* property to the given value.
26012    ///
26013    /// Even though the property as already been set when instantiating this call,
26014    /// we provide this method for API completeness.
26015    pub fn request(
26016        mut self,
26017        new_value: OrdersCancelLineItemRequest,
26018    ) -> OrderCancellineitemCall<'a, C> {
26019        self._request = new_value;
26020        self
26021    }
26022    /// The ID of the account that manages the order. This cannot be a multi-client account.
26023    ///
26024    /// Sets the *merchant id* path property to the given value.
26025    ///
26026    /// Even though the property as already been set when instantiating this call,
26027    /// we provide this method for API completeness.
26028    pub fn merchant_id(mut self, new_value: u64) -> OrderCancellineitemCall<'a, C> {
26029        self._merchant_id = new_value;
26030        self
26031    }
26032    /// The ID of the order.
26033    ///
26034    /// Sets the *order id* path property to the given value.
26035    ///
26036    /// Even though the property as already been set when instantiating this call,
26037    /// we provide this method for API completeness.
26038    pub fn order_id(mut self, new_value: &str) -> OrderCancellineitemCall<'a, C> {
26039        self._order_id = new_value.to_string();
26040        self
26041    }
26042    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26043    /// while executing the actual API request.
26044    ///
26045    /// ````text
26046    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26047    /// ````
26048    ///
26049    /// Sets the *delegate* property to the given value.
26050    pub fn delegate(
26051        mut self,
26052        new_value: &'a mut dyn common::Delegate,
26053    ) -> OrderCancellineitemCall<'a, C> {
26054        self._delegate = Some(new_value);
26055        self
26056    }
26057
26058    /// Set any additional parameter of the query string used in the request.
26059    /// It should be used to set parameters which are not yet available through their own
26060    /// setters.
26061    ///
26062    /// Please note that this method must not be used to set any of the known parameters
26063    /// which have their own setter method. If done anyway, the request will fail.
26064    ///
26065    /// # Additional Parameters
26066    ///
26067    /// * *$.xgafv* (query-string) - V1 error format.
26068    /// * *access_token* (query-string) - OAuth access token.
26069    /// * *alt* (query-string) - Data format for response.
26070    /// * *callback* (query-string) - JSONP
26071    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26072    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26073    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26074    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26075    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26076    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26077    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26078    pub fn param<T>(mut self, name: T, value: T) -> OrderCancellineitemCall<'a, C>
26079    where
26080        T: AsRef<str>,
26081    {
26082        self._additional_params
26083            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26084        self
26085    }
26086
26087    /// Identifies the authorization scope for the method you are building.
26088    ///
26089    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26090    /// [`Scope::Full`].
26091    ///
26092    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26093    /// tokens for more than one scope.
26094    ///
26095    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26096    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26097    /// sufficient, a read-write scope will do as well.
26098    pub fn add_scope<St>(mut self, scope: St) -> OrderCancellineitemCall<'a, C>
26099    where
26100        St: AsRef<str>,
26101    {
26102        self._scopes.insert(String::from(scope.as_ref()));
26103        self
26104    }
26105    /// Identifies the authorization scope(s) for the method you are building.
26106    ///
26107    /// See [`Self::add_scope()`] for details.
26108    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderCancellineitemCall<'a, C>
26109    where
26110        I: IntoIterator<Item = St>,
26111        St: AsRef<str>,
26112    {
26113        self._scopes
26114            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26115        self
26116    }
26117
26118    /// Removes all scopes, and no default scope will be used either.
26119    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26120    /// for details).
26121    pub fn clear_scopes(mut self) -> OrderCancellineitemCall<'a, C> {
26122        self._scopes.clear();
26123        self
26124    }
26125}
26126
26127/// Sandbox only. Cancels a test order for customer-initiated cancellation.
26128///
26129/// A builder for the *canceltestorderbycustomer* method supported by a *order* resource.
26130/// It is not used directly, but through a [`OrderMethods`] instance.
26131///
26132/// # Example
26133///
26134/// Instantiate a resource method builder
26135///
26136/// ```test_harness,no_run
26137/// # extern crate hyper;
26138/// # extern crate hyper_rustls;
26139/// # extern crate google_content2 as content2;
26140/// use content2::api::OrdersCancelTestOrderByCustomerRequest;
26141/// # async fn dox() {
26142/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26143///
26144/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26145/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26146/// #     .with_native_roots()
26147/// #     .unwrap()
26148/// #     .https_only()
26149/// #     .enable_http2()
26150/// #     .build();
26151///
26152/// # let executor = hyper_util::rt::TokioExecutor::new();
26153/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26154/// #     secret,
26155/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26156/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
26157/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
26158/// #     ),
26159/// # ).build().await.unwrap();
26160///
26161/// # let client = hyper_util::client::legacy::Client::builder(
26162/// #     hyper_util::rt::TokioExecutor::new()
26163/// # )
26164/// # .build(
26165/// #     hyper_rustls::HttpsConnectorBuilder::new()
26166/// #         .with_native_roots()
26167/// #         .unwrap()
26168/// #         .https_or_http()
26169/// #         .enable_http2()
26170/// #         .build()
26171/// # );
26172/// # let mut hub = ShoppingContent::new(client, auth);
26173/// // As the method needs a request, you would usually fill it with the desired information
26174/// // into the respective structure. Some of the parts shown here might not be applicable !
26175/// // Values shown here are possibly random and not representative !
26176/// let mut req = OrdersCancelTestOrderByCustomerRequest::default();
26177///
26178/// // You can configure optional parameters by calling the respective setters at will, and
26179/// // execute the final call using `doit()`.
26180/// // Values shown here are possibly random and not representative !
26181/// let result = hub.orders().canceltestorderbycustomer(req, 32, "orderId")
26182///              .doit().await;
26183/// # }
26184/// ```
26185pub struct OrderCanceltestorderbycustomerCall<'a, C>
26186where
26187    C: 'a,
26188{
26189    hub: &'a ShoppingContent<C>,
26190    _request: OrdersCancelTestOrderByCustomerRequest,
26191    _merchant_id: u64,
26192    _order_id: String,
26193    _delegate: Option<&'a mut dyn common::Delegate>,
26194    _additional_params: HashMap<String, String>,
26195    _scopes: BTreeSet<String>,
26196}
26197
26198impl<'a, C> common::CallBuilder for OrderCanceltestorderbycustomerCall<'a, C> {}
26199
26200impl<'a, C> OrderCanceltestorderbycustomerCall<'a, C>
26201where
26202    C: common::Connector,
26203{
26204    /// Perform the operation you have build so far.
26205    pub async fn doit(
26206        mut self,
26207    ) -> common::Result<(common::Response, OrdersCancelTestOrderByCustomerResponse)> {
26208        use std::borrow::Cow;
26209        use std::io::{Read, Seek};
26210
26211        use common::{url::Params, ToParts};
26212        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26213
26214        let mut dd = common::DefaultDelegate;
26215        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26216        dlg.begin(common::MethodInfo {
26217            id: "content.orders.canceltestorderbycustomer",
26218            http_method: hyper::Method::POST,
26219        });
26220
26221        for &field in ["alt", "merchantId", "orderId"].iter() {
26222            if self._additional_params.contains_key(field) {
26223                dlg.finished(false);
26224                return Err(common::Error::FieldClash(field));
26225            }
26226        }
26227
26228        let mut params = Params::with_capacity(5 + self._additional_params.len());
26229        params.push("merchantId", self._merchant_id.to_string());
26230        params.push("orderId", self._order_id);
26231
26232        params.extend(self._additional_params.iter());
26233
26234        params.push("alt", "json");
26235        let mut url =
26236            self.hub._base_url.clone() + "{merchantId}/testorders/{orderId}/cancelByCustomer";
26237        if self._scopes.is_empty() {
26238            self._scopes.insert(Scope::Full.as_ref().to_string());
26239        }
26240
26241        #[allow(clippy::single_element_loop)]
26242        for &(find_this, param_name) in
26243            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
26244        {
26245            url = params.uri_replacement(url, param_name, find_this, false);
26246        }
26247        {
26248            let to_remove = ["orderId", "merchantId"];
26249            params.remove_params(&to_remove);
26250        }
26251
26252        let url = params.parse_with_url(&url);
26253
26254        let mut json_mime_type = mime::APPLICATION_JSON;
26255        let mut request_value_reader = {
26256            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26257            common::remove_json_null_values(&mut value);
26258            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26259            serde_json::to_writer(&mut dst, &value).unwrap();
26260            dst
26261        };
26262        let request_size = request_value_reader
26263            .seek(std::io::SeekFrom::End(0))
26264            .unwrap();
26265        request_value_reader
26266            .seek(std::io::SeekFrom::Start(0))
26267            .unwrap();
26268
26269        loop {
26270            let token = match self
26271                .hub
26272                .auth
26273                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26274                .await
26275            {
26276                Ok(token) => token,
26277                Err(e) => match dlg.token(e) {
26278                    Ok(token) => token,
26279                    Err(e) => {
26280                        dlg.finished(false);
26281                        return Err(common::Error::MissingToken(e));
26282                    }
26283                },
26284            };
26285            request_value_reader
26286                .seek(std::io::SeekFrom::Start(0))
26287                .unwrap();
26288            let mut req_result = {
26289                let client = &self.hub.client;
26290                dlg.pre_request();
26291                let mut req_builder = hyper::Request::builder()
26292                    .method(hyper::Method::POST)
26293                    .uri(url.as_str())
26294                    .header(USER_AGENT, self.hub._user_agent.clone());
26295
26296                if let Some(token) = token.as_ref() {
26297                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26298                }
26299
26300                let request = req_builder
26301                    .header(CONTENT_TYPE, json_mime_type.to_string())
26302                    .header(CONTENT_LENGTH, request_size as u64)
26303                    .body(common::to_body(
26304                        request_value_reader.get_ref().clone().into(),
26305                    ));
26306
26307                client.request(request.unwrap()).await
26308            };
26309
26310            match req_result {
26311                Err(err) => {
26312                    if let common::Retry::After(d) = dlg.http_error(&err) {
26313                        sleep(d).await;
26314                        continue;
26315                    }
26316                    dlg.finished(false);
26317                    return Err(common::Error::HttpError(err));
26318                }
26319                Ok(res) => {
26320                    let (mut parts, body) = res.into_parts();
26321                    let mut body = common::Body::new(body);
26322                    if !parts.status.is_success() {
26323                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26324                        let error = serde_json::from_str(&common::to_string(&bytes));
26325                        let response = common::to_response(parts, bytes.into());
26326
26327                        if let common::Retry::After(d) =
26328                            dlg.http_failure(&response, error.as_ref().ok())
26329                        {
26330                            sleep(d).await;
26331                            continue;
26332                        }
26333
26334                        dlg.finished(false);
26335
26336                        return Err(match error {
26337                            Ok(value) => common::Error::BadRequest(value),
26338                            _ => common::Error::Failure(response),
26339                        });
26340                    }
26341                    let response = {
26342                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26343                        let encoded = common::to_string(&bytes);
26344                        match serde_json::from_str(&encoded) {
26345                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26346                            Err(error) => {
26347                                dlg.response_json_decode_error(&encoded, &error);
26348                                return Err(common::Error::JsonDecodeError(
26349                                    encoded.to_string(),
26350                                    error,
26351                                ));
26352                            }
26353                        }
26354                    };
26355
26356                    dlg.finished(true);
26357                    return Ok(response);
26358                }
26359            }
26360        }
26361    }
26362
26363    ///
26364    /// Sets the *request* property to the given value.
26365    ///
26366    /// Even though the property as already been set when instantiating this call,
26367    /// we provide this method for API completeness.
26368    pub fn request(
26369        mut self,
26370        new_value: OrdersCancelTestOrderByCustomerRequest,
26371    ) -> OrderCanceltestorderbycustomerCall<'a, C> {
26372        self._request = new_value;
26373        self
26374    }
26375    /// The ID of the account that manages the order. This cannot be a multi-client account.
26376    ///
26377    /// Sets the *merchant id* path property to the given value.
26378    ///
26379    /// Even though the property as already been set when instantiating this call,
26380    /// we provide this method for API completeness.
26381    pub fn merchant_id(mut self, new_value: u64) -> OrderCanceltestorderbycustomerCall<'a, C> {
26382        self._merchant_id = new_value;
26383        self
26384    }
26385    /// The ID of the test order to cancel.
26386    ///
26387    /// Sets the *order id* path property to the given value.
26388    ///
26389    /// Even though the property as already been set when instantiating this call,
26390    /// we provide this method for API completeness.
26391    pub fn order_id(mut self, new_value: &str) -> OrderCanceltestorderbycustomerCall<'a, C> {
26392        self._order_id = new_value.to_string();
26393        self
26394    }
26395    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26396    /// while executing the actual API request.
26397    ///
26398    /// ````text
26399    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26400    /// ````
26401    ///
26402    /// Sets the *delegate* property to the given value.
26403    pub fn delegate(
26404        mut self,
26405        new_value: &'a mut dyn common::Delegate,
26406    ) -> OrderCanceltestorderbycustomerCall<'a, C> {
26407        self._delegate = Some(new_value);
26408        self
26409    }
26410
26411    /// Set any additional parameter of the query string used in the request.
26412    /// It should be used to set parameters which are not yet available through their own
26413    /// setters.
26414    ///
26415    /// Please note that this method must not be used to set any of the known parameters
26416    /// which have their own setter method. If done anyway, the request will fail.
26417    ///
26418    /// # Additional Parameters
26419    ///
26420    /// * *$.xgafv* (query-string) - V1 error format.
26421    /// * *access_token* (query-string) - OAuth access token.
26422    /// * *alt* (query-string) - Data format for response.
26423    /// * *callback* (query-string) - JSONP
26424    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26425    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26426    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26427    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26428    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26429    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26430    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26431    pub fn param<T>(mut self, name: T, value: T) -> OrderCanceltestorderbycustomerCall<'a, C>
26432    where
26433        T: AsRef<str>,
26434    {
26435        self._additional_params
26436            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26437        self
26438    }
26439
26440    /// Identifies the authorization scope for the method you are building.
26441    ///
26442    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26443    /// [`Scope::Full`].
26444    ///
26445    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26446    /// tokens for more than one scope.
26447    ///
26448    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26449    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26450    /// sufficient, a read-write scope will do as well.
26451    pub fn add_scope<St>(mut self, scope: St) -> OrderCanceltestorderbycustomerCall<'a, C>
26452    where
26453        St: AsRef<str>,
26454    {
26455        self._scopes.insert(String::from(scope.as_ref()));
26456        self
26457    }
26458    /// Identifies the authorization scope(s) for the method you are building.
26459    ///
26460    /// See [`Self::add_scope()`] for details.
26461    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderCanceltestorderbycustomerCall<'a, C>
26462    where
26463        I: IntoIterator<Item = St>,
26464        St: AsRef<str>,
26465    {
26466        self._scopes
26467            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26468        self
26469    }
26470
26471    /// Removes all scopes, and no default scope will be used either.
26472    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26473    /// for details).
26474    pub fn clear_scopes(mut self) -> OrderCanceltestorderbycustomerCall<'a, C> {
26475        self._scopes.clear();
26476        self
26477    }
26478}
26479
26480/// Sandbox only. Creates a test order.
26481///
26482/// A builder for the *createtestorder* method supported by a *order* resource.
26483/// It is not used directly, but through a [`OrderMethods`] instance.
26484///
26485/// # Example
26486///
26487/// Instantiate a resource method builder
26488///
26489/// ```test_harness,no_run
26490/// # extern crate hyper;
26491/// # extern crate hyper_rustls;
26492/// # extern crate google_content2 as content2;
26493/// use content2::api::OrdersCreateTestOrderRequest;
26494/// # async fn dox() {
26495/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26496///
26497/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26498/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26499/// #     .with_native_roots()
26500/// #     .unwrap()
26501/// #     .https_only()
26502/// #     .enable_http2()
26503/// #     .build();
26504///
26505/// # let executor = hyper_util::rt::TokioExecutor::new();
26506/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26507/// #     secret,
26508/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26509/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
26510/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
26511/// #     ),
26512/// # ).build().await.unwrap();
26513///
26514/// # let client = hyper_util::client::legacy::Client::builder(
26515/// #     hyper_util::rt::TokioExecutor::new()
26516/// # )
26517/// # .build(
26518/// #     hyper_rustls::HttpsConnectorBuilder::new()
26519/// #         .with_native_roots()
26520/// #         .unwrap()
26521/// #         .https_or_http()
26522/// #         .enable_http2()
26523/// #         .build()
26524/// # );
26525/// # let mut hub = ShoppingContent::new(client, auth);
26526/// // As the method needs a request, you would usually fill it with the desired information
26527/// // into the respective structure. Some of the parts shown here might not be applicable !
26528/// // Values shown here are possibly random and not representative !
26529/// let mut req = OrdersCreateTestOrderRequest::default();
26530///
26531/// // You can configure optional parameters by calling the respective setters at will, and
26532/// // execute the final call using `doit()`.
26533/// // Values shown here are possibly random and not representative !
26534/// let result = hub.orders().createtestorder(req, 28)
26535///              .doit().await;
26536/// # }
26537/// ```
26538pub struct OrderCreatetestorderCall<'a, C>
26539where
26540    C: 'a,
26541{
26542    hub: &'a ShoppingContent<C>,
26543    _request: OrdersCreateTestOrderRequest,
26544    _merchant_id: u64,
26545    _delegate: Option<&'a mut dyn common::Delegate>,
26546    _additional_params: HashMap<String, String>,
26547    _scopes: BTreeSet<String>,
26548}
26549
26550impl<'a, C> common::CallBuilder for OrderCreatetestorderCall<'a, C> {}
26551
26552impl<'a, C> OrderCreatetestorderCall<'a, C>
26553where
26554    C: common::Connector,
26555{
26556    /// Perform the operation you have build so far.
26557    pub async fn doit(
26558        mut self,
26559    ) -> common::Result<(common::Response, OrdersCreateTestOrderResponse)> {
26560        use std::borrow::Cow;
26561        use std::io::{Read, Seek};
26562
26563        use common::{url::Params, ToParts};
26564        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26565
26566        let mut dd = common::DefaultDelegate;
26567        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26568        dlg.begin(common::MethodInfo {
26569            id: "content.orders.createtestorder",
26570            http_method: hyper::Method::POST,
26571        });
26572
26573        for &field in ["alt", "merchantId"].iter() {
26574            if self._additional_params.contains_key(field) {
26575                dlg.finished(false);
26576                return Err(common::Error::FieldClash(field));
26577            }
26578        }
26579
26580        let mut params = Params::with_capacity(4 + self._additional_params.len());
26581        params.push("merchantId", self._merchant_id.to_string());
26582
26583        params.extend(self._additional_params.iter());
26584
26585        params.push("alt", "json");
26586        let mut url = self.hub._base_url.clone() + "{merchantId}/testorders";
26587        if self._scopes.is_empty() {
26588            self._scopes.insert(Scope::Full.as_ref().to_string());
26589        }
26590
26591        #[allow(clippy::single_element_loop)]
26592        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
26593            url = params.uri_replacement(url, param_name, find_this, false);
26594        }
26595        {
26596            let to_remove = ["merchantId"];
26597            params.remove_params(&to_remove);
26598        }
26599
26600        let url = params.parse_with_url(&url);
26601
26602        let mut json_mime_type = mime::APPLICATION_JSON;
26603        let mut request_value_reader = {
26604            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26605            common::remove_json_null_values(&mut value);
26606            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26607            serde_json::to_writer(&mut dst, &value).unwrap();
26608            dst
26609        };
26610        let request_size = request_value_reader
26611            .seek(std::io::SeekFrom::End(0))
26612            .unwrap();
26613        request_value_reader
26614            .seek(std::io::SeekFrom::Start(0))
26615            .unwrap();
26616
26617        loop {
26618            let token = match self
26619                .hub
26620                .auth
26621                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26622                .await
26623            {
26624                Ok(token) => token,
26625                Err(e) => match dlg.token(e) {
26626                    Ok(token) => token,
26627                    Err(e) => {
26628                        dlg.finished(false);
26629                        return Err(common::Error::MissingToken(e));
26630                    }
26631                },
26632            };
26633            request_value_reader
26634                .seek(std::io::SeekFrom::Start(0))
26635                .unwrap();
26636            let mut req_result = {
26637                let client = &self.hub.client;
26638                dlg.pre_request();
26639                let mut req_builder = hyper::Request::builder()
26640                    .method(hyper::Method::POST)
26641                    .uri(url.as_str())
26642                    .header(USER_AGENT, self.hub._user_agent.clone());
26643
26644                if let Some(token) = token.as_ref() {
26645                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26646                }
26647
26648                let request = req_builder
26649                    .header(CONTENT_TYPE, json_mime_type.to_string())
26650                    .header(CONTENT_LENGTH, request_size as u64)
26651                    .body(common::to_body(
26652                        request_value_reader.get_ref().clone().into(),
26653                    ));
26654
26655                client.request(request.unwrap()).await
26656            };
26657
26658            match req_result {
26659                Err(err) => {
26660                    if let common::Retry::After(d) = dlg.http_error(&err) {
26661                        sleep(d).await;
26662                        continue;
26663                    }
26664                    dlg.finished(false);
26665                    return Err(common::Error::HttpError(err));
26666                }
26667                Ok(res) => {
26668                    let (mut parts, body) = res.into_parts();
26669                    let mut body = common::Body::new(body);
26670                    if !parts.status.is_success() {
26671                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26672                        let error = serde_json::from_str(&common::to_string(&bytes));
26673                        let response = common::to_response(parts, bytes.into());
26674
26675                        if let common::Retry::After(d) =
26676                            dlg.http_failure(&response, error.as_ref().ok())
26677                        {
26678                            sleep(d).await;
26679                            continue;
26680                        }
26681
26682                        dlg.finished(false);
26683
26684                        return Err(match error {
26685                            Ok(value) => common::Error::BadRequest(value),
26686                            _ => common::Error::Failure(response),
26687                        });
26688                    }
26689                    let response = {
26690                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26691                        let encoded = common::to_string(&bytes);
26692                        match serde_json::from_str(&encoded) {
26693                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26694                            Err(error) => {
26695                                dlg.response_json_decode_error(&encoded, &error);
26696                                return Err(common::Error::JsonDecodeError(
26697                                    encoded.to_string(),
26698                                    error,
26699                                ));
26700                            }
26701                        }
26702                    };
26703
26704                    dlg.finished(true);
26705                    return Ok(response);
26706                }
26707            }
26708        }
26709    }
26710
26711    ///
26712    /// Sets the *request* property to the given value.
26713    ///
26714    /// Even though the property as already been set when instantiating this call,
26715    /// we provide this method for API completeness.
26716    pub fn request(
26717        mut self,
26718        new_value: OrdersCreateTestOrderRequest,
26719    ) -> OrderCreatetestorderCall<'a, C> {
26720        self._request = new_value;
26721        self
26722    }
26723    /// The ID of the account that should manage the order. This cannot be a multi-client account.
26724    ///
26725    /// Sets the *merchant id* path property to the given value.
26726    ///
26727    /// Even though the property as already been set when instantiating this call,
26728    /// we provide this method for API completeness.
26729    pub fn merchant_id(mut self, new_value: u64) -> OrderCreatetestorderCall<'a, C> {
26730        self._merchant_id = new_value;
26731        self
26732    }
26733    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26734    /// while executing the actual API request.
26735    ///
26736    /// ````text
26737    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26738    /// ````
26739    ///
26740    /// Sets the *delegate* property to the given value.
26741    pub fn delegate(
26742        mut self,
26743        new_value: &'a mut dyn common::Delegate,
26744    ) -> OrderCreatetestorderCall<'a, C> {
26745        self._delegate = Some(new_value);
26746        self
26747    }
26748
26749    /// Set any additional parameter of the query string used in the request.
26750    /// It should be used to set parameters which are not yet available through their own
26751    /// setters.
26752    ///
26753    /// Please note that this method must not be used to set any of the known parameters
26754    /// which have their own setter method. If done anyway, the request will fail.
26755    ///
26756    /// # Additional Parameters
26757    ///
26758    /// * *$.xgafv* (query-string) - V1 error format.
26759    /// * *access_token* (query-string) - OAuth access token.
26760    /// * *alt* (query-string) - Data format for response.
26761    /// * *callback* (query-string) - JSONP
26762    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26763    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26764    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26765    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26766    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26767    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26768    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26769    pub fn param<T>(mut self, name: T, value: T) -> OrderCreatetestorderCall<'a, C>
26770    where
26771        T: AsRef<str>,
26772    {
26773        self._additional_params
26774            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26775        self
26776    }
26777
26778    /// Identifies the authorization scope for the method you are building.
26779    ///
26780    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26781    /// [`Scope::Full`].
26782    ///
26783    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26784    /// tokens for more than one scope.
26785    ///
26786    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26787    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26788    /// sufficient, a read-write scope will do as well.
26789    pub fn add_scope<St>(mut self, scope: St) -> OrderCreatetestorderCall<'a, C>
26790    where
26791        St: AsRef<str>,
26792    {
26793        self._scopes.insert(String::from(scope.as_ref()));
26794        self
26795    }
26796    /// Identifies the authorization scope(s) for the method you are building.
26797    ///
26798    /// See [`Self::add_scope()`] for details.
26799    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderCreatetestorderCall<'a, C>
26800    where
26801        I: IntoIterator<Item = St>,
26802        St: AsRef<str>,
26803    {
26804        self._scopes
26805            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26806        self
26807    }
26808
26809    /// Removes all scopes, and no default scope will be used either.
26810    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26811    /// for details).
26812    pub fn clear_scopes(mut self) -> OrderCreatetestorderCall<'a, C> {
26813        self._scopes.clear();
26814        self
26815    }
26816}
26817
26818/// Sandbox only. Creates a test return.
26819///
26820/// A builder for the *createtestreturn* method supported by a *order* resource.
26821/// It is not used directly, but through a [`OrderMethods`] instance.
26822///
26823/// # Example
26824///
26825/// Instantiate a resource method builder
26826///
26827/// ```test_harness,no_run
26828/// # extern crate hyper;
26829/// # extern crate hyper_rustls;
26830/// # extern crate google_content2 as content2;
26831/// use content2::api::OrdersCreateTestReturnRequest;
26832/// # async fn dox() {
26833/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26834///
26835/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26836/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26837/// #     .with_native_roots()
26838/// #     .unwrap()
26839/// #     .https_only()
26840/// #     .enable_http2()
26841/// #     .build();
26842///
26843/// # let executor = hyper_util::rt::TokioExecutor::new();
26844/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26845/// #     secret,
26846/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26847/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
26848/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
26849/// #     ),
26850/// # ).build().await.unwrap();
26851///
26852/// # let client = hyper_util::client::legacy::Client::builder(
26853/// #     hyper_util::rt::TokioExecutor::new()
26854/// # )
26855/// # .build(
26856/// #     hyper_rustls::HttpsConnectorBuilder::new()
26857/// #         .with_native_roots()
26858/// #         .unwrap()
26859/// #         .https_or_http()
26860/// #         .enable_http2()
26861/// #         .build()
26862/// # );
26863/// # let mut hub = ShoppingContent::new(client, auth);
26864/// // As the method needs a request, you would usually fill it with the desired information
26865/// // into the respective structure. Some of the parts shown here might not be applicable !
26866/// // Values shown here are possibly random and not representative !
26867/// let mut req = OrdersCreateTestReturnRequest::default();
26868///
26869/// // You can configure optional parameters by calling the respective setters at will, and
26870/// // execute the final call using `doit()`.
26871/// // Values shown here are possibly random and not representative !
26872/// let result = hub.orders().createtestreturn(req, 91, "orderId")
26873///              .doit().await;
26874/// # }
26875/// ```
26876pub struct OrderCreatetestreturnCall<'a, C>
26877where
26878    C: 'a,
26879{
26880    hub: &'a ShoppingContent<C>,
26881    _request: OrdersCreateTestReturnRequest,
26882    _merchant_id: u64,
26883    _order_id: String,
26884    _delegate: Option<&'a mut dyn common::Delegate>,
26885    _additional_params: HashMap<String, String>,
26886    _scopes: BTreeSet<String>,
26887}
26888
26889impl<'a, C> common::CallBuilder for OrderCreatetestreturnCall<'a, C> {}
26890
26891impl<'a, C> OrderCreatetestreturnCall<'a, C>
26892where
26893    C: common::Connector,
26894{
26895    /// Perform the operation you have build so far.
26896    pub async fn doit(
26897        mut self,
26898    ) -> common::Result<(common::Response, OrdersCreateTestReturnResponse)> {
26899        use std::borrow::Cow;
26900        use std::io::{Read, Seek};
26901
26902        use common::{url::Params, ToParts};
26903        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26904
26905        let mut dd = common::DefaultDelegate;
26906        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26907        dlg.begin(common::MethodInfo {
26908            id: "content.orders.createtestreturn",
26909            http_method: hyper::Method::POST,
26910        });
26911
26912        for &field in ["alt", "merchantId", "orderId"].iter() {
26913            if self._additional_params.contains_key(field) {
26914                dlg.finished(false);
26915                return Err(common::Error::FieldClash(field));
26916            }
26917        }
26918
26919        let mut params = Params::with_capacity(5 + self._additional_params.len());
26920        params.push("merchantId", self._merchant_id.to_string());
26921        params.push("orderId", self._order_id);
26922
26923        params.extend(self._additional_params.iter());
26924
26925        params.push("alt", "json");
26926        let mut url = self.hub._base_url.clone() + "{merchantId}/orders/{orderId}/testreturn";
26927        if self._scopes.is_empty() {
26928            self._scopes.insert(Scope::Full.as_ref().to_string());
26929        }
26930
26931        #[allow(clippy::single_element_loop)]
26932        for &(find_this, param_name) in
26933            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
26934        {
26935            url = params.uri_replacement(url, param_name, find_this, false);
26936        }
26937        {
26938            let to_remove = ["orderId", "merchantId"];
26939            params.remove_params(&to_remove);
26940        }
26941
26942        let url = params.parse_with_url(&url);
26943
26944        let mut json_mime_type = mime::APPLICATION_JSON;
26945        let mut request_value_reader = {
26946            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26947            common::remove_json_null_values(&mut value);
26948            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26949            serde_json::to_writer(&mut dst, &value).unwrap();
26950            dst
26951        };
26952        let request_size = request_value_reader
26953            .seek(std::io::SeekFrom::End(0))
26954            .unwrap();
26955        request_value_reader
26956            .seek(std::io::SeekFrom::Start(0))
26957            .unwrap();
26958
26959        loop {
26960            let token = match self
26961                .hub
26962                .auth
26963                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26964                .await
26965            {
26966                Ok(token) => token,
26967                Err(e) => match dlg.token(e) {
26968                    Ok(token) => token,
26969                    Err(e) => {
26970                        dlg.finished(false);
26971                        return Err(common::Error::MissingToken(e));
26972                    }
26973                },
26974            };
26975            request_value_reader
26976                .seek(std::io::SeekFrom::Start(0))
26977                .unwrap();
26978            let mut req_result = {
26979                let client = &self.hub.client;
26980                dlg.pre_request();
26981                let mut req_builder = hyper::Request::builder()
26982                    .method(hyper::Method::POST)
26983                    .uri(url.as_str())
26984                    .header(USER_AGENT, self.hub._user_agent.clone());
26985
26986                if let Some(token) = token.as_ref() {
26987                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26988                }
26989
26990                let request = req_builder
26991                    .header(CONTENT_TYPE, json_mime_type.to_string())
26992                    .header(CONTENT_LENGTH, request_size as u64)
26993                    .body(common::to_body(
26994                        request_value_reader.get_ref().clone().into(),
26995                    ));
26996
26997                client.request(request.unwrap()).await
26998            };
26999
27000            match req_result {
27001                Err(err) => {
27002                    if let common::Retry::After(d) = dlg.http_error(&err) {
27003                        sleep(d).await;
27004                        continue;
27005                    }
27006                    dlg.finished(false);
27007                    return Err(common::Error::HttpError(err));
27008                }
27009                Ok(res) => {
27010                    let (mut parts, body) = res.into_parts();
27011                    let mut body = common::Body::new(body);
27012                    if !parts.status.is_success() {
27013                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27014                        let error = serde_json::from_str(&common::to_string(&bytes));
27015                        let response = common::to_response(parts, bytes.into());
27016
27017                        if let common::Retry::After(d) =
27018                            dlg.http_failure(&response, error.as_ref().ok())
27019                        {
27020                            sleep(d).await;
27021                            continue;
27022                        }
27023
27024                        dlg.finished(false);
27025
27026                        return Err(match error {
27027                            Ok(value) => common::Error::BadRequest(value),
27028                            _ => common::Error::Failure(response),
27029                        });
27030                    }
27031                    let response = {
27032                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27033                        let encoded = common::to_string(&bytes);
27034                        match serde_json::from_str(&encoded) {
27035                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27036                            Err(error) => {
27037                                dlg.response_json_decode_error(&encoded, &error);
27038                                return Err(common::Error::JsonDecodeError(
27039                                    encoded.to_string(),
27040                                    error,
27041                                ));
27042                            }
27043                        }
27044                    };
27045
27046                    dlg.finished(true);
27047                    return Ok(response);
27048                }
27049            }
27050        }
27051    }
27052
27053    ///
27054    /// Sets the *request* property to the given value.
27055    ///
27056    /// Even though the property as already been set when instantiating this call,
27057    /// we provide this method for API completeness.
27058    pub fn request(
27059        mut self,
27060        new_value: OrdersCreateTestReturnRequest,
27061    ) -> OrderCreatetestreturnCall<'a, C> {
27062        self._request = new_value;
27063        self
27064    }
27065    /// The ID of the account that manages the order. This cannot be a multi-client account.
27066    ///
27067    /// Sets the *merchant id* path property to the given value.
27068    ///
27069    /// Even though the property as already been set when instantiating this call,
27070    /// we provide this method for API completeness.
27071    pub fn merchant_id(mut self, new_value: u64) -> OrderCreatetestreturnCall<'a, C> {
27072        self._merchant_id = new_value;
27073        self
27074    }
27075    /// The ID of the order.
27076    ///
27077    /// Sets the *order id* path property to the given value.
27078    ///
27079    /// Even though the property as already been set when instantiating this call,
27080    /// we provide this method for API completeness.
27081    pub fn order_id(mut self, new_value: &str) -> OrderCreatetestreturnCall<'a, C> {
27082        self._order_id = new_value.to_string();
27083        self
27084    }
27085    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27086    /// while executing the actual API request.
27087    ///
27088    /// ````text
27089    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27090    /// ````
27091    ///
27092    /// Sets the *delegate* property to the given value.
27093    pub fn delegate(
27094        mut self,
27095        new_value: &'a mut dyn common::Delegate,
27096    ) -> OrderCreatetestreturnCall<'a, C> {
27097        self._delegate = Some(new_value);
27098        self
27099    }
27100
27101    /// Set any additional parameter of the query string used in the request.
27102    /// It should be used to set parameters which are not yet available through their own
27103    /// setters.
27104    ///
27105    /// Please note that this method must not be used to set any of the known parameters
27106    /// which have their own setter method. If done anyway, the request will fail.
27107    ///
27108    /// # Additional Parameters
27109    ///
27110    /// * *$.xgafv* (query-string) - V1 error format.
27111    /// * *access_token* (query-string) - OAuth access token.
27112    /// * *alt* (query-string) - Data format for response.
27113    /// * *callback* (query-string) - JSONP
27114    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27115    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
27116    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27117    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27118    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
27119    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27120    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27121    pub fn param<T>(mut self, name: T, value: T) -> OrderCreatetestreturnCall<'a, C>
27122    where
27123        T: AsRef<str>,
27124    {
27125        self._additional_params
27126            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27127        self
27128    }
27129
27130    /// Identifies the authorization scope for the method you are building.
27131    ///
27132    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27133    /// [`Scope::Full`].
27134    ///
27135    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27136    /// tokens for more than one scope.
27137    ///
27138    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27139    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27140    /// sufficient, a read-write scope will do as well.
27141    pub fn add_scope<St>(mut self, scope: St) -> OrderCreatetestreturnCall<'a, C>
27142    where
27143        St: AsRef<str>,
27144    {
27145        self._scopes.insert(String::from(scope.as_ref()));
27146        self
27147    }
27148    /// Identifies the authorization scope(s) for the method you are building.
27149    ///
27150    /// See [`Self::add_scope()`] for details.
27151    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderCreatetestreturnCall<'a, C>
27152    where
27153        I: IntoIterator<Item = St>,
27154        St: AsRef<str>,
27155    {
27156        self._scopes
27157            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27158        self
27159    }
27160
27161    /// Removes all scopes, and no default scope will be used either.
27162    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27163    /// for details).
27164    pub fn clear_scopes(mut self) -> OrderCreatetestreturnCall<'a, C> {
27165        self._scopes.clear();
27166        self
27167    }
27168}
27169
27170/// Retrieves or modifies multiple orders in a single request.
27171///
27172/// A builder for the *custombatch* method supported by a *order* resource.
27173/// It is not used directly, but through a [`OrderMethods`] instance.
27174///
27175/// # Example
27176///
27177/// Instantiate a resource method builder
27178///
27179/// ```test_harness,no_run
27180/// # extern crate hyper;
27181/// # extern crate hyper_rustls;
27182/// # extern crate google_content2 as content2;
27183/// use content2::api::OrdersCustomBatchRequest;
27184/// # async fn dox() {
27185/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27186///
27187/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27188/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27189/// #     .with_native_roots()
27190/// #     .unwrap()
27191/// #     .https_only()
27192/// #     .enable_http2()
27193/// #     .build();
27194///
27195/// # let executor = hyper_util::rt::TokioExecutor::new();
27196/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27197/// #     secret,
27198/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27199/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
27200/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
27201/// #     ),
27202/// # ).build().await.unwrap();
27203///
27204/// # let client = hyper_util::client::legacy::Client::builder(
27205/// #     hyper_util::rt::TokioExecutor::new()
27206/// # )
27207/// # .build(
27208/// #     hyper_rustls::HttpsConnectorBuilder::new()
27209/// #         .with_native_roots()
27210/// #         .unwrap()
27211/// #         .https_or_http()
27212/// #         .enable_http2()
27213/// #         .build()
27214/// # );
27215/// # let mut hub = ShoppingContent::new(client, auth);
27216/// // As the method needs a request, you would usually fill it with the desired information
27217/// // into the respective structure. Some of the parts shown here might not be applicable !
27218/// // Values shown here are possibly random and not representative !
27219/// let mut req = OrdersCustomBatchRequest::default();
27220///
27221/// // You can configure optional parameters by calling the respective setters at will, and
27222/// // execute the final call using `doit()`.
27223/// // Values shown here are possibly random and not representative !
27224/// let result = hub.orders().custombatch(req)
27225///              .doit().await;
27226/// # }
27227/// ```
27228pub struct OrderCustombatchCall<'a, C>
27229where
27230    C: 'a,
27231{
27232    hub: &'a ShoppingContent<C>,
27233    _request: OrdersCustomBatchRequest,
27234    _delegate: Option<&'a mut dyn common::Delegate>,
27235    _additional_params: HashMap<String, String>,
27236    _scopes: BTreeSet<String>,
27237}
27238
27239impl<'a, C> common::CallBuilder for OrderCustombatchCall<'a, C> {}
27240
27241impl<'a, C> OrderCustombatchCall<'a, C>
27242where
27243    C: common::Connector,
27244{
27245    /// Perform the operation you have build so far.
27246    pub async fn doit(mut self) -> common::Result<(common::Response, OrdersCustomBatchResponse)> {
27247        use std::borrow::Cow;
27248        use std::io::{Read, Seek};
27249
27250        use common::{url::Params, ToParts};
27251        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27252
27253        let mut dd = common::DefaultDelegate;
27254        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27255        dlg.begin(common::MethodInfo {
27256            id: "content.orders.custombatch",
27257            http_method: hyper::Method::POST,
27258        });
27259
27260        for &field in ["alt"].iter() {
27261            if self._additional_params.contains_key(field) {
27262                dlg.finished(false);
27263                return Err(common::Error::FieldClash(field));
27264            }
27265        }
27266
27267        let mut params = Params::with_capacity(3 + self._additional_params.len());
27268
27269        params.extend(self._additional_params.iter());
27270
27271        params.push("alt", "json");
27272        let mut url = self.hub._base_url.clone() + "orders/batch";
27273        if self._scopes.is_empty() {
27274            self._scopes.insert(Scope::Full.as_ref().to_string());
27275        }
27276
27277        let url = params.parse_with_url(&url);
27278
27279        let mut json_mime_type = mime::APPLICATION_JSON;
27280        let mut request_value_reader = {
27281            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27282            common::remove_json_null_values(&mut value);
27283            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27284            serde_json::to_writer(&mut dst, &value).unwrap();
27285            dst
27286        };
27287        let request_size = request_value_reader
27288            .seek(std::io::SeekFrom::End(0))
27289            .unwrap();
27290        request_value_reader
27291            .seek(std::io::SeekFrom::Start(0))
27292            .unwrap();
27293
27294        loop {
27295            let token = match self
27296                .hub
27297                .auth
27298                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27299                .await
27300            {
27301                Ok(token) => token,
27302                Err(e) => match dlg.token(e) {
27303                    Ok(token) => token,
27304                    Err(e) => {
27305                        dlg.finished(false);
27306                        return Err(common::Error::MissingToken(e));
27307                    }
27308                },
27309            };
27310            request_value_reader
27311                .seek(std::io::SeekFrom::Start(0))
27312                .unwrap();
27313            let mut req_result = {
27314                let client = &self.hub.client;
27315                dlg.pre_request();
27316                let mut req_builder = hyper::Request::builder()
27317                    .method(hyper::Method::POST)
27318                    .uri(url.as_str())
27319                    .header(USER_AGENT, self.hub._user_agent.clone());
27320
27321                if let Some(token) = token.as_ref() {
27322                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27323                }
27324
27325                let request = req_builder
27326                    .header(CONTENT_TYPE, json_mime_type.to_string())
27327                    .header(CONTENT_LENGTH, request_size as u64)
27328                    .body(common::to_body(
27329                        request_value_reader.get_ref().clone().into(),
27330                    ));
27331
27332                client.request(request.unwrap()).await
27333            };
27334
27335            match req_result {
27336                Err(err) => {
27337                    if let common::Retry::After(d) = dlg.http_error(&err) {
27338                        sleep(d).await;
27339                        continue;
27340                    }
27341                    dlg.finished(false);
27342                    return Err(common::Error::HttpError(err));
27343                }
27344                Ok(res) => {
27345                    let (mut parts, body) = res.into_parts();
27346                    let mut body = common::Body::new(body);
27347                    if !parts.status.is_success() {
27348                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27349                        let error = serde_json::from_str(&common::to_string(&bytes));
27350                        let response = common::to_response(parts, bytes.into());
27351
27352                        if let common::Retry::After(d) =
27353                            dlg.http_failure(&response, error.as_ref().ok())
27354                        {
27355                            sleep(d).await;
27356                            continue;
27357                        }
27358
27359                        dlg.finished(false);
27360
27361                        return Err(match error {
27362                            Ok(value) => common::Error::BadRequest(value),
27363                            _ => common::Error::Failure(response),
27364                        });
27365                    }
27366                    let response = {
27367                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27368                        let encoded = common::to_string(&bytes);
27369                        match serde_json::from_str(&encoded) {
27370                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27371                            Err(error) => {
27372                                dlg.response_json_decode_error(&encoded, &error);
27373                                return Err(common::Error::JsonDecodeError(
27374                                    encoded.to_string(),
27375                                    error,
27376                                ));
27377                            }
27378                        }
27379                    };
27380
27381                    dlg.finished(true);
27382                    return Ok(response);
27383                }
27384            }
27385        }
27386    }
27387
27388    ///
27389    /// Sets the *request* property to the given value.
27390    ///
27391    /// Even though the property as already been set when instantiating this call,
27392    /// we provide this method for API completeness.
27393    pub fn request(mut self, new_value: OrdersCustomBatchRequest) -> OrderCustombatchCall<'a, C> {
27394        self._request = new_value;
27395        self
27396    }
27397    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27398    /// while executing the actual API request.
27399    ///
27400    /// ````text
27401    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27402    /// ````
27403    ///
27404    /// Sets the *delegate* property to the given value.
27405    pub fn delegate(
27406        mut self,
27407        new_value: &'a mut dyn common::Delegate,
27408    ) -> OrderCustombatchCall<'a, C> {
27409        self._delegate = Some(new_value);
27410        self
27411    }
27412
27413    /// Set any additional parameter of the query string used in the request.
27414    /// It should be used to set parameters which are not yet available through their own
27415    /// setters.
27416    ///
27417    /// Please note that this method must not be used to set any of the known parameters
27418    /// which have their own setter method. If done anyway, the request will fail.
27419    ///
27420    /// # Additional Parameters
27421    ///
27422    /// * *$.xgafv* (query-string) - V1 error format.
27423    /// * *access_token* (query-string) - OAuth access token.
27424    /// * *alt* (query-string) - Data format for response.
27425    /// * *callback* (query-string) - JSONP
27426    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27427    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
27428    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27429    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27430    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
27431    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27432    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27433    pub fn param<T>(mut self, name: T, value: T) -> OrderCustombatchCall<'a, C>
27434    where
27435        T: AsRef<str>,
27436    {
27437        self._additional_params
27438            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27439        self
27440    }
27441
27442    /// Identifies the authorization scope for the method you are building.
27443    ///
27444    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27445    /// [`Scope::Full`].
27446    ///
27447    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27448    /// tokens for more than one scope.
27449    ///
27450    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27451    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27452    /// sufficient, a read-write scope will do as well.
27453    pub fn add_scope<St>(mut self, scope: St) -> OrderCustombatchCall<'a, C>
27454    where
27455        St: AsRef<str>,
27456    {
27457        self._scopes.insert(String::from(scope.as_ref()));
27458        self
27459    }
27460    /// Identifies the authorization scope(s) for the method you are building.
27461    ///
27462    /// See [`Self::add_scope()`] for details.
27463    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderCustombatchCall<'a, C>
27464    where
27465        I: IntoIterator<Item = St>,
27466        St: AsRef<str>,
27467    {
27468        self._scopes
27469            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27470        self
27471    }
27472
27473    /// Removes all scopes, and no default scope will be used either.
27474    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27475    /// for details).
27476    pub fn clear_scopes(mut self) -> OrderCustombatchCall<'a, C> {
27477        self._scopes.clear();
27478        self
27479    }
27480}
27481
27482/// Retrieves an order from your Merchant Center account.
27483///
27484/// A builder for the *get* method supported by a *order* resource.
27485/// It is not used directly, but through a [`OrderMethods`] instance.
27486///
27487/// # Example
27488///
27489/// Instantiate a resource method builder
27490///
27491/// ```test_harness,no_run
27492/// # extern crate hyper;
27493/// # extern crate hyper_rustls;
27494/// # extern crate google_content2 as content2;
27495/// # async fn dox() {
27496/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27497///
27498/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27499/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27500/// #     .with_native_roots()
27501/// #     .unwrap()
27502/// #     .https_only()
27503/// #     .enable_http2()
27504/// #     .build();
27505///
27506/// # let executor = hyper_util::rt::TokioExecutor::new();
27507/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27508/// #     secret,
27509/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27510/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
27511/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
27512/// #     ),
27513/// # ).build().await.unwrap();
27514///
27515/// # let client = hyper_util::client::legacy::Client::builder(
27516/// #     hyper_util::rt::TokioExecutor::new()
27517/// # )
27518/// # .build(
27519/// #     hyper_rustls::HttpsConnectorBuilder::new()
27520/// #         .with_native_roots()
27521/// #         .unwrap()
27522/// #         .https_or_http()
27523/// #         .enable_http2()
27524/// #         .build()
27525/// # );
27526/// # let mut hub = ShoppingContent::new(client, auth);
27527/// // You can configure optional parameters by calling the respective setters at will, and
27528/// // execute the final call using `doit()`.
27529/// // Values shown here are possibly random and not representative !
27530/// let result = hub.orders().get(50, "orderId")
27531///              .doit().await;
27532/// # }
27533/// ```
27534pub struct OrderGetCall<'a, C>
27535where
27536    C: 'a,
27537{
27538    hub: &'a ShoppingContent<C>,
27539    _merchant_id: u64,
27540    _order_id: String,
27541    _delegate: Option<&'a mut dyn common::Delegate>,
27542    _additional_params: HashMap<String, String>,
27543    _scopes: BTreeSet<String>,
27544}
27545
27546impl<'a, C> common::CallBuilder for OrderGetCall<'a, C> {}
27547
27548impl<'a, C> OrderGetCall<'a, C>
27549where
27550    C: common::Connector,
27551{
27552    /// Perform the operation you have build so far.
27553    pub async fn doit(mut self) -> common::Result<(common::Response, Order)> {
27554        use std::borrow::Cow;
27555        use std::io::{Read, Seek};
27556
27557        use common::{url::Params, ToParts};
27558        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27559
27560        let mut dd = common::DefaultDelegate;
27561        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27562        dlg.begin(common::MethodInfo {
27563            id: "content.orders.get",
27564            http_method: hyper::Method::GET,
27565        });
27566
27567        for &field in ["alt", "merchantId", "orderId"].iter() {
27568            if self._additional_params.contains_key(field) {
27569                dlg.finished(false);
27570                return Err(common::Error::FieldClash(field));
27571            }
27572        }
27573
27574        let mut params = Params::with_capacity(4 + self._additional_params.len());
27575        params.push("merchantId", self._merchant_id.to_string());
27576        params.push("orderId", self._order_id);
27577
27578        params.extend(self._additional_params.iter());
27579
27580        params.push("alt", "json");
27581        let mut url = self.hub._base_url.clone() + "{merchantId}/orders/{orderId}";
27582        if self._scopes.is_empty() {
27583            self._scopes.insert(Scope::Full.as_ref().to_string());
27584        }
27585
27586        #[allow(clippy::single_element_loop)]
27587        for &(find_this, param_name) in
27588            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
27589        {
27590            url = params.uri_replacement(url, param_name, find_this, false);
27591        }
27592        {
27593            let to_remove = ["orderId", "merchantId"];
27594            params.remove_params(&to_remove);
27595        }
27596
27597        let url = params.parse_with_url(&url);
27598
27599        loop {
27600            let token = match self
27601                .hub
27602                .auth
27603                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27604                .await
27605            {
27606                Ok(token) => token,
27607                Err(e) => match dlg.token(e) {
27608                    Ok(token) => token,
27609                    Err(e) => {
27610                        dlg.finished(false);
27611                        return Err(common::Error::MissingToken(e));
27612                    }
27613                },
27614            };
27615            let mut req_result = {
27616                let client = &self.hub.client;
27617                dlg.pre_request();
27618                let mut req_builder = hyper::Request::builder()
27619                    .method(hyper::Method::GET)
27620                    .uri(url.as_str())
27621                    .header(USER_AGENT, self.hub._user_agent.clone());
27622
27623                if let Some(token) = token.as_ref() {
27624                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27625                }
27626
27627                let request = req_builder
27628                    .header(CONTENT_LENGTH, 0_u64)
27629                    .body(common::to_body::<String>(None));
27630
27631                client.request(request.unwrap()).await
27632            };
27633
27634            match req_result {
27635                Err(err) => {
27636                    if let common::Retry::After(d) = dlg.http_error(&err) {
27637                        sleep(d).await;
27638                        continue;
27639                    }
27640                    dlg.finished(false);
27641                    return Err(common::Error::HttpError(err));
27642                }
27643                Ok(res) => {
27644                    let (mut parts, body) = res.into_parts();
27645                    let mut body = common::Body::new(body);
27646                    if !parts.status.is_success() {
27647                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27648                        let error = serde_json::from_str(&common::to_string(&bytes));
27649                        let response = common::to_response(parts, bytes.into());
27650
27651                        if let common::Retry::After(d) =
27652                            dlg.http_failure(&response, error.as_ref().ok())
27653                        {
27654                            sleep(d).await;
27655                            continue;
27656                        }
27657
27658                        dlg.finished(false);
27659
27660                        return Err(match error {
27661                            Ok(value) => common::Error::BadRequest(value),
27662                            _ => common::Error::Failure(response),
27663                        });
27664                    }
27665                    let response = {
27666                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27667                        let encoded = common::to_string(&bytes);
27668                        match serde_json::from_str(&encoded) {
27669                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27670                            Err(error) => {
27671                                dlg.response_json_decode_error(&encoded, &error);
27672                                return Err(common::Error::JsonDecodeError(
27673                                    encoded.to_string(),
27674                                    error,
27675                                ));
27676                            }
27677                        }
27678                    };
27679
27680                    dlg.finished(true);
27681                    return Ok(response);
27682                }
27683            }
27684        }
27685    }
27686
27687    /// The ID of the account that manages the order. This cannot be a multi-client account.
27688    ///
27689    /// Sets the *merchant id* path property to the given value.
27690    ///
27691    /// Even though the property as already been set when instantiating this call,
27692    /// we provide this method for API completeness.
27693    pub fn merchant_id(mut self, new_value: u64) -> OrderGetCall<'a, C> {
27694        self._merchant_id = new_value;
27695        self
27696    }
27697    /// The ID of the order.
27698    ///
27699    /// Sets the *order id* path property to the given value.
27700    ///
27701    /// Even though the property as already been set when instantiating this call,
27702    /// we provide this method for API completeness.
27703    pub fn order_id(mut self, new_value: &str) -> OrderGetCall<'a, C> {
27704        self._order_id = new_value.to_string();
27705        self
27706    }
27707    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27708    /// while executing the actual API request.
27709    ///
27710    /// ````text
27711    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27712    /// ````
27713    ///
27714    /// Sets the *delegate* property to the given value.
27715    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OrderGetCall<'a, C> {
27716        self._delegate = Some(new_value);
27717        self
27718    }
27719
27720    /// Set any additional parameter of the query string used in the request.
27721    /// It should be used to set parameters which are not yet available through their own
27722    /// setters.
27723    ///
27724    /// Please note that this method must not be used to set any of the known parameters
27725    /// which have their own setter method. If done anyway, the request will fail.
27726    ///
27727    /// # Additional Parameters
27728    ///
27729    /// * *$.xgafv* (query-string) - V1 error format.
27730    /// * *access_token* (query-string) - OAuth access token.
27731    /// * *alt* (query-string) - Data format for response.
27732    /// * *callback* (query-string) - JSONP
27733    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27734    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
27735    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27736    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27737    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
27738    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27739    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27740    pub fn param<T>(mut self, name: T, value: T) -> OrderGetCall<'a, C>
27741    where
27742        T: AsRef<str>,
27743    {
27744        self._additional_params
27745            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27746        self
27747    }
27748
27749    /// Identifies the authorization scope for the method you are building.
27750    ///
27751    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27752    /// [`Scope::Full`].
27753    ///
27754    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27755    /// tokens for more than one scope.
27756    ///
27757    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27758    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27759    /// sufficient, a read-write scope will do as well.
27760    pub fn add_scope<St>(mut self, scope: St) -> OrderGetCall<'a, C>
27761    where
27762        St: AsRef<str>,
27763    {
27764        self._scopes.insert(String::from(scope.as_ref()));
27765        self
27766    }
27767    /// Identifies the authorization scope(s) for the method you are building.
27768    ///
27769    /// See [`Self::add_scope()`] for details.
27770    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderGetCall<'a, C>
27771    where
27772        I: IntoIterator<Item = St>,
27773        St: AsRef<str>,
27774    {
27775        self._scopes
27776            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27777        self
27778    }
27779
27780    /// Removes all scopes, and no default scope will be used either.
27781    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27782    /// for details).
27783    pub fn clear_scopes(mut self) -> OrderGetCall<'a, C> {
27784        self._scopes.clear();
27785        self
27786    }
27787}
27788
27789/// Retrieves an order using merchant order ID.
27790///
27791/// A builder for the *getbymerchantorderid* method supported by a *order* resource.
27792/// It is not used directly, but through a [`OrderMethods`] instance.
27793///
27794/// # Example
27795///
27796/// Instantiate a resource method builder
27797///
27798/// ```test_harness,no_run
27799/// # extern crate hyper;
27800/// # extern crate hyper_rustls;
27801/// # extern crate google_content2 as content2;
27802/// # async fn dox() {
27803/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27804///
27805/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27806/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27807/// #     .with_native_roots()
27808/// #     .unwrap()
27809/// #     .https_only()
27810/// #     .enable_http2()
27811/// #     .build();
27812///
27813/// # let executor = hyper_util::rt::TokioExecutor::new();
27814/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27815/// #     secret,
27816/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27817/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
27818/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
27819/// #     ),
27820/// # ).build().await.unwrap();
27821///
27822/// # let client = hyper_util::client::legacy::Client::builder(
27823/// #     hyper_util::rt::TokioExecutor::new()
27824/// # )
27825/// # .build(
27826/// #     hyper_rustls::HttpsConnectorBuilder::new()
27827/// #         .with_native_roots()
27828/// #         .unwrap()
27829/// #         .https_or_http()
27830/// #         .enable_http2()
27831/// #         .build()
27832/// # );
27833/// # let mut hub = ShoppingContent::new(client, auth);
27834/// // You can configure optional parameters by calling the respective setters at will, and
27835/// // execute the final call using `doit()`.
27836/// // Values shown here are possibly random and not representative !
27837/// let result = hub.orders().getbymerchantorderid(24, "merchantOrderId")
27838///              .doit().await;
27839/// # }
27840/// ```
27841pub struct OrderGetbymerchantorderidCall<'a, C>
27842where
27843    C: 'a,
27844{
27845    hub: &'a ShoppingContent<C>,
27846    _merchant_id: u64,
27847    _merchant_order_id: String,
27848    _delegate: Option<&'a mut dyn common::Delegate>,
27849    _additional_params: HashMap<String, String>,
27850    _scopes: BTreeSet<String>,
27851}
27852
27853impl<'a, C> common::CallBuilder for OrderGetbymerchantorderidCall<'a, C> {}
27854
27855impl<'a, C> OrderGetbymerchantorderidCall<'a, C>
27856where
27857    C: common::Connector,
27858{
27859    /// Perform the operation you have build so far.
27860    pub async fn doit(
27861        mut self,
27862    ) -> common::Result<(common::Response, OrdersGetByMerchantOrderIdResponse)> {
27863        use std::borrow::Cow;
27864        use std::io::{Read, Seek};
27865
27866        use common::{url::Params, ToParts};
27867        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27868
27869        let mut dd = common::DefaultDelegate;
27870        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27871        dlg.begin(common::MethodInfo {
27872            id: "content.orders.getbymerchantorderid",
27873            http_method: hyper::Method::GET,
27874        });
27875
27876        for &field in ["alt", "merchantId", "merchantOrderId"].iter() {
27877            if self._additional_params.contains_key(field) {
27878                dlg.finished(false);
27879                return Err(common::Error::FieldClash(field));
27880            }
27881        }
27882
27883        let mut params = Params::with_capacity(4 + self._additional_params.len());
27884        params.push("merchantId", self._merchant_id.to_string());
27885        params.push("merchantOrderId", self._merchant_order_id);
27886
27887        params.extend(self._additional_params.iter());
27888
27889        params.push("alt", "json");
27890        let mut url =
27891            self.hub._base_url.clone() + "{merchantId}/ordersbymerchantid/{merchantOrderId}";
27892        if self._scopes.is_empty() {
27893            self._scopes.insert(Scope::Full.as_ref().to_string());
27894        }
27895
27896        #[allow(clippy::single_element_loop)]
27897        for &(find_this, param_name) in [
27898            ("{merchantId}", "merchantId"),
27899            ("{merchantOrderId}", "merchantOrderId"),
27900        ]
27901        .iter()
27902        {
27903            url = params.uri_replacement(url, param_name, find_this, false);
27904        }
27905        {
27906            let to_remove = ["merchantOrderId", "merchantId"];
27907            params.remove_params(&to_remove);
27908        }
27909
27910        let url = params.parse_with_url(&url);
27911
27912        loop {
27913            let token = match self
27914                .hub
27915                .auth
27916                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27917                .await
27918            {
27919                Ok(token) => token,
27920                Err(e) => match dlg.token(e) {
27921                    Ok(token) => token,
27922                    Err(e) => {
27923                        dlg.finished(false);
27924                        return Err(common::Error::MissingToken(e));
27925                    }
27926                },
27927            };
27928            let mut req_result = {
27929                let client = &self.hub.client;
27930                dlg.pre_request();
27931                let mut req_builder = hyper::Request::builder()
27932                    .method(hyper::Method::GET)
27933                    .uri(url.as_str())
27934                    .header(USER_AGENT, self.hub._user_agent.clone());
27935
27936                if let Some(token) = token.as_ref() {
27937                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27938                }
27939
27940                let request = req_builder
27941                    .header(CONTENT_LENGTH, 0_u64)
27942                    .body(common::to_body::<String>(None));
27943
27944                client.request(request.unwrap()).await
27945            };
27946
27947            match req_result {
27948                Err(err) => {
27949                    if let common::Retry::After(d) = dlg.http_error(&err) {
27950                        sleep(d).await;
27951                        continue;
27952                    }
27953                    dlg.finished(false);
27954                    return Err(common::Error::HttpError(err));
27955                }
27956                Ok(res) => {
27957                    let (mut parts, body) = res.into_parts();
27958                    let mut body = common::Body::new(body);
27959                    if !parts.status.is_success() {
27960                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27961                        let error = serde_json::from_str(&common::to_string(&bytes));
27962                        let response = common::to_response(parts, bytes.into());
27963
27964                        if let common::Retry::After(d) =
27965                            dlg.http_failure(&response, error.as_ref().ok())
27966                        {
27967                            sleep(d).await;
27968                            continue;
27969                        }
27970
27971                        dlg.finished(false);
27972
27973                        return Err(match error {
27974                            Ok(value) => common::Error::BadRequest(value),
27975                            _ => common::Error::Failure(response),
27976                        });
27977                    }
27978                    let response = {
27979                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27980                        let encoded = common::to_string(&bytes);
27981                        match serde_json::from_str(&encoded) {
27982                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27983                            Err(error) => {
27984                                dlg.response_json_decode_error(&encoded, &error);
27985                                return Err(common::Error::JsonDecodeError(
27986                                    encoded.to_string(),
27987                                    error,
27988                                ));
27989                            }
27990                        }
27991                    };
27992
27993                    dlg.finished(true);
27994                    return Ok(response);
27995                }
27996            }
27997        }
27998    }
27999
28000    /// The ID of the account that manages the order. This cannot be a multi-client account.
28001    ///
28002    /// Sets the *merchant id* path property to the given value.
28003    ///
28004    /// Even though the property as already been set when instantiating this call,
28005    /// we provide this method for API completeness.
28006    pub fn merchant_id(mut self, new_value: u64) -> OrderGetbymerchantorderidCall<'a, C> {
28007        self._merchant_id = new_value;
28008        self
28009    }
28010    /// The merchant order ID to be looked for.
28011    ///
28012    /// Sets the *merchant order id* path property to the given value.
28013    ///
28014    /// Even though the property as already been set when instantiating this call,
28015    /// we provide this method for API completeness.
28016    pub fn merchant_order_id(mut self, new_value: &str) -> OrderGetbymerchantorderidCall<'a, C> {
28017        self._merchant_order_id = new_value.to_string();
28018        self
28019    }
28020    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28021    /// while executing the actual API request.
28022    ///
28023    /// ````text
28024    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28025    /// ````
28026    ///
28027    /// Sets the *delegate* property to the given value.
28028    pub fn delegate(
28029        mut self,
28030        new_value: &'a mut dyn common::Delegate,
28031    ) -> OrderGetbymerchantorderidCall<'a, C> {
28032        self._delegate = Some(new_value);
28033        self
28034    }
28035
28036    /// Set any additional parameter of the query string used in the request.
28037    /// It should be used to set parameters which are not yet available through their own
28038    /// setters.
28039    ///
28040    /// Please note that this method must not be used to set any of the known parameters
28041    /// which have their own setter method. If done anyway, the request will fail.
28042    ///
28043    /// # Additional Parameters
28044    ///
28045    /// * *$.xgafv* (query-string) - V1 error format.
28046    /// * *access_token* (query-string) - OAuth access token.
28047    /// * *alt* (query-string) - Data format for response.
28048    /// * *callback* (query-string) - JSONP
28049    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28050    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
28051    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28052    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28053    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
28054    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28055    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28056    pub fn param<T>(mut self, name: T, value: T) -> OrderGetbymerchantorderidCall<'a, C>
28057    where
28058        T: AsRef<str>,
28059    {
28060        self._additional_params
28061            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28062        self
28063    }
28064
28065    /// Identifies the authorization scope for the method you are building.
28066    ///
28067    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28068    /// [`Scope::Full`].
28069    ///
28070    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28071    /// tokens for more than one scope.
28072    ///
28073    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28074    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28075    /// sufficient, a read-write scope will do as well.
28076    pub fn add_scope<St>(mut self, scope: St) -> OrderGetbymerchantorderidCall<'a, C>
28077    where
28078        St: AsRef<str>,
28079    {
28080        self._scopes.insert(String::from(scope.as_ref()));
28081        self
28082    }
28083    /// Identifies the authorization scope(s) for the method you are building.
28084    ///
28085    /// See [`Self::add_scope()`] for details.
28086    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderGetbymerchantorderidCall<'a, C>
28087    where
28088        I: IntoIterator<Item = St>,
28089        St: AsRef<str>,
28090    {
28091        self._scopes
28092            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28093        self
28094    }
28095
28096    /// Removes all scopes, and no default scope will be used either.
28097    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28098    /// for details).
28099    pub fn clear_scopes(mut self) -> OrderGetbymerchantorderidCall<'a, C> {
28100        self._scopes.clear();
28101        self
28102    }
28103}
28104
28105/// Sandbox only. Retrieves an order template that can be used to quickly create a new order in sandbox.
28106///
28107/// A builder for the *gettestordertemplate* method supported by a *order* resource.
28108/// It is not used directly, but through a [`OrderMethods`] instance.
28109///
28110/// # Example
28111///
28112/// Instantiate a resource method builder
28113///
28114/// ```test_harness,no_run
28115/// # extern crate hyper;
28116/// # extern crate hyper_rustls;
28117/// # extern crate google_content2 as content2;
28118/// # async fn dox() {
28119/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28120///
28121/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28122/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28123/// #     .with_native_roots()
28124/// #     .unwrap()
28125/// #     .https_only()
28126/// #     .enable_http2()
28127/// #     .build();
28128///
28129/// # let executor = hyper_util::rt::TokioExecutor::new();
28130/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28131/// #     secret,
28132/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28133/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
28134/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
28135/// #     ),
28136/// # ).build().await.unwrap();
28137///
28138/// # let client = hyper_util::client::legacy::Client::builder(
28139/// #     hyper_util::rt::TokioExecutor::new()
28140/// # )
28141/// # .build(
28142/// #     hyper_rustls::HttpsConnectorBuilder::new()
28143/// #         .with_native_roots()
28144/// #         .unwrap()
28145/// #         .https_or_http()
28146/// #         .enable_http2()
28147/// #         .build()
28148/// # );
28149/// # let mut hub = ShoppingContent::new(client, auth);
28150/// // You can configure optional parameters by calling the respective setters at will, and
28151/// // execute the final call using `doit()`.
28152/// // Values shown here are possibly random and not representative !
28153/// let result = hub.orders().gettestordertemplate(79, "templateName")
28154///              .country("erat")
28155///              .doit().await;
28156/// # }
28157/// ```
28158pub struct OrderGettestordertemplateCall<'a, C>
28159where
28160    C: 'a,
28161{
28162    hub: &'a ShoppingContent<C>,
28163    _merchant_id: u64,
28164    _template_name: String,
28165    _country: Option<String>,
28166    _delegate: Option<&'a mut dyn common::Delegate>,
28167    _additional_params: HashMap<String, String>,
28168    _scopes: BTreeSet<String>,
28169}
28170
28171impl<'a, C> common::CallBuilder for OrderGettestordertemplateCall<'a, C> {}
28172
28173impl<'a, C> OrderGettestordertemplateCall<'a, C>
28174where
28175    C: common::Connector,
28176{
28177    /// Perform the operation you have build so far.
28178    pub async fn doit(
28179        mut self,
28180    ) -> common::Result<(common::Response, OrdersGetTestOrderTemplateResponse)> {
28181        use std::borrow::Cow;
28182        use std::io::{Read, Seek};
28183
28184        use common::{url::Params, ToParts};
28185        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28186
28187        let mut dd = common::DefaultDelegate;
28188        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28189        dlg.begin(common::MethodInfo {
28190            id: "content.orders.gettestordertemplate",
28191            http_method: hyper::Method::GET,
28192        });
28193
28194        for &field in ["alt", "merchantId", "templateName", "country"].iter() {
28195            if self._additional_params.contains_key(field) {
28196                dlg.finished(false);
28197                return Err(common::Error::FieldClash(field));
28198            }
28199        }
28200
28201        let mut params = Params::with_capacity(5 + self._additional_params.len());
28202        params.push("merchantId", self._merchant_id.to_string());
28203        params.push("templateName", self._template_name);
28204        if let Some(value) = self._country.as_ref() {
28205            params.push("country", value);
28206        }
28207
28208        params.extend(self._additional_params.iter());
28209
28210        params.push("alt", "json");
28211        let mut url = self.hub._base_url.clone() + "{merchantId}/testordertemplates/{templateName}";
28212        if self._scopes.is_empty() {
28213            self._scopes.insert(Scope::Full.as_ref().to_string());
28214        }
28215
28216        #[allow(clippy::single_element_loop)]
28217        for &(find_this, param_name) in [
28218            ("{merchantId}", "merchantId"),
28219            ("{templateName}", "templateName"),
28220        ]
28221        .iter()
28222        {
28223            url = params.uri_replacement(url, param_name, find_this, false);
28224        }
28225        {
28226            let to_remove = ["templateName", "merchantId"];
28227            params.remove_params(&to_remove);
28228        }
28229
28230        let url = params.parse_with_url(&url);
28231
28232        loop {
28233            let token = match self
28234                .hub
28235                .auth
28236                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28237                .await
28238            {
28239                Ok(token) => token,
28240                Err(e) => match dlg.token(e) {
28241                    Ok(token) => token,
28242                    Err(e) => {
28243                        dlg.finished(false);
28244                        return Err(common::Error::MissingToken(e));
28245                    }
28246                },
28247            };
28248            let mut req_result = {
28249                let client = &self.hub.client;
28250                dlg.pre_request();
28251                let mut req_builder = hyper::Request::builder()
28252                    .method(hyper::Method::GET)
28253                    .uri(url.as_str())
28254                    .header(USER_AGENT, self.hub._user_agent.clone());
28255
28256                if let Some(token) = token.as_ref() {
28257                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28258                }
28259
28260                let request = req_builder
28261                    .header(CONTENT_LENGTH, 0_u64)
28262                    .body(common::to_body::<String>(None));
28263
28264                client.request(request.unwrap()).await
28265            };
28266
28267            match req_result {
28268                Err(err) => {
28269                    if let common::Retry::After(d) = dlg.http_error(&err) {
28270                        sleep(d).await;
28271                        continue;
28272                    }
28273                    dlg.finished(false);
28274                    return Err(common::Error::HttpError(err));
28275                }
28276                Ok(res) => {
28277                    let (mut parts, body) = res.into_parts();
28278                    let mut body = common::Body::new(body);
28279                    if !parts.status.is_success() {
28280                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28281                        let error = serde_json::from_str(&common::to_string(&bytes));
28282                        let response = common::to_response(parts, bytes.into());
28283
28284                        if let common::Retry::After(d) =
28285                            dlg.http_failure(&response, error.as_ref().ok())
28286                        {
28287                            sleep(d).await;
28288                            continue;
28289                        }
28290
28291                        dlg.finished(false);
28292
28293                        return Err(match error {
28294                            Ok(value) => common::Error::BadRequest(value),
28295                            _ => common::Error::Failure(response),
28296                        });
28297                    }
28298                    let response = {
28299                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28300                        let encoded = common::to_string(&bytes);
28301                        match serde_json::from_str(&encoded) {
28302                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28303                            Err(error) => {
28304                                dlg.response_json_decode_error(&encoded, &error);
28305                                return Err(common::Error::JsonDecodeError(
28306                                    encoded.to_string(),
28307                                    error,
28308                                ));
28309                            }
28310                        }
28311                    };
28312
28313                    dlg.finished(true);
28314                    return Ok(response);
28315                }
28316            }
28317        }
28318    }
28319
28320    /// The ID of the account that should manage the order. This cannot be a multi-client account.
28321    ///
28322    /// Sets the *merchant id* path property to the given value.
28323    ///
28324    /// Even though the property as already been set when instantiating this call,
28325    /// we provide this method for API completeness.
28326    pub fn merchant_id(mut self, new_value: u64) -> OrderGettestordertemplateCall<'a, C> {
28327        self._merchant_id = new_value;
28328        self
28329    }
28330    /// The name of the template to retrieve.
28331    ///
28332    /// Sets the *template name* path property to the given value.
28333    ///
28334    /// Even though the property as already been set when instantiating this call,
28335    /// we provide this method for API completeness.
28336    pub fn template_name(mut self, new_value: &str) -> OrderGettestordertemplateCall<'a, C> {
28337        self._template_name = new_value.to_string();
28338        self
28339    }
28340    /// The country of the template to retrieve. Defaults to `US`.
28341    ///
28342    /// Sets the *country* query property to the given value.
28343    pub fn country(mut self, new_value: &str) -> OrderGettestordertemplateCall<'a, C> {
28344        self._country = Some(new_value.to_string());
28345        self
28346    }
28347    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28348    /// while executing the actual API request.
28349    ///
28350    /// ````text
28351    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28352    /// ````
28353    ///
28354    /// Sets the *delegate* property to the given value.
28355    pub fn delegate(
28356        mut self,
28357        new_value: &'a mut dyn common::Delegate,
28358    ) -> OrderGettestordertemplateCall<'a, C> {
28359        self._delegate = Some(new_value);
28360        self
28361    }
28362
28363    /// Set any additional parameter of the query string used in the request.
28364    /// It should be used to set parameters which are not yet available through their own
28365    /// setters.
28366    ///
28367    /// Please note that this method must not be used to set any of the known parameters
28368    /// which have their own setter method. If done anyway, the request will fail.
28369    ///
28370    /// # Additional Parameters
28371    ///
28372    /// * *$.xgafv* (query-string) - V1 error format.
28373    /// * *access_token* (query-string) - OAuth access token.
28374    /// * *alt* (query-string) - Data format for response.
28375    /// * *callback* (query-string) - JSONP
28376    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28377    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
28378    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28379    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28380    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
28381    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28382    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28383    pub fn param<T>(mut self, name: T, value: T) -> OrderGettestordertemplateCall<'a, C>
28384    where
28385        T: AsRef<str>,
28386    {
28387        self._additional_params
28388            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28389        self
28390    }
28391
28392    /// Identifies the authorization scope for the method you are building.
28393    ///
28394    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28395    /// [`Scope::Full`].
28396    ///
28397    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28398    /// tokens for more than one scope.
28399    ///
28400    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28401    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28402    /// sufficient, a read-write scope will do as well.
28403    pub fn add_scope<St>(mut self, scope: St) -> OrderGettestordertemplateCall<'a, C>
28404    where
28405        St: AsRef<str>,
28406    {
28407        self._scopes.insert(String::from(scope.as_ref()));
28408        self
28409    }
28410    /// Identifies the authorization scope(s) for the method you are building.
28411    ///
28412    /// See [`Self::add_scope()`] for details.
28413    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderGettestordertemplateCall<'a, C>
28414    where
28415        I: IntoIterator<Item = St>,
28416        St: AsRef<str>,
28417    {
28418        self._scopes
28419            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28420        self
28421    }
28422
28423    /// Removes all scopes, and no default scope will be used either.
28424    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28425    /// for details).
28426    pub fn clear_scopes(mut self) -> OrderGettestordertemplateCall<'a, C> {
28427        self._scopes.clear();
28428        self
28429    }
28430}
28431
28432/// Deprecated. Notifies that item return and refund was handled directly by merchant outside of Google payments processing (e.g. cash refund done in store). Note: We recommend calling the returnrefundlineitem method to refund in-store returns. We will issue the refund directly to the customer. This helps to prevent possible differences arising between merchant and Google transaction records. We also recommend having the point of sale system communicate with Google to ensure that customers do not receive a double refund by first refunding via Google then via an in-store return.
28433///
28434/// A builder for the *instorerefundlineitem* method supported by a *order* resource.
28435/// It is not used directly, but through a [`OrderMethods`] instance.
28436///
28437/// # Example
28438///
28439/// Instantiate a resource method builder
28440///
28441/// ```test_harness,no_run
28442/// # extern crate hyper;
28443/// # extern crate hyper_rustls;
28444/// # extern crate google_content2 as content2;
28445/// use content2::api::OrdersInStoreRefundLineItemRequest;
28446/// # async fn dox() {
28447/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28448///
28449/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28450/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28451/// #     .with_native_roots()
28452/// #     .unwrap()
28453/// #     .https_only()
28454/// #     .enable_http2()
28455/// #     .build();
28456///
28457/// # let executor = hyper_util::rt::TokioExecutor::new();
28458/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28459/// #     secret,
28460/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28461/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
28462/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
28463/// #     ),
28464/// # ).build().await.unwrap();
28465///
28466/// # let client = hyper_util::client::legacy::Client::builder(
28467/// #     hyper_util::rt::TokioExecutor::new()
28468/// # )
28469/// # .build(
28470/// #     hyper_rustls::HttpsConnectorBuilder::new()
28471/// #         .with_native_roots()
28472/// #         .unwrap()
28473/// #         .https_or_http()
28474/// #         .enable_http2()
28475/// #         .build()
28476/// # );
28477/// # let mut hub = ShoppingContent::new(client, auth);
28478/// // As the method needs a request, you would usually fill it with the desired information
28479/// // into the respective structure. Some of the parts shown here might not be applicable !
28480/// // Values shown here are possibly random and not representative !
28481/// let mut req = OrdersInStoreRefundLineItemRequest::default();
28482///
28483/// // You can configure optional parameters by calling the respective setters at will, and
28484/// // execute the final call using `doit()`.
28485/// // Values shown here are possibly random and not representative !
28486/// let result = hub.orders().instorerefundlineitem(req, 91, "orderId")
28487///              .doit().await;
28488/// # }
28489/// ```
28490pub struct OrderInstorerefundlineitemCall<'a, C>
28491where
28492    C: 'a,
28493{
28494    hub: &'a ShoppingContent<C>,
28495    _request: OrdersInStoreRefundLineItemRequest,
28496    _merchant_id: u64,
28497    _order_id: String,
28498    _delegate: Option<&'a mut dyn common::Delegate>,
28499    _additional_params: HashMap<String, String>,
28500    _scopes: BTreeSet<String>,
28501}
28502
28503impl<'a, C> common::CallBuilder for OrderInstorerefundlineitemCall<'a, C> {}
28504
28505impl<'a, C> OrderInstorerefundlineitemCall<'a, C>
28506where
28507    C: common::Connector,
28508{
28509    /// Perform the operation you have build so far.
28510    pub async fn doit(
28511        mut self,
28512    ) -> common::Result<(common::Response, OrdersInStoreRefundLineItemResponse)> {
28513        use std::borrow::Cow;
28514        use std::io::{Read, Seek};
28515
28516        use common::{url::Params, ToParts};
28517        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28518
28519        let mut dd = common::DefaultDelegate;
28520        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28521        dlg.begin(common::MethodInfo {
28522            id: "content.orders.instorerefundlineitem",
28523            http_method: hyper::Method::POST,
28524        });
28525
28526        for &field in ["alt", "merchantId", "orderId"].iter() {
28527            if self._additional_params.contains_key(field) {
28528                dlg.finished(false);
28529                return Err(common::Error::FieldClash(field));
28530            }
28531        }
28532
28533        let mut params = Params::with_capacity(5 + self._additional_params.len());
28534        params.push("merchantId", self._merchant_id.to_string());
28535        params.push("orderId", self._order_id);
28536
28537        params.extend(self._additional_params.iter());
28538
28539        params.push("alt", "json");
28540        let mut url =
28541            self.hub._base_url.clone() + "{merchantId}/orders/{orderId}/inStoreRefundLineItem";
28542        if self._scopes.is_empty() {
28543            self._scopes.insert(Scope::Full.as_ref().to_string());
28544        }
28545
28546        #[allow(clippy::single_element_loop)]
28547        for &(find_this, param_name) in
28548            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
28549        {
28550            url = params.uri_replacement(url, param_name, find_this, false);
28551        }
28552        {
28553            let to_remove = ["orderId", "merchantId"];
28554            params.remove_params(&to_remove);
28555        }
28556
28557        let url = params.parse_with_url(&url);
28558
28559        let mut json_mime_type = mime::APPLICATION_JSON;
28560        let mut request_value_reader = {
28561            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28562            common::remove_json_null_values(&mut value);
28563            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28564            serde_json::to_writer(&mut dst, &value).unwrap();
28565            dst
28566        };
28567        let request_size = request_value_reader
28568            .seek(std::io::SeekFrom::End(0))
28569            .unwrap();
28570        request_value_reader
28571            .seek(std::io::SeekFrom::Start(0))
28572            .unwrap();
28573
28574        loop {
28575            let token = match self
28576                .hub
28577                .auth
28578                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28579                .await
28580            {
28581                Ok(token) => token,
28582                Err(e) => match dlg.token(e) {
28583                    Ok(token) => token,
28584                    Err(e) => {
28585                        dlg.finished(false);
28586                        return Err(common::Error::MissingToken(e));
28587                    }
28588                },
28589            };
28590            request_value_reader
28591                .seek(std::io::SeekFrom::Start(0))
28592                .unwrap();
28593            let mut req_result = {
28594                let client = &self.hub.client;
28595                dlg.pre_request();
28596                let mut req_builder = hyper::Request::builder()
28597                    .method(hyper::Method::POST)
28598                    .uri(url.as_str())
28599                    .header(USER_AGENT, self.hub._user_agent.clone());
28600
28601                if let Some(token) = token.as_ref() {
28602                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28603                }
28604
28605                let request = req_builder
28606                    .header(CONTENT_TYPE, json_mime_type.to_string())
28607                    .header(CONTENT_LENGTH, request_size as u64)
28608                    .body(common::to_body(
28609                        request_value_reader.get_ref().clone().into(),
28610                    ));
28611
28612                client.request(request.unwrap()).await
28613            };
28614
28615            match req_result {
28616                Err(err) => {
28617                    if let common::Retry::After(d) = dlg.http_error(&err) {
28618                        sleep(d).await;
28619                        continue;
28620                    }
28621                    dlg.finished(false);
28622                    return Err(common::Error::HttpError(err));
28623                }
28624                Ok(res) => {
28625                    let (mut parts, body) = res.into_parts();
28626                    let mut body = common::Body::new(body);
28627                    if !parts.status.is_success() {
28628                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28629                        let error = serde_json::from_str(&common::to_string(&bytes));
28630                        let response = common::to_response(parts, bytes.into());
28631
28632                        if let common::Retry::After(d) =
28633                            dlg.http_failure(&response, error.as_ref().ok())
28634                        {
28635                            sleep(d).await;
28636                            continue;
28637                        }
28638
28639                        dlg.finished(false);
28640
28641                        return Err(match error {
28642                            Ok(value) => common::Error::BadRequest(value),
28643                            _ => common::Error::Failure(response),
28644                        });
28645                    }
28646                    let response = {
28647                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28648                        let encoded = common::to_string(&bytes);
28649                        match serde_json::from_str(&encoded) {
28650                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28651                            Err(error) => {
28652                                dlg.response_json_decode_error(&encoded, &error);
28653                                return Err(common::Error::JsonDecodeError(
28654                                    encoded.to_string(),
28655                                    error,
28656                                ));
28657                            }
28658                        }
28659                    };
28660
28661                    dlg.finished(true);
28662                    return Ok(response);
28663                }
28664            }
28665        }
28666    }
28667
28668    ///
28669    /// Sets the *request* property to the given value.
28670    ///
28671    /// Even though the property as already been set when instantiating this call,
28672    /// we provide this method for API completeness.
28673    pub fn request(
28674        mut self,
28675        new_value: OrdersInStoreRefundLineItemRequest,
28676    ) -> OrderInstorerefundlineitemCall<'a, C> {
28677        self._request = new_value;
28678        self
28679    }
28680    /// The ID of the account that manages the order. This cannot be a multi-client account.
28681    ///
28682    /// Sets the *merchant id* path property to the given value.
28683    ///
28684    /// Even though the property as already been set when instantiating this call,
28685    /// we provide this method for API completeness.
28686    pub fn merchant_id(mut self, new_value: u64) -> OrderInstorerefundlineitemCall<'a, C> {
28687        self._merchant_id = new_value;
28688        self
28689    }
28690    /// The ID of the order.
28691    ///
28692    /// Sets the *order id* path property to the given value.
28693    ///
28694    /// Even though the property as already been set when instantiating this call,
28695    /// we provide this method for API completeness.
28696    pub fn order_id(mut self, new_value: &str) -> OrderInstorerefundlineitemCall<'a, C> {
28697        self._order_id = new_value.to_string();
28698        self
28699    }
28700    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28701    /// while executing the actual API request.
28702    ///
28703    /// ````text
28704    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28705    /// ````
28706    ///
28707    /// Sets the *delegate* property to the given value.
28708    pub fn delegate(
28709        mut self,
28710        new_value: &'a mut dyn common::Delegate,
28711    ) -> OrderInstorerefundlineitemCall<'a, C> {
28712        self._delegate = Some(new_value);
28713        self
28714    }
28715
28716    /// Set any additional parameter of the query string used in the request.
28717    /// It should be used to set parameters which are not yet available through their own
28718    /// setters.
28719    ///
28720    /// Please note that this method must not be used to set any of the known parameters
28721    /// which have their own setter method. If done anyway, the request will fail.
28722    ///
28723    /// # Additional Parameters
28724    ///
28725    /// * *$.xgafv* (query-string) - V1 error format.
28726    /// * *access_token* (query-string) - OAuth access token.
28727    /// * *alt* (query-string) - Data format for response.
28728    /// * *callback* (query-string) - JSONP
28729    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28730    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
28731    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28732    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28733    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
28734    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28735    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28736    pub fn param<T>(mut self, name: T, value: T) -> OrderInstorerefundlineitemCall<'a, C>
28737    where
28738        T: AsRef<str>,
28739    {
28740        self._additional_params
28741            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28742        self
28743    }
28744
28745    /// Identifies the authorization scope for the method you are building.
28746    ///
28747    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28748    /// [`Scope::Full`].
28749    ///
28750    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28751    /// tokens for more than one scope.
28752    ///
28753    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28754    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28755    /// sufficient, a read-write scope will do as well.
28756    pub fn add_scope<St>(mut self, scope: St) -> OrderInstorerefundlineitemCall<'a, C>
28757    where
28758        St: AsRef<str>,
28759    {
28760        self._scopes.insert(String::from(scope.as_ref()));
28761        self
28762    }
28763    /// Identifies the authorization scope(s) for the method you are building.
28764    ///
28765    /// See [`Self::add_scope()`] for details.
28766    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderInstorerefundlineitemCall<'a, C>
28767    where
28768        I: IntoIterator<Item = St>,
28769        St: AsRef<str>,
28770    {
28771        self._scopes
28772            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28773        self
28774    }
28775
28776    /// Removes all scopes, and no default scope will be used either.
28777    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28778    /// for details).
28779    pub fn clear_scopes(mut self) -> OrderInstorerefundlineitemCall<'a, C> {
28780        self._scopes.clear();
28781        self
28782    }
28783}
28784
28785/// Lists the orders in your Merchant Center account.
28786///
28787/// A builder for the *list* method supported by a *order* resource.
28788/// It is not used directly, but through a [`OrderMethods`] instance.
28789///
28790/// # Example
28791///
28792/// Instantiate a resource method builder
28793///
28794/// ```test_harness,no_run
28795/// # extern crate hyper;
28796/// # extern crate hyper_rustls;
28797/// # extern crate google_content2 as content2;
28798/// # async fn dox() {
28799/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28800///
28801/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28802/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28803/// #     .with_native_roots()
28804/// #     .unwrap()
28805/// #     .https_only()
28806/// #     .enable_http2()
28807/// #     .build();
28808///
28809/// # let executor = hyper_util::rt::TokioExecutor::new();
28810/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28811/// #     secret,
28812/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28813/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
28814/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
28815/// #     ),
28816/// # ).build().await.unwrap();
28817///
28818/// # let client = hyper_util::client::legacy::Client::builder(
28819/// #     hyper_util::rt::TokioExecutor::new()
28820/// # )
28821/// # .build(
28822/// #     hyper_rustls::HttpsConnectorBuilder::new()
28823/// #         .with_native_roots()
28824/// #         .unwrap()
28825/// #         .https_or_http()
28826/// #         .enable_http2()
28827/// #         .build()
28828/// # );
28829/// # let mut hub = ShoppingContent::new(client, auth);
28830/// // You can configure optional parameters by calling the respective setters at will, and
28831/// // execute the final call using `doit()`.
28832/// // Values shown here are possibly random and not representative !
28833/// let result = hub.orders().list(79)
28834///              .add_statuses("gubergren")
28835///              .placed_date_start("justo")
28836///              .placed_date_end("sea")
28837///              .page_token("consetetur")
28838///              .order_by("sit")
28839///              .max_results(69)
28840///              .acknowledged(false)
28841///              .doit().await;
28842/// # }
28843/// ```
28844pub struct OrderListCall<'a, C>
28845where
28846    C: 'a,
28847{
28848    hub: &'a ShoppingContent<C>,
28849    _merchant_id: u64,
28850    _statuses: Vec<String>,
28851    _placed_date_start: Option<String>,
28852    _placed_date_end: Option<String>,
28853    _page_token: Option<String>,
28854    _order_by: Option<String>,
28855    _max_results: Option<u32>,
28856    _acknowledged: Option<bool>,
28857    _delegate: Option<&'a mut dyn common::Delegate>,
28858    _additional_params: HashMap<String, String>,
28859    _scopes: BTreeSet<String>,
28860}
28861
28862impl<'a, C> common::CallBuilder for OrderListCall<'a, C> {}
28863
28864impl<'a, C> OrderListCall<'a, C>
28865where
28866    C: common::Connector,
28867{
28868    /// Perform the operation you have build so far.
28869    pub async fn doit(mut self) -> common::Result<(common::Response, OrdersListResponse)> {
28870        use std::borrow::Cow;
28871        use std::io::{Read, Seek};
28872
28873        use common::{url::Params, ToParts};
28874        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28875
28876        let mut dd = common::DefaultDelegate;
28877        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28878        dlg.begin(common::MethodInfo {
28879            id: "content.orders.list",
28880            http_method: hyper::Method::GET,
28881        });
28882
28883        for &field in [
28884            "alt",
28885            "merchantId",
28886            "statuses",
28887            "placedDateStart",
28888            "placedDateEnd",
28889            "pageToken",
28890            "orderBy",
28891            "maxResults",
28892            "acknowledged",
28893        ]
28894        .iter()
28895        {
28896            if self._additional_params.contains_key(field) {
28897                dlg.finished(false);
28898                return Err(common::Error::FieldClash(field));
28899            }
28900        }
28901
28902        let mut params = Params::with_capacity(10 + self._additional_params.len());
28903        params.push("merchantId", self._merchant_id.to_string());
28904        if !self._statuses.is_empty() {
28905            for f in self._statuses.iter() {
28906                params.push("statuses", f);
28907            }
28908        }
28909        if let Some(value) = self._placed_date_start.as_ref() {
28910            params.push("placedDateStart", value);
28911        }
28912        if let Some(value) = self._placed_date_end.as_ref() {
28913            params.push("placedDateEnd", value);
28914        }
28915        if let Some(value) = self._page_token.as_ref() {
28916            params.push("pageToken", value);
28917        }
28918        if let Some(value) = self._order_by.as_ref() {
28919            params.push("orderBy", value);
28920        }
28921        if let Some(value) = self._max_results.as_ref() {
28922            params.push("maxResults", value.to_string());
28923        }
28924        if let Some(value) = self._acknowledged.as_ref() {
28925            params.push("acknowledged", value.to_string());
28926        }
28927
28928        params.extend(self._additional_params.iter());
28929
28930        params.push("alt", "json");
28931        let mut url = self.hub._base_url.clone() + "{merchantId}/orders";
28932        if self._scopes.is_empty() {
28933            self._scopes.insert(Scope::Full.as_ref().to_string());
28934        }
28935
28936        #[allow(clippy::single_element_loop)]
28937        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
28938            url = params.uri_replacement(url, param_name, find_this, false);
28939        }
28940        {
28941            let to_remove = ["merchantId"];
28942            params.remove_params(&to_remove);
28943        }
28944
28945        let url = params.parse_with_url(&url);
28946
28947        loop {
28948            let token = match self
28949                .hub
28950                .auth
28951                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28952                .await
28953            {
28954                Ok(token) => token,
28955                Err(e) => match dlg.token(e) {
28956                    Ok(token) => token,
28957                    Err(e) => {
28958                        dlg.finished(false);
28959                        return Err(common::Error::MissingToken(e));
28960                    }
28961                },
28962            };
28963            let mut req_result = {
28964                let client = &self.hub.client;
28965                dlg.pre_request();
28966                let mut req_builder = hyper::Request::builder()
28967                    .method(hyper::Method::GET)
28968                    .uri(url.as_str())
28969                    .header(USER_AGENT, self.hub._user_agent.clone());
28970
28971                if let Some(token) = token.as_ref() {
28972                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28973                }
28974
28975                let request = req_builder
28976                    .header(CONTENT_LENGTH, 0_u64)
28977                    .body(common::to_body::<String>(None));
28978
28979                client.request(request.unwrap()).await
28980            };
28981
28982            match req_result {
28983                Err(err) => {
28984                    if let common::Retry::After(d) = dlg.http_error(&err) {
28985                        sleep(d).await;
28986                        continue;
28987                    }
28988                    dlg.finished(false);
28989                    return Err(common::Error::HttpError(err));
28990                }
28991                Ok(res) => {
28992                    let (mut parts, body) = res.into_parts();
28993                    let mut body = common::Body::new(body);
28994                    if !parts.status.is_success() {
28995                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28996                        let error = serde_json::from_str(&common::to_string(&bytes));
28997                        let response = common::to_response(parts, bytes.into());
28998
28999                        if let common::Retry::After(d) =
29000                            dlg.http_failure(&response, error.as_ref().ok())
29001                        {
29002                            sleep(d).await;
29003                            continue;
29004                        }
29005
29006                        dlg.finished(false);
29007
29008                        return Err(match error {
29009                            Ok(value) => common::Error::BadRequest(value),
29010                            _ => common::Error::Failure(response),
29011                        });
29012                    }
29013                    let response = {
29014                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29015                        let encoded = common::to_string(&bytes);
29016                        match serde_json::from_str(&encoded) {
29017                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29018                            Err(error) => {
29019                                dlg.response_json_decode_error(&encoded, &error);
29020                                return Err(common::Error::JsonDecodeError(
29021                                    encoded.to_string(),
29022                                    error,
29023                                ));
29024                            }
29025                        }
29026                    };
29027
29028                    dlg.finished(true);
29029                    return Ok(response);
29030                }
29031            }
29032        }
29033    }
29034
29035    /// The ID of the account that manages the order. This cannot be a multi-client account.
29036    ///
29037    /// Sets the *merchant id* path property to the given value.
29038    ///
29039    /// Even though the property as already been set when instantiating this call,
29040    /// we provide this method for API completeness.
29041    pub fn merchant_id(mut self, new_value: u64) -> OrderListCall<'a, C> {
29042        self._merchant_id = new_value;
29043        self
29044    }
29045    /// Obtains orders that match any of the specified statuses. Please note that `active` is a shortcut for `pendingShipment` and `partiallyShipped`, and `completed` is a shortcut for `shipped`, `partiallyDelivered`, `delivered`, `partiallyReturned`, `returned`, and `canceled`.
29046    ///
29047    /// Append the given value to the *statuses* query property.
29048    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
29049    pub fn add_statuses(mut self, new_value: &str) -> OrderListCall<'a, C> {
29050        self._statuses.push(new_value.to_string());
29051        self
29052    }
29053    /// Obtains orders placed after this date (inclusively), in ISO 8601 format.
29054    ///
29055    /// Sets the *placed date start* query property to the given value.
29056    pub fn placed_date_start(mut self, new_value: &str) -> OrderListCall<'a, C> {
29057        self._placed_date_start = Some(new_value.to_string());
29058        self
29059    }
29060    /// Obtains orders placed before this date (exclusively), in ISO 8601 format.
29061    ///
29062    /// Sets the *placed date end* query property to the given value.
29063    pub fn placed_date_end(mut self, new_value: &str) -> OrderListCall<'a, C> {
29064        self._placed_date_end = Some(new_value.to_string());
29065        self
29066    }
29067    /// The token returned by the previous request.
29068    ///
29069    /// Sets the *page token* query property to the given value.
29070    pub fn page_token(mut self, new_value: &str) -> OrderListCall<'a, C> {
29071        self._page_token = Some(new_value.to_string());
29072        self
29073    }
29074    /// Order results by placement date in descending or ascending order. Acceptable values are: - placedDateAsc - placedDateDesc
29075    ///
29076    /// Sets the *order by* query property to the given value.
29077    pub fn order_by(mut self, new_value: &str) -> OrderListCall<'a, C> {
29078        self._order_by = Some(new_value.to_string());
29079        self
29080    }
29081    /// The maximum number of orders to return in the response, used for paging. The default value is 25 orders per page, and the maximum allowed value is 250 orders per page.
29082    ///
29083    /// Sets the *max results* query property to the given value.
29084    pub fn max_results(mut self, new_value: u32) -> OrderListCall<'a, C> {
29085        self._max_results = Some(new_value);
29086        self
29087    }
29088    /// Obtains orders that match the acknowledgement status. When set to true, obtains orders that have been acknowledged. When false, obtains orders that have not been acknowledged. We recommend using this filter set to `false`, in conjunction with the `acknowledge` call, such that only un-acknowledged orders are returned.
29089    ///
29090    /// Sets the *acknowledged* query property to the given value.
29091    pub fn acknowledged(mut self, new_value: bool) -> OrderListCall<'a, C> {
29092        self._acknowledged = Some(new_value);
29093        self
29094    }
29095    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29096    /// while executing the actual API request.
29097    ///
29098    /// ````text
29099    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29100    /// ````
29101    ///
29102    /// Sets the *delegate* property to the given value.
29103    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OrderListCall<'a, C> {
29104        self._delegate = Some(new_value);
29105        self
29106    }
29107
29108    /// Set any additional parameter of the query string used in the request.
29109    /// It should be used to set parameters which are not yet available through their own
29110    /// setters.
29111    ///
29112    /// Please note that this method must not be used to set any of the known parameters
29113    /// which have their own setter method. If done anyway, the request will fail.
29114    ///
29115    /// # Additional Parameters
29116    ///
29117    /// * *$.xgafv* (query-string) - V1 error format.
29118    /// * *access_token* (query-string) - OAuth access token.
29119    /// * *alt* (query-string) - Data format for response.
29120    /// * *callback* (query-string) - JSONP
29121    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29122    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
29123    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29124    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29125    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
29126    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29127    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29128    pub fn param<T>(mut self, name: T, value: T) -> OrderListCall<'a, C>
29129    where
29130        T: AsRef<str>,
29131    {
29132        self._additional_params
29133            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29134        self
29135    }
29136
29137    /// Identifies the authorization scope for the method you are building.
29138    ///
29139    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29140    /// [`Scope::Full`].
29141    ///
29142    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29143    /// tokens for more than one scope.
29144    ///
29145    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29146    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29147    /// sufficient, a read-write scope will do as well.
29148    pub fn add_scope<St>(mut self, scope: St) -> OrderListCall<'a, C>
29149    where
29150        St: AsRef<str>,
29151    {
29152        self._scopes.insert(String::from(scope.as_ref()));
29153        self
29154    }
29155    /// Identifies the authorization scope(s) for the method you are building.
29156    ///
29157    /// See [`Self::add_scope()`] for details.
29158    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderListCall<'a, C>
29159    where
29160        I: IntoIterator<Item = St>,
29161        St: AsRef<str>,
29162    {
29163        self._scopes
29164            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29165        self
29166    }
29167
29168    /// Removes all scopes, and no default scope will be used either.
29169    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29170    /// for details).
29171    pub fn clear_scopes(mut self) -> OrderListCall<'a, C> {
29172        self._scopes.clear();
29173        self
29174    }
29175}
29176
29177/// Deprecated, please use returnRefundLineItem instead.
29178///
29179/// A builder for the *refund* method supported by a *order* resource.
29180/// It is not used directly, but through a [`OrderMethods`] instance.
29181///
29182/// # Example
29183///
29184/// Instantiate a resource method builder
29185///
29186/// ```test_harness,no_run
29187/// # extern crate hyper;
29188/// # extern crate hyper_rustls;
29189/// # extern crate google_content2 as content2;
29190/// use content2::api::OrdersRefundRequest;
29191/// # async fn dox() {
29192/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29193///
29194/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29195/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29196/// #     .with_native_roots()
29197/// #     .unwrap()
29198/// #     .https_only()
29199/// #     .enable_http2()
29200/// #     .build();
29201///
29202/// # let executor = hyper_util::rt::TokioExecutor::new();
29203/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29204/// #     secret,
29205/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29206/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
29207/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
29208/// #     ),
29209/// # ).build().await.unwrap();
29210///
29211/// # let client = hyper_util::client::legacy::Client::builder(
29212/// #     hyper_util::rt::TokioExecutor::new()
29213/// # )
29214/// # .build(
29215/// #     hyper_rustls::HttpsConnectorBuilder::new()
29216/// #         .with_native_roots()
29217/// #         .unwrap()
29218/// #         .https_or_http()
29219/// #         .enable_http2()
29220/// #         .build()
29221/// # );
29222/// # let mut hub = ShoppingContent::new(client, auth);
29223/// // As the method needs a request, you would usually fill it with the desired information
29224/// // into the respective structure. Some of the parts shown here might not be applicable !
29225/// // Values shown here are possibly random and not representative !
29226/// let mut req = OrdersRefundRequest::default();
29227///
29228/// // You can configure optional parameters by calling the respective setters at will, and
29229/// // execute the final call using `doit()`.
29230/// // Values shown here are possibly random and not representative !
29231/// let result = hub.orders().refund(req, 82, "orderId")
29232///              .doit().await;
29233/// # }
29234/// ```
29235pub struct OrderRefundCall<'a, C>
29236where
29237    C: 'a,
29238{
29239    hub: &'a ShoppingContent<C>,
29240    _request: OrdersRefundRequest,
29241    _merchant_id: u64,
29242    _order_id: String,
29243    _delegate: Option<&'a mut dyn common::Delegate>,
29244    _additional_params: HashMap<String, String>,
29245    _scopes: BTreeSet<String>,
29246}
29247
29248impl<'a, C> common::CallBuilder for OrderRefundCall<'a, C> {}
29249
29250impl<'a, C> OrderRefundCall<'a, C>
29251where
29252    C: common::Connector,
29253{
29254    /// Perform the operation you have build so far.
29255    pub async fn doit(mut self) -> common::Result<(common::Response, OrdersRefundResponse)> {
29256        use std::borrow::Cow;
29257        use std::io::{Read, Seek};
29258
29259        use common::{url::Params, ToParts};
29260        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29261
29262        let mut dd = common::DefaultDelegate;
29263        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29264        dlg.begin(common::MethodInfo {
29265            id: "content.orders.refund",
29266            http_method: hyper::Method::POST,
29267        });
29268
29269        for &field in ["alt", "merchantId", "orderId"].iter() {
29270            if self._additional_params.contains_key(field) {
29271                dlg.finished(false);
29272                return Err(common::Error::FieldClash(field));
29273            }
29274        }
29275
29276        let mut params = Params::with_capacity(5 + self._additional_params.len());
29277        params.push("merchantId", self._merchant_id.to_string());
29278        params.push("orderId", self._order_id);
29279
29280        params.extend(self._additional_params.iter());
29281
29282        params.push("alt", "json");
29283        let mut url = self.hub._base_url.clone() + "{merchantId}/orders/{orderId}/refund";
29284        if self._scopes.is_empty() {
29285            self._scopes.insert(Scope::Full.as_ref().to_string());
29286        }
29287
29288        #[allow(clippy::single_element_loop)]
29289        for &(find_this, param_name) in
29290            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
29291        {
29292            url = params.uri_replacement(url, param_name, find_this, false);
29293        }
29294        {
29295            let to_remove = ["orderId", "merchantId"];
29296            params.remove_params(&to_remove);
29297        }
29298
29299        let url = params.parse_with_url(&url);
29300
29301        let mut json_mime_type = mime::APPLICATION_JSON;
29302        let mut request_value_reader = {
29303            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29304            common::remove_json_null_values(&mut value);
29305            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29306            serde_json::to_writer(&mut dst, &value).unwrap();
29307            dst
29308        };
29309        let request_size = request_value_reader
29310            .seek(std::io::SeekFrom::End(0))
29311            .unwrap();
29312        request_value_reader
29313            .seek(std::io::SeekFrom::Start(0))
29314            .unwrap();
29315
29316        loop {
29317            let token = match self
29318                .hub
29319                .auth
29320                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29321                .await
29322            {
29323                Ok(token) => token,
29324                Err(e) => match dlg.token(e) {
29325                    Ok(token) => token,
29326                    Err(e) => {
29327                        dlg.finished(false);
29328                        return Err(common::Error::MissingToken(e));
29329                    }
29330                },
29331            };
29332            request_value_reader
29333                .seek(std::io::SeekFrom::Start(0))
29334                .unwrap();
29335            let mut req_result = {
29336                let client = &self.hub.client;
29337                dlg.pre_request();
29338                let mut req_builder = hyper::Request::builder()
29339                    .method(hyper::Method::POST)
29340                    .uri(url.as_str())
29341                    .header(USER_AGENT, self.hub._user_agent.clone());
29342
29343                if let Some(token) = token.as_ref() {
29344                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29345                }
29346
29347                let request = req_builder
29348                    .header(CONTENT_TYPE, json_mime_type.to_string())
29349                    .header(CONTENT_LENGTH, request_size as u64)
29350                    .body(common::to_body(
29351                        request_value_reader.get_ref().clone().into(),
29352                    ));
29353
29354                client.request(request.unwrap()).await
29355            };
29356
29357            match req_result {
29358                Err(err) => {
29359                    if let common::Retry::After(d) = dlg.http_error(&err) {
29360                        sleep(d).await;
29361                        continue;
29362                    }
29363                    dlg.finished(false);
29364                    return Err(common::Error::HttpError(err));
29365                }
29366                Ok(res) => {
29367                    let (mut parts, body) = res.into_parts();
29368                    let mut body = common::Body::new(body);
29369                    if !parts.status.is_success() {
29370                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29371                        let error = serde_json::from_str(&common::to_string(&bytes));
29372                        let response = common::to_response(parts, bytes.into());
29373
29374                        if let common::Retry::After(d) =
29375                            dlg.http_failure(&response, error.as_ref().ok())
29376                        {
29377                            sleep(d).await;
29378                            continue;
29379                        }
29380
29381                        dlg.finished(false);
29382
29383                        return Err(match error {
29384                            Ok(value) => common::Error::BadRequest(value),
29385                            _ => common::Error::Failure(response),
29386                        });
29387                    }
29388                    let response = {
29389                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29390                        let encoded = common::to_string(&bytes);
29391                        match serde_json::from_str(&encoded) {
29392                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29393                            Err(error) => {
29394                                dlg.response_json_decode_error(&encoded, &error);
29395                                return Err(common::Error::JsonDecodeError(
29396                                    encoded.to_string(),
29397                                    error,
29398                                ));
29399                            }
29400                        }
29401                    };
29402
29403                    dlg.finished(true);
29404                    return Ok(response);
29405                }
29406            }
29407        }
29408    }
29409
29410    ///
29411    /// Sets the *request* property to the given value.
29412    ///
29413    /// Even though the property as already been set when instantiating this call,
29414    /// we provide this method for API completeness.
29415    pub fn request(mut self, new_value: OrdersRefundRequest) -> OrderRefundCall<'a, C> {
29416        self._request = new_value;
29417        self
29418    }
29419    /// The ID of the account that manages the order. This cannot be a multi-client account.
29420    ///
29421    /// Sets the *merchant id* path property to the given value.
29422    ///
29423    /// Even though the property as already been set when instantiating this call,
29424    /// we provide this method for API completeness.
29425    pub fn merchant_id(mut self, new_value: u64) -> OrderRefundCall<'a, C> {
29426        self._merchant_id = new_value;
29427        self
29428    }
29429    /// The ID of the order to refund.
29430    ///
29431    /// Sets the *order id* path property to the given value.
29432    ///
29433    /// Even though the property as already been set when instantiating this call,
29434    /// we provide this method for API completeness.
29435    pub fn order_id(mut self, new_value: &str) -> OrderRefundCall<'a, C> {
29436        self._order_id = new_value.to_string();
29437        self
29438    }
29439    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29440    /// while executing the actual API request.
29441    ///
29442    /// ````text
29443    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29444    /// ````
29445    ///
29446    /// Sets the *delegate* property to the given value.
29447    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OrderRefundCall<'a, C> {
29448        self._delegate = Some(new_value);
29449        self
29450    }
29451
29452    /// Set any additional parameter of the query string used in the request.
29453    /// It should be used to set parameters which are not yet available through their own
29454    /// setters.
29455    ///
29456    /// Please note that this method must not be used to set any of the known parameters
29457    /// which have their own setter method. If done anyway, the request will fail.
29458    ///
29459    /// # Additional Parameters
29460    ///
29461    /// * *$.xgafv* (query-string) - V1 error format.
29462    /// * *access_token* (query-string) - OAuth access token.
29463    /// * *alt* (query-string) - Data format for response.
29464    /// * *callback* (query-string) - JSONP
29465    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29466    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
29467    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29468    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29469    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
29470    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29471    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29472    pub fn param<T>(mut self, name: T, value: T) -> OrderRefundCall<'a, C>
29473    where
29474        T: AsRef<str>,
29475    {
29476        self._additional_params
29477            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29478        self
29479    }
29480
29481    /// Identifies the authorization scope for the method you are building.
29482    ///
29483    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29484    /// [`Scope::Full`].
29485    ///
29486    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29487    /// tokens for more than one scope.
29488    ///
29489    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29490    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29491    /// sufficient, a read-write scope will do as well.
29492    pub fn add_scope<St>(mut self, scope: St) -> OrderRefundCall<'a, C>
29493    where
29494        St: AsRef<str>,
29495    {
29496        self._scopes.insert(String::from(scope.as_ref()));
29497        self
29498    }
29499    /// Identifies the authorization scope(s) for the method you are building.
29500    ///
29501    /// See [`Self::add_scope()`] for details.
29502    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderRefundCall<'a, C>
29503    where
29504        I: IntoIterator<Item = St>,
29505        St: AsRef<str>,
29506    {
29507        self._scopes
29508            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29509        self
29510    }
29511
29512    /// Removes all scopes, and no default scope will be used either.
29513    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29514    /// for details).
29515    pub fn clear_scopes(mut self) -> OrderRefundCall<'a, C> {
29516        self._scopes.clear();
29517        self
29518    }
29519}
29520
29521/// Rejects return on an line item.
29522///
29523/// A builder for the *rejectreturnlineitem* method supported by a *order* resource.
29524/// It is not used directly, but through a [`OrderMethods`] instance.
29525///
29526/// # Example
29527///
29528/// Instantiate a resource method builder
29529///
29530/// ```test_harness,no_run
29531/// # extern crate hyper;
29532/// # extern crate hyper_rustls;
29533/// # extern crate google_content2 as content2;
29534/// use content2::api::OrdersRejectReturnLineItemRequest;
29535/// # async fn dox() {
29536/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29537///
29538/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29539/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29540/// #     .with_native_roots()
29541/// #     .unwrap()
29542/// #     .https_only()
29543/// #     .enable_http2()
29544/// #     .build();
29545///
29546/// # let executor = hyper_util::rt::TokioExecutor::new();
29547/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29548/// #     secret,
29549/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29550/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
29551/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
29552/// #     ),
29553/// # ).build().await.unwrap();
29554///
29555/// # let client = hyper_util::client::legacy::Client::builder(
29556/// #     hyper_util::rt::TokioExecutor::new()
29557/// # )
29558/// # .build(
29559/// #     hyper_rustls::HttpsConnectorBuilder::new()
29560/// #         .with_native_roots()
29561/// #         .unwrap()
29562/// #         .https_or_http()
29563/// #         .enable_http2()
29564/// #         .build()
29565/// # );
29566/// # let mut hub = ShoppingContent::new(client, auth);
29567/// // As the method needs a request, you would usually fill it with the desired information
29568/// // into the respective structure. Some of the parts shown here might not be applicable !
29569/// // Values shown here are possibly random and not representative !
29570/// let mut req = OrdersRejectReturnLineItemRequest::default();
29571///
29572/// // You can configure optional parameters by calling the respective setters at will, and
29573/// // execute the final call using `doit()`.
29574/// // Values shown here are possibly random and not representative !
29575/// let result = hub.orders().rejectreturnlineitem(req, 39, "orderId")
29576///              .doit().await;
29577/// # }
29578/// ```
29579pub struct OrderRejectreturnlineitemCall<'a, C>
29580where
29581    C: 'a,
29582{
29583    hub: &'a ShoppingContent<C>,
29584    _request: OrdersRejectReturnLineItemRequest,
29585    _merchant_id: u64,
29586    _order_id: String,
29587    _delegate: Option<&'a mut dyn common::Delegate>,
29588    _additional_params: HashMap<String, String>,
29589    _scopes: BTreeSet<String>,
29590}
29591
29592impl<'a, C> common::CallBuilder for OrderRejectreturnlineitemCall<'a, C> {}
29593
29594impl<'a, C> OrderRejectreturnlineitemCall<'a, C>
29595where
29596    C: common::Connector,
29597{
29598    /// Perform the operation you have build so far.
29599    pub async fn doit(
29600        mut self,
29601    ) -> common::Result<(common::Response, OrdersRejectReturnLineItemResponse)> {
29602        use std::borrow::Cow;
29603        use std::io::{Read, Seek};
29604
29605        use common::{url::Params, ToParts};
29606        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29607
29608        let mut dd = common::DefaultDelegate;
29609        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29610        dlg.begin(common::MethodInfo {
29611            id: "content.orders.rejectreturnlineitem",
29612            http_method: hyper::Method::POST,
29613        });
29614
29615        for &field in ["alt", "merchantId", "orderId"].iter() {
29616            if self._additional_params.contains_key(field) {
29617                dlg.finished(false);
29618                return Err(common::Error::FieldClash(field));
29619            }
29620        }
29621
29622        let mut params = Params::with_capacity(5 + self._additional_params.len());
29623        params.push("merchantId", self._merchant_id.to_string());
29624        params.push("orderId", self._order_id);
29625
29626        params.extend(self._additional_params.iter());
29627
29628        params.push("alt", "json");
29629        let mut url =
29630            self.hub._base_url.clone() + "{merchantId}/orders/{orderId}/rejectReturnLineItem";
29631        if self._scopes.is_empty() {
29632            self._scopes.insert(Scope::Full.as_ref().to_string());
29633        }
29634
29635        #[allow(clippy::single_element_loop)]
29636        for &(find_this, param_name) in
29637            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
29638        {
29639            url = params.uri_replacement(url, param_name, find_this, false);
29640        }
29641        {
29642            let to_remove = ["orderId", "merchantId"];
29643            params.remove_params(&to_remove);
29644        }
29645
29646        let url = params.parse_with_url(&url);
29647
29648        let mut json_mime_type = mime::APPLICATION_JSON;
29649        let mut request_value_reader = {
29650            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29651            common::remove_json_null_values(&mut value);
29652            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29653            serde_json::to_writer(&mut dst, &value).unwrap();
29654            dst
29655        };
29656        let request_size = request_value_reader
29657            .seek(std::io::SeekFrom::End(0))
29658            .unwrap();
29659        request_value_reader
29660            .seek(std::io::SeekFrom::Start(0))
29661            .unwrap();
29662
29663        loop {
29664            let token = match self
29665                .hub
29666                .auth
29667                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29668                .await
29669            {
29670                Ok(token) => token,
29671                Err(e) => match dlg.token(e) {
29672                    Ok(token) => token,
29673                    Err(e) => {
29674                        dlg.finished(false);
29675                        return Err(common::Error::MissingToken(e));
29676                    }
29677                },
29678            };
29679            request_value_reader
29680                .seek(std::io::SeekFrom::Start(0))
29681                .unwrap();
29682            let mut req_result = {
29683                let client = &self.hub.client;
29684                dlg.pre_request();
29685                let mut req_builder = hyper::Request::builder()
29686                    .method(hyper::Method::POST)
29687                    .uri(url.as_str())
29688                    .header(USER_AGENT, self.hub._user_agent.clone());
29689
29690                if let Some(token) = token.as_ref() {
29691                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29692                }
29693
29694                let request = req_builder
29695                    .header(CONTENT_TYPE, json_mime_type.to_string())
29696                    .header(CONTENT_LENGTH, request_size as u64)
29697                    .body(common::to_body(
29698                        request_value_reader.get_ref().clone().into(),
29699                    ));
29700
29701                client.request(request.unwrap()).await
29702            };
29703
29704            match req_result {
29705                Err(err) => {
29706                    if let common::Retry::After(d) = dlg.http_error(&err) {
29707                        sleep(d).await;
29708                        continue;
29709                    }
29710                    dlg.finished(false);
29711                    return Err(common::Error::HttpError(err));
29712                }
29713                Ok(res) => {
29714                    let (mut parts, body) = res.into_parts();
29715                    let mut body = common::Body::new(body);
29716                    if !parts.status.is_success() {
29717                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29718                        let error = serde_json::from_str(&common::to_string(&bytes));
29719                        let response = common::to_response(parts, bytes.into());
29720
29721                        if let common::Retry::After(d) =
29722                            dlg.http_failure(&response, error.as_ref().ok())
29723                        {
29724                            sleep(d).await;
29725                            continue;
29726                        }
29727
29728                        dlg.finished(false);
29729
29730                        return Err(match error {
29731                            Ok(value) => common::Error::BadRequest(value),
29732                            _ => common::Error::Failure(response),
29733                        });
29734                    }
29735                    let response = {
29736                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29737                        let encoded = common::to_string(&bytes);
29738                        match serde_json::from_str(&encoded) {
29739                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29740                            Err(error) => {
29741                                dlg.response_json_decode_error(&encoded, &error);
29742                                return Err(common::Error::JsonDecodeError(
29743                                    encoded.to_string(),
29744                                    error,
29745                                ));
29746                            }
29747                        }
29748                    };
29749
29750                    dlg.finished(true);
29751                    return Ok(response);
29752                }
29753            }
29754        }
29755    }
29756
29757    ///
29758    /// Sets the *request* property to the given value.
29759    ///
29760    /// Even though the property as already been set when instantiating this call,
29761    /// we provide this method for API completeness.
29762    pub fn request(
29763        mut self,
29764        new_value: OrdersRejectReturnLineItemRequest,
29765    ) -> OrderRejectreturnlineitemCall<'a, C> {
29766        self._request = new_value;
29767        self
29768    }
29769    /// The ID of the account that manages the order. This cannot be a multi-client account.
29770    ///
29771    /// Sets the *merchant id* path property to the given value.
29772    ///
29773    /// Even though the property as already been set when instantiating this call,
29774    /// we provide this method for API completeness.
29775    pub fn merchant_id(mut self, new_value: u64) -> OrderRejectreturnlineitemCall<'a, C> {
29776        self._merchant_id = new_value;
29777        self
29778    }
29779    /// The ID of the order.
29780    ///
29781    /// Sets the *order id* path property to the given value.
29782    ///
29783    /// Even though the property as already been set when instantiating this call,
29784    /// we provide this method for API completeness.
29785    pub fn order_id(mut self, new_value: &str) -> OrderRejectreturnlineitemCall<'a, C> {
29786        self._order_id = new_value.to_string();
29787        self
29788    }
29789    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29790    /// while executing the actual API request.
29791    ///
29792    /// ````text
29793    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29794    /// ````
29795    ///
29796    /// Sets the *delegate* property to the given value.
29797    pub fn delegate(
29798        mut self,
29799        new_value: &'a mut dyn common::Delegate,
29800    ) -> OrderRejectreturnlineitemCall<'a, C> {
29801        self._delegate = Some(new_value);
29802        self
29803    }
29804
29805    /// Set any additional parameter of the query string used in the request.
29806    /// It should be used to set parameters which are not yet available through their own
29807    /// setters.
29808    ///
29809    /// Please note that this method must not be used to set any of the known parameters
29810    /// which have their own setter method. If done anyway, the request will fail.
29811    ///
29812    /// # Additional Parameters
29813    ///
29814    /// * *$.xgafv* (query-string) - V1 error format.
29815    /// * *access_token* (query-string) - OAuth access token.
29816    /// * *alt* (query-string) - Data format for response.
29817    /// * *callback* (query-string) - JSONP
29818    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29819    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
29820    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29821    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29822    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
29823    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29824    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29825    pub fn param<T>(mut self, name: T, value: T) -> OrderRejectreturnlineitemCall<'a, C>
29826    where
29827        T: AsRef<str>,
29828    {
29829        self._additional_params
29830            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29831        self
29832    }
29833
29834    /// Identifies the authorization scope for the method you are building.
29835    ///
29836    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29837    /// [`Scope::Full`].
29838    ///
29839    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29840    /// tokens for more than one scope.
29841    ///
29842    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29843    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29844    /// sufficient, a read-write scope will do as well.
29845    pub fn add_scope<St>(mut self, scope: St) -> OrderRejectreturnlineitemCall<'a, C>
29846    where
29847        St: AsRef<str>,
29848    {
29849        self._scopes.insert(String::from(scope.as_ref()));
29850        self
29851    }
29852    /// Identifies the authorization scope(s) for the method you are building.
29853    ///
29854    /// See [`Self::add_scope()`] for details.
29855    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderRejectreturnlineitemCall<'a, C>
29856    where
29857        I: IntoIterator<Item = St>,
29858        St: AsRef<str>,
29859    {
29860        self._scopes
29861            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29862        self
29863    }
29864
29865    /// Removes all scopes, and no default scope will be used either.
29866    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29867    /// for details).
29868    pub fn clear_scopes(mut self) -> OrderRejectreturnlineitemCall<'a, C> {
29869        self._scopes.clear();
29870        self
29871    }
29872}
29873
29874/// Returns a line item.
29875///
29876/// A builder for the *returnlineitem* method supported by a *order* resource.
29877/// It is not used directly, but through a [`OrderMethods`] instance.
29878///
29879/// # Example
29880///
29881/// Instantiate a resource method builder
29882///
29883/// ```test_harness,no_run
29884/// # extern crate hyper;
29885/// # extern crate hyper_rustls;
29886/// # extern crate google_content2 as content2;
29887/// use content2::api::OrdersReturnLineItemRequest;
29888/// # async fn dox() {
29889/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29890///
29891/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29892/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29893/// #     .with_native_roots()
29894/// #     .unwrap()
29895/// #     .https_only()
29896/// #     .enable_http2()
29897/// #     .build();
29898///
29899/// # let executor = hyper_util::rt::TokioExecutor::new();
29900/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29901/// #     secret,
29902/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29903/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
29904/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
29905/// #     ),
29906/// # ).build().await.unwrap();
29907///
29908/// # let client = hyper_util::client::legacy::Client::builder(
29909/// #     hyper_util::rt::TokioExecutor::new()
29910/// # )
29911/// # .build(
29912/// #     hyper_rustls::HttpsConnectorBuilder::new()
29913/// #         .with_native_roots()
29914/// #         .unwrap()
29915/// #         .https_or_http()
29916/// #         .enable_http2()
29917/// #         .build()
29918/// # );
29919/// # let mut hub = ShoppingContent::new(client, auth);
29920/// // As the method needs a request, you would usually fill it with the desired information
29921/// // into the respective structure. Some of the parts shown here might not be applicable !
29922/// // Values shown here are possibly random and not representative !
29923/// let mut req = OrdersReturnLineItemRequest::default();
29924///
29925/// // You can configure optional parameters by calling the respective setters at will, and
29926/// // execute the final call using `doit()`.
29927/// // Values shown here are possibly random and not representative !
29928/// let result = hub.orders().returnlineitem(req, 69, "orderId")
29929///              .doit().await;
29930/// # }
29931/// ```
29932pub struct OrderReturnlineitemCall<'a, C>
29933where
29934    C: 'a,
29935{
29936    hub: &'a ShoppingContent<C>,
29937    _request: OrdersReturnLineItemRequest,
29938    _merchant_id: u64,
29939    _order_id: String,
29940    _delegate: Option<&'a mut dyn common::Delegate>,
29941    _additional_params: HashMap<String, String>,
29942    _scopes: BTreeSet<String>,
29943}
29944
29945impl<'a, C> common::CallBuilder for OrderReturnlineitemCall<'a, C> {}
29946
29947impl<'a, C> OrderReturnlineitemCall<'a, C>
29948where
29949    C: common::Connector,
29950{
29951    /// Perform the operation you have build so far.
29952    pub async fn doit(
29953        mut self,
29954    ) -> common::Result<(common::Response, OrdersReturnLineItemResponse)> {
29955        use std::borrow::Cow;
29956        use std::io::{Read, Seek};
29957
29958        use common::{url::Params, ToParts};
29959        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29960
29961        let mut dd = common::DefaultDelegate;
29962        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29963        dlg.begin(common::MethodInfo {
29964            id: "content.orders.returnlineitem",
29965            http_method: hyper::Method::POST,
29966        });
29967
29968        for &field in ["alt", "merchantId", "orderId"].iter() {
29969            if self._additional_params.contains_key(field) {
29970                dlg.finished(false);
29971                return Err(common::Error::FieldClash(field));
29972            }
29973        }
29974
29975        let mut params = Params::with_capacity(5 + self._additional_params.len());
29976        params.push("merchantId", self._merchant_id.to_string());
29977        params.push("orderId", self._order_id);
29978
29979        params.extend(self._additional_params.iter());
29980
29981        params.push("alt", "json");
29982        let mut url = self.hub._base_url.clone() + "{merchantId}/orders/{orderId}/returnLineItem";
29983        if self._scopes.is_empty() {
29984            self._scopes.insert(Scope::Full.as_ref().to_string());
29985        }
29986
29987        #[allow(clippy::single_element_loop)]
29988        for &(find_this, param_name) in
29989            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
29990        {
29991            url = params.uri_replacement(url, param_name, find_this, false);
29992        }
29993        {
29994            let to_remove = ["orderId", "merchantId"];
29995            params.remove_params(&to_remove);
29996        }
29997
29998        let url = params.parse_with_url(&url);
29999
30000        let mut json_mime_type = mime::APPLICATION_JSON;
30001        let mut request_value_reader = {
30002            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30003            common::remove_json_null_values(&mut value);
30004            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30005            serde_json::to_writer(&mut dst, &value).unwrap();
30006            dst
30007        };
30008        let request_size = request_value_reader
30009            .seek(std::io::SeekFrom::End(0))
30010            .unwrap();
30011        request_value_reader
30012            .seek(std::io::SeekFrom::Start(0))
30013            .unwrap();
30014
30015        loop {
30016            let token = match self
30017                .hub
30018                .auth
30019                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30020                .await
30021            {
30022                Ok(token) => token,
30023                Err(e) => match dlg.token(e) {
30024                    Ok(token) => token,
30025                    Err(e) => {
30026                        dlg.finished(false);
30027                        return Err(common::Error::MissingToken(e));
30028                    }
30029                },
30030            };
30031            request_value_reader
30032                .seek(std::io::SeekFrom::Start(0))
30033                .unwrap();
30034            let mut req_result = {
30035                let client = &self.hub.client;
30036                dlg.pre_request();
30037                let mut req_builder = hyper::Request::builder()
30038                    .method(hyper::Method::POST)
30039                    .uri(url.as_str())
30040                    .header(USER_AGENT, self.hub._user_agent.clone());
30041
30042                if let Some(token) = token.as_ref() {
30043                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30044                }
30045
30046                let request = req_builder
30047                    .header(CONTENT_TYPE, json_mime_type.to_string())
30048                    .header(CONTENT_LENGTH, request_size as u64)
30049                    .body(common::to_body(
30050                        request_value_reader.get_ref().clone().into(),
30051                    ));
30052
30053                client.request(request.unwrap()).await
30054            };
30055
30056            match req_result {
30057                Err(err) => {
30058                    if let common::Retry::After(d) = dlg.http_error(&err) {
30059                        sleep(d).await;
30060                        continue;
30061                    }
30062                    dlg.finished(false);
30063                    return Err(common::Error::HttpError(err));
30064                }
30065                Ok(res) => {
30066                    let (mut parts, body) = res.into_parts();
30067                    let mut body = common::Body::new(body);
30068                    if !parts.status.is_success() {
30069                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30070                        let error = serde_json::from_str(&common::to_string(&bytes));
30071                        let response = common::to_response(parts, bytes.into());
30072
30073                        if let common::Retry::After(d) =
30074                            dlg.http_failure(&response, error.as_ref().ok())
30075                        {
30076                            sleep(d).await;
30077                            continue;
30078                        }
30079
30080                        dlg.finished(false);
30081
30082                        return Err(match error {
30083                            Ok(value) => common::Error::BadRequest(value),
30084                            _ => common::Error::Failure(response),
30085                        });
30086                    }
30087                    let response = {
30088                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30089                        let encoded = common::to_string(&bytes);
30090                        match serde_json::from_str(&encoded) {
30091                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30092                            Err(error) => {
30093                                dlg.response_json_decode_error(&encoded, &error);
30094                                return Err(common::Error::JsonDecodeError(
30095                                    encoded.to_string(),
30096                                    error,
30097                                ));
30098                            }
30099                        }
30100                    };
30101
30102                    dlg.finished(true);
30103                    return Ok(response);
30104                }
30105            }
30106        }
30107    }
30108
30109    ///
30110    /// Sets the *request* property to the given value.
30111    ///
30112    /// Even though the property as already been set when instantiating this call,
30113    /// we provide this method for API completeness.
30114    pub fn request(
30115        mut self,
30116        new_value: OrdersReturnLineItemRequest,
30117    ) -> OrderReturnlineitemCall<'a, C> {
30118        self._request = new_value;
30119        self
30120    }
30121    /// The ID of the account that manages the order. This cannot be a multi-client account.
30122    ///
30123    /// Sets the *merchant id* path property to the given value.
30124    ///
30125    /// Even though the property as already been set when instantiating this call,
30126    /// we provide this method for API completeness.
30127    pub fn merchant_id(mut self, new_value: u64) -> OrderReturnlineitemCall<'a, C> {
30128        self._merchant_id = new_value;
30129        self
30130    }
30131    /// The ID of the order.
30132    ///
30133    /// Sets the *order id* path property to the given value.
30134    ///
30135    /// Even though the property as already been set when instantiating this call,
30136    /// we provide this method for API completeness.
30137    pub fn order_id(mut self, new_value: &str) -> OrderReturnlineitemCall<'a, C> {
30138        self._order_id = new_value.to_string();
30139        self
30140    }
30141    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30142    /// while executing the actual API request.
30143    ///
30144    /// ````text
30145    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30146    /// ````
30147    ///
30148    /// Sets the *delegate* property to the given value.
30149    pub fn delegate(
30150        mut self,
30151        new_value: &'a mut dyn common::Delegate,
30152    ) -> OrderReturnlineitemCall<'a, C> {
30153        self._delegate = Some(new_value);
30154        self
30155    }
30156
30157    /// Set any additional parameter of the query string used in the request.
30158    /// It should be used to set parameters which are not yet available through their own
30159    /// setters.
30160    ///
30161    /// Please note that this method must not be used to set any of the known parameters
30162    /// which have their own setter method. If done anyway, the request will fail.
30163    ///
30164    /// # Additional Parameters
30165    ///
30166    /// * *$.xgafv* (query-string) - V1 error format.
30167    /// * *access_token* (query-string) - OAuth access token.
30168    /// * *alt* (query-string) - Data format for response.
30169    /// * *callback* (query-string) - JSONP
30170    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30171    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
30172    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30173    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30174    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
30175    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30176    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30177    pub fn param<T>(mut self, name: T, value: T) -> OrderReturnlineitemCall<'a, C>
30178    where
30179        T: AsRef<str>,
30180    {
30181        self._additional_params
30182            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30183        self
30184    }
30185
30186    /// Identifies the authorization scope for the method you are building.
30187    ///
30188    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30189    /// [`Scope::Full`].
30190    ///
30191    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30192    /// tokens for more than one scope.
30193    ///
30194    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30195    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30196    /// sufficient, a read-write scope will do as well.
30197    pub fn add_scope<St>(mut self, scope: St) -> OrderReturnlineitemCall<'a, C>
30198    where
30199        St: AsRef<str>,
30200    {
30201        self._scopes.insert(String::from(scope.as_ref()));
30202        self
30203    }
30204    /// Identifies the authorization scope(s) for the method you are building.
30205    ///
30206    /// See [`Self::add_scope()`] for details.
30207    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderReturnlineitemCall<'a, C>
30208    where
30209        I: IntoIterator<Item = St>,
30210        St: AsRef<str>,
30211    {
30212        self._scopes
30213            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30214        self
30215    }
30216
30217    /// Removes all scopes, and no default scope will be used either.
30218    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30219    /// for details).
30220    pub fn clear_scopes(mut self) -> OrderReturnlineitemCall<'a, C> {
30221        self._scopes.clear();
30222        self
30223    }
30224}
30225
30226/// Returns and refunds a line item. Note that this method can only be called on fully shipped orders. Please also note that the Orderreturns API is the preferred way to handle returns after you receive a return from a customer. You can use Orderreturns.list or Orderreturns.get to search for the return, and then use Orderreturns.processreturn to issue the refund. If the return cannot be found, then we recommend using this API to issue a refund.
30227///
30228/// A builder for the *returnrefundlineitem* method supported by a *order* resource.
30229/// It is not used directly, but through a [`OrderMethods`] instance.
30230///
30231/// # Example
30232///
30233/// Instantiate a resource method builder
30234///
30235/// ```test_harness,no_run
30236/// # extern crate hyper;
30237/// # extern crate hyper_rustls;
30238/// # extern crate google_content2 as content2;
30239/// use content2::api::OrdersReturnRefundLineItemRequest;
30240/// # async fn dox() {
30241/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30242///
30243/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30244/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
30245/// #     .with_native_roots()
30246/// #     .unwrap()
30247/// #     .https_only()
30248/// #     .enable_http2()
30249/// #     .build();
30250///
30251/// # let executor = hyper_util::rt::TokioExecutor::new();
30252/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
30253/// #     secret,
30254/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30255/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
30256/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
30257/// #     ),
30258/// # ).build().await.unwrap();
30259///
30260/// # let client = hyper_util::client::legacy::Client::builder(
30261/// #     hyper_util::rt::TokioExecutor::new()
30262/// # )
30263/// # .build(
30264/// #     hyper_rustls::HttpsConnectorBuilder::new()
30265/// #         .with_native_roots()
30266/// #         .unwrap()
30267/// #         .https_or_http()
30268/// #         .enable_http2()
30269/// #         .build()
30270/// # );
30271/// # let mut hub = ShoppingContent::new(client, auth);
30272/// // As the method needs a request, you would usually fill it with the desired information
30273/// // into the respective structure. Some of the parts shown here might not be applicable !
30274/// // Values shown here are possibly random and not representative !
30275/// let mut req = OrdersReturnRefundLineItemRequest::default();
30276///
30277/// // You can configure optional parameters by calling the respective setters at will, and
30278/// // execute the final call using `doit()`.
30279/// // Values shown here are possibly random and not representative !
30280/// let result = hub.orders().returnrefundlineitem(req, 99, "orderId")
30281///              .doit().await;
30282/// # }
30283/// ```
30284pub struct OrderReturnrefundlineitemCall<'a, C>
30285where
30286    C: 'a,
30287{
30288    hub: &'a ShoppingContent<C>,
30289    _request: OrdersReturnRefundLineItemRequest,
30290    _merchant_id: u64,
30291    _order_id: String,
30292    _delegate: Option<&'a mut dyn common::Delegate>,
30293    _additional_params: HashMap<String, String>,
30294    _scopes: BTreeSet<String>,
30295}
30296
30297impl<'a, C> common::CallBuilder for OrderReturnrefundlineitemCall<'a, C> {}
30298
30299impl<'a, C> OrderReturnrefundlineitemCall<'a, C>
30300where
30301    C: common::Connector,
30302{
30303    /// Perform the operation you have build so far.
30304    pub async fn doit(
30305        mut self,
30306    ) -> common::Result<(common::Response, OrdersReturnRefundLineItemResponse)> {
30307        use std::borrow::Cow;
30308        use std::io::{Read, Seek};
30309
30310        use common::{url::Params, ToParts};
30311        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30312
30313        let mut dd = common::DefaultDelegate;
30314        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30315        dlg.begin(common::MethodInfo {
30316            id: "content.orders.returnrefundlineitem",
30317            http_method: hyper::Method::POST,
30318        });
30319
30320        for &field in ["alt", "merchantId", "orderId"].iter() {
30321            if self._additional_params.contains_key(field) {
30322                dlg.finished(false);
30323                return Err(common::Error::FieldClash(field));
30324            }
30325        }
30326
30327        let mut params = Params::with_capacity(5 + self._additional_params.len());
30328        params.push("merchantId", self._merchant_id.to_string());
30329        params.push("orderId", self._order_id);
30330
30331        params.extend(self._additional_params.iter());
30332
30333        params.push("alt", "json");
30334        let mut url =
30335            self.hub._base_url.clone() + "{merchantId}/orders/{orderId}/returnRefundLineItem";
30336        if self._scopes.is_empty() {
30337            self._scopes.insert(Scope::Full.as_ref().to_string());
30338        }
30339
30340        #[allow(clippy::single_element_loop)]
30341        for &(find_this, param_name) in
30342            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
30343        {
30344            url = params.uri_replacement(url, param_name, find_this, false);
30345        }
30346        {
30347            let to_remove = ["orderId", "merchantId"];
30348            params.remove_params(&to_remove);
30349        }
30350
30351        let url = params.parse_with_url(&url);
30352
30353        let mut json_mime_type = mime::APPLICATION_JSON;
30354        let mut request_value_reader = {
30355            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30356            common::remove_json_null_values(&mut value);
30357            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30358            serde_json::to_writer(&mut dst, &value).unwrap();
30359            dst
30360        };
30361        let request_size = request_value_reader
30362            .seek(std::io::SeekFrom::End(0))
30363            .unwrap();
30364        request_value_reader
30365            .seek(std::io::SeekFrom::Start(0))
30366            .unwrap();
30367
30368        loop {
30369            let token = match self
30370                .hub
30371                .auth
30372                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30373                .await
30374            {
30375                Ok(token) => token,
30376                Err(e) => match dlg.token(e) {
30377                    Ok(token) => token,
30378                    Err(e) => {
30379                        dlg.finished(false);
30380                        return Err(common::Error::MissingToken(e));
30381                    }
30382                },
30383            };
30384            request_value_reader
30385                .seek(std::io::SeekFrom::Start(0))
30386                .unwrap();
30387            let mut req_result = {
30388                let client = &self.hub.client;
30389                dlg.pre_request();
30390                let mut req_builder = hyper::Request::builder()
30391                    .method(hyper::Method::POST)
30392                    .uri(url.as_str())
30393                    .header(USER_AGENT, self.hub._user_agent.clone());
30394
30395                if let Some(token) = token.as_ref() {
30396                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30397                }
30398
30399                let request = req_builder
30400                    .header(CONTENT_TYPE, json_mime_type.to_string())
30401                    .header(CONTENT_LENGTH, request_size as u64)
30402                    .body(common::to_body(
30403                        request_value_reader.get_ref().clone().into(),
30404                    ));
30405
30406                client.request(request.unwrap()).await
30407            };
30408
30409            match req_result {
30410                Err(err) => {
30411                    if let common::Retry::After(d) = dlg.http_error(&err) {
30412                        sleep(d).await;
30413                        continue;
30414                    }
30415                    dlg.finished(false);
30416                    return Err(common::Error::HttpError(err));
30417                }
30418                Ok(res) => {
30419                    let (mut parts, body) = res.into_parts();
30420                    let mut body = common::Body::new(body);
30421                    if !parts.status.is_success() {
30422                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30423                        let error = serde_json::from_str(&common::to_string(&bytes));
30424                        let response = common::to_response(parts, bytes.into());
30425
30426                        if let common::Retry::After(d) =
30427                            dlg.http_failure(&response, error.as_ref().ok())
30428                        {
30429                            sleep(d).await;
30430                            continue;
30431                        }
30432
30433                        dlg.finished(false);
30434
30435                        return Err(match error {
30436                            Ok(value) => common::Error::BadRequest(value),
30437                            _ => common::Error::Failure(response),
30438                        });
30439                    }
30440                    let response = {
30441                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30442                        let encoded = common::to_string(&bytes);
30443                        match serde_json::from_str(&encoded) {
30444                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30445                            Err(error) => {
30446                                dlg.response_json_decode_error(&encoded, &error);
30447                                return Err(common::Error::JsonDecodeError(
30448                                    encoded.to_string(),
30449                                    error,
30450                                ));
30451                            }
30452                        }
30453                    };
30454
30455                    dlg.finished(true);
30456                    return Ok(response);
30457                }
30458            }
30459        }
30460    }
30461
30462    ///
30463    /// Sets the *request* property to the given value.
30464    ///
30465    /// Even though the property as already been set when instantiating this call,
30466    /// we provide this method for API completeness.
30467    pub fn request(
30468        mut self,
30469        new_value: OrdersReturnRefundLineItemRequest,
30470    ) -> OrderReturnrefundlineitemCall<'a, C> {
30471        self._request = new_value;
30472        self
30473    }
30474    /// The ID of the account that manages the order. This cannot be a multi-client account.
30475    ///
30476    /// Sets the *merchant id* path property to the given value.
30477    ///
30478    /// Even though the property as already been set when instantiating this call,
30479    /// we provide this method for API completeness.
30480    pub fn merchant_id(mut self, new_value: u64) -> OrderReturnrefundlineitemCall<'a, C> {
30481        self._merchant_id = new_value;
30482        self
30483    }
30484    /// The ID of the order.
30485    ///
30486    /// Sets the *order id* path property to the given value.
30487    ///
30488    /// Even though the property as already been set when instantiating this call,
30489    /// we provide this method for API completeness.
30490    pub fn order_id(mut self, new_value: &str) -> OrderReturnrefundlineitemCall<'a, C> {
30491        self._order_id = new_value.to_string();
30492        self
30493    }
30494    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30495    /// while executing the actual API request.
30496    ///
30497    /// ````text
30498    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30499    /// ````
30500    ///
30501    /// Sets the *delegate* property to the given value.
30502    pub fn delegate(
30503        mut self,
30504        new_value: &'a mut dyn common::Delegate,
30505    ) -> OrderReturnrefundlineitemCall<'a, C> {
30506        self._delegate = Some(new_value);
30507        self
30508    }
30509
30510    /// Set any additional parameter of the query string used in the request.
30511    /// It should be used to set parameters which are not yet available through their own
30512    /// setters.
30513    ///
30514    /// Please note that this method must not be used to set any of the known parameters
30515    /// which have their own setter method. If done anyway, the request will fail.
30516    ///
30517    /// # Additional Parameters
30518    ///
30519    /// * *$.xgafv* (query-string) - V1 error format.
30520    /// * *access_token* (query-string) - OAuth access token.
30521    /// * *alt* (query-string) - Data format for response.
30522    /// * *callback* (query-string) - JSONP
30523    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30524    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
30525    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30526    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30527    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
30528    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30529    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30530    pub fn param<T>(mut self, name: T, value: T) -> OrderReturnrefundlineitemCall<'a, C>
30531    where
30532        T: AsRef<str>,
30533    {
30534        self._additional_params
30535            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30536        self
30537    }
30538
30539    /// Identifies the authorization scope for the method you are building.
30540    ///
30541    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30542    /// [`Scope::Full`].
30543    ///
30544    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30545    /// tokens for more than one scope.
30546    ///
30547    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30548    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30549    /// sufficient, a read-write scope will do as well.
30550    pub fn add_scope<St>(mut self, scope: St) -> OrderReturnrefundlineitemCall<'a, C>
30551    where
30552        St: AsRef<str>,
30553    {
30554        self._scopes.insert(String::from(scope.as_ref()));
30555        self
30556    }
30557    /// Identifies the authorization scope(s) for the method you are building.
30558    ///
30559    /// See [`Self::add_scope()`] for details.
30560    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderReturnrefundlineitemCall<'a, C>
30561    where
30562        I: IntoIterator<Item = St>,
30563        St: AsRef<str>,
30564    {
30565        self._scopes
30566            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30567        self
30568    }
30569
30570    /// Removes all scopes, and no default scope will be used either.
30571    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30572    /// for details).
30573    pub fn clear_scopes(mut self) -> OrderReturnrefundlineitemCall<'a, C> {
30574        self._scopes.clear();
30575        self
30576    }
30577}
30578
30579/// Sets (or overrides if it already exists) merchant provided annotations in the form of key-value pairs. A common use case would be to supply us with additional structured information about a line item that cannot be provided via other methods. Submitted key-value pairs can be retrieved as part of the orders resource.
30580///
30581/// A builder for the *setlineitemmetadata* method supported by a *order* resource.
30582/// It is not used directly, but through a [`OrderMethods`] instance.
30583///
30584/// # Example
30585///
30586/// Instantiate a resource method builder
30587///
30588/// ```test_harness,no_run
30589/// # extern crate hyper;
30590/// # extern crate hyper_rustls;
30591/// # extern crate google_content2 as content2;
30592/// use content2::api::OrdersSetLineItemMetadataRequest;
30593/// # async fn dox() {
30594/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30595///
30596/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30597/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
30598/// #     .with_native_roots()
30599/// #     .unwrap()
30600/// #     .https_only()
30601/// #     .enable_http2()
30602/// #     .build();
30603///
30604/// # let executor = hyper_util::rt::TokioExecutor::new();
30605/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
30606/// #     secret,
30607/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30608/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
30609/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
30610/// #     ),
30611/// # ).build().await.unwrap();
30612///
30613/// # let client = hyper_util::client::legacy::Client::builder(
30614/// #     hyper_util::rt::TokioExecutor::new()
30615/// # )
30616/// # .build(
30617/// #     hyper_rustls::HttpsConnectorBuilder::new()
30618/// #         .with_native_roots()
30619/// #         .unwrap()
30620/// #         .https_or_http()
30621/// #         .enable_http2()
30622/// #         .build()
30623/// # );
30624/// # let mut hub = ShoppingContent::new(client, auth);
30625/// // As the method needs a request, you would usually fill it with the desired information
30626/// // into the respective structure. Some of the parts shown here might not be applicable !
30627/// // Values shown here are possibly random and not representative !
30628/// let mut req = OrdersSetLineItemMetadataRequest::default();
30629///
30630/// // You can configure optional parameters by calling the respective setters at will, and
30631/// // execute the final call using `doit()`.
30632/// // Values shown here are possibly random and not representative !
30633/// let result = hub.orders().setlineitemmetadata(req, 45, "orderId")
30634///              .doit().await;
30635/// # }
30636/// ```
30637pub struct OrderSetlineitemmetadataCall<'a, C>
30638where
30639    C: 'a,
30640{
30641    hub: &'a ShoppingContent<C>,
30642    _request: OrdersSetLineItemMetadataRequest,
30643    _merchant_id: u64,
30644    _order_id: String,
30645    _delegate: Option<&'a mut dyn common::Delegate>,
30646    _additional_params: HashMap<String, String>,
30647    _scopes: BTreeSet<String>,
30648}
30649
30650impl<'a, C> common::CallBuilder for OrderSetlineitemmetadataCall<'a, C> {}
30651
30652impl<'a, C> OrderSetlineitemmetadataCall<'a, C>
30653where
30654    C: common::Connector,
30655{
30656    /// Perform the operation you have build so far.
30657    pub async fn doit(
30658        mut self,
30659    ) -> common::Result<(common::Response, OrdersSetLineItemMetadataResponse)> {
30660        use std::borrow::Cow;
30661        use std::io::{Read, Seek};
30662
30663        use common::{url::Params, ToParts};
30664        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30665
30666        let mut dd = common::DefaultDelegate;
30667        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30668        dlg.begin(common::MethodInfo {
30669            id: "content.orders.setlineitemmetadata",
30670            http_method: hyper::Method::POST,
30671        });
30672
30673        for &field in ["alt", "merchantId", "orderId"].iter() {
30674            if self._additional_params.contains_key(field) {
30675                dlg.finished(false);
30676                return Err(common::Error::FieldClash(field));
30677            }
30678        }
30679
30680        let mut params = Params::with_capacity(5 + self._additional_params.len());
30681        params.push("merchantId", self._merchant_id.to_string());
30682        params.push("orderId", self._order_id);
30683
30684        params.extend(self._additional_params.iter());
30685
30686        params.push("alt", "json");
30687        let mut url =
30688            self.hub._base_url.clone() + "{merchantId}/orders/{orderId}/setLineItemMetadata";
30689        if self._scopes.is_empty() {
30690            self._scopes.insert(Scope::Full.as_ref().to_string());
30691        }
30692
30693        #[allow(clippy::single_element_loop)]
30694        for &(find_this, param_name) in
30695            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
30696        {
30697            url = params.uri_replacement(url, param_name, find_this, false);
30698        }
30699        {
30700            let to_remove = ["orderId", "merchantId"];
30701            params.remove_params(&to_remove);
30702        }
30703
30704        let url = params.parse_with_url(&url);
30705
30706        let mut json_mime_type = mime::APPLICATION_JSON;
30707        let mut request_value_reader = {
30708            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30709            common::remove_json_null_values(&mut value);
30710            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30711            serde_json::to_writer(&mut dst, &value).unwrap();
30712            dst
30713        };
30714        let request_size = request_value_reader
30715            .seek(std::io::SeekFrom::End(0))
30716            .unwrap();
30717        request_value_reader
30718            .seek(std::io::SeekFrom::Start(0))
30719            .unwrap();
30720
30721        loop {
30722            let token = match self
30723                .hub
30724                .auth
30725                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30726                .await
30727            {
30728                Ok(token) => token,
30729                Err(e) => match dlg.token(e) {
30730                    Ok(token) => token,
30731                    Err(e) => {
30732                        dlg.finished(false);
30733                        return Err(common::Error::MissingToken(e));
30734                    }
30735                },
30736            };
30737            request_value_reader
30738                .seek(std::io::SeekFrom::Start(0))
30739                .unwrap();
30740            let mut req_result = {
30741                let client = &self.hub.client;
30742                dlg.pre_request();
30743                let mut req_builder = hyper::Request::builder()
30744                    .method(hyper::Method::POST)
30745                    .uri(url.as_str())
30746                    .header(USER_AGENT, self.hub._user_agent.clone());
30747
30748                if let Some(token) = token.as_ref() {
30749                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30750                }
30751
30752                let request = req_builder
30753                    .header(CONTENT_TYPE, json_mime_type.to_string())
30754                    .header(CONTENT_LENGTH, request_size as u64)
30755                    .body(common::to_body(
30756                        request_value_reader.get_ref().clone().into(),
30757                    ));
30758
30759                client.request(request.unwrap()).await
30760            };
30761
30762            match req_result {
30763                Err(err) => {
30764                    if let common::Retry::After(d) = dlg.http_error(&err) {
30765                        sleep(d).await;
30766                        continue;
30767                    }
30768                    dlg.finished(false);
30769                    return Err(common::Error::HttpError(err));
30770                }
30771                Ok(res) => {
30772                    let (mut parts, body) = res.into_parts();
30773                    let mut body = common::Body::new(body);
30774                    if !parts.status.is_success() {
30775                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30776                        let error = serde_json::from_str(&common::to_string(&bytes));
30777                        let response = common::to_response(parts, bytes.into());
30778
30779                        if let common::Retry::After(d) =
30780                            dlg.http_failure(&response, error.as_ref().ok())
30781                        {
30782                            sleep(d).await;
30783                            continue;
30784                        }
30785
30786                        dlg.finished(false);
30787
30788                        return Err(match error {
30789                            Ok(value) => common::Error::BadRequest(value),
30790                            _ => common::Error::Failure(response),
30791                        });
30792                    }
30793                    let response = {
30794                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30795                        let encoded = common::to_string(&bytes);
30796                        match serde_json::from_str(&encoded) {
30797                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30798                            Err(error) => {
30799                                dlg.response_json_decode_error(&encoded, &error);
30800                                return Err(common::Error::JsonDecodeError(
30801                                    encoded.to_string(),
30802                                    error,
30803                                ));
30804                            }
30805                        }
30806                    };
30807
30808                    dlg.finished(true);
30809                    return Ok(response);
30810                }
30811            }
30812        }
30813    }
30814
30815    ///
30816    /// Sets the *request* property to the given value.
30817    ///
30818    /// Even though the property as already been set when instantiating this call,
30819    /// we provide this method for API completeness.
30820    pub fn request(
30821        mut self,
30822        new_value: OrdersSetLineItemMetadataRequest,
30823    ) -> OrderSetlineitemmetadataCall<'a, C> {
30824        self._request = new_value;
30825        self
30826    }
30827    /// The ID of the account that manages the order. This cannot be a multi-client account.
30828    ///
30829    /// Sets the *merchant id* path property to the given value.
30830    ///
30831    /// Even though the property as already been set when instantiating this call,
30832    /// we provide this method for API completeness.
30833    pub fn merchant_id(mut self, new_value: u64) -> OrderSetlineitemmetadataCall<'a, C> {
30834        self._merchant_id = new_value;
30835        self
30836    }
30837    /// The ID of the order.
30838    ///
30839    /// Sets the *order id* path property to the given value.
30840    ///
30841    /// Even though the property as already been set when instantiating this call,
30842    /// we provide this method for API completeness.
30843    pub fn order_id(mut self, new_value: &str) -> OrderSetlineitemmetadataCall<'a, C> {
30844        self._order_id = new_value.to_string();
30845        self
30846    }
30847    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30848    /// while executing the actual API request.
30849    ///
30850    /// ````text
30851    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30852    /// ````
30853    ///
30854    /// Sets the *delegate* property to the given value.
30855    pub fn delegate(
30856        mut self,
30857        new_value: &'a mut dyn common::Delegate,
30858    ) -> OrderSetlineitemmetadataCall<'a, C> {
30859        self._delegate = Some(new_value);
30860        self
30861    }
30862
30863    /// Set any additional parameter of the query string used in the request.
30864    /// It should be used to set parameters which are not yet available through their own
30865    /// setters.
30866    ///
30867    /// Please note that this method must not be used to set any of the known parameters
30868    /// which have their own setter method. If done anyway, the request will fail.
30869    ///
30870    /// # Additional Parameters
30871    ///
30872    /// * *$.xgafv* (query-string) - V1 error format.
30873    /// * *access_token* (query-string) - OAuth access token.
30874    /// * *alt* (query-string) - Data format for response.
30875    /// * *callback* (query-string) - JSONP
30876    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30877    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
30878    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30879    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30880    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
30881    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30882    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30883    pub fn param<T>(mut self, name: T, value: T) -> OrderSetlineitemmetadataCall<'a, C>
30884    where
30885        T: AsRef<str>,
30886    {
30887        self._additional_params
30888            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30889        self
30890    }
30891
30892    /// Identifies the authorization scope for the method you are building.
30893    ///
30894    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30895    /// [`Scope::Full`].
30896    ///
30897    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30898    /// tokens for more than one scope.
30899    ///
30900    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30901    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30902    /// sufficient, a read-write scope will do as well.
30903    pub fn add_scope<St>(mut self, scope: St) -> OrderSetlineitemmetadataCall<'a, C>
30904    where
30905        St: AsRef<str>,
30906    {
30907        self._scopes.insert(String::from(scope.as_ref()));
30908        self
30909    }
30910    /// Identifies the authorization scope(s) for the method you are building.
30911    ///
30912    /// See [`Self::add_scope()`] for details.
30913    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderSetlineitemmetadataCall<'a, C>
30914    where
30915        I: IntoIterator<Item = St>,
30916        St: AsRef<str>,
30917    {
30918        self._scopes
30919            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30920        self
30921    }
30922
30923    /// Removes all scopes, and no default scope will be used either.
30924    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30925    /// for details).
30926    pub fn clear_scopes(mut self) -> OrderSetlineitemmetadataCall<'a, C> {
30927        self._scopes.clear();
30928        self
30929    }
30930}
30931
30932/// Marks line item(s) as shipped.
30933///
30934/// A builder for the *shiplineitems* method supported by a *order* resource.
30935/// It is not used directly, but through a [`OrderMethods`] instance.
30936///
30937/// # Example
30938///
30939/// Instantiate a resource method builder
30940///
30941/// ```test_harness,no_run
30942/// # extern crate hyper;
30943/// # extern crate hyper_rustls;
30944/// # extern crate google_content2 as content2;
30945/// use content2::api::OrdersShipLineItemsRequest;
30946/// # async fn dox() {
30947/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30948///
30949/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30950/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
30951/// #     .with_native_roots()
30952/// #     .unwrap()
30953/// #     .https_only()
30954/// #     .enable_http2()
30955/// #     .build();
30956///
30957/// # let executor = hyper_util::rt::TokioExecutor::new();
30958/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
30959/// #     secret,
30960/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30961/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
30962/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
30963/// #     ),
30964/// # ).build().await.unwrap();
30965///
30966/// # let client = hyper_util::client::legacy::Client::builder(
30967/// #     hyper_util::rt::TokioExecutor::new()
30968/// # )
30969/// # .build(
30970/// #     hyper_rustls::HttpsConnectorBuilder::new()
30971/// #         .with_native_roots()
30972/// #         .unwrap()
30973/// #         .https_or_http()
30974/// #         .enable_http2()
30975/// #         .build()
30976/// # );
30977/// # let mut hub = ShoppingContent::new(client, auth);
30978/// // As the method needs a request, you would usually fill it with the desired information
30979/// // into the respective structure. Some of the parts shown here might not be applicable !
30980/// // Values shown here are possibly random and not representative !
30981/// let mut req = OrdersShipLineItemsRequest::default();
30982///
30983/// // You can configure optional parameters by calling the respective setters at will, and
30984/// // execute the final call using `doit()`.
30985/// // Values shown here are possibly random and not representative !
30986/// let result = hub.orders().shiplineitems(req, 39, "orderId")
30987///              .doit().await;
30988/// # }
30989/// ```
30990pub struct OrderShiplineitemCall<'a, C>
30991where
30992    C: 'a,
30993{
30994    hub: &'a ShoppingContent<C>,
30995    _request: OrdersShipLineItemsRequest,
30996    _merchant_id: u64,
30997    _order_id: String,
30998    _delegate: Option<&'a mut dyn common::Delegate>,
30999    _additional_params: HashMap<String, String>,
31000    _scopes: BTreeSet<String>,
31001}
31002
31003impl<'a, C> common::CallBuilder for OrderShiplineitemCall<'a, C> {}
31004
31005impl<'a, C> OrderShiplineitemCall<'a, C>
31006where
31007    C: common::Connector,
31008{
31009    /// Perform the operation you have build so far.
31010    pub async fn doit(mut self) -> common::Result<(common::Response, OrdersShipLineItemsResponse)> {
31011        use std::borrow::Cow;
31012        use std::io::{Read, Seek};
31013
31014        use common::{url::Params, ToParts};
31015        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31016
31017        let mut dd = common::DefaultDelegate;
31018        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31019        dlg.begin(common::MethodInfo {
31020            id: "content.orders.shiplineitems",
31021            http_method: hyper::Method::POST,
31022        });
31023
31024        for &field in ["alt", "merchantId", "orderId"].iter() {
31025            if self._additional_params.contains_key(field) {
31026                dlg.finished(false);
31027                return Err(common::Error::FieldClash(field));
31028            }
31029        }
31030
31031        let mut params = Params::with_capacity(5 + self._additional_params.len());
31032        params.push("merchantId", self._merchant_id.to_string());
31033        params.push("orderId", self._order_id);
31034
31035        params.extend(self._additional_params.iter());
31036
31037        params.push("alt", "json");
31038        let mut url = self.hub._base_url.clone() + "{merchantId}/orders/{orderId}/shipLineItems";
31039        if self._scopes.is_empty() {
31040            self._scopes.insert(Scope::Full.as_ref().to_string());
31041        }
31042
31043        #[allow(clippy::single_element_loop)]
31044        for &(find_this, param_name) in
31045            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
31046        {
31047            url = params.uri_replacement(url, param_name, find_this, false);
31048        }
31049        {
31050            let to_remove = ["orderId", "merchantId"];
31051            params.remove_params(&to_remove);
31052        }
31053
31054        let url = params.parse_with_url(&url);
31055
31056        let mut json_mime_type = mime::APPLICATION_JSON;
31057        let mut request_value_reader = {
31058            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31059            common::remove_json_null_values(&mut value);
31060            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31061            serde_json::to_writer(&mut dst, &value).unwrap();
31062            dst
31063        };
31064        let request_size = request_value_reader
31065            .seek(std::io::SeekFrom::End(0))
31066            .unwrap();
31067        request_value_reader
31068            .seek(std::io::SeekFrom::Start(0))
31069            .unwrap();
31070
31071        loop {
31072            let token = match self
31073                .hub
31074                .auth
31075                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31076                .await
31077            {
31078                Ok(token) => token,
31079                Err(e) => match dlg.token(e) {
31080                    Ok(token) => token,
31081                    Err(e) => {
31082                        dlg.finished(false);
31083                        return Err(common::Error::MissingToken(e));
31084                    }
31085                },
31086            };
31087            request_value_reader
31088                .seek(std::io::SeekFrom::Start(0))
31089                .unwrap();
31090            let mut req_result = {
31091                let client = &self.hub.client;
31092                dlg.pre_request();
31093                let mut req_builder = hyper::Request::builder()
31094                    .method(hyper::Method::POST)
31095                    .uri(url.as_str())
31096                    .header(USER_AGENT, self.hub._user_agent.clone());
31097
31098                if let Some(token) = token.as_ref() {
31099                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31100                }
31101
31102                let request = req_builder
31103                    .header(CONTENT_TYPE, json_mime_type.to_string())
31104                    .header(CONTENT_LENGTH, request_size as u64)
31105                    .body(common::to_body(
31106                        request_value_reader.get_ref().clone().into(),
31107                    ));
31108
31109                client.request(request.unwrap()).await
31110            };
31111
31112            match req_result {
31113                Err(err) => {
31114                    if let common::Retry::After(d) = dlg.http_error(&err) {
31115                        sleep(d).await;
31116                        continue;
31117                    }
31118                    dlg.finished(false);
31119                    return Err(common::Error::HttpError(err));
31120                }
31121                Ok(res) => {
31122                    let (mut parts, body) = res.into_parts();
31123                    let mut body = common::Body::new(body);
31124                    if !parts.status.is_success() {
31125                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31126                        let error = serde_json::from_str(&common::to_string(&bytes));
31127                        let response = common::to_response(parts, bytes.into());
31128
31129                        if let common::Retry::After(d) =
31130                            dlg.http_failure(&response, error.as_ref().ok())
31131                        {
31132                            sleep(d).await;
31133                            continue;
31134                        }
31135
31136                        dlg.finished(false);
31137
31138                        return Err(match error {
31139                            Ok(value) => common::Error::BadRequest(value),
31140                            _ => common::Error::Failure(response),
31141                        });
31142                    }
31143                    let response = {
31144                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31145                        let encoded = common::to_string(&bytes);
31146                        match serde_json::from_str(&encoded) {
31147                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31148                            Err(error) => {
31149                                dlg.response_json_decode_error(&encoded, &error);
31150                                return Err(common::Error::JsonDecodeError(
31151                                    encoded.to_string(),
31152                                    error,
31153                                ));
31154                            }
31155                        }
31156                    };
31157
31158                    dlg.finished(true);
31159                    return Ok(response);
31160                }
31161            }
31162        }
31163    }
31164
31165    ///
31166    /// Sets the *request* property to the given value.
31167    ///
31168    /// Even though the property as already been set when instantiating this call,
31169    /// we provide this method for API completeness.
31170    pub fn request(
31171        mut self,
31172        new_value: OrdersShipLineItemsRequest,
31173    ) -> OrderShiplineitemCall<'a, C> {
31174        self._request = new_value;
31175        self
31176    }
31177    /// The ID of the account that manages the order. This cannot be a multi-client account.
31178    ///
31179    /// Sets the *merchant id* path property to the given value.
31180    ///
31181    /// Even though the property as already been set when instantiating this call,
31182    /// we provide this method for API completeness.
31183    pub fn merchant_id(mut self, new_value: u64) -> OrderShiplineitemCall<'a, C> {
31184        self._merchant_id = new_value;
31185        self
31186    }
31187    /// The ID of the order.
31188    ///
31189    /// Sets the *order id* path property to the given value.
31190    ///
31191    /// Even though the property as already been set when instantiating this call,
31192    /// we provide this method for API completeness.
31193    pub fn order_id(mut self, new_value: &str) -> OrderShiplineitemCall<'a, C> {
31194        self._order_id = new_value.to_string();
31195        self
31196    }
31197    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31198    /// while executing the actual API request.
31199    ///
31200    /// ````text
31201    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31202    /// ````
31203    ///
31204    /// Sets the *delegate* property to the given value.
31205    pub fn delegate(
31206        mut self,
31207        new_value: &'a mut dyn common::Delegate,
31208    ) -> OrderShiplineitemCall<'a, C> {
31209        self._delegate = Some(new_value);
31210        self
31211    }
31212
31213    /// Set any additional parameter of the query string used in the request.
31214    /// It should be used to set parameters which are not yet available through their own
31215    /// setters.
31216    ///
31217    /// Please note that this method must not be used to set any of the known parameters
31218    /// which have their own setter method. If done anyway, the request will fail.
31219    ///
31220    /// # Additional Parameters
31221    ///
31222    /// * *$.xgafv* (query-string) - V1 error format.
31223    /// * *access_token* (query-string) - OAuth access token.
31224    /// * *alt* (query-string) - Data format for response.
31225    /// * *callback* (query-string) - JSONP
31226    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31227    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
31228    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31229    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31230    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
31231    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31232    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31233    pub fn param<T>(mut self, name: T, value: T) -> OrderShiplineitemCall<'a, C>
31234    where
31235        T: AsRef<str>,
31236    {
31237        self._additional_params
31238            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31239        self
31240    }
31241
31242    /// Identifies the authorization scope for the method you are building.
31243    ///
31244    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31245    /// [`Scope::Full`].
31246    ///
31247    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31248    /// tokens for more than one scope.
31249    ///
31250    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31251    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31252    /// sufficient, a read-write scope will do as well.
31253    pub fn add_scope<St>(mut self, scope: St) -> OrderShiplineitemCall<'a, C>
31254    where
31255        St: AsRef<str>,
31256    {
31257        self._scopes.insert(String::from(scope.as_ref()));
31258        self
31259    }
31260    /// Identifies the authorization scope(s) for the method you are building.
31261    ///
31262    /// See [`Self::add_scope()`] for details.
31263    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderShiplineitemCall<'a, C>
31264    where
31265        I: IntoIterator<Item = St>,
31266        St: AsRef<str>,
31267    {
31268        self._scopes
31269            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31270        self
31271    }
31272
31273    /// Removes all scopes, and no default scope will be used either.
31274    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31275    /// for details).
31276    pub fn clear_scopes(mut self) -> OrderShiplineitemCall<'a, C> {
31277        self._scopes.clear();
31278        self
31279    }
31280}
31281
31282/// Updates ship by and delivery by dates for a line item.
31283///
31284/// A builder for the *updatelineitemshippingdetails* method supported by a *order* resource.
31285/// It is not used directly, but through a [`OrderMethods`] instance.
31286///
31287/// # Example
31288///
31289/// Instantiate a resource method builder
31290///
31291/// ```test_harness,no_run
31292/// # extern crate hyper;
31293/// # extern crate hyper_rustls;
31294/// # extern crate google_content2 as content2;
31295/// use content2::api::OrdersUpdateLineItemShippingDetailsRequest;
31296/// # async fn dox() {
31297/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31298///
31299/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31300/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
31301/// #     .with_native_roots()
31302/// #     .unwrap()
31303/// #     .https_only()
31304/// #     .enable_http2()
31305/// #     .build();
31306///
31307/// # let executor = hyper_util::rt::TokioExecutor::new();
31308/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
31309/// #     secret,
31310/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31311/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
31312/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
31313/// #     ),
31314/// # ).build().await.unwrap();
31315///
31316/// # let client = hyper_util::client::legacy::Client::builder(
31317/// #     hyper_util::rt::TokioExecutor::new()
31318/// # )
31319/// # .build(
31320/// #     hyper_rustls::HttpsConnectorBuilder::new()
31321/// #         .with_native_roots()
31322/// #         .unwrap()
31323/// #         .https_or_http()
31324/// #         .enable_http2()
31325/// #         .build()
31326/// # );
31327/// # let mut hub = ShoppingContent::new(client, auth);
31328/// // As the method needs a request, you would usually fill it with the desired information
31329/// // into the respective structure. Some of the parts shown here might not be applicable !
31330/// // Values shown here are possibly random and not representative !
31331/// let mut req = OrdersUpdateLineItemShippingDetailsRequest::default();
31332///
31333/// // You can configure optional parameters by calling the respective setters at will, and
31334/// // execute the final call using `doit()`.
31335/// // Values shown here are possibly random and not representative !
31336/// let result = hub.orders().updatelineitemshippingdetails(req, 74, "orderId")
31337///              .doit().await;
31338/// # }
31339/// ```
31340pub struct OrderUpdatelineitemshippingdetailCall<'a, C>
31341where
31342    C: 'a,
31343{
31344    hub: &'a ShoppingContent<C>,
31345    _request: OrdersUpdateLineItemShippingDetailsRequest,
31346    _merchant_id: u64,
31347    _order_id: String,
31348    _delegate: Option<&'a mut dyn common::Delegate>,
31349    _additional_params: HashMap<String, String>,
31350    _scopes: BTreeSet<String>,
31351}
31352
31353impl<'a, C> common::CallBuilder for OrderUpdatelineitemshippingdetailCall<'a, C> {}
31354
31355impl<'a, C> OrderUpdatelineitemshippingdetailCall<'a, C>
31356where
31357    C: common::Connector,
31358{
31359    /// Perform the operation you have build so far.
31360    pub async fn doit(
31361        mut self,
31362    ) -> common::Result<(
31363        common::Response,
31364        OrdersUpdateLineItemShippingDetailsResponse,
31365    )> {
31366        use std::borrow::Cow;
31367        use std::io::{Read, Seek};
31368
31369        use common::{url::Params, ToParts};
31370        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31371
31372        let mut dd = common::DefaultDelegate;
31373        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31374        dlg.begin(common::MethodInfo {
31375            id: "content.orders.updatelineitemshippingdetails",
31376            http_method: hyper::Method::POST,
31377        });
31378
31379        for &field in ["alt", "merchantId", "orderId"].iter() {
31380            if self._additional_params.contains_key(field) {
31381                dlg.finished(false);
31382                return Err(common::Error::FieldClash(field));
31383            }
31384        }
31385
31386        let mut params = Params::with_capacity(5 + self._additional_params.len());
31387        params.push("merchantId", self._merchant_id.to_string());
31388        params.push("orderId", self._order_id);
31389
31390        params.extend(self._additional_params.iter());
31391
31392        params.push("alt", "json");
31393        let mut url = self.hub._base_url.clone()
31394            + "{merchantId}/orders/{orderId}/updateLineItemShippingDetails";
31395        if self._scopes.is_empty() {
31396            self._scopes.insert(Scope::Full.as_ref().to_string());
31397        }
31398
31399        #[allow(clippy::single_element_loop)]
31400        for &(find_this, param_name) in
31401            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
31402        {
31403            url = params.uri_replacement(url, param_name, find_this, false);
31404        }
31405        {
31406            let to_remove = ["orderId", "merchantId"];
31407            params.remove_params(&to_remove);
31408        }
31409
31410        let url = params.parse_with_url(&url);
31411
31412        let mut json_mime_type = mime::APPLICATION_JSON;
31413        let mut request_value_reader = {
31414            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31415            common::remove_json_null_values(&mut value);
31416            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31417            serde_json::to_writer(&mut dst, &value).unwrap();
31418            dst
31419        };
31420        let request_size = request_value_reader
31421            .seek(std::io::SeekFrom::End(0))
31422            .unwrap();
31423        request_value_reader
31424            .seek(std::io::SeekFrom::Start(0))
31425            .unwrap();
31426
31427        loop {
31428            let token = match self
31429                .hub
31430                .auth
31431                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31432                .await
31433            {
31434                Ok(token) => token,
31435                Err(e) => match dlg.token(e) {
31436                    Ok(token) => token,
31437                    Err(e) => {
31438                        dlg.finished(false);
31439                        return Err(common::Error::MissingToken(e));
31440                    }
31441                },
31442            };
31443            request_value_reader
31444                .seek(std::io::SeekFrom::Start(0))
31445                .unwrap();
31446            let mut req_result = {
31447                let client = &self.hub.client;
31448                dlg.pre_request();
31449                let mut req_builder = hyper::Request::builder()
31450                    .method(hyper::Method::POST)
31451                    .uri(url.as_str())
31452                    .header(USER_AGENT, self.hub._user_agent.clone());
31453
31454                if let Some(token) = token.as_ref() {
31455                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31456                }
31457
31458                let request = req_builder
31459                    .header(CONTENT_TYPE, json_mime_type.to_string())
31460                    .header(CONTENT_LENGTH, request_size as u64)
31461                    .body(common::to_body(
31462                        request_value_reader.get_ref().clone().into(),
31463                    ));
31464
31465                client.request(request.unwrap()).await
31466            };
31467
31468            match req_result {
31469                Err(err) => {
31470                    if let common::Retry::After(d) = dlg.http_error(&err) {
31471                        sleep(d).await;
31472                        continue;
31473                    }
31474                    dlg.finished(false);
31475                    return Err(common::Error::HttpError(err));
31476                }
31477                Ok(res) => {
31478                    let (mut parts, body) = res.into_parts();
31479                    let mut body = common::Body::new(body);
31480                    if !parts.status.is_success() {
31481                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31482                        let error = serde_json::from_str(&common::to_string(&bytes));
31483                        let response = common::to_response(parts, bytes.into());
31484
31485                        if let common::Retry::After(d) =
31486                            dlg.http_failure(&response, error.as_ref().ok())
31487                        {
31488                            sleep(d).await;
31489                            continue;
31490                        }
31491
31492                        dlg.finished(false);
31493
31494                        return Err(match error {
31495                            Ok(value) => common::Error::BadRequest(value),
31496                            _ => common::Error::Failure(response),
31497                        });
31498                    }
31499                    let response = {
31500                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31501                        let encoded = common::to_string(&bytes);
31502                        match serde_json::from_str(&encoded) {
31503                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31504                            Err(error) => {
31505                                dlg.response_json_decode_error(&encoded, &error);
31506                                return Err(common::Error::JsonDecodeError(
31507                                    encoded.to_string(),
31508                                    error,
31509                                ));
31510                            }
31511                        }
31512                    };
31513
31514                    dlg.finished(true);
31515                    return Ok(response);
31516                }
31517            }
31518        }
31519    }
31520
31521    ///
31522    /// Sets the *request* property to the given value.
31523    ///
31524    /// Even though the property as already been set when instantiating this call,
31525    /// we provide this method for API completeness.
31526    pub fn request(
31527        mut self,
31528        new_value: OrdersUpdateLineItemShippingDetailsRequest,
31529    ) -> OrderUpdatelineitemshippingdetailCall<'a, C> {
31530        self._request = new_value;
31531        self
31532    }
31533    /// The ID of the account that manages the order. This cannot be a multi-client account.
31534    ///
31535    /// Sets the *merchant id* path property to the given value.
31536    ///
31537    /// Even though the property as already been set when instantiating this call,
31538    /// we provide this method for API completeness.
31539    pub fn merchant_id(mut self, new_value: u64) -> OrderUpdatelineitemshippingdetailCall<'a, C> {
31540        self._merchant_id = new_value;
31541        self
31542    }
31543    /// The ID of the order.
31544    ///
31545    /// Sets the *order id* path property to the given value.
31546    ///
31547    /// Even though the property as already been set when instantiating this call,
31548    /// we provide this method for API completeness.
31549    pub fn order_id(mut self, new_value: &str) -> OrderUpdatelineitemshippingdetailCall<'a, C> {
31550        self._order_id = new_value.to_string();
31551        self
31552    }
31553    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31554    /// while executing the actual API request.
31555    ///
31556    /// ````text
31557    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31558    /// ````
31559    ///
31560    /// Sets the *delegate* property to the given value.
31561    pub fn delegate(
31562        mut self,
31563        new_value: &'a mut dyn common::Delegate,
31564    ) -> OrderUpdatelineitemshippingdetailCall<'a, C> {
31565        self._delegate = Some(new_value);
31566        self
31567    }
31568
31569    /// Set any additional parameter of the query string used in the request.
31570    /// It should be used to set parameters which are not yet available through their own
31571    /// setters.
31572    ///
31573    /// Please note that this method must not be used to set any of the known parameters
31574    /// which have their own setter method. If done anyway, the request will fail.
31575    ///
31576    /// # Additional Parameters
31577    ///
31578    /// * *$.xgafv* (query-string) - V1 error format.
31579    /// * *access_token* (query-string) - OAuth access token.
31580    /// * *alt* (query-string) - Data format for response.
31581    /// * *callback* (query-string) - JSONP
31582    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31583    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
31584    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31585    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31586    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
31587    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31588    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31589    pub fn param<T>(mut self, name: T, value: T) -> OrderUpdatelineitemshippingdetailCall<'a, C>
31590    where
31591        T: AsRef<str>,
31592    {
31593        self._additional_params
31594            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31595        self
31596    }
31597
31598    /// Identifies the authorization scope for the method you are building.
31599    ///
31600    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31601    /// [`Scope::Full`].
31602    ///
31603    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31604    /// tokens for more than one scope.
31605    ///
31606    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31607    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31608    /// sufficient, a read-write scope will do as well.
31609    pub fn add_scope<St>(mut self, scope: St) -> OrderUpdatelineitemshippingdetailCall<'a, C>
31610    where
31611        St: AsRef<str>,
31612    {
31613        self._scopes.insert(String::from(scope.as_ref()));
31614        self
31615    }
31616    /// Identifies the authorization scope(s) for the method you are building.
31617    ///
31618    /// See [`Self::add_scope()`] for details.
31619    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderUpdatelineitemshippingdetailCall<'a, C>
31620    where
31621        I: IntoIterator<Item = St>,
31622        St: AsRef<str>,
31623    {
31624        self._scopes
31625            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31626        self
31627    }
31628
31629    /// Removes all scopes, and no default scope will be used either.
31630    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31631    /// for details).
31632    pub fn clear_scopes(mut self) -> OrderUpdatelineitemshippingdetailCall<'a, C> {
31633        self._scopes.clear();
31634        self
31635    }
31636}
31637
31638/// Updates the merchant order ID for a given order.
31639///
31640/// A builder for the *updatemerchantorderid* method supported by a *order* resource.
31641/// It is not used directly, but through a [`OrderMethods`] instance.
31642///
31643/// # Example
31644///
31645/// Instantiate a resource method builder
31646///
31647/// ```test_harness,no_run
31648/// # extern crate hyper;
31649/// # extern crate hyper_rustls;
31650/// # extern crate google_content2 as content2;
31651/// use content2::api::OrdersUpdateMerchantOrderIdRequest;
31652/// # async fn dox() {
31653/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31654///
31655/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31656/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
31657/// #     .with_native_roots()
31658/// #     .unwrap()
31659/// #     .https_only()
31660/// #     .enable_http2()
31661/// #     .build();
31662///
31663/// # let executor = hyper_util::rt::TokioExecutor::new();
31664/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
31665/// #     secret,
31666/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31667/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
31668/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
31669/// #     ),
31670/// # ).build().await.unwrap();
31671///
31672/// # let client = hyper_util::client::legacy::Client::builder(
31673/// #     hyper_util::rt::TokioExecutor::new()
31674/// # )
31675/// # .build(
31676/// #     hyper_rustls::HttpsConnectorBuilder::new()
31677/// #         .with_native_roots()
31678/// #         .unwrap()
31679/// #         .https_or_http()
31680/// #         .enable_http2()
31681/// #         .build()
31682/// # );
31683/// # let mut hub = ShoppingContent::new(client, auth);
31684/// // As the method needs a request, you would usually fill it with the desired information
31685/// // into the respective structure. Some of the parts shown here might not be applicable !
31686/// // Values shown here are possibly random and not representative !
31687/// let mut req = OrdersUpdateMerchantOrderIdRequest::default();
31688///
31689/// // You can configure optional parameters by calling the respective setters at will, and
31690/// // execute the final call using `doit()`.
31691/// // Values shown here are possibly random and not representative !
31692/// let result = hub.orders().updatemerchantorderid(req, 81, "orderId")
31693///              .doit().await;
31694/// # }
31695/// ```
31696pub struct OrderUpdatemerchantorderidCall<'a, C>
31697where
31698    C: 'a,
31699{
31700    hub: &'a ShoppingContent<C>,
31701    _request: OrdersUpdateMerchantOrderIdRequest,
31702    _merchant_id: u64,
31703    _order_id: String,
31704    _delegate: Option<&'a mut dyn common::Delegate>,
31705    _additional_params: HashMap<String, String>,
31706    _scopes: BTreeSet<String>,
31707}
31708
31709impl<'a, C> common::CallBuilder for OrderUpdatemerchantorderidCall<'a, C> {}
31710
31711impl<'a, C> OrderUpdatemerchantorderidCall<'a, C>
31712where
31713    C: common::Connector,
31714{
31715    /// Perform the operation you have build so far.
31716    pub async fn doit(
31717        mut self,
31718    ) -> common::Result<(common::Response, OrdersUpdateMerchantOrderIdResponse)> {
31719        use std::borrow::Cow;
31720        use std::io::{Read, Seek};
31721
31722        use common::{url::Params, ToParts};
31723        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31724
31725        let mut dd = common::DefaultDelegate;
31726        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31727        dlg.begin(common::MethodInfo {
31728            id: "content.orders.updatemerchantorderid",
31729            http_method: hyper::Method::POST,
31730        });
31731
31732        for &field in ["alt", "merchantId", "orderId"].iter() {
31733            if self._additional_params.contains_key(field) {
31734                dlg.finished(false);
31735                return Err(common::Error::FieldClash(field));
31736            }
31737        }
31738
31739        let mut params = Params::with_capacity(5 + self._additional_params.len());
31740        params.push("merchantId", self._merchant_id.to_string());
31741        params.push("orderId", self._order_id);
31742
31743        params.extend(self._additional_params.iter());
31744
31745        params.push("alt", "json");
31746        let mut url =
31747            self.hub._base_url.clone() + "{merchantId}/orders/{orderId}/updateMerchantOrderId";
31748        if self._scopes.is_empty() {
31749            self._scopes.insert(Scope::Full.as_ref().to_string());
31750        }
31751
31752        #[allow(clippy::single_element_loop)]
31753        for &(find_this, param_name) in
31754            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
31755        {
31756            url = params.uri_replacement(url, param_name, find_this, false);
31757        }
31758        {
31759            let to_remove = ["orderId", "merchantId"];
31760            params.remove_params(&to_remove);
31761        }
31762
31763        let url = params.parse_with_url(&url);
31764
31765        let mut json_mime_type = mime::APPLICATION_JSON;
31766        let mut request_value_reader = {
31767            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31768            common::remove_json_null_values(&mut value);
31769            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31770            serde_json::to_writer(&mut dst, &value).unwrap();
31771            dst
31772        };
31773        let request_size = request_value_reader
31774            .seek(std::io::SeekFrom::End(0))
31775            .unwrap();
31776        request_value_reader
31777            .seek(std::io::SeekFrom::Start(0))
31778            .unwrap();
31779
31780        loop {
31781            let token = match self
31782                .hub
31783                .auth
31784                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31785                .await
31786            {
31787                Ok(token) => token,
31788                Err(e) => match dlg.token(e) {
31789                    Ok(token) => token,
31790                    Err(e) => {
31791                        dlg.finished(false);
31792                        return Err(common::Error::MissingToken(e));
31793                    }
31794                },
31795            };
31796            request_value_reader
31797                .seek(std::io::SeekFrom::Start(0))
31798                .unwrap();
31799            let mut req_result = {
31800                let client = &self.hub.client;
31801                dlg.pre_request();
31802                let mut req_builder = hyper::Request::builder()
31803                    .method(hyper::Method::POST)
31804                    .uri(url.as_str())
31805                    .header(USER_AGENT, self.hub._user_agent.clone());
31806
31807                if let Some(token) = token.as_ref() {
31808                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31809                }
31810
31811                let request = req_builder
31812                    .header(CONTENT_TYPE, json_mime_type.to_string())
31813                    .header(CONTENT_LENGTH, request_size as u64)
31814                    .body(common::to_body(
31815                        request_value_reader.get_ref().clone().into(),
31816                    ));
31817
31818                client.request(request.unwrap()).await
31819            };
31820
31821            match req_result {
31822                Err(err) => {
31823                    if let common::Retry::After(d) = dlg.http_error(&err) {
31824                        sleep(d).await;
31825                        continue;
31826                    }
31827                    dlg.finished(false);
31828                    return Err(common::Error::HttpError(err));
31829                }
31830                Ok(res) => {
31831                    let (mut parts, body) = res.into_parts();
31832                    let mut body = common::Body::new(body);
31833                    if !parts.status.is_success() {
31834                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31835                        let error = serde_json::from_str(&common::to_string(&bytes));
31836                        let response = common::to_response(parts, bytes.into());
31837
31838                        if let common::Retry::After(d) =
31839                            dlg.http_failure(&response, error.as_ref().ok())
31840                        {
31841                            sleep(d).await;
31842                            continue;
31843                        }
31844
31845                        dlg.finished(false);
31846
31847                        return Err(match error {
31848                            Ok(value) => common::Error::BadRequest(value),
31849                            _ => common::Error::Failure(response),
31850                        });
31851                    }
31852                    let response = {
31853                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31854                        let encoded = common::to_string(&bytes);
31855                        match serde_json::from_str(&encoded) {
31856                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31857                            Err(error) => {
31858                                dlg.response_json_decode_error(&encoded, &error);
31859                                return Err(common::Error::JsonDecodeError(
31860                                    encoded.to_string(),
31861                                    error,
31862                                ));
31863                            }
31864                        }
31865                    };
31866
31867                    dlg.finished(true);
31868                    return Ok(response);
31869                }
31870            }
31871        }
31872    }
31873
31874    ///
31875    /// Sets the *request* property to the given value.
31876    ///
31877    /// Even though the property as already been set when instantiating this call,
31878    /// we provide this method for API completeness.
31879    pub fn request(
31880        mut self,
31881        new_value: OrdersUpdateMerchantOrderIdRequest,
31882    ) -> OrderUpdatemerchantorderidCall<'a, C> {
31883        self._request = new_value;
31884        self
31885    }
31886    /// The ID of the account that manages the order. This cannot be a multi-client account.
31887    ///
31888    /// Sets the *merchant id* path property to the given value.
31889    ///
31890    /// Even though the property as already been set when instantiating this call,
31891    /// we provide this method for API completeness.
31892    pub fn merchant_id(mut self, new_value: u64) -> OrderUpdatemerchantorderidCall<'a, C> {
31893        self._merchant_id = new_value;
31894        self
31895    }
31896    /// The ID of the order.
31897    ///
31898    /// Sets the *order id* path property to the given value.
31899    ///
31900    /// Even though the property as already been set when instantiating this call,
31901    /// we provide this method for API completeness.
31902    pub fn order_id(mut self, new_value: &str) -> OrderUpdatemerchantorderidCall<'a, C> {
31903        self._order_id = new_value.to_string();
31904        self
31905    }
31906    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31907    /// while executing the actual API request.
31908    ///
31909    /// ````text
31910    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31911    /// ````
31912    ///
31913    /// Sets the *delegate* property to the given value.
31914    pub fn delegate(
31915        mut self,
31916        new_value: &'a mut dyn common::Delegate,
31917    ) -> OrderUpdatemerchantorderidCall<'a, C> {
31918        self._delegate = Some(new_value);
31919        self
31920    }
31921
31922    /// Set any additional parameter of the query string used in the request.
31923    /// It should be used to set parameters which are not yet available through their own
31924    /// setters.
31925    ///
31926    /// Please note that this method must not be used to set any of the known parameters
31927    /// which have their own setter method. If done anyway, the request will fail.
31928    ///
31929    /// # Additional Parameters
31930    ///
31931    /// * *$.xgafv* (query-string) - V1 error format.
31932    /// * *access_token* (query-string) - OAuth access token.
31933    /// * *alt* (query-string) - Data format for response.
31934    /// * *callback* (query-string) - JSONP
31935    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31936    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
31937    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31938    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31939    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
31940    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31941    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31942    pub fn param<T>(mut self, name: T, value: T) -> OrderUpdatemerchantorderidCall<'a, C>
31943    where
31944        T: AsRef<str>,
31945    {
31946        self._additional_params
31947            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31948        self
31949    }
31950
31951    /// Identifies the authorization scope for the method you are building.
31952    ///
31953    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31954    /// [`Scope::Full`].
31955    ///
31956    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31957    /// tokens for more than one scope.
31958    ///
31959    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31960    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31961    /// sufficient, a read-write scope will do as well.
31962    pub fn add_scope<St>(mut self, scope: St) -> OrderUpdatemerchantorderidCall<'a, C>
31963    where
31964        St: AsRef<str>,
31965    {
31966        self._scopes.insert(String::from(scope.as_ref()));
31967        self
31968    }
31969    /// Identifies the authorization scope(s) for the method you are building.
31970    ///
31971    /// See [`Self::add_scope()`] for details.
31972    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderUpdatemerchantorderidCall<'a, C>
31973    where
31974        I: IntoIterator<Item = St>,
31975        St: AsRef<str>,
31976    {
31977        self._scopes
31978            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31979        self
31980    }
31981
31982    /// Removes all scopes, and no default scope will be used either.
31983    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31984    /// for details).
31985    pub fn clear_scopes(mut self) -> OrderUpdatemerchantorderidCall<'a, C> {
31986        self._scopes.clear();
31987        self
31988    }
31989}
31990
31991/// Updates a shipment's status, carrier, and/or tracking ID.
31992///
31993/// A builder for the *updateshipment* method supported by a *order* resource.
31994/// It is not used directly, but through a [`OrderMethods`] instance.
31995///
31996/// # Example
31997///
31998/// Instantiate a resource method builder
31999///
32000/// ```test_harness,no_run
32001/// # extern crate hyper;
32002/// # extern crate hyper_rustls;
32003/// # extern crate google_content2 as content2;
32004/// use content2::api::OrdersUpdateShipmentRequest;
32005/// # async fn dox() {
32006/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32007///
32008/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32009/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
32010/// #     .with_native_roots()
32011/// #     .unwrap()
32012/// #     .https_only()
32013/// #     .enable_http2()
32014/// #     .build();
32015///
32016/// # let executor = hyper_util::rt::TokioExecutor::new();
32017/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
32018/// #     secret,
32019/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32020/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
32021/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
32022/// #     ),
32023/// # ).build().await.unwrap();
32024///
32025/// # let client = hyper_util::client::legacy::Client::builder(
32026/// #     hyper_util::rt::TokioExecutor::new()
32027/// # )
32028/// # .build(
32029/// #     hyper_rustls::HttpsConnectorBuilder::new()
32030/// #         .with_native_roots()
32031/// #         .unwrap()
32032/// #         .https_or_http()
32033/// #         .enable_http2()
32034/// #         .build()
32035/// # );
32036/// # let mut hub = ShoppingContent::new(client, auth);
32037/// // As the method needs a request, you would usually fill it with the desired information
32038/// // into the respective structure. Some of the parts shown here might not be applicable !
32039/// // Values shown here are possibly random and not representative !
32040/// let mut req = OrdersUpdateShipmentRequest::default();
32041///
32042/// // You can configure optional parameters by calling the respective setters at will, and
32043/// // execute the final call using `doit()`.
32044/// // Values shown here are possibly random and not representative !
32045/// let result = hub.orders().updateshipment(req, 18, "orderId")
32046///              .doit().await;
32047/// # }
32048/// ```
32049pub struct OrderUpdateshipmentCall<'a, C>
32050where
32051    C: 'a,
32052{
32053    hub: &'a ShoppingContent<C>,
32054    _request: OrdersUpdateShipmentRequest,
32055    _merchant_id: u64,
32056    _order_id: String,
32057    _delegate: Option<&'a mut dyn common::Delegate>,
32058    _additional_params: HashMap<String, String>,
32059    _scopes: BTreeSet<String>,
32060}
32061
32062impl<'a, C> common::CallBuilder for OrderUpdateshipmentCall<'a, C> {}
32063
32064impl<'a, C> OrderUpdateshipmentCall<'a, C>
32065where
32066    C: common::Connector,
32067{
32068    /// Perform the operation you have build so far.
32069    pub async fn doit(
32070        mut self,
32071    ) -> common::Result<(common::Response, OrdersUpdateShipmentResponse)> {
32072        use std::borrow::Cow;
32073        use std::io::{Read, Seek};
32074
32075        use common::{url::Params, ToParts};
32076        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32077
32078        let mut dd = common::DefaultDelegate;
32079        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32080        dlg.begin(common::MethodInfo {
32081            id: "content.orders.updateshipment",
32082            http_method: hyper::Method::POST,
32083        });
32084
32085        for &field in ["alt", "merchantId", "orderId"].iter() {
32086            if self._additional_params.contains_key(field) {
32087                dlg.finished(false);
32088                return Err(common::Error::FieldClash(field));
32089            }
32090        }
32091
32092        let mut params = Params::with_capacity(5 + self._additional_params.len());
32093        params.push("merchantId", self._merchant_id.to_string());
32094        params.push("orderId", self._order_id);
32095
32096        params.extend(self._additional_params.iter());
32097
32098        params.push("alt", "json");
32099        let mut url = self.hub._base_url.clone() + "{merchantId}/orders/{orderId}/updateShipment";
32100        if self._scopes.is_empty() {
32101            self._scopes.insert(Scope::Full.as_ref().to_string());
32102        }
32103
32104        #[allow(clippy::single_element_loop)]
32105        for &(find_this, param_name) in
32106            [("{merchantId}", "merchantId"), ("{orderId}", "orderId")].iter()
32107        {
32108            url = params.uri_replacement(url, param_name, find_this, false);
32109        }
32110        {
32111            let to_remove = ["orderId", "merchantId"];
32112            params.remove_params(&to_remove);
32113        }
32114
32115        let url = params.parse_with_url(&url);
32116
32117        let mut json_mime_type = mime::APPLICATION_JSON;
32118        let mut request_value_reader = {
32119            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32120            common::remove_json_null_values(&mut value);
32121            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32122            serde_json::to_writer(&mut dst, &value).unwrap();
32123            dst
32124        };
32125        let request_size = request_value_reader
32126            .seek(std::io::SeekFrom::End(0))
32127            .unwrap();
32128        request_value_reader
32129            .seek(std::io::SeekFrom::Start(0))
32130            .unwrap();
32131
32132        loop {
32133            let token = match self
32134                .hub
32135                .auth
32136                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32137                .await
32138            {
32139                Ok(token) => token,
32140                Err(e) => match dlg.token(e) {
32141                    Ok(token) => token,
32142                    Err(e) => {
32143                        dlg.finished(false);
32144                        return Err(common::Error::MissingToken(e));
32145                    }
32146                },
32147            };
32148            request_value_reader
32149                .seek(std::io::SeekFrom::Start(0))
32150                .unwrap();
32151            let mut req_result = {
32152                let client = &self.hub.client;
32153                dlg.pre_request();
32154                let mut req_builder = hyper::Request::builder()
32155                    .method(hyper::Method::POST)
32156                    .uri(url.as_str())
32157                    .header(USER_AGENT, self.hub._user_agent.clone());
32158
32159                if let Some(token) = token.as_ref() {
32160                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32161                }
32162
32163                let request = req_builder
32164                    .header(CONTENT_TYPE, json_mime_type.to_string())
32165                    .header(CONTENT_LENGTH, request_size as u64)
32166                    .body(common::to_body(
32167                        request_value_reader.get_ref().clone().into(),
32168                    ));
32169
32170                client.request(request.unwrap()).await
32171            };
32172
32173            match req_result {
32174                Err(err) => {
32175                    if let common::Retry::After(d) = dlg.http_error(&err) {
32176                        sleep(d).await;
32177                        continue;
32178                    }
32179                    dlg.finished(false);
32180                    return Err(common::Error::HttpError(err));
32181                }
32182                Ok(res) => {
32183                    let (mut parts, body) = res.into_parts();
32184                    let mut body = common::Body::new(body);
32185                    if !parts.status.is_success() {
32186                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32187                        let error = serde_json::from_str(&common::to_string(&bytes));
32188                        let response = common::to_response(parts, bytes.into());
32189
32190                        if let common::Retry::After(d) =
32191                            dlg.http_failure(&response, error.as_ref().ok())
32192                        {
32193                            sleep(d).await;
32194                            continue;
32195                        }
32196
32197                        dlg.finished(false);
32198
32199                        return Err(match error {
32200                            Ok(value) => common::Error::BadRequest(value),
32201                            _ => common::Error::Failure(response),
32202                        });
32203                    }
32204                    let response = {
32205                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32206                        let encoded = common::to_string(&bytes);
32207                        match serde_json::from_str(&encoded) {
32208                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32209                            Err(error) => {
32210                                dlg.response_json_decode_error(&encoded, &error);
32211                                return Err(common::Error::JsonDecodeError(
32212                                    encoded.to_string(),
32213                                    error,
32214                                ));
32215                            }
32216                        }
32217                    };
32218
32219                    dlg.finished(true);
32220                    return Ok(response);
32221                }
32222            }
32223        }
32224    }
32225
32226    ///
32227    /// Sets the *request* property to the given value.
32228    ///
32229    /// Even though the property as already been set when instantiating this call,
32230    /// we provide this method for API completeness.
32231    pub fn request(
32232        mut self,
32233        new_value: OrdersUpdateShipmentRequest,
32234    ) -> OrderUpdateshipmentCall<'a, C> {
32235        self._request = new_value;
32236        self
32237    }
32238    /// The ID of the account that manages the order. This cannot be a multi-client account.
32239    ///
32240    /// Sets the *merchant id* path property to the given value.
32241    ///
32242    /// Even though the property as already been set when instantiating this call,
32243    /// we provide this method for API completeness.
32244    pub fn merchant_id(mut self, new_value: u64) -> OrderUpdateshipmentCall<'a, C> {
32245        self._merchant_id = new_value;
32246        self
32247    }
32248    /// The ID of the order.
32249    ///
32250    /// Sets the *order id* path property to the given value.
32251    ///
32252    /// Even though the property as already been set when instantiating this call,
32253    /// we provide this method for API completeness.
32254    pub fn order_id(mut self, new_value: &str) -> OrderUpdateshipmentCall<'a, C> {
32255        self._order_id = new_value.to_string();
32256        self
32257    }
32258    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32259    /// while executing the actual API request.
32260    ///
32261    /// ````text
32262    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32263    /// ````
32264    ///
32265    /// Sets the *delegate* property to the given value.
32266    pub fn delegate(
32267        mut self,
32268        new_value: &'a mut dyn common::Delegate,
32269    ) -> OrderUpdateshipmentCall<'a, C> {
32270        self._delegate = Some(new_value);
32271        self
32272    }
32273
32274    /// Set any additional parameter of the query string used in the request.
32275    /// It should be used to set parameters which are not yet available through their own
32276    /// setters.
32277    ///
32278    /// Please note that this method must not be used to set any of the known parameters
32279    /// which have their own setter method. If done anyway, the request will fail.
32280    ///
32281    /// # Additional Parameters
32282    ///
32283    /// * *$.xgafv* (query-string) - V1 error format.
32284    /// * *access_token* (query-string) - OAuth access token.
32285    /// * *alt* (query-string) - Data format for response.
32286    /// * *callback* (query-string) - JSONP
32287    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32288    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
32289    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32290    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32291    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
32292    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32293    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32294    pub fn param<T>(mut self, name: T, value: T) -> OrderUpdateshipmentCall<'a, C>
32295    where
32296        T: AsRef<str>,
32297    {
32298        self._additional_params
32299            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32300        self
32301    }
32302
32303    /// Identifies the authorization scope for the method you are building.
32304    ///
32305    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32306    /// [`Scope::Full`].
32307    ///
32308    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32309    /// tokens for more than one scope.
32310    ///
32311    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32312    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32313    /// sufficient, a read-write scope will do as well.
32314    pub fn add_scope<St>(mut self, scope: St) -> OrderUpdateshipmentCall<'a, C>
32315    where
32316        St: AsRef<str>,
32317    {
32318        self._scopes.insert(String::from(scope.as_ref()));
32319        self
32320    }
32321    /// Identifies the authorization scope(s) for the method you are building.
32322    ///
32323    /// See [`Self::add_scope()`] for details.
32324    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderUpdateshipmentCall<'a, C>
32325    where
32326        I: IntoIterator<Item = St>,
32327        St: AsRef<str>,
32328    {
32329        self._scopes
32330            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32331        self
32332    }
32333
32334    /// Removes all scopes, and no default scope will be used either.
32335    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32336    /// for details).
32337    pub fn clear_scopes(mut self) -> OrderUpdateshipmentCall<'a, C> {
32338        self._scopes.clear();
32339        self
32340    }
32341}
32342
32343/// Batches multiple POS-related calls in a single request.
32344///
32345/// A builder for the *custombatch* method supported by a *po* resource.
32346/// It is not used directly, but through a [`PoMethods`] instance.
32347///
32348/// # Example
32349///
32350/// Instantiate a resource method builder
32351///
32352/// ```test_harness,no_run
32353/// # extern crate hyper;
32354/// # extern crate hyper_rustls;
32355/// # extern crate google_content2 as content2;
32356/// use content2::api::PosCustomBatchRequest;
32357/// # async fn dox() {
32358/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32359///
32360/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32361/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
32362/// #     .with_native_roots()
32363/// #     .unwrap()
32364/// #     .https_only()
32365/// #     .enable_http2()
32366/// #     .build();
32367///
32368/// # let executor = hyper_util::rt::TokioExecutor::new();
32369/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
32370/// #     secret,
32371/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32372/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
32373/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
32374/// #     ),
32375/// # ).build().await.unwrap();
32376///
32377/// # let client = hyper_util::client::legacy::Client::builder(
32378/// #     hyper_util::rt::TokioExecutor::new()
32379/// # )
32380/// # .build(
32381/// #     hyper_rustls::HttpsConnectorBuilder::new()
32382/// #         .with_native_roots()
32383/// #         .unwrap()
32384/// #         .https_or_http()
32385/// #         .enable_http2()
32386/// #         .build()
32387/// # );
32388/// # let mut hub = ShoppingContent::new(client, auth);
32389/// // As the method needs a request, you would usually fill it with the desired information
32390/// // into the respective structure. Some of the parts shown here might not be applicable !
32391/// // Values shown here are possibly random and not representative !
32392/// let mut req = PosCustomBatchRequest::default();
32393///
32394/// // You can configure optional parameters by calling the respective setters at will, and
32395/// // execute the final call using `doit()`.
32396/// // Values shown here are possibly random and not representative !
32397/// let result = hub.pos().custombatch(req)
32398///              .dry_run(true)
32399///              .doit().await;
32400/// # }
32401/// ```
32402pub struct PoCustombatchCall<'a, C>
32403where
32404    C: 'a,
32405{
32406    hub: &'a ShoppingContent<C>,
32407    _request: PosCustomBatchRequest,
32408    _dry_run: Option<bool>,
32409    _delegate: Option<&'a mut dyn common::Delegate>,
32410    _additional_params: HashMap<String, String>,
32411    _scopes: BTreeSet<String>,
32412}
32413
32414impl<'a, C> common::CallBuilder for PoCustombatchCall<'a, C> {}
32415
32416impl<'a, C> PoCustombatchCall<'a, C>
32417where
32418    C: common::Connector,
32419{
32420    /// Perform the operation you have build so far.
32421    pub async fn doit(mut self) -> common::Result<(common::Response, PosCustomBatchResponse)> {
32422        use std::borrow::Cow;
32423        use std::io::{Read, Seek};
32424
32425        use common::{url::Params, ToParts};
32426        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32427
32428        let mut dd = common::DefaultDelegate;
32429        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32430        dlg.begin(common::MethodInfo {
32431            id: "content.pos.custombatch",
32432            http_method: hyper::Method::POST,
32433        });
32434
32435        for &field in ["alt", "dryRun"].iter() {
32436            if self._additional_params.contains_key(field) {
32437                dlg.finished(false);
32438                return Err(common::Error::FieldClash(field));
32439            }
32440        }
32441
32442        let mut params = Params::with_capacity(4 + self._additional_params.len());
32443        if let Some(value) = self._dry_run.as_ref() {
32444            params.push("dryRun", value.to_string());
32445        }
32446
32447        params.extend(self._additional_params.iter());
32448
32449        params.push("alt", "json");
32450        let mut url = self.hub._base_url.clone() + "pos/batch";
32451        if self._scopes.is_empty() {
32452            self._scopes.insert(Scope::Full.as_ref().to_string());
32453        }
32454
32455        let url = params.parse_with_url(&url);
32456
32457        let mut json_mime_type = mime::APPLICATION_JSON;
32458        let mut request_value_reader = {
32459            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32460            common::remove_json_null_values(&mut value);
32461            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32462            serde_json::to_writer(&mut dst, &value).unwrap();
32463            dst
32464        };
32465        let request_size = request_value_reader
32466            .seek(std::io::SeekFrom::End(0))
32467            .unwrap();
32468        request_value_reader
32469            .seek(std::io::SeekFrom::Start(0))
32470            .unwrap();
32471
32472        loop {
32473            let token = match self
32474                .hub
32475                .auth
32476                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32477                .await
32478            {
32479                Ok(token) => token,
32480                Err(e) => match dlg.token(e) {
32481                    Ok(token) => token,
32482                    Err(e) => {
32483                        dlg.finished(false);
32484                        return Err(common::Error::MissingToken(e));
32485                    }
32486                },
32487            };
32488            request_value_reader
32489                .seek(std::io::SeekFrom::Start(0))
32490                .unwrap();
32491            let mut req_result = {
32492                let client = &self.hub.client;
32493                dlg.pre_request();
32494                let mut req_builder = hyper::Request::builder()
32495                    .method(hyper::Method::POST)
32496                    .uri(url.as_str())
32497                    .header(USER_AGENT, self.hub._user_agent.clone());
32498
32499                if let Some(token) = token.as_ref() {
32500                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32501                }
32502
32503                let request = req_builder
32504                    .header(CONTENT_TYPE, json_mime_type.to_string())
32505                    .header(CONTENT_LENGTH, request_size as u64)
32506                    .body(common::to_body(
32507                        request_value_reader.get_ref().clone().into(),
32508                    ));
32509
32510                client.request(request.unwrap()).await
32511            };
32512
32513            match req_result {
32514                Err(err) => {
32515                    if let common::Retry::After(d) = dlg.http_error(&err) {
32516                        sleep(d).await;
32517                        continue;
32518                    }
32519                    dlg.finished(false);
32520                    return Err(common::Error::HttpError(err));
32521                }
32522                Ok(res) => {
32523                    let (mut parts, body) = res.into_parts();
32524                    let mut body = common::Body::new(body);
32525                    if !parts.status.is_success() {
32526                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32527                        let error = serde_json::from_str(&common::to_string(&bytes));
32528                        let response = common::to_response(parts, bytes.into());
32529
32530                        if let common::Retry::After(d) =
32531                            dlg.http_failure(&response, error.as_ref().ok())
32532                        {
32533                            sleep(d).await;
32534                            continue;
32535                        }
32536
32537                        dlg.finished(false);
32538
32539                        return Err(match error {
32540                            Ok(value) => common::Error::BadRequest(value),
32541                            _ => common::Error::Failure(response),
32542                        });
32543                    }
32544                    let response = {
32545                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32546                        let encoded = common::to_string(&bytes);
32547                        match serde_json::from_str(&encoded) {
32548                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32549                            Err(error) => {
32550                                dlg.response_json_decode_error(&encoded, &error);
32551                                return Err(common::Error::JsonDecodeError(
32552                                    encoded.to_string(),
32553                                    error,
32554                                ));
32555                            }
32556                        }
32557                    };
32558
32559                    dlg.finished(true);
32560                    return Ok(response);
32561                }
32562            }
32563        }
32564    }
32565
32566    ///
32567    /// Sets the *request* property to the given value.
32568    ///
32569    /// Even though the property as already been set when instantiating this call,
32570    /// we provide this method for API completeness.
32571    pub fn request(mut self, new_value: PosCustomBatchRequest) -> PoCustombatchCall<'a, C> {
32572        self._request = new_value;
32573        self
32574    }
32575    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
32576    ///
32577    /// Sets the *dry run* query property to the given value.
32578    pub fn dry_run(mut self, new_value: bool) -> PoCustombatchCall<'a, C> {
32579        self._dry_run = Some(new_value);
32580        self
32581    }
32582    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32583    /// while executing the actual API request.
32584    ///
32585    /// ````text
32586    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32587    /// ````
32588    ///
32589    /// Sets the *delegate* property to the given value.
32590    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PoCustombatchCall<'a, C> {
32591        self._delegate = Some(new_value);
32592        self
32593    }
32594
32595    /// Set any additional parameter of the query string used in the request.
32596    /// It should be used to set parameters which are not yet available through their own
32597    /// setters.
32598    ///
32599    /// Please note that this method must not be used to set any of the known parameters
32600    /// which have their own setter method. If done anyway, the request will fail.
32601    ///
32602    /// # Additional Parameters
32603    ///
32604    /// * *$.xgafv* (query-string) - V1 error format.
32605    /// * *access_token* (query-string) - OAuth access token.
32606    /// * *alt* (query-string) - Data format for response.
32607    /// * *callback* (query-string) - JSONP
32608    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32609    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
32610    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32611    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32612    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
32613    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32614    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32615    pub fn param<T>(mut self, name: T, value: T) -> PoCustombatchCall<'a, C>
32616    where
32617        T: AsRef<str>,
32618    {
32619        self._additional_params
32620            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32621        self
32622    }
32623
32624    /// Identifies the authorization scope for the method you are building.
32625    ///
32626    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32627    /// [`Scope::Full`].
32628    ///
32629    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32630    /// tokens for more than one scope.
32631    ///
32632    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32633    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32634    /// sufficient, a read-write scope will do as well.
32635    pub fn add_scope<St>(mut self, scope: St) -> PoCustombatchCall<'a, C>
32636    where
32637        St: AsRef<str>,
32638    {
32639        self._scopes.insert(String::from(scope.as_ref()));
32640        self
32641    }
32642    /// Identifies the authorization scope(s) for the method you are building.
32643    ///
32644    /// See [`Self::add_scope()`] for details.
32645    pub fn add_scopes<I, St>(mut self, scopes: I) -> PoCustombatchCall<'a, C>
32646    where
32647        I: IntoIterator<Item = St>,
32648        St: AsRef<str>,
32649    {
32650        self._scopes
32651            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32652        self
32653    }
32654
32655    /// Removes all scopes, and no default scope will be used either.
32656    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32657    /// for details).
32658    pub fn clear_scopes(mut self) -> PoCustombatchCall<'a, C> {
32659        self._scopes.clear();
32660        self
32661    }
32662}
32663
32664/// Deletes a store for the given merchant.
32665///
32666/// A builder for the *delete* method supported by a *po* resource.
32667/// It is not used directly, but through a [`PoMethods`] instance.
32668///
32669/// # Example
32670///
32671/// Instantiate a resource method builder
32672///
32673/// ```test_harness,no_run
32674/// # extern crate hyper;
32675/// # extern crate hyper_rustls;
32676/// # extern crate google_content2 as content2;
32677/// # async fn dox() {
32678/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32679///
32680/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32681/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
32682/// #     .with_native_roots()
32683/// #     .unwrap()
32684/// #     .https_only()
32685/// #     .enable_http2()
32686/// #     .build();
32687///
32688/// # let executor = hyper_util::rt::TokioExecutor::new();
32689/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
32690/// #     secret,
32691/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32692/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
32693/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
32694/// #     ),
32695/// # ).build().await.unwrap();
32696///
32697/// # let client = hyper_util::client::legacy::Client::builder(
32698/// #     hyper_util::rt::TokioExecutor::new()
32699/// # )
32700/// # .build(
32701/// #     hyper_rustls::HttpsConnectorBuilder::new()
32702/// #         .with_native_roots()
32703/// #         .unwrap()
32704/// #         .https_or_http()
32705/// #         .enable_http2()
32706/// #         .build()
32707/// # );
32708/// # let mut hub = ShoppingContent::new(client, auth);
32709/// // You can configure optional parameters by calling the respective setters at will, and
32710/// // execute the final call using `doit()`.
32711/// // Values shown here are possibly random and not representative !
32712/// let result = hub.pos().delete(97, 95, "storeCode")
32713///              .dry_run(true)
32714///              .doit().await;
32715/// # }
32716/// ```
32717pub struct PoDeleteCall<'a, C>
32718where
32719    C: 'a,
32720{
32721    hub: &'a ShoppingContent<C>,
32722    _merchant_id: u64,
32723    _target_merchant_id: u64,
32724    _store_code: String,
32725    _dry_run: Option<bool>,
32726    _delegate: Option<&'a mut dyn common::Delegate>,
32727    _additional_params: HashMap<String, String>,
32728    _scopes: BTreeSet<String>,
32729}
32730
32731impl<'a, C> common::CallBuilder for PoDeleteCall<'a, C> {}
32732
32733impl<'a, C> PoDeleteCall<'a, C>
32734where
32735    C: common::Connector,
32736{
32737    /// Perform the operation you have build so far.
32738    pub async fn doit(mut self) -> common::Result<common::Response> {
32739        use std::borrow::Cow;
32740        use std::io::{Read, Seek};
32741
32742        use common::{url::Params, ToParts};
32743        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32744
32745        let mut dd = common::DefaultDelegate;
32746        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32747        dlg.begin(common::MethodInfo {
32748            id: "content.pos.delete",
32749            http_method: hyper::Method::DELETE,
32750        });
32751
32752        for &field in ["merchantId", "targetMerchantId", "storeCode", "dryRun"].iter() {
32753            if self._additional_params.contains_key(field) {
32754                dlg.finished(false);
32755                return Err(common::Error::FieldClash(field));
32756            }
32757        }
32758
32759        let mut params = Params::with_capacity(5 + self._additional_params.len());
32760        params.push("merchantId", self._merchant_id.to_string());
32761        params.push("targetMerchantId", self._target_merchant_id.to_string());
32762        params.push("storeCode", self._store_code);
32763        if let Some(value) = self._dry_run.as_ref() {
32764            params.push("dryRun", value.to_string());
32765        }
32766
32767        params.extend(self._additional_params.iter());
32768
32769        let mut url =
32770            self.hub._base_url.clone() + "{merchantId}/pos/{targetMerchantId}/store/{storeCode}";
32771        if self._scopes.is_empty() {
32772            self._scopes.insert(Scope::Full.as_ref().to_string());
32773        }
32774
32775        #[allow(clippy::single_element_loop)]
32776        for &(find_this, param_name) in [
32777            ("{merchantId}", "merchantId"),
32778            ("{targetMerchantId}", "targetMerchantId"),
32779            ("{storeCode}", "storeCode"),
32780        ]
32781        .iter()
32782        {
32783            url = params.uri_replacement(url, param_name, find_this, false);
32784        }
32785        {
32786            let to_remove = ["storeCode", "targetMerchantId", "merchantId"];
32787            params.remove_params(&to_remove);
32788        }
32789
32790        let url = params.parse_with_url(&url);
32791
32792        loop {
32793            let token = match self
32794                .hub
32795                .auth
32796                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32797                .await
32798            {
32799                Ok(token) => token,
32800                Err(e) => match dlg.token(e) {
32801                    Ok(token) => token,
32802                    Err(e) => {
32803                        dlg.finished(false);
32804                        return Err(common::Error::MissingToken(e));
32805                    }
32806                },
32807            };
32808            let mut req_result = {
32809                let client = &self.hub.client;
32810                dlg.pre_request();
32811                let mut req_builder = hyper::Request::builder()
32812                    .method(hyper::Method::DELETE)
32813                    .uri(url.as_str())
32814                    .header(USER_AGENT, self.hub._user_agent.clone());
32815
32816                if let Some(token) = token.as_ref() {
32817                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32818                }
32819
32820                let request = req_builder
32821                    .header(CONTENT_LENGTH, 0_u64)
32822                    .body(common::to_body::<String>(None));
32823
32824                client.request(request.unwrap()).await
32825            };
32826
32827            match req_result {
32828                Err(err) => {
32829                    if let common::Retry::After(d) = dlg.http_error(&err) {
32830                        sleep(d).await;
32831                        continue;
32832                    }
32833                    dlg.finished(false);
32834                    return Err(common::Error::HttpError(err));
32835                }
32836                Ok(res) => {
32837                    let (mut parts, body) = res.into_parts();
32838                    let mut body = common::Body::new(body);
32839                    if !parts.status.is_success() {
32840                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32841                        let error = serde_json::from_str(&common::to_string(&bytes));
32842                        let response = common::to_response(parts, bytes.into());
32843
32844                        if let common::Retry::After(d) =
32845                            dlg.http_failure(&response, error.as_ref().ok())
32846                        {
32847                            sleep(d).await;
32848                            continue;
32849                        }
32850
32851                        dlg.finished(false);
32852
32853                        return Err(match error {
32854                            Ok(value) => common::Error::BadRequest(value),
32855                            _ => common::Error::Failure(response),
32856                        });
32857                    }
32858                    let response = common::Response::from_parts(parts, body);
32859
32860                    dlg.finished(true);
32861                    return Ok(response);
32862                }
32863            }
32864        }
32865    }
32866
32867    /// The ID of the POS or inventory data provider.
32868    ///
32869    /// Sets the *merchant id* path property to the given value.
32870    ///
32871    /// Even though the property as already been set when instantiating this call,
32872    /// we provide this method for API completeness.
32873    pub fn merchant_id(mut self, new_value: u64) -> PoDeleteCall<'a, C> {
32874        self._merchant_id = new_value;
32875        self
32876    }
32877    /// The ID of the target merchant.
32878    ///
32879    /// Sets the *target merchant id* path property to the given value.
32880    ///
32881    /// Even though the property as already been set when instantiating this call,
32882    /// we provide this method for API completeness.
32883    pub fn target_merchant_id(mut self, new_value: u64) -> PoDeleteCall<'a, C> {
32884        self._target_merchant_id = new_value;
32885        self
32886    }
32887    /// A store code that is unique per merchant.
32888    ///
32889    /// Sets the *store code* path property to the given value.
32890    ///
32891    /// Even though the property as already been set when instantiating this call,
32892    /// we provide this method for API completeness.
32893    pub fn store_code(mut self, new_value: &str) -> PoDeleteCall<'a, C> {
32894        self._store_code = new_value.to_string();
32895        self
32896    }
32897    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
32898    ///
32899    /// Sets the *dry run* query property to the given value.
32900    pub fn dry_run(mut self, new_value: bool) -> PoDeleteCall<'a, C> {
32901        self._dry_run = Some(new_value);
32902        self
32903    }
32904    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32905    /// while executing the actual API request.
32906    ///
32907    /// ````text
32908    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32909    /// ````
32910    ///
32911    /// Sets the *delegate* property to the given value.
32912    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PoDeleteCall<'a, C> {
32913        self._delegate = Some(new_value);
32914        self
32915    }
32916
32917    /// Set any additional parameter of the query string used in the request.
32918    /// It should be used to set parameters which are not yet available through their own
32919    /// setters.
32920    ///
32921    /// Please note that this method must not be used to set any of the known parameters
32922    /// which have their own setter method. If done anyway, the request will fail.
32923    ///
32924    /// # Additional Parameters
32925    ///
32926    /// * *$.xgafv* (query-string) - V1 error format.
32927    /// * *access_token* (query-string) - OAuth access token.
32928    /// * *alt* (query-string) - Data format for response.
32929    /// * *callback* (query-string) - JSONP
32930    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32931    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
32932    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32933    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32934    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
32935    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32936    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32937    pub fn param<T>(mut self, name: T, value: T) -> PoDeleteCall<'a, C>
32938    where
32939        T: AsRef<str>,
32940    {
32941        self._additional_params
32942            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32943        self
32944    }
32945
32946    /// Identifies the authorization scope for the method you are building.
32947    ///
32948    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32949    /// [`Scope::Full`].
32950    ///
32951    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32952    /// tokens for more than one scope.
32953    ///
32954    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32955    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32956    /// sufficient, a read-write scope will do as well.
32957    pub fn add_scope<St>(mut self, scope: St) -> PoDeleteCall<'a, C>
32958    where
32959        St: AsRef<str>,
32960    {
32961        self._scopes.insert(String::from(scope.as_ref()));
32962        self
32963    }
32964    /// Identifies the authorization scope(s) for the method you are building.
32965    ///
32966    /// See [`Self::add_scope()`] for details.
32967    pub fn add_scopes<I, St>(mut self, scopes: I) -> PoDeleteCall<'a, C>
32968    where
32969        I: IntoIterator<Item = St>,
32970        St: AsRef<str>,
32971    {
32972        self._scopes
32973            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32974        self
32975    }
32976
32977    /// Removes all scopes, and no default scope will be used either.
32978    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32979    /// for details).
32980    pub fn clear_scopes(mut self) -> PoDeleteCall<'a, C> {
32981        self._scopes.clear();
32982        self
32983    }
32984}
32985
32986/// Retrieves information about the given store.
32987///
32988/// A builder for the *get* method supported by a *po* resource.
32989/// It is not used directly, but through a [`PoMethods`] instance.
32990///
32991/// # Example
32992///
32993/// Instantiate a resource method builder
32994///
32995/// ```test_harness,no_run
32996/// # extern crate hyper;
32997/// # extern crate hyper_rustls;
32998/// # extern crate google_content2 as content2;
32999/// # async fn dox() {
33000/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33001///
33002/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33003/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
33004/// #     .with_native_roots()
33005/// #     .unwrap()
33006/// #     .https_only()
33007/// #     .enable_http2()
33008/// #     .build();
33009///
33010/// # let executor = hyper_util::rt::TokioExecutor::new();
33011/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
33012/// #     secret,
33013/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33014/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
33015/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
33016/// #     ),
33017/// # ).build().await.unwrap();
33018///
33019/// # let client = hyper_util::client::legacy::Client::builder(
33020/// #     hyper_util::rt::TokioExecutor::new()
33021/// # )
33022/// # .build(
33023/// #     hyper_rustls::HttpsConnectorBuilder::new()
33024/// #         .with_native_roots()
33025/// #         .unwrap()
33026/// #         .https_or_http()
33027/// #         .enable_http2()
33028/// #         .build()
33029/// # );
33030/// # let mut hub = ShoppingContent::new(client, auth);
33031/// // You can configure optional parameters by calling the respective setters at will, and
33032/// // execute the final call using `doit()`.
33033/// // Values shown here are possibly random and not representative !
33034/// let result = hub.pos().get(90, 10, "storeCode")
33035///              .doit().await;
33036/// # }
33037/// ```
33038pub struct PoGetCall<'a, C>
33039where
33040    C: 'a,
33041{
33042    hub: &'a ShoppingContent<C>,
33043    _merchant_id: u64,
33044    _target_merchant_id: u64,
33045    _store_code: String,
33046    _delegate: Option<&'a mut dyn common::Delegate>,
33047    _additional_params: HashMap<String, String>,
33048    _scopes: BTreeSet<String>,
33049}
33050
33051impl<'a, C> common::CallBuilder for PoGetCall<'a, C> {}
33052
33053impl<'a, C> PoGetCall<'a, C>
33054where
33055    C: common::Connector,
33056{
33057    /// Perform the operation you have build so far.
33058    pub async fn doit(mut self) -> common::Result<(common::Response, PosStore)> {
33059        use std::borrow::Cow;
33060        use std::io::{Read, Seek};
33061
33062        use common::{url::Params, ToParts};
33063        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33064
33065        let mut dd = common::DefaultDelegate;
33066        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33067        dlg.begin(common::MethodInfo {
33068            id: "content.pos.get",
33069            http_method: hyper::Method::GET,
33070        });
33071
33072        for &field in ["alt", "merchantId", "targetMerchantId", "storeCode"].iter() {
33073            if self._additional_params.contains_key(field) {
33074                dlg.finished(false);
33075                return Err(common::Error::FieldClash(field));
33076            }
33077        }
33078
33079        let mut params = Params::with_capacity(5 + self._additional_params.len());
33080        params.push("merchantId", self._merchant_id.to_string());
33081        params.push("targetMerchantId", self._target_merchant_id.to_string());
33082        params.push("storeCode", self._store_code);
33083
33084        params.extend(self._additional_params.iter());
33085
33086        params.push("alt", "json");
33087        let mut url =
33088            self.hub._base_url.clone() + "{merchantId}/pos/{targetMerchantId}/store/{storeCode}";
33089        if self._scopes.is_empty() {
33090            self._scopes.insert(Scope::Full.as_ref().to_string());
33091        }
33092
33093        #[allow(clippy::single_element_loop)]
33094        for &(find_this, param_name) in [
33095            ("{merchantId}", "merchantId"),
33096            ("{targetMerchantId}", "targetMerchantId"),
33097            ("{storeCode}", "storeCode"),
33098        ]
33099        .iter()
33100        {
33101            url = params.uri_replacement(url, param_name, find_this, false);
33102        }
33103        {
33104            let to_remove = ["storeCode", "targetMerchantId", "merchantId"];
33105            params.remove_params(&to_remove);
33106        }
33107
33108        let url = params.parse_with_url(&url);
33109
33110        loop {
33111            let token = match self
33112                .hub
33113                .auth
33114                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33115                .await
33116            {
33117                Ok(token) => token,
33118                Err(e) => match dlg.token(e) {
33119                    Ok(token) => token,
33120                    Err(e) => {
33121                        dlg.finished(false);
33122                        return Err(common::Error::MissingToken(e));
33123                    }
33124                },
33125            };
33126            let mut req_result = {
33127                let client = &self.hub.client;
33128                dlg.pre_request();
33129                let mut req_builder = hyper::Request::builder()
33130                    .method(hyper::Method::GET)
33131                    .uri(url.as_str())
33132                    .header(USER_AGENT, self.hub._user_agent.clone());
33133
33134                if let Some(token) = token.as_ref() {
33135                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33136                }
33137
33138                let request = req_builder
33139                    .header(CONTENT_LENGTH, 0_u64)
33140                    .body(common::to_body::<String>(None));
33141
33142                client.request(request.unwrap()).await
33143            };
33144
33145            match req_result {
33146                Err(err) => {
33147                    if let common::Retry::After(d) = dlg.http_error(&err) {
33148                        sleep(d).await;
33149                        continue;
33150                    }
33151                    dlg.finished(false);
33152                    return Err(common::Error::HttpError(err));
33153                }
33154                Ok(res) => {
33155                    let (mut parts, body) = res.into_parts();
33156                    let mut body = common::Body::new(body);
33157                    if !parts.status.is_success() {
33158                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33159                        let error = serde_json::from_str(&common::to_string(&bytes));
33160                        let response = common::to_response(parts, bytes.into());
33161
33162                        if let common::Retry::After(d) =
33163                            dlg.http_failure(&response, error.as_ref().ok())
33164                        {
33165                            sleep(d).await;
33166                            continue;
33167                        }
33168
33169                        dlg.finished(false);
33170
33171                        return Err(match error {
33172                            Ok(value) => common::Error::BadRequest(value),
33173                            _ => common::Error::Failure(response),
33174                        });
33175                    }
33176                    let response = {
33177                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33178                        let encoded = common::to_string(&bytes);
33179                        match serde_json::from_str(&encoded) {
33180                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33181                            Err(error) => {
33182                                dlg.response_json_decode_error(&encoded, &error);
33183                                return Err(common::Error::JsonDecodeError(
33184                                    encoded.to_string(),
33185                                    error,
33186                                ));
33187                            }
33188                        }
33189                    };
33190
33191                    dlg.finished(true);
33192                    return Ok(response);
33193                }
33194            }
33195        }
33196    }
33197
33198    /// The ID of the POS or inventory data provider.
33199    ///
33200    /// Sets the *merchant id* path property to the given value.
33201    ///
33202    /// Even though the property as already been set when instantiating this call,
33203    /// we provide this method for API completeness.
33204    pub fn merchant_id(mut self, new_value: u64) -> PoGetCall<'a, C> {
33205        self._merchant_id = new_value;
33206        self
33207    }
33208    /// The ID of the target merchant.
33209    ///
33210    /// Sets the *target merchant id* path property to the given value.
33211    ///
33212    /// Even though the property as already been set when instantiating this call,
33213    /// we provide this method for API completeness.
33214    pub fn target_merchant_id(mut self, new_value: u64) -> PoGetCall<'a, C> {
33215        self._target_merchant_id = new_value;
33216        self
33217    }
33218    /// A store code that is unique per merchant.
33219    ///
33220    /// Sets the *store code* path property to the given value.
33221    ///
33222    /// Even though the property as already been set when instantiating this call,
33223    /// we provide this method for API completeness.
33224    pub fn store_code(mut self, new_value: &str) -> PoGetCall<'a, C> {
33225        self._store_code = new_value.to_string();
33226        self
33227    }
33228    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33229    /// while executing the actual API request.
33230    ///
33231    /// ````text
33232    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33233    /// ````
33234    ///
33235    /// Sets the *delegate* property to the given value.
33236    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PoGetCall<'a, C> {
33237        self._delegate = Some(new_value);
33238        self
33239    }
33240
33241    /// Set any additional parameter of the query string used in the request.
33242    /// It should be used to set parameters which are not yet available through their own
33243    /// setters.
33244    ///
33245    /// Please note that this method must not be used to set any of the known parameters
33246    /// which have their own setter method. If done anyway, the request will fail.
33247    ///
33248    /// # Additional Parameters
33249    ///
33250    /// * *$.xgafv* (query-string) - V1 error format.
33251    /// * *access_token* (query-string) - OAuth access token.
33252    /// * *alt* (query-string) - Data format for response.
33253    /// * *callback* (query-string) - JSONP
33254    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33255    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
33256    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33257    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33258    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
33259    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33260    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33261    pub fn param<T>(mut self, name: T, value: T) -> PoGetCall<'a, C>
33262    where
33263        T: AsRef<str>,
33264    {
33265        self._additional_params
33266            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33267        self
33268    }
33269
33270    /// Identifies the authorization scope for the method you are building.
33271    ///
33272    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33273    /// [`Scope::Full`].
33274    ///
33275    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33276    /// tokens for more than one scope.
33277    ///
33278    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33279    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33280    /// sufficient, a read-write scope will do as well.
33281    pub fn add_scope<St>(mut self, scope: St) -> PoGetCall<'a, C>
33282    where
33283        St: AsRef<str>,
33284    {
33285        self._scopes.insert(String::from(scope.as_ref()));
33286        self
33287    }
33288    /// Identifies the authorization scope(s) for the method you are building.
33289    ///
33290    /// See [`Self::add_scope()`] for details.
33291    pub fn add_scopes<I, St>(mut self, scopes: I) -> PoGetCall<'a, C>
33292    where
33293        I: IntoIterator<Item = St>,
33294        St: AsRef<str>,
33295    {
33296        self._scopes
33297            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33298        self
33299    }
33300
33301    /// Removes all scopes, and no default scope will be used either.
33302    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33303    /// for details).
33304    pub fn clear_scopes(mut self) -> PoGetCall<'a, C> {
33305        self._scopes.clear();
33306        self
33307    }
33308}
33309
33310/// Creates a store for the given merchant.
33311///
33312/// A builder for the *insert* method supported by a *po* resource.
33313/// It is not used directly, but through a [`PoMethods`] instance.
33314///
33315/// # Example
33316///
33317/// Instantiate a resource method builder
33318///
33319/// ```test_harness,no_run
33320/// # extern crate hyper;
33321/// # extern crate hyper_rustls;
33322/// # extern crate google_content2 as content2;
33323/// use content2::api::PosStore;
33324/// # async fn dox() {
33325/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33326///
33327/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33328/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
33329/// #     .with_native_roots()
33330/// #     .unwrap()
33331/// #     .https_only()
33332/// #     .enable_http2()
33333/// #     .build();
33334///
33335/// # let executor = hyper_util::rt::TokioExecutor::new();
33336/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
33337/// #     secret,
33338/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33339/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
33340/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
33341/// #     ),
33342/// # ).build().await.unwrap();
33343///
33344/// # let client = hyper_util::client::legacy::Client::builder(
33345/// #     hyper_util::rt::TokioExecutor::new()
33346/// # )
33347/// # .build(
33348/// #     hyper_rustls::HttpsConnectorBuilder::new()
33349/// #         .with_native_roots()
33350/// #         .unwrap()
33351/// #         .https_or_http()
33352/// #         .enable_http2()
33353/// #         .build()
33354/// # );
33355/// # let mut hub = ShoppingContent::new(client, auth);
33356/// // As the method needs a request, you would usually fill it with the desired information
33357/// // into the respective structure. Some of the parts shown here might not be applicable !
33358/// // Values shown here are possibly random and not representative !
33359/// let mut req = PosStore::default();
33360///
33361/// // You can configure optional parameters by calling the respective setters at will, and
33362/// // execute the final call using `doit()`.
33363/// // Values shown here are possibly random and not representative !
33364/// let result = hub.pos().insert(req, 88, 0)
33365///              .dry_run(true)
33366///              .doit().await;
33367/// # }
33368/// ```
33369pub struct PoInsertCall<'a, C>
33370where
33371    C: 'a,
33372{
33373    hub: &'a ShoppingContent<C>,
33374    _request: PosStore,
33375    _merchant_id: u64,
33376    _target_merchant_id: u64,
33377    _dry_run: Option<bool>,
33378    _delegate: Option<&'a mut dyn common::Delegate>,
33379    _additional_params: HashMap<String, String>,
33380    _scopes: BTreeSet<String>,
33381}
33382
33383impl<'a, C> common::CallBuilder for PoInsertCall<'a, C> {}
33384
33385impl<'a, C> PoInsertCall<'a, C>
33386where
33387    C: common::Connector,
33388{
33389    /// Perform the operation you have build so far.
33390    pub async fn doit(mut self) -> common::Result<(common::Response, PosStore)> {
33391        use std::borrow::Cow;
33392        use std::io::{Read, Seek};
33393
33394        use common::{url::Params, ToParts};
33395        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33396
33397        let mut dd = common::DefaultDelegate;
33398        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33399        dlg.begin(common::MethodInfo {
33400            id: "content.pos.insert",
33401            http_method: hyper::Method::POST,
33402        });
33403
33404        for &field in ["alt", "merchantId", "targetMerchantId", "dryRun"].iter() {
33405            if self._additional_params.contains_key(field) {
33406                dlg.finished(false);
33407                return Err(common::Error::FieldClash(field));
33408            }
33409        }
33410
33411        let mut params = Params::with_capacity(6 + self._additional_params.len());
33412        params.push("merchantId", self._merchant_id.to_string());
33413        params.push("targetMerchantId", self._target_merchant_id.to_string());
33414        if let Some(value) = self._dry_run.as_ref() {
33415            params.push("dryRun", value.to_string());
33416        }
33417
33418        params.extend(self._additional_params.iter());
33419
33420        params.push("alt", "json");
33421        let mut url = self.hub._base_url.clone() + "{merchantId}/pos/{targetMerchantId}/store";
33422        if self._scopes.is_empty() {
33423            self._scopes.insert(Scope::Full.as_ref().to_string());
33424        }
33425
33426        #[allow(clippy::single_element_loop)]
33427        for &(find_this, param_name) in [
33428            ("{merchantId}", "merchantId"),
33429            ("{targetMerchantId}", "targetMerchantId"),
33430        ]
33431        .iter()
33432        {
33433            url = params.uri_replacement(url, param_name, find_this, false);
33434        }
33435        {
33436            let to_remove = ["targetMerchantId", "merchantId"];
33437            params.remove_params(&to_remove);
33438        }
33439
33440        let url = params.parse_with_url(&url);
33441
33442        let mut json_mime_type = mime::APPLICATION_JSON;
33443        let mut request_value_reader = {
33444            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33445            common::remove_json_null_values(&mut value);
33446            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33447            serde_json::to_writer(&mut dst, &value).unwrap();
33448            dst
33449        };
33450        let request_size = request_value_reader
33451            .seek(std::io::SeekFrom::End(0))
33452            .unwrap();
33453        request_value_reader
33454            .seek(std::io::SeekFrom::Start(0))
33455            .unwrap();
33456
33457        loop {
33458            let token = match self
33459                .hub
33460                .auth
33461                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33462                .await
33463            {
33464                Ok(token) => token,
33465                Err(e) => match dlg.token(e) {
33466                    Ok(token) => token,
33467                    Err(e) => {
33468                        dlg.finished(false);
33469                        return Err(common::Error::MissingToken(e));
33470                    }
33471                },
33472            };
33473            request_value_reader
33474                .seek(std::io::SeekFrom::Start(0))
33475                .unwrap();
33476            let mut req_result = {
33477                let client = &self.hub.client;
33478                dlg.pre_request();
33479                let mut req_builder = hyper::Request::builder()
33480                    .method(hyper::Method::POST)
33481                    .uri(url.as_str())
33482                    .header(USER_AGENT, self.hub._user_agent.clone());
33483
33484                if let Some(token) = token.as_ref() {
33485                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33486                }
33487
33488                let request = req_builder
33489                    .header(CONTENT_TYPE, json_mime_type.to_string())
33490                    .header(CONTENT_LENGTH, request_size as u64)
33491                    .body(common::to_body(
33492                        request_value_reader.get_ref().clone().into(),
33493                    ));
33494
33495                client.request(request.unwrap()).await
33496            };
33497
33498            match req_result {
33499                Err(err) => {
33500                    if let common::Retry::After(d) = dlg.http_error(&err) {
33501                        sleep(d).await;
33502                        continue;
33503                    }
33504                    dlg.finished(false);
33505                    return Err(common::Error::HttpError(err));
33506                }
33507                Ok(res) => {
33508                    let (mut parts, body) = res.into_parts();
33509                    let mut body = common::Body::new(body);
33510                    if !parts.status.is_success() {
33511                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33512                        let error = serde_json::from_str(&common::to_string(&bytes));
33513                        let response = common::to_response(parts, bytes.into());
33514
33515                        if let common::Retry::After(d) =
33516                            dlg.http_failure(&response, error.as_ref().ok())
33517                        {
33518                            sleep(d).await;
33519                            continue;
33520                        }
33521
33522                        dlg.finished(false);
33523
33524                        return Err(match error {
33525                            Ok(value) => common::Error::BadRequest(value),
33526                            _ => common::Error::Failure(response),
33527                        });
33528                    }
33529                    let response = {
33530                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33531                        let encoded = common::to_string(&bytes);
33532                        match serde_json::from_str(&encoded) {
33533                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33534                            Err(error) => {
33535                                dlg.response_json_decode_error(&encoded, &error);
33536                                return Err(common::Error::JsonDecodeError(
33537                                    encoded.to_string(),
33538                                    error,
33539                                ));
33540                            }
33541                        }
33542                    };
33543
33544                    dlg.finished(true);
33545                    return Ok(response);
33546                }
33547            }
33548        }
33549    }
33550
33551    ///
33552    /// Sets the *request* property to the given value.
33553    ///
33554    /// Even though the property as already been set when instantiating this call,
33555    /// we provide this method for API completeness.
33556    pub fn request(mut self, new_value: PosStore) -> PoInsertCall<'a, C> {
33557        self._request = new_value;
33558        self
33559    }
33560    /// The ID of the POS or inventory data provider.
33561    ///
33562    /// Sets the *merchant id* path property to the given value.
33563    ///
33564    /// Even though the property as already been set when instantiating this call,
33565    /// we provide this method for API completeness.
33566    pub fn merchant_id(mut self, new_value: u64) -> PoInsertCall<'a, C> {
33567        self._merchant_id = new_value;
33568        self
33569    }
33570    /// The ID of the target merchant.
33571    ///
33572    /// Sets the *target merchant id* path property to the given value.
33573    ///
33574    /// Even though the property as already been set when instantiating this call,
33575    /// we provide this method for API completeness.
33576    pub fn target_merchant_id(mut self, new_value: u64) -> PoInsertCall<'a, C> {
33577        self._target_merchant_id = new_value;
33578        self
33579    }
33580    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
33581    ///
33582    /// Sets the *dry run* query property to the given value.
33583    pub fn dry_run(mut self, new_value: bool) -> PoInsertCall<'a, C> {
33584        self._dry_run = Some(new_value);
33585        self
33586    }
33587    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33588    /// while executing the actual API request.
33589    ///
33590    /// ````text
33591    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33592    /// ````
33593    ///
33594    /// Sets the *delegate* property to the given value.
33595    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PoInsertCall<'a, C> {
33596        self._delegate = Some(new_value);
33597        self
33598    }
33599
33600    /// Set any additional parameter of the query string used in the request.
33601    /// It should be used to set parameters which are not yet available through their own
33602    /// setters.
33603    ///
33604    /// Please note that this method must not be used to set any of the known parameters
33605    /// which have their own setter method. If done anyway, the request will fail.
33606    ///
33607    /// # Additional Parameters
33608    ///
33609    /// * *$.xgafv* (query-string) - V1 error format.
33610    /// * *access_token* (query-string) - OAuth access token.
33611    /// * *alt* (query-string) - Data format for response.
33612    /// * *callback* (query-string) - JSONP
33613    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33614    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
33615    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33616    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33617    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
33618    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33619    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33620    pub fn param<T>(mut self, name: T, value: T) -> PoInsertCall<'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::Full`].
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>(mut self, scope: St) -> PoInsertCall<'a, C>
33641    where
33642        St: AsRef<str>,
33643    {
33644        self._scopes.insert(String::from(scope.as_ref()));
33645        self
33646    }
33647    /// Identifies the authorization scope(s) for the method you are building.
33648    ///
33649    /// See [`Self::add_scope()`] for details.
33650    pub fn add_scopes<I, St>(mut self, scopes: I) -> PoInsertCall<'a, C>
33651    where
33652        I: IntoIterator<Item = St>,
33653        St: AsRef<str>,
33654    {
33655        self._scopes
33656            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33657        self
33658    }
33659
33660    /// Removes all scopes, and no default scope will be used either.
33661    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33662    /// for details).
33663    pub fn clear_scopes(mut self) -> PoInsertCall<'a, C> {
33664        self._scopes.clear();
33665        self
33666    }
33667}
33668
33669/// Submit inventory for the given merchant.
33670///
33671/// A builder for the *inventory* method supported by a *po* resource.
33672/// It is not used directly, but through a [`PoMethods`] instance.
33673///
33674/// # Example
33675///
33676/// Instantiate a resource method builder
33677///
33678/// ```test_harness,no_run
33679/// # extern crate hyper;
33680/// # extern crate hyper_rustls;
33681/// # extern crate google_content2 as content2;
33682/// use content2::api::PosInventoryRequest;
33683/// # async fn dox() {
33684/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33685///
33686/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33687/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
33688/// #     .with_native_roots()
33689/// #     .unwrap()
33690/// #     .https_only()
33691/// #     .enable_http2()
33692/// #     .build();
33693///
33694/// # let executor = hyper_util::rt::TokioExecutor::new();
33695/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
33696/// #     secret,
33697/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33698/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
33699/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
33700/// #     ),
33701/// # ).build().await.unwrap();
33702///
33703/// # let client = hyper_util::client::legacy::Client::builder(
33704/// #     hyper_util::rt::TokioExecutor::new()
33705/// # )
33706/// # .build(
33707/// #     hyper_rustls::HttpsConnectorBuilder::new()
33708/// #         .with_native_roots()
33709/// #         .unwrap()
33710/// #         .https_or_http()
33711/// #         .enable_http2()
33712/// #         .build()
33713/// # );
33714/// # let mut hub = ShoppingContent::new(client, auth);
33715/// // As the method needs a request, you would usually fill it with the desired information
33716/// // into the respective structure. Some of the parts shown here might not be applicable !
33717/// // Values shown here are possibly random and not representative !
33718/// let mut req = PosInventoryRequest::default();
33719///
33720/// // You can configure optional parameters by calling the respective setters at will, and
33721/// // execute the final call using `doit()`.
33722/// // Values shown here are possibly random and not representative !
33723/// let result = hub.pos().inventory(req, 10, 35)
33724///              .dry_run(true)
33725///              .doit().await;
33726/// # }
33727/// ```
33728pub struct PoInventoryCall<'a, C>
33729where
33730    C: 'a,
33731{
33732    hub: &'a ShoppingContent<C>,
33733    _request: PosInventoryRequest,
33734    _merchant_id: u64,
33735    _target_merchant_id: u64,
33736    _dry_run: Option<bool>,
33737    _delegate: Option<&'a mut dyn common::Delegate>,
33738    _additional_params: HashMap<String, String>,
33739    _scopes: BTreeSet<String>,
33740}
33741
33742impl<'a, C> common::CallBuilder for PoInventoryCall<'a, C> {}
33743
33744impl<'a, C> PoInventoryCall<'a, C>
33745where
33746    C: common::Connector,
33747{
33748    /// Perform the operation you have build so far.
33749    pub async fn doit(mut self) -> common::Result<(common::Response, PosInventoryResponse)> {
33750        use std::borrow::Cow;
33751        use std::io::{Read, Seek};
33752
33753        use common::{url::Params, ToParts};
33754        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33755
33756        let mut dd = common::DefaultDelegate;
33757        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33758        dlg.begin(common::MethodInfo {
33759            id: "content.pos.inventory",
33760            http_method: hyper::Method::POST,
33761        });
33762
33763        for &field in ["alt", "merchantId", "targetMerchantId", "dryRun"].iter() {
33764            if self._additional_params.contains_key(field) {
33765                dlg.finished(false);
33766                return Err(common::Error::FieldClash(field));
33767            }
33768        }
33769
33770        let mut params = Params::with_capacity(6 + self._additional_params.len());
33771        params.push("merchantId", self._merchant_id.to_string());
33772        params.push("targetMerchantId", self._target_merchant_id.to_string());
33773        if let Some(value) = self._dry_run.as_ref() {
33774            params.push("dryRun", value.to_string());
33775        }
33776
33777        params.extend(self._additional_params.iter());
33778
33779        params.push("alt", "json");
33780        let mut url = self.hub._base_url.clone() + "{merchantId}/pos/{targetMerchantId}/inventory";
33781        if self._scopes.is_empty() {
33782            self._scopes.insert(Scope::Full.as_ref().to_string());
33783        }
33784
33785        #[allow(clippy::single_element_loop)]
33786        for &(find_this, param_name) in [
33787            ("{merchantId}", "merchantId"),
33788            ("{targetMerchantId}", "targetMerchantId"),
33789        ]
33790        .iter()
33791        {
33792            url = params.uri_replacement(url, param_name, find_this, false);
33793        }
33794        {
33795            let to_remove = ["targetMerchantId", "merchantId"];
33796            params.remove_params(&to_remove);
33797        }
33798
33799        let url = params.parse_with_url(&url);
33800
33801        let mut json_mime_type = mime::APPLICATION_JSON;
33802        let mut request_value_reader = {
33803            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33804            common::remove_json_null_values(&mut value);
33805            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33806            serde_json::to_writer(&mut dst, &value).unwrap();
33807            dst
33808        };
33809        let request_size = request_value_reader
33810            .seek(std::io::SeekFrom::End(0))
33811            .unwrap();
33812        request_value_reader
33813            .seek(std::io::SeekFrom::Start(0))
33814            .unwrap();
33815
33816        loop {
33817            let token = match self
33818                .hub
33819                .auth
33820                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33821                .await
33822            {
33823                Ok(token) => token,
33824                Err(e) => match dlg.token(e) {
33825                    Ok(token) => token,
33826                    Err(e) => {
33827                        dlg.finished(false);
33828                        return Err(common::Error::MissingToken(e));
33829                    }
33830                },
33831            };
33832            request_value_reader
33833                .seek(std::io::SeekFrom::Start(0))
33834                .unwrap();
33835            let mut req_result = {
33836                let client = &self.hub.client;
33837                dlg.pre_request();
33838                let mut req_builder = hyper::Request::builder()
33839                    .method(hyper::Method::POST)
33840                    .uri(url.as_str())
33841                    .header(USER_AGENT, self.hub._user_agent.clone());
33842
33843                if let Some(token) = token.as_ref() {
33844                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33845                }
33846
33847                let request = req_builder
33848                    .header(CONTENT_TYPE, json_mime_type.to_string())
33849                    .header(CONTENT_LENGTH, request_size as u64)
33850                    .body(common::to_body(
33851                        request_value_reader.get_ref().clone().into(),
33852                    ));
33853
33854                client.request(request.unwrap()).await
33855            };
33856
33857            match req_result {
33858                Err(err) => {
33859                    if let common::Retry::After(d) = dlg.http_error(&err) {
33860                        sleep(d).await;
33861                        continue;
33862                    }
33863                    dlg.finished(false);
33864                    return Err(common::Error::HttpError(err));
33865                }
33866                Ok(res) => {
33867                    let (mut parts, body) = res.into_parts();
33868                    let mut body = common::Body::new(body);
33869                    if !parts.status.is_success() {
33870                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33871                        let error = serde_json::from_str(&common::to_string(&bytes));
33872                        let response = common::to_response(parts, bytes.into());
33873
33874                        if let common::Retry::After(d) =
33875                            dlg.http_failure(&response, error.as_ref().ok())
33876                        {
33877                            sleep(d).await;
33878                            continue;
33879                        }
33880
33881                        dlg.finished(false);
33882
33883                        return Err(match error {
33884                            Ok(value) => common::Error::BadRequest(value),
33885                            _ => common::Error::Failure(response),
33886                        });
33887                    }
33888                    let response = {
33889                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33890                        let encoded = common::to_string(&bytes);
33891                        match serde_json::from_str(&encoded) {
33892                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33893                            Err(error) => {
33894                                dlg.response_json_decode_error(&encoded, &error);
33895                                return Err(common::Error::JsonDecodeError(
33896                                    encoded.to_string(),
33897                                    error,
33898                                ));
33899                            }
33900                        }
33901                    };
33902
33903                    dlg.finished(true);
33904                    return Ok(response);
33905                }
33906            }
33907        }
33908    }
33909
33910    ///
33911    /// Sets the *request* 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 request(mut self, new_value: PosInventoryRequest) -> PoInventoryCall<'a, C> {
33916        self._request = new_value;
33917        self
33918    }
33919    /// The ID of the POS or inventory data provider.
33920    ///
33921    /// Sets the *merchant id* path property to the given value.
33922    ///
33923    /// Even though the property as already been set when instantiating this call,
33924    /// we provide this method for API completeness.
33925    pub fn merchant_id(mut self, new_value: u64) -> PoInventoryCall<'a, C> {
33926        self._merchant_id = new_value;
33927        self
33928    }
33929    /// The ID of the target merchant.
33930    ///
33931    /// Sets the *target merchant id* path property to the given value.
33932    ///
33933    /// Even though the property as already been set when instantiating this call,
33934    /// we provide this method for API completeness.
33935    pub fn target_merchant_id(mut self, new_value: u64) -> PoInventoryCall<'a, C> {
33936        self._target_merchant_id = new_value;
33937        self
33938    }
33939    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
33940    ///
33941    /// Sets the *dry run* query property to the given value.
33942    pub fn dry_run(mut self, new_value: bool) -> PoInventoryCall<'a, C> {
33943        self._dry_run = Some(new_value);
33944        self
33945    }
33946    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33947    /// while executing the actual API request.
33948    ///
33949    /// ````text
33950    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33951    /// ````
33952    ///
33953    /// Sets the *delegate* property to the given value.
33954    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PoInventoryCall<'a, C> {
33955        self._delegate = Some(new_value);
33956        self
33957    }
33958
33959    /// Set any additional parameter of the query string used in the request.
33960    /// It should be used to set parameters which are not yet available through their own
33961    /// setters.
33962    ///
33963    /// Please note that this method must not be used to set any of the known parameters
33964    /// which have their own setter method. If done anyway, the request will fail.
33965    ///
33966    /// # Additional Parameters
33967    ///
33968    /// * *$.xgafv* (query-string) - V1 error format.
33969    /// * *access_token* (query-string) - OAuth access token.
33970    /// * *alt* (query-string) - Data format for response.
33971    /// * *callback* (query-string) - JSONP
33972    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33973    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
33974    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33975    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33976    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
33977    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33978    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33979    pub fn param<T>(mut self, name: T, value: T) -> PoInventoryCall<'a, C>
33980    where
33981        T: AsRef<str>,
33982    {
33983        self._additional_params
33984            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33985        self
33986    }
33987
33988    /// Identifies the authorization scope for the method you are building.
33989    ///
33990    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33991    /// [`Scope::Full`].
33992    ///
33993    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33994    /// tokens for more than one scope.
33995    ///
33996    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33997    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33998    /// sufficient, a read-write scope will do as well.
33999    pub fn add_scope<St>(mut self, scope: St) -> PoInventoryCall<'a, C>
34000    where
34001        St: AsRef<str>,
34002    {
34003        self._scopes.insert(String::from(scope.as_ref()));
34004        self
34005    }
34006    /// Identifies the authorization scope(s) for the method you are building.
34007    ///
34008    /// See [`Self::add_scope()`] for details.
34009    pub fn add_scopes<I, St>(mut self, scopes: I) -> PoInventoryCall<'a, C>
34010    where
34011        I: IntoIterator<Item = St>,
34012        St: AsRef<str>,
34013    {
34014        self._scopes
34015            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34016        self
34017    }
34018
34019    /// Removes all scopes, and no default scope will be used either.
34020    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34021    /// for details).
34022    pub fn clear_scopes(mut self) -> PoInventoryCall<'a, C> {
34023        self._scopes.clear();
34024        self
34025    }
34026}
34027
34028/// Lists the stores of the target merchant.
34029///
34030/// A builder for the *list* method supported by a *po* resource.
34031/// It is not used directly, but through a [`PoMethods`] instance.
34032///
34033/// # Example
34034///
34035/// Instantiate a resource method builder
34036///
34037/// ```test_harness,no_run
34038/// # extern crate hyper;
34039/// # extern crate hyper_rustls;
34040/// # extern crate google_content2 as content2;
34041/// # async fn dox() {
34042/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34043///
34044/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34045/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
34046/// #     .with_native_roots()
34047/// #     .unwrap()
34048/// #     .https_only()
34049/// #     .enable_http2()
34050/// #     .build();
34051///
34052/// # let executor = hyper_util::rt::TokioExecutor::new();
34053/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
34054/// #     secret,
34055/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34056/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
34057/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
34058/// #     ),
34059/// # ).build().await.unwrap();
34060///
34061/// # let client = hyper_util::client::legacy::Client::builder(
34062/// #     hyper_util::rt::TokioExecutor::new()
34063/// # )
34064/// # .build(
34065/// #     hyper_rustls::HttpsConnectorBuilder::new()
34066/// #         .with_native_roots()
34067/// #         .unwrap()
34068/// #         .https_or_http()
34069/// #         .enable_http2()
34070/// #         .build()
34071/// # );
34072/// # let mut hub = ShoppingContent::new(client, auth);
34073/// // You can configure optional parameters by calling the respective setters at will, and
34074/// // execute the final call using `doit()`.
34075/// // Values shown here are possibly random and not representative !
34076/// let result = hub.pos().list(67, 76)
34077///              .doit().await;
34078/// # }
34079/// ```
34080pub struct PoListCall<'a, C>
34081where
34082    C: 'a,
34083{
34084    hub: &'a ShoppingContent<C>,
34085    _merchant_id: u64,
34086    _target_merchant_id: u64,
34087    _delegate: Option<&'a mut dyn common::Delegate>,
34088    _additional_params: HashMap<String, String>,
34089    _scopes: BTreeSet<String>,
34090}
34091
34092impl<'a, C> common::CallBuilder for PoListCall<'a, C> {}
34093
34094impl<'a, C> PoListCall<'a, C>
34095where
34096    C: common::Connector,
34097{
34098    /// Perform the operation you have build so far.
34099    pub async fn doit(mut self) -> common::Result<(common::Response, PosListResponse)> {
34100        use std::borrow::Cow;
34101        use std::io::{Read, Seek};
34102
34103        use common::{url::Params, ToParts};
34104        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34105
34106        let mut dd = common::DefaultDelegate;
34107        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34108        dlg.begin(common::MethodInfo {
34109            id: "content.pos.list",
34110            http_method: hyper::Method::GET,
34111        });
34112
34113        for &field in ["alt", "merchantId", "targetMerchantId"].iter() {
34114            if self._additional_params.contains_key(field) {
34115                dlg.finished(false);
34116                return Err(common::Error::FieldClash(field));
34117            }
34118        }
34119
34120        let mut params = Params::with_capacity(4 + self._additional_params.len());
34121        params.push("merchantId", self._merchant_id.to_string());
34122        params.push("targetMerchantId", self._target_merchant_id.to_string());
34123
34124        params.extend(self._additional_params.iter());
34125
34126        params.push("alt", "json");
34127        let mut url = self.hub._base_url.clone() + "{merchantId}/pos/{targetMerchantId}/store";
34128        if self._scopes.is_empty() {
34129            self._scopes.insert(Scope::Full.as_ref().to_string());
34130        }
34131
34132        #[allow(clippy::single_element_loop)]
34133        for &(find_this, param_name) in [
34134            ("{merchantId}", "merchantId"),
34135            ("{targetMerchantId}", "targetMerchantId"),
34136        ]
34137        .iter()
34138        {
34139            url = params.uri_replacement(url, param_name, find_this, false);
34140        }
34141        {
34142            let to_remove = ["targetMerchantId", "merchantId"];
34143            params.remove_params(&to_remove);
34144        }
34145
34146        let url = params.parse_with_url(&url);
34147
34148        loop {
34149            let token = match self
34150                .hub
34151                .auth
34152                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34153                .await
34154            {
34155                Ok(token) => token,
34156                Err(e) => match dlg.token(e) {
34157                    Ok(token) => token,
34158                    Err(e) => {
34159                        dlg.finished(false);
34160                        return Err(common::Error::MissingToken(e));
34161                    }
34162                },
34163            };
34164            let mut req_result = {
34165                let client = &self.hub.client;
34166                dlg.pre_request();
34167                let mut req_builder = hyper::Request::builder()
34168                    .method(hyper::Method::GET)
34169                    .uri(url.as_str())
34170                    .header(USER_AGENT, self.hub._user_agent.clone());
34171
34172                if let Some(token) = token.as_ref() {
34173                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34174                }
34175
34176                let request = req_builder
34177                    .header(CONTENT_LENGTH, 0_u64)
34178                    .body(common::to_body::<String>(None));
34179
34180                client.request(request.unwrap()).await
34181            };
34182
34183            match req_result {
34184                Err(err) => {
34185                    if let common::Retry::After(d) = dlg.http_error(&err) {
34186                        sleep(d).await;
34187                        continue;
34188                    }
34189                    dlg.finished(false);
34190                    return Err(common::Error::HttpError(err));
34191                }
34192                Ok(res) => {
34193                    let (mut parts, body) = res.into_parts();
34194                    let mut body = common::Body::new(body);
34195                    if !parts.status.is_success() {
34196                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34197                        let error = serde_json::from_str(&common::to_string(&bytes));
34198                        let response = common::to_response(parts, bytes.into());
34199
34200                        if let common::Retry::After(d) =
34201                            dlg.http_failure(&response, error.as_ref().ok())
34202                        {
34203                            sleep(d).await;
34204                            continue;
34205                        }
34206
34207                        dlg.finished(false);
34208
34209                        return Err(match error {
34210                            Ok(value) => common::Error::BadRequest(value),
34211                            _ => common::Error::Failure(response),
34212                        });
34213                    }
34214                    let response = {
34215                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34216                        let encoded = common::to_string(&bytes);
34217                        match serde_json::from_str(&encoded) {
34218                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34219                            Err(error) => {
34220                                dlg.response_json_decode_error(&encoded, &error);
34221                                return Err(common::Error::JsonDecodeError(
34222                                    encoded.to_string(),
34223                                    error,
34224                                ));
34225                            }
34226                        }
34227                    };
34228
34229                    dlg.finished(true);
34230                    return Ok(response);
34231                }
34232            }
34233        }
34234    }
34235
34236    /// The ID of the POS or inventory data provider.
34237    ///
34238    /// Sets the *merchant id* path property to the given value.
34239    ///
34240    /// Even though the property as already been set when instantiating this call,
34241    /// we provide this method for API completeness.
34242    pub fn merchant_id(mut self, new_value: u64) -> PoListCall<'a, C> {
34243        self._merchant_id = new_value;
34244        self
34245    }
34246    /// The ID of the target merchant.
34247    ///
34248    /// Sets the *target merchant id* path property to the given value.
34249    ///
34250    /// Even though the property as already been set when instantiating this call,
34251    /// we provide this method for API completeness.
34252    pub fn target_merchant_id(mut self, new_value: u64) -> PoListCall<'a, C> {
34253        self._target_merchant_id = new_value;
34254        self
34255    }
34256    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34257    /// while executing the actual API request.
34258    ///
34259    /// ````text
34260    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34261    /// ````
34262    ///
34263    /// Sets the *delegate* property to the given value.
34264    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PoListCall<'a, C> {
34265        self._delegate = Some(new_value);
34266        self
34267    }
34268
34269    /// Set any additional parameter of the query string used in the request.
34270    /// It should be used to set parameters which are not yet available through their own
34271    /// setters.
34272    ///
34273    /// Please note that this method must not be used to set any of the known parameters
34274    /// which have their own setter method. If done anyway, the request will fail.
34275    ///
34276    /// # Additional Parameters
34277    ///
34278    /// * *$.xgafv* (query-string) - V1 error format.
34279    /// * *access_token* (query-string) - OAuth access token.
34280    /// * *alt* (query-string) - Data format for response.
34281    /// * *callback* (query-string) - JSONP
34282    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34283    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
34284    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34285    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34286    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
34287    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34288    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34289    pub fn param<T>(mut self, name: T, value: T) -> PoListCall<'a, C>
34290    where
34291        T: AsRef<str>,
34292    {
34293        self._additional_params
34294            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34295        self
34296    }
34297
34298    /// Identifies the authorization scope for the method you are building.
34299    ///
34300    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34301    /// [`Scope::Full`].
34302    ///
34303    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34304    /// tokens for more than one scope.
34305    ///
34306    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34307    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34308    /// sufficient, a read-write scope will do as well.
34309    pub fn add_scope<St>(mut self, scope: St) -> PoListCall<'a, C>
34310    where
34311        St: AsRef<str>,
34312    {
34313        self._scopes.insert(String::from(scope.as_ref()));
34314        self
34315    }
34316    /// Identifies the authorization scope(s) for the method you are building.
34317    ///
34318    /// See [`Self::add_scope()`] for details.
34319    pub fn add_scopes<I, St>(mut self, scopes: I) -> PoListCall<'a, C>
34320    where
34321        I: IntoIterator<Item = St>,
34322        St: AsRef<str>,
34323    {
34324        self._scopes
34325            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34326        self
34327    }
34328
34329    /// Removes all scopes, and no default scope will be used either.
34330    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34331    /// for details).
34332    pub fn clear_scopes(mut self) -> PoListCall<'a, C> {
34333        self._scopes.clear();
34334        self
34335    }
34336}
34337
34338/// Submit a sale event for the given merchant.
34339///
34340/// A builder for the *sale* method supported by a *po* resource.
34341/// It is not used directly, but through a [`PoMethods`] instance.
34342///
34343/// # Example
34344///
34345/// Instantiate a resource method builder
34346///
34347/// ```test_harness,no_run
34348/// # extern crate hyper;
34349/// # extern crate hyper_rustls;
34350/// # extern crate google_content2 as content2;
34351/// use content2::api::PosSaleRequest;
34352/// # async fn dox() {
34353/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34354///
34355/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34356/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
34357/// #     .with_native_roots()
34358/// #     .unwrap()
34359/// #     .https_only()
34360/// #     .enable_http2()
34361/// #     .build();
34362///
34363/// # let executor = hyper_util::rt::TokioExecutor::new();
34364/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
34365/// #     secret,
34366/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34367/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
34368/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
34369/// #     ),
34370/// # ).build().await.unwrap();
34371///
34372/// # let client = hyper_util::client::legacy::Client::builder(
34373/// #     hyper_util::rt::TokioExecutor::new()
34374/// # )
34375/// # .build(
34376/// #     hyper_rustls::HttpsConnectorBuilder::new()
34377/// #         .with_native_roots()
34378/// #         .unwrap()
34379/// #         .https_or_http()
34380/// #         .enable_http2()
34381/// #         .build()
34382/// # );
34383/// # let mut hub = ShoppingContent::new(client, auth);
34384/// // As the method needs a request, you would usually fill it with the desired information
34385/// // into the respective structure. Some of the parts shown here might not be applicable !
34386/// // Values shown here are possibly random and not representative !
34387/// let mut req = PosSaleRequest::default();
34388///
34389/// // You can configure optional parameters by calling the respective setters at will, and
34390/// // execute the final call using `doit()`.
34391/// // Values shown here are possibly random and not representative !
34392/// let result = hub.pos().sale(req, 49, 17)
34393///              .dry_run(false)
34394///              .doit().await;
34395/// # }
34396/// ```
34397pub struct PoSaleCall<'a, C>
34398where
34399    C: 'a,
34400{
34401    hub: &'a ShoppingContent<C>,
34402    _request: PosSaleRequest,
34403    _merchant_id: u64,
34404    _target_merchant_id: u64,
34405    _dry_run: Option<bool>,
34406    _delegate: Option<&'a mut dyn common::Delegate>,
34407    _additional_params: HashMap<String, String>,
34408    _scopes: BTreeSet<String>,
34409}
34410
34411impl<'a, C> common::CallBuilder for PoSaleCall<'a, C> {}
34412
34413impl<'a, C> PoSaleCall<'a, C>
34414where
34415    C: common::Connector,
34416{
34417    /// Perform the operation you have build so far.
34418    pub async fn doit(mut self) -> common::Result<(common::Response, PosSaleResponse)> {
34419        use std::borrow::Cow;
34420        use std::io::{Read, Seek};
34421
34422        use common::{url::Params, ToParts};
34423        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34424
34425        let mut dd = common::DefaultDelegate;
34426        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34427        dlg.begin(common::MethodInfo {
34428            id: "content.pos.sale",
34429            http_method: hyper::Method::POST,
34430        });
34431
34432        for &field in ["alt", "merchantId", "targetMerchantId", "dryRun"].iter() {
34433            if self._additional_params.contains_key(field) {
34434                dlg.finished(false);
34435                return Err(common::Error::FieldClash(field));
34436            }
34437        }
34438
34439        let mut params = Params::with_capacity(6 + self._additional_params.len());
34440        params.push("merchantId", self._merchant_id.to_string());
34441        params.push("targetMerchantId", self._target_merchant_id.to_string());
34442        if let Some(value) = self._dry_run.as_ref() {
34443            params.push("dryRun", value.to_string());
34444        }
34445
34446        params.extend(self._additional_params.iter());
34447
34448        params.push("alt", "json");
34449        let mut url = self.hub._base_url.clone() + "{merchantId}/pos/{targetMerchantId}/sale";
34450        if self._scopes.is_empty() {
34451            self._scopes.insert(Scope::Full.as_ref().to_string());
34452        }
34453
34454        #[allow(clippy::single_element_loop)]
34455        for &(find_this, param_name) in [
34456            ("{merchantId}", "merchantId"),
34457            ("{targetMerchantId}", "targetMerchantId"),
34458        ]
34459        .iter()
34460        {
34461            url = params.uri_replacement(url, param_name, find_this, false);
34462        }
34463        {
34464            let to_remove = ["targetMerchantId", "merchantId"];
34465            params.remove_params(&to_remove);
34466        }
34467
34468        let url = params.parse_with_url(&url);
34469
34470        let mut json_mime_type = mime::APPLICATION_JSON;
34471        let mut request_value_reader = {
34472            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
34473            common::remove_json_null_values(&mut value);
34474            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
34475            serde_json::to_writer(&mut dst, &value).unwrap();
34476            dst
34477        };
34478        let request_size = request_value_reader
34479            .seek(std::io::SeekFrom::End(0))
34480            .unwrap();
34481        request_value_reader
34482            .seek(std::io::SeekFrom::Start(0))
34483            .unwrap();
34484
34485        loop {
34486            let token = match self
34487                .hub
34488                .auth
34489                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34490                .await
34491            {
34492                Ok(token) => token,
34493                Err(e) => match dlg.token(e) {
34494                    Ok(token) => token,
34495                    Err(e) => {
34496                        dlg.finished(false);
34497                        return Err(common::Error::MissingToken(e));
34498                    }
34499                },
34500            };
34501            request_value_reader
34502                .seek(std::io::SeekFrom::Start(0))
34503                .unwrap();
34504            let mut req_result = {
34505                let client = &self.hub.client;
34506                dlg.pre_request();
34507                let mut req_builder = hyper::Request::builder()
34508                    .method(hyper::Method::POST)
34509                    .uri(url.as_str())
34510                    .header(USER_AGENT, self.hub._user_agent.clone());
34511
34512                if let Some(token) = token.as_ref() {
34513                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34514                }
34515
34516                let request = req_builder
34517                    .header(CONTENT_TYPE, json_mime_type.to_string())
34518                    .header(CONTENT_LENGTH, request_size as u64)
34519                    .body(common::to_body(
34520                        request_value_reader.get_ref().clone().into(),
34521                    ));
34522
34523                client.request(request.unwrap()).await
34524            };
34525
34526            match req_result {
34527                Err(err) => {
34528                    if let common::Retry::After(d) = dlg.http_error(&err) {
34529                        sleep(d).await;
34530                        continue;
34531                    }
34532                    dlg.finished(false);
34533                    return Err(common::Error::HttpError(err));
34534                }
34535                Ok(res) => {
34536                    let (mut parts, body) = res.into_parts();
34537                    let mut body = common::Body::new(body);
34538                    if !parts.status.is_success() {
34539                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34540                        let error = serde_json::from_str(&common::to_string(&bytes));
34541                        let response = common::to_response(parts, bytes.into());
34542
34543                        if let common::Retry::After(d) =
34544                            dlg.http_failure(&response, error.as_ref().ok())
34545                        {
34546                            sleep(d).await;
34547                            continue;
34548                        }
34549
34550                        dlg.finished(false);
34551
34552                        return Err(match error {
34553                            Ok(value) => common::Error::BadRequest(value),
34554                            _ => common::Error::Failure(response),
34555                        });
34556                    }
34557                    let response = {
34558                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34559                        let encoded = common::to_string(&bytes);
34560                        match serde_json::from_str(&encoded) {
34561                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34562                            Err(error) => {
34563                                dlg.response_json_decode_error(&encoded, &error);
34564                                return Err(common::Error::JsonDecodeError(
34565                                    encoded.to_string(),
34566                                    error,
34567                                ));
34568                            }
34569                        }
34570                    };
34571
34572                    dlg.finished(true);
34573                    return Ok(response);
34574                }
34575            }
34576        }
34577    }
34578
34579    ///
34580    /// Sets the *request* property to the given value.
34581    ///
34582    /// Even though the property as already been set when instantiating this call,
34583    /// we provide this method for API completeness.
34584    pub fn request(mut self, new_value: PosSaleRequest) -> PoSaleCall<'a, C> {
34585        self._request = new_value;
34586        self
34587    }
34588    /// The ID of the POS or inventory data provider.
34589    ///
34590    /// Sets the *merchant id* path property to the given value.
34591    ///
34592    /// Even though the property as already been set when instantiating this call,
34593    /// we provide this method for API completeness.
34594    pub fn merchant_id(mut self, new_value: u64) -> PoSaleCall<'a, C> {
34595        self._merchant_id = new_value;
34596        self
34597    }
34598    /// The ID of the target merchant.
34599    ///
34600    /// Sets the *target merchant id* path property to the given value.
34601    ///
34602    /// Even though the property as already been set when instantiating this call,
34603    /// we provide this method for API completeness.
34604    pub fn target_merchant_id(mut self, new_value: u64) -> PoSaleCall<'a, C> {
34605        self._target_merchant_id = new_value;
34606        self
34607    }
34608    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
34609    ///
34610    /// Sets the *dry run* query property to the given value.
34611    pub fn dry_run(mut self, new_value: bool) -> PoSaleCall<'a, C> {
34612        self._dry_run = Some(new_value);
34613        self
34614    }
34615    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34616    /// while executing the actual API request.
34617    ///
34618    /// ````text
34619    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34620    /// ````
34621    ///
34622    /// Sets the *delegate* property to the given value.
34623    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PoSaleCall<'a, C> {
34624        self._delegate = Some(new_value);
34625        self
34626    }
34627
34628    /// Set any additional parameter of the query string used in the request.
34629    /// It should be used to set parameters which are not yet available through their own
34630    /// setters.
34631    ///
34632    /// Please note that this method must not be used to set any of the known parameters
34633    /// which have their own setter method. If done anyway, the request will fail.
34634    ///
34635    /// # Additional Parameters
34636    ///
34637    /// * *$.xgafv* (query-string) - V1 error format.
34638    /// * *access_token* (query-string) - OAuth access token.
34639    /// * *alt* (query-string) - Data format for response.
34640    /// * *callback* (query-string) - JSONP
34641    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34642    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
34643    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34644    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34645    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
34646    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34647    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34648    pub fn param<T>(mut self, name: T, value: T) -> PoSaleCall<'a, C>
34649    where
34650        T: AsRef<str>,
34651    {
34652        self._additional_params
34653            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34654        self
34655    }
34656
34657    /// Identifies the authorization scope for the method you are building.
34658    ///
34659    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34660    /// [`Scope::Full`].
34661    ///
34662    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34663    /// tokens for more than one scope.
34664    ///
34665    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34666    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34667    /// sufficient, a read-write scope will do as well.
34668    pub fn add_scope<St>(mut self, scope: St) -> PoSaleCall<'a, C>
34669    where
34670        St: AsRef<str>,
34671    {
34672        self._scopes.insert(String::from(scope.as_ref()));
34673        self
34674    }
34675    /// Identifies the authorization scope(s) for the method you are building.
34676    ///
34677    /// See [`Self::add_scope()`] for details.
34678    pub fn add_scopes<I, St>(mut self, scopes: I) -> PoSaleCall<'a, C>
34679    where
34680        I: IntoIterator<Item = St>,
34681        St: AsRef<str>,
34682    {
34683        self._scopes
34684            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34685        self
34686    }
34687
34688    /// Removes all scopes, and no default scope will be used either.
34689    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34690    /// for details).
34691    pub fn clear_scopes(mut self) -> PoSaleCall<'a, C> {
34692        self._scopes.clear();
34693        self
34694    }
34695}
34696
34697/// Retrieves, inserts, and deletes multiple products in a single request.
34698///
34699/// A builder for the *custombatch* method supported by a *product* resource.
34700/// It is not used directly, but through a [`ProductMethods`] instance.
34701///
34702/// # Example
34703///
34704/// Instantiate a resource method builder
34705///
34706/// ```test_harness,no_run
34707/// # extern crate hyper;
34708/// # extern crate hyper_rustls;
34709/// # extern crate google_content2 as content2;
34710/// use content2::api::ProductsCustomBatchRequest;
34711/// # async fn dox() {
34712/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34713///
34714/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34715/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
34716/// #     .with_native_roots()
34717/// #     .unwrap()
34718/// #     .https_only()
34719/// #     .enable_http2()
34720/// #     .build();
34721///
34722/// # let executor = hyper_util::rt::TokioExecutor::new();
34723/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
34724/// #     secret,
34725/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34726/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
34727/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
34728/// #     ),
34729/// # ).build().await.unwrap();
34730///
34731/// # let client = hyper_util::client::legacy::Client::builder(
34732/// #     hyper_util::rt::TokioExecutor::new()
34733/// # )
34734/// # .build(
34735/// #     hyper_rustls::HttpsConnectorBuilder::new()
34736/// #         .with_native_roots()
34737/// #         .unwrap()
34738/// #         .https_or_http()
34739/// #         .enable_http2()
34740/// #         .build()
34741/// # );
34742/// # let mut hub = ShoppingContent::new(client, auth);
34743/// // As the method needs a request, you would usually fill it with the desired information
34744/// // into the respective structure. Some of the parts shown here might not be applicable !
34745/// // Values shown here are possibly random and not representative !
34746/// let mut req = ProductsCustomBatchRequest::default();
34747///
34748/// // You can configure optional parameters by calling the respective setters at will, and
34749/// // execute the final call using `doit()`.
34750/// // Values shown here are possibly random and not representative !
34751/// let result = hub.products().custombatch(req)
34752///              .dry_run(true)
34753///              .doit().await;
34754/// # }
34755/// ```
34756pub struct ProductCustombatchCall<'a, C>
34757where
34758    C: 'a,
34759{
34760    hub: &'a ShoppingContent<C>,
34761    _request: ProductsCustomBatchRequest,
34762    _dry_run: Option<bool>,
34763    _delegate: Option<&'a mut dyn common::Delegate>,
34764    _additional_params: HashMap<String, String>,
34765    _scopes: BTreeSet<String>,
34766}
34767
34768impl<'a, C> common::CallBuilder for ProductCustombatchCall<'a, C> {}
34769
34770impl<'a, C> ProductCustombatchCall<'a, C>
34771where
34772    C: common::Connector,
34773{
34774    /// Perform the operation you have build so far.
34775    pub async fn doit(mut self) -> common::Result<(common::Response, ProductsCustomBatchResponse)> {
34776        use std::borrow::Cow;
34777        use std::io::{Read, Seek};
34778
34779        use common::{url::Params, ToParts};
34780        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34781
34782        let mut dd = common::DefaultDelegate;
34783        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34784        dlg.begin(common::MethodInfo {
34785            id: "content.products.custombatch",
34786            http_method: hyper::Method::POST,
34787        });
34788
34789        for &field in ["alt", "dryRun"].iter() {
34790            if self._additional_params.contains_key(field) {
34791                dlg.finished(false);
34792                return Err(common::Error::FieldClash(field));
34793            }
34794        }
34795
34796        let mut params = Params::with_capacity(4 + self._additional_params.len());
34797        if let Some(value) = self._dry_run.as_ref() {
34798            params.push("dryRun", value.to_string());
34799        }
34800
34801        params.extend(self._additional_params.iter());
34802
34803        params.push("alt", "json");
34804        let mut url = self.hub._base_url.clone() + "products/batch";
34805        if self._scopes.is_empty() {
34806            self._scopes.insert(Scope::Full.as_ref().to_string());
34807        }
34808
34809        let url = params.parse_with_url(&url);
34810
34811        let mut json_mime_type = mime::APPLICATION_JSON;
34812        let mut request_value_reader = {
34813            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
34814            common::remove_json_null_values(&mut value);
34815            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
34816            serde_json::to_writer(&mut dst, &value).unwrap();
34817            dst
34818        };
34819        let request_size = request_value_reader
34820            .seek(std::io::SeekFrom::End(0))
34821            .unwrap();
34822        request_value_reader
34823            .seek(std::io::SeekFrom::Start(0))
34824            .unwrap();
34825
34826        loop {
34827            let token = match self
34828                .hub
34829                .auth
34830                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34831                .await
34832            {
34833                Ok(token) => token,
34834                Err(e) => match dlg.token(e) {
34835                    Ok(token) => token,
34836                    Err(e) => {
34837                        dlg.finished(false);
34838                        return Err(common::Error::MissingToken(e));
34839                    }
34840                },
34841            };
34842            request_value_reader
34843                .seek(std::io::SeekFrom::Start(0))
34844                .unwrap();
34845            let mut req_result = {
34846                let client = &self.hub.client;
34847                dlg.pre_request();
34848                let mut req_builder = hyper::Request::builder()
34849                    .method(hyper::Method::POST)
34850                    .uri(url.as_str())
34851                    .header(USER_AGENT, self.hub._user_agent.clone());
34852
34853                if let Some(token) = token.as_ref() {
34854                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34855                }
34856
34857                let request = req_builder
34858                    .header(CONTENT_TYPE, json_mime_type.to_string())
34859                    .header(CONTENT_LENGTH, request_size as u64)
34860                    .body(common::to_body(
34861                        request_value_reader.get_ref().clone().into(),
34862                    ));
34863
34864                client.request(request.unwrap()).await
34865            };
34866
34867            match req_result {
34868                Err(err) => {
34869                    if let common::Retry::After(d) = dlg.http_error(&err) {
34870                        sleep(d).await;
34871                        continue;
34872                    }
34873                    dlg.finished(false);
34874                    return Err(common::Error::HttpError(err));
34875                }
34876                Ok(res) => {
34877                    let (mut parts, body) = res.into_parts();
34878                    let mut body = common::Body::new(body);
34879                    if !parts.status.is_success() {
34880                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34881                        let error = serde_json::from_str(&common::to_string(&bytes));
34882                        let response = common::to_response(parts, bytes.into());
34883
34884                        if let common::Retry::After(d) =
34885                            dlg.http_failure(&response, error.as_ref().ok())
34886                        {
34887                            sleep(d).await;
34888                            continue;
34889                        }
34890
34891                        dlg.finished(false);
34892
34893                        return Err(match error {
34894                            Ok(value) => common::Error::BadRequest(value),
34895                            _ => common::Error::Failure(response),
34896                        });
34897                    }
34898                    let response = {
34899                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34900                        let encoded = common::to_string(&bytes);
34901                        match serde_json::from_str(&encoded) {
34902                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34903                            Err(error) => {
34904                                dlg.response_json_decode_error(&encoded, &error);
34905                                return Err(common::Error::JsonDecodeError(
34906                                    encoded.to_string(),
34907                                    error,
34908                                ));
34909                            }
34910                        }
34911                    };
34912
34913                    dlg.finished(true);
34914                    return Ok(response);
34915                }
34916            }
34917        }
34918    }
34919
34920    ///
34921    /// Sets the *request* property to the given value.
34922    ///
34923    /// Even though the property as already been set when instantiating this call,
34924    /// we provide this method for API completeness.
34925    pub fn request(
34926        mut self,
34927        new_value: ProductsCustomBatchRequest,
34928    ) -> ProductCustombatchCall<'a, C> {
34929        self._request = new_value;
34930        self
34931    }
34932    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
34933    ///
34934    /// Sets the *dry run* query property to the given value.
34935    pub fn dry_run(mut self, new_value: bool) -> ProductCustombatchCall<'a, C> {
34936        self._dry_run = Some(new_value);
34937        self
34938    }
34939    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34940    /// while executing the actual API request.
34941    ///
34942    /// ````text
34943    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34944    /// ````
34945    ///
34946    /// Sets the *delegate* property to the given value.
34947    pub fn delegate(
34948        mut self,
34949        new_value: &'a mut dyn common::Delegate,
34950    ) -> ProductCustombatchCall<'a, C> {
34951        self._delegate = Some(new_value);
34952        self
34953    }
34954
34955    /// Set any additional parameter of the query string used in the request.
34956    /// It should be used to set parameters which are not yet available through their own
34957    /// setters.
34958    ///
34959    /// Please note that this method must not be used to set any of the known parameters
34960    /// which have their own setter method. If done anyway, the request will fail.
34961    ///
34962    /// # Additional Parameters
34963    ///
34964    /// * *$.xgafv* (query-string) - V1 error format.
34965    /// * *access_token* (query-string) - OAuth access token.
34966    /// * *alt* (query-string) - Data format for response.
34967    /// * *callback* (query-string) - JSONP
34968    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34969    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
34970    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34971    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34972    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
34973    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34974    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34975    pub fn param<T>(mut self, name: T, value: T) -> ProductCustombatchCall<'a, C>
34976    where
34977        T: AsRef<str>,
34978    {
34979        self._additional_params
34980            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34981        self
34982    }
34983
34984    /// Identifies the authorization scope for the method you are building.
34985    ///
34986    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34987    /// [`Scope::Full`].
34988    ///
34989    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34990    /// tokens for more than one scope.
34991    ///
34992    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34993    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34994    /// sufficient, a read-write scope will do as well.
34995    pub fn add_scope<St>(mut self, scope: St) -> ProductCustombatchCall<'a, C>
34996    where
34997        St: AsRef<str>,
34998    {
34999        self._scopes.insert(String::from(scope.as_ref()));
35000        self
35001    }
35002    /// Identifies the authorization scope(s) for the method you are building.
35003    ///
35004    /// See [`Self::add_scope()`] for details.
35005    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProductCustombatchCall<'a, C>
35006    where
35007        I: IntoIterator<Item = St>,
35008        St: AsRef<str>,
35009    {
35010        self._scopes
35011            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35012        self
35013    }
35014
35015    /// Removes all scopes, and no default scope will be used either.
35016    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35017    /// for details).
35018    pub fn clear_scopes(mut self) -> ProductCustombatchCall<'a, C> {
35019        self._scopes.clear();
35020        self
35021    }
35022}
35023
35024/// Deletes a product from your Merchant Center account.
35025///
35026/// A builder for the *delete* method supported by a *product* resource.
35027/// It is not used directly, but through a [`ProductMethods`] instance.
35028///
35029/// # Example
35030///
35031/// Instantiate a resource method builder
35032///
35033/// ```test_harness,no_run
35034/// # extern crate hyper;
35035/// # extern crate hyper_rustls;
35036/// # extern crate google_content2 as content2;
35037/// # async fn dox() {
35038/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35039///
35040/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35041/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
35042/// #     .with_native_roots()
35043/// #     .unwrap()
35044/// #     .https_only()
35045/// #     .enable_http2()
35046/// #     .build();
35047///
35048/// # let executor = hyper_util::rt::TokioExecutor::new();
35049/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
35050/// #     secret,
35051/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35052/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
35053/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
35054/// #     ),
35055/// # ).build().await.unwrap();
35056///
35057/// # let client = hyper_util::client::legacy::Client::builder(
35058/// #     hyper_util::rt::TokioExecutor::new()
35059/// # )
35060/// # .build(
35061/// #     hyper_rustls::HttpsConnectorBuilder::new()
35062/// #         .with_native_roots()
35063/// #         .unwrap()
35064/// #         .https_or_http()
35065/// #         .enable_http2()
35066/// #         .build()
35067/// # );
35068/// # let mut hub = ShoppingContent::new(client, auth);
35069/// // You can configure optional parameters by calling the respective setters at will, and
35070/// // execute the final call using `doit()`.
35071/// // Values shown here are possibly random and not representative !
35072/// let result = hub.products().delete(25, "productId")
35073///              .dry_run(true)
35074///              .doit().await;
35075/// # }
35076/// ```
35077pub struct ProductDeleteCall<'a, C>
35078where
35079    C: 'a,
35080{
35081    hub: &'a ShoppingContent<C>,
35082    _merchant_id: u64,
35083    _product_id: String,
35084    _dry_run: Option<bool>,
35085    _delegate: Option<&'a mut dyn common::Delegate>,
35086    _additional_params: HashMap<String, String>,
35087    _scopes: BTreeSet<String>,
35088}
35089
35090impl<'a, C> common::CallBuilder for ProductDeleteCall<'a, C> {}
35091
35092impl<'a, C> ProductDeleteCall<'a, C>
35093where
35094    C: common::Connector,
35095{
35096    /// Perform the operation you have build so far.
35097    pub async fn doit(mut self) -> common::Result<common::Response> {
35098        use std::borrow::Cow;
35099        use std::io::{Read, Seek};
35100
35101        use common::{url::Params, ToParts};
35102        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35103
35104        let mut dd = common::DefaultDelegate;
35105        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35106        dlg.begin(common::MethodInfo {
35107            id: "content.products.delete",
35108            http_method: hyper::Method::DELETE,
35109        });
35110
35111        for &field in ["merchantId", "productId", "dryRun"].iter() {
35112            if self._additional_params.contains_key(field) {
35113                dlg.finished(false);
35114                return Err(common::Error::FieldClash(field));
35115            }
35116        }
35117
35118        let mut params = Params::with_capacity(4 + self._additional_params.len());
35119        params.push("merchantId", self._merchant_id.to_string());
35120        params.push("productId", self._product_id);
35121        if let Some(value) = self._dry_run.as_ref() {
35122            params.push("dryRun", value.to_string());
35123        }
35124
35125        params.extend(self._additional_params.iter());
35126
35127        let mut url = self.hub._base_url.clone() + "{merchantId}/products/{productId}";
35128        if self._scopes.is_empty() {
35129            self._scopes.insert(Scope::Full.as_ref().to_string());
35130        }
35131
35132        #[allow(clippy::single_element_loop)]
35133        for &(find_this, param_name) in
35134            [("{merchantId}", "merchantId"), ("{productId}", "productId")].iter()
35135        {
35136            url = params.uri_replacement(url, param_name, find_this, false);
35137        }
35138        {
35139            let to_remove = ["productId", "merchantId"];
35140            params.remove_params(&to_remove);
35141        }
35142
35143        let url = params.parse_with_url(&url);
35144
35145        loop {
35146            let token = match self
35147                .hub
35148                .auth
35149                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35150                .await
35151            {
35152                Ok(token) => token,
35153                Err(e) => match dlg.token(e) {
35154                    Ok(token) => token,
35155                    Err(e) => {
35156                        dlg.finished(false);
35157                        return Err(common::Error::MissingToken(e));
35158                    }
35159                },
35160            };
35161            let mut req_result = {
35162                let client = &self.hub.client;
35163                dlg.pre_request();
35164                let mut req_builder = hyper::Request::builder()
35165                    .method(hyper::Method::DELETE)
35166                    .uri(url.as_str())
35167                    .header(USER_AGENT, self.hub._user_agent.clone());
35168
35169                if let Some(token) = token.as_ref() {
35170                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35171                }
35172
35173                let request = req_builder
35174                    .header(CONTENT_LENGTH, 0_u64)
35175                    .body(common::to_body::<String>(None));
35176
35177                client.request(request.unwrap()).await
35178            };
35179
35180            match req_result {
35181                Err(err) => {
35182                    if let common::Retry::After(d) = dlg.http_error(&err) {
35183                        sleep(d).await;
35184                        continue;
35185                    }
35186                    dlg.finished(false);
35187                    return Err(common::Error::HttpError(err));
35188                }
35189                Ok(res) => {
35190                    let (mut parts, body) = res.into_parts();
35191                    let mut body = common::Body::new(body);
35192                    if !parts.status.is_success() {
35193                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35194                        let error = serde_json::from_str(&common::to_string(&bytes));
35195                        let response = common::to_response(parts, bytes.into());
35196
35197                        if let common::Retry::After(d) =
35198                            dlg.http_failure(&response, error.as_ref().ok())
35199                        {
35200                            sleep(d).await;
35201                            continue;
35202                        }
35203
35204                        dlg.finished(false);
35205
35206                        return Err(match error {
35207                            Ok(value) => common::Error::BadRequest(value),
35208                            _ => common::Error::Failure(response),
35209                        });
35210                    }
35211                    let response = common::Response::from_parts(parts, body);
35212
35213                    dlg.finished(true);
35214                    return Ok(response);
35215                }
35216            }
35217        }
35218    }
35219
35220    /// The ID of the account that contains the product. This account cannot be a multi-client account.
35221    ///
35222    /// Sets the *merchant id* path property to the given value.
35223    ///
35224    /// Even though the property as already been set when instantiating this call,
35225    /// we provide this method for API completeness.
35226    pub fn merchant_id(mut self, new_value: u64) -> ProductDeleteCall<'a, C> {
35227        self._merchant_id = new_value;
35228        self
35229    }
35230    /// The REST ID of the product.
35231    ///
35232    /// Sets the *product id* path property to the given value.
35233    ///
35234    /// Even though the property as already been set when instantiating this call,
35235    /// we provide this method for API completeness.
35236    pub fn product_id(mut self, new_value: &str) -> ProductDeleteCall<'a, C> {
35237        self._product_id = new_value.to_string();
35238        self
35239    }
35240    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
35241    ///
35242    /// Sets the *dry run* query property to the given value.
35243    pub fn dry_run(mut self, new_value: bool) -> ProductDeleteCall<'a, C> {
35244        self._dry_run = Some(new_value);
35245        self
35246    }
35247    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35248    /// while executing the actual API request.
35249    ///
35250    /// ````text
35251    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
35252    /// ````
35253    ///
35254    /// Sets the *delegate* property to the given value.
35255    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProductDeleteCall<'a, C> {
35256        self._delegate = Some(new_value);
35257        self
35258    }
35259
35260    /// Set any additional parameter of the query string used in the request.
35261    /// It should be used to set parameters which are not yet available through their own
35262    /// setters.
35263    ///
35264    /// Please note that this method must not be used to set any of the known parameters
35265    /// which have their own setter method. If done anyway, the request will fail.
35266    ///
35267    /// # Additional Parameters
35268    ///
35269    /// * *$.xgafv* (query-string) - V1 error format.
35270    /// * *access_token* (query-string) - OAuth access token.
35271    /// * *alt* (query-string) - Data format for response.
35272    /// * *callback* (query-string) - JSONP
35273    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35274    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
35275    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35276    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35277    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
35278    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35279    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35280    pub fn param<T>(mut self, name: T, value: T) -> ProductDeleteCall<'a, C>
35281    where
35282        T: AsRef<str>,
35283    {
35284        self._additional_params
35285            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35286        self
35287    }
35288
35289    /// Identifies the authorization scope for the method you are building.
35290    ///
35291    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35292    /// [`Scope::Full`].
35293    ///
35294    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35295    /// tokens for more than one scope.
35296    ///
35297    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35298    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35299    /// sufficient, a read-write scope will do as well.
35300    pub fn add_scope<St>(mut self, scope: St) -> ProductDeleteCall<'a, C>
35301    where
35302        St: AsRef<str>,
35303    {
35304        self._scopes.insert(String::from(scope.as_ref()));
35305        self
35306    }
35307    /// Identifies the authorization scope(s) for the method you are building.
35308    ///
35309    /// See [`Self::add_scope()`] for details.
35310    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProductDeleteCall<'a, C>
35311    where
35312        I: IntoIterator<Item = St>,
35313        St: AsRef<str>,
35314    {
35315        self._scopes
35316            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35317        self
35318    }
35319
35320    /// Removes all scopes, and no default scope will be used either.
35321    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35322    /// for details).
35323    pub fn clear_scopes(mut self) -> ProductDeleteCall<'a, C> {
35324        self._scopes.clear();
35325        self
35326    }
35327}
35328
35329/// Retrieves a product from your Merchant Center account.
35330///
35331/// A builder for the *get* method supported by a *product* resource.
35332/// It is not used directly, but through a [`ProductMethods`] instance.
35333///
35334/// # Example
35335///
35336/// Instantiate a resource method builder
35337///
35338/// ```test_harness,no_run
35339/// # extern crate hyper;
35340/// # extern crate hyper_rustls;
35341/// # extern crate google_content2 as content2;
35342/// # async fn dox() {
35343/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35344///
35345/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35346/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
35347/// #     .with_native_roots()
35348/// #     .unwrap()
35349/// #     .https_only()
35350/// #     .enable_http2()
35351/// #     .build();
35352///
35353/// # let executor = hyper_util::rt::TokioExecutor::new();
35354/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
35355/// #     secret,
35356/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35357/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
35358/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
35359/// #     ),
35360/// # ).build().await.unwrap();
35361///
35362/// # let client = hyper_util::client::legacy::Client::builder(
35363/// #     hyper_util::rt::TokioExecutor::new()
35364/// # )
35365/// # .build(
35366/// #     hyper_rustls::HttpsConnectorBuilder::new()
35367/// #         .with_native_roots()
35368/// #         .unwrap()
35369/// #         .https_or_http()
35370/// #         .enable_http2()
35371/// #         .build()
35372/// # );
35373/// # let mut hub = ShoppingContent::new(client, auth);
35374/// // You can configure optional parameters by calling the respective setters at will, and
35375/// // execute the final call using `doit()`.
35376/// // Values shown here are possibly random and not representative !
35377/// let result = hub.products().get(14, "productId")
35378///              .doit().await;
35379/// # }
35380/// ```
35381pub struct ProductGetCall<'a, C>
35382where
35383    C: 'a,
35384{
35385    hub: &'a ShoppingContent<C>,
35386    _merchant_id: u64,
35387    _product_id: String,
35388    _delegate: Option<&'a mut dyn common::Delegate>,
35389    _additional_params: HashMap<String, String>,
35390    _scopes: BTreeSet<String>,
35391}
35392
35393impl<'a, C> common::CallBuilder for ProductGetCall<'a, C> {}
35394
35395impl<'a, C> ProductGetCall<'a, C>
35396where
35397    C: common::Connector,
35398{
35399    /// Perform the operation you have build so far.
35400    pub async fn doit(mut self) -> common::Result<(common::Response, Product)> {
35401        use std::borrow::Cow;
35402        use std::io::{Read, Seek};
35403
35404        use common::{url::Params, ToParts};
35405        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35406
35407        let mut dd = common::DefaultDelegate;
35408        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35409        dlg.begin(common::MethodInfo {
35410            id: "content.products.get",
35411            http_method: hyper::Method::GET,
35412        });
35413
35414        for &field in ["alt", "merchantId", "productId"].iter() {
35415            if self._additional_params.contains_key(field) {
35416                dlg.finished(false);
35417                return Err(common::Error::FieldClash(field));
35418            }
35419        }
35420
35421        let mut params = Params::with_capacity(4 + self._additional_params.len());
35422        params.push("merchantId", self._merchant_id.to_string());
35423        params.push("productId", self._product_id);
35424
35425        params.extend(self._additional_params.iter());
35426
35427        params.push("alt", "json");
35428        let mut url = self.hub._base_url.clone() + "{merchantId}/products/{productId}";
35429        if self._scopes.is_empty() {
35430            self._scopes.insert(Scope::Full.as_ref().to_string());
35431        }
35432
35433        #[allow(clippy::single_element_loop)]
35434        for &(find_this, param_name) in
35435            [("{merchantId}", "merchantId"), ("{productId}", "productId")].iter()
35436        {
35437            url = params.uri_replacement(url, param_name, find_this, false);
35438        }
35439        {
35440            let to_remove = ["productId", "merchantId"];
35441            params.remove_params(&to_remove);
35442        }
35443
35444        let url = params.parse_with_url(&url);
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            let mut req_result = {
35463                let client = &self.hub.client;
35464                dlg.pre_request();
35465                let mut req_builder = hyper::Request::builder()
35466                    .method(hyper::Method::GET)
35467                    .uri(url.as_str())
35468                    .header(USER_AGENT, self.hub._user_agent.clone());
35469
35470                if let Some(token) = token.as_ref() {
35471                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35472                }
35473
35474                let request = req_builder
35475                    .header(CONTENT_LENGTH, 0_u64)
35476                    .body(common::to_body::<String>(None));
35477
35478                client.request(request.unwrap()).await
35479            };
35480
35481            match req_result {
35482                Err(err) => {
35483                    if let common::Retry::After(d) = dlg.http_error(&err) {
35484                        sleep(d).await;
35485                        continue;
35486                    }
35487                    dlg.finished(false);
35488                    return Err(common::Error::HttpError(err));
35489                }
35490                Ok(res) => {
35491                    let (mut parts, body) = res.into_parts();
35492                    let mut body = common::Body::new(body);
35493                    if !parts.status.is_success() {
35494                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35495                        let error = serde_json::from_str(&common::to_string(&bytes));
35496                        let response = common::to_response(parts, bytes.into());
35497
35498                        if let common::Retry::After(d) =
35499                            dlg.http_failure(&response, error.as_ref().ok())
35500                        {
35501                            sleep(d).await;
35502                            continue;
35503                        }
35504
35505                        dlg.finished(false);
35506
35507                        return Err(match error {
35508                            Ok(value) => common::Error::BadRequest(value),
35509                            _ => common::Error::Failure(response),
35510                        });
35511                    }
35512                    let response = {
35513                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35514                        let encoded = common::to_string(&bytes);
35515                        match serde_json::from_str(&encoded) {
35516                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35517                            Err(error) => {
35518                                dlg.response_json_decode_error(&encoded, &error);
35519                                return Err(common::Error::JsonDecodeError(
35520                                    encoded.to_string(),
35521                                    error,
35522                                ));
35523                            }
35524                        }
35525                    };
35526
35527                    dlg.finished(true);
35528                    return Ok(response);
35529                }
35530            }
35531        }
35532    }
35533
35534    /// The ID of the account that contains the product. This account cannot be a multi-client account.
35535    ///
35536    /// Sets the *merchant id* path property to the given value.
35537    ///
35538    /// Even though the property as already been set when instantiating this call,
35539    /// we provide this method for API completeness.
35540    pub fn merchant_id(mut self, new_value: u64) -> ProductGetCall<'a, C> {
35541        self._merchant_id = new_value;
35542        self
35543    }
35544    /// The REST ID of the product.
35545    ///
35546    /// Sets the *product id* path property to the given value.
35547    ///
35548    /// Even though the property as already been set when instantiating this call,
35549    /// we provide this method for API completeness.
35550    pub fn product_id(mut self, new_value: &str) -> ProductGetCall<'a, C> {
35551        self._product_id = new_value.to_string();
35552        self
35553    }
35554    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35555    /// while executing the actual API request.
35556    ///
35557    /// ````text
35558    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
35559    /// ````
35560    ///
35561    /// Sets the *delegate* property to the given value.
35562    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProductGetCall<'a, C> {
35563        self._delegate = Some(new_value);
35564        self
35565    }
35566
35567    /// Set any additional parameter of the query string used in the request.
35568    /// It should be used to set parameters which are not yet available through their own
35569    /// setters.
35570    ///
35571    /// Please note that this method must not be used to set any of the known parameters
35572    /// which have their own setter method. If done anyway, the request will fail.
35573    ///
35574    /// # Additional Parameters
35575    ///
35576    /// * *$.xgafv* (query-string) - V1 error format.
35577    /// * *access_token* (query-string) - OAuth access token.
35578    /// * *alt* (query-string) - Data format for response.
35579    /// * *callback* (query-string) - JSONP
35580    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35581    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
35582    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35583    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35584    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
35585    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35586    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35587    pub fn param<T>(mut self, name: T, value: T) -> ProductGetCall<'a, C>
35588    where
35589        T: AsRef<str>,
35590    {
35591        self._additional_params
35592            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35593        self
35594    }
35595
35596    /// Identifies the authorization scope for the method you are building.
35597    ///
35598    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35599    /// [`Scope::Full`].
35600    ///
35601    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35602    /// tokens for more than one scope.
35603    ///
35604    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35605    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35606    /// sufficient, a read-write scope will do as well.
35607    pub fn add_scope<St>(mut self, scope: St) -> ProductGetCall<'a, C>
35608    where
35609        St: AsRef<str>,
35610    {
35611        self._scopes.insert(String::from(scope.as_ref()));
35612        self
35613    }
35614    /// Identifies the authorization scope(s) for the method you are building.
35615    ///
35616    /// See [`Self::add_scope()`] for details.
35617    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProductGetCall<'a, C>
35618    where
35619        I: IntoIterator<Item = St>,
35620        St: AsRef<str>,
35621    {
35622        self._scopes
35623            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35624        self
35625    }
35626
35627    /// Removes all scopes, and no default scope will be used either.
35628    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35629    /// for details).
35630    pub fn clear_scopes(mut self) -> ProductGetCall<'a, C> {
35631        self._scopes.clear();
35632        self
35633    }
35634}
35635
35636/// Uploads a product to your Merchant Center account. If an item with the same channel, contentLanguage, offerId, and targetCountry already exists, this method updates that entry.
35637///
35638/// A builder for the *insert* method supported by a *product* resource.
35639/// It is not used directly, but through a [`ProductMethods`] instance.
35640///
35641/// # Example
35642///
35643/// Instantiate a resource method builder
35644///
35645/// ```test_harness,no_run
35646/// # extern crate hyper;
35647/// # extern crate hyper_rustls;
35648/// # extern crate google_content2 as content2;
35649/// use content2::api::Product;
35650/// # async fn dox() {
35651/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35652///
35653/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35654/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
35655/// #     .with_native_roots()
35656/// #     .unwrap()
35657/// #     .https_only()
35658/// #     .enable_http2()
35659/// #     .build();
35660///
35661/// # let executor = hyper_util::rt::TokioExecutor::new();
35662/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
35663/// #     secret,
35664/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35665/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
35666/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
35667/// #     ),
35668/// # ).build().await.unwrap();
35669///
35670/// # let client = hyper_util::client::legacy::Client::builder(
35671/// #     hyper_util::rt::TokioExecutor::new()
35672/// # )
35673/// # .build(
35674/// #     hyper_rustls::HttpsConnectorBuilder::new()
35675/// #         .with_native_roots()
35676/// #         .unwrap()
35677/// #         .https_or_http()
35678/// #         .enable_http2()
35679/// #         .build()
35680/// # );
35681/// # let mut hub = ShoppingContent::new(client, auth);
35682/// // As the method needs a request, you would usually fill it with the desired information
35683/// // into the respective structure. Some of the parts shown here might not be applicable !
35684/// // Values shown here are possibly random and not representative !
35685/// let mut req = Product::default();
35686///
35687/// // You can configure optional parameters by calling the respective setters at will, and
35688/// // execute the final call using `doit()`.
35689/// // Values shown here are possibly random and not representative !
35690/// let result = hub.products().insert(req, 31)
35691///              .dry_run(true)
35692///              .doit().await;
35693/// # }
35694/// ```
35695pub struct ProductInsertCall<'a, C>
35696where
35697    C: 'a,
35698{
35699    hub: &'a ShoppingContent<C>,
35700    _request: Product,
35701    _merchant_id: u64,
35702    _dry_run: Option<bool>,
35703    _delegate: Option<&'a mut dyn common::Delegate>,
35704    _additional_params: HashMap<String, String>,
35705    _scopes: BTreeSet<String>,
35706}
35707
35708impl<'a, C> common::CallBuilder for ProductInsertCall<'a, C> {}
35709
35710impl<'a, C> ProductInsertCall<'a, C>
35711where
35712    C: common::Connector,
35713{
35714    /// Perform the operation you have build so far.
35715    pub async fn doit(mut self) -> common::Result<(common::Response, Product)> {
35716        use std::borrow::Cow;
35717        use std::io::{Read, Seek};
35718
35719        use common::{url::Params, ToParts};
35720        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35721
35722        let mut dd = common::DefaultDelegate;
35723        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35724        dlg.begin(common::MethodInfo {
35725            id: "content.products.insert",
35726            http_method: hyper::Method::POST,
35727        });
35728
35729        for &field in ["alt", "merchantId", "dryRun"].iter() {
35730            if self._additional_params.contains_key(field) {
35731                dlg.finished(false);
35732                return Err(common::Error::FieldClash(field));
35733            }
35734        }
35735
35736        let mut params = Params::with_capacity(5 + self._additional_params.len());
35737        params.push("merchantId", self._merchant_id.to_string());
35738        if let Some(value) = self._dry_run.as_ref() {
35739            params.push("dryRun", value.to_string());
35740        }
35741
35742        params.extend(self._additional_params.iter());
35743
35744        params.push("alt", "json");
35745        let mut url = self.hub._base_url.clone() + "{merchantId}/products";
35746        if self._scopes.is_empty() {
35747            self._scopes.insert(Scope::Full.as_ref().to_string());
35748        }
35749
35750        #[allow(clippy::single_element_loop)]
35751        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
35752            url = params.uri_replacement(url, param_name, find_this, false);
35753        }
35754        {
35755            let to_remove = ["merchantId"];
35756            params.remove_params(&to_remove);
35757        }
35758
35759        let url = params.parse_with_url(&url);
35760
35761        let mut json_mime_type = mime::APPLICATION_JSON;
35762        let mut request_value_reader = {
35763            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
35764            common::remove_json_null_values(&mut value);
35765            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
35766            serde_json::to_writer(&mut dst, &value).unwrap();
35767            dst
35768        };
35769        let request_size = request_value_reader
35770            .seek(std::io::SeekFrom::End(0))
35771            .unwrap();
35772        request_value_reader
35773            .seek(std::io::SeekFrom::Start(0))
35774            .unwrap();
35775
35776        loop {
35777            let token = match self
35778                .hub
35779                .auth
35780                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35781                .await
35782            {
35783                Ok(token) => token,
35784                Err(e) => match dlg.token(e) {
35785                    Ok(token) => token,
35786                    Err(e) => {
35787                        dlg.finished(false);
35788                        return Err(common::Error::MissingToken(e));
35789                    }
35790                },
35791            };
35792            request_value_reader
35793                .seek(std::io::SeekFrom::Start(0))
35794                .unwrap();
35795            let mut req_result = {
35796                let client = &self.hub.client;
35797                dlg.pre_request();
35798                let mut req_builder = hyper::Request::builder()
35799                    .method(hyper::Method::POST)
35800                    .uri(url.as_str())
35801                    .header(USER_AGENT, self.hub._user_agent.clone());
35802
35803                if let Some(token) = token.as_ref() {
35804                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35805                }
35806
35807                let request = req_builder
35808                    .header(CONTENT_TYPE, json_mime_type.to_string())
35809                    .header(CONTENT_LENGTH, request_size as u64)
35810                    .body(common::to_body(
35811                        request_value_reader.get_ref().clone().into(),
35812                    ));
35813
35814                client.request(request.unwrap()).await
35815            };
35816
35817            match req_result {
35818                Err(err) => {
35819                    if let common::Retry::After(d) = dlg.http_error(&err) {
35820                        sleep(d).await;
35821                        continue;
35822                    }
35823                    dlg.finished(false);
35824                    return Err(common::Error::HttpError(err));
35825                }
35826                Ok(res) => {
35827                    let (mut parts, body) = res.into_parts();
35828                    let mut body = common::Body::new(body);
35829                    if !parts.status.is_success() {
35830                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35831                        let error = serde_json::from_str(&common::to_string(&bytes));
35832                        let response = common::to_response(parts, bytes.into());
35833
35834                        if let common::Retry::After(d) =
35835                            dlg.http_failure(&response, error.as_ref().ok())
35836                        {
35837                            sleep(d).await;
35838                            continue;
35839                        }
35840
35841                        dlg.finished(false);
35842
35843                        return Err(match error {
35844                            Ok(value) => common::Error::BadRequest(value),
35845                            _ => common::Error::Failure(response),
35846                        });
35847                    }
35848                    let response = {
35849                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35850                        let encoded = common::to_string(&bytes);
35851                        match serde_json::from_str(&encoded) {
35852                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35853                            Err(error) => {
35854                                dlg.response_json_decode_error(&encoded, &error);
35855                                return Err(common::Error::JsonDecodeError(
35856                                    encoded.to_string(),
35857                                    error,
35858                                ));
35859                            }
35860                        }
35861                    };
35862
35863                    dlg.finished(true);
35864                    return Ok(response);
35865                }
35866            }
35867        }
35868    }
35869
35870    ///
35871    /// Sets the *request* property to the given value.
35872    ///
35873    /// Even though the property as already been set when instantiating this call,
35874    /// we provide this method for API completeness.
35875    pub fn request(mut self, new_value: Product) -> ProductInsertCall<'a, C> {
35876        self._request = new_value;
35877        self
35878    }
35879    /// The ID of the account that contains the product. This account cannot be a multi-client account.
35880    ///
35881    /// Sets the *merchant id* path property to the given value.
35882    ///
35883    /// Even though the property as already been set when instantiating this call,
35884    /// we provide this method for API completeness.
35885    pub fn merchant_id(mut self, new_value: u64) -> ProductInsertCall<'a, C> {
35886        self._merchant_id = new_value;
35887        self
35888    }
35889    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
35890    ///
35891    /// Sets the *dry run* query property to the given value.
35892    pub fn dry_run(mut self, new_value: bool) -> ProductInsertCall<'a, C> {
35893        self._dry_run = Some(new_value);
35894        self
35895    }
35896    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35897    /// while executing the actual API request.
35898    ///
35899    /// ````text
35900    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
35901    /// ````
35902    ///
35903    /// Sets the *delegate* property to the given value.
35904    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProductInsertCall<'a, C> {
35905        self._delegate = Some(new_value);
35906        self
35907    }
35908
35909    /// Set any additional parameter of the query string used in the request.
35910    /// It should be used to set parameters which are not yet available through their own
35911    /// setters.
35912    ///
35913    /// Please note that this method must not be used to set any of the known parameters
35914    /// which have their own setter method. If done anyway, the request will fail.
35915    ///
35916    /// # Additional Parameters
35917    ///
35918    /// * *$.xgafv* (query-string) - V1 error format.
35919    /// * *access_token* (query-string) - OAuth access token.
35920    /// * *alt* (query-string) - Data format for response.
35921    /// * *callback* (query-string) - JSONP
35922    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35923    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
35924    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35925    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35926    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
35927    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35928    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35929    pub fn param<T>(mut self, name: T, value: T) -> ProductInsertCall<'a, C>
35930    where
35931        T: AsRef<str>,
35932    {
35933        self._additional_params
35934            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35935        self
35936    }
35937
35938    /// Identifies the authorization scope for the method you are building.
35939    ///
35940    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35941    /// [`Scope::Full`].
35942    ///
35943    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35944    /// tokens for more than one scope.
35945    ///
35946    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35947    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35948    /// sufficient, a read-write scope will do as well.
35949    pub fn add_scope<St>(mut self, scope: St) -> ProductInsertCall<'a, C>
35950    where
35951        St: AsRef<str>,
35952    {
35953        self._scopes.insert(String::from(scope.as_ref()));
35954        self
35955    }
35956    /// Identifies the authorization scope(s) for the method you are building.
35957    ///
35958    /// See [`Self::add_scope()`] for details.
35959    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProductInsertCall<'a, C>
35960    where
35961        I: IntoIterator<Item = St>,
35962        St: AsRef<str>,
35963    {
35964        self._scopes
35965            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35966        self
35967    }
35968
35969    /// Removes all scopes, and no default scope will be used either.
35970    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35971    /// for details).
35972    pub fn clear_scopes(mut self) -> ProductInsertCall<'a, C> {
35973        self._scopes.clear();
35974        self
35975    }
35976}
35977
35978/// Lists the products in your Merchant Center account. The response might contain fewer items than specified by maxResults. Rely on nextPageToken to determine if there are more items to be requested.
35979///
35980/// A builder for the *list* method supported by a *product* resource.
35981/// It is not used directly, but through a [`ProductMethods`] instance.
35982///
35983/// # Example
35984///
35985/// Instantiate a resource method builder
35986///
35987/// ```test_harness,no_run
35988/// # extern crate hyper;
35989/// # extern crate hyper_rustls;
35990/// # extern crate google_content2 as content2;
35991/// # async fn dox() {
35992/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35993///
35994/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35995/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
35996/// #     .with_native_roots()
35997/// #     .unwrap()
35998/// #     .https_only()
35999/// #     .enable_http2()
36000/// #     .build();
36001///
36002/// # let executor = hyper_util::rt::TokioExecutor::new();
36003/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
36004/// #     secret,
36005/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36006/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
36007/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
36008/// #     ),
36009/// # ).build().await.unwrap();
36010///
36011/// # let client = hyper_util::client::legacy::Client::builder(
36012/// #     hyper_util::rt::TokioExecutor::new()
36013/// # )
36014/// # .build(
36015/// #     hyper_rustls::HttpsConnectorBuilder::new()
36016/// #         .with_native_roots()
36017/// #         .unwrap()
36018/// #         .https_or_http()
36019/// #         .enable_http2()
36020/// #         .build()
36021/// # );
36022/// # let mut hub = ShoppingContent::new(client, auth);
36023/// // You can configure optional parameters by calling the respective setters at will, and
36024/// // execute the final call using `doit()`.
36025/// // Values shown here are possibly random and not representative !
36026/// let result = hub.products().list(6)
36027///              .page_token("tempor")
36028///              .max_results(91)
36029///              .include_invalid_inserted_items(false)
36030///              .doit().await;
36031/// # }
36032/// ```
36033pub struct ProductListCall<'a, C>
36034where
36035    C: 'a,
36036{
36037    hub: &'a ShoppingContent<C>,
36038    _merchant_id: u64,
36039    _page_token: Option<String>,
36040    _max_results: Option<u32>,
36041    _include_invalid_inserted_items: Option<bool>,
36042    _delegate: Option<&'a mut dyn common::Delegate>,
36043    _additional_params: HashMap<String, String>,
36044    _scopes: BTreeSet<String>,
36045}
36046
36047impl<'a, C> common::CallBuilder for ProductListCall<'a, C> {}
36048
36049impl<'a, C> ProductListCall<'a, C>
36050where
36051    C: common::Connector,
36052{
36053    /// Perform the operation you have build so far.
36054    pub async fn doit(mut self) -> common::Result<(common::Response, ProductsListResponse)> {
36055        use std::borrow::Cow;
36056        use std::io::{Read, Seek};
36057
36058        use common::{url::Params, ToParts};
36059        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36060
36061        let mut dd = common::DefaultDelegate;
36062        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36063        dlg.begin(common::MethodInfo {
36064            id: "content.products.list",
36065            http_method: hyper::Method::GET,
36066        });
36067
36068        for &field in [
36069            "alt",
36070            "merchantId",
36071            "pageToken",
36072            "maxResults",
36073            "includeInvalidInsertedItems",
36074        ]
36075        .iter()
36076        {
36077            if self._additional_params.contains_key(field) {
36078                dlg.finished(false);
36079                return Err(common::Error::FieldClash(field));
36080            }
36081        }
36082
36083        let mut params = Params::with_capacity(6 + self._additional_params.len());
36084        params.push("merchantId", self._merchant_id.to_string());
36085        if let Some(value) = self._page_token.as_ref() {
36086            params.push("pageToken", value);
36087        }
36088        if let Some(value) = self._max_results.as_ref() {
36089            params.push("maxResults", value.to_string());
36090        }
36091        if let Some(value) = self._include_invalid_inserted_items.as_ref() {
36092            params.push("includeInvalidInsertedItems", value.to_string());
36093        }
36094
36095        params.extend(self._additional_params.iter());
36096
36097        params.push("alt", "json");
36098        let mut url = self.hub._base_url.clone() + "{merchantId}/products";
36099        if self._scopes.is_empty() {
36100            self._scopes.insert(Scope::Full.as_ref().to_string());
36101        }
36102
36103        #[allow(clippy::single_element_loop)]
36104        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
36105            url = params.uri_replacement(url, param_name, find_this, false);
36106        }
36107        {
36108            let to_remove = ["merchantId"];
36109            params.remove_params(&to_remove);
36110        }
36111
36112        let url = params.parse_with_url(&url);
36113
36114        loop {
36115            let token = match self
36116                .hub
36117                .auth
36118                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36119                .await
36120            {
36121                Ok(token) => token,
36122                Err(e) => match dlg.token(e) {
36123                    Ok(token) => token,
36124                    Err(e) => {
36125                        dlg.finished(false);
36126                        return Err(common::Error::MissingToken(e));
36127                    }
36128                },
36129            };
36130            let mut req_result = {
36131                let client = &self.hub.client;
36132                dlg.pre_request();
36133                let mut req_builder = hyper::Request::builder()
36134                    .method(hyper::Method::GET)
36135                    .uri(url.as_str())
36136                    .header(USER_AGENT, self.hub._user_agent.clone());
36137
36138                if let Some(token) = token.as_ref() {
36139                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36140                }
36141
36142                let request = req_builder
36143                    .header(CONTENT_LENGTH, 0_u64)
36144                    .body(common::to_body::<String>(None));
36145
36146                client.request(request.unwrap()).await
36147            };
36148
36149            match req_result {
36150                Err(err) => {
36151                    if let common::Retry::After(d) = dlg.http_error(&err) {
36152                        sleep(d).await;
36153                        continue;
36154                    }
36155                    dlg.finished(false);
36156                    return Err(common::Error::HttpError(err));
36157                }
36158                Ok(res) => {
36159                    let (mut parts, body) = res.into_parts();
36160                    let mut body = common::Body::new(body);
36161                    if !parts.status.is_success() {
36162                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36163                        let error = serde_json::from_str(&common::to_string(&bytes));
36164                        let response = common::to_response(parts, bytes.into());
36165
36166                        if let common::Retry::After(d) =
36167                            dlg.http_failure(&response, error.as_ref().ok())
36168                        {
36169                            sleep(d).await;
36170                            continue;
36171                        }
36172
36173                        dlg.finished(false);
36174
36175                        return Err(match error {
36176                            Ok(value) => common::Error::BadRequest(value),
36177                            _ => common::Error::Failure(response),
36178                        });
36179                    }
36180                    let response = {
36181                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36182                        let encoded = common::to_string(&bytes);
36183                        match serde_json::from_str(&encoded) {
36184                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36185                            Err(error) => {
36186                                dlg.response_json_decode_error(&encoded, &error);
36187                                return Err(common::Error::JsonDecodeError(
36188                                    encoded.to_string(),
36189                                    error,
36190                                ));
36191                            }
36192                        }
36193                    };
36194
36195                    dlg.finished(true);
36196                    return Ok(response);
36197                }
36198            }
36199        }
36200    }
36201
36202    /// The ID of the account that contains the products. This account cannot be a multi-client account.
36203    ///
36204    /// Sets the *merchant id* path property to the given value.
36205    ///
36206    /// Even though the property as already been set when instantiating this call,
36207    /// we provide this method for API completeness.
36208    pub fn merchant_id(mut self, new_value: u64) -> ProductListCall<'a, C> {
36209        self._merchant_id = new_value;
36210        self
36211    }
36212    /// The token returned by the previous request.
36213    ///
36214    /// Sets the *page token* query property to the given value.
36215    pub fn page_token(mut self, new_value: &str) -> ProductListCall<'a, C> {
36216        self._page_token = Some(new_value.to_string());
36217        self
36218    }
36219    /// The maximum number of products to return in the response, used for paging.
36220    ///
36221    /// Sets the *max results* query property to the given value.
36222    pub fn max_results(mut self, new_value: u32) -> ProductListCall<'a, C> {
36223        self._max_results = Some(new_value);
36224        self
36225    }
36226    /// Flag to include the invalid inserted items in the result of the list request. By default the invalid items are not shown (the default value is false).
36227    ///
36228    /// Sets the *include invalid inserted items* query property to the given value.
36229    pub fn include_invalid_inserted_items(mut self, new_value: bool) -> ProductListCall<'a, C> {
36230        self._include_invalid_inserted_items = Some(new_value);
36231        self
36232    }
36233    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36234    /// while executing the actual API request.
36235    ///
36236    /// ````text
36237    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
36238    /// ````
36239    ///
36240    /// Sets the *delegate* property to the given value.
36241    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProductListCall<'a, C> {
36242        self._delegate = Some(new_value);
36243        self
36244    }
36245
36246    /// Set any additional parameter of the query string used in the request.
36247    /// It should be used to set parameters which are not yet available through their own
36248    /// setters.
36249    ///
36250    /// Please note that this method must not be used to set any of the known parameters
36251    /// which have their own setter method. If done anyway, the request will fail.
36252    ///
36253    /// # Additional Parameters
36254    ///
36255    /// * *$.xgafv* (query-string) - V1 error format.
36256    /// * *access_token* (query-string) - OAuth access token.
36257    /// * *alt* (query-string) - Data format for response.
36258    /// * *callback* (query-string) - JSONP
36259    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36260    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
36261    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36262    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36263    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
36264    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36265    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36266    pub fn param<T>(mut self, name: T, value: T) -> ProductListCall<'a, C>
36267    where
36268        T: AsRef<str>,
36269    {
36270        self._additional_params
36271            .insert(name.as_ref().to_string(), value.as_ref().to_string());
36272        self
36273    }
36274
36275    /// Identifies the authorization scope for the method you are building.
36276    ///
36277    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36278    /// [`Scope::Full`].
36279    ///
36280    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36281    /// tokens for more than one scope.
36282    ///
36283    /// Usually there is more than one suitable scope to authorize an operation, some of which may
36284    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36285    /// sufficient, a read-write scope will do as well.
36286    pub fn add_scope<St>(mut self, scope: St) -> ProductListCall<'a, C>
36287    where
36288        St: AsRef<str>,
36289    {
36290        self._scopes.insert(String::from(scope.as_ref()));
36291        self
36292    }
36293    /// Identifies the authorization scope(s) for the method you are building.
36294    ///
36295    /// See [`Self::add_scope()`] for details.
36296    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProductListCall<'a, C>
36297    where
36298        I: IntoIterator<Item = St>,
36299        St: AsRef<str>,
36300    {
36301        self._scopes
36302            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36303        self
36304    }
36305
36306    /// Removes all scopes, and no default scope will be used either.
36307    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36308    /// for details).
36309    pub fn clear_scopes(mut self) -> ProductListCall<'a, C> {
36310        self._scopes.clear();
36311        self
36312    }
36313}
36314
36315/// Gets the statuses of multiple products in a single request.
36316///
36317/// A builder for the *custombatch* method supported by a *productstatus* resource.
36318/// It is not used directly, but through a [`ProductstatusMethods`] instance.
36319///
36320/// # Example
36321///
36322/// Instantiate a resource method builder
36323///
36324/// ```test_harness,no_run
36325/// # extern crate hyper;
36326/// # extern crate hyper_rustls;
36327/// # extern crate google_content2 as content2;
36328/// use content2::api::ProductstatusesCustomBatchRequest;
36329/// # async fn dox() {
36330/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36331///
36332/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36333/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
36334/// #     .with_native_roots()
36335/// #     .unwrap()
36336/// #     .https_only()
36337/// #     .enable_http2()
36338/// #     .build();
36339///
36340/// # let executor = hyper_util::rt::TokioExecutor::new();
36341/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
36342/// #     secret,
36343/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36344/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
36345/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
36346/// #     ),
36347/// # ).build().await.unwrap();
36348///
36349/// # let client = hyper_util::client::legacy::Client::builder(
36350/// #     hyper_util::rt::TokioExecutor::new()
36351/// # )
36352/// # .build(
36353/// #     hyper_rustls::HttpsConnectorBuilder::new()
36354/// #         .with_native_roots()
36355/// #         .unwrap()
36356/// #         .https_or_http()
36357/// #         .enable_http2()
36358/// #         .build()
36359/// # );
36360/// # let mut hub = ShoppingContent::new(client, auth);
36361/// // As the method needs a request, you would usually fill it with the desired information
36362/// // into the respective structure. Some of the parts shown here might not be applicable !
36363/// // Values shown here are possibly random and not representative !
36364/// let mut req = ProductstatusesCustomBatchRequest::default();
36365///
36366/// // You can configure optional parameters by calling the respective setters at will, and
36367/// // execute the final call using `doit()`.
36368/// // Values shown here are possibly random and not representative !
36369/// let result = hub.productstatuses().custombatch(req)
36370///              .include_attributes(true)
36371///              .doit().await;
36372/// # }
36373/// ```
36374pub struct ProductstatusCustombatchCall<'a, C>
36375where
36376    C: 'a,
36377{
36378    hub: &'a ShoppingContent<C>,
36379    _request: ProductstatusesCustomBatchRequest,
36380    _include_attributes: Option<bool>,
36381    _delegate: Option<&'a mut dyn common::Delegate>,
36382    _additional_params: HashMap<String, String>,
36383    _scopes: BTreeSet<String>,
36384}
36385
36386impl<'a, C> common::CallBuilder for ProductstatusCustombatchCall<'a, C> {}
36387
36388impl<'a, C> ProductstatusCustombatchCall<'a, C>
36389where
36390    C: common::Connector,
36391{
36392    /// Perform the operation you have build so far.
36393    pub async fn doit(
36394        mut self,
36395    ) -> common::Result<(common::Response, ProductstatusesCustomBatchResponse)> {
36396        use std::borrow::Cow;
36397        use std::io::{Read, Seek};
36398
36399        use common::{url::Params, ToParts};
36400        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36401
36402        let mut dd = common::DefaultDelegate;
36403        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36404        dlg.begin(common::MethodInfo {
36405            id: "content.productstatuses.custombatch",
36406            http_method: hyper::Method::POST,
36407        });
36408
36409        for &field in ["alt", "includeAttributes"].iter() {
36410            if self._additional_params.contains_key(field) {
36411                dlg.finished(false);
36412                return Err(common::Error::FieldClash(field));
36413            }
36414        }
36415
36416        let mut params = Params::with_capacity(4 + self._additional_params.len());
36417        if let Some(value) = self._include_attributes.as_ref() {
36418            params.push("includeAttributes", value.to_string());
36419        }
36420
36421        params.extend(self._additional_params.iter());
36422
36423        params.push("alt", "json");
36424        let mut url = self.hub._base_url.clone() + "productstatuses/batch";
36425        if self._scopes.is_empty() {
36426            self._scopes.insert(Scope::Full.as_ref().to_string());
36427        }
36428
36429        let url = params.parse_with_url(&url);
36430
36431        let mut json_mime_type = mime::APPLICATION_JSON;
36432        let mut request_value_reader = {
36433            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
36434            common::remove_json_null_values(&mut value);
36435            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
36436            serde_json::to_writer(&mut dst, &value).unwrap();
36437            dst
36438        };
36439        let request_size = request_value_reader
36440            .seek(std::io::SeekFrom::End(0))
36441            .unwrap();
36442        request_value_reader
36443            .seek(std::io::SeekFrom::Start(0))
36444            .unwrap();
36445
36446        loop {
36447            let token = match self
36448                .hub
36449                .auth
36450                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36451                .await
36452            {
36453                Ok(token) => token,
36454                Err(e) => match dlg.token(e) {
36455                    Ok(token) => token,
36456                    Err(e) => {
36457                        dlg.finished(false);
36458                        return Err(common::Error::MissingToken(e));
36459                    }
36460                },
36461            };
36462            request_value_reader
36463                .seek(std::io::SeekFrom::Start(0))
36464                .unwrap();
36465            let mut req_result = {
36466                let client = &self.hub.client;
36467                dlg.pre_request();
36468                let mut req_builder = hyper::Request::builder()
36469                    .method(hyper::Method::POST)
36470                    .uri(url.as_str())
36471                    .header(USER_AGENT, self.hub._user_agent.clone());
36472
36473                if let Some(token) = token.as_ref() {
36474                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36475                }
36476
36477                let request = req_builder
36478                    .header(CONTENT_TYPE, json_mime_type.to_string())
36479                    .header(CONTENT_LENGTH, request_size as u64)
36480                    .body(common::to_body(
36481                        request_value_reader.get_ref().clone().into(),
36482                    ));
36483
36484                client.request(request.unwrap()).await
36485            };
36486
36487            match req_result {
36488                Err(err) => {
36489                    if let common::Retry::After(d) = dlg.http_error(&err) {
36490                        sleep(d).await;
36491                        continue;
36492                    }
36493                    dlg.finished(false);
36494                    return Err(common::Error::HttpError(err));
36495                }
36496                Ok(res) => {
36497                    let (mut parts, body) = res.into_parts();
36498                    let mut body = common::Body::new(body);
36499                    if !parts.status.is_success() {
36500                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36501                        let error = serde_json::from_str(&common::to_string(&bytes));
36502                        let response = common::to_response(parts, bytes.into());
36503
36504                        if let common::Retry::After(d) =
36505                            dlg.http_failure(&response, error.as_ref().ok())
36506                        {
36507                            sleep(d).await;
36508                            continue;
36509                        }
36510
36511                        dlg.finished(false);
36512
36513                        return Err(match error {
36514                            Ok(value) => common::Error::BadRequest(value),
36515                            _ => common::Error::Failure(response),
36516                        });
36517                    }
36518                    let response = {
36519                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36520                        let encoded = common::to_string(&bytes);
36521                        match serde_json::from_str(&encoded) {
36522                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36523                            Err(error) => {
36524                                dlg.response_json_decode_error(&encoded, &error);
36525                                return Err(common::Error::JsonDecodeError(
36526                                    encoded.to_string(),
36527                                    error,
36528                                ));
36529                            }
36530                        }
36531                    };
36532
36533                    dlg.finished(true);
36534                    return Ok(response);
36535                }
36536            }
36537        }
36538    }
36539
36540    ///
36541    /// Sets the *request* property to the given value.
36542    ///
36543    /// Even though the property as already been set when instantiating this call,
36544    /// we provide this method for API completeness.
36545    pub fn request(
36546        mut self,
36547        new_value: ProductstatusesCustomBatchRequest,
36548    ) -> ProductstatusCustombatchCall<'a, C> {
36549        self._request = new_value;
36550        self
36551    }
36552    /// Flag to include full product data in the results of this request. The default value is false.
36553    ///
36554    /// Sets the *include attributes* query property to the given value.
36555    pub fn include_attributes(mut self, new_value: bool) -> ProductstatusCustombatchCall<'a, C> {
36556        self._include_attributes = Some(new_value);
36557        self
36558    }
36559    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36560    /// while executing the actual API request.
36561    ///
36562    /// ````text
36563    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
36564    /// ````
36565    ///
36566    /// Sets the *delegate* property to the given value.
36567    pub fn delegate(
36568        mut self,
36569        new_value: &'a mut dyn common::Delegate,
36570    ) -> ProductstatusCustombatchCall<'a, C> {
36571        self._delegate = Some(new_value);
36572        self
36573    }
36574
36575    /// Set any additional parameter of the query string used in the request.
36576    /// It should be used to set parameters which are not yet available through their own
36577    /// setters.
36578    ///
36579    /// Please note that this method must not be used to set any of the known parameters
36580    /// which have their own setter method. If done anyway, the request will fail.
36581    ///
36582    /// # Additional Parameters
36583    ///
36584    /// * *$.xgafv* (query-string) - V1 error format.
36585    /// * *access_token* (query-string) - OAuth access token.
36586    /// * *alt* (query-string) - Data format for response.
36587    /// * *callback* (query-string) - JSONP
36588    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36589    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
36590    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36591    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36592    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
36593    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36594    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36595    pub fn param<T>(mut self, name: T, value: T) -> ProductstatusCustombatchCall<'a, C>
36596    where
36597        T: AsRef<str>,
36598    {
36599        self._additional_params
36600            .insert(name.as_ref().to_string(), value.as_ref().to_string());
36601        self
36602    }
36603
36604    /// Identifies the authorization scope for the method you are building.
36605    ///
36606    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36607    /// [`Scope::Full`].
36608    ///
36609    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36610    /// tokens for more than one scope.
36611    ///
36612    /// Usually there is more than one suitable scope to authorize an operation, some of which may
36613    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36614    /// sufficient, a read-write scope will do as well.
36615    pub fn add_scope<St>(mut self, scope: St) -> ProductstatusCustombatchCall<'a, C>
36616    where
36617        St: AsRef<str>,
36618    {
36619        self._scopes.insert(String::from(scope.as_ref()));
36620        self
36621    }
36622    /// Identifies the authorization scope(s) for the method you are building.
36623    ///
36624    /// See [`Self::add_scope()`] for details.
36625    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProductstatusCustombatchCall<'a, C>
36626    where
36627        I: IntoIterator<Item = St>,
36628        St: AsRef<str>,
36629    {
36630        self._scopes
36631            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36632        self
36633    }
36634
36635    /// Removes all scopes, and no default scope will be used either.
36636    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36637    /// for details).
36638    pub fn clear_scopes(mut self) -> ProductstatusCustombatchCall<'a, C> {
36639        self._scopes.clear();
36640        self
36641    }
36642}
36643
36644/// Gets the status of a product from your Merchant Center account.
36645///
36646/// A builder for the *get* method supported by a *productstatus* resource.
36647/// It is not used directly, but through a [`ProductstatusMethods`] instance.
36648///
36649/// # Example
36650///
36651/// Instantiate a resource method builder
36652///
36653/// ```test_harness,no_run
36654/// # extern crate hyper;
36655/// # extern crate hyper_rustls;
36656/// # extern crate google_content2 as content2;
36657/// # async fn dox() {
36658/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36659///
36660/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36661/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
36662/// #     .with_native_roots()
36663/// #     .unwrap()
36664/// #     .https_only()
36665/// #     .enable_http2()
36666/// #     .build();
36667///
36668/// # let executor = hyper_util::rt::TokioExecutor::new();
36669/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
36670/// #     secret,
36671/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36672/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
36673/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
36674/// #     ),
36675/// # ).build().await.unwrap();
36676///
36677/// # let client = hyper_util::client::legacy::Client::builder(
36678/// #     hyper_util::rt::TokioExecutor::new()
36679/// # )
36680/// # .build(
36681/// #     hyper_rustls::HttpsConnectorBuilder::new()
36682/// #         .with_native_roots()
36683/// #         .unwrap()
36684/// #         .https_or_http()
36685/// #         .enable_http2()
36686/// #         .build()
36687/// # );
36688/// # let mut hub = ShoppingContent::new(client, auth);
36689/// // You can configure optional parameters by calling the respective setters at will, and
36690/// // execute the final call using `doit()`.
36691/// // Values shown here are possibly random and not representative !
36692/// let result = hub.productstatuses().get(68, "productId")
36693///              .include_attributes(true)
36694///              .add_destinations("At")
36695///              .doit().await;
36696/// # }
36697/// ```
36698pub struct ProductstatusGetCall<'a, C>
36699where
36700    C: 'a,
36701{
36702    hub: &'a ShoppingContent<C>,
36703    _merchant_id: u64,
36704    _product_id: String,
36705    _include_attributes: Option<bool>,
36706    _destinations: Vec<String>,
36707    _delegate: Option<&'a mut dyn common::Delegate>,
36708    _additional_params: HashMap<String, String>,
36709    _scopes: BTreeSet<String>,
36710}
36711
36712impl<'a, C> common::CallBuilder for ProductstatusGetCall<'a, C> {}
36713
36714impl<'a, C> ProductstatusGetCall<'a, C>
36715where
36716    C: common::Connector,
36717{
36718    /// Perform the operation you have build so far.
36719    pub async fn doit(mut self) -> common::Result<(common::Response, ProductStatus)> {
36720        use std::borrow::Cow;
36721        use std::io::{Read, Seek};
36722
36723        use common::{url::Params, ToParts};
36724        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36725
36726        let mut dd = common::DefaultDelegate;
36727        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36728        dlg.begin(common::MethodInfo {
36729            id: "content.productstatuses.get",
36730            http_method: hyper::Method::GET,
36731        });
36732
36733        for &field in [
36734            "alt",
36735            "merchantId",
36736            "productId",
36737            "includeAttributes",
36738            "destinations",
36739        ]
36740        .iter()
36741        {
36742            if self._additional_params.contains_key(field) {
36743                dlg.finished(false);
36744                return Err(common::Error::FieldClash(field));
36745            }
36746        }
36747
36748        let mut params = Params::with_capacity(6 + self._additional_params.len());
36749        params.push("merchantId", self._merchant_id.to_string());
36750        params.push("productId", self._product_id);
36751        if let Some(value) = self._include_attributes.as_ref() {
36752            params.push("includeAttributes", value.to_string());
36753        }
36754        if !self._destinations.is_empty() {
36755            for f in self._destinations.iter() {
36756                params.push("destinations", f);
36757            }
36758        }
36759
36760        params.extend(self._additional_params.iter());
36761
36762        params.push("alt", "json");
36763        let mut url = self.hub._base_url.clone() + "{merchantId}/productstatuses/{productId}";
36764        if self._scopes.is_empty() {
36765            self._scopes.insert(Scope::Full.as_ref().to_string());
36766        }
36767
36768        #[allow(clippy::single_element_loop)]
36769        for &(find_this, param_name) in
36770            [("{merchantId}", "merchantId"), ("{productId}", "productId")].iter()
36771        {
36772            url = params.uri_replacement(url, param_name, find_this, false);
36773        }
36774        {
36775            let to_remove = ["productId", "merchantId"];
36776            params.remove_params(&to_remove);
36777        }
36778
36779        let url = params.parse_with_url(&url);
36780
36781        loop {
36782            let token = match self
36783                .hub
36784                .auth
36785                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36786                .await
36787            {
36788                Ok(token) => token,
36789                Err(e) => match dlg.token(e) {
36790                    Ok(token) => token,
36791                    Err(e) => {
36792                        dlg.finished(false);
36793                        return Err(common::Error::MissingToken(e));
36794                    }
36795                },
36796            };
36797            let mut req_result = {
36798                let client = &self.hub.client;
36799                dlg.pre_request();
36800                let mut req_builder = hyper::Request::builder()
36801                    .method(hyper::Method::GET)
36802                    .uri(url.as_str())
36803                    .header(USER_AGENT, self.hub._user_agent.clone());
36804
36805                if let Some(token) = token.as_ref() {
36806                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36807                }
36808
36809                let request = req_builder
36810                    .header(CONTENT_LENGTH, 0_u64)
36811                    .body(common::to_body::<String>(None));
36812
36813                client.request(request.unwrap()).await
36814            };
36815
36816            match req_result {
36817                Err(err) => {
36818                    if let common::Retry::After(d) = dlg.http_error(&err) {
36819                        sleep(d).await;
36820                        continue;
36821                    }
36822                    dlg.finished(false);
36823                    return Err(common::Error::HttpError(err));
36824                }
36825                Ok(res) => {
36826                    let (mut parts, body) = res.into_parts();
36827                    let mut body = common::Body::new(body);
36828                    if !parts.status.is_success() {
36829                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36830                        let error = serde_json::from_str(&common::to_string(&bytes));
36831                        let response = common::to_response(parts, bytes.into());
36832
36833                        if let common::Retry::After(d) =
36834                            dlg.http_failure(&response, error.as_ref().ok())
36835                        {
36836                            sleep(d).await;
36837                            continue;
36838                        }
36839
36840                        dlg.finished(false);
36841
36842                        return Err(match error {
36843                            Ok(value) => common::Error::BadRequest(value),
36844                            _ => common::Error::Failure(response),
36845                        });
36846                    }
36847                    let response = {
36848                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36849                        let encoded = common::to_string(&bytes);
36850                        match serde_json::from_str(&encoded) {
36851                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36852                            Err(error) => {
36853                                dlg.response_json_decode_error(&encoded, &error);
36854                                return Err(common::Error::JsonDecodeError(
36855                                    encoded.to_string(),
36856                                    error,
36857                                ));
36858                            }
36859                        }
36860                    };
36861
36862                    dlg.finished(true);
36863                    return Ok(response);
36864                }
36865            }
36866        }
36867    }
36868
36869    /// The ID of the account that contains the product. This account cannot be a multi-client account.
36870    ///
36871    /// Sets the *merchant id* path property to the given value.
36872    ///
36873    /// Even though the property as already been set when instantiating this call,
36874    /// we provide this method for API completeness.
36875    pub fn merchant_id(mut self, new_value: u64) -> ProductstatusGetCall<'a, C> {
36876        self._merchant_id = new_value;
36877        self
36878    }
36879    /// The REST ID of the product.
36880    ///
36881    /// Sets the *product id* path property to the given value.
36882    ///
36883    /// Even though the property as already been set when instantiating this call,
36884    /// we provide this method for API completeness.
36885    pub fn product_id(mut self, new_value: &str) -> ProductstatusGetCall<'a, C> {
36886        self._product_id = new_value.to_string();
36887        self
36888    }
36889    /// Flag to include full product data in the result of this get request. The default value is false.
36890    ///
36891    /// Sets the *include attributes* query property to the given value.
36892    pub fn include_attributes(mut self, new_value: bool) -> ProductstatusGetCall<'a, C> {
36893        self._include_attributes = Some(new_value);
36894        self
36895    }
36896    /// If set, only issues for the specified destinations are returned, otherwise only issues for the Shopping destination.
36897    ///
36898    /// Append the given value to the *destinations* query property.
36899    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
36900    pub fn add_destinations(mut self, new_value: &str) -> ProductstatusGetCall<'a, C> {
36901        self._destinations.push(new_value.to_string());
36902        self
36903    }
36904    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36905    /// while executing the actual API request.
36906    ///
36907    /// ````text
36908    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
36909    /// ````
36910    ///
36911    /// Sets the *delegate* property to the given value.
36912    pub fn delegate(
36913        mut self,
36914        new_value: &'a mut dyn common::Delegate,
36915    ) -> ProductstatusGetCall<'a, C> {
36916        self._delegate = Some(new_value);
36917        self
36918    }
36919
36920    /// Set any additional parameter of the query string used in the request.
36921    /// It should be used to set parameters which are not yet available through their own
36922    /// setters.
36923    ///
36924    /// Please note that this method must not be used to set any of the known parameters
36925    /// which have their own setter method. If done anyway, the request will fail.
36926    ///
36927    /// # Additional Parameters
36928    ///
36929    /// * *$.xgafv* (query-string) - V1 error format.
36930    /// * *access_token* (query-string) - OAuth access token.
36931    /// * *alt* (query-string) - Data format for response.
36932    /// * *callback* (query-string) - JSONP
36933    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36934    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
36935    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36936    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36937    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
36938    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36939    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36940    pub fn param<T>(mut self, name: T, value: T) -> ProductstatusGetCall<'a, C>
36941    where
36942        T: AsRef<str>,
36943    {
36944        self._additional_params
36945            .insert(name.as_ref().to_string(), value.as_ref().to_string());
36946        self
36947    }
36948
36949    /// Identifies the authorization scope for the method you are building.
36950    ///
36951    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36952    /// [`Scope::Full`].
36953    ///
36954    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36955    /// tokens for more than one scope.
36956    ///
36957    /// Usually there is more than one suitable scope to authorize an operation, some of which may
36958    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36959    /// sufficient, a read-write scope will do as well.
36960    pub fn add_scope<St>(mut self, scope: St) -> ProductstatusGetCall<'a, C>
36961    where
36962        St: AsRef<str>,
36963    {
36964        self._scopes.insert(String::from(scope.as_ref()));
36965        self
36966    }
36967    /// Identifies the authorization scope(s) for the method you are building.
36968    ///
36969    /// See [`Self::add_scope()`] for details.
36970    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProductstatusGetCall<'a, C>
36971    where
36972        I: IntoIterator<Item = St>,
36973        St: AsRef<str>,
36974    {
36975        self._scopes
36976            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36977        self
36978    }
36979
36980    /// Removes all scopes, and no default scope will be used either.
36981    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36982    /// for details).
36983    pub fn clear_scopes(mut self) -> ProductstatusGetCall<'a, C> {
36984        self._scopes.clear();
36985        self
36986    }
36987}
36988
36989/// Lists the statuses of the products in your Merchant Center account.
36990///
36991/// A builder for the *list* method supported by a *productstatus* resource.
36992/// It is not used directly, but through a [`ProductstatusMethods`] instance.
36993///
36994/// # Example
36995///
36996/// Instantiate a resource method builder
36997///
36998/// ```test_harness,no_run
36999/// # extern crate hyper;
37000/// # extern crate hyper_rustls;
37001/// # extern crate google_content2 as content2;
37002/// # async fn dox() {
37003/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37004///
37005/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37006/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
37007/// #     .with_native_roots()
37008/// #     .unwrap()
37009/// #     .https_only()
37010/// #     .enable_http2()
37011/// #     .build();
37012///
37013/// # let executor = hyper_util::rt::TokioExecutor::new();
37014/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
37015/// #     secret,
37016/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37017/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
37018/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
37019/// #     ),
37020/// # ).build().await.unwrap();
37021///
37022/// # let client = hyper_util::client::legacy::Client::builder(
37023/// #     hyper_util::rt::TokioExecutor::new()
37024/// # )
37025/// # .build(
37026/// #     hyper_rustls::HttpsConnectorBuilder::new()
37027/// #         .with_native_roots()
37028/// #         .unwrap()
37029/// #         .https_or_http()
37030/// #         .enable_http2()
37031/// #         .build()
37032/// # );
37033/// # let mut hub = ShoppingContent::new(client, auth);
37034/// // You can configure optional parameters by calling the respective setters at will, and
37035/// // execute the final call using `doit()`.
37036/// // Values shown here are possibly random and not representative !
37037/// let result = hub.productstatuses().list(13)
37038///              .page_token("clita")
37039///              .max_results(86)
37040///              .include_invalid_inserted_items(false)
37041///              .include_attributes(false)
37042///              .add_destinations("dolores")
37043///              .doit().await;
37044/// # }
37045/// ```
37046pub struct ProductstatusListCall<'a, C>
37047where
37048    C: 'a,
37049{
37050    hub: &'a ShoppingContent<C>,
37051    _merchant_id: u64,
37052    _page_token: Option<String>,
37053    _max_results: Option<u32>,
37054    _include_invalid_inserted_items: Option<bool>,
37055    _include_attributes: Option<bool>,
37056    _destinations: Vec<String>,
37057    _delegate: Option<&'a mut dyn common::Delegate>,
37058    _additional_params: HashMap<String, String>,
37059    _scopes: BTreeSet<String>,
37060}
37061
37062impl<'a, C> common::CallBuilder for ProductstatusListCall<'a, C> {}
37063
37064impl<'a, C> ProductstatusListCall<'a, C>
37065where
37066    C: common::Connector,
37067{
37068    /// Perform the operation you have build so far.
37069    pub async fn doit(mut self) -> common::Result<(common::Response, ProductstatusesListResponse)> {
37070        use std::borrow::Cow;
37071        use std::io::{Read, Seek};
37072
37073        use common::{url::Params, ToParts};
37074        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37075
37076        let mut dd = common::DefaultDelegate;
37077        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37078        dlg.begin(common::MethodInfo {
37079            id: "content.productstatuses.list",
37080            http_method: hyper::Method::GET,
37081        });
37082
37083        for &field in [
37084            "alt",
37085            "merchantId",
37086            "pageToken",
37087            "maxResults",
37088            "includeInvalidInsertedItems",
37089            "includeAttributes",
37090            "destinations",
37091        ]
37092        .iter()
37093        {
37094            if self._additional_params.contains_key(field) {
37095                dlg.finished(false);
37096                return Err(common::Error::FieldClash(field));
37097            }
37098        }
37099
37100        let mut params = Params::with_capacity(8 + self._additional_params.len());
37101        params.push("merchantId", self._merchant_id.to_string());
37102        if let Some(value) = self._page_token.as_ref() {
37103            params.push("pageToken", value);
37104        }
37105        if let Some(value) = self._max_results.as_ref() {
37106            params.push("maxResults", value.to_string());
37107        }
37108        if let Some(value) = self._include_invalid_inserted_items.as_ref() {
37109            params.push("includeInvalidInsertedItems", value.to_string());
37110        }
37111        if let Some(value) = self._include_attributes.as_ref() {
37112            params.push("includeAttributes", value.to_string());
37113        }
37114        if !self._destinations.is_empty() {
37115            for f in self._destinations.iter() {
37116                params.push("destinations", f);
37117            }
37118        }
37119
37120        params.extend(self._additional_params.iter());
37121
37122        params.push("alt", "json");
37123        let mut url = self.hub._base_url.clone() + "{merchantId}/productstatuses";
37124        if self._scopes.is_empty() {
37125            self._scopes.insert(Scope::Full.as_ref().to_string());
37126        }
37127
37128        #[allow(clippy::single_element_loop)]
37129        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
37130            url = params.uri_replacement(url, param_name, find_this, false);
37131        }
37132        {
37133            let to_remove = ["merchantId"];
37134            params.remove_params(&to_remove);
37135        }
37136
37137        let url = params.parse_with_url(&url);
37138
37139        loop {
37140            let token = match self
37141                .hub
37142                .auth
37143                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37144                .await
37145            {
37146                Ok(token) => token,
37147                Err(e) => match dlg.token(e) {
37148                    Ok(token) => token,
37149                    Err(e) => {
37150                        dlg.finished(false);
37151                        return Err(common::Error::MissingToken(e));
37152                    }
37153                },
37154            };
37155            let mut req_result = {
37156                let client = &self.hub.client;
37157                dlg.pre_request();
37158                let mut req_builder = hyper::Request::builder()
37159                    .method(hyper::Method::GET)
37160                    .uri(url.as_str())
37161                    .header(USER_AGENT, self.hub._user_agent.clone());
37162
37163                if let Some(token) = token.as_ref() {
37164                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37165                }
37166
37167                let request = req_builder
37168                    .header(CONTENT_LENGTH, 0_u64)
37169                    .body(common::to_body::<String>(None));
37170
37171                client.request(request.unwrap()).await
37172            };
37173
37174            match req_result {
37175                Err(err) => {
37176                    if let common::Retry::After(d) = dlg.http_error(&err) {
37177                        sleep(d).await;
37178                        continue;
37179                    }
37180                    dlg.finished(false);
37181                    return Err(common::Error::HttpError(err));
37182                }
37183                Ok(res) => {
37184                    let (mut parts, body) = res.into_parts();
37185                    let mut body = common::Body::new(body);
37186                    if !parts.status.is_success() {
37187                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37188                        let error = serde_json::from_str(&common::to_string(&bytes));
37189                        let response = common::to_response(parts, bytes.into());
37190
37191                        if let common::Retry::After(d) =
37192                            dlg.http_failure(&response, error.as_ref().ok())
37193                        {
37194                            sleep(d).await;
37195                            continue;
37196                        }
37197
37198                        dlg.finished(false);
37199
37200                        return Err(match error {
37201                            Ok(value) => common::Error::BadRequest(value),
37202                            _ => common::Error::Failure(response),
37203                        });
37204                    }
37205                    let response = {
37206                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37207                        let encoded = common::to_string(&bytes);
37208                        match serde_json::from_str(&encoded) {
37209                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37210                            Err(error) => {
37211                                dlg.response_json_decode_error(&encoded, &error);
37212                                return Err(common::Error::JsonDecodeError(
37213                                    encoded.to_string(),
37214                                    error,
37215                                ));
37216                            }
37217                        }
37218                    };
37219
37220                    dlg.finished(true);
37221                    return Ok(response);
37222                }
37223            }
37224        }
37225    }
37226
37227    /// The ID of the account that contains the products. This account cannot be a multi-client account.
37228    ///
37229    /// Sets the *merchant id* path property to the given value.
37230    ///
37231    /// Even though the property as already been set when instantiating this call,
37232    /// we provide this method for API completeness.
37233    pub fn merchant_id(mut self, new_value: u64) -> ProductstatusListCall<'a, C> {
37234        self._merchant_id = new_value;
37235        self
37236    }
37237    /// The token returned by the previous request.
37238    ///
37239    /// Sets the *page token* query property to the given value.
37240    pub fn page_token(mut self, new_value: &str) -> ProductstatusListCall<'a, C> {
37241        self._page_token = Some(new_value.to_string());
37242        self
37243    }
37244    /// The maximum number of product statuses to return in the response, used for paging.
37245    ///
37246    /// Sets the *max results* query property to the given value.
37247    pub fn max_results(mut self, new_value: u32) -> ProductstatusListCall<'a, C> {
37248        self._max_results = Some(new_value);
37249        self
37250    }
37251    /// Flag to include the invalid inserted items in the result of the list request. By default the invalid items are not shown (the default value is false).
37252    ///
37253    /// Sets the *include invalid inserted items* query property to the given value.
37254    pub fn include_invalid_inserted_items(
37255        mut self,
37256        new_value: bool,
37257    ) -> ProductstatusListCall<'a, C> {
37258        self._include_invalid_inserted_items = Some(new_value);
37259        self
37260    }
37261    /// Flag to include full product data in the results of the list request. The default value is false.
37262    ///
37263    /// Sets the *include attributes* query property to the given value.
37264    pub fn include_attributes(mut self, new_value: bool) -> ProductstatusListCall<'a, C> {
37265        self._include_attributes = Some(new_value);
37266        self
37267    }
37268    /// If set, only issues for the specified destinations are returned, otherwise only issues for the Shopping destination.
37269    ///
37270    /// Append the given value to the *destinations* query property.
37271    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
37272    pub fn add_destinations(mut self, new_value: &str) -> ProductstatusListCall<'a, C> {
37273        self._destinations.push(new_value.to_string());
37274        self
37275    }
37276    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37277    /// while executing the actual API request.
37278    ///
37279    /// ````text
37280    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
37281    /// ````
37282    ///
37283    /// Sets the *delegate* property to the given value.
37284    pub fn delegate(
37285        mut self,
37286        new_value: &'a mut dyn common::Delegate,
37287    ) -> ProductstatusListCall<'a, C> {
37288        self._delegate = Some(new_value);
37289        self
37290    }
37291
37292    /// Set any additional parameter of the query string used in the request.
37293    /// It should be used to set parameters which are not yet available through their own
37294    /// setters.
37295    ///
37296    /// Please note that this method must not be used to set any of the known parameters
37297    /// which have their own setter method. If done anyway, the request will fail.
37298    ///
37299    /// # Additional Parameters
37300    ///
37301    /// * *$.xgafv* (query-string) - V1 error format.
37302    /// * *access_token* (query-string) - OAuth access token.
37303    /// * *alt* (query-string) - Data format for response.
37304    /// * *callback* (query-string) - JSONP
37305    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37306    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
37307    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37308    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37309    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
37310    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37311    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37312    pub fn param<T>(mut self, name: T, value: T) -> ProductstatusListCall<'a, C>
37313    where
37314        T: AsRef<str>,
37315    {
37316        self._additional_params
37317            .insert(name.as_ref().to_string(), value.as_ref().to_string());
37318        self
37319    }
37320
37321    /// Identifies the authorization scope for the method you are building.
37322    ///
37323    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37324    /// [`Scope::Full`].
37325    ///
37326    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37327    /// tokens for more than one scope.
37328    ///
37329    /// Usually there is more than one suitable scope to authorize an operation, some of which may
37330    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37331    /// sufficient, a read-write scope will do as well.
37332    pub fn add_scope<St>(mut self, scope: St) -> ProductstatusListCall<'a, C>
37333    where
37334        St: AsRef<str>,
37335    {
37336        self._scopes.insert(String::from(scope.as_ref()));
37337        self
37338    }
37339    /// Identifies the authorization scope(s) for the method you are building.
37340    ///
37341    /// See [`Self::add_scope()`] for details.
37342    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProductstatusListCall<'a, C>
37343    where
37344        I: IntoIterator<Item = St>,
37345        St: AsRef<str>,
37346    {
37347        self._scopes
37348            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37349        self
37350    }
37351
37352    /// Removes all scopes, and no default scope will be used either.
37353    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37354    /// for details).
37355    pub fn clear_scopes(mut self) -> ProductstatusListCall<'a, C> {
37356        self._scopes.clear();
37357        self
37358    }
37359}
37360
37361/// Retrieves and updates the shipping settings of multiple accounts in a single request.
37362///
37363/// A builder for the *custombatch* method supported by a *shippingsetting* resource.
37364/// It is not used directly, but through a [`ShippingsettingMethods`] instance.
37365///
37366/// # Example
37367///
37368/// Instantiate a resource method builder
37369///
37370/// ```test_harness,no_run
37371/// # extern crate hyper;
37372/// # extern crate hyper_rustls;
37373/// # extern crate google_content2 as content2;
37374/// use content2::api::ShippingsettingsCustomBatchRequest;
37375/// # async fn dox() {
37376/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37377///
37378/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37379/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
37380/// #     .with_native_roots()
37381/// #     .unwrap()
37382/// #     .https_only()
37383/// #     .enable_http2()
37384/// #     .build();
37385///
37386/// # let executor = hyper_util::rt::TokioExecutor::new();
37387/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
37388/// #     secret,
37389/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37390/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
37391/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
37392/// #     ),
37393/// # ).build().await.unwrap();
37394///
37395/// # let client = hyper_util::client::legacy::Client::builder(
37396/// #     hyper_util::rt::TokioExecutor::new()
37397/// # )
37398/// # .build(
37399/// #     hyper_rustls::HttpsConnectorBuilder::new()
37400/// #         .with_native_roots()
37401/// #         .unwrap()
37402/// #         .https_or_http()
37403/// #         .enable_http2()
37404/// #         .build()
37405/// # );
37406/// # let mut hub = ShoppingContent::new(client, auth);
37407/// // As the method needs a request, you would usually fill it with the desired information
37408/// // into the respective structure. Some of the parts shown here might not be applicable !
37409/// // Values shown here are possibly random and not representative !
37410/// let mut req = ShippingsettingsCustomBatchRequest::default();
37411///
37412/// // You can configure optional parameters by calling the respective setters at will, and
37413/// // execute the final call using `doit()`.
37414/// // Values shown here are possibly random and not representative !
37415/// let result = hub.shippingsettings().custombatch(req)
37416///              .dry_run(true)
37417///              .doit().await;
37418/// # }
37419/// ```
37420pub struct ShippingsettingCustombatchCall<'a, C>
37421where
37422    C: 'a,
37423{
37424    hub: &'a ShoppingContent<C>,
37425    _request: ShippingsettingsCustomBatchRequest,
37426    _dry_run: Option<bool>,
37427    _delegate: Option<&'a mut dyn common::Delegate>,
37428    _additional_params: HashMap<String, String>,
37429    _scopes: BTreeSet<String>,
37430}
37431
37432impl<'a, C> common::CallBuilder for ShippingsettingCustombatchCall<'a, C> {}
37433
37434impl<'a, C> ShippingsettingCustombatchCall<'a, C>
37435where
37436    C: common::Connector,
37437{
37438    /// Perform the operation you have build so far.
37439    pub async fn doit(
37440        mut self,
37441    ) -> common::Result<(common::Response, ShippingsettingsCustomBatchResponse)> {
37442        use std::borrow::Cow;
37443        use std::io::{Read, Seek};
37444
37445        use common::{url::Params, ToParts};
37446        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37447
37448        let mut dd = common::DefaultDelegate;
37449        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37450        dlg.begin(common::MethodInfo {
37451            id: "content.shippingsettings.custombatch",
37452            http_method: hyper::Method::POST,
37453        });
37454
37455        for &field in ["alt", "dryRun"].iter() {
37456            if self._additional_params.contains_key(field) {
37457                dlg.finished(false);
37458                return Err(common::Error::FieldClash(field));
37459            }
37460        }
37461
37462        let mut params = Params::with_capacity(4 + self._additional_params.len());
37463        if let Some(value) = self._dry_run.as_ref() {
37464            params.push("dryRun", value.to_string());
37465        }
37466
37467        params.extend(self._additional_params.iter());
37468
37469        params.push("alt", "json");
37470        let mut url = self.hub._base_url.clone() + "shippingsettings/batch";
37471        if self._scopes.is_empty() {
37472            self._scopes.insert(Scope::Full.as_ref().to_string());
37473        }
37474
37475        let url = params.parse_with_url(&url);
37476
37477        let mut json_mime_type = mime::APPLICATION_JSON;
37478        let mut request_value_reader = {
37479            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
37480            common::remove_json_null_values(&mut value);
37481            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
37482            serde_json::to_writer(&mut dst, &value).unwrap();
37483            dst
37484        };
37485        let request_size = request_value_reader
37486            .seek(std::io::SeekFrom::End(0))
37487            .unwrap();
37488        request_value_reader
37489            .seek(std::io::SeekFrom::Start(0))
37490            .unwrap();
37491
37492        loop {
37493            let token = match self
37494                .hub
37495                .auth
37496                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37497                .await
37498            {
37499                Ok(token) => token,
37500                Err(e) => match dlg.token(e) {
37501                    Ok(token) => token,
37502                    Err(e) => {
37503                        dlg.finished(false);
37504                        return Err(common::Error::MissingToken(e));
37505                    }
37506                },
37507            };
37508            request_value_reader
37509                .seek(std::io::SeekFrom::Start(0))
37510                .unwrap();
37511            let mut req_result = {
37512                let client = &self.hub.client;
37513                dlg.pre_request();
37514                let mut req_builder = hyper::Request::builder()
37515                    .method(hyper::Method::POST)
37516                    .uri(url.as_str())
37517                    .header(USER_AGENT, self.hub._user_agent.clone());
37518
37519                if let Some(token) = token.as_ref() {
37520                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37521                }
37522
37523                let request = req_builder
37524                    .header(CONTENT_TYPE, json_mime_type.to_string())
37525                    .header(CONTENT_LENGTH, request_size as u64)
37526                    .body(common::to_body(
37527                        request_value_reader.get_ref().clone().into(),
37528                    ));
37529
37530                client.request(request.unwrap()).await
37531            };
37532
37533            match req_result {
37534                Err(err) => {
37535                    if let common::Retry::After(d) = dlg.http_error(&err) {
37536                        sleep(d).await;
37537                        continue;
37538                    }
37539                    dlg.finished(false);
37540                    return Err(common::Error::HttpError(err));
37541                }
37542                Ok(res) => {
37543                    let (mut parts, body) = res.into_parts();
37544                    let mut body = common::Body::new(body);
37545                    if !parts.status.is_success() {
37546                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37547                        let error = serde_json::from_str(&common::to_string(&bytes));
37548                        let response = common::to_response(parts, bytes.into());
37549
37550                        if let common::Retry::After(d) =
37551                            dlg.http_failure(&response, error.as_ref().ok())
37552                        {
37553                            sleep(d).await;
37554                            continue;
37555                        }
37556
37557                        dlg.finished(false);
37558
37559                        return Err(match error {
37560                            Ok(value) => common::Error::BadRequest(value),
37561                            _ => common::Error::Failure(response),
37562                        });
37563                    }
37564                    let response = {
37565                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37566                        let encoded = common::to_string(&bytes);
37567                        match serde_json::from_str(&encoded) {
37568                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37569                            Err(error) => {
37570                                dlg.response_json_decode_error(&encoded, &error);
37571                                return Err(common::Error::JsonDecodeError(
37572                                    encoded.to_string(),
37573                                    error,
37574                                ));
37575                            }
37576                        }
37577                    };
37578
37579                    dlg.finished(true);
37580                    return Ok(response);
37581                }
37582            }
37583        }
37584    }
37585
37586    ///
37587    /// Sets the *request* property to the given value.
37588    ///
37589    /// Even though the property as already been set when instantiating this call,
37590    /// we provide this method for API completeness.
37591    pub fn request(
37592        mut self,
37593        new_value: ShippingsettingsCustomBatchRequest,
37594    ) -> ShippingsettingCustombatchCall<'a, C> {
37595        self._request = new_value;
37596        self
37597    }
37598    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
37599    ///
37600    /// Sets the *dry run* query property to the given value.
37601    pub fn dry_run(mut self, new_value: bool) -> ShippingsettingCustombatchCall<'a, C> {
37602        self._dry_run = Some(new_value);
37603        self
37604    }
37605    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37606    /// while executing the actual API request.
37607    ///
37608    /// ````text
37609    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
37610    /// ````
37611    ///
37612    /// Sets the *delegate* property to the given value.
37613    pub fn delegate(
37614        mut self,
37615        new_value: &'a mut dyn common::Delegate,
37616    ) -> ShippingsettingCustombatchCall<'a, C> {
37617        self._delegate = Some(new_value);
37618        self
37619    }
37620
37621    /// Set any additional parameter of the query string used in the request.
37622    /// It should be used to set parameters which are not yet available through their own
37623    /// setters.
37624    ///
37625    /// Please note that this method must not be used to set any of the known parameters
37626    /// which have their own setter method. If done anyway, the request will fail.
37627    ///
37628    /// # Additional Parameters
37629    ///
37630    /// * *$.xgafv* (query-string) - V1 error format.
37631    /// * *access_token* (query-string) - OAuth access token.
37632    /// * *alt* (query-string) - Data format for response.
37633    /// * *callback* (query-string) - JSONP
37634    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37635    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
37636    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37637    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37638    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
37639    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37640    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37641    pub fn param<T>(mut self, name: T, value: T) -> ShippingsettingCustombatchCall<'a, C>
37642    where
37643        T: AsRef<str>,
37644    {
37645        self._additional_params
37646            .insert(name.as_ref().to_string(), value.as_ref().to_string());
37647        self
37648    }
37649
37650    /// Identifies the authorization scope for the method you are building.
37651    ///
37652    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37653    /// [`Scope::Full`].
37654    ///
37655    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37656    /// tokens for more than one scope.
37657    ///
37658    /// Usually there is more than one suitable scope to authorize an operation, some of which may
37659    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37660    /// sufficient, a read-write scope will do as well.
37661    pub fn add_scope<St>(mut self, scope: St) -> ShippingsettingCustombatchCall<'a, C>
37662    where
37663        St: AsRef<str>,
37664    {
37665        self._scopes.insert(String::from(scope.as_ref()));
37666        self
37667    }
37668    /// Identifies the authorization scope(s) for the method you are building.
37669    ///
37670    /// See [`Self::add_scope()`] for details.
37671    pub fn add_scopes<I, St>(mut self, scopes: I) -> ShippingsettingCustombatchCall<'a, C>
37672    where
37673        I: IntoIterator<Item = St>,
37674        St: AsRef<str>,
37675    {
37676        self._scopes
37677            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37678        self
37679    }
37680
37681    /// Removes all scopes, and no default scope will be used either.
37682    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37683    /// for details).
37684    pub fn clear_scopes(mut self) -> ShippingsettingCustombatchCall<'a, C> {
37685        self._scopes.clear();
37686        self
37687    }
37688}
37689
37690/// Retrieves the shipping settings of the account.
37691///
37692/// A builder for the *get* method supported by a *shippingsetting* resource.
37693/// It is not used directly, but through a [`ShippingsettingMethods`] instance.
37694///
37695/// # Example
37696///
37697/// Instantiate a resource method builder
37698///
37699/// ```test_harness,no_run
37700/// # extern crate hyper;
37701/// # extern crate hyper_rustls;
37702/// # extern crate google_content2 as content2;
37703/// # async fn dox() {
37704/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37705///
37706/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37707/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
37708/// #     .with_native_roots()
37709/// #     .unwrap()
37710/// #     .https_only()
37711/// #     .enable_http2()
37712/// #     .build();
37713///
37714/// # let executor = hyper_util::rt::TokioExecutor::new();
37715/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
37716/// #     secret,
37717/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37718/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
37719/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
37720/// #     ),
37721/// # ).build().await.unwrap();
37722///
37723/// # let client = hyper_util::client::legacy::Client::builder(
37724/// #     hyper_util::rt::TokioExecutor::new()
37725/// # )
37726/// # .build(
37727/// #     hyper_rustls::HttpsConnectorBuilder::new()
37728/// #         .with_native_roots()
37729/// #         .unwrap()
37730/// #         .https_or_http()
37731/// #         .enable_http2()
37732/// #         .build()
37733/// # );
37734/// # let mut hub = ShoppingContent::new(client, auth);
37735/// // You can configure optional parameters by calling the respective setters at will, and
37736/// // execute the final call using `doit()`.
37737/// // Values shown here are possibly random and not representative !
37738/// let result = hub.shippingsettings().get(37, 2)
37739///              .doit().await;
37740/// # }
37741/// ```
37742pub struct ShippingsettingGetCall<'a, C>
37743where
37744    C: 'a,
37745{
37746    hub: &'a ShoppingContent<C>,
37747    _merchant_id: u64,
37748    _account_id: u64,
37749    _delegate: Option<&'a mut dyn common::Delegate>,
37750    _additional_params: HashMap<String, String>,
37751    _scopes: BTreeSet<String>,
37752}
37753
37754impl<'a, C> common::CallBuilder for ShippingsettingGetCall<'a, C> {}
37755
37756impl<'a, C> ShippingsettingGetCall<'a, C>
37757where
37758    C: common::Connector,
37759{
37760    /// Perform the operation you have build so far.
37761    pub async fn doit(mut self) -> common::Result<(common::Response, ShippingSettings)> {
37762        use std::borrow::Cow;
37763        use std::io::{Read, Seek};
37764
37765        use common::{url::Params, ToParts};
37766        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37767
37768        let mut dd = common::DefaultDelegate;
37769        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37770        dlg.begin(common::MethodInfo {
37771            id: "content.shippingsettings.get",
37772            http_method: hyper::Method::GET,
37773        });
37774
37775        for &field in ["alt", "merchantId", "accountId"].iter() {
37776            if self._additional_params.contains_key(field) {
37777                dlg.finished(false);
37778                return Err(common::Error::FieldClash(field));
37779            }
37780        }
37781
37782        let mut params = Params::with_capacity(4 + self._additional_params.len());
37783        params.push("merchantId", self._merchant_id.to_string());
37784        params.push("accountId", self._account_id.to_string());
37785
37786        params.extend(self._additional_params.iter());
37787
37788        params.push("alt", "json");
37789        let mut url = self.hub._base_url.clone() + "{merchantId}/shippingsettings/{accountId}";
37790        if self._scopes.is_empty() {
37791            self._scopes.insert(Scope::Full.as_ref().to_string());
37792        }
37793
37794        #[allow(clippy::single_element_loop)]
37795        for &(find_this, param_name) in
37796            [("{merchantId}", "merchantId"), ("{accountId}", "accountId")].iter()
37797        {
37798            url = params.uri_replacement(url, param_name, find_this, false);
37799        }
37800        {
37801            let to_remove = ["accountId", "merchantId"];
37802            params.remove_params(&to_remove);
37803        }
37804
37805        let url = params.parse_with_url(&url);
37806
37807        loop {
37808            let token = match self
37809                .hub
37810                .auth
37811                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37812                .await
37813            {
37814                Ok(token) => token,
37815                Err(e) => match dlg.token(e) {
37816                    Ok(token) => token,
37817                    Err(e) => {
37818                        dlg.finished(false);
37819                        return Err(common::Error::MissingToken(e));
37820                    }
37821                },
37822            };
37823            let mut req_result = {
37824                let client = &self.hub.client;
37825                dlg.pre_request();
37826                let mut req_builder = hyper::Request::builder()
37827                    .method(hyper::Method::GET)
37828                    .uri(url.as_str())
37829                    .header(USER_AGENT, self.hub._user_agent.clone());
37830
37831                if let Some(token) = token.as_ref() {
37832                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37833                }
37834
37835                let request = req_builder
37836                    .header(CONTENT_LENGTH, 0_u64)
37837                    .body(common::to_body::<String>(None));
37838
37839                client.request(request.unwrap()).await
37840            };
37841
37842            match req_result {
37843                Err(err) => {
37844                    if let common::Retry::After(d) = dlg.http_error(&err) {
37845                        sleep(d).await;
37846                        continue;
37847                    }
37848                    dlg.finished(false);
37849                    return Err(common::Error::HttpError(err));
37850                }
37851                Ok(res) => {
37852                    let (mut parts, body) = res.into_parts();
37853                    let mut body = common::Body::new(body);
37854                    if !parts.status.is_success() {
37855                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37856                        let error = serde_json::from_str(&common::to_string(&bytes));
37857                        let response = common::to_response(parts, bytes.into());
37858
37859                        if let common::Retry::After(d) =
37860                            dlg.http_failure(&response, error.as_ref().ok())
37861                        {
37862                            sleep(d).await;
37863                            continue;
37864                        }
37865
37866                        dlg.finished(false);
37867
37868                        return Err(match error {
37869                            Ok(value) => common::Error::BadRequest(value),
37870                            _ => common::Error::Failure(response),
37871                        });
37872                    }
37873                    let response = {
37874                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37875                        let encoded = common::to_string(&bytes);
37876                        match serde_json::from_str(&encoded) {
37877                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37878                            Err(error) => {
37879                                dlg.response_json_decode_error(&encoded, &error);
37880                                return Err(common::Error::JsonDecodeError(
37881                                    encoded.to_string(),
37882                                    error,
37883                                ));
37884                            }
37885                        }
37886                    };
37887
37888                    dlg.finished(true);
37889                    return Ok(response);
37890                }
37891            }
37892        }
37893    }
37894
37895    /// The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
37896    ///
37897    /// Sets the *merchant id* path property to the given value.
37898    ///
37899    /// Even though the property as already been set when instantiating this call,
37900    /// we provide this method for API completeness.
37901    pub fn merchant_id(mut self, new_value: u64) -> ShippingsettingGetCall<'a, C> {
37902        self._merchant_id = new_value;
37903        self
37904    }
37905    /// The ID of the account for which to get/update shipping settings.
37906    ///
37907    /// Sets the *account id* path property to the given value.
37908    ///
37909    /// Even though the property as already been set when instantiating this call,
37910    /// we provide this method for API completeness.
37911    pub fn account_id(mut self, new_value: u64) -> ShippingsettingGetCall<'a, C> {
37912        self._account_id = new_value;
37913        self
37914    }
37915    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37916    /// while executing the actual API request.
37917    ///
37918    /// ````text
37919    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
37920    /// ````
37921    ///
37922    /// Sets the *delegate* property to the given value.
37923    pub fn delegate(
37924        mut self,
37925        new_value: &'a mut dyn common::Delegate,
37926    ) -> ShippingsettingGetCall<'a, C> {
37927        self._delegate = Some(new_value);
37928        self
37929    }
37930
37931    /// Set any additional parameter of the query string used in the request.
37932    /// It should be used to set parameters which are not yet available through their own
37933    /// setters.
37934    ///
37935    /// Please note that this method must not be used to set any of the known parameters
37936    /// which have their own setter method. If done anyway, the request will fail.
37937    ///
37938    /// # Additional Parameters
37939    ///
37940    /// * *$.xgafv* (query-string) - V1 error format.
37941    /// * *access_token* (query-string) - OAuth access token.
37942    /// * *alt* (query-string) - Data format for response.
37943    /// * *callback* (query-string) - JSONP
37944    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37945    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
37946    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37947    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37948    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
37949    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37950    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37951    pub fn param<T>(mut self, name: T, value: T) -> ShippingsettingGetCall<'a, C>
37952    where
37953        T: AsRef<str>,
37954    {
37955        self._additional_params
37956            .insert(name.as_ref().to_string(), value.as_ref().to_string());
37957        self
37958    }
37959
37960    /// Identifies the authorization scope for the method you are building.
37961    ///
37962    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37963    /// [`Scope::Full`].
37964    ///
37965    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37966    /// tokens for more than one scope.
37967    ///
37968    /// Usually there is more than one suitable scope to authorize an operation, some of which may
37969    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37970    /// sufficient, a read-write scope will do as well.
37971    pub fn add_scope<St>(mut self, scope: St) -> ShippingsettingGetCall<'a, C>
37972    where
37973        St: AsRef<str>,
37974    {
37975        self._scopes.insert(String::from(scope.as_ref()));
37976        self
37977    }
37978    /// Identifies the authorization scope(s) for the method you are building.
37979    ///
37980    /// See [`Self::add_scope()`] for details.
37981    pub fn add_scopes<I, St>(mut self, scopes: I) -> ShippingsettingGetCall<'a, C>
37982    where
37983        I: IntoIterator<Item = St>,
37984        St: AsRef<str>,
37985    {
37986        self._scopes
37987            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37988        self
37989    }
37990
37991    /// Removes all scopes, and no default scope will be used either.
37992    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37993    /// for details).
37994    pub fn clear_scopes(mut self) -> ShippingsettingGetCall<'a, C> {
37995        self._scopes.clear();
37996        self
37997    }
37998}
37999
38000/// Retrieves supported carriers and carrier services for an account.
38001///
38002/// A builder for the *getsupportedcarriers* method supported by a *shippingsetting* resource.
38003/// It is not used directly, but through a [`ShippingsettingMethods`] instance.
38004///
38005/// # Example
38006///
38007/// Instantiate a resource method builder
38008///
38009/// ```test_harness,no_run
38010/// # extern crate hyper;
38011/// # extern crate hyper_rustls;
38012/// # extern crate google_content2 as content2;
38013/// # async fn dox() {
38014/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
38015///
38016/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
38017/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
38018/// #     .with_native_roots()
38019/// #     .unwrap()
38020/// #     .https_only()
38021/// #     .enable_http2()
38022/// #     .build();
38023///
38024/// # let executor = hyper_util::rt::TokioExecutor::new();
38025/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
38026/// #     secret,
38027/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
38028/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
38029/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
38030/// #     ),
38031/// # ).build().await.unwrap();
38032///
38033/// # let client = hyper_util::client::legacy::Client::builder(
38034/// #     hyper_util::rt::TokioExecutor::new()
38035/// # )
38036/// # .build(
38037/// #     hyper_rustls::HttpsConnectorBuilder::new()
38038/// #         .with_native_roots()
38039/// #         .unwrap()
38040/// #         .https_or_http()
38041/// #         .enable_http2()
38042/// #         .build()
38043/// # );
38044/// # let mut hub = ShoppingContent::new(client, auth);
38045/// // You can configure optional parameters by calling the respective setters at will, and
38046/// // execute the final call using `doit()`.
38047/// // Values shown here are possibly random and not representative !
38048/// let result = hub.shippingsettings().getsupportedcarriers(19)
38049///              .doit().await;
38050/// # }
38051/// ```
38052pub struct ShippingsettingGetsupportedcarrierCall<'a, C>
38053where
38054    C: 'a,
38055{
38056    hub: &'a ShoppingContent<C>,
38057    _merchant_id: u64,
38058    _delegate: Option<&'a mut dyn common::Delegate>,
38059    _additional_params: HashMap<String, String>,
38060    _scopes: BTreeSet<String>,
38061}
38062
38063impl<'a, C> common::CallBuilder for ShippingsettingGetsupportedcarrierCall<'a, C> {}
38064
38065impl<'a, C> ShippingsettingGetsupportedcarrierCall<'a, C>
38066where
38067    C: common::Connector,
38068{
38069    /// Perform the operation you have build so far.
38070    pub async fn doit(
38071        mut self,
38072    ) -> common::Result<(
38073        common::Response,
38074        ShippingsettingsGetSupportedCarriersResponse,
38075    )> {
38076        use std::borrow::Cow;
38077        use std::io::{Read, Seek};
38078
38079        use common::{url::Params, ToParts};
38080        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
38081
38082        let mut dd = common::DefaultDelegate;
38083        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
38084        dlg.begin(common::MethodInfo {
38085            id: "content.shippingsettings.getsupportedcarriers",
38086            http_method: hyper::Method::GET,
38087        });
38088
38089        for &field in ["alt", "merchantId"].iter() {
38090            if self._additional_params.contains_key(field) {
38091                dlg.finished(false);
38092                return Err(common::Error::FieldClash(field));
38093            }
38094        }
38095
38096        let mut params = Params::with_capacity(3 + self._additional_params.len());
38097        params.push("merchantId", self._merchant_id.to_string());
38098
38099        params.extend(self._additional_params.iter());
38100
38101        params.push("alt", "json");
38102        let mut url = self.hub._base_url.clone() + "{merchantId}/supportedCarriers";
38103        if self._scopes.is_empty() {
38104            self._scopes.insert(Scope::Full.as_ref().to_string());
38105        }
38106
38107        #[allow(clippy::single_element_loop)]
38108        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
38109            url = params.uri_replacement(url, param_name, find_this, false);
38110        }
38111        {
38112            let to_remove = ["merchantId"];
38113            params.remove_params(&to_remove);
38114        }
38115
38116        let url = params.parse_with_url(&url);
38117
38118        loop {
38119            let token = match self
38120                .hub
38121                .auth
38122                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
38123                .await
38124            {
38125                Ok(token) => token,
38126                Err(e) => match dlg.token(e) {
38127                    Ok(token) => token,
38128                    Err(e) => {
38129                        dlg.finished(false);
38130                        return Err(common::Error::MissingToken(e));
38131                    }
38132                },
38133            };
38134            let mut req_result = {
38135                let client = &self.hub.client;
38136                dlg.pre_request();
38137                let mut req_builder = hyper::Request::builder()
38138                    .method(hyper::Method::GET)
38139                    .uri(url.as_str())
38140                    .header(USER_AGENT, self.hub._user_agent.clone());
38141
38142                if let Some(token) = token.as_ref() {
38143                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
38144                }
38145
38146                let request = req_builder
38147                    .header(CONTENT_LENGTH, 0_u64)
38148                    .body(common::to_body::<String>(None));
38149
38150                client.request(request.unwrap()).await
38151            };
38152
38153            match req_result {
38154                Err(err) => {
38155                    if let common::Retry::After(d) = dlg.http_error(&err) {
38156                        sleep(d).await;
38157                        continue;
38158                    }
38159                    dlg.finished(false);
38160                    return Err(common::Error::HttpError(err));
38161                }
38162                Ok(res) => {
38163                    let (mut parts, body) = res.into_parts();
38164                    let mut body = common::Body::new(body);
38165                    if !parts.status.is_success() {
38166                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38167                        let error = serde_json::from_str(&common::to_string(&bytes));
38168                        let response = common::to_response(parts, bytes.into());
38169
38170                        if let common::Retry::After(d) =
38171                            dlg.http_failure(&response, error.as_ref().ok())
38172                        {
38173                            sleep(d).await;
38174                            continue;
38175                        }
38176
38177                        dlg.finished(false);
38178
38179                        return Err(match error {
38180                            Ok(value) => common::Error::BadRequest(value),
38181                            _ => common::Error::Failure(response),
38182                        });
38183                    }
38184                    let response = {
38185                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38186                        let encoded = common::to_string(&bytes);
38187                        match serde_json::from_str(&encoded) {
38188                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
38189                            Err(error) => {
38190                                dlg.response_json_decode_error(&encoded, &error);
38191                                return Err(common::Error::JsonDecodeError(
38192                                    encoded.to_string(),
38193                                    error,
38194                                ));
38195                            }
38196                        }
38197                    };
38198
38199                    dlg.finished(true);
38200                    return Ok(response);
38201                }
38202            }
38203        }
38204    }
38205
38206    /// The ID of the account for which to retrieve the supported carriers.
38207    ///
38208    /// Sets the *merchant id* path property to the given value.
38209    ///
38210    /// Even though the property as already been set when instantiating this call,
38211    /// we provide this method for API completeness.
38212    pub fn merchant_id(mut self, new_value: u64) -> ShippingsettingGetsupportedcarrierCall<'a, C> {
38213        self._merchant_id = new_value;
38214        self
38215    }
38216    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38217    /// while executing the actual API request.
38218    ///
38219    /// ````text
38220    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
38221    /// ````
38222    ///
38223    /// Sets the *delegate* property to the given value.
38224    pub fn delegate(
38225        mut self,
38226        new_value: &'a mut dyn common::Delegate,
38227    ) -> ShippingsettingGetsupportedcarrierCall<'a, C> {
38228        self._delegate = Some(new_value);
38229        self
38230    }
38231
38232    /// Set any additional parameter of the query string used in the request.
38233    /// It should be used to set parameters which are not yet available through their own
38234    /// setters.
38235    ///
38236    /// Please note that this method must not be used to set any of the known parameters
38237    /// which have their own setter method. If done anyway, the request will fail.
38238    ///
38239    /// # Additional Parameters
38240    ///
38241    /// * *$.xgafv* (query-string) - V1 error format.
38242    /// * *access_token* (query-string) - OAuth access token.
38243    /// * *alt* (query-string) - Data format for response.
38244    /// * *callback* (query-string) - JSONP
38245    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38246    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
38247    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38248    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38249    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
38250    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38251    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38252    pub fn param<T>(mut self, name: T, value: T) -> ShippingsettingGetsupportedcarrierCall<'a, C>
38253    where
38254        T: AsRef<str>,
38255    {
38256        self._additional_params
38257            .insert(name.as_ref().to_string(), value.as_ref().to_string());
38258        self
38259    }
38260
38261    /// Identifies the authorization scope for the method you are building.
38262    ///
38263    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38264    /// [`Scope::Full`].
38265    ///
38266    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38267    /// tokens for more than one scope.
38268    ///
38269    /// Usually there is more than one suitable scope to authorize an operation, some of which may
38270    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38271    /// sufficient, a read-write scope will do as well.
38272    pub fn add_scope<St>(mut self, scope: St) -> ShippingsettingGetsupportedcarrierCall<'a, C>
38273    where
38274        St: AsRef<str>,
38275    {
38276        self._scopes.insert(String::from(scope.as_ref()));
38277        self
38278    }
38279    /// Identifies the authorization scope(s) for the method you are building.
38280    ///
38281    /// See [`Self::add_scope()`] for details.
38282    pub fn add_scopes<I, St>(mut self, scopes: I) -> ShippingsettingGetsupportedcarrierCall<'a, C>
38283    where
38284        I: IntoIterator<Item = St>,
38285        St: AsRef<str>,
38286    {
38287        self._scopes
38288            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38289        self
38290    }
38291
38292    /// Removes all scopes, and no default scope will be used either.
38293    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38294    /// for details).
38295    pub fn clear_scopes(mut self) -> ShippingsettingGetsupportedcarrierCall<'a, C> {
38296        self._scopes.clear();
38297        self
38298    }
38299}
38300
38301/// Retrieves supported holidays for an account.
38302///
38303/// A builder for the *getsupportedholidays* method supported by a *shippingsetting* resource.
38304/// It is not used directly, but through a [`ShippingsettingMethods`] instance.
38305///
38306/// # Example
38307///
38308/// Instantiate a resource method builder
38309///
38310/// ```test_harness,no_run
38311/// # extern crate hyper;
38312/// # extern crate hyper_rustls;
38313/// # extern crate google_content2 as content2;
38314/// # async fn dox() {
38315/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
38316///
38317/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
38318/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
38319/// #     .with_native_roots()
38320/// #     .unwrap()
38321/// #     .https_only()
38322/// #     .enable_http2()
38323/// #     .build();
38324///
38325/// # let executor = hyper_util::rt::TokioExecutor::new();
38326/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
38327/// #     secret,
38328/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
38329/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
38330/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
38331/// #     ),
38332/// # ).build().await.unwrap();
38333///
38334/// # let client = hyper_util::client::legacy::Client::builder(
38335/// #     hyper_util::rt::TokioExecutor::new()
38336/// # )
38337/// # .build(
38338/// #     hyper_rustls::HttpsConnectorBuilder::new()
38339/// #         .with_native_roots()
38340/// #         .unwrap()
38341/// #         .https_or_http()
38342/// #         .enable_http2()
38343/// #         .build()
38344/// # );
38345/// # let mut hub = ShoppingContent::new(client, auth);
38346/// // You can configure optional parameters by calling the respective setters at will, and
38347/// // execute the final call using `doit()`.
38348/// // Values shown here are possibly random and not representative !
38349/// let result = hub.shippingsettings().getsupportedholidays(18)
38350///              .doit().await;
38351/// # }
38352/// ```
38353pub struct ShippingsettingGetsupportedholidayCall<'a, C>
38354where
38355    C: 'a,
38356{
38357    hub: &'a ShoppingContent<C>,
38358    _merchant_id: u64,
38359    _delegate: Option<&'a mut dyn common::Delegate>,
38360    _additional_params: HashMap<String, String>,
38361    _scopes: BTreeSet<String>,
38362}
38363
38364impl<'a, C> common::CallBuilder for ShippingsettingGetsupportedholidayCall<'a, C> {}
38365
38366impl<'a, C> ShippingsettingGetsupportedholidayCall<'a, C>
38367where
38368    C: common::Connector,
38369{
38370    /// Perform the operation you have build so far.
38371    pub async fn doit(
38372        mut self,
38373    ) -> common::Result<(
38374        common::Response,
38375        ShippingsettingsGetSupportedHolidaysResponse,
38376    )> {
38377        use std::borrow::Cow;
38378        use std::io::{Read, Seek};
38379
38380        use common::{url::Params, ToParts};
38381        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
38382
38383        let mut dd = common::DefaultDelegate;
38384        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
38385        dlg.begin(common::MethodInfo {
38386            id: "content.shippingsettings.getsupportedholidays",
38387            http_method: hyper::Method::GET,
38388        });
38389
38390        for &field in ["alt", "merchantId"].iter() {
38391            if self._additional_params.contains_key(field) {
38392                dlg.finished(false);
38393                return Err(common::Error::FieldClash(field));
38394            }
38395        }
38396
38397        let mut params = Params::with_capacity(3 + self._additional_params.len());
38398        params.push("merchantId", self._merchant_id.to_string());
38399
38400        params.extend(self._additional_params.iter());
38401
38402        params.push("alt", "json");
38403        let mut url = self.hub._base_url.clone() + "{merchantId}/supportedHolidays";
38404        if self._scopes.is_empty() {
38405            self._scopes.insert(Scope::Full.as_ref().to_string());
38406        }
38407
38408        #[allow(clippy::single_element_loop)]
38409        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
38410            url = params.uri_replacement(url, param_name, find_this, false);
38411        }
38412        {
38413            let to_remove = ["merchantId"];
38414            params.remove_params(&to_remove);
38415        }
38416
38417        let url = params.parse_with_url(&url);
38418
38419        loop {
38420            let token = match self
38421                .hub
38422                .auth
38423                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
38424                .await
38425            {
38426                Ok(token) => token,
38427                Err(e) => match dlg.token(e) {
38428                    Ok(token) => token,
38429                    Err(e) => {
38430                        dlg.finished(false);
38431                        return Err(common::Error::MissingToken(e));
38432                    }
38433                },
38434            };
38435            let mut req_result = {
38436                let client = &self.hub.client;
38437                dlg.pre_request();
38438                let mut req_builder = hyper::Request::builder()
38439                    .method(hyper::Method::GET)
38440                    .uri(url.as_str())
38441                    .header(USER_AGENT, self.hub._user_agent.clone());
38442
38443                if let Some(token) = token.as_ref() {
38444                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
38445                }
38446
38447                let request = req_builder
38448                    .header(CONTENT_LENGTH, 0_u64)
38449                    .body(common::to_body::<String>(None));
38450
38451                client.request(request.unwrap()).await
38452            };
38453
38454            match req_result {
38455                Err(err) => {
38456                    if let common::Retry::After(d) = dlg.http_error(&err) {
38457                        sleep(d).await;
38458                        continue;
38459                    }
38460                    dlg.finished(false);
38461                    return Err(common::Error::HttpError(err));
38462                }
38463                Ok(res) => {
38464                    let (mut parts, body) = res.into_parts();
38465                    let mut body = common::Body::new(body);
38466                    if !parts.status.is_success() {
38467                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38468                        let error = serde_json::from_str(&common::to_string(&bytes));
38469                        let response = common::to_response(parts, bytes.into());
38470
38471                        if let common::Retry::After(d) =
38472                            dlg.http_failure(&response, error.as_ref().ok())
38473                        {
38474                            sleep(d).await;
38475                            continue;
38476                        }
38477
38478                        dlg.finished(false);
38479
38480                        return Err(match error {
38481                            Ok(value) => common::Error::BadRequest(value),
38482                            _ => common::Error::Failure(response),
38483                        });
38484                    }
38485                    let response = {
38486                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38487                        let encoded = common::to_string(&bytes);
38488                        match serde_json::from_str(&encoded) {
38489                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
38490                            Err(error) => {
38491                                dlg.response_json_decode_error(&encoded, &error);
38492                                return Err(common::Error::JsonDecodeError(
38493                                    encoded.to_string(),
38494                                    error,
38495                                ));
38496                            }
38497                        }
38498                    };
38499
38500                    dlg.finished(true);
38501                    return Ok(response);
38502                }
38503            }
38504        }
38505    }
38506
38507    /// The ID of the account for which to retrieve the supported holidays.
38508    ///
38509    /// Sets the *merchant id* path property to the given value.
38510    ///
38511    /// Even though the property as already been set when instantiating this call,
38512    /// we provide this method for API completeness.
38513    pub fn merchant_id(mut self, new_value: u64) -> ShippingsettingGetsupportedholidayCall<'a, C> {
38514        self._merchant_id = new_value;
38515        self
38516    }
38517    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38518    /// while executing the actual API request.
38519    ///
38520    /// ````text
38521    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
38522    /// ````
38523    ///
38524    /// Sets the *delegate* property to the given value.
38525    pub fn delegate(
38526        mut self,
38527        new_value: &'a mut dyn common::Delegate,
38528    ) -> ShippingsettingGetsupportedholidayCall<'a, C> {
38529        self._delegate = Some(new_value);
38530        self
38531    }
38532
38533    /// Set any additional parameter of the query string used in the request.
38534    /// It should be used to set parameters which are not yet available through their own
38535    /// setters.
38536    ///
38537    /// Please note that this method must not be used to set any of the known parameters
38538    /// which have their own setter method. If done anyway, the request will fail.
38539    ///
38540    /// # Additional Parameters
38541    ///
38542    /// * *$.xgafv* (query-string) - V1 error format.
38543    /// * *access_token* (query-string) - OAuth access token.
38544    /// * *alt* (query-string) - Data format for response.
38545    /// * *callback* (query-string) - JSONP
38546    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38547    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
38548    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38549    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38550    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
38551    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38552    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38553    pub fn param<T>(mut self, name: T, value: T) -> ShippingsettingGetsupportedholidayCall<'a, C>
38554    where
38555        T: AsRef<str>,
38556    {
38557        self._additional_params
38558            .insert(name.as_ref().to_string(), value.as_ref().to_string());
38559        self
38560    }
38561
38562    /// Identifies the authorization scope for the method you are building.
38563    ///
38564    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38565    /// [`Scope::Full`].
38566    ///
38567    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38568    /// tokens for more than one scope.
38569    ///
38570    /// Usually there is more than one suitable scope to authorize an operation, some of which may
38571    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38572    /// sufficient, a read-write scope will do as well.
38573    pub fn add_scope<St>(mut self, scope: St) -> ShippingsettingGetsupportedholidayCall<'a, C>
38574    where
38575        St: AsRef<str>,
38576    {
38577        self._scopes.insert(String::from(scope.as_ref()));
38578        self
38579    }
38580    /// Identifies the authorization scope(s) for the method you are building.
38581    ///
38582    /// See [`Self::add_scope()`] for details.
38583    pub fn add_scopes<I, St>(mut self, scopes: I) -> ShippingsettingGetsupportedholidayCall<'a, C>
38584    where
38585        I: IntoIterator<Item = St>,
38586        St: AsRef<str>,
38587    {
38588        self._scopes
38589            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38590        self
38591    }
38592
38593    /// Removes all scopes, and no default scope will be used either.
38594    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38595    /// for details).
38596    pub fn clear_scopes(mut self) -> ShippingsettingGetsupportedholidayCall<'a, C> {
38597        self._scopes.clear();
38598        self
38599    }
38600}
38601
38602/// Retrieves supported pickup services for an account.
38603///
38604/// A builder for the *getsupportedpickupservices* method supported by a *shippingsetting* resource.
38605/// It is not used directly, but through a [`ShippingsettingMethods`] instance.
38606///
38607/// # Example
38608///
38609/// Instantiate a resource method builder
38610///
38611/// ```test_harness,no_run
38612/// # extern crate hyper;
38613/// # extern crate hyper_rustls;
38614/// # extern crate google_content2 as content2;
38615/// # async fn dox() {
38616/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
38617///
38618/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
38619/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
38620/// #     .with_native_roots()
38621/// #     .unwrap()
38622/// #     .https_only()
38623/// #     .enable_http2()
38624/// #     .build();
38625///
38626/// # let executor = hyper_util::rt::TokioExecutor::new();
38627/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
38628/// #     secret,
38629/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
38630/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
38631/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
38632/// #     ),
38633/// # ).build().await.unwrap();
38634///
38635/// # let client = hyper_util::client::legacy::Client::builder(
38636/// #     hyper_util::rt::TokioExecutor::new()
38637/// # )
38638/// # .build(
38639/// #     hyper_rustls::HttpsConnectorBuilder::new()
38640/// #         .with_native_roots()
38641/// #         .unwrap()
38642/// #         .https_or_http()
38643/// #         .enable_http2()
38644/// #         .build()
38645/// # );
38646/// # let mut hub = ShoppingContent::new(client, auth);
38647/// // You can configure optional parameters by calling the respective setters at will, and
38648/// // execute the final call using `doit()`.
38649/// // Values shown here are possibly random and not representative !
38650/// let result = hub.shippingsettings().getsupportedpickupservices(59)
38651///              .doit().await;
38652/// # }
38653/// ```
38654pub struct ShippingsettingGetsupportedpickupserviceCall<'a, C>
38655where
38656    C: 'a,
38657{
38658    hub: &'a ShoppingContent<C>,
38659    _merchant_id: u64,
38660    _delegate: Option<&'a mut dyn common::Delegate>,
38661    _additional_params: HashMap<String, String>,
38662    _scopes: BTreeSet<String>,
38663}
38664
38665impl<'a, C> common::CallBuilder for ShippingsettingGetsupportedpickupserviceCall<'a, C> {}
38666
38667impl<'a, C> ShippingsettingGetsupportedpickupserviceCall<'a, C>
38668where
38669    C: common::Connector,
38670{
38671    /// Perform the operation you have build so far.
38672    pub async fn doit(
38673        mut self,
38674    ) -> common::Result<(
38675        common::Response,
38676        ShippingsettingsGetSupportedPickupServicesResponse,
38677    )> {
38678        use std::borrow::Cow;
38679        use std::io::{Read, Seek};
38680
38681        use common::{url::Params, ToParts};
38682        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
38683
38684        let mut dd = common::DefaultDelegate;
38685        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
38686        dlg.begin(common::MethodInfo {
38687            id: "content.shippingsettings.getsupportedpickupservices",
38688            http_method: hyper::Method::GET,
38689        });
38690
38691        for &field in ["alt", "merchantId"].iter() {
38692            if self._additional_params.contains_key(field) {
38693                dlg.finished(false);
38694                return Err(common::Error::FieldClash(field));
38695            }
38696        }
38697
38698        let mut params = Params::with_capacity(3 + self._additional_params.len());
38699        params.push("merchantId", self._merchant_id.to_string());
38700
38701        params.extend(self._additional_params.iter());
38702
38703        params.push("alt", "json");
38704        let mut url = self.hub._base_url.clone() + "{merchantId}/supportedPickupServices";
38705        if self._scopes.is_empty() {
38706            self._scopes.insert(Scope::Full.as_ref().to_string());
38707        }
38708
38709        #[allow(clippy::single_element_loop)]
38710        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
38711            url = params.uri_replacement(url, param_name, find_this, false);
38712        }
38713        {
38714            let to_remove = ["merchantId"];
38715            params.remove_params(&to_remove);
38716        }
38717
38718        let url = params.parse_with_url(&url);
38719
38720        loop {
38721            let token = match self
38722                .hub
38723                .auth
38724                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
38725                .await
38726            {
38727                Ok(token) => token,
38728                Err(e) => match dlg.token(e) {
38729                    Ok(token) => token,
38730                    Err(e) => {
38731                        dlg.finished(false);
38732                        return Err(common::Error::MissingToken(e));
38733                    }
38734                },
38735            };
38736            let mut req_result = {
38737                let client = &self.hub.client;
38738                dlg.pre_request();
38739                let mut req_builder = hyper::Request::builder()
38740                    .method(hyper::Method::GET)
38741                    .uri(url.as_str())
38742                    .header(USER_AGENT, self.hub._user_agent.clone());
38743
38744                if let Some(token) = token.as_ref() {
38745                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
38746                }
38747
38748                let request = req_builder
38749                    .header(CONTENT_LENGTH, 0_u64)
38750                    .body(common::to_body::<String>(None));
38751
38752                client.request(request.unwrap()).await
38753            };
38754
38755            match req_result {
38756                Err(err) => {
38757                    if let common::Retry::After(d) = dlg.http_error(&err) {
38758                        sleep(d).await;
38759                        continue;
38760                    }
38761                    dlg.finished(false);
38762                    return Err(common::Error::HttpError(err));
38763                }
38764                Ok(res) => {
38765                    let (mut parts, body) = res.into_parts();
38766                    let mut body = common::Body::new(body);
38767                    if !parts.status.is_success() {
38768                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38769                        let error = serde_json::from_str(&common::to_string(&bytes));
38770                        let response = common::to_response(parts, bytes.into());
38771
38772                        if let common::Retry::After(d) =
38773                            dlg.http_failure(&response, error.as_ref().ok())
38774                        {
38775                            sleep(d).await;
38776                            continue;
38777                        }
38778
38779                        dlg.finished(false);
38780
38781                        return Err(match error {
38782                            Ok(value) => common::Error::BadRequest(value),
38783                            _ => common::Error::Failure(response),
38784                        });
38785                    }
38786                    let response = {
38787                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38788                        let encoded = common::to_string(&bytes);
38789                        match serde_json::from_str(&encoded) {
38790                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
38791                            Err(error) => {
38792                                dlg.response_json_decode_error(&encoded, &error);
38793                                return Err(common::Error::JsonDecodeError(
38794                                    encoded.to_string(),
38795                                    error,
38796                                ));
38797                            }
38798                        }
38799                    };
38800
38801                    dlg.finished(true);
38802                    return Ok(response);
38803                }
38804            }
38805        }
38806    }
38807
38808    /// The ID of the account for which to retrieve the supported pickup services.
38809    ///
38810    /// Sets the *merchant id* path property to the given value.
38811    ///
38812    /// Even though the property as already been set when instantiating this call,
38813    /// we provide this method for API completeness.
38814    pub fn merchant_id(
38815        mut self,
38816        new_value: u64,
38817    ) -> ShippingsettingGetsupportedpickupserviceCall<'a, C> {
38818        self._merchant_id = new_value;
38819        self
38820    }
38821    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38822    /// while executing the actual API request.
38823    ///
38824    /// ````text
38825    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
38826    /// ````
38827    ///
38828    /// Sets the *delegate* property to the given value.
38829    pub fn delegate(
38830        mut self,
38831        new_value: &'a mut dyn common::Delegate,
38832    ) -> ShippingsettingGetsupportedpickupserviceCall<'a, C> {
38833        self._delegate = Some(new_value);
38834        self
38835    }
38836
38837    /// Set any additional parameter of the query string used in the request.
38838    /// It should be used to set parameters which are not yet available through their own
38839    /// setters.
38840    ///
38841    /// Please note that this method must not be used to set any of the known parameters
38842    /// which have their own setter method. If done anyway, the request will fail.
38843    ///
38844    /// # Additional Parameters
38845    ///
38846    /// * *$.xgafv* (query-string) - V1 error format.
38847    /// * *access_token* (query-string) - OAuth access token.
38848    /// * *alt* (query-string) - Data format for response.
38849    /// * *callback* (query-string) - JSONP
38850    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38851    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
38852    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38853    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38854    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
38855    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38856    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38857    pub fn param<T>(
38858        mut self,
38859        name: T,
38860        value: T,
38861    ) -> ShippingsettingGetsupportedpickupserviceCall<'a, C>
38862    where
38863        T: AsRef<str>,
38864    {
38865        self._additional_params
38866            .insert(name.as_ref().to_string(), value.as_ref().to_string());
38867        self
38868    }
38869
38870    /// Identifies the authorization scope for the method you are building.
38871    ///
38872    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38873    /// [`Scope::Full`].
38874    ///
38875    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38876    /// tokens for more than one scope.
38877    ///
38878    /// Usually there is more than one suitable scope to authorize an operation, some of which may
38879    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38880    /// sufficient, a read-write scope will do as well.
38881    pub fn add_scope<St>(mut self, scope: St) -> ShippingsettingGetsupportedpickupserviceCall<'a, C>
38882    where
38883        St: AsRef<str>,
38884    {
38885        self._scopes.insert(String::from(scope.as_ref()));
38886        self
38887    }
38888    /// Identifies the authorization scope(s) for the method you are building.
38889    ///
38890    /// See [`Self::add_scope()`] for details.
38891    pub fn add_scopes<I, St>(
38892        mut self,
38893        scopes: I,
38894    ) -> ShippingsettingGetsupportedpickupserviceCall<'a, C>
38895    where
38896        I: IntoIterator<Item = St>,
38897        St: AsRef<str>,
38898    {
38899        self._scopes
38900            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38901        self
38902    }
38903
38904    /// Removes all scopes, and no default scope will be used either.
38905    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38906    /// for details).
38907    pub fn clear_scopes(mut self) -> ShippingsettingGetsupportedpickupserviceCall<'a, C> {
38908        self._scopes.clear();
38909        self
38910    }
38911}
38912
38913/// Lists the shipping settings of the sub-accounts in your Merchant Center account.
38914///
38915/// A builder for the *list* method supported by a *shippingsetting* resource.
38916/// It is not used directly, but through a [`ShippingsettingMethods`] instance.
38917///
38918/// # Example
38919///
38920/// Instantiate a resource method builder
38921///
38922/// ```test_harness,no_run
38923/// # extern crate hyper;
38924/// # extern crate hyper_rustls;
38925/// # extern crate google_content2 as content2;
38926/// # async fn dox() {
38927/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
38928///
38929/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
38930/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
38931/// #     .with_native_roots()
38932/// #     .unwrap()
38933/// #     .https_only()
38934/// #     .enable_http2()
38935/// #     .build();
38936///
38937/// # let executor = hyper_util::rt::TokioExecutor::new();
38938/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
38939/// #     secret,
38940/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
38941/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
38942/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
38943/// #     ),
38944/// # ).build().await.unwrap();
38945///
38946/// # let client = hyper_util::client::legacy::Client::builder(
38947/// #     hyper_util::rt::TokioExecutor::new()
38948/// # )
38949/// # .build(
38950/// #     hyper_rustls::HttpsConnectorBuilder::new()
38951/// #         .with_native_roots()
38952/// #         .unwrap()
38953/// #         .https_or_http()
38954/// #         .enable_http2()
38955/// #         .build()
38956/// # );
38957/// # let mut hub = ShoppingContent::new(client, auth);
38958/// // You can configure optional parameters by calling the respective setters at will, and
38959/// // execute the final call using `doit()`.
38960/// // Values shown here are possibly random and not representative !
38961/// let result = hub.shippingsettings().list(10)
38962///              .page_token("et")
38963///              .max_results(93)
38964///              .doit().await;
38965/// # }
38966/// ```
38967pub struct ShippingsettingListCall<'a, C>
38968where
38969    C: 'a,
38970{
38971    hub: &'a ShoppingContent<C>,
38972    _merchant_id: u64,
38973    _page_token: Option<String>,
38974    _max_results: Option<u32>,
38975    _delegate: Option<&'a mut dyn common::Delegate>,
38976    _additional_params: HashMap<String, String>,
38977    _scopes: BTreeSet<String>,
38978}
38979
38980impl<'a, C> common::CallBuilder for ShippingsettingListCall<'a, C> {}
38981
38982impl<'a, C> ShippingsettingListCall<'a, C>
38983where
38984    C: common::Connector,
38985{
38986    /// Perform the operation you have build so far.
38987    pub async fn doit(
38988        mut self,
38989    ) -> common::Result<(common::Response, ShippingsettingsListResponse)> {
38990        use std::borrow::Cow;
38991        use std::io::{Read, Seek};
38992
38993        use common::{url::Params, ToParts};
38994        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
38995
38996        let mut dd = common::DefaultDelegate;
38997        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
38998        dlg.begin(common::MethodInfo {
38999            id: "content.shippingsettings.list",
39000            http_method: hyper::Method::GET,
39001        });
39002
39003        for &field in ["alt", "merchantId", "pageToken", "maxResults"].iter() {
39004            if self._additional_params.contains_key(field) {
39005                dlg.finished(false);
39006                return Err(common::Error::FieldClash(field));
39007            }
39008        }
39009
39010        let mut params = Params::with_capacity(5 + self._additional_params.len());
39011        params.push("merchantId", self._merchant_id.to_string());
39012        if let Some(value) = self._page_token.as_ref() {
39013            params.push("pageToken", value);
39014        }
39015        if let Some(value) = self._max_results.as_ref() {
39016            params.push("maxResults", value.to_string());
39017        }
39018
39019        params.extend(self._additional_params.iter());
39020
39021        params.push("alt", "json");
39022        let mut url = self.hub._base_url.clone() + "{merchantId}/shippingsettings";
39023        if self._scopes.is_empty() {
39024            self._scopes.insert(Scope::Full.as_ref().to_string());
39025        }
39026
39027        #[allow(clippy::single_element_loop)]
39028        for &(find_this, param_name) in [("{merchantId}", "merchantId")].iter() {
39029            url = params.uri_replacement(url, param_name, find_this, false);
39030        }
39031        {
39032            let to_remove = ["merchantId"];
39033            params.remove_params(&to_remove);
39034        }
39035
39036        let url = params.parse_with_url(&url);
39037
39038        loop {
39039            let token = match self
39040                .hub
39041                .auth
39042                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
39043                .await
39044            {
39045                Ok(token) => token,
39046                Err(e) => match dlg.token(e) {
39047                    Ok(token) => token,
39048                    Err(e) => {
39049                        dlg.finished(false);
39050                        return Err(common::Error::MissingToken(e));
39051                    }
39052                },
39053            };
39054            let mut req_result = {
39055                let client = &self.hub.client;
39056                dlg.pre_request();
39057                let mut req_builder = hyper::Request::builder()
39058                    .method(hyper::Method::GET)
39059                    .uri(url.as_str())
39060                    .header(USER_AGENT, self.hub._user_agent.clone());
39061
39062                if let Some(token) = token.as_ref() {
39063                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
39064                }
39065
39066                let request = req_builder
39067                    .header(CONTENT_LENGTH, 0_u64)
39068                    .body(common::to_body::<String>(None));
39069
39070                client.request(request.unwrap()).await
39071            };
39072
39073            match req_result {
39074                Err(err) => {
39075                    if let common::Retry::After(d) = dlg.http_error(&err) {
39076                        sleep(d).await;
39077                        continue;
39078                    }
39079                    dlg.finished(false);
39080                    return Err(common::Error::HttpError(err));
39081                }
39082                Ok(res) => {
39083                    let (mut parts, body) = res.into_parts();
39084                    let mut body = common::Body::new(body);
39085                    if !parts.status.is_success() {
39086                        let bytes = common::to_bytes(body).await.unwrap_or_default();
39087                        let error = serde_json::from_str(&common::to_string(&bytes));
39088                        let response = common::to_response(parts, bytes.into());
39089
39090                        if let common::Retry::After(d) =
39091                            dlg.http_failure(&response, error.as_ref().ok())
39092                        {
39093                            sleep(d).await;
39094                            continue;
39095                        }
39096
39097                        dlg.finished(false);
39098
39099                        return Err(match error {
39100                            Ok(value) => common::Error::BadRequest(value),
39101                            _ => common::Error::Failure(response),
39102                        });
39103                    }
39104                    let response = {
39105                        let bytes = common::to_bytes(body).await.unwrap_or_default();
39106                        let encoded = common::to_string(&bytes);
39107                        match serde_json::from_str(&encoded) {
39108                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
39109                            Err(error) => {
39110                                dlg.response_json_decode_error(&encoded, &error);
39111                                return Err(common::Error::JsonDecodeError(
39112                                    encoded.to_string(),
39113                                    error,
39114                                ));
39115                            }
39116                        }
39117                    };
39118
39119                    dlg.finished(true);
39120                    return Ok(response);
39121                }
39122            }
39123        }
39124    }
39125
39126    /// The ID of the managing account. This must be a multi-client account.
39127    ///
39128    /// Sets the *merchant id* path property to the given value.
39129    ///
39130    /// Even though the property as already been set when instantiating this call,
39131    /// we provide this method for API completeness.
39132    pub fn merchant_id(mut self, new_value: u64) -> ShippingsettingListCall<'a, C> {
39133        self._merchant_id = new_value;
39134        self
39135    }
39136    /// The token returned by the previous request.
39137    ///
39138    /// Sets the *page token* query property to the given value.
39139    pub fn page_token(mut self, new_value: &str) -> ShippingsettingListCall<'a, C> {
39140        self._page_token = Some(new_value.to_string());
39141        self
39142    }
39143    /// The maximum number of shipping settings to return in the response, used for paging.
39144    ///
39145    /// Sets the *max results* query property to the given value.
39146    pub fn max_results(mut self, new_value: u32) -> ShippingsettingListCall<'a, C> {
39147        self._max_results = Some(new_value);
39148        self
39149    }
39150    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
39151    /// while executing the actual API request.
39152    ///
39153    /// ````text
39154    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
39155    /// ````
39156    ///
39157    /// Sets the *delegate* property to the given value.
39158    pub fn delegate(
39159        mut self,
39160        new_value: &'a mut dyn common::Delegate,
39161    ) -> ShippingsettingListCall<'a, C> {
39162        self._delegate = Some(new_value);
39163        self
39164    }
39165
39166    /// Set any additional parameter of the query string used in the request.
39167    /// It should be used to set parameters which are not yet available through their own
39168    /// setters.
39169    ///
39170    /// Please note that this method must not be used to set any of the known parameters
39171    /// which have their own setter method. If done anyway, the request will fail.
39172    ///
39173    /// # Additional Parameters
39174    ///
39175    /// * *$.xgafv* (query-string) - V1 error format.
39176    /// * *access_token* (query-string) - OAuth access token.
39177    /// * *alt* (query-string) - Data format for response.
39178    /// * *callback* (query-string) - JSONP
39179    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
39180    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
39181    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
39182    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
39183    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
39184    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
39185    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
39186    pub fn param<T>(mut self, name: T, value: T) -> ShippingsettingListCall<'a, C>
39187    where
39188        T: AsRef<str>,
39189    {
39190        self._additional_params
39191            .insert(name.as_ref().to_string(), value.as_ref().to_string());
39192        self
39193    }
39194
39195    /// Identifies the authorization scope for the method you are building.
39196    ///
39197    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
39198    /// [`Scope::Full`].
39199    ///
39200    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
39201    /// tokens for more than one scope.
39202    ///
39203    /// Usually there is more than one suitable scope to authorize an operation, some of which may
39204    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
39205    /// sufficient, a read-write scope will do as well.
39206    pub fn add_scope<St>(mut self, scope: St) -> ShippingsettingListCall<'a, C>
39207    where
39208        St: AsRef<str>,
39209    {
39210        self._scopes.insert(String::from(scope.as_ref()));
39211        self
39212    }
39213    /// Identifies the authorization scope(s) for the method you are building.
39214    ///
39215    /// See [`Self::add_scope()`] for details.
39216    pub fn add_scopes<I, St>(mut self, scopes: I) -> ShippingsettingListCall<'a, C>
39217    where
39218        I: IntoIterator<Item = St>,
39219        St: AsRef<str>,
39220    {
39221        self._scopes
39222            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
39223        self
39224    }
39225
39226    /// Removes all scopes, and no default scope will be used either.
39227    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
39228    /// for details).
39229    pub fn clear_scopes(mut self) -> ShippingsettingListCall<'a, C> {
39230        self._scopes.clear();
39231        self
39232    }
39233}
39234
39235/// Updates the shipping settings of the account. Any fields that are not provided are deleted from the resource.
39236///
39237/// A builder for the *update* method supported by a *shippingsetting* resource.
39238/// It is not used directly, but through a [`ShippingsettingMethods`] instance.
39239///
39240/// # Example
39241///
39242/// Instantiate a resource method builder
39243///
39244/// ```test_harness,no_run
39245/// # extern crate hyper;
39246/// # extern crate hyper_rustls;
39247/// # extern crate google_content2 as content2;
39248/// use content2::api::ShippingSettings;
39249/// # async fn dox() {
39250/// # use content2::{ShoppingContent, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
39251///
39252/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
39253/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
39254/// #     .with_native_roots()
39255/// #     .unwrap()
39256/// #     .https_only()
39257/// #     .enable_http2()
39258/// #     .build();
39259///
39260/// # let executor = hyper_util::rt::TokioExecutor::new();
39261/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
39262/// #     secret,
39263/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
39264/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
39265/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
39266/// #     ),
39267/// # ).build().await.unwrap();
39268///
39269/// # let client = hyper_util::client::legacy::Client::builder(
39270/// #     hyper_util::rt::TokioExecutor::new()
39271/// # )
39272/// # .build(
39273/// #     hyper_rustls::HttpsConnectorBuilder::new()
39274/// #         .with_native_roots()
39275/// #         .unwrap()
39276/// #         .https_or_http()
39277/// #         .enable_http2()
39278/// #         .build()
39279/// # );
39280/// # let mut hub = ShoppingContent::new(client, auth);
39281/// // As the method needs a request, you would usually fill it with the desired information
39282/// // into the respective structure. Some of the parts shown here might not be applicable !
39283/// // Values shown here are possibly random and not representative !
39284/// let mut req = ShippingSettings::default();
39285///
39286/// // You can configure optional parameters by calling the respective setters at will, and
39287/// // execute the final call using `doit()`.
39288/// // Values shown here are possibly random and not representative !
39289/// let result = hub.shippingsettings().update(req, 78, 62)
39290///              .dry_run(true)
39291///              .doit().await;
39292/// # }
39293/// ```
39294pub struct ShippingsettingUpdateCall<'a, C>
39295where
39296    C: 'a,
39297{
39298    hub: &'a ShoppingContent<C>,
39299    _request: ShippingSettings,
39300    _merchant_id: u64,
39301    _account_id: u64,
39302    _dry_run: Option<bool>,
39303    _delegate: Option<&'a mut dyn common::Delegate>,
39304    _additional_params: HashMap<String, String>,
39305    _scopes: BTreeSet<String>,
39306}
39307
39308impl<'a, C> common::CallBuilder for ShippingsettingUpdateCall<'a, C> {}
39309
39310impl<'a, C> ShippingsettingUpdateCall<'a, C>
39311where
39312    C: common::Connector,
39313{
39314    /// Perform the operation you have build so far.
39315    pub async fn doit(mut self) -> common::Result<(common::Response, ShippingSettings)> {
39316        use std::borrow::Cow;
39317        use std::io::{Read, Seek};
39318
39319        use common::{url::Params, ToParts};
39320        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
39321
39322        let mut dd = common::DefaultDelegate;
39323        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
39324        dlg.begin(common::MethodInfo {
39325            id: "content.shippingsettings.update",
39326            http_method: hyper::Method::PUT,
39327        });
39328
39329        for &field in ["alt", "merchantId", "accountId", "dryRun"].iter() {
39330            if self._additional_params.contains_key(field) {
39331                dlg.finished(false);
39332                return Err(common::Error::FieldClash(field));
39333            }
39334        }
39335
39336        let mut params = Params::with_capacity(6 + self._additional_params.len());
39337        params.push("merchantId", self._merchant_id.to_string());
39338        params.push("accountId", self._account_id.to_string());
39339        if let Some(value) = self._dry_run.as_ref() {
39340            params.push("dryRun", value.to_string());
39341        }
39342
39343        params.extend(self._additional_params.iter());
39344
39345        params.push("alt", "json");
39346        let mut url = self.hub._base_url.clone() + "{merchantId}/shippingsettings/{accountId}";
39347        if self._scopes.is_empty() {
39348            self._scopes.insert(Scope::Full.as_ref().to_string());
39349        }
39350
39351        #[allow(clippy::single_element_loop)]
39352        for &(find_this, param_name) in
39353            [("{merchantId}", "merchantId"), ("{accountId}", "accountId")].iter()
39354        {
39355            url = params.uri_replacement(url, param_name, find_this, false);
39356        }
39357        {
39358            let to_remove = ["accountId", "merchantId"];
39359            params.remove_params(&to_remove);
39360        }
39361
39362        let url = params.parse_with_url(&url);
39363
39364        let mut json_mime_type = mime::APPLICATION_JSON;
39365        let mut request_value_reader = {
39366            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
39367            common::remove_json_null_values(&mut value);
39368            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
39369            serde_json::to_writer(&mut dst, &value).unwrap();
39370            dst
39371        };
39372        let request_size = request_value_reader
39373            .seek(std::io::SeekFrom::End(0))
39374            .unwrap();
39375        request_value_reader
39376            .seek(std::io::SeekFrom::Start(0))
39377            .unwrap();
39378
39379        loop {
39380            let token = match self
39381                .hub
39382                .auth
39383                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
39384                .await
39385            {
39386                Ok(token) => token,
39387                Err(e) => match dlg.token(e) {
39388                    Ok(token) => token,
39389                    Err(e) => {
39390                        dlg.finished(false);
39391                        return Err(common::Error::MissingToken(e));
39392                    }
39393                },
39394            };
39395            request_value_reader
39396                .seek(std::io::SeekFrom::Start(0))
39397                .unwrap();
39398            let mut req_result = {
39399                let client = &self.hub.client;
39400                dlg.pre_request();
39401                let mut req_builder = hyper::Request::builder()
39402                    .method(hyper::Method::PUT)
39403                    .uri(url.as_str())
39404                    .header(USER_AGENT, self.hub._user_agent.clone());
39405
39406                if let Some(token) = token.as_ref() {
39407                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
39408                }
39409
39410                let request = req_builder
39411                    .header(CONTENT_TYPE, json_mime_type.to_string())
39412                    .header(CONTENT_LENGTH, request_size as u64)
39413                    .body(common::to_body(
39414                        request_value_reader.get_ref().clone().into(),
39415                    ));
39416
39417                client.request(request.unwrap()).await
39418            };
39419
39420            match req_result {
39421                Err(err) => {
39422                    if let common::Retry::After(d) = dlg.http_error(&err) {
39423                        sleep(d).await;
39424                        continue;
39425                    }
39426                    dlg.finished(false);
39427                    return Err(common::Error::HttpError(err));
39428                }
39429                Ok(res) => {
39430                    let (mut parts, body) = res.into_parts();
39431                    let mut body = common::Body::new(body);
39432                    if !parts.status.is_success() {
39433                        let bytes = common::to_bytes(body).await.unwrap_or_default();
39434                        let error = serde_json::from_str(&common::to_string(&bytes));
39435                        let response = common::to_response(parts, bytes.into());
39436
39437                        if let common::Retry::After(d) =
39438                            dlg.http_failure(&response, error.as_ref().ok())
39439                        {
39440                            sleep(d).await;
39441                            continue;
39442                        }
39443
39444                        dlg.finished(false);
39445
39446                        return Err(match error {
39447                            Ok(value) => common::Error::BadRequest(value),
39448                            _ => common::Error::Failure(response),
39449                        });
39450                    }
39451                    let response = {
39452                        let bytes = common::to_bytes(body).await.unwrap_or_default();
39453                        let encoded = common::to_string(&bytes);
39454                        match serde_json::from_str(&encoded) {
39455                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
39456                            Err(error) => {
39457                                dlg.response_json_decode_error(&encoded, &error);
39458                                return Err(common::Error::JsonDecodeError(
39459                                    encoded.to_string(),
39460                                    error,
39461                                ));
39462                            }
39463                        }
39464                    };
39465
39466                    dlg.finished(true);
39467                    return Ok(response);
39468                }
39469            }
39470        }
39471    }
39472
39473    ///
39474    /// Sets the *request* property to the given value.
39475    ///
39476    /// Even though the property as already been set when instantiating this call,
39477    /// we provide this method for API completeness.
39478    pub fn request(mut self, new_value: ShippingSettings) -> ShippingsettingUpdateCall<'a, C> {
39479        self._request = new_value;
39480        self
39481    }
39482    /// The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and `accountId` must be the ID of a sub-account of this account.
39483    ///
39484    /// Sets the *merchant id* path property to the given value.
39485    ///
39486    /// Even though the property as already been set when instantiating this call,
39487    /// we provide this method for API completeness.
39488    pub fn merchant_id(mut self, new_value: u64) -> ShippingsettingUpdateCall<'a, C> {
39489        self._merchant_id = new_value;
39490        self
39491    }
39492    /// The ID of the account for which to get/update shipping settings.
39493    ///
39494    /// Sets the *account id* path property to the given value.
39495    ///
39496    /// Even though the property as already been set when instantiating this call,
39497    /// we provide this method for API completeness.
39498    pub fn account_id(mut self, new_value: u64) -> ShippingsettingUpdateCall<'a, C> {
39499        self._account_id = new_value;
39500        self
39501    }
39502    /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
39503    ///
39504    /// Sets the *dry run* query property to the given value.
39505    pub fn dry_run(mut self, new_value: bool) -> ShippingsettingUpdateCall<'a, C> {
39506        self._dry_run = Some(new_value);
39507        self
39508    }
39509    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
39510    /// while executing the actual API request.
39511    ///
39512    /// ````text
39513    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
39514    /// ````
39515    ///
39516    /// Sets the *delegate* property to the given value.
39517    pub fn delegate(
39518        mut self,
39519        new_value: &'a mut dyn common::Delegate,
39520    ) -> ShippingsettingUpdateCall<'a, C> {
39521        self._delegate = Some(new_value);
39522        self
39523    }
39524
39525    /// Set any additional parameter of the query string used in the request.
39526    /// It should be used to set parameters which are not yet available through their own
39527    /// setters.
39528    ///
39529    /// Please note that this method must not be used to set any of the known parameters
39530    /// which have their own setter method. If done anyway, the request will fail.
39531    ///
39532    /// # Additional Parameters
39533    ///
39534    /// * *$.xgafv* (query-string) - V1 error format.
39535    /// * *access_token* (query-string) - OAuth access token.
39536    /// * *alt* (query-string) - Data format for response.
39537    /// * *callback* (query-string) - JSONP
39538    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
39539    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
39540    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
39541    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
39542    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
39543    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
39544    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
39545    pub fn param<T>(mut self, name: T, value: T) -> ShippingsettingUpdateCall<'a, C>
39546    where
39547        T: AsRef<str>,
39548    {
39549        self._additional_params
39550            .insert(name.as_ref().to_string(), value.as_ref().to_string());
39551        self
39552    }
39553
39554    /// Identifies the authorization scope for the method you are building.
39555    ///
39556    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
39557    /// [`Scope::Full`].
39558    ///
39559    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
39560    /// tokens for more than one scope.
39561    ///
39562    /// Usually there is more than one suitable scope to authorize an operation, some of which may
39563    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
39564    /// sufficient, a read-write scope will do as well.
39565    pub fn add_scope<St>(mut self, scope: St) -> ShippingsettingUpdateCall<'a, C>
39566    where
39567        St: AsRef<str>,
39568    {
39569        self._scopes.insert(String::from(scope.as_ref()));
39570        self
39571    }
39572    /// Identifies the authorization scope(s) for the method you are building.
39573    ///
39574    /// See [`Self::add_scope()`] for details.
39575    pub fn add_scopes<I, St>(mut self, scopes: I) -> ShippingsettingUpdateCall<'a, C>
39576    where
39577        I: IntoIterator<Item = St>,
39578        St: AsRef<str>,
39579    {
39580        self._scopes
39581            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
39582        self
39583    }
39584
39585    /// Removes all scopes, and no default scope will be used either.
39586    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
39587    /// for details).
39588    pub fn clear_scopes(mut self) -> ShippingsettingUpdateCall<'a, C> {
39589        self._scopes.clear();
39590        self
39591    }
39592}