google_cloudchannel1/
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 users on your domain
17    AppOrder,
18
19    /// View usage reports for your Google Workspace domain
20    AppReportUsageReadonly,
21}
22
23impl AsRef<str> for Scope {
24    fn as_ref(&self) -> &str {
25        match *self {
26            Scope::AppOrder => "https://www.googleapis.com/auth/apps.order",
27            Scope::AppReportUsageReadonly => {
28                "https://www.googleapis.com/auth/apps.reports.usage.readonly"
29            }
30        }
31    }
32}
33
34#[allow(clippy::derivable_impls)]
35impl Default for Scope {
36    fn default() -> Scope {
37        Scope::AppReportUsageReadonly
38    }
39}
40
41// ########
42// HUB ###
43// ######
44
45/// Central instance to access all Cloudchannel related resource activities
46///
47/// # Examples
48///
49/// Instantiate a new hub
50///
51/// ```test_harness,no_run
52/// extern crate hyper;
53/// extern crate hyper_rustls;
54/// extern crate google_cloudchannel1 as cloudchannel1;
55/// use cloudchannel1::api::GoogleCloudChannelV1ActivateEntitlementRequest;
56/// use cloudchannel1::{Result, Error};
57/// # async fn dox() {
58/// use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
59///
60/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
61/// // `client_secret`, among other things.
62/// let secret: yup_oauth2::ApplicationSecret = Default::default();
63/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
64/// // unless you replace  `None` with the desired Flow.
65/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
66/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
67/// // retrieve them from storage.
68/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
69///     .with_native_roots()
70///     .unwrap()
71///     .https_only()
72///     .enable_http2()
73///     .build();
74///
75/// let executor = hyper_util::rt::TokioExecutor::new();
76/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
77///     secret,
78///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
79///     yup_oauth2::client::CustomHyperClientBuilder::from(
80///         hyper_util::client::legacy::Client::builder(executor).build(connector),
81///     ),
82/// ).build().await.unwrap();
83///
84/// let client = hyper_util::client::legacy::Client::builder(
85///     hyper_util::rt::TokioExecutor::new()
86/// )
87/// .build(
88///     hyper_rustls::HttpsConnectorBuilder::new()
89///         .with_native_roots()
90///         .unwrap()
91///         .https_or_http()
92///         .enable_http2()
93///         .build()
94/// );
95/// let mut hub = Cloudchannel::new(client, auth);
96/// // As the method needs a request, you would usually fill it with the desired information
97/// // into the respective structure. Some of the parts shown here might not be applicable !
98/// // Values shown here are possibly random and not representative !
99/// let mut req = GoogleCloudChannelV1ActivateEntitlementRequest::default();
100///
101/// // You can configure optional parameters by calling the respective setters at will, and
102/// // execute the final call using `doit()`.
103/// // Values shown here are possibly random and not representative !
104/// let result = hub.accounts().customers_entitlements_activate(req, "name")
105///              .doit().await;
106///
107/// match result {
108///     Err(e) => match e {
109///         // The Error enum provides details about what exactly happened.
110///         // You can also just use its `Debug`, `Display` or `Error` traits
111///          Error::HttpError(_)
112///         |Error::Io(_)
113///         |Error::MissingAPIKey
114///         |Error::MissingToken(_)
115///         |Error::Cancelled
116///         |Error::UploadSizeLimitExceeded(_, _)
117///         |Error::Failure(_)
118///         |Error::BadRequest(_)
119///         |Error::FieldClash(_)
120///         |Error::JsonDecodeError(_, _) => println!("{}", e),
121///     },
122///     Ok(res) => println!("Success: {:?}", res),
123/// }
124/// # }
125/// ```
126#[derive(Clone)]
127pub struct Cloudchannel<C> {
128    pub client: common::Client<C>,
129    pub auth: Box<dyn common::GetToken>,
130    _user_agent: String,
131    _base_url: String,
132    _root_url: String,
133}
134
135impl<C> common::Hub for Cloudchannel<C> {}
136
137impl<'a, C> Cloudchannel<C> {
138    pub fn new<A: 'static + common::GetToken>(
139        client: common::Client<C>,
140        auth: A,
141    ) -> Cloudchannel<C> {
142        Cloudchannel {
143            client,
144            auth: Box::new(auth),
145            _user_agent: "google-api-rust-client/7.0.0".to_string(),
146            _base_url: "https://cloudchannel.googleapis.com/".to_string(),
147            _root_url: "https://cloudchannel.googleapis.com/".to_string(),
148        }
149    }
150
151    pub fn accounts(&'a self) -> AccountMethods<'a, C> {
152        AccountMethods { hub: self }
153    }
154    pub fn integrators(&'a self) -> IntegratorMethods<'a, C> {
155        IntegratorMethods { hub: self }
156    }
157    pub fn operations(&'a self) -> OperationMethods<'a, C> {
158        OperationMethods { hub: self }
159    }
160    pub fn products(&'a self) -> ProductMethods<'a, C> {
161        ProductMethods { hub: self }
162    }
163
164    /// Set the user-agent header field to use in all requests to the server.
165    /// It defaults to `google-api-rust-client/7.0.0`.
166    ///
167    /// Returns the previously set user-agent.
168    pub fn user_agent(&mut self, agent_name: String) -> String {
169        std::mem::replace(&mut self._user_agent, agent_name)
170    }
171
172    /// Set the base url to use in all requests to the server.
173    /// It defaults to `https://cloudchannel.googleapis.com/`.
174    ///
175    /// Returns the previously set base url.
176    pub fn base_url(&mut self, new_base_url: String) -> String {
177        std::mem::replace(&mut self._base_url, new_base_url)
178    }
179
180    /// Set the root url to use in all requests to the server.
181    /// It defaults to `https://cloudchannel.googleapis.com/`.
182    ///
183    /// Returns the previously set root url.
184    pub fn root_url(&mut self, new_root_url: String) -> String {
185        std::mem::replace(&mut self._root_url, new_root_url)
186    }
187}
188
189// ############
190// SCHEMAS ###
191// ##########
192/// Request message for CloudChannelService.ActivateEntitlement.
193///
194/// # Activities
195///
196/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
197/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
198///
199/// * [customers entitlements activate accounts](AccountCustomerEntitlementActivateCall) (request)
200#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
201#[serde_with::serde_as]
202#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
203pub struct GoogleCloudChannelV1ActivateEntitlementRequest {
204    /// Optional. You can specify an optional unique request ID, and if you need to retry your request, the server will know to ignore the request if it's complete. For example, you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if it received the original operation with the same request ID. If it did, it will ignore the second request. The request ID must be a valid [UUID](https://tools.ietf.org/html/rfc4122) with the exception that zero UUID is not supported (`00000000-0000-0000-0000-000000000000`).
205    #[serde(rename = "requestId")]
206    pub request_id: Option<String>,
207}
208
209impl common::RequestValue for GoogleCloudChannelV1ActivateEntitlementRequest {}
210
211/// Information needed to create an Admin User for Google Workspace.
212///
213/// This type is not used in any activity, and only used as *part* of another schema.
214///
215#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
216#[serde_with::serde_as]
217#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
218pub struct GoogleCloudChannelV1AdminUser {
219    /// Primary email of the admin user.
220    pub email: Option<String>,
221    /// Family name of the admin user.
222    #[serde(rename = "familyName")]
223    pub family_name: Option<String>,
224    /// Given name of the admin user.
225    #[serde(rename = "givenName")]
226    pub given_name: Option<String>,
227}
228
229impl common::Part for GoogleCloudChannelV1AdminUser {}
230
231/// Association links that an entitlement has to other entitlements.
232///
233/// This type is not used in any activity, and only used as *part* of another schema.
234///
235#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
236#[serde_with::serde_as]
237#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
238pub struct GoogleCloudChannelV1AssociationInfo {
239    /// The name of the base entitlement, for which this entitlement is an add-on.
240    #[serde(rename = "baseEntitlement")]
241    pub base_entitlement: Option<String>,
242}
243
244impl common::Part for GoogleCloudChannelV1AssociationInfo {}
245
246/// Represents the Billable SKU information.
247///
248/// This type is not used in any activity, and only used as *part* of another schema.
249///
250#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
251#[serde_with::serde_as]
252#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
253pub struct GoogleCloudChannelV1BillableSku {
254    /// Resource name of Service which contains Repricing SKU. Format: services/{service}. Example: "services/B7D9-FDCB-15D8".
255    pub service: Option<String>,
256    /// Unique human readable name for the Service.
257    #[serde(rename = "serviceDisplayName")]
258    pub service_display_name: Option<String>,
259    /// Resource name of Billable SKU. Format: billableSkus/{sku}. Example: billableSkus/6E1B-6634-470F".
260    pub sku: Option<String>,
261    /// Unique human readable name for the SKU.
262    #[serde(rename = "skuDisplayName")]
263    pub sku_display_name: Option<String>,
264}
265
266impl common::Part for GoogleCloudChannelV1BillableSku {}
267
268/// Represents a billing account.
269///
270/// This type is not used in any activity, and only used as *part* of another schema.
271///
272#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
273#[serde_with::serde_as]
274#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
275pub struct GoogleCloudChannelV1BillingAccount {
276    /// Output only. The time when this billing account was created.
277    #[serde(rename = "createTime")]
278    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
279    /// Output only. The 3-letter currency code defined in ISO 4217.
280    #[serde(rename = "currencyCode")]
281    pub currency_code: Option<String>,
282    /// Display name of the billing account.
283    #[serde(rename = "displayName")]
284    pub display_name: Option<String>,
285    /// Output only. Resource name of the billing account. Format: accounts/{account_id}/billingAccounts/{billing_account_id}.
286    pub name: Option<String>,
287    /// Output only. The CLDR region code.
288    #[serde(rename = "regionCode")]
289    pub region_code: Option<String>,
290}
291
292impl common::Part for GoogleCloudChannelV1BillingAccount {}
293
294/// Represents a billing account that can be used to make a purchase.
295///
296/// This type is not used in any activity, and only used as *part* of another schema.
297///
298#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
299#[serde_with::serde_as]
300#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
301pub struct GoogleCloudChannelV1BillingAccountPurchaseInfo {
302    /// The billing account resource.
303    #[serde(rename = "billingAccount")]
304    pub billing_account: Option<GoogleCloudChannelV1BillingAccount>,
305}
306
307impl common::Part for GoogleCloudChannelV1BillingAccountPurchaseInfo {}
308
309/// Request message for CloudChannelService.CancelEntitlement.
310///
311/// # Activities
312///
313/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
314/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
315///
316/// * [customers entitlements cancel accounts](AccountCustomerEntitlementCancelCall) (request)
317#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
318#[serde_with::serde_as]
319#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
320pub struct GoogleCloudChannelV1CancelEntitlementRequest {
321    /// Optional. You can specify an optional unique request ID, and if you need to retry your request, the server will know to ignore the request if it's complete. For example, you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if it received the original operation with the same request ID. If it did, it will ignore the second request. The request ID must be a valid [UUID](https://tools.ietf.org/html/rfc4122) with the exception that zero UUID is not supported (`00000000-0000-0000-0000-000000000000`).
322    #[serde(rename = "requestId")]
323    pub request_id: Option<String>,
324}
325
326impl common::RequestValue for GoogleCloudChannelV1CancelEntitlementRequest {}
327
328/// Request message for CloudChannelService.ChangeOffer.
329///
330/// # Activities
331///
332/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
333/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
334///
335/// * [customers entitlements change offer accounts](AccountCustomerEntitlementChangeOfferCall) (request)
336#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
337#[serde_with::serde_as]
338#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
339pub struct GoogleCloudChannelV1ChangeOfferRequest {
340    /// Optional. The billing account resource name that is used to pay for this entitlement when setting up billing on a trial subscription. This field is only relevant for multi-currency accounts. It should be left empty for single currency accounts.
341    #[serde(rename = "billingAccount")]
342    pub billing_account: Option<String>,
343    /// Required. New Offer. Format: accounts/{account_id}/offers/{offer_id}.
344    pub offer: Option<String>,
345    /// Optional. Parameters needed to purchase the Offer. To view the available Parameters refer to the Offer.parameter_definitions from the desired offer.
346    pub parameters: Option<Vec<GoogleCloudChannelV1Parameter>>,
347    /// Optional. Price reference ID for the offer. Only for offers that require additional price information. Used to guarantee that the pricing is consistent between quoting the offer and placing the order.
348    #[serde(rename = "priceReferenceId")]
349    pub price_reference_id: Option<String>,
350    /// Optional. Purchase order id provided by the reseller.
351    #[serde(rename = "purchaseOrderId")]
352    pub purchase_order_id: Option<String>,
353    /// Optional. You can specify an optional unique request ID, and if you need to retry your request, the server will know to ignore the request if it's complete. For example, you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if it received the original operation with the same request ID. If it did, it will ignore the second request. The request ID must be a valid [UUID](https://tools.ietf.org/html/rfc4122) with the exception that zero UUID is not supported (`00000000-0000-0000-0000-000000000000`).
354    #[serde(rename = "requestId")]
355    pub request_id: Option<String>,
356}
357
358impl common::RequestValue for GoogleCloudChannelV1ChangeOfferRequest {}
359
360/// Request message for CloudChannelService.ChangeParameters.
361///
362/// # Activities
363///
364/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
365/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
366///
367/// * [customers entitlements change parameters accounts](AccountCustomerEntitlementChangeParameterCall) (request)
368#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
369#[serde_with::serde_as]
370#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
371pub struct GoogleCloudChannelV1ChangeParametersRequest {
372    /// Required. Entitlement parameters to update. You can only change editable parameters. To view the available Parameters for a request, refer to the Offer.parameter_definitions from the desired offer.
373    pub parameters: Option<Vec<GoogleCloudChannelV1Parameter>>,
374    /// Optional. Purchase order ID provided by the reseller.
375    #[serde(rename = "purchaseOrderId")]
376    pub purchase_order_id: Option<String>,
377    /// Optional. You can specify an optional unique request ID, and if you need to retry your request, the server will know to ignore the request if it's complete. For example, you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if it received the original operation with the same request ID. If it did, it will ignore the second request. The request ID must be a valid [UUID](https://tools.ietf.org/html/rfc4122) with the exception that zero UUID is not supported (`00000000-0000-0000-0000-000000000000`).
378    #[serde(rename = "requestId")]
379    pub request_id: Option<String>,
380}
381
382impl common::RequestValue for GoogleCloudChannelV1ChangeParametersRequest {}
383
384/// Request message for CloudChannelService.ChangeRenewalSettings.
385///
386/// # Activities
387///
388/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
389/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
390///
391/// * [customers entitlements change renewal settings accounts](AccountCustomerEntitlementChangeRenewalSettingCall) (request)
392#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
393#[serde_with::serde_as]
394#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
395pub struct GoogleCloudChannelV1ChangeRenewalSettingsRequest {
396    /// Required. New renewal settings.
397    #[serde(rename = "renewalSettings")]
398    pub renewal_settings: Option<GoogleCloudChannelV1RenewalSettings>,
399    /// Optional. You can specify an optional unique request ID, and if you need to retry your request, the server will know to ignore the request if it's complete. For example, you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if it received the original operation with the same request ID. If it did, it will ignore the second request. The request ID must be a valid [UUID](https://tools.ietf.org/html/rfc4122) with the exception that zero UUID is not supported (`00000000-0000-0000-0000-000000000000`).
400    #[serde(rename = "requestId")]
401    pub request_id: Option<String>,
402}
403
404impl common::RequestValue for GoogleCloudChannelV1ChangeRenewalSettingsRequest {}
405
406/// Entity representing a link between distributors and their indirect resellers in an n-tier resale channel.
407///
408/// # Activities
409///
410/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
411/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
412///
413/// * [channel partner links create accounts](AccountChannelPartnerLinkCreateCall) (request|response)
414/// * [channel partner links get accounts](AccountChannelPartnerLinkGetCall) (response)
415/// * [channel partner links patch accounts](AccountChannelPartnerLinkPatchCall) (response)
416#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
417#[serde_with::serde_as]
418#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
419pub struct GoogleCloudChannelV1ChannelPartnerLink {
420    /// Output only. Cloud Identity info of the channel partner (IR).
421    #[serde(rename = "channelPartnerCloudIdentityInfo")]
422    pub channel_partner_cloud_identity_info: Option<GoogleCloudChannelV1CloudIdentityInfo>,
423    /// Output only. Timestamp of when the channel partner link is created.
424    #[serde(rename = "createTime")]
425    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
426    /// Output only. URI of the web page where partner accepts the link invitation.
427    #[serde(rename = "inviteLinkUri")]
428    pub invite_link_uri: Option<String>,
429    /// Required. State of the channel partner link.
430    #[serde(rename = "linkState")]
431    pub link_state: Option<String>,
432    /// Output only. Resource name for the channel partner link, in the format accounts/{account_id}/channelPartnerLinks/{id}.
433    pub name: Option<String>,
434    /// Output only. Public identifier that a customer must use to generate a transfer token to move to this distributor-reseller combination.
435    #[serde(rename = "publicId")]
436    pub public_id: Option<String>,
437    /// Required. Cloud Identity ID of the linked reseller.
438    #[serde(rename = "resellerCloudIdentityId")]
439    pub reseller_cloud_identity_id: Option<String>,
440    /// Output only. Timestamp of when the channel partner link is updated.
441    #[serde(rename = "updateTime")]
442    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
443}
444
445impl common::RequestValue for GoogleCloudChannelV1ChannelPartnerLink {}
446impl common::ResponseResult for GoogleCloudChannelV1ChannelPartnerLink {}
447
448/// Configuration for how a distributor will rebill a channel partner (also known as a distributor-authorized reseller).
449///
450/// # Activities
451///
452/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
453/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
454///
455/// * [channel partner links channel partner repricing configs create accounts](AccountChannelPartnerLinkChannelPartnerRepricingConfigCreateCall) (request|response)
456/// * [channel partner links channel partner repricing configs get accounts](AccountChannelPartnerLinkChannelPartnerRepricingConfigGetCall) (response)
457/// * [channel partner links channel partner repricing configs patch accounts](AccountChannelPartnerLinkChannelPartnerRepricingConfigPatchCall) (request|response)
458#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
459#[serde_with::serde_as]
460#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
461pub struct GoogleCloudChannelV1ChannelPartnerRepricingConfig {
462    /// Output only. Resource name of the ChannelPartnerRepricingConfig. Format: accounts/{account_id}/channelPartnerLinks/{channel_partner_id}/channelPartnerRepricingConfigs/{id}.
463    pub name: Option<String>,
464    /// Required. The configuration for bill modifications made by a reseller before sending it to ChannelPartner.
465    #[serde(rename = "repricingConfig")]
466    pub repricing_config: Option<GoogleCloudChannelV1RepricingConfig>,
467    /// Output only. Timestamp of an update to the repricing rule. If `update_time` is after RepricingConfig.effective_invoice_month then it indicates this was set mid-month.
468    #[serde(rename = "updateTime")]
469    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
470}
471
472impl common::RequestValue for GoogleCloudChannelV1ChannelPartnerRepricingConfig {}
473impl common::ResponseResult for GoogleCloudChannelV1ChannelPartnerRepricingConfig {}
474
475/// Request message for CloudChannelService.CheckCloudIdentityAccountsExist.
476///
477/// # Activities
478///
479/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
480/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
481///
482/// * [check cloud identity accounts exist accounts](AccountCheckCloudIdentityAccountsExistCall) (request)
483#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
484#[serde_with::serde_as]
485#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
486pub struct GoogleCloudChannelV1CheckCloudIdentityAccountsExistRequest {
487    /// Required. Domain to fetch for Cloud Identity account customers, including domain and team customers. For team customers, please use the domain for their emails.
488    pub domain: Option<String>,
489    /// Optional. Primary admin email to fetch for Cloud Identity account team customer.
490    #[serde(rename = "primaryAdminEmail")]
491    pub primary_admin_email: Option<String>,
492}
493
494impl common::RequestValue for GoogleCloudChannelV1CheckCloudIdentityAccountsExistRequest {}
495
496/// Response message for CloudChannelService.CheckCloudIdentityAccountsExist.
497///
498/// # Activities
499///
500/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
501/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
502///
503/// * [check cloud identity accounts exist accounts](AccountCheckCloudIdentityAccountsExistCall) (response)
504#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
505#[serde_with::serde_as]
506#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
507pub struct GoogleCloudChannelV1CheckCloudIdentityAccountsExistResponse {
508    /// The Cloud Identity accounts associated with the domain.
509    #[serde(rename = "cloudIdentityAccounts")]
510    pub cloud_identity_accounts: Option<Vec<GoogleCloudChannelV1CloudIdentityCustomerAccount>>,
511}
512
513impl common::ResponseResult for GoogleCloudChannelV1CheckCloudIdentityAccountsExistResponse {}
514
515/// Entity representing a Cloud Identity account that may be associated with a Channel Services API partner.
516///
517/// This type is not used in any activity, and only used as *part* of another schema.
518///
519#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
520#[serde_with::serde_as]
521#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
522pub struct GoogleCloudChannelV1CloudIdentityCustomerAccount {
523    /// If existing = true, and is 2-tier customer, the channel partner of the customer.
524    #[serde(rename = "channelPartnerCloudIdentityId")]
525    pub channel_partner_cloud_identity_id: Option<String>,
526    /// If existing = true, the Cloud Identity ID of the customer.
527    #[serde(rename = "customerCloudIdentityId")]
528    pub customer_cloud_identity_id: Option<String>,
529    /// If owned = true, the name of the customer that owns the Cloud Identity account. Customer_name uses the format: accounts/{account_id}/customers/{customer_id}
530    #[serde(rename = "customerName")]
531    pub customer_name: Option<String>,
532    /// If existing = true, the type of the customer.
533    #[serde(rename = "customerType")]
534    pub customer_type: Option<String>,
535    /// Returns true if a Cloud Identity account exists for a specific domain.
536    pub existing: Option<bool>,
537    /// Returns true if the Cloud Identity account is associated with a customer of the Channel Services partner (with active subscriptions or purchase consents).
538    pub owned: Option<bool>,
539}
540
541impl common::Part for GoogleCloudChannelV1CloudIdentityCustomerAccount {}
542
543/// Cloud Identity information for the Cloud Channel Customer.
544///
545/// This type is not used in any activity, and only used as *part* of another schema.
546///
547#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
548#[serde_with::serde_as]
549#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
550pub struct GoogleCloudChannelV1CloudIdentityInfo {
551    /// Output only. URI of Customer's Admin console dashboard.
552    #[serde(rename = "adminConsoleUri")]
553    pub admin_console_uri: Option<String>,
554    /// The alternate email.
555    #[serde(rename = "alternateEmail")]
556    pub alternate_email: Option<String>,
557    /// CustomerType indicates verification type needed for using services.
558    #[serde(rename = "customerType")]
559    pub customer_type: Option<String>,
560    /// Edu information about the customer.
561    #[serde(rename = "eduData")]
562    pub edu_data: Option<GoogleCloudChannelV1EduData>,
563    /// Output only. Whether the domain is verified. This field is not returned for a Customer's cloud_identity_info resource. Partners can use the domains.get() method of the Workspace SDK's Directory API, or listen to the PRIMARY_DOMAIN_VERIFIED Pub/Sub event in to track domain verification of their resolve Workspace customers.
564    #[serde(rename = "isDomainVerified")]
565    pub is_domain_verified: Option<bool>,
566    /// Language code.
567    #[serde(rename = "languageCode")]
568    pub language_code: Option<String>,
569    /// Phone number associated with the Cloud Identity.
570    #[serde(rename = "phoneNumber")]
571    pub phone_number: Option<String>,
572    /// Output only. The primary domain name.
573    #[serde(rename = "primaryDomain")]
574    pub primary_domain: Option<String>,
575}
576
577impl common::Part for GoogleCloudChannelV1CloudIdentityInfo {}
578
579/// The definition of a report column. Specifies the data properties in the corresponding position of the report rows.
580///
581/// This type is not used in any activity, and only used as *part* of another schema.
582///
583#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
584#[serde_with::serde_as]
585#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
586pub struct GoogleCloudChannelV1Column {
587    /// The unique name of the column (for example, customer_domain, channel_partner, customer_cost). You can use column IDs in RunReportJobRequest.filter. To see all reports and their columns, call CloudChannelReportsService.ListReports.
588    #[serde(rename = "columnId")]
589    pub column_id: Option<String>,
590    /// The type of the values for this column.
591    #[serde(rename = "dataType")]
592    pub data_type: Option<String>,
593    /// The column's display name.
594    #[serde(rename = "displayName")]
595    pub display_name: Option<String>,
596}
597
598impl common::Part for GoogleCloudChannelV1Column {}
599
600/// Commitment settings for commitment-based offers.
601///
602/// This type is not used in any activity, and only used as *part* of another schema.
603///
604#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
605#[serde_with::serde_as]
606#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
607pub struct GoogleCloudChannelV1CommitmentSettings {
608    /// Output only. Commitment end timestamp.
609    #[serde(rename = "endTime")]
610    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
611    /// Optional. Renewal settings applicable for a commitment-based Offer.
612    #[serde(rename = "renewalSettings")]
613    pub renewal_settings: Option<GoogleCloudChannelV1RenewalSettings>,
614    /// Output only. Commitment start timestamp.
615    #[serde(rename = "startTime")]
616    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
617}
618
619impl common::Part for GoogleCloudChannelV1CommitmentSettings {}
620
621/// Specifies the override to conditionally apply.
622///
623/// This type is not used in any activity, and only used as *part* of another schema.
624///
625#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
626#[serde_with::serde_as]
627#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
628pub struct GoogleCloudChannelV1ConditionalOverride {
629    /// Required. Information about the applied override's adjustment.
630    pub adjustment: Option<GoogleCloudChannelV1RepricingAdjustment>,
631    /// Required. The RebillingBasis to use for the applied override. Shows the relative cost based on your repricing costs.
632    #[serde(rename = "rebillingBasis")]
633    pub rebilling_basis: Option<String>,
634    /// Required. Specifies the condition which, if met, will apply the override.
635    #[serde(rename = "repricingCondition")]
636    pub repricing_condition: Option<GoogleCloudChannelV1RepricingCondition>,
637}
638
639impl common::Part for GoogleCloudChannelV1ConditionalOverride {}
640
641/// Represents the constraints for buying the Offer.
642///
643/// This type is not used in any activity, and only used as *part* of another schema.
644///
645#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
646#[serde_with::serde_as]
647#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
648pub struct GoogleCloudChannelV1Constraints {
649    /// Represents constraints required to purchase the Offer for a customer.
650    #[serde(rename = "customerConstraints")]
651    pub customer_constraints: Option<GoogleCloudChannelV1CustomerConstraints>,
652}
653
654impl common::Part for GoogleCloudChannelV1Constraints {}
655
656/// Contact information for a customer account.
657///
658/// This type is not used in any activity, and only used as *part* of another schema.
659///
660#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
661#[serde_with::serde_as]
662#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
663pub struct GoogleCloudChannelV1ContactInfo {
664    /// Output only. The customer account contact's display name, formatted as a combination of the customer's first and last name.
665    #[serde(rename = "displayName")]
666    pub display_name: Option<String>,
667    /// The customer account's contact email. Required for entitlements that create admin.google.com accounts, and serves as the customer's username for those accounts. Use this email to invite Team customers.
668    pub email: Option<String>,
669    /// The customer account contact's first name. Optional for Team customers.
670    #[serde(rename = "firstName")]
671    pub first_name: Option<String>,
672    /// The customer account contact's last name. Optional for Team customers.
673    #[serde(rename = "lastName")]
674    pub last_name: Option<String>,
675    /// The customer account's contact phone number.
676    pub phone: Option<String>,
677    /// Optional. The customer account contact's job title.
678    pub title: Option<String>,
679}
680
681impl common::Part for GoogleCloudChannelV1ContactInfo {}
682
683/// Request message for CloudChannelService.CreateEntitlement
684///
685/// # Activities
686///
687/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
688/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
689///
690/// * [customers entitlements create accounts](AccountCustomerEntitlementCreateCall) (request)
691#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
692#[serde_with::serde_as]
693#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
694pub struct GoogleCloudChannelV1CreateEntitlementRequest {
695    /// Required. The entitlement to create.
696    pub entitlement: Option<GoogleCloudChannelV1Entitlement>,
697    /// Optional. You can specify an optional unique request ID, and if you need to retry your request, the server will know to ignore the request if it's complete. For example, you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if it received the original operation with the same request ID. If it did, it will ignore the second request. The request ID must be a valid [UUID](https://tools.ietf.org/html/rfc4122) with the exception that zero UUID is not supported (`00000000-0000-0000-0000-000000000000`).
698    #[serde(rename = "requestId")]
699    pub request_id: Option<String>,
700}
701
702impl common::RequestValue for GoogleCloudChannelV1CreateEntitlementRequest {}
703
704/// Entity representing a customer of a reseller or distributor.
705///
706/// # Activities
707///
708/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
709/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
710///
711/// * [channel partner links customers create accounts](AccountChannelPartnerLinkCustomerCreateCall) (request|response)
712/// * [channel partner links customers get accounts](AccountChannelPartnerLinkCustomerGetCall) (response)
713/// * [channel partner links customers import accounts](AccountChannelPartnerLinkCustomerImportCall) (response)
714/// * [channel partner links customers patch accounts](AccountChannelPartnerLinkCustomerPatchCall) (request|response)
715/// * [customers create accounts](AccountCustomerCreateCall) (request|response)
716/// * [customers get accounts](AccountCustomerGetCall) (response)
717/// * [customers import accounts](AccountCustomerImportCall) (response)
718/// * [customers patch accounts](AccountCustomerPatchCall) (request|response)
719#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
720#[serde_with::serde_as]
721#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
722pub struct GoogleCloudChannelV1Customer {
723    /// Secondary contact email. You need to provide an alternate email to create different domains if a primary contact email already exists. Users will receive a notification with credentials when you create an admin.google.com account. Secondary emails are also recovery email addresses. Alternate emails are optional when you create Team customers.
724    #[serde(rename = "alternateEmail")]
725    pub alternate_email: Option<String>,
726    /// Cloud Identity ID of the customer's channel partner. Populated only if a channel partner exists for this customer.
727    #[serde(rename = "channelPartnerId")]
728    pub channel_partner_id: Option<String>,
729    /// Output only. The customer's Cloud Identity ID if the customer has a Cloud Identity resource.
730    #[serde(rename = "cloudIdentityId")]
731    pub cloud_identity_id: Option<String>,
732    /// Output only. Cloud Identity information for the customer. Populated only if a Cloud Identity account exists for this customer.
733    #[serde(rename = "cloudIdentityInfo")]
734    pub cloud_identity_info: Option<GoogleCloudChannelV1CloudIdentityInfo>,
735    /// Optional. External CRM ID for the customer. Populated only if a CRM ID exists for this customer.
736    #[serde(rename = "correlationId")]
737    pub correlation_id: Option<String>,
738    /// Output only. Time when the customer was created.
739    #[serde(rename = "createTime")]
740    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
741    /// Optional. Indicate if a customer is attesting about the correctness of provided information. Only required if creating a GCP Entitlement.
742    #[serde(rename = "customerAttestationState")]
743    pub customer_attestation_state: Option<String>,
744    /// Required. The customer's primary domain. Must match the primary contact email's domain.
745    pub domain: Option<String>,
746    /// Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see https://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
747    #[serde(rename = "languageCode")]
748    pub language_code: Option<String>,
749    /// Output only. Resource name of the customer. Format: accounts/{account_id}/customers/{customer_id}
750    pub name: Option<String>,
751    /// Required. Name of the organization that the customer entity represents.
752    #[serde(rename = "orgDisplayName")]
753    pub org_display_name: Option<String>,
754    /// Required. The organization address for the customer. To enforce US laws and embargoes, we require a region, postal code, and address lines. You must provide valid addresses for every customer. To set the customer's language, use the Customer-level language code.
755    #[serde(rename = "orgPostalAddress")]
756    pub org_postal_address: Option<GoogleTypePostalAddress>,
757    /// Primary contact info.
758    #[serde(rename = "primaryContactInfo")]
759    pub primary_contact_info: Option<GoogleCloudChannelV1ContactInfo>,
760    /// Output only. Time when the customer was updated.
761    #[serde(rename = "updateTime")]
762    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
763}
764
765impl common::RequestValue for GoogleCloudChannelV1Customer {}
766impl common::ResponseResult for GoogleCloudChannelV1Customer {}
767
768/// Represents constraints required to purchase the Offer for a customer.
769///
770/// This type is not used in any activity, and only used as *part* of another schema.
771///
772#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
773#[serde_with::serde_as]
774#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
775pub struct GoogleCloudChannelV1CustomerConstraints {
776    /// Allowed Customer Type.
777    #[serde(rename = "allowedCustomerTypes")]
778    pub allowed_customer_types: Option<Vec<String>>,
779    /// Allowed geographical regions of the customer.
780    #[serde(rename = "allowedRegions")]
781    pub allowed_regions: Option<Vec<String>>,
782    /// Allowed Promotional Order Type. Present for Promotional offers.
783    #[serde(rename = "promotionalOrderTypes")]
784    pub promotional_order_types: Option<Vec<String>>,
785}
786
787impl common::Part for GoogleCloudChannelV1CustomerConstraints {}
788
789/// Configuration for how a reseller will reprice a Customer.
790///
791/// # Activities
792///
793/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
794/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
795///
796/// * [customers customer repricing configs create accounts](AccountCustomerCustomerRepricingConfigCreateCall) (request|response)
797/// * [customers customer repricing configs get accounts](AccountCustomerCustomerRepricingConfigGetCall) (response)
798/// * [customers customer repricing configs patch accounts](AccountCustomerCustomerRepricingConfigPatchCall) (request|response)
799#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
800#[serde_with::serde_as]
801#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
802pub struct GoogleCloudChannelV1CustomerRepricingConfig {
803    /// Output only. Resource name of the CustomerRepricingConfig. Format: accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}.
804    pub name: Option<String>,
805    /// Required. The configuration for bill modifications made by a reseller before sending it to customers.
806    #[serde(rename = "repricingConfig")]
807    pub repricing_config: Option<GoogleCloudChannelV1RepricingConfig>,
808    /// Output only. Timestamp of an update to the repricing rule. If `update_time` is after RepricingConfig.effective_invoice_month then it indicates this was set mid-month.
809    #[serde(rename = "updateTime")]
810    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
811}
812
813impl common::RequestValue for GoogleCloudChannelV1CustomerRepricingConfig {}
814impl common::ResponseResult for GoogleCloudChannelV1CustomerRepricingConfig {}
815
816/// A representation of usage or invoice date ranges.
817///
818/// This type is not used in any activity, and only used as *part* of another schema.
819///
820#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
821#[serde_with::serde_as]
822#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
823pub struct GoogleCloudChannelV1DateRange {
824    /// The latest invoice date (inclusive). If this value is not the last day of a month, this will move it forward to the last day of the given month.
825    #[serde(rename = "invoiceEndDate")]
826    pub invoice_end_date: Option<GoogleTypeDate>,
827    /// The earliest invoice date (inclusive). If this value is not the first day of a month, this will move it back to the first day of the given month.
828    #[serde(rename = "invoiceStartDate")]
829    pub invoice_start_date: Option<GoogleTypeDate>,
830    /// The latest usage date time (exclusive). If you use time groupings (daily, weekly, etc), each group uses midnight to midnight (Pacific time). The usage end date is rounded down to include all usage from the specified date. We recommend that clients pass `usage_start_date_time` in Pacific time.
831    #[serde(rename = "usageEndDateTime")]
832    pub usage_end_date_time: Option<GoogleTypeDateTime>,
833    /// The earliest usage date time (inclusive). If you use time groupings (daily, weekly, etc), each group uses midnight to midnight (Pacific time). The usage start date is rounded down to include all usage from the specified date. We recommend that clients pass `usage_start_date_time` in Pacific time.
834    #[serde(rename = "usageStartDateTime")]
835    pub usage_start_date_time: Option<GoogleTypeDateTime>,
836}
837
838impl common::Part for GoogleCloudChannelV1DateRange {}
839
840/// Represents a single component of the total discount applicable on a Price.
841///
842/// This type is not used in any activity, and only used as *part* of another schema.
843///
844#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
845#[serde_with::serde_as]
846#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
847pub struct GoogleCloudChannelV1DiscountComponent {
848    /// Fixed value discount.
849    #[serde(rename = "discountAbsolute")]
850    pub discount_absolute: Option<GoogleTypeMoney>,
851    /// Discount percentage, represented as decimal. For example, a 20% discount will be represented as 0.2.
852    #[serde(rename = "discountPercentage")]
853    pub discount_percentage: Option<f64>,
854    /// Type of the discount.
855    #[serde(rename = "discountType")]
856    pub discount_type: Option<String>,
857}
858
859impl common::Part for GoogleCloudChannelV1DiscountComponent {}
860
861/// Required Edu Attributes
862///
863/// This type is not used in any activity, and only used as *part* of another schema.
864///
865#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
866#[serde_with::serde_as]
867#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
868pub struct GoogleCloudChannelV1EduData {
869    /// Size of the institute.
870    #[serde(rename = "instituteSize")]
871    pub institute_size: Option<String>,
872    /// Designated institute type of customer.
873    #[serde(rename = "instituteType")]
874    pub institute_type: Option<String>,
875    /// Web address for the edu customer's institution.
876    pub website: Option<String>,
877}
878
879impl common::Part for GoogleCloudChannelV1EduData {}
880
881/// An entitlement is a representation of a customer’s ability to use a service.
882///
883/// # Activities
884///
885/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
886/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
887///
888/// * [customers entitlements get accounts](AccountCustomerEntitlementGetCall) (response)
889#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
890#[serde_with::serde_as]
891#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
892pub struct GoogleCloudChannelV1Entitlement {
893    /// Association information to other entitlements.
894    #[serde(rename = "associationInfo")]
895    pub association_info: Option<GoogleCloudChannelV1AssociationInfo>,
896    /// Optional. The billing account resource name that is used to pay for this entitlement.
897    #[serde(rename = "billingAccount")]
898    pub billing_account: Option<String>,
899    /// Commitment settings for a commitment-based Offer. Required for commitment based offers.
900    #[serde(rename = "commitmentSettings")]
901    pub commitment_settings: Option<GoogleCloudChannelV1CommitmentSettings>,
902    /// Output only. The time at which the entitlement is created.
903    #[serde(rename = "createTime")]
904    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
905    /// Output only. Resource name of an entitlement in the form: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}.
906    pub name: Option<String>,
907    /// Required. The offer resource name for which the entitlement is to be created. Takes the form: accounts/{account_id}/offers/{offer_id}.
908    pub offer: Option<String>,
909    /// Extended entitlement parameters. When creating an entitlement, valid parameter names and values are defined in the Offer.parameter_definitions. For Google Workspace, the following Parameters may be accepted as input: - max_units: The maximum assignable units for a flexible offer OR - num_units: The total commitment for commitment-based offers The response may additionally include the following output-only Parameters: - assigned_units: The number of licenses assigned to users. For Google Cloud billing subaccounts, the following Parameter may be accepted as input: - display_name: The display name of the billing subaccount.
910    pub parameters: Option<Vec<GoogleCloudChannelV1Parameter>>,
911    /// Optional. Price reference ID for the offer. Only for offers that require additional price information. Used to guarantee that the pricing is consistent between quoting the offer and placing the order.
912    #[serde(rename = "priceReferenceId")]
913    pub price_reference_id: Option<String>,
914    /// Output only. Service provisioning details for the entitlement.
915    #[serde(rename = "provisionedService")]
916    pub provisioned_service: Option<GoogleCloudChannelV1ProvisionedService>,
917    /// Output only. Current provisioning state of the entitlement.
918    #[serde(rename = "provisioningState")]
919    pub provisioning_state: Option<String>,
920    /// Optional. This purchase order (PO) information is for resellers to use for their company tracking usage. If a purchaseOrderId value is given, it appears in the API responses and shows up in the invoice. The property accepts up to 80 plain text characters. This is only supported for Google Workspace entitlements.
921    #[serde(rename = "purchaseOrderId")]
922    pub purchase_order_id: Option<String>,
923    /// Output only. Enumerable of all current suspension reasons for an entitlement.
924    #[serde(rename = "suspensionReasons")]
925    pub suspension_reasons: Option<Vec<String>>,
926    /// Output only. Settings for trial offers.
927    #[serde(rename = "trialSettings")]
928    pub trial_settings: Option<GoogleCloudChannelV1TrialSettings>,
929    /// Output only. The time at which the entitlement is updated.
930    #[serde(rename = "updateTime")]
931    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
932}
933
934impl common::ResponseResult for GoogleCloudChannelV1Entitlement {}
935
936/// Change event entry for Entitlement order history
937///
938/// This type is not used in any activity, and only used as *part* of another schema.
939///
940#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
941#[serde_with::serde_as]
942#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
943pub struct GoogleCloudChannelV1EntitlementChange {
944    /// The Entitlement's activation reason
945    #[serde(rename = "activationReason")]
946    pub activation_reason: Option<String>,
947    /// Cancellation reason for the Entitlement.
948    #[serde(rename = "cancellationReason")]
949    pub cancellation_reason: Option<String>,
950    /// The change action type.
951    #[serde(rename = "changeType")]
952    pub change_type: Option<String>,
953    /// The submitted time of the change.
954    #[serde(rename = "createTime")]
955    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
956    /// Required. Resource name of an entitlement in the form: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
957    pub entitlement: Option<String>,
958    /// Required. Resource name of the Offer at the time of change. Takes the form: accounts/{account_id}/offers/{offer_id}.
959    pub offer: Option<String>,
960    /// Human-readable identifier that shows what operator made a change. When the operator_type is RESELLER, this is the user's email address. For all other operator types, this is empty.
961    pub operator: Option<String>,
962    /// Operator type responsible for the change.
963    #[serde(rename = "operatorType")]
964    pub operator_type: Option<String>,
965    /// e.g. purchase_number change reason, entered by CRS.
966    #[serde(rename = "otherChangeReason")]
967    pub other_change_reason: Option<String>,
968    /// Extended parameters, such as: purchase_order_number, gcp_details; internal_correlation_id, long_running_operation_id, order_id; etc.
969    pub parameters: Option<Vec<GoogleCloudChannelV1Parameter>>,
970    /// Service provisioned for an Entitlement.
971    #[serde(rename = "provisionedService")]
972    pub provisioned_service: Option<GoogleCloudChannelV1ProvisionedService>,
973    /// Suspension reason for the Entitlement.
974    #[serde(rename = "suspensionReason")]
975    pub suspension_reason: Option<String>,
976}
977
978impl common::Part for GoogleCloudChannelV1EntitlementChange {}
979
980/// Request message for CloudChannelReportsService.FetchReportResults.
981///
982/// # Activities
983///
984/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
985/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
986///
987/// * [report jobs fetch report results accounts](AccountReportJobFetchReportResultCall) (request)
988#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
989#[serde_with::serde_as]
990#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
991pub struct GoogleCloudChannelV1FetchReportResultsRequest {
992    /// Optional. Requested page size of the report. The server may return fewer results than requested. If you don't specify a page size, the server uses a sensible default (may change over time). The maximum value is 30,000; the server will change larger values to 30,000.
993    #[serde(rename = "pageSize")]
994    pub page_size: Option<i32>,
995    /// Optional. A token that specifies a page of results beyond the first page. Obtained through FetchReportResultsResponse.next_page_token of the previous CloudChannelReportsService.FetchReportResults call.
996    #[serde(rename = "pageToken")]
997    pub page_token: Option<String>,
998    /// Optional. List of keys specifying which report partitions to return. If empty, returns all partitions.
999    #[serde(rename = "partitionKeys")]
1000    pub partition_keys: Option<Vec<String>>,
1001}
1002
1003impl common::RequestValue for GoogleCloudChannelV1FetchReportResultsRequest {}
1004
1005/// Response message for CloudChannelReportsService.FetchReportResults. Contains a tabular representation of the report results.
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/// * [report jobs fetch report results accounts](AccountReportJobFetchReportResultCall) (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 GoogleCloudChannelV1FetchReportResultsResponse {
1017    /// Pass this token to FetchReportResultsRequest.page_token to retrieve the next page of results.
1018    #[serde(rename = "nextPageToken")]
1019    pub next_page_token: Option<String>,
1020    /// The metadata for the report results (display name, columns, row count, and date ranges).
1021    #[serde(rename = "reportMetadata")]
1022    pub report_metadata: Option<GoogleCloudChannelV1ReportResultsMetadata>,
1023    /// The report's lists of values. Each row follows the settings and ordering of the columns from `report_metadata`.
1024    pub rows: Option<Vec<GoogleCloudChannelV1Row>>,
1025}
1026
1027impl common::ResponseResult for GoogleCloudChannelV1FetchReportResultsResponse {}
1028
1029/// Request message for CloudChannelService.ImportCustomer
1030///
1031/// # Activities
1032///
1033/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1034/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1035///
1036/// * [channel partner links customers import accounts](AccountChannelPartnerLinkCustomerImportCall) (request)
1037/// * [customers import accounts](AccountCustomerImportCall) (request)
1038#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1039#[serde_with::serde_as]
1040#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1041pub struct GoogleCloudChannelV1ImportCustomerRequest {
1042    /// Optional. The super admin of the resold customer generates this token to authorize a reseller to access their Cloud Identity and purchase entitlements on their behalf. You can omit this token after authorization. See https://support.google.com/a/answer/7643790 for more details.
1043    #[serde(rename = "authToken")]
1044    pub auth_token: Option<String>,
1045    /// Optional. Cloud Identity ID of a channel partner who will be the direct reseller for the customer's order. This field is required for 2-tier transfer scenarios and can be provided via the request Parent binding as well.
1046    #[serde(rename = "channelPartnerId")]
1047    pub channel_partner_id: Option<String>,
1048    /// Required. Customer's Cloud Identity ID
1049    #[serde(rename = "cloudIdentityId")]
1050    pub cloud_identity_id: Option<String>,
1051    /// Optional. Specifies the customer that will receive imported Cloud Identity information. Format: accounts/{account_id}/customers/{customer_id}
1052    pub customer: Option<String>,
1053    /// Required. Customer domain.
1054    pub domain: Option<String>,
1055    /// Required. Choose to overwrite an existing customer if found. This must be set to true if there is an existing customer with a conflicting region code or domain.
1056    #[serde(rename = "overwriteIfExists")]
1057    pub overwrite_if_exists: Option<bool>,
1058    /// Required. Customer's primary admin email.
1059    #[serde(rename = "primaryAdminEmail")]
1060    pub primary_admin_email: Option<String>,
1061}
1062
1063impl common::RequestValue for GoogleCloudChannelV1ImportCustomerRequest {}
1064
1065/// Response message for CloudChannelService.ListChannelPartnerLinks.
1066///
1067/// # Activities
1068///
1069/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1070/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1071///
1072/// * [channel partner links list accounts](AccountChannelPartnerLinkListCall) (response)
1073#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1074#[serde_with::serde_as]
1075#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1076pub struct GoogleCloudChannelV1ListChannelPartnerLinksResponse {
1077    /// The Channel partner links for a reseller.
1078    #[serde(rename = "channelPartnerLinks")]
1079    pub channel_partner_links: Option<Vec<GoogleCloudChannelV1ChannelPartnerLink>>,
1080    /// A token to retrieve the next page of results. Pass to ListChannelPartnerLinksRequest.page_token to obtain that page.
1081    #[serde(rename = "nextPageToken")]
1082    pub next_page_token: Option<String>,
1083}
1084
1085impl common::ResponseResult for GoogleCloudChannelV1ListChannelPartnerLinksResponse {}
1086
1087/// Response message for CloudChannelService.ListChannelPartnerRepricingConfigs.
1088///
1089/// # Activities
1090///
1091/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1092/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1093///
1094/// * [channel partner links channel partner repricing configs list accounts](AccountChannelPartnerLinkChannelPartnerRepricingConfigListCall) (response)
1095#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1096#[serde_with::serde_as]
1097#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1098pub struct GoogleCloudChannelV1ListChannelPartnerRepricingConfigsResponse {
1099    /// The repricing configs for this channel partner.
1100    #[serde(rename = "channelPartnerRepricingConfigs")]
1101    pub channel_partner_repricing_configs:
1102        Option<Vec<GoogleCloudChannelV1ChannelPartnerRepricingConfig>>,
1103    /// A token to retrieve the next page of results. Pass to ListChannelPartnerRepricingConfigsRequest.page_token to obtain that page.
1104    #[serde(rename = "nextPageToken")]
1105    pub next_page_token: Option<String>,
1106}
1107
1108impl common::ResponseResult for GoogleCloudChannelV1ListChannelPartnerRepricingConfigsResponse {}
1109
1110/// Response message for CloudChannelService.ListCustomerRepricingConfigs.
1111///
1112/// # Activities
1113///
1114/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1115/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1116///
1117/// * [customers customer repricing configs list accounts](AccountCustomerCustomerRepricingConfigListCall) (response)
1118#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1119#[serde_with::serde_as]
1120#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1121pub struct GoogleCloudChannelV1ListCustomerRepricingConfigsResponse {
1122    /// The repricing configs for this channel partner.
1123    #[serde(rename = "customerRepricingConfigs")]
1124    pub customer_repricing_configs: Option<Vec<GoogleCloudChannelV1CustomerRepricingConfig>>,
1125    /// A token to retrieve the next page of results. Pass to ListCustomerRepricingConfigsRequest.page_token to obtain that page.
1126    #[serde(rename = "nextPageToken")]
1127    pub next_page_token: Option<String>,
1128}
1129
1130impl common::ResponseResult for GoogleCloudChannelV1ListCustomerRepricingConfigsResponse {}
1131
1132/// Response message for CloudChannelService.ListCustomers.
1133///
1134/// # Activities
1135///
1136/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1137/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1138///
1139/// * [channel partner links customers list accounts](AccountChannelPartnerLinkCustomerListCall) (response)
1140/// * [customers list accounts](AccountCustomerListCall) (response)
1141#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1142#[serde_with::serde_as]
1143#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1144pub struct GoogleCloudChannelV1ListCustomersResponse {
1145    /// The customers belonging to a reseller or distributor.
1146    pub customers: Option<Vec<GoogleCloudChannelV1Customer>>,
1147    /// A token to retrieve the next page of results. Pass to ListCustomersRequest.page_token to obtain that page.
1148    #[serde(rename = "nextPageToken")]
1149    pub next_page_token: Option<String>,
1150}
1151
1152impl common::ResponseResult for GoogleCloudChannelV1ListCustomersResponse {}
1153
1154/// Response message for CloudChannelService.ListEntitlementChanges
1155///
1156/// # Activities
1157///
1158/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1159/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1160///
1161/// * [customers entitlements list entitlement changes accounts](AccountCustomerEntitlementListEntitlementChangeCall) (response)
1162#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1163#[serde_with::serde_as]
1164#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1165pub struct GoogleCloudChannelV1ListEntitlementChangesResponse {
1166    /// The list of entitlement changes.
1167    #[serde(rename = "entitlementChanges")]
1168    pub entitlement_changes: Option<Vec<GoogleCloudChannelV1EntitlementChange>>,
1169    /// A token to list the next page of results.
1170    #[serde(rename = "nextPageToken")]
1171    pub next_page_token: Option<String>,
1172}
1173
1174impl common::ResponseResult for GoogleCloudChannelV1ListEntitlementChangesResponse {}
1175
1176/// Response message for CloudChannelService.ListEntitlements.
1177///
1178/// # Activities
1179///
1180/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1181/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1182///
1183/// * [customers entitlements list accounts](AccountCustomerEntitlementListCall) (response)
1184#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1185#[serde_with::serde_as]
1186#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1187pub struct GoogleCloudChannelV1ListEntitlementsResponse {
1188    /// The reseller customer's entitlements.
1189    pub entitlements: Option<Vec<GoogleCloudChannelV1Entitlement>>,
1190    /// A token to list the next page of results. Pass to ListEntitlementsRequest.page_token to obtain that page.
1191    #[serde(rename = "nextPageToken")]
1192    pub next_page_token: Option<String>,
1193}
1194
1195impl common::ResponseResult for GoogleCloudChannelV1ListEntitlementsResponse {}
1196
1197/// Response message for ListOffers.
1198///
1199/// # Activities
1200///
1201/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1202/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1203///
1204/// * [offers list accounts](AccountOfferListCall) (response)
1205#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1206#[serde_with::serde_as]
1207#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1208pub struct GoogleCloudChannelV1ListOffersResponse {
1209    /// A token to retrieve the next page of results.
1210    #[serde(rename = "nextPageToken")]
1211    pub next_page_token: Option<String>,
1212    /// The list of Offers requested. The pricing information for each Offer only includes the base price. Effective prices and discounts aren't populated.
1213    pub offers: Option<Vec<GoogleCloudChannelV1Offer>>,
1214}
1215
1216impl common::ResponseResult for GoogleCloudChannelV1ListOffersResponse {}
1217
1218/// Response message for ListProducts.
1219///
1220/// # Activities
1221///
1222/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1223/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1224///
1225/// * [list products](ProductListCall) (response)
1226#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1227#[serde_with::serde_as]
1228#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1229pub struct GoogleCloudChannelV1ListProductsResponse {
1230    /// A token to retrieve the next page of results.
1231    #[serde(rename = "nextPageToken")]
1232    pub next_page_token: Option<String>,
1233    /// List of Products requested.
1234    pub products: Option<Vec<GoogleCloudChannelV1Product>>,
1235}
1236
1237impl common::ResponseResult for GoogleCloudChannelV1ListProductsResponse {}
1238
1239/// Response message for ListPurchasableOffers.
1240///
1241/// # Activities
1242///
1243/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1244/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1245///
1246/// * [customers list purchasable offers accounts](AccountCustomerListPurchasableOfferCall) (response)
1247#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1248#[serde_with::serde_as]
1249#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1250pub struct GoogleCloudChannelV1ListPurchasableOffersResponse {
1251    /// A token to retrieve the next page of results.
1252    #[serde(rename = "nextPageToken")]
1253    pub next_page_token: Option<String>,
1254    /// The list of Offers requested.
1255    #[serde(rename = "purchasableOffers")]
1256    pub purchasable_offers: Option<Vec<GoogleCloudChannelV1PurchasableOffer>>,
1257}
1258
1259impl common::ResponseResult for GoogleCloudChannelV1ListPurchasableOffersResponse {}
1260
1261/// Response message for ListPurchasableSkus.
1262///
1263/// # Activities
1264///
1265/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1266/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1267///
1268/// * [customers list purchasable skus accounts](AccountCustomerListPurchasableSkuCall) (response)
1269#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1270#[serde_with::serde_as]
1271#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1272pub struct GoogleCloudChannelV1ListPurchasableSkusResponse {
1273    /// A token to retrieve the next page of results.
1274    #[serde(rename = "nextPageToken")]
1275    pub next_page_token: Option<String>,
1276    /// The list of SKUs requested.
1277    #[serde(rename = "purchasableSkus")]
1278    pub purchasable_skus: Option<Vec<GoogleCloudChannelV1PurchasableSku>>,
1279}
1280
1281impl common::ResponseResult for GoogleCloudChannelV1ListPurchasableSkusResponse {}
1282
1283/// Response message for CloudChannelReportsService.ListReports.
1284///
1285/// # Activities
1286///
1287/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1288/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1289///
1290/// * [reports list accounts](AccountReportListCall) (response)
1291#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1292#[serde_with::serde_as]
1293#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1294pub struct GoogleCloudChannelV1ListReportsResponse {
1295    /// Pass this token to FetchReportResultsRequest.page_token to retrieve the next page of results.
1296    #[serde(rename = "nextPageToken")]
1297    pub next_page_token: Option<String>,
1298    /// The reports available to the partner.
1299    pub reports: Option<Vec<GoogleCloudChannelV1Report>>,
1300}
1301
1302impl common::ResponseResult for GoogleCloudChannelV1ListReportsResponse {}
1303
1304/// Response message for ListSkuGroupBillableSkus.
1305///
1306/// # Activities
1307///
1308/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1309/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1310///
1311/// * [sku groups billable skus list accounts](AccountSkuGroupBillableSkuListCall) (response)
1312#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1313#[serde_with::serde_as]
1314#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1315pub struct GoogleCloudChannelV1ListSkuGroupBillableSkusResponse {
1316    /// The list of billable SKUs in the requested SKU group.
1317    #[serde(rename = "billableSkus")]
1318    pub billable_skus: Option<Vec<GoogleCloudChannelV1BillableSku>>,
1319    /// A token to retrieve the next page of results. Pass to ListSkuGroupBillableSkusRequest.page_token to obtain that page.
1320    #[serde(rename = "nextPageToken")]
1321    pub next_page_token: Option<String>,
1322}
1323
1324impl common::ResponseResult for GoogleCloudChannelV1ListSkuGroupBillableSkusResponse {}
1325
1326/// Response message for ListSkuGroups.
1327///
1328/// # Activities
1329///
1330/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1331/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1332///
1333/// * [sku groups list accounts](AccountSkuGroupListCall) (response)
1334#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1335#[serde_with::serde_as]
1336#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1337pub struct GoogleCloudChannelV1ListSkuGroupsResponse {
1338    /// A token to retrieve the next page of results. Pass to ListSkuGroupsRequest.page_token to obtain that page.
1339    #[serde(rename = "nextPageToken")]
1340    pub next_page_token: Option<String>,
1341    /// The list of SKU groups requested.
1342    #[serde(rename = "skuGroups")]
1343    pub sku_groups: Option<Vec<GoogleCloudChannelV1SkuGroup>>,
1344}
1345
1346impl common::ResponseResult for GoogleCloudChannelV1ListSkuGroupsResponse {}
1347
1348/// Response message for ListSkus.
1349///
1350/// # Activities
1351///
1352/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1353/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1354///
1355/// * [skus list products](ProductSkuListCall) (response)
1356#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1357#[serde_with::serde_as]
1358#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1359pub struct GoogleCloudChannelV1ListSkusResponse {
1360    /// A token to retrieve the next page of results.
1361    #[serde(rename = "nextPageToken")]
1362    pub next_page_token: Option<String>,
1363    /// The list of SKUs requested.
1364    pub skus: Option<Vec<GoogleCloudChannelV1Sku>>,
1365}
1366
1367impl common::ResponseResult for GoogleCloudChannelV1ListSkusResponse {}
1368
1369/// Response Message for ListSubscribers.
1370///
1371/// # Activities
1372///
1373/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1374/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1375///
1376/// * [list subscribers accounts](AccountListSubscriberCall) (response)
1377/// * [list subscribers integrators](IntegratorListSubscriberCall) (response)
1378#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1379#[serde_with::serde_as]
1380#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1381pub struct GoogleCloudChannelV1ListSubscribersResponse {
1382    /// A token that can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1383    #[serde(rename = "nextPageToken")]
1384    pub next_page_token: Option<String>,
1385    /// List of service accounts which have subscriber access to the topic.
1386    #[serde(rename = "serviceAccounts")]
1387    pub service_accounts: Option<Vec<String>>,
1388    /// Name of the topic registered with the reseller.
1389    pub topic: Option<String>,
1390}
1391
1392impl common::ResponseResult for GoogleCloudChannelV1ListSubscribersResponse {}
1393
1394/// Request message for CloudChannelService.ListTransferableOffers
1395///
1396/// # Activities
1397///
1398/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1399/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1400///
1401/// * [list transferable offers accounts](AccountListTransferableOfferCall) (request)
1402#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1403#[serde_with::serde_as]
1404#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1405pub struct GoogleCloudChannelV1ListTransferableOffersRequest {
1406    /// Optional. The Billing Account to look up Offers for. Format: accounts/{account_id}/billingAccounts/{billing_account_id}. This field is only relevant for multi-currency accounts. It should be left empty for single currency accounts.
1407    #[serde(rename = "billingAccount")]
1408    pub billing_account: Option<String>,
1409    /// Customer's Cloud Identity ID
1410    #[serde(rename = "cloudIdentityId")]
1411    pub cloud_identity_id: Option<String>,
1412    /// A reseller should create a customer and use the resource name of that customer here.
1413    #[serde(rename = "customerName")]
1414    pub customer_name: Option<String>,
1415    /// Optional. The BCP-47 language code. For example, "en-US". The response will localize in the corresponding language code, if specified. The default value is "en-US".
1416    #[serde(rename = "languageCode")]
1417    pub language_code: Option<String>,
1418    /// Requested page size. Server might return fewer results than requested. If unspecified, returns at most 100 offers. The maximum value is 1000; the server will coerce values above 1000.
1419    #[serde(rename = "pageSize")]
1420    pub page_size: Option<i32>,
1421    /// A token for a page of results other than the first page. Obtained using ListTransferableOffersResponse.next_page_token of the previous CloudChannelService.ListTransferableOffers call.
1422    #[serde(rename = "pageToken")]
1423    pub page_token: Option<String>,
1424    /// Required. The SKU to look up Offers for.
1425    pub sku: Option<String>,
1426}
1427
1428impl common::RequestValue for GoogleCloudChannelV1ListTransferableOffersRequest {}
1429
1430/// Response message for CloudChannelService.ListTransferableOffers.
1431///
1432/// # Activities
1433///
1434/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1435/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1436///
1437/// * [list transferable offers accounts](AccountListTransferableOfferCall) (response)
1438#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1439#[serde_with::serde_as]
1440#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1441pub struct GoogleCloudChannelV1ListTransferableOffersResponse {
1442    /// A token to retrieve the next page of results. Pass to ListTransferableOffersRequest.page_token to obtain that page.
1443    #[serde(rename = "nextPageToken")]
1444    pub next_page_token: Option<String>,
1445    /// Information about Offers for a customer that can be used for transfer.
1446    #[serde(rename = "transferableOffers")]
1447    pub transferable_offers: Option<Vec<GoogleCloudChannelV1TransferableOffer>>,
1448}
1449
1450impl common::ResponseResult for GoogleCloudChannelV1ListTransferableOffersResponse {}
1451
1452/// Request message for CloudChannelService.ListTransferableSkus
1453///
1454/// # Activities
1455///
1456/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1457/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1458///
1459/// * [list transferable skus accounts](AccountListTransferableSkuCall) (request)
1460#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1461#[serde_with::serde_as]
1462#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1463pub struct GoogleCloudChannelV1ListTransferableSkusRequest {
1464    /// Optional. The super admin of the resold customer generates this token to authorize a reseller to access their Cloud Identity and purchase entitlements on their behalf. You can omit this token after authorization. See https://support.google.com/a/answer/7643790 for more details.
1465    #[serde(rename = "authToken")]
1466    pub auth_token: Option<String>,
1467    /// Customer's Cloud Identity ID
1468    #[serde(rename = "cloudIdentityId")]
1469    pub cloud_identity_id: Option<String>,
1470    /// A reseller is required to create a customer and use the resource name of the created customer here. Customer_name uses the format: accounts/{account_id}/customers/{customer_id}
1471    #[serde(rename = "customerName")]
1472    pub customer_name: Option<String>,
1473    /// The BCP-47 language code. For example, "en-US". The response will localize in the corresponding language code, if specified. The default value is "en-US". Optional.
1474    #[serde(rename = "languageCode")]
1475    pub language_code: Option<String>,
1476    /// The requested page size. Server might return fewer results than requested. If unspecified, returns at most 100 SKUs. The maximum value is 1000; the server will coerce values above 1000. Optional.
1477    #[serde(rename = "pageSize")]
1478    pub page_size: Option<i32>,
1479    /// A token for a page of results other than the first page. Obtained using ListTransferableSkusResponse.next_page_token of the previous CloudChannelService.ListTransferableSkus call. Optional.
1480    #[serde(rename = "pageToken")]
1481    pub page_token: Option<String>,
1482}
1483
1484impl common::RequestValue for GoogleCloudChannelV1ListTransferableSkusRequest {}
1485
1486/// Response message for CloudChannelService.ListTransferableSkus.
1487///
1488/// # Activities
1489///
1490/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1491/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1492///
1493/// * [list transferable skus accounts](AccountListTransferableSkuCall) (response)
1494#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1495#[serde_with::serde_as]
1496#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1497pub struct GoogleCloudChannelV1ListTransferableSkusResponse {
1498    /// A token to retrieve the next page of results. Pass to ListTransferableSkusRequest.page_token to obtain that page.
1499    #[serde(rename = "nextPageToken")]
1500    pub next_page_token: Option<String>,
1501    /// Information about existing SKUs for a customer that needs a transfer.
1502    #[serde(rename = "transferableSkus")]
1503    pub transferable_skus: Option<Vec<GoogleCloudChannelV1TransferableSku>>,
1504}
1505
1506impl common::ResponseResult for GoogleCloudChannelV1ListTransferableSkusResponse {}
1507
1508/// Represents the marketing information for a Product, SKU or Offer.
1509///
1510/// This type is not used in any activity, and only used as *part* of another schema.
1511///
1512#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1513#[serde_with::serde_as]
1514#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1515pub struct GoogleCloudChannelV1MarketingInfo {
1516    /// Default logo.
1517    #[serde(rename = "defaultLogo")]
1518    pub default_logo: Option<GoogleCloudChannelV1Media>,
1519    /// Human readable description. Description can contain HTML.
1520    pub description: Option<String>,
1521    /// Human readable name.
1522    #[serde(rename = "displayName")]
1523    pub display_name: Option<String>,
1524}
1525
1526impl common::Part for GoogleCloudChannelV1MarketingInfo {}
1527
1528/// Represents media information.
1529///
1530/// This type is not used in any activity, and only used as *part* of another schema.
1531///
1532#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1533#[serde_with::serde_as]
1534#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1535pub struct GoogleCloudChannelV1Media {
1536    /// URL of the media.
1537    pub content: Option<String>,
1538    /// Title of the media.
1539    pub title: Option<String>,
1540    /// Type of the media.
1541    #[serde(rename = "type")]
1542    pub type_: Option<String>,
1543}
1544
1545impl common::Part for GoogleCloudChannelV1Media {}
1546
1547/// Represents an offer made to resellers for purchase. An offer is associated with a Sku, has a plan for payment, a price, and defines the constraints for buying.
1548///
1549/// # Activities
1550///
1551/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1552/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1553///
1554/// * [customers entitlements lookup offer accounts](AccountCustomerEntitlementLookupOfferCall) (response)
1555#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1556#[serde_with::serde_as]
1557#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1558pub struct GoogleCloudChannelV1Offer {
1559    /// Constraints on transacting the Offer.
1560    pub constraints: Option<GoogleCloudChannelV1Constraints>,
1561    /// The deal code of the offer to get a special promotion or discount.
1562    #[serde(rename = "dealCode")]
1563    pub deal_code: Option<String>,
1564    /// Output only. End of the Offer validity time.
1565    #[serde(rename = "endTime")]
1566    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1567    /// Marketing information for the Offer.
1568    #[serde(rename = "marketingInfo")]
1569    pub marketing_info: Option<GoogleCloudChannelV1MarketingInfo>,
1570    /// Resource Name of the Offer. Format: accounts/{account_id}/offers/{offer_id}
1571    pub name: Option<String>,
1572    /// Parameters required to use current Offer to purchase.
1573    #[serde(rename = "parameterDefinitions")]
1574    pub parameter_definitions: Option<Vec<GoogleCloudChannelV1ParameterDefinition>>,
1575    /// Describes the payment plan for the Offer.
1576    pub plan: Option<GoogleCloudChannelV1Plan>,
1577    /// Price for each monetizable resource type.
1578    #[serde(rename = "priceByResources")]
1579    pub price_by_resources: Option<Vec<GoogleCloudChannelV1PriceByResource>>,
1580    /// SKU the offer is associated with.
1581    pub sku: Option<GoogleCloudChannelV1Sku>,
1582    /// Start of the Offer validity time.
1583    #[serde(rename = "startTime")]
1584    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1585}
1586
1587impl common::ResponseResult for GoogleCloudChannelV1Offer {}
1588
1589/// Definition for extended entitlement parameters.
1590///
1591/// This type is not used in any activity, and only used as *part* of another schema.
1592///
1593#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1594#[serde_with::serde_as]
1595#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1596pub struct GoogleCloudChannelV1Parameter {
1597    /// Output only. Specifies whether this parameter is allowed to be changed. For example, for a Google Workspace Business Starter entitlement in commitment plan, num_units is editable when entitlement is active.
1598    pub editable: Option<bool>,
1599    /// Name of the parameter.
1600    pub name: Option<String>,
1601    /// Value of the parameter.
1602    pub value: Option<GoogleCloudChannelV1Value>,
1603}
1604
1605impl common::Part for GoogleCloudChannelV1Parameter {}
1606
1607/// Parameter's definition. Specifies what parameter is required to use the current Offer to purchase.
1608///
1609/// This type is not used in any activity, and only used as *part* of another schema.
1610///
1611#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1612#[serde_with::serde_as]
1613#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1614pub struct GoogleCloudChannelV1ParameterDefinition {
1615    /// If not empty, parameter values must be drawn from this list. For example, [us-west1, us-west2, ...] Applicable to STRING parameter type.
1616    #[serde(rename = "allowedValues")]
1617    pub allowed_values: Option<Vec<GoogleCloudChannelV1Value>>,
1618    /// Maximum value of the parameter, if applicable. Inclusive. For example, maximum seats when purchasing Google Workspace Business Standard. Applicable to INT64 and DOUBLE parameter types.
1619    #[serde(rename = "maxValue")]
1620    pub max_value: Option<GoogleCloudChannelV1Value>,
1621    /// Minimal value of the parameter, if applicable. Inclusive. For example, minimal commitment when purchasing Anthos is 0.01. Applicable to INT64 and DOUBLE parameter types.
1622    #[serde(rename = "minValue")]
1623    pub min_value: Option<GoogleCloudChannelV1Value>,
1624    /// Name of the parameter.
1625    pub name: Option<String>,
1626    /// If set to true, parameter is optional to purchase this Offer.
1627    pub optional: Option<bool>,
1628    /// Data type of the parameter. Minimal value, Maximum value and allowed values will use specified data type here.
1629    #[serde(rename = "parameterType")]
1630    pub parameter_type: Option<String>,
1631}
1632
1633impl common::Part for GoogleCloudChannelV1ParameterDefinition {}
1634
1635/// An adjustment that applies a flat markup or markdown to an entire bill.
1636///
1637/// This type is not used in any activity, and only used as *part* of another schema.
1638///
1639#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1640#[serde_with::serde_as]
1641#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1642pub struct GoogleCloudChannelV1PercentageAdjustment {
1643    /// The percentage of the bill to adjust. For example: Mark down by 1% => "-1.00" Mark up by 1% => "1.00" Pass-Through => "0.00"
1644    pub percentage: Option<GoogleTypeDecimal>,
1645}
1646
1647impl common::Part for GoogleCloudChannelV1PercentageAdjustment {}
1648
1649/// Represents period in days/months/years.
1650///
1651/// This type is not used in any activity, and only used as *part* of another schema.
1652///
1653#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1654#[serde_with::serde_as]
1655#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1656pub struct GoogleCloudChannelV1Period {
1657    /// Total duration of Period Type defined.
1658    pub duration: Option<i32>,
1659    /// Period Type.
1660    #[serde(rename = "periodType")]
1661    pub period_type: Option<String>,
1662}
1663
1664impl common::Part for GoogleCloudChannelV1Period {}
1665
1666/// The payment plan for the Offer. Describes how to make a payment.
1667///
1668/// This type is not used in any activity, and only used as *part* of another schema.
1669///
1670#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1671#[serde_with::serde_as]
1672#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1673pub struct GoogleCloudChannelV1Plan {
1674    /// Reseller Billing account to charge after an offer transaction. Only present for Google Cloud offers.
1675    #[serde(rename = "billingAccount")]
1676    pub billing_account: Option<String>,
1677    /// Describes how frequently the reseller will be billed, such as once per month.
1678    #[serde(rename = "paymentCycle")]
1679    pub payment_cycle: Option<GoogleCloudChannelV1Period>,
1680    /// Describes how a reseller will be billed.
1681    #[serde(rename = "paymentPlan")]
1682    pub payment_plan: Option<String>,
1683    /// Specifies when the payment needs to happen.
1684    #[serde(rename = "paymentType")]
1685    pub payment_type: Option<String>,
1686    /// Present for Offers with a trial period. For trial-only Offers, a paid service needs to start before the trial period ends for continued service. For Regular Offers with a trial period, the regular pricing goes into effect when trial period ends, or if paid service is started before the end of the trial period.
1687    #[serde(rename = "trialPeriod")]
1688    pub trial_period: Option<GoogleCloudChannelV1Period>,
1689}
1690
1691impl common::Part for GoogleCloudChannelV1Plan {}
1692
1693/// Represents the price of the Offer.
1694///
1695/// This type is not used in any activity, and only used as *part* of another schema.
1696///
1697#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1698#[serde_with::serde_as]
1699#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1700pub struct GoogleCloudChannelV1Price {
1701    /// Base price.
1702    #[serde(rename = "basePrice")]
1703    pub base_price: Option<GoogleTypeMoney>,
1704    /// Discount percentage, represented as decimal. For example, a 20% discount will be represent as 0.2.
1705    pub discount: Option<f64>,
1706    /// Breakdown of the discount into its components. This will be empty if there is no discount present.
1707    #[serde(rename = "discountComponents")]
1708    pub discount_components: Option<Vec<GoogleCloudChannelV1DiscountComponent>>,
1709    /// Effective Price after applying the discounts.
1710    #[serde(rename = "effectivePrice")]
1711    pub effective_price: Option<GoogleTypeMoney>,
1712    /// Link to external price list, such as link to Google Voice rate card.
1713    #[serde(rename = "externalPriceUri")]
1714    pub external_price_uri: Option<String>,
1715    /// The time period with respect to which base and effective prices are defined. Example: 1 month, 6 months, 1 year, etc.
1716    #[serde(rename = "pricePeriod")]
1717    pub price_period: Option<GoogleCloudChannelV1Period>,
1718}
1719
1720impl common::Part for GoogleCloudChannelV1Price {}
1721
1722/// Represents price by resource type.
1723///
1724/// This type is not used in any activity, and only used as *part* of another schema.
1725///
1726#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1727#[serde_with::serde_as]
1728#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1729pub struct GoogleCloudChannelV1PriceByResource {
1730    /// Price of the Offer. Present if there are no price phases.
1731    pub price: Option<GoogleCloudChannelV1Price>,
1732    /// Specifies the price by time range.
1733    #[serde(rename = "pricePhases")]
1734    pub price_phases: Option<Vec<GoogleCloudChannelV1PricePhase>>,
1735    /// Resource Type. Example: SEAT
1736    #[serde(rename = "resourceType")]
1737    pub resource_type: Option<String>,
1738}
1739
1740impl common::Part for GoogleCloudChannelV1PriceByResource {}
1741
1742/// Specifies the price by the duration of months. For example, a 20% discount for the first six months, then a 10% discount starting on the seventh month.
1743///
1744/// This type is not used in any activity, and only used as *part* of another schema.
1745///
1746#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1747#[serde_with::serde_as]
1748#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1749pub struct GoogleCloudChannelV1PricePhase {
1750    /// Defines first period for the phase.
1751    #[serde(rename = "firstPeriod")]
1752    pub first_period: Option<i32>,
1753    /// Defines first period for the phase.
1754    #[serde(rename = "lastPeriod")]
1755    pub last_period: Option<i32>,
1756    /// Defines the phase period type.
1757    #[serde(rename = "periodType")]
1758    pub period_type: Option<String>,
1759    /// Price of the phase. Present if there are no price tiers.
1760    pub price: Option<GoogleCloudChannelV1Price>,
1761    /// Price by the resource tiers.
1762    #[serde(rename = "priceTiers")]
1763    pub price_tiers: Option<Vec<GoogleCloudChannelV1PriceTier>>,
1764}
1765
1766impl common::Part for GoogleCloudChannelV1PricePhase {}
1767
1768/// Defines price at resource tier level. For example, an offer with following definition : * Tier 1: Provide 25% discount for all seats between 1 and 25. * Tier 2: Provide 10% discount for all seats between 26 and 100. * Tier 3: Provide flat 15% discount for all seats above 100. Each of these tiers is represented as a PriceTier.
1769///
1770/// This type is not used in any activity, and only used as *part* of another schema.
1771///
1772#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1773#[serde_with::serde_as]
1774#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1775pub struct GoogleCloudChannelV1PriceTier {
1776    /// First resource for which the tier price applies.
1777    #[serde(rename = "firstResource")]
1778    pub first_resource: Option<i32>,
1779    /// Last resource for which the tier price applies.
1780    #[serde(rename = "lastResource")]
1781    pub last_resource: Option<i32>,
1782    /// Price of the tier.
1783    pub price: Option<GoogleCloudChannelV1Price>,
1784}
1785
1786impl common::Part for GoogleCloudChannelV1PriceTier {}
1787
1788/// A Product is the entity a customer uses when placing an order. For example, Google Workspace, Google Voice, etc.
1789///
1790/// This type is not used in any activity, and only used as *part* of another schema.
1791///
1792#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1793#[serde_with::serde_as]
1794#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1795pub struct GoogleCloudChannelV1Product {
1796    /// Marketing information for the product.
1797    #[serde(rename = "marketingInfo")]
1798    pub marketing_info: Option<GoogleCloudChannelV1MarketingInfo>,
1799    /// Resource Name of the Product. Format: products/{product_id}
1800    pub name: Option<String>,
1801}
1802
1803impl common::Part for GoogleCloudChannelV1Product {}
1804
1805/// Request message for CloudChannelService.ProvisionCloudIdentity
1806///
1807/// # Activities
1808///
1809/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1810/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1811///
1812/// * [customers provision cloud identity accounts](AccountCustomerProvisionCloudIdentityCall) (request)
1813#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1814#[serde_with::serde_as]
1815#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1816pub struct GoogleCloudChannelV1ProvisionCloudIdentityRequest {
1817    /// CloudIdentity-specific customer information.
1818    #[serde(rename = "cloudIdentityInfo")]
1819    pub cloud_identity_info: Option<GoogleCloudChannelV1CloudIdentityInfo>,
1820    /// Admin user information.
1821    pub user: Option<GoogleCloudChannelV1AdminUser>,
1822    /// Validate the request and preview the review, but do not post it.
1823    #[serde(rename = "validateOnly")]
1824    pub validate_only: Option<bool>,
1825}
1826
1827impl common::RequestValue for GoogleCloudChannelV1ProvisionCloudIdentityRequest {}
1828
1829/// Service provisioned for an entitlement.
1830///
1831/// This type is not used in any activity, and only used as *part* of another schema.
1832///
1833#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1834#[serde_with::serde_as]
1835#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1836pub struct GoogleCloudChannelV1ProvisionedService {
1837    /// Output only. The product pertaining to the provisioning resource as specified in the Offer.
1838    #[serde(rename = "productId")]
1839    pub product_id: Option<String>,
1840    /// Output only. Provisioning ID of the entitlement. For Google Workspace, this is the underlying Subscription ID. For Google Cloud, this is the Billing Account ID of the billing subaccount.
1841    #[serde(rename = "provisioningId")]
1842    pub provisioning_id: Option<String>,
1843    /// Output only. The SKU pertaining to the provisioning resource as specified in the Offer.
1844    #[serde(rename = "skuId")]
1845    pub sku_id: Option<String>,
1846}
1847
1848impl common::Part for GoogleCloudChannelV1ProvisionedService {}
1849
1850/// Offer that you can purchase for a customer. This is used in the ListPurchasableOffer API response.
1851///
1852/// This type is not used in any activity, and only used as *part* of another schema.
1853///
1854#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1855#[serde_with::serde_as]
1856#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1857pub struct GoogleCloudChannelV1PurchasableOffer {
1858    /// Offer.
1859    pub offer: Option<GoogleCloudChannelV1Offer>,
1860    /// Optional. Price reference ID for the offer. Only for offers that require additional price information. Used to guarantee that the pricing is consistent between quoting the offer and placing the order.
1861    #[serde(rename = "priceReferenceId")]
1862    pub price_reference_id: Option<String>,
1863}
1864
1865impl common::Part for GoogleCloudChannelV1PurchasableOffer {}
1866
1867/// SKU that you can purchase. This is used in ListPurchasableSku API response.
1868///
1869/// This type is not used in any activity, and only used as *part* of another schema.
1870///
1871#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1872#[serde_with::serde_as]
1873#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1874pub struct GoogleCloudChannelV1PurchasableSku {
1875    /// SKU
1876    pub sku: Option<GoogleCloudChannelV1Sku>,
1877}
1878
1879impl common::Part for GoogleCloudChannelV1PurchasableSku {}
1880
1881/// Response message for QueryEligibleBillingAccounts.
1882///
1883/// # Activities
1884///
1885/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1886/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1887///
1888/// * [customers query eligible billing accounts accounts](AccountCustomerQueryEligibleBillingAccountCall) (response)
1889#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1890#[serde_with::serde_as]
1891#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1892pub struct GoogleCloudChannelV1QueryEligibleBillingAccountsResponse {
1893    /// List of SKU purchase groups where each group represents a set of SKUs that must be purchased using the same billing account. Each SKU from [QueryEligibleBillingAccountsRequest.skus] will appear in exactly one SKU group.
1894    #[serde(rename = "skuPurchaseGroups")]
1895    pub sku_purchase_groups: Option<Vec<GoogleCloudChannelV1SkuPurchaseGroup>>,
1896}
1897
1898impl common::ResponseResult for GoogleCloudChannelV1QueryEligibleBillingAccountsResponse {}
1899
1900/// Request Message for RegisterSubscriber.
1901///
1902/// # Activities
1903///
1904/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1905/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1906///
1907/// * [register accounts](AccountRegisterCall) (request)
1908/// * [register subscriber integrators](IntegratorRegisterSubscriberCall) (request)
1909#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1910#[serde_with::serde_as]
1911#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1912pub struct GoogleCloudChannelV1RegisterSubscriberRequest {
1913    /// Optional. Resource name of the account. Required if integrator is not provided. Otherwise, leave this field empty/unset.
1914    pub account: Option<String>,
1915    /// Optional. Resource name of the integrator. Required if account is not provided. Otherwise, leave this field empty/unset.
1916    pub integrator: Option<String>,
1917    /// Required. Service account that provides subscriber access to the registered topic.
1918    #[serde(rename = "serviceAccount")]
1919    pub service_account: Option<String>,
1920}
1921
1922impl common::RequestValue for GoogleCloudChannelV1RegisterSubscriberRequest {}
1923
1924/// Response Message for RegisterSubscriber.
1925///
1926/// # Activities
1927///
1928/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1929/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1930///
1931/// * [register accounts](AccountRegisterCall) (response)
1932/// * [register subscriber integrators](IntegratorRegisterSubscriberCall) (response)
1933#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1934#[serde_with::serde_as]
1935#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1936pub struct GoogleCloudChannelV1RegisterSubscriberResponse {
1937    /// Name of the topic the subscriber will listen to.
1938    pub topic: Option<String>,
1939}
1940
1941impl common::ResponseResult for GoogleCloudChannelV1RegisterSubscriberResponse {}
1942
1943/// Renewal settings for renewable Offers.
1944///
1945/// This type is not used in any activity, and only used as *part* of another schema.
1946///
1947#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1948#[serde_with::serde_as]
1949#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1950pub struct GoogleCloudChannelV1RenewalSettings {
1951    /// If false, the plan will be completed at the end date.
1952    #[serde(rename = "enableRenewal")]
1953    pub enable_renewal: Option<bool>,
1954    /// Describes how frequently the reseller will be billed, such as once per month.
1955    #[serde(rename = "paymentCycle")]
1956    pub payment_cycle: Option<GoogleCloudChannelV1Period>,
1957    /// Describes how a reseller will be billed.
1958    #[serde(rename = "paymentPlan")]
1959    pub payment_plan: Option<String>,
1960    /// If true and enable_renewal = true, the unit (for example seats or licenses) will be set to the number of active units at renewal time.
1961    #[serde(rename = "resizeUnitCount")]
1962    pub resize_unit_count: Option<bool>,
1963}
1964
1965impl common::Part for GoogleCloudChannelV1RenewalSettings {}
1966
1967/// The ID and description of a report that was used to generate report data. For example, "Google Cloud Daily Spend", "Google Workspace License Activity", etc.
1968///
1969/// This type is not used in any activity, and only used as *part* of another schema.
1970///
1971#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1972#[serde_with::serde_as]
1973#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1974pub struct GoogleCloudChannelV1Report {
1975    /// The list of columns included in the report. This defines the schema of the report results.
1976    pub columns: Option<Vec<GoogleCloudChannelV1Column>>,
1977    /// A description of other aspects of the report, such as the products it supports.
1978    pub description: Option<String>,
1979    /// A human-readable name for this report.
1980    #[serde(rename = "displayName")]
1981    pub display_name: Option<String>,
1982    /// Required. The report's resource name. Specifies the account and report used to generate report data. The report_id identifier is a UID (for example, `613bf59q`). Name uses the format: accounts/{account_id}/reports/{report_id}
1983    pub name: Option<String>,
1984}
1985
1986impl common::Part for GoogleCloudChannelV1Report {}
1987
1988/// The features describing the data. Returned by CloudChannelReportsService.RunReportJob and CloudChannelReportsService.FetchReportResults.
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 GoogleCloudChannelV1ReportResultsMetadata {
1996    /// The date range of reported usage.
1997    #[serde(rename = "dateRange")]
1998    pub date_range: Option<GoogleCloudChannelV1DateRange>,
1999    /// The usage dates immediately preceding `date_range` with the same duration. Use this to calculate trending usage and costs. This is only populated if you request trending data. For example, if `date_range` is July 1-15, `preceding_date_range` will be June 16-30.
2000    #[serde(rename = "precedingDateRange")]
2001    pub preceding_date_range: Option<GoogleCloudChannelV1DateRange>,
2002    /// Details of the completed report.
2003    pub report: Option<GoogleCloudChannelV1Report>,
2004    /// The total number of rows of data in the final report.
2005    #[serde(rename = "rowCount")]
2006    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2007    pub row_count: Option<i64>,
2008}
2009
2010impl common::Part for GoogleCloudChannelV1ReportResultsMetadata {}
2011
2012/// A single report value.
2013///
2014/// This type is not used in any activity, and only used as *part* of another schema.
2015///
2016#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2017#[serde_with::serde_as]
2018#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2019pub struct GoogleCloudChannelV1ReportValue {
2020    /// A value of type `google.type.DateTime` (year, month, day, hour, minute, second, and UTC offset or timezone.)
2021    #[serde(rename = "dateTimeValue")]
2022    pub date_time_value: Option<GoogleTypeDateTime>,
2023    /// A value of type `google.type.Date` (year, month, day).
2024    #[serde(rename = "dateValue")]
2025    pub date_value: Option<GoogleTypeDate>,
2026    /// A value of type `google.type.Decimal`, representing non-integer numeric values.
2027    #[serde(rename = "decimalValue")]
2028    pub decimal_value: Option<GoogleTypeDecimal>,
2029    /// A value of type `int`.
2030    #[serde(rename = "intValue")]
2031    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2032    pub int_value: Option<i64>,
2033    /// A value of type `google.type.Money` (currency code, whole units, decimal units).
2034    #[serde(rename = "moneyValue")]
2035    pub money_value: Option<GoogleTypeMoney>,
2036    /// A value of type `string`.
2037    #[serde(rename = "stringValue")]
2038    pub string_value: Option<String>,
2039}
2040
2041impl common::Part for GoogleCloudChannelV1ReportValue {}
2042
2043/// A type that represents the various adjustments you can apply to a bill.
2044///
2045/// This type is not used in any activity, and only used as *part* of another schema.
2046///
2047#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2048#[serde_with::serde_as]
2049#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2050pub struct GoogleCloudChannelV1RepricingAdjustment {
2051    /// Flat markup or markdown on an entire bill.
2052    #[serde(rename = "percentageAdjustment")]
2053    pub percentage_adjustment: Option<GoogleCloudChannelV1PercentageAdjustment>,
2054}
2055
2056impl common::Part for GoogleCloudChannelV1RepricingAdjustment {}
2057
2058/// Represents the various repricing conditions you can use for a conditional override.
2059///
2060/// This type is not used in any activity, and only used as *part* of another schema.
2061///
2062#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2063#[serde_with::serde_as]
2064#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2065pub struct GoogleCloudChannelV1RepricingCondition {
2066    /// SKU Group condition for override.
2067    #[serde(rename = "skuGroupCondition")]
2068    pub sku_group_condition: Option<GoogleCloudChannelV1SkuGroupCondition>,
2069}
2070
2071impl common::Part for GoogleCloudChannelV1RepricingCondition {}
2072
2073/// Configuration for repricing a Google bill over a period of time.
2074///
2075/// This type is not used in any activity, and only used as *part* of another schema.
2076///
2077#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2078#[serde_with::serde_as]
2079#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2080pub struct GoogleCloudChannelV1RepricingConfig {
2081    /// Required. Information about the adjustment.
2082    pub adjustment: Option<GoogleCloudChannelV1RepricingAdjustment>,
2083    /// Applies the repricing configuration at the channel partner level. Only ChannelPartnerRepricingConfig supports this value. Deprecated: This is no longer supported. Use RepricingConfig.entitlement_granularity instead.
2084    #[serde(rename = "channelPartnerGranularity")]
2085    pub channel_partner_granularity:
2086        Option<GoogleCloudChannelV1RepricingConfigChannelPartnerGranularity>,
2087    /// The conditional overrides to apply for this configuration. If you list multiple overrides, only the first valid override is used. If you don't list any overrides, the API uses the normal adjustment and rebilling basis.
2088    #[serde(rename = "conditionalOverrides")]
2089    pub conditional_overrides: Option<Vec<GoogleCloudChannelV1ConditionalOverride>>,
2090    /// Required. The YearMonth when these adjustments activate. The Day field needs to be "0" since we only accept YearMonth repricing boundaries.
2091    #[serde(rename = "effectiveInvoiceMonth")]
2092    pub effective_invoice_month: Option<GoogleTypeDate>,
2093    /// Required. Applies the repricing configuration at the entitlement level. Note: If a ChannelPartnerRepricingConfig using RepricingConfig.EntitlementGranularity becomes effective, then no existing or future RepricingConfig.ChannelPartnerGranularity will apply to the RepricingConfig.EntitlementGranularity.entitlement. This is the recommended value for both CustomerRepricingConfig and ChannelPartnerRepricingConfig.
2094    #[serde(rename = "entitlementGranularity")]
2095    pub entitlement_granularity: Option<GoogleCloudChannelV1RepricingConfigEntitlementGranularity>,
2096    /// Required. The RebillingBasis to use for this bill. Specifies the relative cost based on repricing costs you will apply.
2097    #[serde(rename = "rebillingBasis")]
2098    pub rebilling_basis: Option<String>,
2099}
2100
2101impl common::Part for GoogleCloudChannelV1RepricingConfig {}
2102
2103/// Applies the repricing configuration at the channel partner level. The channel partner value is derived from the resource name. Takes an empty json object. Deprecated: This is no longer supported. Use RepricingConfig.EntitlementGranularity instead.
2104///
2105/// This type is not used in any activity, and only used as *part* of another schema.
2106///
2107#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2108#[serde_with::serde_as]
2109#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2110pub struct GoogleCloudChannelV1RepricingConfigChannelPartnerGranularity {
2111    _never_set: Option<bool>,
2112}
2113
2114impl common::Part for GoogleCloudChannelV1RepricingConfigChannelPartnerGranularity {}
2115
2116/// Applies the repricing configuration at the entitlement level.
2117///
2118/// This type is not used in any activity, and only used as *part* of another schema.
2119///
2120#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2121#[serde_with::serde_as]
2122#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2123pub struct GoogleCloudChannelV1RepricingConfigEntitlementGranularity {
2124    /// Resource name of the entitlement. Format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
2125    pub entitlement: Option<String>,
2126}
2127
2128impl common::Part for GoogleCloudChannelV1RepricingConfigEntitlementGranularity {}
2129
2130/// A row of report values.
2131///
2132/// This type is not used in any activity, and only used as *part* of another schema.
2133///
2134#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2135#[serde_with::serde_as]
2136#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2137pub struct GoogleCloudChannelV1Row {
2138    /// The key for the partition this row belongs to. This field is empty if the report is not partitioned.
2139    #[serde(rename = "partitionKey")]
2140    pub partition_key: Option<String>,
2141    /// The list of values in the row.
2142    pub values: Option<Vec<GoogleCloudChannelV1ReportValue>>,
2143}
2144
2145impl common::Part for GoogleCloudChannelV1Row {}
2146
2147/// Request message for CloudChannelReportsService.RunReportJob.
2148///
2149/// # Activities
2150///
2151/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2152/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2153///
2154/// * [reports run accounts](AccountReportRunCall) (request)
2155#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2156#[serde_with::serde_as]
2157#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2158pub struct GoogleCloudChannelV1RunReportJobRequest {
2159    /// Optional. The range of usage or invoice dates to include in the result.
2160    #[serde(rename = "dateRange")]
2161    pub date_range: Option<GoogleCloudChannelV1DateRange>,
2162    /// Optional. A structured string that defines conditions on dimension columns to restrict the report output. Filters support logical operators (AND, OR, NOT) and conditional operators (=, !=, <, >, <=, and >=) using `column_id` as keys. For example: `(customer:"accounts/C123abc/customers/S456def" OR customer:"accounts/C123abc/customers/S789ghi") AND invoice_start_date.year >= 2022`
2163    pub filter: Option<String>,
2164    /// Optional. The BCP-47 language code, such as "en-US". If specified, the response is localized to the corresponding language code if the original data sources support it. Default is "en-US".
2165    #[serde(rename = "languageCode")]
2166    pub language_code: Option<String>,
2167}
2168
2169impl common::RequestValue for GoogleCloudChannelV1RunReportJobRequest {}
2170
2171/// Represents a product's purchasable Stock Keeping Unit (SKU). SKUs represent the different variations of the product. For example, Google Workspace Business Standard and Google Workspace Business Plus are Google Workspace product SKUs.
2172///
2173/// This type is not used in any activity, and only used as *part* of another schema.
2174///
2175#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2176#[serde_with::serde_as]
2177#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2178pub struct GoogleCloudChannelV1Sku {
2179    /// Marketing information for the SKU.
2180    #[serde(rename = "marketingInfo")]
2181    pub marketing_info: Option<GoogleCloudChannelV1MarketingInfo>,
2182    /// Resource Name of the SKU. Format: products/{product_id}/skus/{sku_id}
2183    pub name: Option<String>,
2184    /// Product the SKU is associated with.
2185    pub product: Option<GoogleCloudChannelV1Product>,
2186}
2187
2188impl common::Part for GoogleCloudChannelV1Sku {}
2189
2190/// Represents the SKU group information.
2191///
2192/// This type is not used in any activity, and only used as *part* of another schema.
2193///
2194#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2195#[serde_with::serde_as]
2196#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2197pub struct GoogleCloudChannelV1SkuGroup {
2198    /// Unique human readable identifier for the SKU group.
2199    #[serde(rename = "displayName")]
2200    pub display_name: Option<String>,
2201    /// Resource name of SKU group. Format: accounts/{account}/skuGroups/{sku_group}. Example: "accounts/C01234/skuGroups/3d50fd57-3157-4577-a5a9-a219b8490041".
2202    pub name: Option<String>,
2203}
2204
2205impl common::Part for GoogleCloudChannelV1SkuGroup {}
2206
2207/// A condition that applies the override if a line item SKU is found in the SKU group.
2208///
2209/// This type is not used in any activity, and only used as *part* of another schema.
2210///
2211#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2212#[serde_with::serde_as]
2213#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2214pub struct GoogleCloudChannelV1SkuGroupCondition {
2215    /// Specifies a SKU group (https://cloud.google.com/skus/sku-groups). Resource name of SKU group. Format: accounts/{account}/skuGroups/{sku_group}. Example: "accounts/C01234/skuGroups/3d50fd57-3157-4577-a5a9-a219b8490041".
2216    #[serde(rename = "skuGroup")]
2217    pub sku_group: Option<String>,
2218}
2219
2220impl common::Part for GoogleCloudChannelV1SkuGroupCondition {}
2221
2222/// Represents a set of SKUs that must be purchased using the same billing account.
2223///
2224/// This type is not used in any activity, and only used as *part* of another schema.
2225///
2226#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2227#[serde_with::serde_as]
2228#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2229pub struct GoogleCloudChannelV1SkuPurchaseGroup {
2230    /// List of billing accounts that are eligible to purhcase these SKUs.
2231    #[serde(rename = "billingAccountPurchaseInfos")]
2232    pub billing_account_purchase_infos: Option<Vec<GoogleCloudChannelV1BillingAccountPurchaseInfo>>,
2233    /// Resource names of the SKUs included in this group. Format: products/{product_id}/skus/{sku_id}.
2234    pub skus: Option<Vec<String>>,
2235}
2236
2237impl common::Part for GoogleCloudChannelV1SkuPurchaseGroup {}
2238
2239/// Request message for CloudChannelService.StartPaidService.
2240///
2241/// # Activities
2242///
2243/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2244/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2245///
2246/// * [customers entitlements start paid service accounts](AccountCustomerEntitlementStartPaidServiceCall) (request)
2247#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2248#[serde_with::serde_as]
2249#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2250pub struct GoogleCloudChannelV1StartPaidServiceRequest {
2251    /// Optional. You can specify an optional unique request ID, and if you need to retry your request, the server will know to ignore the request if it's complete. For example, you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if it received the original operation with the same request ID. If it did, it will ignore the second request. The request ID must be a valid [UUID](https://tools.ietf.org/html/rfc4122) with the exception that zero UUID is not supported (`00000000-0000-0000-0000-000000000000`).
2252    #[serde(rename = "requestId")]
2253    pub request_id: Option<String>,
2254}
2255
2256impl common::RequestValue for GoogleCloudChannelV1StartPaidServiceRequest {}
2257
2258/// Request message for CloudChannelService.SuspendEntitlement.
2259///
2260/// # Activities
2261///
2262/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2263/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2264///
2265/// * [customers entitlements suspend accounts](AccountCustomerEntitlementSuspendCall) (request)
2266#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2267#[serde_with::serde_as]
2268#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2269pub struct GoogleCloudChannelV1SuspendEntitlementRequest {
2270    /// Optional. You can specify an optional unique request ID, and if you need to retry your request, the server will know to ignore the request if it's complete. For example, you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if it received the original operation with the same request ID. If it did, it will ignore the second request. The request ID must be a valid [UUID](https://tools.ietf.org/html/rfc4122) with the exception that zero UUID is not supported (`00000000-0000-0000-0000-000000000000`).
2271    #[serde(rename = "requestId")]
2272    pub request_id: Option<String>,
2273}
2274
2275impl common::RequestValue for GoogleCloudChannelV1SuspendEntitlementRequest {}
2276
2277/// Specifies transfer eligibility of a SKU.
2278///
2279/// This type is not used in any activity, and only used as *part* of another schema.
2280///
2281#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2282#[serde_with::serde_as]
2283#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2284pub struct GoogleCloudChannelV1TransferEligibility {
2285    /// Localized description if reseller is not eligible to transfer the SKU.
2286    pub description: Option<String>,
2287    /// Specified the reason for ineligibility.
2288    #[serde(rename = "ineligibilityReason")]
2289    pub ineligibility_reason: Option<String>,
2290    /// Whether reseller is eligible to transfer the SKU.
2291    #[serde(rename = "isEligible")]
2292    pub is_eligible: Option<bool>,
2293}
2294
2295impl common::Part for GoogleCloudChannelV1TransferEligibility {}
2296
2297/// Request message for CloudChannelService.TransferEntitlements.
2298///
2299/// # Activities
2300///
2301/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2302/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2303///
2304/// * [customers transfer entitlements accounts](AccountCustomerTransferEntitlementCall) (request)
2305#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2306#[serde_with::serde_as]
2307#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2308pub struct GoogleCloudChannelV1TransferEntitlementsRequest {
2309    /// The super admin of the resold customer generates this token to authorize a reseller to access their Cloud Identity and purchase entitlements on their behalf. You can omit this token after authorization. See https://support.google.com/a/answer/7643790 for more details.
2310    #[serde(rename = "authToken")]
2311    pub auth_token: Option<String>,
2312    /// Required. The new entitlements to create or transfer.
2313    pub entitlements: Option<Vec<GoogleCloudChannelV1Entitlement>>,
2314    /// Optional. You can specify an optional unique request ID, and if you need to retry your request, the server will know to ignore the request if it's complete. For example, you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if it received the original operation with the same request ID. If it did, it will ignore the second request. The request ID must be a valid [UUID](https://tools.ietf.org/html/rfc4122) with the exception that zero UUID is not supported (`00000000-0000-0000-0000-000000000000`).
2315    #[serde(rename = "requestId")]
2316    pub request_id: Option<String>,
2317}
2318
2319impl common::RequestValue for GoogleCloudChannelV1TransferEntitlementsRequest {}
2320
2321/// Request message for CloudChannelService.TransferEntitlementsToGoogle.
2322///
2323/// # Activities
2324///
2325/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2326/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2327///
2328/// * [customers transfer entitlements to google accounts](AccountCustomerTransferEntitlementsToGoogleCall) (request)
2329#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2330#[serde_with::serde_as]
2331#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2332pub struct GoogleCloudChannelV1TransferEntitlementsToGoogleRequest {
2333    /// Required. The entitlements to transfer to Google.
2334    pub entitlements: Option<Vec<GoogleCloudChannelV1Entitlement>>,
2335    /// Optional. You can specify an optional unique request ID, and if you need to retry your request, the server will know to ignore the request if it's complete. For example, you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if it received the original operation with the same request ID. If it did, it will ignore the second request. The request ID must be a valid [UUID](https://tools.ietf.org/html/rfc4122) with the exception that zero UUID is not supported (`00000000-0000-0000-0000-000000000000`).
2336    #[serde(rename = "requestId")]
2337    pub request_id: Option<String>,
2338}
2339
2340impl common::RequestValue for GoogleCloudChannelV1TransferEntitlementsToGoogleRequest {}
2341
2342/// TransferableOffer represents an Offer that can be used in Transfer. Read-only.
2343///
2344/// This type is not used in any activity, and only used as *part* of another schema.
2345///
2346#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2347#[serde_with::serde_as]
2348#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2349pub struct GoogleCloudChannelV1TransferableOffer {
2350    /// Offer with parameter constraints updated to allow the Transfer.
2351    pub offer: Option<GoogleCloudChannelV1Offer>,
2352    /// Optional. Price reference ID for the offer. Only for offers that require additional price information. Used to guarantee that the pricing is consistent between quoting the offer and placing the order.
2353    #[serde(rename = "priceReferenceId")]
2354    pub price_reference_id: Option<String>,
2355}
2356
2357impl common::Part for GoogleCloudChannelV1TransferableOffer {}
2358
2359/// TransferableSku represents information a reseller needs to view existing provisioned services for a customer that they do not own. Read-only.
2360///
2361/// This type is not used in any activity, and only used as *part* of another schema.
2362///
2363#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2364#[serde_with::serde_as]
2365#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2366pub struct GoogleCloudChannelV1TransferableSku {
2367    /// Optional. The customer to transfer has an entitlement with the populated legacy SKU.
2368    #[serde(rename = "legacySku")]
2369    pub legacy_sku: Option<GoogleCloudChannelV1Sku>,
2370    /// The SKU pertaining to the provisioning resource as specified in the Offer.
2371    pub sku: Option<GoogleCloudChannelV1Sku>,
2372    /// Describes the transfer eligibility of a SKU.
2373    #[serde(rename = "transferEligibility")]
2374    pub transfer_eligibility: Option<GoogleCloudChannelV1TransferEligibility>,
2375}
2376
2377impl common::Part for GoogleCloudChannelV1TransferableSku {}
2378
2379/// Settings for trial offers.
2380///
2381/// This type is not used in any activity, and only used as *part* of another schema.
2382///
2383#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2384#[serde_with::serde_as]
2385#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2386pub struct GoogleCloudChannelV1TrialSettings {
2387    /// Date when the trial ends. The value is in milliseconds using the UNIX Epoch format. See an example [Epoch converter](https://www.epochconverter.com).
2388    #[serde(rename = "endTime")]
2389    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2390    /// Determines if the entitlement is in a trial or not: * `true` - The entitlement is in trial. * `false` - The entitlement is not in trial.
2391    pub trial: Option<bool>,
2392}
2393
2394impl common::Part for GoogleCloudChannelV1TrialSettings {}
2395
2396/// Request Message for UnregisterSubscriber.
2397///
2398/// # Activities
2399///
2400/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2401/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2402///
2403/// * [unregister accounts](AccountUnregisterCall) (request)
2404/// * [unregister subscriber integrators](IntegratorUnregisterSubscriberCall) (request)
2405#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2406#[serde_with::serde_as]
2407#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2408pub struct GoogleCloudChannelV1UnregisterSubscriberRequest {
2409    /// Optional. Resource name of the account. Required if integrator is not provided. Otherwise, leave this field empty/unset.
2410    pub account: Option<String>,
2411    /// Optional. Resource name of the integrator. Required if account is not provided. Otherwise, leave this field empty/unset.
2412    pub integrator: Option<String>,
2413    /// Required. Service account to unregister from subscriber access to the topic.
2414    #[serde(rename = "serviceAccount")]
2415    pub service_account: Option<String>,
2416}
2417
2418impl common::RequestValue for GoogleCloudChannelV1UnregisterSubscriberRequest {}
2419
2420/// Response Message for UnregisterSubscriber.
2421///
2422/// # Activities
2423///
2424/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2425/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2426///
2427/// * [unregister accounts](AccountUnregisterCall) (response)
2428/// * [unregister subscriber integrators](IntegratorUnregisterSubscriberCall) (response)
2429#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2430#[serde_with::serde_as]
2431#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2432pub struct GoogleCloudChannelV1UnregisterSubscriberResponse {
2433    /// Name of the topic the service account subscriber access was removed from.
2434    pub topic: Option<String>,
2435}
2436
2437impl common::ResponseResult for GoogleCloudChannelV1UnregisterSubscriberResponse {}
2438
2439/// Request message for CloudChannelService.UpdateChannelPartnerLink
2440///
2441/// # Activities
2442///
2443/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2444/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2445///
2446/// * [channel partner links patch accounts](AccountChannelPartnerLinkPatchCall) (request)
2447#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2448#[serde_with::serde_as]
2449#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2450pub struct GoogleCloudChannelV1UpdateChannelPartnerLinkRequest {
2451    /// Required. The channel partner link to update. Only channel_partner_link.link_state is allowed for updates.
2452    #[serde(rename = "channelPartnerLink")]
2453    pub channel_partner_link: Option<GoogleCloudChannelV1ChannelPartnerLink>,
2454    /// Required. The update mask that applies to the resource. The only allowable value for an update mask is channel_partner_link.link_state.
2455    #[serde(rename = "updateMask")]
2456    pub update_mask: Option<common::FieldMask>,
2457}
2458
2459impl common::RequestValue for GoogleCloudChannelV1UpdateChannelPartnerLinkRequest {}
2460
2461/// Data type and value of a parameter.
2462///
2463/// This type is not used in any activity, and only used as *part* of another schema.
2464///
2465#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2466#[serde_with::serde_as]
2467#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2468pub struct GoogleCloudChannelV1Value {
2469    /// Represents a boolean value.
2470    #[serde(rename = "boolValue")]
2471    pub bool_value: Option<bool>,
2472    /// Represents a double value.
2473    #[serde(rename = "doubleValue")]
2474    pub double_value: Option<f64>,
2475    /// Represents an int64 value.
2476    #[serde(rename = "int64Value")]
2477    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2478    pub int64_value: Option<i64>,
2479    /// Represents an 'Any' proto value.
2480    #[serde(rename = "protoValue")]
2481    pub proto_value: Option<HashMap<String, serde_json::Value>>,
2482    /// Represents a string value.
2483    #[serde(rename = "stringValue")]
2484    pub string_value: Option<String>,
2485}
2486
2487impl common::Part for GoogleCloudChannelV1Value {}
2488
2489/// The request message for Operations.CancelOperation.
2490///
2491/// # Activities
2492///
2493/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2494/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2495///
2496/// * [cancel operations](OperationCancelCall) (request)
2497#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2498#[serde_with::serde_as]
2499#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2500pub struct GoogleLongrunningCancelOperationRequest {
2501    _never_set: Option<bool>,
2502}
2503
2504impl common::RequestValue for GoogleLongrunningCancelOperationRequest {}
2505
2506/// The response message for Operations.ListOperations.
2507///
2508/// # Activities
2509///
2510/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2511/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2512///
2513/// * [list operations](OperationListCall) (response)
2514#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2515#[serde_with::serde_as]
2516#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2517pub struct GoogleLongrunningListOperationsResponse {
2518    /// The standard List next-page token.
2519    #[serde(rename = "nextPageToken")]
2520    pub next_page_token: Option<String>,
2521    /// A list of operations that matches the specified filter in the request.
2522    pub operations: Option<Vec<GoogleLongrunningOperation>>,
2523    /// Unordered list. Unreachable resources. Populated when the request sets `ListOperationsRequest.return_partial_success` and reads across collections. For example, when attempting to list all resources across all supported locations.
2524    pub unreachable: Option<Vec<String>>,
2525}
2526
2527impl common::ResponseResult for GoogleLongrunningListOperationsResponse {}
2528
2529/// This resource represents a long-running operation that is the result of a network API call.
2530///
2531/// # Activities
2532///
2533/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2534/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2535///
2536/// * [customers entitlements activate accounts](AccountCustomerEntitlementActivateCall) (response)
2537/// * [customers entitlements cancel accounts](AccountCustomerEntitlementCancelCall) (response)
2538/// * [customers entitlements change offer accounts](AccountCustomerEntitlementChangeOfferCall) (response)
2539/// * [customers entitlements change parameters accounts](AccountCustomerEntitlementChangeParameterCall) (response)
2540/// * [customers entitlements change renewal settings accounts](AccountCustomerEntitlementChangeRenewalSettingCall) (response)
2541/// * [customers entitlements create accounts](AccountCustomerEntitlementCreateCall) (response)
2542/// * [customers entitlements start paid service accounts](AccountCustomerEntitlementStartPaidServiceCall) (response)
2543/// * [customers entitlements suspend accounts](AccountCustomerEntitlementSuspendCall) (response)
2544/// * [customers provision cloud identity accounts](AccountCustomerProvisionCloudIdentityCall) (response)
2545/// * [customers transfer entitlements accounts](AccountCustomerTransferEntitlementCall) (response)
2546/// * [customers transfer entitlements to google accounts](AccountCustomerTransferEntitlementsToGoogleCall) (response)
2547/// * [reports run accounts](AccountReportRunCall) (response)
2548/// * [get operations](OperationGetCall) (response)
2549#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2550#[serde_with::serde_as]
2551#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2552pub struct GoogleLongrunningOperation {
2553    /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
2554    pub done: Option<bool>,
2555    /// The error result of the operation in case of failure or cancellation.
2556    pub error: Option<GoogleRpcStatus>,
2557    /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
2558    pub metadata: Option<HashMap<String, serde_json::Value>>,
2559    /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
2560    pub name: Option<String>,
2561    /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
2562    pub response: Option<HashMap<String, serde_json::Value>>,
2563}
2564
2565impl common::ResponseResult for GoogleLongrunningOperation {}
2566
2567/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
2568///
2569/// # Activities
2570///
2571/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2572/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2573///
2574/// * [channel partner links channel partner repricing configs delete accounts](AccountChannelPartnerLinkChannelPartnerRepricingConfigDeleteCall) (response)
2575/// * [channel partner links customers delete accounts](AccountChannelPartnerLinkCustomerDeleteCall) (response)
2576/// * [customers customer repricing configs delete accounts](AccountCustomerCustomerRepricingConfigDeleteCall) (response)
2577/// * [customers delete accounts](AccountCustomerDeleteCall) (response)
2578/// * [cancel operations](OperationCancelCall) (response)
2579/// * [delete operations](OperationDeleteCall) (response)
2580#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2581#[serde_with::serde_as]
2582#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2583pub struct GoogleProtobufEmpty {
2584    _never_set: Option<bool>,
2585}
2586
2587impl common::ResponseResult for GoogleProtobufEmpty {}
2588
2589/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
2590///
2591/// This type is not used in any activity, and only used as *part* of another schema.
2592///
2593#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2594#[serde_with::serde_as]
2595#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2596pub struct GoogleRpcStatus {
2597    /// The status code, which should be an enum value of google.rpc.Code.
2598    pub code: Option<i32>,
2599    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
2600    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
2601    /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
2602    pub message: Option<String>,
2603}
2604
2605impl common::Part for GoogleRpcStatus {}
2606
2607/// Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
2608///
2609/// This type is not used in any activity, and only used as *part* of another schema.
2610///
2611#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2612#[serde_with::serde_as]
2613#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2614pub struct GoogleTypeDate {
2615    /// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
2616    pub day: Option<i32>,
2617    /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
2618    pub month: Option<i32>,
2619    /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
2620    pub year: Option<i32>,
2621}
2622
2623impl common::Part for GoogleTypeDate {}
2624
2625/// Represents civil time (or occasionally physical time). This type can represent a civil time in one of a few possible ways: * When utc_offset is set and time_zone is unset: a civil time on a calendar day with a particular offset from UTC. * When time_zone is set and utc_offset is unset: a civil time on a calendar day in a particular time zone. * When neither time_zone nor utc_offset is set: a civil time on a calendar day in local time. The date is relative to the Proleptic Gregorian Calendar. If year, month, or day are 0, the DateTime is considered not to have a specific year, month, or day respectively. This type may also be used to represent a physical time if all the date and time fields are set and either case of the `time_offset` oneof is set. Consider using `Timestamp` message for physical time instead. If your use case also would like to store the user's timezone, that can be done in another field. This type is more flexible than some applications may want. Make sure to document and validate your application's limitations.
2626///
2627/// This type is not used in any activity, and only used as *part* of another schema.
2628///
2629#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2630#[serde_with::serde_as]
2631#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2632pub struct GoogleTypeDateTime {
2633    /// Optional. Day of month. Must be from 1 to 31 and valid for the year and month, or 0 if specifying a datetime without a day.
2634    pub day: Option<i32>,
2635    /// Optional. Hours of day in 24 hour format. Should be from 0 to 23, defaults to 0 (midnight). An API may choose to allow the value "24:00:00" for scenarios like business closing time.
2636    pub hours: Option<i32>,
2637    /// Optional. Minutes of hour of day. Must be from 0 to 59, defaults to 0.
2638    pub minutes: Option<i32>,
2639    /// Optional. Month of year. Must be from 1 to 12, or 0 if specifying a datetime without a month.
2640    pub month: Option<i32>,
2641    /// Optional. Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999, defaults to 0.
2642    pub nanos: Option<i32>,
2643    /// Optional. Seconds of minutes of the time. Must normally be from 0 to 59, defaults to 0. An API may allow the value 60 if it allows leap-seconds.
2644    pub seconds: Option<i32>,
2645    /// Time zone.
2646    #[serde(rename = "timeZone")]
2647    pub time_zone: Option<GoogleTypeTimeZone>,
2648    /// UTC offset. Must be whole seconds, between -18 hours and +18 hours. For example, a UTC offset of -4:00 would be represented as { seconds: -14400 }.
2649    #[serde(rename = "utcOffset")]
2650    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2651    pub utc_offset: Option<chrono::Duration>,
2652    /// Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a datetime without a year.
2653    pub year: Option<i32>,
2654}
2655
2656impl common::Part for GoogleTypeDateTime {}
2657
2658/// A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html) or Python's [decimal.Decimal](https://docs.python.org/3/library/decimal.html).
2659///
2660/// This type is not used in any activity, and only used as *part* of another schema.
2661///
2662#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2663#[serde_with::serde_as]
2664#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2665pub struct GoogleTypeDecimal {
2666    /// The decimal value, as a string. The string representation consists of an optional sign, `+` (`U+002B`) or `-` (`U+002D`), followed by a sequence of zero or more decimal digits ("the integer"), optionally followed by a fraction, optionally followed by an exponent. An empty string **should** be interpreted as `0`. The fraction consists of a decimal point followed by zero or more decimal digits. The string must contain at least one digit in either the integer or the fraction. The number formed by the sign, the integer and the fraction is referred to as the significand. The exponent consists of the character `e` (`U+0065`) or `E` (`U+0045`) followed by one or more decimal digits. Services **should** normalize decimal values before storing them by: - Removing an explicitly-provided `+` sign (`+2.5` -> `2.5`). - Replacing a zero-length integer value with `0` (`.5` -> `0.5`). - Coercing the exponent character to upper-case, with explicit sign (`2.5e8` -> `2.5E+8`). - Removing an explicitly-provided zero exponent (`2.5E0` -> `2.5`). Services **may** perform additional normalization based on its own needs and the internal decimal implementation selected, such as shifting the decimal point and exponent value together (example: `2.5E-1` <-> `0.25`). Additionally, services **may** preserve trailing zeroes in the fraction to indicate increased precision, but are not required to do so. Note that only the `.` character is supported to divide the integer and the fraction; `,` **should not** be supported regardless of locale. Additionally, thousand separators **should not** be supported. If a service does support them, values **must** be normalized. The ENBF grammar is: DecimalString = '' | [Sign] Significand [Exponent]; Sign = '+' | '-'; Significand = Digits '.' | [Digits] '.' Digits; Exponent = ('e' | 'E') [Sign] Digits; Digits = { '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' }; Services **should** clearly document the range of supported values, the maximum supported precision (total number of digits), and, if applicable, the scale (number of digits after the decimal point), as well as how it behaves when receiving out-of-bounds values. Services **may** choose to accept values passed as input even when the value has a higher precision or scale than the service supports, and **should** round the value to fit the supported scale. Alternatively, the service **may** error with `400 Bad Request` (`INVALID_ARGUMENT` in gRPC) if precision would be lost. Services **should** error with `400 Bad Request` (`INVALID_ARGUMENT` in gRPC) if the service receives a value outside of the supported range.
2667    pub value: Option<String>,
2668}
2669
2670impl common::Part for GoogleTypeDecimal {}
2671
2672/// Represents an amount of money with its currency type.
2673///
2674/// This type is not used in any activity, and only used as *part* of another schema.
2675///
2676#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2677#[serde_with::serde_as]
2678#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2679pub struct GoogleTypeMoney {
2680    /// The three-letter currency code defined in ISO 4217.
2681    #[serde(rename = "currencyCode")]
2682    pub currency_code: Option<String>,
2683    /// Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If `units` is positive, `nanos` must be positive or zero. If `units` is zero, `nanos` can be positive, zero, or negative. If `units` is negative, `nanos` must be negative or zero. For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
2684    pub nanos: Option<i32>,
2685    /// The whole units of the amount. For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
2686    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2687    pub units: Option<i64>,
2688}
2689
2690impl common::Part for GoogleTypeMoney {}
2691
2692/// Represents a postal address, such as for postal delivery or payments addresses. With a postal address, a postal service can deliver items to a premise, P.O. box, or similar. A postal address is not intended to model geographical locations like roads, towns, or mountains. In typical usage, an address would be created by user input or from importing existing data, depending on the type of process. Advice on address input or editing: - Use an internationalization-ready address widget such as https://github.com/google/libaddressinput. - Users should not be presented with UI elements for input or editing of fields outside countries where that field is used. For more guidance on how to use this schema, see: https://support.google.com/business/answer/6397478.
2693///
2694/// This type is not used in any activity, and only used as *part* of another schema.
2695///
2696#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2697#[serde_with::serde_as]
2698#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2699pub struct GoogleTypePostalAddress {
2700    /// Unstructured address lines describing the lower levels of an address. Because values in `address_lines` do not have type information and may sometimes contain multiple values in a single field (for example, "Austin, TX"), it is important that the line order is clear. The order of address lines should be "envelope order" for the country or region of the address. In places where this can vary (for example, Japan), `address_language` is used to make it explicit (for example, "ja" for large-to-small ordering and "ja-Latn" or "en" for small-to-large). In this way, the most specific line of an address can be selected based on the language. The minimum permitted structural representation of an address consists of a `region_code` with all remaining information placed in the `address_lines`. It would be possible to format such an address very approximately without geocoding, but no semantic reasoning could be made about any of the address components until it was at least partially resolved. Creating an address only containing a `region_code` and `address_lines` and then geocoding is the recommended way to handle completely unstructured addresses (as opposed to guessing which parts of the address should be localities or administrative areas).
2701    #[serde(rename = "addressLines")]
2702    pub address_lines: Option<Vec<String>>,
2703    /// Optional. Highest administrative subdivision which is used for postal addresses of a country or region. For example, this can be a state, a province, an oblast, or a prefecture. For Spain, this is the province and not the autonomous community (for example, "Barcelona" and not "Catalonia"). Many countries don't use an administrative area in postal addresses. For example, in Switzerland, this should be left unpopulated.
2704    #[serde(rename = "administrativeArea")]
2705    pub administrative_area: Option<String>,
2706    /// Optional. BCP-47 language code of the contents of this address (if known). This is often the UI language of the input form or is expected to match one of the languages used in the address' country/region, or their transliterated equivalents. This can affect formatting in certain countries, but is not critical to the correctness of the data and will never affect any validation or other non-formatting related operations. If this value is not known, it should be omitted (rather than specifying a possibly incorrect default). Examples: "zh-Hant", "ja", "ja-Latn", "en".
2707    #[serde(rename = "languageCode")]
2708    pub language_code: Option<String>,
2709    /// Optional. Generally refers to the city or town portion of the address. Examples: US city, IT comune, UK post town. In regions of the world where localities are not well defined or do not fit into this structure well, leave `locality` empty and use `address_lines`.
2710    pub locality: Option<String>,
2711    /// Optional. The name of the organization at the address.
2712    pub organization: Option<String>,
2713    /// Optional. Postal code of the address. Not all countries use or require postal codes to be present, but where they are used, they may trigger additional validation with other parts of the address (for example, state or zip code validation in the United States).
2714    #[serde(rename = "postalCode")]
2715    pub postal_code: Option<String>,
2716    /// Optional. The recipient at the address. This field may, under certain circumstances, contain multiline information. For example, it might contain "care of" information.
2717    pub recipients: Option<Vec<String>>,
2718    /// Required. CLDR region code of the country/region of the address. This is never inferred and it is up to the user to ensure the value is correct. See https://cldr.unicode.org/ and https://www.unicode.org/cldr/charts/30/supplemental/territory_information.html for details. Example: "CH" for Switzerland.
2719    #[serde(rename = "regionCode")]
2720    pub region_code: Option<String>,
2721    /// The schema revision of the `PostalAddress`. This must be set to 0, which is the latest revision. All new revisions **must** be backward compatible with old revisions.
2722    pub revision: Option<i32>,
2723    /// Optional. Additional, country-specific, sorting code. This is not used in most regions. Where it is used, the value is either a string like "CEDEX", optionally followed by a number (for example, "CEDEX 7"), or just a number alone, representing the "sector code" (Jamaica), "delivery area indicator" (Malawi) or "post office indicator" (Côte d'Ivoire).
2724    #[serde(rename = "sortingCode")]
2725    pub sorting_code: Option<String>,
2726    /// Optional. Sublocality of the address. For example, this can be a neighborhood, borough, or district.
2727    pub sublocality: Option<String>,
2728}
2729
2730impl common::Part for GoogleTypePostalAddress {}
2731
2732/// Represents a time zone from the [IANA Time Zone Database](https://www.iana.org/time-zones).
2733///
2734/// This type is not used in any activity, and only used as *part* of another schema.
2735///
2736#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2737#[serde_with::serde_as]
2738#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2739pub struct GoogleTypeTimeZone {
2740    /// IANA Time Zone Database time zone. For example "America/New_York".
2741    pub id: Option<String>,
2742    /// Optional. IANA Time Zone Database version number. For example "2019a".
2743    pub version: Option<String>,
2744}
2745
2746impl common::Part for GoogleTypeTimeZone {}
2747
2748// ###################
2749// MethodBuilders ###
2750// #################
2751
2752/// A builder providing access to all methods supported on *account* resources.
2753/// It is not used directly, but through the [`Cloudchannel`] hub.
2754///
2755/// # Example
2756///
2757/// Instantiate a resource builder
2758///
2759/// ```test_harness,no_run
2760/// extern crate hyper;
2761/// extern crate hyper_rustls;
2762/// extern crate google_cloudchannel1 as cloudchannel1;
2763///
2764/// # async fn dox() {
2765/// use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2766///
2767/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2768/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2769///     .with_native_roots()
2770///     .unwrap()
2771///     .https_only()
2772///     .enable_http2()
2773///     .build();
2774///
2775/// let executor = hyper_util::rt::TokioExecutor::new();
2776/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2777///     secret,
2778///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2779///     yup_oauth2::client::CustomHyperClientBuilder::from(
2780///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2781///     ),
2782/// ).build().await.unwrap();
2783///
2784/// let client = hyper_util::client::legacy::Client::builder(
2785///     hyper_util::rt::TokioExecutor::new()
2786/// )
2787/// .build(
2788///     hyper_rustls::HttpsConnectorBuilder::new()
2789///         .with_native_roots()
2790///         .unwrap()
2791///         .https_or_http()
2792///         .enable_http2()
2793///         .build()
2794/// );
2795/// let mut hub = Cloudchannel::new(client, auth);
2796/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2797/// // like `channel_partner_links_channel_partner_repricing_configs_create(...)`, `channel_partner_links_channel_partner_repricing_configs_delete(...)`, `channel_partner_links_channel_partner_repricing_configs_get(...)`, `channel_partner_links_channel_partner_repricing_configs_list(...)`, `channel_partner_links_channel_partner_repricing_configs_patch(...)`, `channel_partner_links_create(...)`, `channel_partner_links_customers_create(...)`, `channel_partner_links_customers_delete(...)`, `channel_partner_links_customers_get(...)`, `channel_partner_links_customers_import(...)`, `channel_partner_links_customers_list(...)`, `channel_partner_links_customers_patch(...)`, `channel_partner_links_get(...)`, `channel_partner_links_list(...)`, `channel_partner_links_patch(...)`, `check_cloud_identity_accounts_exist(...)`, `customers_create(...)`, `customers_customer_repricing_configs_create(...)`, `customers_customer_repricing_configs_delete(...)`, `customers_customer_repricing_configs_get(...)`, `customers_customer_repricing_configs_list(...)`, `customers_customer_repricing_configs_patch(...)`, `customers_delete(...)`, `customers_entitlements_activate(...)`, `customers_entitlements_cancel(...)`, `customers_entitlements_change_offer(...)`, `customers_entitlements_change_parameters(...)`, `customers_entitlements_change_renewal_settings(...)`, `customers_entitlements_create(...)`, `customers_entitlements_get(...)`, `customers_entitlements_list(...)`, `customers_entitlements_list_entitlement_changes(...)`, `customers_entitlements_lookup_offer(...)`, `customers_entitlements_start_paid_service(...)`, `customers_entitlements_suspend(...)`, `customers_get(...)`, `customers_import(...)`, `customers_list(...)`, `customers_list_purchasable_offers(...)`, `customers_list_purchasable_skus(...)`, `customers_patch(...)`, `customers_provision_cloud_identity(...)`, `customers_query_eligible_billing_accounts(...)`, `customers_transfer_entitlements(...)`, `customers_transfer_entitlements_to_google(...)`, `list_subscribers(...)`, `list_transferable_offers(...)`, `list_transferable_skus(...)`, `offers_list(...)`, `register(...)`, `report_jobs_fetch_report_results(...)`, `reports_list(...)`, `reports_run(...)`, `sku_groups_billable_skus_list(...)`, `sku_groups_list(...)` and `unregister(...)`
2798/// // to build up your call.
2799/// let rb = hub.accounts();
2800/// # }
2801/// ```
2802pub struct AccountMethods<'a, C>
2803where
2804    C: 'a,
2805{
2806    hub: &'a Cloudchannel<C>,
2807}
2808
2809impl<'a, C> common::MethodsBuilder for AccountMethods<'a, C> {}
2810
2811impl<'a, C> AccountMethods<'a, C> {
2812    /// Create a builder to help you perform the following task:
2813    ///
2814    /// Creates a ChannelPartnerRepricingConfig. Call this method to set modifications for a specific ChannelPartner's bill. You can only create configs if the RepricingConfig.effective_invoice_month is a future month. If needed, you can create a config for the current month, with some restrictions. When creating a config for a future month, make sure there are no existing configs for that RepricingConfig.effective_invoice_month. The following restrictions are for creating configs in the current month. * This functionality is reserved for recovering from an erroneous config, and should not be used for regular business cases. * The new config will not modify exports used with other configs. Changes to the config may be immediate, but may take up to 24 hours. * There is a limit of ten configs for any ChannelPartner or RepricingConfig.EntitlementGranularity.entitlement, for any RepricingConfig.effective_invoice_month. * The contained ChannelPartnerRepricingConfig.repricing_config value must be different from the value used in the current config for a ChannelPartner. Possible Error Codes: * PERMISSION_DENIED: If the account making the request and the account being queried are different. * INVALID_ARGUMENT: Missing or invalid required parameters in the request. Also displays if the updated config is for the current month or past months. * NOT_FOUND: The ChannelPartnerRepricingConfig specified does not exist or is not associated with the given account. * INTERNAL: Any non-user error related to technical issues in the backend. In this case, contact Cloud Channel support. Return Value: If successful, the updated ChannelPartnerRepricingConfig resource, otherwise returns an error.
2815    ///
2816    /// # Arguments
2817    ///
2818    /// * `request` - No description provided.
2819    /// * `parent` - Required. The resource name of the ChannelPartner that will receive the repricing config. Parent uses the format: accounts/{account_id}/channelPartnerLinks/{channel_partner_id}
2820    pub fn channel_partner_links_channel_partner_repricing_configs_create(
2821        &self,
2822        request: GoogleCloudChannelV1ChannelPartnerRepricingConfig,
2823        parent: &str,
2824    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigCreateCall<'a, C> {
2825        AccountChannelPartnerLinkChannelPartnerRepricingConfigCreateCall {
2826            hub: self.hub,
2827            _request: request,
2828            _parent: parent.to_string(),
2829            _delegate: Default::default(),
2830            _additional_params: Default::default(),
2831            _scopes: Default::default(),
2832        }
2833    }
2834
2835    /// Create a builder to help you perform the following task:
2836    ///
2837    /// Deletes the given ChannelPartnerRepricingConfig permanently. You can only delete configs if their RepricingConfig.effective_invoice_month is set to a date after the current month. Possible error codes: * PERMISSION_DENIED: The account making the request does not own this customer. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * FAILED_PRECONDITION: The ChannelPartnerRepricingConfig is active or in the past. * NOT_FOUND: No ChannelPartnerRepricingConfig found for the name in the request.
2838    ///
2839    /// # Arguments
2840    ///
2841    /// * `name` - Required. The resource name of the channel partner repricing config rule to delete.
2842    pub fn channel_partner_links_channel_partner_repricing_configs_delete(
2843        &self,
2844        name: &str,
2845    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigDeleteCall<'a, C> {
2846        AccountChannelPartnerLinkChannelPartnerRepricingConfigDeleteCall {
2847            hub: self.hub,
2848            _name: name.to_string(),
2849            _delegate: Default::default(),
2850            _additional_params: Default::default(),
2851            _scopes: Default::default(),
2852        }
2853    }
2854
2855    /// Create a builder to help you perform the following task:
2856    ///
2857    /// Gets information about how a Distributor modifies their bill before sending it to a ChannelPartner. Possible Error Codes: * PERMISSION_DENIED: If the account making the request and the account being queried are different. * NOT_FOUND: The ChannelPartnerRepricingConfig was not found. * INTERNAL: Any non-user error related to technical issues in the backend. In this case, contact Cloud Channel support. Return Value: If successful, the ChannelPartnerRepricingConfig resource, otherwise returns an error.
2858    ///
2859    /// # Arguments
2860    ///
2861    /// * `name` - Required. The resource name of the ChannelPartnerRepricingConfig Format: accounts/{account_id}/channelPartnerLinks/{channel_partner_id}/channelPartnerRepricingConfigs/{id}.
2862    pub fn channel_partner_links_channel_partner_repricing_configs_get(
2863        &self,
2864        name: &str,
2865    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigGetCall<'a, C> {
2866        AccountChannelPartnerLinkChannelPartnerRepricingConfigGetCall {
2867            hub: self.hub,
2868            _name: name.to_string(),
2869            _delegate: Default::default(),
2870            _additional_params: Default::default(),
2871            _scopes: Default::default(),
2872        }
2873    }
2874
2875    /// Create a builder to help you perform the following task:
2876    ///
2877    /// Lists information about how a Reseller modifies their bill before sending it to a ChannelPartner. Possible Error Codes: * PERMISSION_DENIED: If the account making the request and the account being queried are different. * NOT_FOUND: The ChannelPartnerRepricingConfig specified does not exist or is not associated with the given account. * INTERNAL: Any non-user error related to technical issues in the backend. In this case, contact Cloud Channel support. Return Value: If successful, the ChannelPartnerRepricingConfig resources. The data for each resource is displayed in the ascending order of: * Channel Partner ID * RepricingConfig.effective_invoice_month * ChannelPartnerRepricingConfig.update_time If unsuccessful, returns an error.
2878    ///
2879    /// # Arguments
2880    ///
2881    /// * `parent` - Required. The resource name of the account's ChannelPartnerLink. Parent uses the format: accounts/{account_id}/channelPartnerLinks/{channel_partner_id}. Supports accounts/{account_id}/channelPartnerLinks/- to retrieve configs for all channel partners.
2882    pub fn channel_partner_links_channel_partner_repricing_configs_list(
2883        &self,
2884        parent: &str,
2885    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigListCall<'a, C> {
2886        AccountChannelPartnerLinkChannelPartnerRepricingConfigListCall {
2887            hub: self.hub,
2888            _parent: parent.to_string(),
2889            _page_token: Default::default(),
2890            _page_size: Default::default(),
2891            _filter: Default::default(),
2892            _delegate: Default::default(),
2893            _additional_params: Default::default(),
2894            _scopes: Default::default(),
2895        }
2896    }
2897
2898    /// Create a builder to help you perform the following task:
2899    ///
2900    /// Updates a ChannelPartnerRepricingConfig. Call this method to set modifications for a specific ChannelPartner's bill. This method overwrites the existing CustomerRepricingConfig. You can only update configs if the RepricingConfig.effective_invoice_month is a future month. To make changes to configs for the current month, use CreateChannelPartnerRepricingConfig, taking note of its restrictions. You cannot update the RepricingConfig.effective_invoice_month. When updating a config in the future: * This config must already exist. Possible Error Codes: * PERMISSION_DENIED: If the account making the request and the account being queried are different. * INVALID_ARGUMENT: Missing or invalid required parameters in the request. Also displays if the updated config is for the current month or past months. * NOT_FOUND: The ChannelPartnerRepricingConfig specified does not exist or is not associated with the given account. * INTERNAL: Any non-user error related to technical issues in the backend. In this case, contact Cloud Channel support. Return Value: If successful, the updated ChannelPartnerRepricingConfig resource, otherwise returns an error.
2901    ///
2902    /// # Arguments
2903    ///
2904    /// * `request` - No description provided.
2905    /// * `name` - Output only. Resource name of the ChannelPartnerRepricingConfig. Format: accounts/{account_id}/channelPartnerLinks/{channel_partner_id}/channelPartnerRepricingConfigs/{id}.
2906    pub fn channel_partner_links_channel_partner_repricing_configs_patch(
2907        &self,
2908        request: GoogleCloudChannelV1ChannelPartnerRepricingConfig,
2909        name: &str,
2910    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigPatchCall<'a, C> {
2911        AccountChannelPartnerLinkChannelPartnerRepricingConfigPatchCall {
2912            hub: self.hub,
2913            _request: request,
2914            _name: name.to_string(),
2915            _delegate: Default::default(),
2916            _additional_params: Default::default(),
2917            _scopes: Default::default(),
2918        }
2919    }
2920
2921    /// Create a builder to help you perform the following task:
2922    ///
2923    /// Creates a new Customer resource under the reseller or distributor account. Possible error codes: * PERMISSION_DENIED: * The reseller account making the request is different from the reseller account in the API request. * You are not authorized to create a customer. See https://support.google.com/channelservices/answer/9759265 * INVALID_ARGUMENT: * Required request parameters are missing or invalid. * Domain field value doesn't match the primary email domain. Return value: The newly created Customer resource.
2924    ///
2925    /// # Arguments
2926    ///
2927    /// * `request` - No description provided.
2928    /// * `parent` - Required. The resource name of reseller account in which to create the customer. Parent uses the format: accounts/{account_id}
2929    pub fn channel_partner_links_customers_create(
2930        &self,
2931        request: GoogleCloudChannelV1Customer,
2932        parent: &str,
2933    ) -> AccountChannelPartnerLinkCustomerCreateCall<'a, C> {
2934        AccountChannelPartnerLinkCustomerCreateCall {
2935            hub: self.hub,
2936            _request: request,
2937            _parent: parent.to_string(),
2938            _delegate: Default::default(),
2939            _additional_params: Default::default(),
2940            _scopes: Default::default(),
2941        }
2942    }
2943
2944    /// Create a builder to help you perform the following task:
2945    ///
2946    /// Deletes the given Customer permanently. Possible error codes: * PERMISSION_DENIED: The account making the request does not own this customer. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * FAILED_PRECONDITION: The customer has existing entitlements. * NOT_FOUND: No Customer resource found for the name in the request.
2947    ///
2948    /// # Arguments
2949    ///
2950    /// * `name` - Required. The resource name of the customer to delete.
2951    pub fn channel_partner_links_customers_delete(
2952        &self,
2953        name: &str,
2954    ) -> AccountChannelPartnerLinkCustomerDeleteCall<'a, C> {
2955        AccountChannelPartnerLinkCustomerDeleteCall {
2956            hub: self.hub,
2957            _name: name.to_string(),
2958            _delegate: Default::default(),
2959            _additional_params: Default::default(),
2960            _scopes: Default::default(),
2961        }
2962    }
2963
2964    /// Create a builder to help you perform the following task:
2965    ///
2966    /// Returns the requested Customer resource. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The customer resource doesn't exist. Usually the result of an invalid name parameter. Return value: The Customer resource.
2967    ///
2968    /// # Arguments
2969    ///
2970    /// * `name` - Required. The resource name of the customer to retrieve. Name uses the format: accounts/{account_id}/customers/{customer_id}
2971    pub fn channel_partner_links_customers_get(
2972        &self,
2973        name: &str,
2974    ) -> AccountChannelPartnerLinkCustomerGetCall<'a, C> {
2975        AccountChannelPartnerLinkCustomerGetCall {
2976            hub: self.hub,
2977            _name: name.to_string(),
2978            _delegate: Default::default(),
2979            _additional_params: Default::default(),
2980            _scopes: Default::default(),
2981        }
2982    }
2983
2984    /// Create a builder to help you perform the following task:
2985    ///
2986    /// Imports a Customer from the Cloud Identity associated with the provided Cloud Identity ID or domain before a TransferEntitlements call. If a linked Customer already exists and overwrite_if_exists is true, it will update that Customer's data. Possible error codes: * PERMISSION_DENIED: * The reseller account making the request is different from the reseller account in the API request. * You are not authorized to import the customer. See https://support.google.com/channelservices/answer/9759265 * NOT_FOUND: Cloud Identity doesn't exist or was deleted. * INVALID_ARGUMENT: Required parameters are missing, or the auth_token is expired or invalid. * ALREADY_EXISTS: A customer already exists and has conflicting critical fields. Requires an overwrite. Return value: The Customer.
2987    ///
2988    /// # Arguments
2989    ///
2990    /// * `request` - No description provided.
2991    /// * `parent` - Required. The resource name of the reseller's account. Parent takes the format: accounts/{account_id} or accounts/{account_id}/channelPartnerLinks/{channel_partner_id}
2992    pub fn channel_partner_links_customers_import(
2993        &self,
2994        request: GoogleCloudChannelV1ImportCustomerRequest,
2995        parent: &str,
2996    ) -> AccountChannelPartnerLinkCustomerImportCall<'a, C> {
2997        AccountChannelPartnerLinkCustomerImportCall {
2998            hub: self.hub,
2999            _request: request,
3000            _parent: parent.to_string(),
3001            _delegate: Default::default(),
3002            _additional_params: Default::default(),
3003            _scopes: Default::default(),
3004        }
3005    }
3006
3007    /// Create a builder to help you perform the following task:
3008    ///
3009    /// List Customers. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. Return value: List of Customers, or an empty list if there are no customers.
3010    ///
3011    /// # Arguments
3012    ///
3013    /// * `parent` - Required. The resource name of the reseller account to list customers from. Parent uses the format: accounts/{account_id}.
3014    pub fn channel_partner_links_customers_list(
3015        &self,
3016        parent: &str,
3017    ) -> AccountChannelPartnerLinkCustomerListCall<'a, C> {
3018        AccountChannelPartnerLinkCustomerListCall {
3019            hub: self.hub,
3020            _parent: parent.to_string(),
3021            _page_token: Default::default(),
3022            _page_size: Default::default(),
3023            _filter: Default::default(),
3024            _delegate: Default::default(),
3025            _additional_params: Default::default(),
3026            _scopes: Default::default(),
3027        }
3028    }
3029
3030    /// Create a builder to help you perform the following task:
3031    ///
3032    /// Updates an existing Customer resource for the reseller or distributor. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: No Customer resource found for the name in the request. Return value: The updated Customer resource.
3033    ///
3034    /// # Arguments
3035    ///
3036    /// * `request` - No description provided.
3037    /// * `name` - Output only. Resource name of the customer. Format: accounts/{account_id}/customers/{customer_id}
3038    pub fn channel_partner_links_customers_patch(
3039        &self,
3040        request: GoogleCloudChannelV1Customer,
3041        name: &str,
3042    ) -> AccountChannelPartnerLinkCustomerPatchCall<'a, C> {
3043        AccountChannelPartnerLinkCustomerPatchCall {
3044            hub: self.hub,
3045            _request: request,
3046            _name: name.to_string(),
3047            _update_mask: Default::default(),
3048            _delegate: Default::default(),
3049            _additional_params: Default::default(),
3050            _scopes: Default::default(),
3051        }
3052    }
3053
3054    /// Create a builder to help you perform the following task:
3055    ///
3056    /// Initiates a channel partner link between a distributor and a reseller, or between resellers in an n-tier reseller channel. Invited partners need to follow the invite_link_uri provided in the response to accept. After accepting the invitation, a link is set up between the two parties. You must be a distributor to call this method. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * ALREADY_EXISTS: The ChannelPartnerLink sent in the request already exists. * NOT_FOUND: No Cloud Identity customer exists for provided domain. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The new ChannelPartnerLink resource.
3057    ///
3058    /// # Arguments
3059    ///
3060    /// * `request` - No description provided.
3061    /// * `parent` - Required. Create a channel partner link for the provided reseller account's resource name. Parent uses the format: accounts/{account_id}
3062    pub fn channel_partner_links_create(
3063        &self,
3064        request: GoogleCloudChannelV1ChannelPartnerLink,
3065        parent: &str,
3066    ) -> AccountChannelPartnerLinkCreateCall<'a, C> {
3067        AccountChannelPartnerLinkCreateCall {
3068            hub: self.hub,
3069            _request: request,
3070            _parent: parent.to_string(),
3071            _delegate: Default::default(),
3072            _additional_params: Default::default(),
3073            _scopes: Default::default(),
3074        }
3075    }
3076
3077    /// Create a builder to help you perform the following task:
3078    ///
3079    /// Returns the requested ChannelPartnerLink resource. You must be a distributor to call this method. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: ChannelPartnerLink resource not found because of an invalid channel partner link name. Return value: The ChannelPartnerLink resource.
3080    ///
3081    /// # Arguments
3082    ///
3083    /// * `name` - Required. The resource name of the channel partner link to retrieve. Name uses the format: accounts/{account_id}/channelPartnerLinks/{id} where {id} is the Cloud Identity ID of the partner.
3084    pub fn channel_partner_links_get(&self, name: &str) -> AccountChannelPartnerLinkGetCall<'a, C> {
3085        AccountChannelPartnerLinkGetCall {
3086            hub: self.hub,
3087            _name: name.to_string(),
3088            _view: Default::default(),
3089            _delegate: Default::default(),
3090            _additional_params: Default::default(),
3091            _scopes: Default::default(),
3092        }
3093    }
3094
3095    /// Create a builder to help you perform the following task:
3096    ///
3097    /// List ChannelPartnerLinks belonging to a distributor. You must be a distributor to call this method. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. Return value: The list of the distributor account's ChannelPartnerLink resources.
3098    ///
3099    /// # Arguments
3100    ///
3101    /// * `parent` - Required. The resource name of the reseller account for listing channel partner links. Parent uses the format: accounts/{account_id}
3102    pub fn channel_partner_links_list(
3103        &self,
3104        parent: &str,
3105    ) -> AccountChannelPartnerLinkListCall<'a, C> {
3106        AccountChannelPartnerLinkListCall {
3107            hub: self.hub,
3108            _parent: parent.to_string(),
3109            _view: Default::default(),
3110            _page_token: Default::default(),
3111            _page_size: Default::default(),
3112            _delegate: Default::default(),
3113            _additional_params: Default::default(),
3114            _scopes: Default::default(),
3115        }
3116    }
3117
3118    /// Create a builder to help you perform the following task:
3119    ///
3120    /// Updates a channel partner link. Distributors call this method to change a link's status. For example, to suspend a partner link. You must be a distributor to call this method. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: * Required request parameters are missing or invalid. * Link state cannot change from invited to active or suspended. * Cannot send reseller_cloud_identity_id, invite_url, or name in update mask. * NOT_FOUND: ChannelPartnerLink resource not found. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The updated ChannelPartnerLink resource.
3121    ///
3122    /// # Arguments
3123    ///
3124    /// * `request` - No description provided.
3125    /// * `name` - Required. The resource name of the channel partner link to cancel. Name uses the format: accounts/{account_id}/channelPartnerLinks/{id} where {id} is the Cloud Identity ID of the partner.
3126    pub fn channel_partner_links_patch(
3127        &self,
3128        request: GoogleCloudChannelV1UpdateChannelPartnerLinkRequest,
3129        name: &str,
3130    ) -> AccountChannelPartnerLinkPatchCall<'a, C> {
3131        AccountChannelPartnerLinkPatchCall {
3132            hub: self.hub,
3133            _request: request,
3134            _name: name.to_string(),
3135            _delegate: Default::default(),
3136            _additional_params: Default::default(),
3137            _scopes: Default::default(),
3138        }
3139    }
3140
3141    /// Create a builder to help you perform the following task:
3142    ///
3143    /// Creates a CustomerRepricingConfig. Call this method to set modifications for a specific customer's bill. You can only create configs if the RepricingConfig.effective_invoice_month is a future month. If needed, you can create a config for the current month, with some restrictions. When creating a config for a future month, make sure there are no existing configs for that RepricingConfig.effective_invoice_month. The following restrictions are for creating configs in the current month. * This functionality is reserved for recovering from an erroneous config, and should not be used for regular business cases. * The new config will not modify exports used with other configs. Changes to the config may be immediate, but may take up to 24 hours. * There is a limit of ten configs for any RepricingConfig.EntitlementGranularity.entitlement, for any RepricingConfig.effective_invoice_month. * The contained CustomerRepricingConfig.repricing_config value must be different from the value used in the current config for a RepricingConfig.EntitlementGranularity.entitlement. Possible Error Codes: * PERMISSION_DENIED: If the account making the request and the account being queried are different. * INVALID_ARGUMENT: Missing or invalid required parameters in the request. Also displays if the updated config is for the current month or past months. * NOT_FOUND: The CustomerRepricingConfig specified does not exist or is not associated with the given account. * INTERNAL: Any non-user error related to technical issues in the backend. In this case, contact Cloud Channel support. Return Value: If successful, the updated CustomerRepricingConfig resource, otherwise returns an error.
3144    ///
3145    /// # Arguments
3146    ///
3147    /// * `request` - No description provided.
3148    /// * `parent` - Required. The resource name of the customer that will receive this repricing config. Parent uses the format: accounts/{account_id}/customers/{customer_id}
3149    pub fn customers_customer_repricing_configs_create(
3150        &self,
3151        request: GoogleCloudChannelV1CustomerRepricingConfig,
3152        parent: &str,
3153    ) -> AccountCustomerCustomerRepricingConfigCreateCall<'a, C> {
3154        AccountCustomerCustomerRepricingConfigCreateCall {
3155            hub: self.hub,
3156            _request: request,
3157            _parent: parent.to_string(),
3158            _delegate: Default::default(),
3159            _additional_params: Default::default(),
3160            _scopes: Default::default(),
3161        }
3162    }
3163
3164    /// Create a builder to help you perform the following task:
3165    ///
3166    /// Deletes the given CustomerRepricingConfig permanently. You can only delete configs if their RepricingConfig.effective_invoice_month is set to a date after the current month. Possible error codes: * PERMISSION_DENIED: The account making the request does not own this customer. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * FAILED_PRECONDITION: The CustomerRepricingConfig is active or in the past. * NOT_FOUND: No CustomerRepricingConfig found for the name in the request.
3167    ///
3168    /// # Arguments
3169    ///
3170    /// * `name` - Required. The resource name of the customer repricing config rule to delete. Format: accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}.
3171    pub fn customers_customer_repricing_configs_delete(
3172        &self,
3173        name: &str,
3174    ) -> AccountCustomerCustomerRepricingConfigDeleteCall<'a, C> {
3175        AccountCustomerCustomerRepricingConfigDeleteCall {
3176            hub: self.hub,
3177            _name: name.to_string(),
3178            _delegate: Default::default(),
3179            _additional_params: Default::default(),
3180            _scopes: Default::default(),
3181        }
3182    }
3183
3184    /// Create a builder to help you perform the following task:
3185    ///
3186    /// Gets information about how a Reseller modifies their bill before sending it to a Customer. Possible Error Codes: * PERMISSION_DENIED: If the account making the request and the account being queried are different. * NOT_FOUND: The CustomerRepricingConfig was not found. * INTERNAL: Any non-user error related to technical issues in the backend. In this case, contact Cloud Channel support. Return Value: If successful, the CustomerRepricingConfig resource, otherwise returns an error.
3187    ///
3188    /// # Arguments
3189    ///
3190    /// * `name` - Required. The resource name of the CustomerRepricingConfig. Format: accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}.
3191    pub fn customers_customer_repricing_configs_get(
3192        &self,
3193        name: &str,
3194    ) -> AccountCustomerCustomerRepricingConfigGetCall<'a, C> {
3195        AccountCustomerCustomerRepricingConfigGetCall {
3196            hub: self.hub,
3197            _name: name.to_string(),
3198            _delegate: Default::default(),
3199            _additional_params: Default::default(),
3200            _scopes: Default::default(),
3201        }
3202    }
3203
3204    /// Create a builder to help you perform the following task:
3205    ///
3206    /// Lists information about how a Reseller modifies their bill before sending it to a Customer. Possible Error Codes: * PERMISSION_DENIED: If the account making the request and the account being queried are different. * NOT_FOUND: The CustomerRepricingConfig specified does not exist or is not associated with the given account. * INTERNAL: Any non-user error related to technical issues in the backend. In this case, contact Cloud Channel support. Return Value: If successful, the CustomerRepricingConfig resources. The data for each resource is displayed in the ascending order of: * Customer ID * RepricingConfig.EntitlementGranularity.entitlement * RepricingConfig.effective_invoice_month * CustomerRepricingConfig.update_time If unsuccessful, returns an error.
3207    ///
3208    /// # Arguments
3209    ///
3210    /// * `parent` - Required. The resource name of the customer. Parent uses the format: accounts/{account_id}/customers/{customer_id}. Supports accounts/{account_id}/customers/- to retrieve configs for all customers.
3211    pub fn customers_customer_repricing_configs_list(
3212        &self,
3213        parent: &str,
3214    ) -> AccountCustomerCustomerRepricingConfigListCall<'a, C> {
3215        AccountCustomerCustomerRepricingConfigListCall {
3216            hub: self.hub,
3217            _parent: parent.to_string(),
3218            _page_token: Default::default(),
3219            _page_size: Default::default(),
3220            _filter: Default::default(),
3221            _delegate: Default::default(),
3222            _additional_params: Default::default(),
3223            _scopes: Default::default(),
3224        }
3225    }
3226
3227    /// Create a builder to help you perform the following task:
3228    ///
3229    /// Updates a CustomerRepricingConfig. Call this method to set modifications for a specific customer's bill. This method overwrites the existing CustomerRepricingConfig. You can only update configs if the RepricingConfig.effective_invoice_month is a future month. To make changes to configs for the current month, use CreateCustomerRepricingConfig, taking note of its restrictions. You cannot update the RepricingConfig.effective_invoice_month. When updating a config in the future: * This config must already exist. Possible Error Codes: * PERMISSION_DENIED: If the account making the request and the account being queried are different. * INVALID_ARGUMENT: Missing or invalid required parameters in the request. Also displays if the updated config is for the current month or past months. * NOT_FOUND: The CustomerRepricingConfig specified does not exist or is not associated with the given account. * INTERNAL: Any non-user error related to technical issues in the backend. In this case, contact Cloud Channel support. Return Value: If successful, the updated CustomerRepricingConfig resource, otherwise returns an error.
3230    ///
3231    /// # Arguments
3232    ///
3233    /// * `request` - No description provided.
3234    /// * `name` - Output only. Resource name of the CustomerRepricingConfig. Format: accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}.
3235    pub fn customers_customer_repricing_configs_patch(
3236        &self,
3237        request: GoogleCloudChannelV1CustomerRepricingConfig,
3238        name: &str,
3239    ) -> AccountCustomerCustomerRepricingConfigPatchCall<'a, C> {
3240        AccountCustomerCustomerRepricingConfigPatchCall {
3241            hub: self.hub,
3242            _request: request,
3243            _name: name.to_string(),
3244            _delegate: Default::default(),
3245            _additional_params: Default::default(),
3246            _scopes: Default::default(),
3247        }
3248    }
3249
3250    /// Create a builder to help you perform the following task:
3251    ///
3252    /// Activates a previously suspended entitlement. Entitlements suspended for pending ToS acceptance can't be activated using this method. An entitlement activation is a long-running operation and it updates the state of the customer entitlement. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: Entitlement resource not found. * SUSPENSION_NOT_RESELLER_INITIATED: Can only activate reseller-initiated suspensions and entitlements that have accepted the TOS. * NOT_SUSPENDED: Can only activate suspended entitlements not in an ACTIVE state. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata will contain an instance of OperationMetadata.
3253    ///
3254    /// # Arguments
3255    ///
3256    /// * `request` - No description provided.
3257    /// * `name` - Required. The resource name of the entitlement to activate. Name uses the format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
3258    pub fn customers_entitlements_activate(
3259        &self,
3260        request: GoogleCloudChannelV1ActivateEntitlementRequest,
3261        name: &str,
3262    ) -> AccountCustomerEntitlementActivateCall<'a, C> {
3263        AccountCustomerEntitlementActivateCall {
3264            hub: self.hub,
3265            _request: request,
3266            _name: name.to_string(),
3267            _delegate: Default::default(),
3268            _additional_params: Default::default(),
3269            _scopes: Default::default(),
3270        }
3271    }
3272
3273    /// Create a builder to help you perform the following task:
3274    ///
3275    /// Cancels a previously fulfilled entitlement. An entitlement cancellation is a long-running operation. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * FAILED_PRECONDITION: There are Google Cloud projects linked to the Google Cloud entitlement's Cloud Billing subaccount. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: Entitlement resource not found. * DELETION_TYPE_NOT_ALLOWED: Cancel is only allowed for Google Workspace add-ons, or entitlements for Google Cloud's development platform. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The response will contain google.protobuf.Empty on success. The Operation metadata will contain an instance of OperationMetadata.
3276    ///
3277    /// # Arguments
3278    ///
3279    /// * `request` - No description provided.
3280    /// * `name` - Required. The resource name of the entitlement to cancel. Name uses the format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
3281    pub fn customers_entitlements_cancel(
3282        &self,
3283        request: GoogleCloudChannelV1CancelEntitlementRequest,
3284        name: &str,
3285    ) -> AccountCustomerEntitlementCancelCall<'a, C> {
3286        AccountCustomerEntitlementCancelCall {
3287            hub: self.hub,
3288            _request: request,
3289            _name: name.to_string(),
3290            _delegate: Default::default(),
3291            _additional_params: Default::default(),
3292            _scopes: Default::default(),
3293        }
3294    }
3295
3296    /// Create a builder to help you perform the following task:
3297    ///
3298    /// Updates the Offer for an existing customer entitlement. An entitlement update is a long-running operation and it updates the entitlement as a result of fulfillment. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: Offer or Entitlement resource not found. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata will contain an instance of OperationMetadata.
3299    ///
3300    /// # Arguments
3301    ///
3302    /// * `request` - No description provided.
3303    /// * `name` - Required. The resource name of the entitlement to update. Name uses the format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
3304    pub fn customers_entitlements_change_offer(
3305        &self,
3306        request: GoogleCloudChannelV1ChangeOfferRequest,
3307        name: &str,
3308    ) -> AccountCustomerEntitlementChangeOfferCall<'a, C> {
3309        AccountCustomerEntitlementChangeOfferCall {
3310            hub: self.hub,
3311            _request: request,
3312            _name: name.to_string(),
3313            _delegate: Default::default(),
3314            _additional_params: Default::default(),
3315            _scopes: Default::default(),
3316        }
3317    }
3318
3319    /// Create a builder to help you perform the following task:
3320    ///
3321    /// Change parameters of the entitlement. An entitlement update is a long-running operation and it updates the entitlement as a result of fulfillment. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. For example, the number of seats being changed is greater than the allowed number of max seats, or decreasing seats for a commitment based plan. * NOT_FOUND: Entitlement resource not found. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata will contain an instance of OperationMetadata.
3322    ///
3323    /// # Arguments
3324    ///
3325    /// * `request` - No description provided.
3326    /// * `name` - Required. The name of the entitlement to update. Name uses the format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
3327    pub fn customers_entitlements_change_parameters(
3328        &self,
3329        request: GoogleCloudChannelV1ChangeParametersRequest,
3330        name: &str,
3331    ) -> AccountCustomerEntitlementChangeParameterCall<'a, C> {
3332        AccountCustomerEntitlementChangeParameterCall {
3333            hub: self.hub,
3334            _request: request,
3335            _name: name.to_string(),
3336            _delegate: Default::default(),
3337            _additional_params: Default::default(),
3338            _scopes: Default::default(),
3339        }
3340    }
3341
3342    /// Create a builder to help you perform the following task:
3343    ///
3344    /// Updates the renewal settings for an existing customer entitlement. An entitlement update is a long-running operation and it updates the entitlement as a result of fulfillment. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: Entitlement resource not found. * NOT_COMMITMENT_PLAN: Renewal Settings are only applicable for a commitment plan. Can't enable or disable renewals for non-commitment plans. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata will contain an instance of OperationMetadata.
3345    ///
3346    /// # Arguments
3347    ///
3348    /// * `request` - No description provided.
3349    /// * `name` - Required. The name of the entitlement to update. Name uses the format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
3350    pub fn customers_entitlements_change_renewal_settings(
3351        &self,
3352        request: GoogleCloudChannelV1ChangeRenewalSettingsRequest,
3353        name: &str,
3354    ) -> AccountCustomerEntitlementChangeRenewalSettingCall<'a, C> {
3355        AccountCustomerEntitlementChangeRenewalSettingCall {
3356            hub: self.hub,
3357            _request: request,
3358            _name: name.to_string(),
3359            _delegate: Default::default(),
3360            _additional_params: Default::default(),
3361            _scopes: Default::default(),
3362        }
3363    }
3364
3365    /// Create a builder to help you perform the following task:
3366    ///
3367    /// Creates an entitlement for a customer. Possible error codes: * PERMISSION_DENIED: * The customer doesn't belong to the reseller. * The reseller is not authorized to transact on this Product. See https://support.google.com/channelservices/answer/9759265 * INVALID_ARGUMENT: * Required request parameters are missing or invalid. * There is already a customer entitlement for a SKU from the same product family. * INVALID_VALUE: Make sure the OfferId is valid. If it is, contact Google Channel support for further troubleshooting. * NOT_FOUND: The customer or offer resource was not found. * ALREADY_EXISTS: * The SKU was already purchased for the customer. * The customer's primary email already exists. Retry after changing the customer's primary contact email. * CONDITION_NOT_MET or FAILED_PRECONDITION: * The domain required for purchasing a SKU has not been verified. * A pre-requisite SKU required to purchase an Add-On SKU is missing. For example, Google Workspace Business Starter is required to purchase Vault or Drive. * (Developer accounts only) Reseller and resold domain must meet the following naming requirements: * Domain names must start with goog-test. * Domain names must include the reseller domain. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata will contain an instance of OperationMetadata.
3368    ///
3369    /// # Arguments
3370    ///
3371    /// * `request` - No description provided.
3372    /// * `parent` - Required. The resource name of the reseller's customer account in which to create the entitlement. Parent uses the format: accounts/{account_id}/customers/{customer_id}
3373    pub fn customers_entitlements_create(
3374        &self,
3375        request: GoogleCloudChannelV1CreateEntitlementRequest,
3376        parent: &str,
3377    ) -> AccountCustomerEntitlementCreateCall<'a, C> {
3378        AccountCustomerEntitlementCreateCall {
3379            hub: self.hub,
3380            _request: request,
3381            _parent: parent.to_string(),
3382            _delegate: Default::default(),
3383            _additional_params: Default::default(),
3384            _scopes: Default::default(),
3385        }
3386    }
3387
3388    /// Create a builder to help you perform the following task:
3389    ///
3390    /// Returns the requested Entitlement resource. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The customer entitlement was not found. Return value: The requested Entitlement resource.
3391    ///
3392    /// # Arguments
3393    ///
3394    /// * `name` - Required. The resource name of the entitlement to retrieve. Name uses the format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
3395    pub fn customers_entitlements_get(
3396        &self,
3397        name: &str,
3398    ) -> AccountCustomerEntitlementGetCall<'a, C> {
3399        AccountCustomerEntitlementGetCall {
3400            hub: self.hub,
3401            _name: name.to_string(),
3402            _delegate: Default::default(),
3403            _additional_params: Default::default(),
3404            _scopes: Default::default(),
3405        }
3406    }
3407
3408    /// Create a builder to help you perform the following task:
3409    ///
3410    /// Lists Entitlements belonging to a customer. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. Return value: A list of the customer's Entitlements.
3411    ///
3412    /// # Arguments
3413    ///
3414    /// * `parent` - Required. The resource name of the reseller's customer account to list entitlements for. Parent uses the format: accounts/{account_id}/customers/{customer_id}
3415    pub fn customers_entitlements_list(
3416        &self,
3417        parent: &str,
3418    ) -> AccountCustomerEntitlementListCall<'a, C> {
3419        AccountCustomerEntitlementListCall {
3420            hub: self.hub,
3421            _parent: parent.to_string(),
3422            _page_token: Default::default(),
3423            _page_size: Default::default(),
3424            _delegate: Default::default(),
3425            _additional_params: Default::default(),
3426            _scopes: Default::default(),
3427        }
3428    }
3429
3430    /// Create a builder to help you perform the following task:
3431    ///
3432    /// List entitlement history. Possible error codes: * PERMISSION_DENIED: The reseller account making the request and the provided reseller account are different. * INVALID_ARGUMENT: Missing or invalid required fields in the request. * NOT_FOUND: The parent resource doesn't exist. Usually the result of an invalid name parameter. * INTERNAL: Any non-user error related to a technical issue in the backend. In this case, contact CloudChannel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. In this case, contact Cloud Channel support. Return value: List of EntitlementChanges.
3433    ///
3434    /// # Arguments
3435    ///
3436    /// * `parent` - Required. The resource name of the entitlement for which to list entitlement changes. The `-` wildcard may be used to match entitlements across a customer. Formats: * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} * accounts/{account_id}/customers/{customer_id}/entitlements/-
3437    pub fn customers_entitlements_list_entitlement_changes(
3438        &self,
3439        parent: &str,
3440    ) -> AccountCustomerEntitlementListEntitlementChangeCall<'a, C> {
3441        AccountCustomerEntitlementListEntitlementChangeCall {
3442            hub: self.hub,
3443            _parent: parent.to_string(),
3444            _page_token: Default::default(),
3445            _page_size: Default::default(),
3446            _filter: Default::default(),
3447            _delegate: Default::default(),
3448            _additional_params: Default::default(),
3449            _scopes: Default::default(),
3450        }
3451    }
3452
3453    /// Create a builder to help you perform the following task:
3454    ///
3455    /// Returns the requested Offer resource. Possible error codes: * PERMISSION_DENIED: The entitlement doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: Entitlement or offer was not found. Return value: The Offer resource.
3456    ///
3457    /// # Arguments
3458    ///
3459    /// * `entitlement` - Required. The resource name of the entitlement to retrieve the Offer. Entitlement uses the format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
3460    pub fn customers_entitlements_lookup_offer(
3461        &self,
3462        entitlement: &str,
3463    ) -> AccountCustomerEntitlementLookupOfferCall<'a, C> {
3464        AccountCustomerEntitlementLookupOfferCall {
3465            hub: self.hub,
3466            _entitlement: entitlement.to_string(),
3467            _delegate: Default::default(),
3468            _additional_params: Default::default(),
3469            _scopes: Default::default(),
3470        }
3471    }
3472
3473    /// Create a builder to help you perform the following task:
3474    ///
3475    /// Starts paid service for a trial entitlement. Starts paid service for a trial entitlement immediately. This method is only applicable if a plan is set up for a trial entitlement but has some trial days remaining. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: Entitlement resource not found. * FAILED_PRECONDITION/NOT_IN_TRIAL: This method only works for entitlement on trial plans. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata will contain an instance of OperationMetadata.
3476    ///
3477    /// # Arguments
3478    ///
3479    /// * `request` - No description provided.
3480    /// * `name` - Required. The name of the entitlement to start a paid service for. Name uses the format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
3481    pub fn customers_entitlements_start_paid_service(
3482        &self,
3483        request: GoogleCloudChannelV1StartPaidServiceRequest,
3484        name: &str,
3485    ) -> AccountCustomerEntitlementStartPaidServiceCall<'a, C> {
3486        AccountCustomerEntitlementStartPaidServiceCall {
3487            hub: self.hub,
3488            _request: request,
3489            _name: name.to_string(),
3490            _delegate: Default::default(),
3491            _additional_params: Default::default(),
3492            _scopes: Default::default(),
3493        }
3494    }
3495
3496    /// Create a builder to help you perform the following task:
3497    ///
3498    /// Suspends a previously fulfilled entitlement. An entitlement suspension is a long-running operation. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: Entitlement resource not found. * NOT_ACTIVE: Entitlement is not active. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata will contain an instance of OperationMetadata.
3499    ///
3500    /// # Arguments
3501    ///
3502    /// * `request` - No description provided.
3503    /// * `name` - Required. The resource name of the entitlement to suspend. Name uses the format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
3504    pub fn customers_entitlements_suspend(
3505        &self,
3506        request: GoogleCloudChannelV1SuspendEntitlementRequest,
3507        name: &str,
3508    ) -> AccountCustomerEntitlementSuspendCall<'a, C> {
3509        AccountCustomerEntitlementSuspendCall {
3510            hub: self.hub,
3511            _request: request,
3512            _name: name.to_string(),
3513            _delegate: Default::default(),
3514            _additional_params: Default::default(),
3515            _scopes: Default::default(),
3516        }
3517    }
3518
3519    /// Create a builder to help you perform the following task:
3520    ///
3521    /// Creates a new Customer resource under the reseller or distributor account. Possible error codes: * PERMISSION_DENIED: * The reseller account making the request is different from the reseller account in the API request. * You are not authorized to create a customer. See https://support.google.com/channelservices/answer/9759265 * INVALID_ARGUMENT: * Required request parameters are missing or invalid. * Domain field value doesn't match the primary email domain. Return value: The newly created Customer resource.
3522    ///
3523    /// # Arguments
3524    ///
3525    /// * `request` - No description provided.
3526    /// * `parent` - Required. The resource name of reseller account in which to create the customer. Parent uses the format: accounts/{account_id}
3527    pub fn customers_create(
3528        &self,
3529        request: GoogleCloudChannelV1Customer,
3530        parent: &str,
3531    ) -> AccountCustomerCreateCall<'a, C> {
3532        AccountCustomerCreateCall {
3533            hub: self.hub,
3534            _request: request,
3535            _parent: parent.to_string(),
3536            _delegate: Default::default(),
3537            _additional_params: Default::default(),
3538            _scopes: Default::default(),
3539        }
3540    }
3541
3542    /// Create a builder to help you perform the following task:
3543    ///
3544    /// Deletes the given Customer permanently. Possible error codes: * PERMISSION_DENIED: The account making the request does not own this customer. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * FAILED_PRECONDITION: The customer has existing entitlements. * NOT_FOUND: No Customer resource found for the name in the request.
3545    ///
3546    /// # Arguments
3547    ///
3548    /// * `name` - Required. The resource name of the customer to delete.
3549    pub fn customers_delete(&self, name: &str) -> AccountCustomerDeleteCall<'a, C> {
3550        AccountCustomerDeleteCall {
3551            hub: self.hub,
3552            _name: name.to_string(),
3553            _delegate: Default::default(),
3554            _additional_params: Default::default(),
3555            _scopes: Default::default(),
3556        }
3557    }
3558
3559    /// Create a builder to help you perform the following task:
3560    ///
3561    /// Returns the requested Customer resource. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The customer resource doesn't exist. Usually the result of an invalid name parameter. Return value: The Customer resource.
3562    ///
3563    /// # Arguments
3564    ///
3565    /// * `name` - Required. The resource name of the customer to retrieve. Name uses the format: accounts/{account_id}/customers/{customer_id}
3566    pub fn customers_get(&self, name: &str) -> AccountCustomerGetCall<'a, C> {
3567        AccountCustomerGetCall {
3568            hub: self.hub,
3569            _name: name.to_string(),
3570            _delegate: Default::default(),
3571            _additional_params: Default::default(),
3572            _scopes: Default::default(),
3573        }
3574    }
3575
3576    /// Create a builder to help you perform the following task:
3577    ///
3578    /// Imports a Customer from the Cloud Identity associated with the provided Cloud Identity ID or domain before a TransferEntitlements call. If a linked Customer already exists and overwrite_if_exists is true, it will update that Customer's data. Possible error codes: * PERMISSION_DENIED: * The reseller account making the request is different from the reseller account in the API request. * You are not authorized to import the customer. See https://support.google.com/channelservices/answer/9759265 * NOT_FOUND: Cloud Identity doesn't exist or was deleted. * INVALID_ARGUMENT: Required parameters are missing, or the auth_token is expired or invalid. * ALREADY_EXISTS: A customer already exists and has conflicting critical fields. Requires an overwrite. Return value: The Customer.
3579    ///
3580    /// # Arguments
3581    ///
3582    /// * `request` - No description provided.
3583    /// * `parent` - Required. The resource name of the reseller's account. Parent takes the format: accounts/{account_id} or accounts/{account_id}/channelPartnerLinks/{channel_partner_id}
3584    pub fn customers_import(
3585        &self,
3586        request: GoogleCloudChannelV1ImportCustomerRequest,
3587        parent: &str,
3588    ) -> AccountCustomerImportCall<'a, C> {
3589        AccountCustomerImportCall {
3590            hub: self.hub,
3591            _request: request,
3592            _parent: parent.to_string(),
3593            _delegate: Default::default(),
3594            _additional_params: Default::default(),
3595            _scopes: Default::default(),
3596        }
3597    }
3598
3599    /// Create a builder to help you perform the following task:
3600    ///
3601    /// List Customers. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. Return value: List of Customers, or an empty list if there are no customers.
3602    ///
3603    /// # Arguments
3604    ///
3605    /// * `parent` - Required. The resource name of the reseller account to list customers from. Parent uses the format: accounts/{account_id}.
3606    pub fn customers_list(&self, parent: &str) -> AccountCustomerListCall<'a, C> {
3607        AccountCustomerListCall {
3608            hub: self.hub,
3609            _parent: parent.to_string(),
3610            _page_token: Default::default(),
3611            _page_size: Default::default(),
3612            _filter: Default::default(),
3613            _delegate: Default::default(),
3614            _additional_params: Default::default(),
3615            _scopes: Default::default(),
3616        }
3617    }
3618
3619    /// Create a builder to help you perform the following task:
3620    ///
3621    /// Lists the following: * Offers that you can purchase for a customer. * Offers that you can change for an entitlement. Possible error codes: * PERMISSION_DENIED: * The customer doesn't belong to the reseller * The reseller is not authorized to transact on this Product. See https://support.google.com/channelservices/answer/9759265 * INVALID_ARGUMENT: Required request parameters are missing or invalid.
3622    ///
3623    /// # Arguments
3624    ///
3625    /// * `customer` - Required. The resource name of the customer to list Offers for. Format: accounts/{account_id}/customers/{customer_id}.
3626    pub fn customers_list_purchasable_offers(
3627        &self,
3628        customer: &str,
3629    ) -> AccountCustomerListPurchasableOfferCall<'a, C> {
3630        AccountCustomerListPurchasableOfferCall {
3631            hub: self.hub,
3632            _customer: customer.to_string(),
3633            _page_token: Default::default(),
3634            _page_size: Default::default(),
3635            _language_code: Default::default(),
3636            _create_entitlement_purchase_sku: Default::default(),
3637            _create_entitlement_purchase_billing_account: Default::default(),
3638            _change_offer_purchase_new_sku: Default::default(),
3639            _change_offer_purchase_entitlement: Default::default(),
3640            _change_offer_purchase_billing_account: Default::default(),
3641            _delegate: Default::default(),
3642            _additional_params: Default::default(),
3643            _scopes: Default::default(),
3644        }
3645    }
3646
3647    /// Create a builder to help you perform the following task:
3648    ///
3649    /// Lists the following: * SKUs that you can purchase for a customer * SKUs that you can upgrade or downgrade for an entitlement. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid.
3650    ///
3651    /// # Arguments
3652    ///
3653    /// * `customer` - Required. The resource name of the customer to list SKUs for. Format: accounts/{account_id}/customers/{customer_id}.
3654    pub fn customers_list_purchasable_skus(
3655        &self,
3656        customer: &str,
3657    ) -> AccountCustomerListPurchasableSkuCall<'a, C> {
3658        AccountCustomerListPurchasableSkuCall {
3659            hub: self.hub,
3660            _customer: customer.to_string(),
3661            _page_token: Default::default(),
3662            _page_size: Default::default(),
3663            _language_code: Default::default(),
3664            _create_entitlement_purchase_product: Default::default(),
3665            _change_offer_purchase_entitlement: Default::default(),
3666            _change_offer_purchase_change_type: Default::default(),
3667            _delegate: Default::default(),
3668            _additional_params: Default::default(),
3669            _scopes: Default::default(),
3670        }
3671    }
3672
3673    /// Create a builder to help you perform the following task:
3674    ///
3675    /// Updates an existing Customer resource for the reseller or distributor. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: No Customer resource found for the name in the request. Return value: The updated Customer resource.
3676    ///
3677    /// # Arguments
3678    ///
3679    /// * `request` - No description provided.
3680    /// * `name` - Output only. Resource name of the customer. Format: accounts/{account_id}/customers/{customer_id}
3681    pub fn customers_patch(
3682        &self,
3683        request: GoogleCloudChannelV1Customer,
3684        name: &str,
3685    ) -> AccountCustomerPatchCall<'a, C> {
3686        AccountCustomerPatchCall {
3687            hub: self.hub,
3688            _request: request,
3689            _name: name.to_string(),
3690            _update_mask: Default::default(),
3691            _delegate: Default::default(),
3692            _additional_params: Default::default(),
3693            _scopes: Default::default(),
3694        }
3695    }
3696
3697    /// Create a builder to help you perform the following task:
3698    ///
3699    /// Creates a Cloud Identity for the given customer using the customer's information, or the information provided here. Possible error codes: * PERMISSION_DENIED: * The customer doesn't belong to the reseller. * You are not authorized to provision cloud identity id. See https://support.google.com/channelservices/answer/9759265 * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The customer was not found. * ALREADY_EXISTS: The customer's primary email already exists. Retry after changing the customer's primary contact email. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata contains an instance of OperationMetadata.
3700    ///
3701    /// # Arguments
3702    ///
3703    /// * `request` - No description provided.
3704    /// * `customer` - Required. Resource name of the customer. Format: accounts/{account_id}/customers/{customer_id}
3705    pub fn customers_provision_cloud_identity(
3706        &self,
3707        request: GoogleCloudChannelV1ProvisionCloudIdentityRequest,
3708        customer: &str,
3709    ) -> AccountCustomerProvisionCloudIdentityCall<'a, C> {
3710        AccountCustomerProvisionCloudIdentityCall {
3711            hub: self.hub,
3712            _request: request,
3713            _customer: customer.to_string(),
3714            _delegate: Default::default(),
3715            _additional_params: Default::default(),
3716            _scopes: Default::default(),
3717        }
3718    }
3719
3720    /// Create a builder to help you perform the following task:
3721    ///
3722    /// Lists the billing accounts that are eligible to purchase particular SKUs for a given customer. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. Return value: Based on the provided list of SKUs, returns a list of SKU groups that must be purchased using the same billing account and the billing accounts eligible to purchase each SKU group.
3723    ///
3724    /// # Arguments
3725    ///
3726    /// * `customer` - Required. The resource name of the customer to list eligible billing accounts for. Format: accounts/{account_id}/customers/{customer_id}.
3727    pub fn customers_query_eligible_billing_accounts(
3728        &self,
3729        customer: &str,
3730    ) -> AccountCustomerQueryEligibleBillingAccountCall<'a, C> {
3731        AccountCustomerQueryEligibleBillingAccountCall {
3732            hub: self.hub,
3733            _customer: customer.to_string(),
3734            _skus: Default::default(),
3735            _delegate: Default::default(),
3736            _additional_params: Default::default(),
3737            _scopes: Default::default(),
3738        }
3739    }
3740
3741    /// Create a builder to help you perform the following task:
3742    ///
3743    /// Transfers customer entitlements to new reseller. Possible error codes: * PERMISSION_DENIED: * The customer doesn't belong to the reseller. * The reseller is not authorized to transact on this Product. See https://support.google.com/channelservices/answer/9759265 * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The customer or offer resource was not found. * ALREADY_EXISTS: The SKU was already transferred for the customer. * CONDITION_NOT_MET or FAILED_PRECONDITION: * The SKU requires domain verification to transfer, but the domain is not verified. * An Add-On SKU (example, Vault or Drive) is missing the pre-requisite SKU (example, G Suite Basic). * (Developer accounts only) Reseller and resold domain must meet the following naming requirements: * Domain names must start with goog-test. * Domain names must include the reseller domain. * Specify all transferring entitlements. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata will contain an instance of OperationMetadata.
3744    ///
3745    /// # Arguments
3746    ///
3747    /// * `request` - No description provided.
3748    /// * `parent` - Required. The resource name of the reseller's customer account that will receive transferred entitlements. Parent uses the format: accounts/{account_id}/customers/{customer_id}
3749    pub fn customers_transfer_entitlements(
3750        &self,
3751        request: GoogleCloudChannelV1TransferEntitlementsRequest,
3752        parent: &str,
3753    ) -> AccountCustomerTransferEntitlementCall<'a, C> {
3754        AccountCustomerTransferEntitlementCall {
3755            hub: self.hub,
3756            _request: request,
3757            _parent: parent.to_string(),
3758            _delegate: Default::default(),
3759            _additional_params: Default::default(),
3760            _scopes: Default::default(),
3761        }
3762    }
3763
3764    /// Create a builder to help you perform the following task:
3765    ///
3766    /// Transfers customer entitlements from their current reseller to Google. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The customer or offer resource was not found. * ALREADY_EXISTS: The SKU was already transferred for the customer. * CONDITION_NOT_MET or FAILED_PRECONDITION: * The SKU requires domain verification to transfer, but the domain is not verified. * An Add-On SKU (example, Vault or Drive) is missing the pre-requisite SKU (example, G Suite Basic). * (Developer accounts only) Reseller and resold domain must meet the following naming requirements: * Domain names must start with goog-test. * Domain names must include the reseller domain. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The response will contain google.protobuf.Empty on success. The Operation metadata will contain an instance of OperationMetadata.
3767    ///
3768    /// # Arguments
3769    ///
3770    /// * `request` - No description provided.
3771    /// * `parent` - Required. The resource name of the reseller's customer account where the entitlements transfer from. Parent uses the format: accounts/{account_id}/customers/{customer_id}
3772    pub fn customers_transfer_entitlements_to_google(
3773        &self,
3774        request: GoogleCloudChannelV1TransferEntitlementsToGoogleRequest,
3775        parent: &str,
3776    ) -> AccountCustomerTransferEntitlementsToGoogleCall<'a, C> {
3777        AccountCustomerTransferEntitlementsToGoogleCall {
3778            hub: self.hub,
3779            _request: request,
3780            _parent: parent.to_string(),
3781            _delegate: Default::default(),
3782            _additional_params: Default::default(),
3783            _scopes: Default::default(),
3784        }
3785    }
3786
3787    /// Create a builder to help you perform the following task:
3788    ///
3789    /// Lists the Offers the reseller can sell. Possible error codes: * INVALID_ARGUMENT: Required request parameters are missing or invalid.
3790    ///
3791    /// # Arguments
3792    ///
3793    /// * `parent` - Required. The resource name of the reseller account from which to list Offers. Parent uses the format: accounts/{account_id}.
3794    pub fn offers_list(&self, parent: &str) -> AccountOfferListCall<'a, C> {
3795        AccountOfferListCall {
3796            hub: self.hub,
3797            _parent: parent.to_string(),
3798            _show_future_offers: Default::default(),
3799            _page_token: Default::default(),
3800            _page_size: Default::default(),
3801            _language_code: Default::default(),
3802            _filter: Default::default(),
3803            _delegate: Default::default(),
3804            _additional_params: Default::default(),
3805            _scopes: Default::default(),
3806        }
3807    }
3808
3809    /// Create a builder to help you perform the following task:
3810    ///
3811    /// Retrieves data generated by CloudChannelReportsService.RunReportJob. Deprecated: Please use [Export Channel Services data to BigQuery](https://cloud.google.com/channel/docs/rebilling/export-data-to-bigquery) instead.
3812    ///
3813    /// # Arguments
3814    ///
3815    /// * `request` - No description provided.
3816    /// * `reportJob` - Required. The report job created by CloudChannelReportsService.RunReportJob. Report_job uses the format: accounts/{account_id}/reportJobs/{report_job_id}
3817    pub fn report_jobs_fetch_report_results(
3818        &self,
3819        request: GoogleCloudChannelV1FetchReportResultsRequest,
3820        report_job: &str,
3821    ) -> AccountReportJobFetchReportResultCall<'a, C> {
3822        AccountReportJobFetchReportResultCall {
3823            hub: self.hub,
3824            _request: request,
3825            _report_job: report_job.to_string(),
3826            _delegate: Default::default(),
3827            _additional_params: Default::default(),
3828            _scopes: Default::default(),
3829        }
3830    }
3831
3832    /// Create a builder to help you perform the following task:
3833    ///
3834    /// Lists the reports that RunReportJob can run. These reports include an ID, a description, and the list of columns that will be in the result. Deprecated: Please use [Export Channel Services data to BigQuery](https://cloud.google.com/channel/docs/rebilling/export-data-to-bigquery) instead.
3835    ///
3836    /// # Arguments
3837    ///
3838    /// * `parent` - Required. The resource name of the partner account to list available reports for. Parent uses the format: accounts/{account_id}
3839    pub fn reports_list(&self, parent: &str) -> AccountReportListCall<'a, C> {
3840        AccountReportListCall {
3841            hub: self.hub,
3842            _parent: parent.to_string(),
3843            _page_token: Default::default(),
3844            _page_size: Default::default(),
3845            _language_code: Default::default(),
3846            _delegate: Default::default(),
3847            _additional_params: Default::default(),
3848            _scopes: Default::default(),
3849        }
3850    }
3851
3852    /// Create a builder to help you perform the following task:
3853    ///
3854    /// Begins generation of data for a given report. The report identifier is a UID (for example, `613bf59q`). Possible error codes: * PERMISSION_DENIED: The user doesn't have access to this report. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The report identifier was not found. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata contains an instance of OperationMetadata. To get the results of report generation, call CloudChannelReportsService.FetchReportResults with the RunReportJobResponse.report_job. Deprecated: Please use [Export Channel Services data to BigQuery](https://cloud.google.com/channel/docs/rebilling/export-data-to-bigquery) instead.
3855    ///
3856    /// # Arguments
3857    ///
3858    /// * `request` - No description provided.
3859    /// * `name` - Required. The report's resource name. Specifies the account and report used to generate report data. The report_id identifier is a UID (for example, `613bf59q`). Name uses the format: accounts/{account_id}/reports/{report_id}
3860    pub fn reports_run(
3861        &self,
3862        request: GoogleCloudChannelV1RunReportJobRequest,
3863        name: &str,
3864    ) -> AccountReportRunCall<'a, C> {
3865        AccountReportRunCall {
3866            hub: self.hub,
3867            _request: request,
3868            _name: name.to_string(),
3869            _delegate: Default::default(),
3870            _additional_params: Default::default(),
3871            _scopes: Default::default(),
3872        }
3873    }
3874
3875    /// Create a builder to help you perform the following task:
3876    ///
3877    /// Lists the Billable SKUs in a given SKU group. Possible error codes: PERMISSION_DENIED: If the account making the request and the account being queried for are different, or the account doesn't exist. INVALID_ARGUMENT: Missing or invalid required parameters in the request. INTERNAL: Any non-user error related to technical issue in the backend. In this case, contact cloud channel support. Return Value: If successful, the BillableSku resources. The data for each resource is displayed in the ascending order of: * BillableSku.service_display_name * BillableSku.sku_display_name If unsuccessful, returns an error.
3878    ///
3879    /// # Arguments
3880    ///
3881    /// * `parent` - Required. Resource name of the SKU group. Format: accounts/{account}/skuGroups/{sku_group}.
3882    pub fn sku_groups_billable_skus_list(
3883        &self,
3884        parent: &str,
3885    ) -> AccountSkuGroupBillableSkuListCall<'a, C> {
3886        AccountSkuGroupBillableSkuListCall {
3887            hub: self.hub,
3888            _parent: parent.to_string(),
3889            _page_token: Default::default(),
3890            _page_size: Default::default(),
3891            _delegate: Default::default(),
3892            _additional_params: Default::default(),
3893            _scopes: Default::default(),
3894        }
3895    }
3896
3897    /// Create a builder to help you perform the following task:
3898    ///
3899    /// Lists the Rebilling supported SKU groups the account is authorized to sell. Reference: https://cloud.google.com/skus/sku-groups Possible Error Codes: * PERMISSION_DENIED: If the account making the request and the account being queried are different, or the account doesn't exist. * INTERNAL: Any non-user error related to technical issues in the backend. In this case, contact Cloud Channel support. Return Value: If successful, the SkuGroup resources. The data for each resource is displayed in the alphabetical order of SKU group display name. The data for each resource is displayed in the ascending order of SkuGroup.display_name If unsuccessful, returns an error.
3900    ///
3901    /// # Arguments
3902    ///
3903    /// * `parent` - Required. The resource name of the account from which to list SKU groups. Parent uses the format: accounts/{account}.
3904    pub fn sku_groups_list(&self, parent: &str) -> AccountSkuGroupListCall<'a, C> {
3905        AccountSkuGroupListCall {
3906            hub: self.hub,
3907            _parent: parent.to_string(),
3908            _page_token: Default::default(),
3909            _page_size: Default::default(),
3910            _delegate: Default::default(),
3911            _additional_params: Default::default(),
3912            _scopes: Default::default(),
3913        }
3914    }
3915
3916    /// Create a builder to help you perform the following task:
3917    ///
3918    /// Confirms the existence of Cloud Identity accounts based on the domain and if the Cloud Identity accounts are owned by the reseller. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * INVALID_VALUE: Invalid domain value in the request. Return value: A list of CloudIdentityCustomerAccount resources for the domain (may be empty) Note: in the v1alpha1 version of the API, a NOT_FOUND error returns if no CloudIdentityCustomerAccount resources match the domain.
3919    ///
3920    /// # Arguments
3921    ///
3922    /// * `request` - No description provided.
3923    /// * `parent` - Required. The reseller account's resource name. Parent uses the format: accounts/{account_id}
3924    pub fn check_cloud_identity_accounts_exist(
3925        &self,
3926        request: GoogleCloudChannelV1CheckCloudIdentityAccountsExistRequest,
3927        parent: &str,
3928    ) -> AccountCheckCloudIdentityAccountsExistCall<'a, C> {
3929        AccountCheckCloudIdentityAccountsExistCall {
3930            hub: self.hub,
3931            _request: request,
3932            _parent: parent.to_string(),
3933            _delegate: Default::default(),
3934            _additional_params: Default::default(),
3935            _scopes: Default::default(),
3936        }
3937    }
3938
3939    /// Create a builder to help you perform the following task:
3940    ///
3941    /// Lists service accounts with subscriber privileges on the Pub/Sub topic created for this Channel Services account or integrator. Possible error codes: * PERMISSION_DENIED: The reseller account making the request and the provided reseller account are different, or the impersonated user is not a super admin. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The topic resource doesn't exist. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: A list of service email addresses.
3942    ///
3943    /// # Arguments
3944    ///
3945    /// * `account` - Optional. Resource name of the account. Required if integrator is not provided. Otherwise, leave this field empty/unset.
3946    pub fn list_subscribers(&self, account: &str) -> AccountListSubscriberCall<'a, C> {
3947        AccountListSubscriberCall {
3948            hub: self.hub,
3949            _account: account.to_string(),
3950            _page_token: Default::default(),
3951            _page_size: Default::default(),
3952            _integrator: Default::default(),
3953            _delegate: Default::default(),
3954            _additional_params: Default::default(),
3955            _scopes: Default::default(),
3956        }
3957    }
3958
3959    /// Create a builder to help you perform the following task:
3960    ///
3961    /// List TransferableOffers of a customer based on Cloud Identity ID or Customer Name in the request. Use this method when a reseller gets the entitlement information of an unowned customer. The reseller should provide the customer's Cloud Identity ID or Customer Name. Possible error codes: * PERMISSION_DENIED: * The customer doesn't belong to the reseller and has no auth token. * The customer provided incorrect reseller information when generating auth token. * The reseller account making the request is different from the reseller account in the query. * The reseller is not authorized to transact on this Product. See https://support.google.com/channelservices/answer/9759265 * INVALID_ARGUMENT: Required request parameters are missing or invalid. Return value: List of TransferableOffer for the given customer and SKU.
3962    ///
3963    /// # Arguments
3964    ///
3965    /// * `request` - No description provided.
3966    /// * `parent` - Required. The resource name of the reseller's account.
3967    pub fn list_transferable_offers(
3968        &self,
3969        request: GoogleCloudChannelV1ListTransferableOffersRequest,
3970        parent: &str,
3971    ) -> AccountListTransferableOfferCall<'a, C> {
3972        AccountListTransferableOfferCall {
3973            hub: self.hub,
3974            _request: request,
3975            _parent: parent.to_string(),
3976            _delegate: Default::default(),
3977            _additional_params: Default::default(),
3978            _scopes: Default::default(),
3979        }
3980    }
3981
3982    /// Create a builder to help you perform the following task:
3983    ///
3984    /// List TransferableSkus of a customer based on the Cloud Identity ID or Customer Name in the request. Use this method to list the entitlements information of an unowned customer. You should provide the customer's Cloud Identity ID or Customer Name. Possible error codes: * PERMISSION_DENIED: * The customer doesn't belong to the reseller and has no auth token. * The supplied auth token is invalid. * The reseller account making the request is different from the reseller account in the query. * INVALID_ARGUMENT: Required request parameters are missing or invalid. Return value: A list of the customer's TransferableSku.
3985    ///
3986    /// # Arguments
3987    ///
3988    /// * `request` - No description provided.
3989    /// * `parent` - Required. The reseller account's resource name. Parent uses the format: accounts/{account_id}
3990    pub fn list_transferable_skus(
3991        &self,
3992        request: GoogleCloudChannelV1ListTransferableSkusRequest,
3993        parent: &str,
3994    ) -> AccountListTransferableSkuCall<'a, C> {
3995        AccountListTransferableSkuCall {
3996            hub: self.hub,
3997            _request: request,
3998            _parent: parent.to_string(),
3999            _delegate: Default::default(),
4000            _additional_params: Default::default(),
4001            _scopes: Default::default(),
4002        }
4003    }
4004
4005    /// Create a builder to help you perform the following task:
4006    ///
4007    /// Registers a service account with subscriber privileges on the Pub/Sub topic for this Channel Services account or integrator. After you create a subscriber, you get the events through SubscriberEvent Possible error codes: * PERMISSION_DENIED: The reseller account making the request and the provided reseller account are different, or the impersonated user is not a super admin. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The topic name with the registered service email address.
4008    ///
4009    /// # Arguments
4010    ///
4011    /// * `request` - No description provided.
4012    /// * `account` - Optional. Resource name of the account. Required if integrator is not provided. Otherwise, leave this field empty/unset.
4013    pub fn register(
4014        &self,
4015        request: GoogleCloudChannelV1RegisterSubscriberRequest,
4016        account: &str,
4017    ) -> AccountRegisterCall<'a, C> {
4018        AccountRegisterCall {
4019            hub: self.hub,
4020            _request: request,
4021            _account: account.to_string(),
4022            _delegate: Default::default(),
4023            _additional_params: Default::default(),
4024            _scopes: Default::default(),
4025        }
4026    }
4027
4028    /// Create a builder to help you perform the following task:
4029    ///
4030    /// Unregisters a service account with subscriber privileges on the Pub/Sub topic created for this Channel Services account or integrator. If there are no service accounts left with subscriber privileges, this deletes the topic. You can call ListSubscribers to check for these accounts. Possible error codes: * PERMISSION_DENIED: The reseller account making the request and the provided reseller account are different, or the impersonated user is not a super admin. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The topic resource doesn't exist. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The topic name that unregistered the service email address. Returns a success response if the service email address wasn't registered with the topic.
4031    ///
4032    /// # Arguments
4033    ///
4034    /// * `request` - No description provided.
4035    /// * `account` - Optional. Resource name of the account. Required if integrator is not provided. Otherwise, leave this field empty/unset.
4036    pub fn unregister(
4037        &self,
4038        request: GoogleCloudChannelV1UnregisterSubscriberRequest,
4039        account: &str,
4040    ) -> AccountUnregisterCall<'a, C> {
4041        AccountUnregisterCall {
4042            hub: self.hub,
4043            _request: request,
4044            _account: account.to_string(),
4045            _delegate: Default::default(),
4046            _additional_params: Default::default(),
4047            _scopes: Default::default(),
4048        }
4049    }
4050}
4051
4052/// A builder providing access to all methods supported on *integrator* resources.
4053/// It is not used directly, but through the [`Cloudchannel`] hub.
4054///
4055/// # Example
4056///
4057/// Instantiate a resource builder
4058///
4059/// ```test_harness,no_run
4060/// extern crate hyper;
4061/// extern crate hyper_rustls;
4062/// extern crate google_cloudchannel1 as cloudchannel1;
4063///
4064/// # async fn dox() {
4065/// use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4066///
4067/// let secret: yup_oauth2::ApplicationSecret = Default::default();
4068/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
4069///     .with_native_roots()
4070///     .unwrap()
4071///     .https_only()
4072///     .enable_http2()
4073///     .build();
4074///
4075/// let executor = hyper_util::rt::TokioExecutor::new();
4076/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4077///     secret,
4078///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4079///     yup_oauth2::client::CustomHyperClientBuilder::from(
4080///         hyper_util::client::legacy::Client::builder(executor).build(connector),
4081///     ),
4082/// ).build().await.unwrap();
4083///
4084/// let client = hyper_util::client::legacy::Client::builder(
4085///     hyper_util::rt::TokioExecutor::new()
4086/// )
4087/// .build(
4088///     hyper_rustls::HttpsConnectorBuilder::new()
4089///         .with_native_roots()
4090///         .unwrap()
4091///         .https_or_http()
4092///         .enable_http2()
4093///         .build()
4094/// );
4095/// let mut hub = Cloudchannel::new(client, auth);
4096/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
4097/// // like `list_subscribers(...)`, `register_subscriber(...)` and `unregister_subscriber(...)`
4098/// // to build up your call.
4099/// let rb = hub.integrators();
4100/// # }
4101/// ```
4102pub struct IntegratorMethods<'a, C>
4103where
4104    C: 'a,
4105{
4106    hub: &'a Cloudchannel<C>,
4107}
4108
4109impl<'a, C> common::MethodsBuilder for IntegratorMethods<'a, C> {}
4110
4111impl<'a, C> IntegratorMethods<'a, C> {
4112    /// Create a builder to help you perform the following task:
4113    ///
4114    /// Lists service accounts with subscriber privileges on the Pub/Sub topic created for this Channel Services account or integrator. Possible error codes: * PERMISSION_DENIED: The reseller account making the request and the provided reseller account are different, or the impersonated user is not a super admin. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The topic resource doesn't exist. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: A list of service email addresses.
4115    ///
4116    /// # Arguments
4117    ///
4118    /// * `integrator` - Optional. Resource name of the integrator. Required if account is not provided. Otherwise, leave this field empty/unset.
4119    pub fn list_subscribers(&self, integrator: &str) -> IntegratorListSubscriberCall<'a, C> {
4120        IntegratorListSubscriberCall {
4121            hub: self.hub,
4122            _integrator: integrator.to_string(),
4123            _page_token: Default::default(),
4124            _page_size: Default::default(),
4125            _account: Default::default(),
4126            _delegate: Default::default(),
4127            _additional_params: Default::default(),
4128            _scopes: Default::default(),
4129        }
4130    }
4131
4132    /// Create a builder to help you perform the following task:
4133    ///
4134    /// Registers a service account with subscriber privileges on the Pub/Sub topic for this Channel Services account or integrator. After you create a subscriber, you get the events through SubscriberEvent Possible error codes: * PERMISSION_DENIED: The reseller account making the request and the provided reseller account are different, or the impersonated user is not a super admin. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The topic name with the registered service email address.
4135    ///
4136    /// # Arguments
4137    ///
4138    /// * `request` - No description provided.
4139    /// * `integrator` - Optional. Resource name of the integrator. Required if account is not provided. Otherwise, leave this field empty/unset.
4140    pub fn register_subscriber(
4141        &self,
4142        request: GoogleCloudChannelV1RegisterSubscriberRequest,
4143        integrator: &str,
4144    ) -> IntegratorRegisterSubscriberCall<'a, C> {
4145        IntegratorRegisterSubscriberCall {
4146            hub: self.hub,
4147            _request: request,
4148            _integrator: integrator.to_string(),
4149            _delegate: Default::default(),
4150            _additional_params: Default::default(),
4151            _scopes: Default::default(),
4152        }
4153    }
4154
4155    /// Create a builder to help you perform the following task:
4156    ///
4157    /// Unregisters a service account with subscriber privileges on the Pub/Sub topic created for this Channel Services account or integrator. If there are no service accounts left with subscriber privileges, this deletes the topic. You can call ListSubscribers to check for these accounts. Possible error codes: * PERMISSION_DENIED: The reseller account making the request and the provided reseller account are different, or the impersonated user is not a super admin. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The topic resource doesn't exist. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The topic name that unregistered the service email address. Returns a success response if the service email address wasn't registered with the topic.
4158    ///
4159    /// # Arguments
4160    ///
4161    /// * `request` - No description provided.
4162    /// * `integrator` - Optional. Resource name of the integrator. Required if account is not provided. Otherwise, leave this field empty/unset.
4163    pub fn unregister_subscriber(
4164        &self,
4165        request: GoogleCloudChannelV1UnregisterSubscriberRequest,
4166        integrator: &str,
4167    ) -> IntegratorUnregisterSubscriberCall<'a, C> {
4168        IntegratorUnregisterSubscriberCall {
4169            hub: self.hub,
4170            _request: request,
4171            _integrator: integrator.to_string(),
4172            _delegate: Default::default(),
4173            _additional_params: Default::default(),
4174            _scopes: Default::default(),
4175        }
4176    }
4177}
4178
4179/// A builder providing access to all methods supported on *operation* resources.
4180/// It is not used directly, but through the [`Cloudchannel`] hub.
4181///
4182/// # Example
4183///
4184/// Instantiate a resource builder
4185///
4186/// ```test_harness,no_run
4187/// extern crate hyper;
4188/// extern crate hyper_rustls;
4189/// extern crate google_cloudchannel1 as cloudchannel1;
4190///
4191/// # async fn dox() {
4192/// use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4193///
4194/// let secret: yup_oauth2::ApplicationSecret = Default::default();
4195/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
4196///     .with_native_roots()
4197///     .unwrap()
4198///     .https_only()
4199///     .enable_http2()
4200///     .build();
4201///
4202/// let executor = hyper_util::rt::TokioExecutor::new();
4203/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4204///     secret,
4205///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4206///     yup_oauth2::client::CustomHyperClientBuilder::from(
4207///         hyper_util::client::legacy::Client::builder(executor).build(connector),
4208///     ),
4209/// ).build().await.unwrap();
4210///
4211/// let client = hyper_util::client::legacy::Client::builder(
4212///     hyper_util::rt::TokioExecutor::new()
4213/// )
4214/// .build(
4215///     hyper_rustls::HttpsConnectorBuilder::new()
4216///         .with_native_roots()
4217///         .unwrap()
4218///         .https_or_http()
4219///         .enable_http2()
4220///         .build()
4221/// );
4222/// let mut hub = Cloudchannel::new(client, auth);
4223/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
4224/// // like `cancel(...)`, `delete(...)`, `get(...)` and `list(...)`
4225/// // to build up your call.
4226/// let rb = hub.operations();
4227/// # }
4228/// ```
4229pub struct OperationMethods<'a, C>
4230where
4231    C: 'a,
4232{
4233    hub: &'a Cloudchannel<C>,
4234}
4235
4236impl<'a, C> common::MethodsBuilder for OperationMethods<'a, C> {}
4237
4238impl<'a, C> OperationMethods<'a, C> {
4239    /// Create a builder to help you perform the following task:
4240    ///
4241    /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of `1`, corresponding to `Code.CANCELLED`.
4242    ///
4243    /// # Arguments
4244    ///
4245    /// * `request` - No description provided.
4246    /// * `name` - The name of the operation resource to be cancelled.
4247    pub fn cancel(
4248        &self,
4249        request: GoogleLongrunningCancelOperationRequest,
4250        name: &str,
4251    ) -> OperationCancelCall<'a, C> {
4252        OperationCancelCall {
4253            hub: self.hub,
4254            _request: request,
4255            _name: name.to_string(),
4256            _delegate: Default::default(),
4257            _additional_params: Default::default(),
4258            _scopes: Default::default(),
4259        }
4260    }
4261
4262    /// Create a builder to help you perform the following task:
4263    ///
4264    /// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
4265    ///
4266    /// # Arguments
4267    ///
4268    /// * `name` - The name of the operation resource to be deleted.
4269    pub fn delete(&self, name: &str) -> OperationDeleteCall<'a, C> {
4270        OperationDeleteCall {
4271            hub: self.hub,
4272            _name: name.to_string(),
4273            _delegate: Default::default(),
4274            _additional_params: Default::default(),
4275            _scopes: Default::default(),
4276        }
4277    }
4278
4279    /// Create a builder to help you perform the following task:
4280    ///
4281    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
4282    ///
4283    /// # Arguments
4284    ///
4285    /// * `name` - The name of the operation resource.
4286    pub fn get(&self, name: &str) -> OperationGetCall<'a, C> {
4287        OperationGetCall {
4288            hub: self.hub,
4289            _name: name.to_string(),
4290            _delegate: Default::default(),
4291            _additional_params: Default::default(),
4292            _scopes: Default::default(),
4293        }
4294    }
4295
4296    /// Create a builder to help you perform the following task:
4297    ///
4298    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
4299    ///
4300    /// # Arguments
4301    ///
4302    /// * `name` - The name of the operation's parent resource.
4303    pub fn list(&self, name: &str) -> OperationListCall<'a, C> {
4304        OperationListCall {
4305            hub: self.hub,
4306            _name: name.to_string(),
4307            _return_partial_success: Default::default(),
4308            _page_token: Default::default(),
4309            _page_size: Default::default(),
4310            _filter: Default::default(),
4311            _delegate: Default::default(),
4312            _additional_params: Default::default(),
4313            _scopes: Default::default(),
4314        }
4315    }
4316}
4317
4318/// A builder providing access to all methods supported on *product* resources.
4319/// It is not used directly, but through the [`Cloudchannel`] hub.
4320///
4321/// # Example
4322///
4323/// Instantiate a resource builder
4324///
4325/// ```test_harness,no_run
4326/// extern crate hyper;
4327/// extern crate hyper_rustls;
4328/// extern crate google_cloudchannel1 as cloudchannel1;
4329///
4330/// # async fn dox() {
4331/// use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4332///
4333/// let secret: yup_oauth2::ApplicationSecret = Default::default();
4334/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
4335///     .with_native_roots()
4336///     .unwrap()
4337///     .https_only()
4338///     .enable_http2()
4339///     .build();
4340///
4341/// let executor = hyper_util::rt::TokioExecutor::new();
4342/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4343///     secret,
4344///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4345///     yup_oauth2::client::CustomHyperClientBuilder::from(
4346///         hyper_util::client::legacy::Client::builder(executor).build(connector),
4347///     ),
4348/// ).build().await.unwrap();
4349///
4350/// let client = hyper_util::client::legacy::Client::builder(
4351///     hyper_util::rt::TokioExecutor::new()
4352/// )
4353/// .build(
4354///     hyper_rustls::HttpsConnectorBuilder::new()
4355///         .with_native_roots()
4356///         .unwrap()
4357///         .https_or_http()
4358///         .enable_http2()
4359///         .build()
4360/// );
4361/// let mut hub = Cloudchannel::new(client, auth);
4362/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
4363/// // like `list(...)` and `skus_list(...)`
4364/// // to build up your call.
4365/// let rb = hub.products();
4366/// # }
4367/// ```
4368pub struct ProductMethods<'a, C>
4369where
4370    C: 'a,
4371{
4372    hub: &'a Cloudchannel<C>,
4373}
4374
4375impl<'a, C> common::MethodsBuilder for ProductMethods<'a, C> {}
4376
4377impl<'a, C> ProductMethods<'a, C> {
4378    /// Create a builder to help you perform the following task:
4379    ///
4380    /// Lists the SKUs for a product the reseller is authorized to sell. Possible error codes: * INVALID_ARGUMENT: Required request parameters are missing or invalid.
4381    ///
4382    /// # Arguments
4383    ///
4384    /// * `parent` - Required. The resource name of the Product to list SKUs for. Parent uses the format: products/{product_id}. Supports products/- to retrieve SKUs for all products.
4385    pub fn skus_list(&self, parent: &str) -> ProductSkuListCall<'a, C> {
4386        ProductSkuListCall {
4387            hub: self.hub,
4388            _parent: parent.to_string(),
4389            _page_token: Default::default(),
4390            _page_size: Default::default(),
4391            _language_code: Default::default(),
4392            _account: Default::default(),
4393            _delegate: Default::default(),
4394            _additional_params: Default::default(),
4395            _scopes: Default::default(),
4396        }
4397    }
4398
4399    /// Create a builder to help you perform the following task:
4400    ///
4401    /// Lists the Products the reseller is authorized to sell. Possible error codes: * INVALID_ARGUMENT: Required request parameters are missing or invalid.
4402    pub fn list(&self) -> ProductListCall<'a, C> {
4403        ProductListCall {
4404            hub: self.hub,
4405            _page_token: Default::default(),
4406            _page_size: Default::default(),
4407            _language_code: Default::default(),
4408            _account: Default::default(),
4409            _delegate: Default::default(),
4410            _additional_params: Default::default(),
4411            _scopes: Default::default(),
4412        }
4413    }
4414}
4415
4416// ###################
4417// CallBuilders   ###
4418// #################
4419
4420/// Creates a ChannelPartnerRepricingConfig. Call this method to set modifications for a specific ChannelPartner's bill. You can only create configs if the RepricingConfig.effective_invoice_month is a future month. If needed, you can create a config for the current month, with some restrictions. When creating a config for a future month, make sure there are no existing configs for that RepricingConfig.effective_invoice_month. The following restrictions are for creating configs in the current month. * This functionality is reserved for recovering from an erroneous config, and should not be used for regular business cases. * The new config will not modify exports used with other configs. Changes to the config may be immediate, but may take up to 24 hours. * There is a limit of ten configs for any ChannelPartner or RepricingConfig.EntitlementGranularity.entitlement, for any RepricingConfig.effective_invoice_month. * The contained ChannelPartnerRepricingConfig.repricing_config value must be different from the value used in the current config for a ChannelPartner. Possible Error Codes: * PERMISSION_DENIED: If the account making the request and the account being queried are different. * INVALID_ARGUMENT: Missing or invalid required parameters in the request. Also displays if the updated config is for the current month or past months. * NOT_FOUND: The ChannelPartnerRepricingConfig specified does not exist or is not associated with the given account. * INTERNAL: Any non-user error related to technical issues in the backend. In this case, contact Cloud Channel support. Return Value: If successful, the updated ChannelPartnerRepricingConfig resource, otherwise returns an error.
4421///
4422/// A builder for the *channelPartnerLinks.channelPartnerRepricingConfigs.create* method supported by a *account* resource.
4423/// It is not used directly, but through a [`AccountMethods`] instance.
4424///
4425/// # Example
4426///
4427/// Instantiate a resource method builder
4428///
4429/// ```test_harness,no_run
4430/// # extern crate hyper;
4431/// # extern crate hyper_rustls;
4432/// # extern crate google_cloudchannel1 as cloudchannel1;
4433/// use cloudchannel1::api::GoogleCloudChannelV1ChannelPartnerRepricingConfig;
4434/// # async fn dox() {
4435/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4436///
4437/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4438/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4439/// #     .with_native_roots()
4440/// #     .unwrap()
4441/// #     .https_only()
4442/// #     .enable_http2()
4443/// #     .build();
4444///
4445/// # let executor = hyper_util::rt::TokioExecutor::new();
4446/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4447/// #     secret,
4448/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4449/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4450/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4451/// #     ),
4452/// # ).build().await.unwrap();
4453///
4454/// # let client = hyper_util::client::legacy::Client::builder(
4455/// #     hyper_util::rt::TokioExecutor::new()
4456/// # )
4457/// # .build(
4458/// #     hyper_rustls::HttpsConnectorBuilder::new()
4459/// #         .with_native_roots()
4460/// #         .unwrap()
4461/// #         .https_or_http()
4462/// #         .enable_http2()
4463/// #         .build()
4464/// # );
4465/// # let mut hub = Cloudchannel::new(client, auth);
4466/// // As the method needs a request, you would usually fill it with the desired information
4467/// // into the respective structure. Some of the parts shown here might not be applicable !
4468/// // Values shown here are possibly random and not representative !
4469/// let mut req = GoogleCloudChannelV1ChannelPartnerRepricingConfig::default();
4470///
4471/// // You can configure optional parameters by calling the respective setters at will, and
4472/// // execute the final call using `doit()`.
4473/// // Values shown here are possibly random and not representative !
4474/// let result = hub.accounts().channel_partner_links_channel_partner_repricing_configs_create(req, "parent")
4475///              .doit().await;
4476/// # }
4477/// ```
4478pub struct AccountChannelPartnerLinkChannelPartnerRepricingConfigCreateCall<'a, C>
4479where
4480    C: 'a,
4481{
4482    hub: &'a Cloudchannel<C>,
4483    _request: GoogleCloudChannelV1ChannelPartnerRepricingConfig,
4484    _parent: String,
4485    _delegate: Option<&'a mut dyn common::Delegate>,
4486    _additional_params: HashMap<String, String>,
4487    _scopes: BTreeSet<String>,
4488}
4489
4490impl<'a, C> common::CallBuilder
4491    for AccountChannelPartnerLinkChannelPartnerRepricingConfigCreateCall<'a, C>
4492{
4493}
4494
4495impl<'a, C> AccountChannelPartnerLinkChannelPartnerRepricingConfigCreateCall<'a, C>
4496where
4497    C: common::Connector,
4498{
4499    /// Perform the operation you have build so far.
4500    pub async fn doit(
4501        mut self,
4502    ) -> common::Result<(
4503        common::Response,
4504        GoogleCloudChannelV1ChannelPartnerRepricingConfig,
4505    )> {
4506        use std::borrow::Cow;
4507        use std::io::{Read, Seek};
4508
4509        use common::{url::Params, ToParts};
4510        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4511
4512        let mut dd = common::DefaultDelegate;
4513        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4514        dlg.begin(common::MethodInfo {
4515            id: "cloudchannel.accounts.channelPartnerLinks.channelPartnerRepricingConfigs.create",
4516            http_method: hyper::Method::POST,
4517        });
4518
4519        for &field in ["alt", "parent"].iter() {
4520            if self._additional_params.contains_key(field) {
4521                dlg.finished(false);
4522                return Err(common::Error::FieldClash(field));
4523            }
4524        }
4525
4526        let mut params = Params::with_capacity(4 + self._additional_params.len());
4527        params.push("parent", self._parent);
4528
4529        params.extend(self._additional_params.iter());
4530
4531        params.push("alt", "json");
4532        let mut url = self.hub._base_url.clone() + "v1/{+parent}/channelPartnerRepricingConfigs";
4533        if self._scopes.is_empty() {
4534            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
4535        }
4536
4537        #[allow(clippy::single_element_loop)]
4538        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4539            url = params.uri_replacement(url, param_name, find_this, true);
4540        }
4541        {
4542            let to_remove = ["parent"];
4543            params.remove_params(&to_remove);
4544        }
4545
4546        let url = params.parse_with_url(&url);
4547
4548        let mut json_mime_type = mime::APPLICATION_JSON;
4549        let mut request_value_reader = {
4550            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4551            common::remove_json_null_values(&mut value);
4552            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4553            serde_json::to_writer(&mut dst, &value).unwrap();
4554            dst
4555        };
4556        let request_size = request_value_reader
4557            .seek(std::io::SeekFrom::End(0))
4558            .unwrap();
4559        request_value_reader
4560            .seek(std::io::SeekFrom::Start(0))
4561            .unwrap();
4562
4563        loop {
4564            let token = match self
4565                .hub
4566                .auth
4567                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4568                .await
4569            {
4570                Ok(token) => token,
4571                Err(e) => match dlg.token(e) {
4572                    Ok(token) => token,
4573                    Err(e) => {
4574                        dlg.finished(false);
4575                        return Err(common::Error::MissingToken(e));
4576                    }
4577                },
4578            };
4579            request_value_reader
4580                .seek(std::io::SeekFrom::Start(0))
4581                .unwrap();
4582            let mut req_result = {
4583                let client = &self.hub.client;
4584                dlg.pre_request();
4585                let mut req_builder = hyper::Request::builder()
4586                    .method(hyper::Method::POST)
4587                    .uri(url.as_str())
4588                    .header(USER_AGENT, self.hub._user_agent.clone());
4589
4590                if let Some(token) = token.as_ref() {
4591                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4592                }
4593
4594                let request = req_builder
4595                    .header(CONTENT_TYPE, json_mime_type.to_string())
4596                    .header(CONTENT_LENGTH, request_size as u64)
4597                    .body(common::to_body(
4598                        request_value_reader.get_ref().clone().into(),
4599                    ));
4600
4601                client.request(request.unwrap()).await
4602            };
4603
4604            match req_result {
4605                Err(err) => {
4606                    if let common::Retry::After(d) = dlg.http_error(&err) {
4607                        sleep(d).await;
4608                        continue;
4609                    }
4610                    dlg.finished(false);
4611                    return Err(common::Error::HttpError(err));
4612                }
4613                Ok(res) => {
4614                    let (mut parts, body) = res.into_parts();
4615                    let mut body = common::Body::new(body);
4616                    if !parts.status.is_success() {
4617                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4618                        let error = serde_json::from_str(&common::to_string(&bytes));
4619                        let response = common::to_response(parts, bytes.into());
4620
4621                        if let common::Retry::After(d) =
4622                            dlg.http_failure(&response, error.as_ref().ok())
4623                        {
4624                            sleep(d).await;
4625                            continue;
4626                        }
4627
4628                        dlg.finished(false);
4629
4630                        return Err(match error {
4631                            Ok(value) => common::Error::BadRequest(value),
4632                            _ => common::Error::Failure(response),
4633                        });
4634                    }
4635                    let response = {
4636                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4637                        let encoded = common::to_string(&bytes);
4638                        match serde_json::from_str(&encoded) {
4639                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4640                            Err(error) => {
4641                                dlg.response_json_decode_error(&encoded, &error);
4642                                return Err(common::Error::JsonDecodeError(
4643                                    encoded.to_string(),
4644                                    error,
4645                                ));
4646                            }
4647                        }
4648                    };
4649
4650                    dlg.finished(true);
4651                    return Ok(response);
4652                }
4653            }
4654        }
4655    }
4656
4657    ///
4658    /// Sets the *request* property to the given value.
4659    ///
4660    /// Even though the property as already been set when instantiating this call,
4661    /// we provide this method for API completeness.
4662    pub fn request(
4663        mut self,
4664        new_value: GoogleCloudChannelV1ChannelPartnerRepricingConfig,
4665    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigCreateCall<'a, C> {
4666        self._request = new_value;
4667        self
4668    }
4669    /// Required. The resource name of the ChannelPartner that will receive the repricing config. Parent uses the format: accounts/{account_id}/channelPartnerLinks/{channel_partner_id}
4670    ///
4671    /// Sets the *parent* path property to the given value.
4672    ///
4673    /// Even though the property as already been set when instantiating this call,
4674    /// we provide this method for API completeness.
4675    pub fn parent(
4676        mut self,
4677        new_value: &str,
4678    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigCreateCall<'a, C> {
4679        self._parent = new_value.to_string();
4680        self
4681    }
4682    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4683    /// while executing the actual API request.
4684    ///
4685    /// ````text
4686    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4687    /// ````
4688    ///
4689    /// Sets the *delegate* property to the given value.
4690    pub fn delegate(
4691        mut self,
4692        new_value: &'a mut dyn common::Delegate,
4693    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigCreateCall<'a, C> {
4694        self._delegate = Some(new_value);
4695        self
4696    }
4697
4698    /// Set any additional parameter of the query string used in the request.
4699    /// It should be used to set parameters which are not yet available through their own
4700    /// setters.
4701    ///
4702    /// Please note that this method must not be used to set any of the known parameters
4703    /// which have their own setter method. If done anyway, the request will fail.
4704    ///
4705    /// # Additional Parameters
4706    ///
4707    /// * *$.xgafv* (query-string) - V1 error format.
4708    /// * *access_token* (query-string) - OAuth access token.
4709    /// * *alt* (query-string) - Data format for response.
4710    /// * *callback* (query-string) - JSONP
4711    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4712    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4713    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4714    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4715    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4716    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4717    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4718    pub fn param<T>(
4719        mut self,
4720        name: T,
4721        value: T,
4722    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigCreateCall<'a, C>
4723    where
4724        T: AsRef<str>,
4725    {
4726        self._additional_params
4727            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4728        self
4729    }
4730
4731    /// Identifies the authorization scope for the method you are building.
4732    ///
4733    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4734    /// [`Scope::AppOrder`].
4735    ///
4736    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4737    /// tokens for more than one scope.
4738    ///
4739    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4740    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4741    /// sufficient, a read-write scope will do as well.
4742    pub fn add_scope<St>(
4743        mut self,
4744        scope: St,
4745    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigCreateCall<'a, C>
4746    where
4747        St: AsRef<str>,
4748    {
4749        self._scopes.insert(String::from(scope.as_ref()));
4750        self
4751    }
4752    /// Identifies the authorization scope(s) for the method you are building.
4753    ///
4754    /// See [`Self::add_scope()`] for details.
4755    pub fn add_scopes<I, St>(
4756        mut self,
4757        scopes: I,
4758    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigCreateCall<'a, C>
4759    where
4760        I: IntoIterator<Item = St>,
4761        St: AsRef<str>,
4762    {
4763        self._scopes
4764            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4765        self
4766    }
4767
4768    /// Removes all scopes, and no default scope will be used either.
4769    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4770    /// for details).
4771    pub fn clear_scopes(
4772        mut self,
4773    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigCreateCall<'a, C> {
4774        self._scopes.clear();
4775        self
4776    }
4777}
4778
4779/// Deletes the given ChannelPartnerRepricingConfig permanently. You can only delete configs if their RepricingConfig.effective_invoice_month is set to a date after the current month. Possible error codes: * PERMISSION_DENIED: The account making the request does not own this customer. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * FAILED_PRECONDITION: The ChannelPartnerRepricingConfig is active or in the past. * NOT_FOUND: No ChannelPartnerRepricingConfig found for the name in the request.
4780///
4781/// A builder for the *channelPartnerLinks.channelPartnerRepricingConfigs.delete* method supported by a *account* resource.
4782/// It is not used directly, but through a [`AccountMethods`] instance.
4783///
4784/// # Example
4785///
4786/// Instantiate a resource method builder
4787///
4788/// ```test_harness,no_run
4789/// # extern crate hyper;
4790/// # extern crate hyper_rustls;
4791/// # extern crate google_cloudchannel1 as cloudchannel1;
4792/// # async fn dox() {
4793/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4794///
4795/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4796/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4797/// #     .with_native_roots()
4798/// #     .unwrap()
4799/// #     .https_only()
4800/// #     .enable_http2()
4801/// #     .build();
4802///
4803/// # let executor = hyper_util::rt::TokioExecutor::new();
4804/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4805/// #     secret,
4806/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4807/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4808/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4809/// #     ),
4810/// # ).build().await.unwrap();
4811///
4812/// # let client = hyper_util::client::legacy::Client::builder(
4813/// #     hyper_util::rt::TokioExecutor::new()
4814/// # )
4815/// # .build(
4816/// #     hyper_rustls::HttpsConnectorBuilder::new()
4817/// #         .with_native_roots()
4818/// #         .unwrap()
4819/// #         .https_or_http()
4820/// #         .enable_http2()
4821/// #         .build()
4822/// # );
4823/// # let mut hub = Cloudchannel::new(client, auth);
4824/// // You can configure optional parameters by calling the respective setters at will, and
4825/// // execute the final call using `doit()`.
4826/// // Values shown here are possibly random and not representative !
4827/// let result = hub.accounts().channel_partner_links_channel_partner_repricing_configs_delete("name")
4828///              .doit().await;
4829/// # }
4830/// ```
4831pub struct AccountChannelPartnerLinkChannelPartnerRepricingConfigDeleteCall<'a, C>
4832where
4833    C: 'a,
4834{
4835    hub: &'a Cloudchannel<C>,
4836    _name: String,
4837    _delegate: Option<&'a mut dyn common::Delegate>,
4838    _additional_params: HashMap<String, String>,
4839    _scopes: BTreeSet<String>,
4840}
4841
4842impl<'a, C> common::CallBuilder
4843    for AccountChannelPartnerLinkChannelPartnerRepricingConfigDeleteCall<'a, C>
4844{
4845}
4846
4847impl<'a, C> AccountChannelPartnerLinkChannelPartnerRepricingConfigDeleteCall<'a, C>
4848where
4849    C: common::Connector,
4850{
4851    /// Perform the operation you have build so far.
4852    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleProtobufEmpty)> {
4853        use std::borrow::Cow;
4854        use std::io::{Read, Seek};
4855
4856        use common::{url::Params, ToParts};
4857        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4858
4859        let mut dd = common::DefaultDelegate;
4860        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4861        dlg.begin(common::MethodInfo {
4862            id: "cloudchannel.accounts.channelPartnerLinks.channelPartnerRepricingConfigs.delete",
4863            http_method: hyper::Method::DELETE,
4864        });
4865
4866        for &field in ["alt", "name"].iter() {
4867            if self._additional_params.contains_key(field) {
4868                dlg.finished(false);
4869                return Err(common::Error::FieldClash(field));
4870            }
4871        }
4872
4873        let mut params = Params::with_capacity(3 + self._additional_params.len());
4874        params.push("name", self._name);
4875
4876        params.extend(self._additional_params.iter());
4877
4878        params.push("alt", "json");
4879        let mut url = self.hub._base_url.clone() + "v1/{+name}";
4880        if self._scopes.is_empty() {
4881            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
4882        }
4883
4884        #[allow(clippy::single_element_loop)]
4885        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4886            url = params.uri_replacement(url, param_name, find_this, true);
4887        }
4888        {
4889            let to_remove = ["name"];
4890            params.remove_params(&to_remove);
4891        }
4892
4893        let url = params.parse_with_url(&url);
4894
4895        loop {
4896            let token = match self
4897                .hub
4898                .auth
4899                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4900                .await
4901            {
4902                Ok(token) => token,
4903                Err(e) => match dlg.token(e) {
4904                    Ok(token) => token,
4905                    Err(e) => {
4906                        dlg.finished(false);
4907                        return Err(common::Error::MissingToken(e));
4908                    }
4909                },
4910            };
4911            let mut req_result = {
4912                let client = &self.hub.client;
4913                dlg.pre_request();
4914                let mut req_builder = hyper::Request::builder()
4915                    .method(hyper::Method::DELETE)
4916                    .uri(url.as_str())
4917                    .header(USER_AGENT, self.hub._user_agent.clone());
4918
4919                if let Some(token) = token.as_ref() {
4920                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4921                }
4922
4923                let request = req_builder
4924                    .header(CONTENT_LENGTH, 0_u64)
4925                    .body(common::to_body::<String>(None));
4926
4927                client.request(request.unwrap()).await
4928            };
4929
4930            match req_result {
4931                Err(err) => {
4932                    if let common::Retry::After(d) = dlg.http_error(&err) {
4933                        sleep(d).await;
4934                        continue;
4935                    }
4936                    dlg.finished(false);
4937                    return Err(common::Error::HttpError(err));
4938                }
4939                Ok(res) => {
4940                    let (mut parts, body) = res.into_parts();
4941                    let mut body = common::Body::new(body);
4942                    if !parts.status.is_success() {
4943                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4944                        let error = serde_json::from_str(&common::to_string(&bytes));
4945                        let response = common::to_response(parts, bytes.into());
4946
4947                        if let common::Retry::After(d) =
4948                            dlg.http_failure(&response, error.as_ref().ok())
4949                        {
4950                            sleep(d).await;
4951                            continue;
4952                        }
4953
4954                        dlg.finished(false);
4955
4956                        return Err(match error {
4957                            Ok(value) => common::Error::BadRequest(value),
4958                            _ => common::Error::Failure(response),
4959                        });
4960                    }
4961                    let response = {
4962                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4963                        let encoded = common::to_string(&bytes);
4964                        match serde_json::from_str(&encoded) {
4965                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4966                            Err(error) => {
4967                                dlg.response_json_decode_error(&encoded, &error);
4968                                return Err(common::Error::JsonDecodeError(
4969                                    encoded.to_string(),
4970                                    error,
4971                                ));
4972                            }
4973                        }
4974                    };
4975
4976                    dlg.finished(true);
4977                    return Ok(response);
4978                }
4979            }
4980        }
4981    }
4982
4983    /// Required. The resource name of the channel partner repricing config rule to delete.
4984    ///
4985    /// Sets the *name* path property to the given value.
4986    ///
4987    /// Even though the property as already been set when instantiating this call,
4988    /// we provide this method for API completeness.
4989    pub fn name(
4990        mut self,
4991        new_value: &str,
4992    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigDeleteCall<'a, C> {
4993        self._name = new_value.to_string();
4994        self
4995    }
4996    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4997    /// while executing the actual API request.
4998    ///
4999    /// ````text
5000    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5001    /// ````
5002    ///
5003    /// Sets the *delegate* property to the given value.
5004    pub fn delegate(
5005        mut self,
5006        new_value: &'a mut dyn common::Delegate,
5007    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigDeleteCall<'a, C> {
5008        self._delegate = Some(new_value);
5009        self
5010    }
5011
5012    /// Set any additional parameter of the query string used in the request.
5013    /// It should be used to set parameters which are not yet available through their own
5014    /// setters.
5015    ///
5016    /// Please note that this method must not be used to set any of the known parameters
5017    /// which have their own setter method. If done anyway, the request will fail.
5018    ///
5019    /// # Additional Parameters
5020    ///
5021    /// * *$.xgafv* (query-string) - V1 error format.
5022    /// * *access_token* (query-string) - OAuth access token.
5023    /// * *alt* (query-string) - Data format for response.
5024    /// * *callback* (query-string) - JSONP
5025    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5026    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5027    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5028    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5029    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5030    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5031    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5032    pub fn param<T>(
5033        mut self,
5034        name: T,
5035        value: T,
5036    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigDeleteCall<'a, C>
5037    where
5038        T: AsRef<str>,
5039    {
5040        self._additional_params
5041            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5042        self
5043    }
5044
5045    /// Identifies the authorization scope for the method you are building.
5046    ///
5047    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5048    /// [`Scope::AppOrder`].
5049    ///
5050    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5051    /// tokens for more than one scope.
5052    ///
5053    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5054    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5055    /// sufficient, a read-write scope will do as well.
5056    pub fn add_scope<St>(
5057        mut self,
5058        scope: St,
5059    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigDeleteCall<'a, C>
5060    where
5061        St: AsRef<str>,
5062    {
5063        self._scopes.insert(String::from(scope.as_ref()));
5064        self
5065    }
5066    /// Identifies the authorization scope(s) for the method you are building.
5067    ///
5068    /// See [`Self::add_scope()`] for details.
5069    pub fn add_scopes<I, St>(
5070        mut self,
5071        scopes: I,
5072    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigDeleteCall<'a, C>
5073    where
5074        I: IntoIterator<Item = St>,
5075        St: AsRef<str>,
5076    {
5077        self._scopes
5078            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5079        self
5080    }
5081
5082    /// Removes all scopes, and no default scope will be used either.
5083    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5084    /// for details).
5085    pub fn clear_scopes(
5086        mut self,
5087    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigDeleteCall<'a, C> {
5088        self._scopes.clear();
5089        self
5090    }
5091}
5092
5093/// Gets information about how a Distributor modifies their bill before sending it to a ChannelPartner. Possible Error Codes: * PERMISSION_DENIED: If the account making the request and the account being queried are different. * NOT_FOUND: The ChannelPartnerRepricingConfig was not found. * INTERNAL: Any non-user error related to technical issues in the backend. In this case, contact Cloud Channel support. Return Value: If successful, the ChannelPartnerRepricingConfig resource, otherwise returns an error.
5094///
5095/// A builder for the *channelPartnerLinks.channelPartnerRepricingConfigs.get* method supported by a *account* resource.
5096/// It is not used directly, but through a [`AccountMethods`] instance.
5097///
5098/// # Example
5099///
5100/// Instantiate a resource method builder
5101///
5102/// ```test_harness,no_run
5103/// # extern crate hyper;
5104/// # extern crate hyper_rustls;
5105/// # extern crate google_cloudchannel1 as cloudchannel1;
5106/// # async fn dox() {
5107/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5108///
5109/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5110/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5111/// #     .with_native_roots()
5112/// #     .unwrap()
5113/// #     .https_only()
5114/// #     .enable_http2()
5115/// #     .build();
5116///
5117/// # let executor = hyper_util::rt::TokioExecutor::new();
5118/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5119/// #     secret,
5120/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5121/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5122/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5123/// #     ),
5124/// # ).build().await.unwrap();
5125///
5126/// # let client = hyper_util::client::legacy::Client::builder(
5127/// #     hyper_util::rt::TokioExecutor::new()
5128/// # )
5129/// # .build(
5130/// #     hyper_rustls::HttpsConnectorBuilder::new()
5131/// #         .with_native_roots()
5132/// #         .unwrap()
5133/// #         .https_or_http()
5134/// #         .enable_http2()
5135/// #         .build()
5136/// # );
5137/// # let mut hub = Cloudchannel::new(client, auth);
5138/// // You can configure optional parameters by calling the respective setters at will, and
5139/// // execute the final call using `doit()`.
5140/// // Values shown here are possibly random and not representative !
5141/// let result = hub.accounts().channel_partner_links_channel_partner_repricing_configs_get("name")
5142///              .doit().await;
5143/// # }
5144/// ```
5145pub struct AccountChannelPartnerLinkChannelPartnerRepricingConfigGetCall<'a, C>
5146where
5147    C: 'a,
5148{
5149    hub: &'a Cloudchannel<C>,
5150    _name: String,
5151    _delegate: Option<&'a mut dyn common::Delegate>,
5152    _additional_params: HashMap<String, String>,
5153    _scopes: BTreeSet<String>,
5154}
5155
5156impl<'a, C> common::CallBuilder
5157    for AccountChannelPartnerLinkChannelPartnerRepricingConfigGetCall<'a, C>
5158{
5159}
5160
5161impl<'a, C> AccountChannelPartnerLinkChannelPartnerRepricingConfigGetCall<'a, C>
5162where
5163    C: common::Connector,
5164{
5165    /// Perform the operation you have build so far.
5166    pub async fn doit(
5167        mut self,
5168    ) -> common::Result<(
5169        common::Response,
5170        GoogleCloudChannelV1ChannelPartnerRepricingConfig,
5171    )> {
5172        use std::borrow::Cow;
5173        use std::io::{Read, Seek};
5174
5175        use common::{url::Params, ToParts};
5176        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5177
5178        let mut dd = common::DefaultDelegate;
5179        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5180        dlg.begin(common::MethodInfo {
5181            id: "cloudchannel.accounts.channelPartnerLinks.channelPartnerRepricingConfigs.get",
5182            http_method: hyper::Method::GET,
5183        });
5184
5185        for &field in ["alt", "name"].iter() {
5186            if self._additional_params.contains_key(field) {
5187                dlg.finished(false);
5188                return Err(common::Error::FieldClash(field));
5189            }
5190        }
5191
5192        let mut params = Params::with_capacity(3 + self._additional_params.len());
5193        params.push("name", self._name);
5194
5195        params.extend(self._additional_params.iter());
5196
5197        params.push("alt", "json");
5198        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5199        if self._scopes.is_empty() {
5200            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
5201        }
5202
5203        #[allow(clippy::single_element_loop)]
5204        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5205            url = params.uri_replacement(url, param_name, find_this, true);
5206        }
5207        {
5208            let to_remove = ["name"];
5209            params.remove_params(&to_remove);
5210        }
5211
5212        let url = params.parse_with_url(&url);
5213
5214        loop {
5215            let token = match self
5216                .hub
5217                .auth
5218                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5219                .await
5220            {
5221                Ok(token) => token,
5222                Err(e) => match dlg.token(e) {
5223                    Ok(token) => token,
5224                    Err(e) => {
5225                        dlg.finished(false);
5226                        return Err(common::Error::MissingToken(e));
5227                    }
5228                },
5229            };
5230            let mut req_result = {
5231                let client = &self.hub.client;
5232                dlg.pre_request();
5233                let mut req_builder = hyper::Request::builder()
5234                    .method(hyper::Method::GET)
5235                    .uri(url.as_str())
5236                    .header(USER_AGENT, self.hub._user_agent.clone());
5237
5238                if let Some(token) = token.as_ref() {
5239                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5240                }
5241
5242                let request = req_builder
5243                    .header(CONTENT_LENGTH, 0_u64)
5244                    .body(common::to_body::<String>(None));
5245
5246                client.request(request.unwrap()).await
5247            };
5248
5249            match req_result {
5250                Err(err) => {
5251                    if let common::Retry::After(d) = dlg.http_error(&err) {
5252                        sleep(d).await;
5253                        continue;
5254                    }
5255                    dlg.finished(false);
5256                    return Err(common::Error::HttpError(err));
5257                }
5258                Ok(res) => {
5259                    let (mut parts, body) = res.into_parts();
5260                    let mut body = common::Body::new(body);
5261                    if !parts.status.is_success() {
5262                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5263                        let error = serde_json::from_str(&common::to_string(&bytes));
5264                        let response = common::to_response(parts, bytes.into());
5265
5266                        if let common::Retry::After(d) =
5267                            dlg.http_failure(&response, error.as_ref().ok())
5268                        {
5269                            sleep(d).await;
5270                            continue;
5271                        }
5272
5273                        dlg.finished(false);
5274
5275                        return Err(match error {
5276                            Ok(value) => common::Error::BadRequest(value),
5277                            _ => common::Error::Failure(response),
5278                        });
5279                    }
5280                    let response = {
5281                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5282                        let encoded = common::to_string(&bytes);
5283                        match serde_json::from_str(&encoded) {
5284                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5285                            Err(error) => {
5286                                dlg.response_json_decode_error(&encoded, &error);
5287                                return Err(common::Error::JsonDecodeError(
5288                                    encoded.to_string(),
5289                                    error,
5290                                ));
5291                            }
5292                        }
5293                    };
5294
5295                    dlg.finished(true);
5296                    return Ok(response);
5297                }
5298            }
5299        }
5300    }
5301
5302    /// Required. The resource name of the ChannelPartnerRepricingConfig Format: accounts/{account_id}/channelPartnerLinks/{channel_partner_id}/channelPartnerRepricingConfigs/{id}.
5303    ///
5304    /// Sets the *name* path property to the given value.
5305    ///
5306    /// Even though the property as already been set when instantiating this call,
5307    /// we provide this method for API completeness.
5308    pub fn name(
5309        mut self,
5310        new_value: &str,
5311    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigGetCall<'a, C> {
5312        self._name = new_value.to_string();
5313        self
5314    }
5315    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5316    /// while executing the actual API request.
5317    ///
5318    /// ````text
5319    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5320    /// ````
5321    ///
5322    /// Sets the *delegate* property to the given value.
5323    pub fn delegate(
5324        mut self,
5325        new_value: &'a mut dyn common::Delegate,
5326    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigGetCall<'a, C> {
5327        self._delegate = Some(new_value);
5328        self
5329    }
5330
5331    /// Set any additional parameter of the query string used in the request.
5332    /// It should be used to set parameters which are not yet available through their own
5333    /// setters.
5334    ///
5335    /// Please note that this method must not be used to set any of the known parameters
5336    /// which have their own setter method. If done anyway, the request will fail.
5337    ///
5338    /// # Additional Parameters
5339    ///
5340    /// * *$.xgafv* (query-string) - V1 error format.
5341    /// * *access_token* (query-string) - OAuth access token.
5342    /// * *alt* (query-string) - Data format for response.
5343    /// * *callback* (query-string) - JSONP
5344    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5345    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5346    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5347    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5348    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5349    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5350    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5351    pub fn param<T>(
5352        mut self,
5353        name: T,
5354        value: T,
5355    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigGetCall<'a, C>
5356    where
5357        T: AsRef<str>,
5358    {
5359        self._additional_params
5360            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5361        self
5362    }
5363
5364    /// Identifies the authorization scope for the method you are building.
5365    ///
5366    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5367    /// [`Scope::AppOrder`].
5368    ///
5369    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5370    /// tokens for more than one scope.
5371    ///
5372    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5373    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5374    /// sufficient, a read-write scope will do as well.
5375    pub fn add_scope<St>(
5376        mut self,
5377        scope: St,
5378    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigGetCall<'a, C>
5379    where
5380        St: AsRef<str>,
5381    {
5382        self._scopes.insert(String::from(scope.as_ref()));
5383        self
5384    }
5385    /// Identifies the authorization scope(s) for the method you are building.
5386    ///
5387    /// See [`Self::add_scope()`] for details.
5388    pub fn add_scopes<I, St>(
5389        mut self,
5390        scopes: I,
5391    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigGetCall<'a, C>
5392    where
5393        I: IntoIterator<Item = St>,
5394        St: AsRef<str>,
5395    {
5396        self._scopes
5397            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5398        self
5399    }
5400
5401    /// Removes all scopes, and no default scope will be used either.
5402    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5403    /// for details).
5404    pub fn clear_scopes(
5405        mut self,
5406    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigGetCall<'a, C> {
5407        self._scopes.clear();
5408        self
5409    }
5410}
5411
5412/// Lists information about how a Reseller modifies their bill before sending it to a ChannelPartner. Possible Error Codes: * PERMISSION_DENIED: If the account making the request and the account being queried are different. * NOT_FOUND: The ChannelPartnerRepricingConfig specified does not exist or is not associated with the given account. * INTERNAL: Any non-user error related to technical issues in the backend. In this case, contact Cloud Channel support. Return Value: If successful, the ChannelPartnerRepricingConfig resources. The data for each resource is displayed in the ascending order of: * Channel Partner ID * RepricingConfig.effective_invoice_month * ChannelPartnerRepricingConfig.update_time If unsuccessful, returns an error.
5413///
5414/// A builder for the *channelPartnerLinks.channelPartnerRepricingConfigs.list* method supported by a *account* resource.
5415/// It is not used directly, but through a [`AccountMethods`] instance.
5416///
5417/// # Example
5418///
5419/// Instantiate a resource method builder
5420///
5421/// ```test_harness,no_run
5422/// # extern crate hyper;
5423/// # extern crate hyper_rustls;
5424/// # extern crate google_cloudchannel1 as cloudchannel1;
5425/// # async fn dox() {
5426/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5427///
5428/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5429/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5430/// #     .with_native_roots()
5431/// #     .unwrap()
5432/// #     .https_only()
5433/// #     .enable_http2()
5434/// #     .build();
5435///
5436/// # let executor = hyper_util::rt::TokioExecutor::new();
5437/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5438/// #     secret,
5439/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5440/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5441/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5442/// #     ),
5443/// # ).build().await.unwrap();
5444///
5445/// # let client = hyper_util::client::legacy::Client::builder(
5446/// #     hyper_util::rt::TokioExecutor::new()
5447/// # )
5448/// # .build(
5449/// #     hyper_rustls::HttpsConnectorBuilder::new()
5450/// #         .with_native_roots()
5451/// #         .unwrap()
5452/// #         .https_or_http()
5453/// #         .enable_http2()
5454/// #         .build()
5455/// # );
5456/// # let mut hub = Cloudchannel::new(client, auth);
5457/// // You can configure optional parameters by calling the respective setters at will, and
5458/// // execute the final call using `doit()`.
5459/// // Values shown here are possibly random and not representative !
5460/// let result = hub.accounts().channel_partner_links_channel_partner_repricing_configs_list("parent")
5461///              .page_token("sed")
5462///              .page_size(-2)
5463///              .filter("takimata")
5464///              .doit().await;
5465/// # }
5466/// ```
5467pub struct AccountChannelPartnerLinkChannelPartnerRepricingConfigListCall<'a, C>
5468where
5469    C: 'a,
5470{
5471    hub: &'a Cloudchannel<C>,
5472    _parent: String,
5473    _page_token: Option<String>,
5474    _page_size: Option<i32>,
5475    _filter: Option<String>,
5476    _delegate: Option<&'a mut dyn common::Delegate>,
5477    _additional_params: HashMap<String, String>,
5478    _scopes: BTreeSet<String>,
5479}
5480
5481impl<'a, C> common::CallBuilder
5482    for AccountChannelPartnerLinkChannelPartnerRepricingConfigListCall<'a, C>
5483{
5484}
5485
5486impl<'a, C> AccountChannelPartnerLinkChannelPartnerRepricingConfigListCall<'a, C>
5487where
5488    C: common::Connector,
5489{
5490    /// Perform the operation you have build so far.
5491    pub async fn doit(
5492        mut self,
5493    ) -> common::Result<(
5494        common::Response,
5495        GoogleCloudChannelV1ListChannelPartnerRepricingConfigsResponse,
5496    )> {
5497        use std::borrow::Cow;
5498        use std::io::{Read, Seek};
5499
5500        use common::{url::Params, ToParts};
5501        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5502
5503        let mut dd = common::DefaultDelegate;
5504        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5505        dlg.begin(common::MethodInfo {
5506            id: "cloudchannel.accounts.channelPartnerLinks.channelPartnerRepricingConfigs.list",
5507            http_method: hyper::Method::GET,
5508        });
5509
5510        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
5511            if self._additional_params.contains_key(field) {
5512                dlg.finished(false);
5513                return Err(common::Error::FieldClash(field));
5514            }
5515        }
5516
5517        let mut params = Params::with_capacity(6 + self._additional_params.len());
5518        params.push("parent", self._parent);
5519        if let Some(value) = self._page_token.as_ref() {
5520            params.push("pageToken", value);
5521        }
5522        if let Some(value) = self._page_size.as_ref() {
5523            params.push("pageSize", value.to_string());
5524        }
5525        if let Some(value) = self._filter.as_ref() {
5526            params.push("filter", value);
5527        }
5528
5529        params.extend(self._additional_params.iter());
5530
5531        params.push("alt", "json");
5532        let mut url = self.hub._base_url.clone() + "v1/{+parent}/channelPartnerRepricingConfigs";
5533        if self._scopes.is_empty() {
5534            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
5535        }
5536
5537        #[allow(clippy::single_element_loop)]
5538        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5539            url = params.uri_replacement(url, param_name, find_this, true);
5540        }
5541        {
5542            let to_remove = ["parent"];
5543            params.remove_params(&to_remove);
5544        }
5545
5546        let url = params.parse_with_url(&url);
5547
5548        loop {
5549            let token = match self
5550                .hub
5551                .auth
5552                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5553                .await
5554            {
5555                Ok(token) => token,
5556                Err(e) => match dlg.token(e) {
5557                    Ok(token) => token,
5558                    Err(e) => {
5559                        dlg.finished(false);
5560                        return Err(common::Error::MissingToken(e));
5561                    }
5562                },
5563            };
5564            let mut req_result = {
5565                let client = &self.hub.client;
5566                dlg.pre_request();
5567                let mut req_builder = hyper::Request::builder()
5568                    .method(hyper::Method::GET)
5569                    .uri(url.as_str())
5570                    .header(USER_AGENT, self.hub._user_agent.clone());
5571
5572                if let Some(token) = token.as_ref() {
5573                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5574                }
5575
5576                let request = req_builder
5577                    .header(CONTENT_LENGTH, 0_u64)
5578                    .body(common::to_body::<String>(None));
5579
5580                client.request(request.unwrap()).await
5581            };
5582
5583            match req_result {
5584                Err(err) => {
5585                    if let common::Retry::After(d) = dlg.http_error(&err) {
5586                        sleep(d).await;
5587                        continue;
5588                    }
5589                    dlg.finished(false);
5590                    return Err(common::Error::HttpError(err));
5591                }
5592                Ok(res) => {
5593                    let (mut parts, body) = res.into_parts();
5594                    let mut body = common::Body::new(body);
5595                    if !parts.status.is_success() {
5596                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5597                        let error = serde_json::from_str(&common::to_string(&bytes));
5598                        let response = common::to_response(parts, bytes.into());
5599
5600                        if let common::Retry::After(d) =
5601                            dlg.http_failure(&response, error.as_ref().ok())
5602                        {
5603                            sleep(d).await;
5604                            continue;
5605                        }
5606
5607                        dlg.finished(false);
5608
5609                        return Err(match error {
5610                            Ok(value) => common::Error::BadRequest(value),
5611                            _ => common::Error::Failure(response),
5612                        });
5613                    }
5614                    let response = {
5615                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5616                        let encoded = common::to_string(&bytes);
5617                        match serde_json::from_str(&encoded) {
5618                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5619                            Err(error) => {
5620                                dlg.response_json_decode_error(&encoded, &error);
5621                                return Err(common::Error::JsonDecodeError(
5622                                    encoded.to_string(),
5623                                    error,
5624                                ));
5625                            }
5626                        }
5627                    };
5628
5629                    dlg.finished(true);
5630                    return Ok(response);
5631                }
5632            }
5633        }
5634    }
5635
5636    /// Required. The resource name of the account's ChannelPartnerLink. Parent uses the format: accounts/{account_id}/channelPartnerLinks/{channel_partner_id}. Supports accounts/{account_id}/channelPartnerLinks/- to retrieve configs for all channel partners.
5637    ///
5638    /// Sets the *parent* path property to the given value.
5639    ///
5640    /// Even though the property as already been set when instantiating this call,
5641    /// we provide this method for API completeness.
5642    pub fn parent(
5643        mut self,
5644        new_value: &str,
5645    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigListCall<'a, C> {
5646        self._parent = new_value.to_string();
5647        self
5648    }
5649    /// Optional. A token identifying a page of results beyond the first page. Obtained through ListChannelPartnerRepricingConfigsResponse.next_page_token of the previous CloudChannelService.ListChannelPartnerRepricingConfigs call.
5650    ///
5651    /// Sets the *page token* query property to the given value.
5652    pub fn page_token(
5653        mut self,
5654        new_value: &str,
5655    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigListCall<'a, C> {
5656        self._page_token = Some(new_value.to_string());
5657        self
5658    }
5659    /// Optional. The maximum number of repricing configs to return. The service may return fewer than this value. If unspecified, returns a maximum of 50 rules. The maximum value is 100; values above 100 will be coerced to 100.
5660    ///
5661    /// Sets the *page size* query property to the given value.
5662    pub fn page_size(
5663        mut self,
5664        new_value: i32,
5665    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigListCall<'a, C> {
5666        self._page_size = Some(new_value);
5667        self
5668    }
5669    /// Optional. A filter for [CloudChannelService.ListChannelPartnerRepricingConfigs] results (channel_partner_link only). You can use this filter when you support a BatchGet-like query. To use the filter, you must set `parent=accounts/{account_id}/channelPartnerLinks/-`. Example: `channel_partner_link = accounts/account_id/channelPartnerLinks/c1` OR `channel_partner_link = accounts/account_id/channelPartnerLinks/c2`.
5670    ///
5671    /// Sets the *filter* query property to the given value.
5672    pub fn filter(
5673        mut self,
5674        new_value: &str,
5675    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigListCall<'a, C> {
5676        self._filter = Some(new_value.to_string());
5677        self
5678    }
5679    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5680    /// while executing the actual API request.
5681    ///
5682    /// ````text
5683    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5684    /// ````
5685    ///
5686    /// Sets the *delegate* property to the given value.
5687    pub fn delegate(
5688        mut self,
5689        new_value: &'a mut dyn common::Delegate,
5690    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigListCall<'a, C> {
5691        self._delegate = Some(new_value);
5692        self
5693    }
5694
5695    /// Set any additional parameter of the query string used in the request.
5696    /// It should be used to set parameters which are not yet available through their own
5697    /// setters.
5698    ///
5699    /// Please note that this method must not be used to set any of the known parameters
5700    /// which have their own setter method. If done anyway, the request will fail.
5701    ///
5702    /// # Additional Parameters
5703    ///
5704    /// * *$.xgafv* (query-string) - V1 error format.
5705    /// * *access_token* (query-string) - OAuth access token.
5706    /// * *alt* (query-string) - Data format for response.
5707    /// * *callback* (query-string) - JSONP
5708    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5709    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5710    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5711    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5712    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5713    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5714    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5715    pub fn param<T>(
5716        mut self,
5717        name: T,
5718        value: T,
5719    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigListCall<'a, C>
5720    where
5721        T: AsRef<str>,
5722    {
5723        self._additional_params
5724            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5725        self
5726    }
5727
5728    /// Identifies the authorization scope for the method you are building.
5729    ///
5730    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5731    /// [`Scope::AppOrder`].
5732    ///
5733    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5734    /// tokens for more than one scope.
5735    ///
5736    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5737    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5738    /// sufficient, a read-write scope will do as well.
5739    pub fn add_scope<St>(
5740        mut self,
5741        scope: St,
5742    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigListCall<'a, C>
5743    where
5744        St: AsRef<str>,
5745    {
5746        self._scopes.insert(String::from(scope.as_ref()));
5747        self
5748    }
5749    /// Identifies the authorization scope(s) for the method you are building.
5750    ///
5751    /// See [`Self::add_scope()`] for details.
5752    pub fn add_scopes<I, St>(
5753        mut self,
5754        scopes: I,
5755    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigListCall<'a, C>
5756    where
5757        I: IntoIterator<Item = St>,
5758        St: AsRef<str>,
5759    {
5760        self._scopes
5761            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5762        self
5763    }
5764
5765    /// Removes all scopes, and no default scope will be used either.
5766    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5767    /// for details).
5768    pub fn clear_scopes(
5769        mut self,
5770    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigListCall<'a, C> {
5771        self._scopes.clear();
5772        self
5773    }
5774}
5775
5776/// Updates a ChannelPartnerRepricingConfig. Call this method to set modifications for a specific ChannelPartner's bill. This method overwrites the existing CustomerRepricingConfig. You can only update configs if the RepricingConfig.effective_invoice_month is a future month. To make changes to configs for the current month, use CreateChannelPartnerRepricingConfig, taking note of its restrictions. You cannot update the RepricingConfig.effective_invoice_month. When updating a config in the future: * This config must already exist. Possible Error Codes: * PERMISSION_DENIED: If the account making the request and the account being queried are different. * INVALID_ARGUMENT: Missing or invalid required parameters in the request. Also displays if the updated config is for the current month or past months. * NOT_FOUND: The ChannelPartnerRepricingConfig specified does not exist or is not associated with the given account. * INTERNAL: Any non-user error related to technical issues in the backend. In this case, contact Cloud Channel support. Return Value: If successful, the updated ChannelPartnerRepricingConfig resource, otherwise returns an error.
5777///
5778/// A builder for the *channelPartnerLinks.channelPartnerRepricingConfigs.patch* method supported by a *account* resource.
5779/// It is not used directly, but through a [`AccountMethods`] instance.
5780///
5781/// # Example
5782///
5783/// Instantiate a resource method builder
5784///
5785/// ```test_harness,no_run
5786/// # extern crate hyper;
5787/// # extern crate hyper_rustls;
5788/// # extern crate google_cloudchannel1 as cloudchannel1;
5789/// use cloudchannel1::api::GoogleCloudChannelV1ChannelPartnerRepricingConfig;
5790/// # async fn dox() {
5791/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5792///
5793/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5794/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5795/// #     .with_native_roots()
5796/// #     .unwrap()
5797/// #     .https_only()
5798/// #     .enable_http2()
5799/// #     .build();
5800///
5801/// # let executor = hyper_util::rt::TokioExecutor::new();
5802/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5803/// #     secret,
5804/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5805/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5806/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5807/// #     ),
5808/// # ).build().await.unwrap();
5809///
5810/// # let client = hyper_util::client::legacy::Client::builder(
5811/// #     hyper_util::rt::TokioExecutor::new()
5812/// # )
5813/// # .build(
5814/// #     hyper_rustls::HttpsConnectorBuilder::new()
5815/// #         .with_native_roots()
5816/// #         .unwrap()
5817/// #         .https_or_http()
5818/// #         .enable_http2()
5819/// #         .build()
5820/// # );
5821/// # let mut hub = Cloudchannel::new(client, auth);
5822/// // As the method needs a request, you would usually fill it with the desired information
5823/// // into the respective structure. Some of the parts shown here might not be applicable !
5824/// // Values shown here are possibly random and not representative !
5825/// let mut req = GoogleCloudChannelV1ChannelPartnerRepricingConfig::default();
5826///
5827/// // You can configure optional parameters by calling the respective setters at will, and
5828/// // execute the final call using `doit()`.
5829/// // Values shown here are possibly random and not representative !
5830/// let result = hub.accounts().channel_partner_links_channel_partner_repricing_configs_patch(req, "name")
5831///              .doit().await;
5832/// # }
5833/// ```
5834pub struct AccountChannelPartnerLinkChannelPartnerRepricingConfigPatchCall<'a, C>
5835where
5836    C: 'a,
5837{
5838    hub: &'a Cloudchannel<C>,
5839    _request: GoogleCloudChannelV1ChannelPartnerRepricingConfig,
5840    _name: String,
5841    _delegate: Option<&'a mut dyn common::Delegate>,
5842    _additional_params: HashMap<String, String>,
5843    _scopes: BTreeSet<String>,
5844}
5845
5846impl<'a, C> common::CallBuilder
5847    for AccountChannelPartnerLinkChannelPartnerRepricingConfigPatchCall<'a, C>
5848{
5849}
5850
5851impl<'a, C> AccountChannelPartnerLinkChannelPartnerRepricingConfigPatchCall<'a, C>
5852where
5853    C: common::Connector,
5854{
5855    /// Perform the operation you have build so far.
5856    pub async fn doit(
5857        mut self,
5858    ) -> common::Result<(
5859        common::Response,
5860        GoogleCloudChannelV1ChannelPartnerRepricingConfig,
5861    )> {
5862        use std::borrow::Cow;
5863        use std::io::{Read, Seek};
5864
5865        use common::{url::Params, ToParts};
5866        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5867
5868        let mut dd = common::DefaultDelegate;
5869        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5870        dlg.begin(common::MethodInfo {
5871            id: "cloudchannel.accounts.channelPartnerLinks.channelPartnerRepricingConfigs.patch",
5872            http_method: hyper::Method::PATCH,
5873        });
5874
5875        for &field in ["alt", "name"].iter() {
5876            if self._additional_params.contains_key(field) {
5877                dlg.finished(false);
5878                return Err(common::Error::FieldClash(field));
5879            }
5880        }
5881
5882        let mut params = Params::with_capacity(4 + self._additional_params.len());
5883        params.push("name", self._name);
5884
5885        params.extend(self._additional_params.iter());
5886
5887        params.push("alt", "json");
5888        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5889        if self._scopes.is_empty() {
5890            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
5891        }
5892
5893        #[allow(clippy::single_element_loop)]
5894        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5895            url = params.uri_replacement(url, param_name, find_this, true);
5896        }
5897        {
5898            let to_remove = ["name"];
5899            params.remove_params(&to_remove);
5900        }
5901
5902        let url = params.parse_with_url(&url);
5903
5904        let mut json_mime_type = mime::APPLICATION_JSON;
5905        let mut request_value_reader = {
5906            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5907            common::remove_json_null_values(&mut value);
5908            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5909            serde_json::to_writer(&mut dst, &value).unwrap();
5910            dst
5911        };
5912        let request_size = request_value_reader
5913            .seek(std::io::SeekFrom::End(0))
5914            .unwrap();
5915        request_value_reader
5916            .seek(std::io::SeekFrom::Start(0))
5917            .unwrap();
5918
5919        loop {
5920            let token = match self
5921                .hub
5922                .auth
5923                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5924                .await
5925            {
5926                Ok(token) => token,
5927                Err(e) => match dlg.token(e) {
5928                    Ok(token) => token,
5929                    Err(e) => {
5930                        dlg.finished(false);
5931                        return Err(common::Error::MissingToken(e));
5932                    }
5933                },
5934            };
5935            request_value_reader
5936                .seek(std::io::SeekFrom::Start(0))
5937                .unwrap();
5938            let mut req_result = {
5939                let client = &self.hub.client;
5940                dlg.pre_request();
5941                let mut req_builder = hyper::Request::builder()
5942                    .method(hyper::Method::PATCH)
5943                    .uri(url.as_str())
5944                    .header(USER_AGENT, self.hub._user_agent.clone());
5945
5946                if let Some(token) = token.as_ref() {
5947                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5948                }
5949
5950                let request = req_builder
5951                    .header(CONTENT_TYPE, json_mime_type.to_string())
5952                    .header(CONTENT_LENGTH, request_size as u64)
5953                    .body(common::to_body(
5954                        request_value_reader.get_ref().clone().into(),
5955                    ));
5956
5957                client.request(request.unwrap()).await
5958            };
5959
5960            match req_result {
5961                Err(err) => {
5962                    if let common::Retry::After(d) = dlg.http_error(&err) {
5963                        sleep(d).await;
5964                        continue;
5965                    }
5966                    dlg.finished(false);
5967                    return Err(common::Error::HttpError(err));
5968                }
5969                Ok(res) => {
5970                    let (mut parts, body) = res.into_parts();
5971                    let mut body = common::Body::new(body);
5972                    if !parts.status.is_success() {
5973                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5974                        let error = serde_json::from_str(&common::to_string(&bytes));
5975                        let response = common::to_response(parts, bytes.into());
5976
5977                        if let common::Retry::After(d) =
5978                            dlg.http_failure(&response, error.as_ref().ok())
5979                        {
5980                            sleep(d).await;
5981                            continue;
5982                        }
5983
5984                        dlg.finished(false);
5985
5986                        return Err(match error {
5987                            Ok(value) => common::Error::BadRequest(value),
5988                            _ => common::Error::Failure(response),
5989                        });
5990                    }
5991                    let response = {
5992                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5993                        let encoded = common::to_string(&bytes);
5994                        match serde_json::from_str(&encoded) {
5995                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5996                            Err(error) => {
5997                                dlg.response_json_decode_error(&encoded, &error);
5998                                return Err(common::Error::JsonDecodeError(
5999                                    encoded.to_string(),
6000                                    error,
6001                                ));
6002                            }
6003                        }
6004                    };
6005
6006                    dlg.finished(true);
6007                    return Ok(response);
6008                }
6009            }
6010        }
6011    }
6012
6013    ///
6014    /// Sets the *request* property to the given value.
6015    ///
6016    /// Even though the property as already been set when instantiating this call,
6017    /// we provide this method for API completeness.
6018    pub fn request(
6019        mut self,
6020        new_value: GoogleCloudChannelV1ChannelPartnerRepricingConfig,
6021    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigPatchCall<'a, C> {
6022        self._request = new_value;
6023        self
6024    }
6025    /// Output only. Resource name of the ChannelPartnerRepricingConfig. Format: accounts/{account_id}/channelPartnerLinks/{channel_partner_id}/channelPartnerRepricingConfigs/{id}.
6026    ///
6027    /// Sets the *name* path property to the given value.
6028    ///
6029    /// Even though the property as already been set when instantiating this call,
6030    /// we provide this method for API completeness.
6031    pub fn name(
6032        mut self,
6033        new_value: &str,
6034    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigPatchCall<'a, C> {
6035        self._name = new_value.to_string();
6036        self
6037    }
6038    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6039    /// while executing the actual API request.
6040    ///
6041    /// ````text
6042    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6043    /// ````
6044    ///
6045    /// Sets the *delegate* property to the given value.
6046    pub fn delegate(
6047        mut self,
6048        new_value: &'a mut dyn common::Delegate,
6049    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigPatchCall<'a, C> {
6050        self._delegate = Some(new_value);
6051        self
6052    }
6053
6054    /// Set any additional parameter of the query string used in the request.
6055    /// It should be used to set parameters which are not yet available through their own
6056    /// setters.
6057    ///
6058    /// Please note that this method must not be used to set any of the known parameters
6059    /// which have their own setter method. If done anyway, the request will fail.
6060    ///
6061    /// # Additional Parameters
6062    ///
6063    /// * *$.xgafv* (query-string) - V1 error format.
6064    /// * *access_token* (query-string) - OAuth access token.
6065    /// * *alt* (query-string) - Data format for response.
6066    /// * *callback* (query-string) - JSONP
6067    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6068    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6069    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6070    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6071    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6072    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6073    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6074    pub fn param<T>(
6075        mut self,
6076        name: T,
6077        value: T,
6078    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigPatchCall<'a, C>
6079    where
6080        T: AsRef<str>,
6081    {
6082        self._additional_params
6083            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6084        self
6085    }
6086
6087    /// Identifies the authorization scope for the method you are building.
6088    ///
6089    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6090    /// [`Scope::AppOrder`].
6091    ///
6092    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6093    /// tokens for more than one scope.
6094    ///
6095    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6096    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6097    /// sufficient, a read-write scope will do as well.
6098    pub fn add_scope<St>(
6099        mut self,
6100        scope: St,
6101    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigPatchCall<'a, C>
6102    where
6103        St: AsRef<str>,
6104    {
6105        self._scopes.insert(String::from(scope.as_ref()));
6106        self
6107    }
6108    /// Identifies the authorization scope(s) for the method you are building.
6109    ///
6110    /// See [`Self::add_scope()`] for details.
6111    pub fn add_scopes<I, St>(
6112        mut self,
6113        scopes: I,
6114    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigPatchCall<'a, C>
6115    where
6116        I: IntoIterator<Item = St>,
6117        St: AsRef<str>,
6118    {
6119        self._scopes
6120            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6121        self
6122    }
6123
6124    /// Removes all scopes, and no default scope will be used either.
6125    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6126    /// for details).
6127    pub fn clear_scopes(
6128        mut self,
6129    ) -> AccountChannelPartnerLinkChannelPartnerRepricingConfigPatchCall<'a, C> {
6130        self._scopes.clear();
6131        self
6132    }
6133}
6134
6135/// Creates a new Customer resource under the reseller or distributor account. Possible error codes: * PERMISSION_DENIED: * The reseller account making the request is different from the reseller account in the API request. * You are not authorized to create a customer. See https://support.google.com/channelservices/answer/9759265 * INVALID_ARGUMENT: * Required request parameters are missing or invalid. * Domain field value doesn't match the primary email domain. Return value: The newly created Customer resource.
6136///
6137/// A builder for the *channelPartnerLinks.customers.create* method supported by a *account* resource.
6138/// It is not used directly, but through a [`AccountMethods`] instance.
6139///
6140/// # Example
6141///
6142/// Instantiate a resource method builder
6143///
6144/// ```test_harness,no_run
6145/// # extern crate hyper;
6146/// # extern crate hyper_rustls;
6147/// # extern crate google_cloudchannel1 as cloudchannel1;
6148/// use cloudchannel1::api::GoogleCloudChannelV1Customer;
6149/// # async fn dox() {
6150/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6151///
6152/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6153/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6154/// #     .with_native_roots()
6155/// #     .unwrap()
6156/// #     .https_only()
6157/// #     .enable_http2()
6158/// #     .build();
6159///
6160/// # let executor = hyper_util::rt::TokioExecutor::new();
6161/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6162/// #     secret,
6163/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6164/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6165/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6166/// #     ),
6167/// # ).build().await.unwrap();
6168///
6169/// # let client = hyper_util::client::legacy::Client::builder(
6170/// #     hyper_util::rt::TokioExecutor::new()
6171/// # )
6172/// # .build(
6173/// #     hyper_rustls::HttpsConnectorBuilder::new()
6174/// #         .with_native_roots()
6175/// #         .unwrap()
6176/// #         .https_or_http()
6177/// #         .enable_http2()
6178/// #         .build()
6179/// # );
6180/// # let mut hub = Cloudchannel::new(client, auth);
6181/// // As the method needs a request, you would usually fill it with the desired information
6182/// // into the respective structure. Some of the parts shown here might not be applicable !
6183/// // Values shown here are possibly random and not representative !
6184/// let mut req = GoogleCloudChannelV1Customer::default();
6185///
6186/// // You can configure optional parameters by calling the respective setters at will, and
6187/// // execute the final call using `doit()`.
6188/// // Values shown here are possibly random and not representative !
6189/// let result = hub.accounts().channel_partner_links_customers_create(req, "parent")
6190///              .doit().await;
6191/// # }
6192/// ```
6193pub struct AccountChannelPartnerLinkCustomerCreateCall<'a, C>
6194where
6195    C: 'a,
6196{
6197    hub: &'a Cloudchannel<C>,
6198    _request: GoogleCloudChannelV1Customer,
6199    _parent: String,
6200    _delegate: Option<&'a mut dyn common::Delegate>,
6201    _additional_params: HashMap<String, String>,
6202    _scopes: BTreeSet<String>,
6203}
6204
6205impl<'a, C> common::CallBuilder for AccountChannelPartnerLinkCustomerCreateCall<'a, C> {}
6206
6207impl<'a, C> AccountChannelPartnerLinkCustomerCreateCall<'a, C>
6208where
6209    C: common::Connector,
6210{
6211    /// Perform the operation you have build so far.
6212    pub async fn doit(
6213        mut self,
6214    ) -> common::Result<(common::Response, GoogleCloudChannelV1Customer)> {
6215        use std::borrow::Cow;
6216        use std::io::{Read, Seek};
6217
6218        use common::{url::Params, ToParts};
6219        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6220
6221        let mut dd = common::DefaultDelegate;
6222        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6223        dlg.begin(common::MethodInfo {
6224            id: "cloudchannel.accounts.channelPartnerLinks.customers.create",
6225            http_method: hyper::Method::POST,
6226        });
6227
6228        for &field in ["alt", "parent"].iter() {
6229            if self._additional_params.contains_key(field) {
6230                dlg.finished(false);
6231                return Err(common::Error::FieldClash(field));
6232            }
6233        }
6234
6235        let mut params = Params::with_capacity(4 + self._additional_params.len());
6236        params.push("parent", self._parent);
6237
6238        params.extend(self._additional_params.iter());
6239
6240        params.push("alt", "json");
6241        let mut url = self.hub._base_url.clone() + "v1/{+parent}/customers";
6242        if self._scopes.is_empty() {
6243            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
6244        }
6245
6246        #[allow(clippy::single_element_loop)]
6247        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6248            url = params.uri_replacement(url, param_name, find_this, true);
6249        }
6250        {
6251            let to_remove = ["parent"];
6252            params.remove_params(&to_remove);
6253        }
6254
6255        let url = params.parse_with_url(&url);
6256
6257        let mut json_mime_type = mime::APPLICATION_JSON;
6258        let mut request_value_reader = {
6259            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6260            common::remove_json_null_values(&mut value);
6261            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6262            serde_json::to_writer(&mut dst, &value).unwrap();
6263            dst
6264        };
6265        let request_size = request_value_reader
6266            .seek(std::io::SeekFrom::End(0))
6267            .unwrap();
6268        request_value_reader
6269            .seek(std::io::SeekFrom::Start(0))
6270            .unwrap();
6271
6272        loop {
6273            let token = match self
6274                .hub
6275                .auth
6276                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6277                .await
6278            {
6279                Ok(token) => token,
6280                Err(e) => match dlg.token(e) {
6281                    Ok(token) => token,
6282                    Err(e) => {
6283                        dlg.finished(false);
6284                        return Err(common::Error::MissingToken(e));
6285                    }
6286                },
6287            };
6288            request_value_reader
6289                .seek(std::io::SeekFrom::Start(0))
6290                .unwrap();
6291            let mut req_result = {
6292                let client = &self.hub.client;
6293                dlg.pre_request();
6294                let mut req_builder = hyper::Request::builder()
6295                    .method(hyper::Method::POST)
6296                    .uri(url.as_str())
6297                    .header(USER_AGENT, self.hub._user_agent.clone());
6298
6299                if let Some(token) = token.as_ref() {
6300                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6301                }
6302
6303                let request = req_builder
6304                    .header(CONTENT_TYPE, json_mime_type.to_string())
6305                    .header(CONTENT_LENGTH, request_size as u64)
6306                    .body(common::to_body(
6307                        request_value_reader.get_ref().clone().into(),
6308                    ));
6309
6310                client.request(request.unwrap()).await
6311            };
6312
6313            match req_result {
6314                Err(err) => {
6315                    if let common::Retry::After(d) = dlg.http_error(&err) {
6316                        sleep(d).await;
6317                        continue;
6318                    }
6319                    dlg.finished(false);
6320                    return Err(common::Error::HttpError(err));
6321                }
6322                Ok(res) => {
6323                    let (mut parts, body) = res.into_parts();
6324                    let mut body = common::Body::new(body);
6325                    if !parts.status.is_success() {
6326                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6327                        let error = serde_json::from_str(&common::to_string(&bytes));
6328                        let response = common::to_response(parts, bytes.into());
6329
6330                        if let common::Retry::After(d) =
6331                            dlg.http_failure(&response, error.as_ref().ok())
6332                        {
6333                            sleep(d).await;
6334                            continue;
6335                        }
6336
6337                        dlg.finished(false);
6338
6339                        return Err(match error {
6340                            Ok(value) => common::Error::BadRequest(value),
6341                            _ => common::Error::Failure(response),
6342                        });
6343                    }
6344                    let response = {
6345                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6346                        let encoded = common::to_string(&bytes);
6347                        match serde_json::from_str(&encoded) {
6348                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6349                            Err(error) => {
6350                                dlg.response_json_decode_error(&encoded, &error);
6351                                return Err(common::Error::JsonDecodeError(
6352                                    encoded.to_string(),
6353                                    error,
6354                                ));
6355                            }
6356                        }
6357                    };
6358
6359                    dlg.finished(true);
6360                    return Ok(response);
6361                }
6362            }
6363        }
6364    }
6365
6366    ///
6367    /// Sets the *request* property to the given value.
6368    ///
6369    /// Even though the property as already been set when instantiating this call,
6370    /// we provide this method for API completeness.
6371    pub fn request(
6372        mut self,
6373        new_value: GoogleCloudChannelV1Customer,
6374    ) -> AccountChannelPartnerLinkCustomerCreateCall<'a, C> {
6375        self._request = new_value;
6376        self
6377    }
6378    /// Required. The resource name of reseller account in which to create the customer. Parent uses the format: accounts/{account_id}
6379    ///
6380    /// Sets the *parent* path property to the given value.
6381    ///
6382    /// Even though the property as already been set when instantiating this call,
6383    /// we provide this method for API completeness.
6384    pub fn parent(mut self, new_value: &str) -> AccountChannelPartnerLinkCustomerCreateCall<'a, C> {
6385        self._parent = new_value.to_string();
6386        self
6387    }
6388    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6389    /// while executing the actual API request.
6390    ///
6391    /// ````text
6392    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6393    /// ````
6394    ///
6395    /// Sets the *delegate* property to the given value.
6396    pub fn delegate(
6397        mut self,
6398        new_value: &'a mut dyn common::Delegate,
6399    ) -> AccountChannelPartnerLinkCustomerCreateCall<'a, C> {
6400        self._delegate = Some(new_value);
6401        self
6402    }
6403
6404    /// Set any additional parameter of the query string used in the request.
6405    /// It should be used to set parameters which are not yet available through their own
6406    /// setters.
6407    ///
6408    /// Please note that this method must not be used to set any of the known parameters
6409    /// which have their own setter method. If done anyway, the request will fail.
6410    ///
6411    /// # Additional Parameters
6412    ///
6413    /// * *$.xgafv* (query-string) - V1 error format.
6414    /// * *access_token* (query-string) - OAuth access token.
6415    /// * *alt* (query-string) - Data format for response.
6416    /// * *callback* (query-string) - JSONP
6417    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6418    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6419    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6420    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6421    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6422    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6423    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6424    pub fn param<T>(
6425        mut self,
6426        name: T,
6427        value: T,
6428    ) -> AccountChannelPartnerLinkCustomerCreateCall<'a, C>
6429    where
6430        T: AsRef<str>,
6431    {
6432        self._additional_params
6433            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6434        self
6435    }
6436
6437    /// Identifies the authorization scope for the method you are building.
6438    ///
6439    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6440    /// [`Scope::AppOrder`].
6441    ///
6442    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6443    /// tokens for more than one scope.
6444    ///
6445    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6446    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6447    /// sufficient, a read-write scope will do as well.
6448    pub fn add_scope<St>(mut self, scope: St) -> AccountChannelPartnerLinkCustomerCreateCall<'a, C>
6449    where
6450        St: AsRef<str>,
6451    {
6452        self._scopes.insert(String::from(scope.as_ref()));
6453        self
6454    }
6455    /// Identifies the authorization scope(s) for the method you are building.
6456    ///
6457    /// See [`Self::add_scope()`] for details.
6458    pub fn add_scopes<I, St>(
6459        mut self,
6460        scopes: I,
6461    ) -> AccountChannelPartnerLinkCustomerCreateCall<'a, C>
6462    where
6463        I: IntoIterator<Item = St>,
6464        St: AsRef<str>,
6465    {
6466        self._scopes
6467            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6468        self
6469    }
6470
6471    /// Removes all scopes, and no default scope will be used either.
6472    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6473    /// for details).
6474    pub fn clear_scopes(mut self) -> AccountChannelPartnerLinkCustomerCreateCall<'a, C> {
6475        self._scopes.clear();
6476        self
6477    }
6478}
6479
6480/// Deletes the given Customer permanently. Possible error codes: * PERMISSION_DENIED: The account making the request does not own this customer. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * FAILED_PRECONDITION: The customer has existing entitlements. * NOT_FOUND: No Customer resource found for the name in the request.
6481///
6482/// A builder for the *channelPartnerLinks.customers.delete* method supported by a *account* resource.
6483/// It is not used directly, but through a [`AccountMethods`] instance.
6484///
6485/// # Example
6486///
6487/// Instantiate a resource method builder
6488///
6489/// ```test_harness,no_run
6490/// # extern crate hyper;
6491/// # extern crate hyper_rustls;
6492/// # extern crate google_cloudchannel1 as cloudchannel1;
6493/// # async fn dox() {
6494/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6495///
6496/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6497/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6498/// #     .with_native_roots()
6499/// #     .unwrap()
6500/// #     .https_only()
6501/// #     .enable_http2()
6502/// #     .build();
6503///
6504/// # let executor = hyper_util::rt::TokioExecutor::new();
6505/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6506/// #     secret,
6507/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6508/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6509/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6510/// #     ),
6511/// # ).build().await.unwrap();
6512///
6513/// # let client = hyper_util::client::legacy::Client::builder(
6514/// #     hyper_util::rt::TokioExecutor::new()
6515/// # )
6516/// # .build(
6517/// #     hyper_rustls::HttpsConnectorBuilder::new()
6518/// #         .with_native_roots()
6519/// #         .unwrap()
6520/// #         .https_or_http()
6521/// #         .enable_http2()
6522/// #         .build()
6523/// # );
6524/// # let mut hub = Cloudchannel::new(client, auth);
6525/// // You can configure optional parameters by calling the respective setters at will, and
6526/// // execute the final call using `doit()`.
6527/// // Values shown here are possibly random and not representative !
6528/// let result = hub.accounts().channel_partner_links_customers_delete("name")
6529///              .doit().await;
6530/// # }
6531/// ```
6532pub struct AccountChannelPartnerLinkCustomerDeleteCall<'a, C>
6533where
6534    C: 'a,
6535{
6536    hub: &'a Cloudchannel<C>,
6537    _name: String,
6538    _delegate: Option<&'a mut dyn common::Delegate>,
6539    _additional_params: HashMap<String, String>,
6540    _scopes: BTreeSet<String>,
6541}
6542
6543impl<'a, C> common::CallBuilder for AccountChannelPartnerLinkCustomerDeleteCall<'a, C> {}
6544
6545impl<'a, C> AccountChannelPartnerLinkCustomerDeleteCall<'a, C>
6546where
6547    C: common::Connector,
6548{
6549    /// Perform the operation you have build so far.
6550    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleProtobufEmpty)> {
6551        use std::borrow::Cow;
6552        use std::io::{Read, Seek};
6553
6554        use common::{url::Params, ToParts};
6555        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6556
6557        let mut dd = common::DefaultDelegate;
6558        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6559        dlg.begin(common::MethodInfo {
6560            id: "cloudchannel.accounts.channelPartnerLinks.customers.delete",
6561            http_method: hyper::Method::DELETE,
6562        });
6563
6564        for &field in ["alt", "name"].iter() {
6565            if self._additional_params.contains_key(field) {
6566                dlg.finished(false);
6567                return Err(common::Error::FieldClash(field));
6568            }
6569        }
6570
6571        let mut params = Params::with_capacity(3 + self._additional_params.len());
6572        params.push("name", self._name);
6573
6574        params.extend(self._additional_params.iter());
6575
6576        params.push("alt", "json");
6577        let mut url = self.hub._base_url.clone() + "v1/{+name}";
6578        if self._scopes.is_empty() {
6579            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
6580        }
6581
6582        #[allow(clippy::single_element_loop)]
6583        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6584            url = params.uri_replacement(url, param_name, find_this, true);
6585        }
6586        {
6587            let to_remove = ["name"];
6588            params.remove_params(&to_remove);
6589        }
6590
6591        let url = params.parse_with_url(&url);
6592
6593        loop {
6594            let token = match self
6595                .hub
6596                .auth
6597                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6598                .await
6599            {
6600                Ok(token) => token,
6601                Err(e) => match dlg.token(e) {
6602                    Ok(token) => token,
6603                    Err(e) => {
6604                        dlg.finished(false);
6605                        return Err(common::Error::MissingToken(e));
6606                    }
6607                },
6608            };
6609            let mut req_result = {
6610                let client = &self.hub.client;
6611                dlg.pre_request();
6612                let mut req_builder = hyper::Request::builder()
6613                    .method(hyper::Method::DELETE)
6614                    .uri(url.as_str())
6615                    .header(USER_AGENT, self.hub._user_agent.clone());
6616
6617                if let Some(token) = token.as_ref() {
6618                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6619                }
6620
6621                let request = req_builder
6622                    .header(CONTENT_LENGTH, 0_u64)
6623                    .body(common::to_body::<String>(None));
6624
6625                client.request(request.unwrap()).await
6626            };
6627
6628            match req_result {
6629                Err(err) => {
6630                    if let common::Retry::After(d) = dlg.http_error(&err) {
6631                        sleep(d).await;
6632                        continue;
6633                    }
6634                    dlg.finished(false);
6635                    return Err(common::Error::HttpError(err));
6636                }
6637                Ok(res) => {
6638                    let (mut parts, body) = res.into_parts();
6639                    let mut body = common::Body::new(body);
6640                    if !parts.status.is_success() {
6641                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6642                        let error = serde_json::from_str(&common::to_string(&bytes));
6643                        let response = common::to_response(parts, bytes.into());
6644
6645                        if let common::Retry::After(d) =
6646                            dlg.http_failure(&response, error.as_ref().ok())
6647                        {
6648                            sleep(d).await;
6649                            continue;
6650                        }
6651
6652                        dlg.finished(false);
6653
6654                        return Err(match error {
6655                            Ok(value) => common::Error::BadRequest(value),
6656                            _ => common::Error::Failure(response),
6657                        });
6658                    }
6659                    let response = {
6660                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6661                        let encoded = common::to_string(&bytes);
6662                        match serde_json::from_str(&encoded) {
6663                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6664                            Err(error) => {
6665                                dlg.response_json_decode_error(&encoded, &error);
6666                                return Err(common::Error::JsonDecodeError(
6667                                    encoded.to_string(),
6668                                    error,
6669                                ));
6670                            }
6671                        }
6672                    };
6673
6674                    dlg.finished(true);
6675                    return Ok(response);
6676                }
6677            }
6678        }
6679    }
6680
6681    /// Required. The resource name of the customer to delete.
6682    ///
6683    /// Sets the *name* path property to the given value.
6684    ///
6685    /// Even though the property as already been set when instantiating this call,
6686    /// we provide this method for API completeness.
6687    pub fn name(mut self, new_value: &str) -> AccountChannelPartnerLinkCustomerDeleteCall<'a, C> {
6688        self._name = new_value.to_string();
6689        self
6690    }
6691    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6692    /// while executing the actual API request.
6693    ///
6694    /// ````text
6695    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6696    /// ````
6697    ///
6698    /// Sets the *delegate* property to the given value.
6699    pub fn delegate(
6700        mut self,
6701        new_value: &'a mut dyn common::Delegate,
6702    ) -> AccountChannelPartnerLinkCustomerDeleteCall<'a, C> {
6703        self._delegate = Some(new_value);
6704        self
6705    }
6706
6707    /// Set any additional parameter of the query string used in the request.
6708    /// It should be used to set parameters which are not yet available through their own
6709    /// setters.
6710    ///
6711    /// Please note that this method must not be used to set any of the known parameters
6712    /// which have their own setter method. If done anyway, the request will fail.
6713    ///
6714    /// # Additional Parameters
6715    ///
6716    /// * *$.xgafv* (query-string) - V1 error format.
6717    /// * *access_token* (query-string) - OAuth access token.
6718    /// * *alt* (query-string) - Data format for response.
6719    /// * *callback* (query-string) - JSONP
6720    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6721    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6722    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6723    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6724    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6725    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6726    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6727    pub fn param<T>(
6728        mut self,
6729        name: T,
6730        value: T,
6731    ) -> AccountChannelPartnerLinkCustomerDeleteCall<'a, C>
6732    where
6733        T: AsRef<str>,
6734    {
6735        self._additional_params
6736            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6737        self
6738    }
6739
6740    /// Identifies the authorization scope for the method you are building.
6741    ///
6742    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6743    /// [`Scope::AppOrder`].
6744    ///
6745    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6746    /// tokens for more than one scope.
6747    ///
6748    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6749    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6750    /// sufficient, a read-write scope will do as well.
6751    pub fn add_scope<St>(mut self, scope: St) -> AccountChannelPartnerLinkCustomerDeleteCall<'a, C>
6752    where
6753        St: AsRef<str>,
6754    {
6755        self._scopes.insert(String::from(scope.as_ref()));
6756        self
6757    }
6758    /// Identifies the authorization scope(s) for the method you are building.
6759    ///
6760    /// See [`Self::add_scope()`] for details.
6761    pub fn add_scopes<I, St>(
6762        mut self,
6763        scopes: I,
6764    ) -> AccountChannelPartnerLinkCustomerDeleteCall<'a, C>
6765    where
6766        I: IntoIterator<Item = St>,
6767        St: AsRef<str>,
6768    {
6769        self._scopes
6770            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6771        self
6772    }
6773
6774    /// Removes all scopes, and no default scope will be used either.
6775    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6776    /// for details).
6777    pub fn clear_scopes(mut self) -> AccountChannelPartnerLinkCustomerDeleteCall<'a, C> {
6778        self._scopes.clear();
6779        self
6780    }
6781}
6782
6783/// Returns the requested Customer resource. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The customer resource doesn't exist. Usually the result of an invalid name parameter. Return value: The Customer resource.
6784///
6785/// A builder for the *channelPartnerLinks.customers.get* method supported by a *account* resource.
6786/// It is not used directly, but through a [`AccountMethods`] instance.
6787///
6788/// # Example
6789///
6790/// Instantiate a resource method builder
6791///
6792/// ```test_harness,no_run
6793/// # extern crate hyper;
6794/// # extern crate hyper_rustls;
6795/// # extern crate google_cloudchannel1 as cloudchannel1;
6796/// # async fn dox() {
6797/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6798///
6799/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6800/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6801/// #     .with_native_roots()
6802/// #     .unwrap()
6803/// #     .https_only()
6804/// #     .enable_http2()
6805/// #     .build();
6806///
6807/// # let executor = hyper_util::rt::TokioExecutor::new();
6808/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6809/// #     secret,
6810/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6811/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6812/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6813/// #     ),
6814/// # ).build().await.unwrap();
6815///
6816/// # let client = hyper_util::client::legacy::Client::builder(
6817/// #     hyper_util::rt::TokioExecutor::new()
6818/// # )
6819/// # .build(
6820/// #     hyper_rustls::HttpsConnectorBuilder::new()
6821/// #         .with_native_roots()
6822/// #         .unwrap()
6823/// #         .https_or_http()
6824/// #         .enable_http2()
6825/// #         .build()
6826/// # );
6827/// # let mut hub = Cloudchannel::new(client, auth);
6828/// // You can configure optional parameters by calling the respective setters at will, and
6829/// // execute the final call using `doit()`.
6830/// // Values shown here are possibly random and not representative !
6831/// let result = hub.accounts().channel_partner_links_customers_get("name")
6832///              .doit().await;
6833/// # }
6834/// ```
6835pub struct AccountChannelPartnerLinkCustomerGetCall<'a, C>
6836where
6837    C: 'a,
6838{
6839    hub: &'a Cloudchannel<C>,
6840    _name: String,
6841    _delegate: Option<&'a mut dyn common::Delegate>,
6842    _additional_params: HashMap<String, String>,
6843    _scopes: BTreeSet<String>,
6844}
6845
6846impl<'a, C> common::CallBuilder for AccountChannelPartnerLinkCustomerGetCall<'a, C> {}
6847
6848impl<'a, C> AccountChannelPartnerLinkCustomerGetCall<'a, C>
6849where
6850    C: common::Connector,
6851{
6852    /// Perform the operation you have build so far.
6853    pub async fn doit(
6854        mut self,
6855    ) -> common::Result<(common::Response, GoogleCloudChannelV1Customer)> {
6856        use std::borrow::Cow;
6857        use std::io::{Read, Seek};
6858
6859        use common::{url::Params, ToParts};
6860        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6861
6862        let mut dd = common::DefaultDelegate;
6863        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6864        dlg.begin(common::MethodInfo {
6865            id: "cloudchannel.accounts.channelPartnerLinks.customers.get",
6866            http_method: hyper::Method::GET,
6867        });
6868
6869        for &field in ["alt", "name"].iter() {
6870            if self._additional_params.contains_key(field) {
6871                dlg.finished(false);
6872                return Err(common::Error::FieldClash(field));
6873            }
6874        }
6875
6876        let mut params = Params::with_capacity(3 + self._additional_params.len());
6877        params.push("name", self._name);
6878
6879        params.extend(self._additional_params.iter());
6880
6881        params.push("alt", "json");
6882        let mut url = self.hub._base_url.clone() + "v1/{+name}";
6883        if self._scopes.is_empty() {
6884            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
6885        }
6886
6887        #[allow(clippy::single_element_loop)]
6888        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6889            url = params.uri_replacement(url, param_name, find_this, true);
6890        }
6891        {
6892            let to_remove = ["name"];
6893            params.remove_params(&to_remove);
6894        }
6895
6896        let url = params.parse_with_url(&url);
6897
6898        loop {
6899            let token = match self
6900                .hub
6901                .auth
6902                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6903                .await
6904            {
6905                Ok(token) => token,
6906                Err(e) => match dlg.token(e) {
6907                    Ok(token) => token,
6908                    Err(e) => {
6909                        dlg.finished(false);
6910                        return Err(common::Error::MissingToken(e));
6911                    }
6912                },
6913            };
6914            let mut req_result = {
6915                let client = &self.hub.client;
6916                dlg.pre_request();
6917                let mut req_builder = hyper::Request::builder()
6918                    .method(hyper::Method::GET)
6919                    .uri(url.as_str())
6920                    .header(USER_AGENT, self.hub._user_agent.clone());
6921
6922                if let Some(token) = token.as_ref() {
6923                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6924                }
6925
6926                let request = req_builder
6927                    .header(CONTENT_LENGTH, 0_u64)
6928                    .body(common::to_body::<String>(None));
6929
6930                client.request(request.unwrap()).await
6931            };
6932
6933            match req_result {
6934                Err(err) => {
6935                    if let common::Retry::After(d) = dlg.http_error(&err) {
6936                        sleep(d).await;
6937                        continue;
6938                    }
6939                    dlg.finished(false);
6940                    return Err(common::Error::HttpError(err));
6941                }
6942                Ok(res) => {
6943                    let (mut parts, body) = res.into_parts();
6944                    let mut body = common::Body::new(body);
6945                    if !parts.status.is_success() {
6946                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6947                        let error = serde_json::from_str(&common::to_string(&bytes));
6948                        let response = common::to_response(parts, bytes.into());
6949
6950                        if let common::Retry::After(d) =
6951                            dlg.http_failure(&response, error.as_ref().ok())
6952                        {
6953                            sleep(d).await;
6954                            continue;
6955                        }
6956
6957                        dlg.finished(false);
6958
6959                        return Err(match error {
6960                            Ok(value) => common::Error::BadRequest(value),
6961                            _ => common::Error::Failure(response),
6962                        });
6963                    }
6964                    let response = {
6965                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6966                        let encoded = common::to_string(&bytes);
6967                        match serde_json::from_str(&encoded) {
6968                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6969                            Err(error) => {
6970                                dlg.response_json_decode_error(&encoded, &error);
6971                                return Err(common::Error::JsonDecodeError(
6972                                    encoded.to_string(),
6973                                    error,
6974                                ));
6975                            }
6976                        }
6977                    };
6978
6979                    dlg.finished(true);
6980                    return Ok(response);
6981                }
6982            }
6983        }
6984    }
6985
6986    /// Required. The resource name of the customer to retrieve. Name uses the format: accounts/{account_id}/customers/{customer_id}
6987    ///
6988    /// Sets the *name* path property to the given value.
6989    ///
6990    /// Even though the property as already been set when instantiating this call,
6991    /// we provide this method for API completeness.
6992    pub fn name(mut self, new_value: &str) -> AccountChannelPartnerLinkCustomerGetCall<'a, C> {
6993        self._name = new_value.to_string();
6994        self
6995    }
6996    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6997    /// while executing the actual API request.
6998    ///
6999    /// ````text
7000    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7001    /// ````
7002    ///
7003    /// Sets the *delegate* property to the given value.
7004    pub fn delegate(
7005        mut self,
7006        new_value: &'a mut dyn common::Delegate,
7007    ) -> AccountChannelPartnerLinkCustomerGetCall<'a, C> {
7008        self._delegate = Some(new_value);
7009        self
7010    }
7011
7012    /// Set any additional parameter of the query string used in the request.
7013    /// It should be used to set parameters which are not yet available through their own
7014    /// setters.
7015    ///
7016    /// Please note that this method must not be used to set any of the known parameters
7017    /// which have their own setter method. If done anyway, the request will fail.
7018    ///
7019    /// # Additional Parameters
7020    ///
7021    /// * *$.xgafv* (query-string) - V1 error format.
7022    /// * *access_token* (query-string) - OAuth access token.
7023    /// * *alt* (query-string) - Data format for response.
7024    /// * *callback* (query-string) - JSONP
7025    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7026    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7027    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7028    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7029    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7030    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7031    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7032    pub fn param<T>(mut self, name: T, value: T) -> AccountChannelPartnerLinkCustomerGetCall<'a, C>
7033    where
7034        T: AsRef<str>,
7035    {
7036        self._additional_params
7037            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7038        self
7039    }
7040
7041    /// Identifies the authorization scope for the method you are building.
7042    ///
7043    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7044    /// [`Scope::AppOrder`].
7045    ///
7046    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7047    /// tokens for more than one scope.
7048    ///
7049    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7050    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7051    /// sufficient, a read-write scope will do as well.
7052    pub fn add_scope<St>(mut self, scope: St) -> AccountChannelPartnerLinkCustomerGetCall<'a, C>
7053    where
7054        St: AsRef<str>,
7055    {
7056        self._scopes.insert(String::from(scope.as_ref()));
7057        self
7058    }
7059    /// Identifies the authorization scope(s) for the method you are building.
7060    ///
7061    /// See [`Self::add_scope()`] for details.
7062    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountChannelPartnerLinkCustomerGetCall<'a, C>
7063    where
7064        I: IntoIterator<Item = St>,
7065        St: AsRef<str>,
7066    {
7067        self._scopes
7068            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7069        self
7070    }
7071
7072    /// Removes all scopes, and no default scope will be used either.
7073    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7074    /// for details).
7075    pub fn clear_scopes(mut self) -> AccountChannelPartnerLinkCustomerGetCall<'a, C> {
7076        self._scopes.clear();
7077        self
7078    }
7079}
7080
7081/// Imports a Customer from the Cloud Identity associated with the provided Cloud Identity ID or domain before a TransferEntitlements call. If a linked Customer already exists and overwrite_if_exists is true, it will update that Customer's data. Possible error codes: * PERMISSION_DENIED: * The reseller account making the request is different from the reseller account in the API request. * You are not authorized to import the customer. See https://support.google.com/channelservices/answer/9759265 * NOT_FOUND: Cloud Identity doesn't exist or was deleted. * INVALID_ARGUMENT: Required parameters are missing, or the auth_token is expired or invalid. * ALREADY_EXISTS: A customer already exists and has conflicting critical fields. Requires an overwrite. Return value: The Customer.
7082///
7083/// A builder for the *channelPartnerLinks.customers.import* method supported by a *account* resource.
7084/// It is not used directly, but through a [`AccountMethods`] instance.
7085///
7086/// # Example
7087///
7088/// Instantiate a resource method builder
7089///
7090/// ```test_harness,no_run
7091/// # extern crate hyper;
7092/// # extern crate hyper_rustls;
7093/// # extern crate google_cloudchannel1 as cloudchannel1;
7094/// use cloudchannel1::api::GoogleCloudChannelV1ImportCustomerRequest;
7095/// # async fn dox() {
7096/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7097///
7098/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7099/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7100/// #     .with_native_roots()
7101/// #     .unwrap()
7102/// #     .https_only()
7103/// #     .enable_http2()
7104/// #     .build();
7105///
7106/// # let executor = hyper_util::rt::TokioExecutor::new();
7107/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7108/// #     secret,
7109/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7110/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7111/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7112/// #     ),
7113/// # ).build().await.unwrap();
7114///
7115/// # let client = hyper_util::client::legacy::Client::builder(
7116/// #     hyper_util::rt::TokioExecutor::new()
7117/// # )
7118/// # .build(
7119/// #     hyper_rustls::HttpsConnectorBuilder::new()
7120/// #         .with_native_roots()
7121/// #         .unwrap()
7122/// #         .https_or_http()
7123/// #         .enable_http2()
7124/// #         .build()
7125/// # );
7126/// # let mut hub = Cloudchannel::new(client, auth);
7127/// // As the method needs a request, you would usually fill it with the desired information
7128/// // into the respective structure. Some of the parts shown here might not be applicable !
7129/// // Values shown here are possibly random and not representative !
7130/// let mut req = GoogleCloudChannelV1ImportCustomerRequest::default();
7131///
7132/// // You can configure optional parameters by calling the respective setters at will, and
7133/// // execute the final call using `doit()`.
7134/// // Values shown here are possibly random and not representative !
7135/// let result = hub.accounts().channel_partner_links_customers_import(req, "parent")
7136///              .doit().await;
7137/// # }
7138/// ```
7139pub struct AccountChannelPartnerLinkCustomerImportCall<'a, C>
7140where
7141    C: 'a,
7142{
7143    hub: &'a Cloudchannel<C>,
7144    _request: GoogleCloudChannelV1ImportCustomerRequest,
7145    _parent: String,
7146    _delegate: Option<&'a mut dyn common::Delegate>,
7147    _additional_params: HashMap<String, String>,
7148    _scopes: BTreeSet<String>,
7149}
7150
7151impl<'a, C> common::CallBuilder for AccountChannelPartnerLinkCustomerImportCall<'a, C> {}
7152
7153impl<'a, C> AccountChannelPartnerLinkCustomerImportCall<'a, C>
7154where
7155    C: common::Connector,
7156{
7157    /// Perform the operation you have build so far.
7158    pub async fn doit(
7159        mut self,
7160    ) -> common::Result<(common::Response, GoogleCloudChannelV1Customer)> {
7161        use std::borrow::Cow;
7162        use std::io::{Read, Seek};
7163
7164        use common::{url::Params, ToParts};
7165        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7166
7167        let mut dd = common::DefaultDelegate;
7168        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7169        dlg.begin(common::MethodInfo {
7170            id: "cloudchannel.accounts.channelPartnerLinks.customers.import",
7171            http_method: hyper::Method::POST,
7172        });
7173
7174        for &field in ["alt", "parent"].iter() {
7175            if self._additional_params.contains_key(field) {
7176                dlg.finished(false);
7177                return Err(common::Error::FieldClash(field));
7178            }
7179        }
7180
7181        let mut params = Params::with_capacity(4 + self._additional_params.len());
7182        params.push("parent", self._parent);
7183
7184        params.extend(self._additional_params.iter());
7185
7186        params.push("alt", "json");
7187        let mut url = self.hub._base_url.clone() + "v1/{+parent}/customers:import";
7188        if self._scopes.is_empty() {
7189            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
7190        }
7191
7192        #[allow(clippy::single_element_loop)]
7193        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7194            url = params.uri_replacement(url, param_name, find_this, true);
7195        }
7196        {
7197            let to_remove = ["parent"];
7198            params.remove_params(&to_remove);
7199        }
7200
7201        let url = params.parse_with_url(&url);
7202
7203        let mut json_mime_type = mime::APPLICATION_JSON;
7204        let mut request_value_reader = {
7205            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7206            common::remove_json_null_values(&mut value);
7207            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7208            serde_json::to_writer(&mut dst, &value).unwrap();
7209            dst
7210        };
7211        let request_size = request_value_reader
7212            .seek(std::io::SeekFrom::End(0))
7213            .unwrap();
7214        request_value_reader
7215            .seek(std::io::SeekFrom::Start(0))
7216            .unwrap();
7217
7218        loop {
7219            let token = match self
7220                .hub
7221                .auth
7222                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7223                .await
7224            {
7225                Ok(token) => token,
7226                Err(e) => match dlg.token(e) {
7227                    Ok(token) => token,
7228                    Err(e) => {
7229                        dlg.finished(false);
7230                        return Err(common::Error::MissingToken(e));
7231                    }
7232                },
7233            };
7234            request_value_reader
7235                .seek(std::io::SeekFrom::Start(0))
7236                .unwrap();
7237            let mut req_result = {
7238                let client = &self.hub.client;
7239                dlg.pre_request();
7240                let mut req_builder = hyper::Request::builder()
7241                    .method(hyper::Method::POST)
7242                    .uri(url.as_str())
7243                    .header(USER_AGENT, self.hub._user_agent.clone());
7244
7245                if let Some(token) = token.as_ref() {
7246                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7247                }
7248
7249                let request = req_builder
7250                    .header(CONTENT_TYPE, json_mime_type.to_string())
7251                    .header(CONTENT_LENGTH, request_size as u64)
7252                    .body(common::to_body(
7253                        request_value_reader.get_ref().clone().into(),
7254                    ));
7255
7256                client.request(request.unwrap()).await
7257            };
7258
7259            match req_result {
7260                Err(err) => {
7261                    if let common::Retry::After(d) = dlg.http_error(&err) {
7262                        sleep(d).await;
7263                        continue;
7264                    }
7265                    dlg.finished(false);
7266                    return Err(common::Error::HttpError(err));
7267                }
7268                Ok(res) => {
7269                    let (mut parts, body) = res.into_parts();
7270                    let mut body = common::Body::new(body);
7271                    if !parts.status.is_success() {
7272                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7273                        let error = serde_json::from_str(&common::to_string(&bytes));
7274                        let response = common::to_response(parts, bytes.into());
7275
7276                        if let common::Retry::After(d) =
7277                            dlg.http_failure(&response, error.as_ref().ok())
7278                        {
7279                            sleep(d).await;
7280                            continue;
7281                        }
7282
7283                        dlg.finished(false);
7284
7285                        return Err(match error {
7286                            Ok(value) => common::Error::BadRequest(value),
7287                            _ => common::Error::Failure(response),
7288                        });
7289                    }
7290                    let response = {
7291                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7292                        let encoded = common::to_string(&bytes);
7293                        match serde_json::from_str(&encoded) {
7294                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7295                            Err(error) => {
7296                                dlg.response_json_decode_error(&encoded, &error);
7297                                return Err(common::Error::JsonDecodeError(
7298                                    encoded.to_string(),
7299                                    error,
7300                                ));
7301                            }
7302                        }
7303                    };
7304
7305                    dlg.finished(true);
7306                    return Ok(response);
7307                }
7308            }
7309        }
7310    }
7311
7312    ///
7313    /// Sets the *request* property to the given value.
7314    ///
7315    /// Even though the property as already been set when instantiating this call,
7316    /// we provide this method for API completeness.
7317    pub fn request(
7318        mut self,
7319        new_value: GoogleCloudChannelV1ImportCustomerRequest,
7320    ) -> AccountChannelPartnerLinkCustomerImportCall<'a, C> {
7321        self._request = new_value;
7322        self
7323    }
7324    /// Required. The resource name of the reseller's account. Parent takes the format: accounts/{account_id} or accounts/{account_id}/channelPartnerLinks/{channel_partner_id}
7325    ///
7326    /// Sets the *parent* path property to the given value.
7327    ///
7328    /// Even though the property as already been set when instantiating this call,
7329    /// we provide this method for API completeness.
7330    pub fn parent(mut self, new_value: &str) -> AccountChannelPartnerLinkCustomerImportCall<'a, C> {
7331        self._parent = new_value.to_string();
7332        self
7333    }
7334    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7335    /// while executing the actual API request.
7336    ///
7337    /// ````text
7338    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7339    /// ````
7340    ///
7341    /// Sets the *delegate* property to the given value.
7342    pub fn delegate(
7343        mut self,
7344        new_value: &'a mut dyn common::Delegate,
7345    ) -> AccountChannelPartnerLinkCustomerImportCall<'a, C> {
7346        self._delegate = Some(new_value);
7347        self
7348    }
7349
7350    /// Set any additional parameter of the query string used in the request.
7351    /// It should be used to set parameters which are not yet available through their own
7352    /// setters.
7353    ///
7354    /// Please note that this method must not be used to set any of the known parameters
7355    /// which have their own setter method. If done anyway, the request will fail.
7356    ///
7357    /// # Additional Parameters
7358    ///
7359    /// * *$.xgafv* (query-string) - V1 error format.
7360    /// * *access_token* (query-string) - OAuth access token.
7361    /// * *alt* (query-string) - Data format for response.
7362    /// * *callback* (query-string) - JSONP
7363    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7364    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7365    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7366    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7367    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7368    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7369    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7370    pub fn param<T>(
7371        mut self,
7372        name: T,
7373        value: T,
7374    ) -> AccountChannelPartnerLinkCustomerImportCall<'a, C>
7375    where
7376        T: AsRef<str>,
7377    {
7378        self._additional_params
7379            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7380        self
7381    }
7382
7383    /// Identifies the authorization scope for the method you are building.
7384    ///
7385    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7386    /// [`Scope::AppOrder`].
7387    ///
7388    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7389    /// tokens for more than one scope.
7390    ///
7391    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7392    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7393    /// sufficient, a read-write scope will do as well.
7394    pub fn add_scope<St>(mut self, scope: St) -> AccountChannelPartnerLinkCustomerImportCall<'a, C>
7395    where
7396        St: AsRef<str>,
7397    {
7398        self._scopes.insert(String::from(scope.as_ref()));
7399        self
7400    }
7401    /// Identifies the authorization scope(s) for the method you are building.
7402    ///
7403    /// See [`Self::add_scope()`] for details.
7404    pub fn add_scopes<I, St>(
7405        mut self,
7406        scopes: I,
7407    ) -> AccountChannelPartnerLinkCustomerImportCall<'a, C>
7408    where
7409        I: IntoIterator<Item = St>,
7410        St: AsRef<str>,
7411    {
7412        self._scopes
7413            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7414        self
7415    }
7416
7417    /// Removes all scopes, and no default scope will be used either.
7418    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7419    /// for details).
7420    pub fn clear_scopes(mut self) -> AccountChannelPartnerLinkCustomerImportCall<'a, C> {
7421        self._scopes.clear();
7422        self
7423    }
7424}
7425
7426/// List Customers. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. Return value: List of Customers, or an empty list if there are no customers.
7427///
7428/// A builder for the *channelPartnerLinks.customers.list* method supported by a *account* resource.
7429/// It is not used directly, but through a [`AccountMethods`] instance.
7430///
7431/// # Example
7432///
7433/// Instantiate a resource method builder
7434///
7435/// ```test_harness,no_run
7436/// # extern crate hyper;
7437/// # extern crate hyper_rustls;
7438/// # extern crate google_cloudchannel1 as cloudchannel1;
7439/// # async fn dox() {
7440/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7441///
7442/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7443/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7444/// #     .with_native_roots()
7445/// #     .unwrap()
7446/// #     .https_only()
7447/// #     .enable_http2()
7448/// #     .build();
7449///
7450/// # let executor = hyper_util::rt::TokioExecutor::new();
7451/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7452/// #     secret,
7453/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7454/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7455/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7456/// #     ),
7457/// # ).build().await.unwrap();
7458///
7459/// # let client = hyper_util::client::legacy::Client::builder(
7460/// #     hyper_util::rt::TokioExecutor::new()
7461/// # )
7462/// # .build(
7463/// #     hyper_rustls::HttpsConnectorBuilder::new()
7464/// #         .with_native_roots()
7465/// #         .unwrap()
7466/// #         .https_or_http()
7467/// #         .enable_http2()
7468/// #         .build()
7469/// # );
7470/// # let mut hub = Cloudchannel::new(client, auth);
7471/// // You can configure optional parameters by calling the respective setters at will, and
7472/// // execute the final call using `doit()`.
7473/// // Values shown here are possibly random and not representative !
7474/// let result = hub.accounts().channel_partner_links_customers_list("parent")
7475///              .page_token("eos")
7476///              .page_size(-4)
7477///              .filter("ea")
7478///              .doit().await;
7479/// # }
7480/// ```
7481pub struct AccountChannelPartnerLinkCustomerListCall<'a, C>
7482where
7483    C: 'a,
7484{
7485    hub: &'a Cloudchannel<C>,
7486    _parent: String,
7487    _page_token: Option<String>,
7488    _page_size: Option<i32>,
7489    _filter: Option<String>,
7490    _delegate: Option<&'a mut dyn common::Delegate>,
7491    _additional_params: HashMap<String, String>,
7492    _scopes: BTreeSet<String>,
7493}
7494
7495impl<'a, C> common::CallBuilder for AccountChannelPartnerLinkCustomerListCall<'a, C> {}
7496
7497impl<'a, C> AccountChannelPartnerLinkCustomerListCall<'a, C>
7498where
7499    C: common::Connector,
7500{
7501    /// Perform the operation you have build so far.
7502    pub async fn doit(
7503        mut self,
7504    ) -> common::Result<(common::Response, GoogleCloudChannelV1ListCustomersResponse)> {
7505        use std::borrow::Cow;
7506        use std::io::{Read, Seek};
7507
7508        use common::{url::Params, ToParts};
7509        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7510
7511        let mut dd = common::DefaultDelegate;
7512        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7513        dlg.begin(common::MethodInfo {
7514            id: "cloudchannel.accounts.channelPartnerLinks.customers.list",
7515            http_method: hyper::Method::GET,
7516        });
7517
7518        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
7519            if self._additional_params.contains_key(field) {
7520                dlg.finished(false);
7521                return Err(common::Error::FieldClash(field));
7522            }
7523        }
7524
7525        let mut params = Params::with_capacity(6 + self._additional_params.len());
7526        params.push("parent", self._parent);
7527        if let Some(value) = self._page_token.as_ref() {
7528            params.push("pageToken", value);
7529        }
7530        if let Some(value) = self._page_size.as_ref() {
7531            params.push("pageSize", value.to_string());
7532        }
7533        if let Some(value) = self._filter.as_ref() {
7534            params.push("filter", value);
7535        }
7536
7537        params.extend(self._additional_params.iter());
7538
7539        params.push("alt", "json");
7540        let mut url = self.hub._base_url.clone() + "v1/{+parent}/customers";
7541        if self._scopes.is_empty() {
7542            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
7543        }
7544
7545        #[allow(clippy::single_element_loop)]
7546        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7547            url = params.uri_replacement(url, param_name, find_this, true);
7548        }
7549        {
7550            let to_remove = ["parent"];
7551            params.remove_params(&to_remove);
7552        }
7553
7554        let url = params.parse_with_url(&url);
7555
7556        loop {
7557            let token = match self
7558                .hub
7559                .auth
7560                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7561                .await
7562            {
7563                Ok(token) => token,
7564                Err(e) => match dlg.token(e) {
7565                    Ok(token) => token,
7566                    Err(e) => {
7567                        dlg.finished(false);
7568                        return Err(common::Error::MissingToken(e));
7569                    }
7570                },
7571            };
7572            let mut req_result = {
7573                let client = &self.hub.client;
7574                dlg.pre_request();
7575                let mut req_builder = hyper::Request::builder()
7576                    .method(hyper::Method::GET)
7577                    .uri(url.as_str())
7578                    .header(USER_AGENT, self.hub._user_agent.clone());
7579
7580                if let Some(token) = token.as_ref() {
7581                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7582                }
7583
7584                let request = req_builder
7585                    .header(CONTENT_LENGTH, 0_u64)
7586                    .body(common::to_body::<String>(None));
7587
7588                client.request(request.unwrap()).await
7589            };
7590
7591            match req_result {
7592                Err(err) => {
7593                    if let common::Retry::After(d) = dlg.http_error(&err) {
7594                        sleep(d).await;
7595                        continue;
7596                    }
7597                    dlg.finished(false);
7598                    return Err(common::Error::HttpError(err));
7599                }
7600                Ok(res) => {
7601                    let (mut parts, body) = res.into_parts();
7602                    let mut body = common::Body::new(body);
7603                    if !parts.status.is_success() {
7604                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7605                        let error = serde_json::from_str(&common::to_string(&bytes));
7606                        let response = common::to_response(parts, bytes.into());
7607
7608                        if let common::Retry::After(d) =
7609                            dlg.http_failure(&response, error.as_ref().ok())
7610                        {
7611                            sleep(d).await;
7612                            continue;
7613                        }
7614
7615                        dlg.finished(false);
7616
7617                        return Err(match error {
7618                            Ok(value) => common::Error::BadRequest(value),
7619                            _ => common::Error::Failure(response),
7620                        });
7621                    }
7622                    let response = {
7623                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7624                        let encoded = common::to_string(&bytes);
7625                        match serde_json::from_str(&encoded) {
7626                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7627                            Err(error) => {
7628                                dlg.response_json_decode_error(&encoded, &error);
7629                                return Err(common::Error::JsonDecodeError(
7630                                    encoded.to_string(),
7631                                    error,
7632                                ));
7633                            }
7634                        }
7635                    };
7636
7637                    dlg.finished(true);
7638                    return Ok(response);
7639                }
7640            }
7641        }
7642    }
7643
7644    /// Required. The resource name of the reseller account to list customers from. Parent uses the format: accounts/{account_id}.
7645    ///
7646    /// Sets the *parent* path property to the given value.
7647    ///
7648    /// Even though the property as already been set when instantiating this call,
7649    /// we provide this method for API completeness.
7650    pub fn parent(mut self, new_value: &str) -> AccountChannelPartnerLinkCustomerListCall<'a, C> {
7651        self._parent = new_value.to_string();
7652        self
7653    }
7654    /// Optional. A token identifying a page of results other than the first page. Obtained through ListCustomersResponse.next_page_token of the previous CloudChannelService.ListCustomers call.
7655    ///
7656    /// Sets the *page token* query property to the given value.
7657    pub fn page_token(
7658        mut self,
7659        new_value: &str,
7660    ) -> AccountChannelPartnerLinkCustomerListCall<'a, C> {
7661        self._page_token = Some(new_value.to_string());
7662        self
7663    }
7664    /// Optional. The maximum number of customers to return. The service may return fewer than this value. If unspecified, returns at most 10 customers. The maximum value is 50.
7665    ///
7666    /// Sets the *page size* query property to the given value.
7667    pub fn page_size(mut self, new_value: i32) -> AccountChannelPartnerLinkCustomerListCall<'a, C> {
7668        self._page_size = Some(new_value);
7669        self
7670    }
7671    /// Optional. Filters applied to the [CloudChannelService.ListCustomers] results. See https://cloud.google.com/channel/docs/concepts/google-cloud/filter-customers for more information.
7672    ///
7673    /// Sets the *filter* query property to the given value.
7674    pub fn filter(mut self, new_value: &str) -> AccountChannelPartnerLinkCustomerListCall<'a, C> {
7675        self._filter = Some(new_value.to_string());
7676        self
7677    }
7678    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7679    /// while executing the actual API request.
7680    ///
7681    /// ````text
7682    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7683    /// ````
7684    ///
7685    /// Sets the *delegate* property to the given value.
7686    pub fn delegate(
7687        mut self,
7688        new_value: &'a mut dyn common::Delegate,
7689    ) -> AccountChannelPartnerLinkCustomerListCall<'a, C> {
7690        self._delegate = Some(new_value);
7691        self
7692    }
7693
7694    /// Set any additional parameter of the query string used in the request.
7695    /// It should be used to set parameters which are not yet available through their own
7696    /// setters.
7697    ///
7698    /// Please note that this method must not be used to set any of the known parameters
7699    /// which have their own setter method. If done anyway, the request will fail.
7700    ///
7701    /// # Additional Parameters
7702    ///
7703    /// * *$.xgafv* (query-string) - V1 error format.
7704    /// * *access_token* (query-string) - OAuth access token.
7705    /// * *alt* (query-string) - Data format for response.
7706    /// * *callback* (query-string) - JSONP
7707    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7708    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7709    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7710    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7711    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7712    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7713    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7714    pub fn param<T>(mut self, name: T, value: T) -> AccountChannelPartnerLinkCustomerListCall<'a, C>
7715    where
7716        T: AsRef<str>,
7717    {
7718        self._additional_params
7719            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7720        self
7721    }
7722
7723    /// Identifies the authorization scope for the method you are building.
7724    ///
7725    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7726    /// [`Scope::AppOrder`].
7727    ///
7728    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7729    /// tokens for more than one scope.
7730    ///
7731    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7732    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7733    /// sufficient, a read-write scope will do as well.
7734    pub fn add_scope<St>(mut self, scope: St) -> AccountChannelPartnerLinkCustomerListCall<'a, C>
7735    where
7736        St: AsRef<str>,
7737    {
7738        self._scopes.insert(String::from(scope.as_ref()));
7739        self
7740    }
7741    /// Identifies the authorization scope(s) for the method you are building.
7742    ///
7743    /// See [`Self::add_scope()`] for details.
7744    pub fn add_scopes<I, St>(
7745        mut self,
7746        scopes: I,
7747    ) -> AccountChannelPartnerLinkCustomerListCall<'a, C>
7748    where
7749        I: IntoIterator<Item = St>,
7750        St: AsRef<str>,
7751    {
7752        self._scopes
7753            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7754        self
7755    }
7756
7757    /// Removes all scopes, and no default scope will be used either.
7758    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7759    /// for details).
7760    pub fn clear_scopes(mut self) -> AccountChannelPartnerLinkCustomerListCall<'a, C> {
7761        self._scopes.clear();
7762        self
7763    }
7764}
7765
7766/// Updates an existing Customer resource for the reseller or distributor. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: No Customer resource found for the name in the request. Return value: The updated Customer resource.
7767///
7768/// A builder for the *channelPartnerLinks.customers.patch* method supported by a *account* resource.
7769/// It is not used directly, but through a [`AccountMethods`] instance.
7770///
7771/// # Example
7772///
7773/// Instantiate a resource method builder
7774///
7775/// ```test_harness,no_run
7776/// # extern crate hyper;
7777/// # extern crate hyper_rustls;
7778/// # extern crate google_cloudchannel1 as cloudchannel1;
7779/// use cloudchannel1::api::GoogleCloudChannelV1Customer;
7780/// # async fn dox() {
7781/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7782///
7783/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7784/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7785/// #     .with_native_roots()
7786/// #     .unwrap()
7787/// #     .https_only()
7788/// #     .enable_http2()
7789/// #     .build();
7790///
7791/// # let executor = hyper_util::rt::TokioExecutor::new();
7792/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7793/// #     secret,
7794/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7795/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7796/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7797/// #     ),
7798/// # ).build().await.unwrap();
7799///
7800/// # let client = hyper_util::client::legacy::Client::builder(
7801/// #     hyper_util::rt::TokioExecutor::new()
7802/// # )
7803/// # .build(
7804/// #     hyper_rustls::HttpsConnectorBuilder::new()
7805/// #         .with_native_roots()
7806/// #         .unwrap()
7807/// #         .https_or_http()
7808/// #         .enable_http2()
7809/// #         .build()
7810/// # );
7811/// # let mut hub = Cloudchannel::new(client, auth);
7812/// // As the method needs a request, you would usually fill it with the desired information
7813/// // into the respective structure. Some of the parts shown here might not be applicable !
7814/// // Values shown here are possibly random and not representative !
7815/// let mut req = GoogleCloudChannelV1Customer::default();
7816///
7817/// // You can configure optional parameters by calling the respective setters at will, and
7818/// // execute the final call using `doit()`.
7819/// // Values shown here are possibly random and not representative !
7820/// let result = hub.accounts().channel_partner_links_customers_patch(req, "name")
7821///              .update_mask(FieldMask::new::<&str>(&[]))
7822///              .doit().await;
7823/// # }
7824/// ```
7825pub struct AccountChannelPartnerLinkCustomerPatchCall<'a, C>
7826where
7827    C: 'a,
7828{
7829    hub: &'a Cloudchannel<C>,
7830    _request: GoogleCloudChannelV1Customer,
7831    _name: String,
7832    _update_mask: Option<common::FieldMask>,
7833    _delegate: Option<&'a mut dyn common::Delegate>,
7834    _additional_params: HashMap<String, String>,
7835    _scopes: BTreeSet<String>,
7836}
7837
7838impl<'a, C> common::CallBuilder for AccountChannelPartnerLinkCustomerPatchCall<'a, C> {}
7839
7840impl<'a, C> AccountChannelPartnerLinkCustomerPatchCall<'a, C>
7841where
7842    C: common::Connector,
7843{
7844    /// Perform the operation you have build so far.
7845    pub async fn doit(
7846        mut self,
7847    ) -> common::Result<(common::Response, GoogleCloudChannelV1Customer)> {
7848        use std::borrow::Cow;
7849        use std::io::{Read, Seek};
7850
7851        use common::{url::Params, ToParts};
7852        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7853
7854        let mut dd = common::DefaultDelegate;
7855        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7856        dlg.begin(common::MethodInfo {
7857            id: "cloudchannel.accounts.channelPartnerLinks.customers.patch",
7858            http_method: hyper::Method::PATCH,
7859        });
7860
7861        for &field in ["alt", "name", "updateMask"].iter() {
7862            if self._additional_params.contains_key(field) {
7863                dlg.finished(false);
7864                return Err(common::Error::FieldClash(field));
7865            }
7866        }
7867
7868        let mut params = Params::with_capacity(5 + self._additional_params.len());
7869        params.push("name", self._name);
7870        if let Some(value) = self._update_mask.as_ref() {
7871            params.push("updateMask", value.to_string());
7872        }
7873
7874        params.extend(self._additional_params.iter());
7875
7876        params.push("alt", "json");
7877        let mut url = self.hub._base_url.clone() + "v1/{+name}";
7878        if self._scopes.is_empty() {
7879            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
7880        }
7881
7882        #[allow(clippy::single_element_loop)]
7883        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7884            url = params.uri_replacement(url, param_name, find_this, true);
7885        }
7886        {
7887            let to_remove = ["name"];
7888            params.remove_params(&to_remove);
7889        }
7890
7891        let url = params.parse_with_url(&url);
7892
7893        let mut json_mime_type = mime::APPLICATION_JSON;
7894        let mut request_value_reader = {
7895            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7896            common::remove_json_null_values(&mut value);
7897            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7898            serde_json::to_writer(&mut dst, &value).unwrap();
7899            dst
7900        };
7901        let request_size = request_value_reader
7902            .seek(std::io::SeekFrom::End(0))
7903            .unwrap();
7904        request_value_reader
7905            .seek(std::io::SeekFrom::Start(0))
7906            .unwrap();
7907
7908        loop {
7909            let token = match self
7910                .hub
7911                .auth
7912                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7913                .await
7914            {
7915                Ok(token) => token,
7916                Err(e) => match dlg.token(e) {
7917                    Ok(token) => token,
7918                    Err(e) => {
7919                        dlg.finished(false);
7920                        return Err(common::Error::MissingToken(e));
7921                    }
7922                },
7923            };
7924            request_value_reader
7925                .seek(std::io::SeekFrom::Start(0))
7926                .unwrap();
7927            let mut req_result = {
7928                let client = &self.hub.client;
7929                dlg.pre_request();
7930                let mut req_builder = hyper::Request::builder()
7931                    .method(hyper::Method::PATCH)
7932                    .uri(url.as_str())
7933                    .header(USER_AGENT, self.hub._user_agent.clone());
7934
7935                if let Some(token) = token.as_ref() {
7936                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7937                }
7938
7939                let request = req_builder
7940                    .header(CONTENT_TYPE, json_mime_type.to_string())
7941                    .header(CONTENT_LENGTH, request_size as u64)
7942                    .body(common::to_body(
7943                        request_value_reader.get_ref().clone().into(),
7944                    ));
7945
7946                client.request(request.unwrap()).await
7947            };
7948
7949            match req_result {
7950                Err(err) => {
7951                    if let common::Retry::After(d) = dlg.http_error(&err) {
7952                        sleep(d).await;
7953                        continue;
7954                    }
7955                    dlg.finished(false);
7956                    return Err(common::Error::HttpError(err));
7957                }
7958                Ok(res) => {
7959                    let (mut parts, body) = res.into_parts();
7960                    let mut body = common::Body::new(body);
7961                    if !parts.status.is_success() {
7962                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7963                        let error = serde_json::from_str(&common::to_string(&bytes));
7964                        let response = common::to_response(parts, bytes.into());
7965
7966                        if let common::Retry::After(d) =
7967                            dlg.http_failure(&response, error.as_ref().ok())
7968                        {
7969                            sleep(d).await;
7970                            continue;
7971                        }
7972
7973                        dlg.finished(false);
7974
7975                        return Err(match error {
7976                            Ok(value) => common::Error::BadRequest(value),
7977                            _ => common::Error::Failure(response),
7978                        });
7979                    }
7980                    let response = {
7981                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7982                        let encoded = common::to_string(&bytes);
7983                        match serde_json::from_str(&encoded) {
7984                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7985                            Err(error) => {
7986                                dlg.response_json_decode_error(&encoded, &error);
7987                                return Err(common::Error::JsonDecodeError(
7988                                    encoded.to_string(),
7989                                    error,
7990                                ));
7991                            }
7992                        }
7993                    };
7994
7995                    dlg.finished(true);
7996                    return Ok(response);
7997                }
7998            }
7999        }
8000    }
8001
8002    ///
8003    /// Sets the *request* property to the given value.
8004    ///
8005    /// Even though the property as already been set when instantiating this call,
8006    /// we provide this method for API completeness.
8007    pub fn request(
8008        mut self,
8009        new_value: GoogleCloudChannelV1Customer,
8010    ) -> AccountChannelPartnerLinkCustomerPatchCall<'a, C> {
8011        self._request = new_value;
8012        self
8013    }
8014    /// Output only. Resource name of the customer. Format: accounts/{account_id}/customers/{customer_id}
8015    ///
8016    /// Sets the *name* path property to the given value.
8017    ///
8018    /// Even though the property as already been set when instantiating this call,
8019    /// we provide this method for API completeness.
8020    pub fn name(mut self, new_value: &str) -> AccountChannelPartnerLinkCustomerPatchCall<'a, C> {
8021        self._name = new_value.to_string();
8022        self
8023    }
8024    /// The update mask that applies to the resource. Optional.
8025    ///
8026    /// Sets the *update mask* query property to the given value.
8027    pub fn update_mask(
8028        mut self,
8029        new_value: common::FieldMask,
8030    ) -> AccountChannelPartnerLinkCustomerPatchCall<'a, C> {
8031        self._update_mask = Some(new_value);
8032        self
8033    }
8034    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8035    /// while executing the actual API request.
8036    ///
8037    /// ````text
8038    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8039    /// ````
8040    ///
8041    /// Sets the *delegate* property to the given value.
8042    pub fn delegate(
8043        mut self,
8044        new_value: &'a mut dyn common::Delegate,
8045    ) -> AccountChannelPartnerLinkCustomerPatchCall<'a, C> {
8046        self._delegate = Some(new_value);
8047        self
8048    }
8049
8050    /// Set any additional parameter of the query string used in the request.
8051    /// It should be used to set parameters which are not yet available through their own
8052    /// setters.
8053    ///
8054    /// Please note that this method must not be used to set any of the known parameters
8055    /// which have their own setter method. If done anyway, the request will fail.
8056    ///
8057    /// # Additional Parameters
8058    ///
8059    /// * *$.xgafv* (query-string) - V1 error format.
8060    /// * *access_token* (query-string) - OAuth access token.
8061    /// * *alt* (query-string) - Data format for response.
8062    /// * *callback* (query-string) - JSONP
8063    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8064    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8065    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8066    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8067    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8068    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8069    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8070    pub fn param<T>(
8071        mut self,
8072        name: T,
8073        value: T,
8074    ) -> AccountChannelPartnerLinkCustomerPatchCall<'a, C>
8075    where
8076        T: AsRef<str>,
8077    {
8078        self._additional_params
8079            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8080        self
8081    }
8082
8083    /// Identifies the authorization scope for the method you are building.
8084    ///
8085    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8086    /// [`Scope::AppOrder`].
8087    ///
8088    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8089    /// tokens for more than one scope.
8090    ///
8091    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8092    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8093    /// sufficient, a read-write scope will do as well.
8094    pub fn add_scope<St>(mut self, scope: St) -> AccountChannelPartnerLinkCustomerPatchCall<'a, C>
8095    where
8096        St: AsRef<str>,
8097    {
8098        self._scopes.insert(String::from(scope.as_ref()));
8099        self
8100    }
8101    /// Identifies the authorization scope(s) for the method you are building.
8102    ///
8103    /// See [`Self::add_scope()`] for details.
8104    pub fn add_scopes<I, St>(
8105        mut self,
8106        scopes: I,
8107    ) -> AccountChannelPartnerLinkCustomerPatchCall<'a, C>
8108    where
8109        I: IntoIterator<Item = St>,
8110        St: AsRef<str>,
8111    {
8112        self._scopes
8113            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8114        self
8115    }
8116
8117    /// Removes all scopes, and no default scope will be used either.
8118    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8119    /// for details).
8120    pub fn clear_scopes(mut self) -> AccountChannelPartnerLinkCustomerPatchCall<'a, C> {
8121        self._scopes.clear();
8122        self
8123    }
8124}
8125
8126/// Initiates a channel partner link between a distributor and a reseller, or between resellers in an n-tier reseller channel. Invited partners need to follow the invite_link_uri provided in the response to accept. After accepting the invitation, a link is set up between the two parties. You must be a distributor to call this method. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * ALREADY_EXISTS: The ChannelPartnerLink sent in the request already exists. * NOT_FOUND: No Cloud Identity customer exists for provided domain. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The new ChannelPartnerLink resource.
8127///
8128/// A builder for the *channelPartnerLinks.create* method supported by a *account* resource.
8129/// It is not used directly, but through a [`AccountMethods`] instance.
8130///
8131/// # Example
8132///
8133/// Instantiate a resource method builder
8134///
8135/// ```test_harness,no_run
8136/// # extern crate hyper;
8137/// # extern crate hyper_rustls;
8138/// # extern crate google_cloudchannel1 as cloudchannel1;
8139/// use cloudchannel1::api::GoogleCloudChannelV1ChannelPartnerLink;
8140/// # async fn dox() {
8141/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8142///
8143/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8144/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8145/// #     .with_native_roots()
8146/// #     .unwrap()
8147/// #     .https_only()
8148/// #     .enable_http2()
8149/// #     .build();
8150///
8151/// # let executor = hyper_util::rt::TokioExecutor::new();
8152/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8153/// #     secret,
8154/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8155/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8156/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8157/// #     ),
8158/// # ).build().await.unwrap();
8159///
8160/// # let client = hyper_util::client::legacy::Client::builder(
8161/// #     hyper_util::rt::TokioExecutor::new()
8162/// # )
8163/// # .build(
8164/// #     hyper_rustls::HttpsConnectorBuilder::new()
8165/// #         .with_native_roots()
8166/// #         .unwrap()
8167/// #         .https_or_http()
8168/// #         .enable_http2()
8169/// #         .build()
8170/// # );
8171/// # let mut hub = Cloudchannel::new(client, auth);
8172/// // As the method needs a request, you would usually fill it with the desired information
8173/// // into the respective structure. Some of the parts shown here might not be applicable !
8174/// // Values shown here are possibly random and not representative !
8175/// let mut req = GoogleCloudChannelV1ChannelPartnerLink::default();
8176///
8177/// // You can configure optional parameters by calling the respective setters at will, and
8178/// // execute the final call using `doit()`.
8179/// // Values shown here are possibly random and not representative !
8180/// let result = hub.accounts().channel_partner_links_create(req, "parent")
8181///              .doit().await;
8182/// # }
8183/// ```
8184pub struct AccountChannelPartnerLinkCreateCall<'a, C>
8185where
8186    C: 'a,
8187{
8188    hub: &'a Cloudchannel<C>,
8189    _request: GoogleCloudChannelV1ChannelPartnerLink,
8190    _parent: String,
8191    _delegate: Option<&'a mut dyn common::Delegate>,
8192    _additional_params: HashMap<String, String>,
8193    _scopes: BTreeSet<String>,
8194}
8195
8196impl<'a, C> common::CallBuilder for AccountChannelPartnerLinkCreateCall<'a, C> {}
8197
8198impl<'a, C> AccountChannelPartnerLinkCreateCall<'a, C>
8199where
8200    C: common::Connector,
8201{
8202    /// Perform the operation you have build so far.
8203    pub async fn doit(
8204        mut self,
8205    ) -> common::Result<(common::Response, GoogleCloudChannelV1ChannelPartnerLink)> {
8206        use std::borrow::Cow;
8207        use std::io::{Read, Seek};
8208
8209        use common::{url::Params, ToParts};
8210        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8211
8212        let mut dd = common::DefaultDelegate;
8213        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8214        dlg.begin(common::MethodInfo {
8215            id: "cloudchannel.accounts.channelPartnerLinks.create",
8216            http_method: hyper::Method::POST,
8217        });
8218
8219        for &field in ["alt", "parent"].iter() {
8220            if self._additional_params.contains_key(field) {
8221                dlg.finished(false);
8222                return Err(common::Error::FieldClash(field));
8223            }
8224        }
8225
8226        let mut params = Params::with_capacity(4 + self._additional_params.len());
8227        params.push("parent", self._parent);
8228
8229        params.extend(self._additional_params.iter());
8230
8231        params.push("alt", "json");
8232        let mut url = self.hub._base_url.clone() + "v1/{+parent}/channelPartnerLinks";
8233        if self._scopes.is_empty() {
8234            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
8235        }
8236
8237        #[allow(clippy::single_element_loop)]
8238        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8239            url = params.uri_replacement(url, param_name, find_this, true);
8240        }
8241        {
8242            let to_remove = ["parent"];
8243            params.remove_params(&to_remove);
8244        }
8245
8246        let url = params.parse_with_url(&url);
8247
8248        let mut json_mime_type = mime::APPLICATION_JSON;
8249        let mut request_value_reader = {
8250            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8251            common::remove_json_null_values(&mut value);
8252            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8253            serde_json::to_writer(&mut dst, &value).unwrap();
8254            dst
8255        };
8256        let request_size = request_value_reader
8257            .seek(std::io::SeekFrom::End(0))
8258            .unwrap();
8259        request_value_reader
8260            .seek(std::io::SeekFrom::Start(0))
8261            .unwrap();
8262
8263        loop {
8264            let token = match self
8265                .hub
8266                .auth
8267                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8268                .await
8269            {
8270                Ok(token) => token,
8271                Err(e) => match dlg.token(e) {
8272                    Ok(token) => token,
8273                    Err(e) => {
8274                        dlg.finished(false);
8275                        return Err(common::Error::MissingToken(e));
8276                    }
8277                },
8278            };
8279            request_value_reader
8280                .seek(std::io::SeekFrom::Start(0))
8281                .unwrap();
8282            let mut req_result = {
8283                let client = &self.hub.client;
8284                dlg.pre_request();
8285                let mut req_builder = hyper::Request::builder()
8286                    .method(hyper::Method::POST)
8287                    .uri(url.as_str())
8288                    .header(USER_AGENT, self.hub._user_agent.clone());
8289
8290                if let Some(token) = token.as_ref() {
8291                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8292                }
8293
8294                let request = req_builder
8295                    .header(CONTENT_TYPE, json_mime_type.to_string())
8296                    .header(CONTENT_LENGTH, request_size as u64)
8297                    .body(common::to_body(
8298                        request_value_reader.get_ref().clone().into(),
8299                    ));
8300
8301                client.request(request.unwrap()).await
8302            };
8303
8304            match req_result {
8305                Err(err) => {
8306                    if let common::Retry::After(d) = dlg.http_error(&err) {
8307                        sleep(d).await;
8308                        continue;
8309                    }
8310                    dlg.finished(false);
8311                    return Err(common::Error::HttpError(err));
8312                }
8313                Ok(res) => {
8314                    let (mut parts, body) = res.into_parts();
8315                    let mut body = common::Body::new(body);
8316                    if !parts.status.is_success() {
8317                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8318                        let error = serde_json::from_str(&common::to_string(&bytes));
8319                        let response = common::to_response(parts, bytes.into());
8320
8321                        if let common::Retry::After(d) =
8322                            dlg.http_failure(&response, error.as_ref().ok())
8323                        {
8324                            sleep(d).await;
8325                            continue;
8326                        }
8327
8328                        dlg.finished(false);
8329
8330                        return Err(match error {
8331                            Ok(value) => common::Error::BadRequest(value),
8332                            _ => common::Error::Failure(response),
8333                        });
8334                    }
8335                    let response = {
8336                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8337                        let encoded = common::to_string(&bytes);
8338                        match serde_json::from_str(&encoded) {
8339                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8340                            Err(error) => {
8341                                dlg.response_json_decode_error(&encoded, &error);
8342                                return Err(common::Error::JsonDecodeError(
8343                                    encoded.to_string(),
8344                                    error,
8345                                ));
8346                            }
8347                        }
8348                    };
8349
8350                    dlg.finished(true);
8351                    return Ok(response);
8352                }
8353            }
8354        }
8355    }
8356
8357    ///
8358    /// Sets the *request* property to the given value.
8359    ///
8360    /// Even though the property as already been set when instantiating this call,
8361    /// we provide this method for API completeness.
8362    pub fn request(
8363        mut self,
8364        new_value: GoogleCloudChannelV1ChannelPartnerLink,
8365    ) -> AccountChannelPartnerLinkCreateCall<'a, C> {
8366        self._request = new_value;
8367        self
8368    }
8369    /// Required. Create a channel partner link for the provided reseller account's resource name. Parent uses the format: accounts/{account_id}
8370    ///
8371    /// Sets the *parent* path property to the given value.
8372    ///
8373    /// Even though the property as already been set when instantiating this call,
8374    /// we provide this method for API completeness.
8375    pub fn parent(mut self, new_value: &str) -> AccountChannelPartnerLinkCreateCall<'a, C> {
8376        self._parent = new_value.to_string();
8377        self
8378    }
8379    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8380    /// while executing the actual API request.
8381    ///
8382    /// ````text
8383    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8384    /// ````
8385    ///
8386    /// Sets the *delegate* property to the given value.
8387    pub fn delegate(
8388        mut self,
8389        new_value: &'a mut dyn common::Delegate,
8390    ) -> AccountChannelPartnerLinkCreateCall<'a, C> {
8391        self._delegate = Some(new_value);
8392        self
8393    }
8394
8395    /// Set any additional parameter of the query string used in the request.
8396    /// It should be used to set parameters which are not yet available through their own
8397    /// setters.
8398    ///
8399    /// Please note that this method must not be used to set any of the known parameters
8400    /// which have their own setter method. If done anyway, the request will fail.
8401    ///
8402    /// # Additional Parameters
8403    ///
8404    /// * *$.xgafv* (query-string) - V1 error format.
8405    /// * *access_token* (query-string) - OAuth access token.
8406    /// * *alt* (query-string) - Data format for response.
8407    /// * *callback* (query-string) - JSONP
8408    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8409    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8410    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8411    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8412    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8413    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8414    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8415    pub fn param<T>(mut self, name: T, value: T) -> AccountChannelPartnerLinkCreateCall<'a, C>
8416    where
8417        T: AsRef<str>,
8418    {
8419        self._additional_params
8420            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8421        self
8422    }
8423
8424    /// Identifies the authorization scope for the method you are building.
8425    ///
8426    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8427    /// [`Scope::AppOrder`].
8428    ///
8429    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8430    /// tokens for more than one scope.
8431    ///
8432    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8433    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8434    /// sufficient, a read-write scope will do as well.
8435    pub fn add_scope<St>(mut self, scope: St) -> AccountChannelPartnerLinkCreateCall<'a, C>
8436    where
8437        St: AsRef<str>,
8438    {
8439        self._scopes.insert(String::from(scope.as_ref()));
8440        self
8441    }
8442    /// Identifies the authorization scope(s) for the method you are building.
8443    ///
8444    /// See [`Self::add_scope()`] for details.
8445    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountChannelPartnerLinkCreateCall<'a, C>
8446    where
8447        I: IntoIterator<Item = St>,
8448        St: AsRef<str>,
8449    {
8450        self._scopes
8451            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8452        self
8453    }
8454
8455    /// Removes all scopes, and no default scope will be used either.
8456    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8457    /// for details).
8458    pub fn clear_scopes(mut self) -> AccountChannelPartnerLinkCreateCall<'a, C> {
8459        self._scopes.clear();
8460        self
8461    }
8462}
8463
8464/// Returns the requested ChannelPartnerLink resource. You must be a distributor to call this method. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: ChannelPartnerLink resource not found because of an invalid channel partner link name. Return value: The ChannelPartnerLink resource.
8465///
8466/// A builder for the *channelPartnerLinks.get* method supported by a *account* resource.
8467/// It is not used directly, but through a [`AccountMethods`] instance.
8468///
8469/// # Example
8470///
8471/// Instantiate a resource method builder
8472///
8473/// ```test_harness,no_run
8474/// # extern crate hyper;
8475/// # extern crate hyper_rustls;
8476/// # extern crate google_cloudchannel1 as cloudchannel1;
8477/// # async fn dox() {
8478/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8479///
8480/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8481/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8482/// #     .with_native_roots()
8483/// #     .unwrap()
8484/// #     .https_only()
8485/// #     .enable_http2()
8486/// #     .build();
8487///
8488/// # let executor = hyper_util::rt::TokioExecutor::new();
8489/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8490/// #     secret,
8491/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8492/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8493/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8494/// #     ),
8495/// # ).build().await.unwrap();
8496///
8497/// # let client = hyper_util::client::legacy::Client::builder(
8498/// #     hyper_util::rt::TokioExecutor::new()
8499/// # )
8500/// # .build(
8501/// #     hyper_rustls::HttpsConnectorBuilder::new()
8502/// #         .with_native_roots()
8503/// #         .unwrap()
8504/// #         .https_or_http()
8505/// #         .enable_http2()
8506/// #         .build()
8507/// # );
8508/// # let mut hub = Cloudchannel::new(client, auth);
8509/// // You can configure optional parameters by calling the respective setters at will, and
8510/// // execute the final call using `doit()`.
8511/// // Values shown here are possibly random and not representative !
8512/// let result = hub.accounts().channel_partner_links_get("name")
8513///              .view("duo")
8514///              .doit().await;
8515/// # }
8516/// ```
8517pub struct AccountChannelPartnerLinkGetCall<'a, C>
8518where
8519    C: 'a,
8520{
8521    hub: &'a Cloudchannel<C>,
8522    _name: String,
8523    _view: Option<String>,
8524    _delegate: Option<&'a mut dyn common::Delegate>,
8525    _additional_params: HashMap<String, String>,
8526    _scopes: BTreeSet<String>,
8527}
8528
8529impl<'a, C> common::CallBuilder for AccountChannelPartnerLinkGetCall<'a, C> {}
8530
8531impl<'a, C> AccountChannelPartnerLinkGetCall<'a, C>
8532where
8533    C: common::Connector,
8534{
8535    /// Perform the operation you have build so far.
8536    pub async fn doit(
8537        mut self,
8538    ) -> common::Result<(common::Response, GoogleCloudChannelV1ChannelPartnerLink)> {
8539        use std::borrow::Cow;
8540        use std::io::{Read, Seek};
8541
8542        use common::{url::Params, ToParts};
8543        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8544
8545        let mut dd = common::DefaultDelegate;
8546        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8547        dlg.begin(common::MethodInfo {
8548            id: "cloudchannel.accounts.channelPartnerLinks.get",
8549            http_method: hyper::Method::GET,
8550        });
8551
8552        for &field in ["alt", "name", "view"].iter() {
8553            if self._additional_params.contains_key(field) {
8554                dlg.finished(false);
8555                return Err(common::Error::FieldClash(field));
8556            }
8557        }
8558
8559        let mut params = Params::with_capacity(4 + self._additional_params.len());
8560        params.push("name", self._name);
8561        if let Some(value) = self._view.as_ref() {
8562            params.push("view", value);
8563        }
8564
8565        params.extend(self._additional_params.iter());
8566
8567        params.push("alt", "json");
8568        let mut url = self.hub._base_url.clone() + "v1/{+name}";
8569        if self._scopes.is_empty() {
8570            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
8571        }
8572
8573        #[allow(clippy::single_element_loop)]
8574        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8575            url = params.uri_replacement(url, param_name, find_this, true);
8576        }
8577        {
8578            let to_remove = ["name"];
8579            params.remove_params(&to_remove);
8580        }
8581
8582        let url = params.parse_with_url(&url);
8583
8584        loop {
8585            let token = match self
8586                .hub
8587                .auth
8588                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8589                .await
8590            {
8591                Ok(token) => token,
8592                Err(e) => match dlg.token(e) {
8593                    Ok(token) => token,
8594                    Err(e) => {
8595                        dlg.finished(false);
8596                        return Err(common::Error::MissingToken(e));
8597                    }
8598                },
8599            };
8600            let mut req_result = {
8601                let client = &self.hub.client;
8602                dlg.pre_request();
8603                let mut req_builder = hyper::Request::builder()
8604                    .method(hyper::Method::GET)
8605                    .uri(url.as_str())
8606                    .header(USER_AGENT, self.hub._user_agent.clone());
8607
8608                if let Some(token) = token.as_ref() {
8609                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8610                }
8611
8612                let request = req_builder
8613                    .header(CONTENT_LENGTH, 0_u64)
8614                    .body(common::to_body::<String>(None));
8615
8616                client.request(request.unwrap()).await
8617            };
8618
8619            match req_result {
8620                Err(err) => {
8621                    if let common::Retry::After(d) = dlg.http_error(&err) {
8622                        sleep(d).await;
8623                        continue;
8624                    }
8625                    dlg.finished(false);
8626                    return Err(common::Error::HttpError(err));
8627                }
8628                Ok(res) => {
8629                    let (mut parts, body) = res.into_parts();
8630                    let mut body = common::Body::new(body);
8631                    if !parts.status.is_success() {
8632                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8633                        let error = serde_json::from_str(&common::to_string(&bytes));
8634                        let response = common::to_response(parts, bytes.into());
8635
8636                        if let common::Retry::After(d) =
8637                            dlg.http_failure(&response, error.as_ref().ok())
8638                        {
8639                            sleep(d).await;
8640                            continue;
8641                        }
8642
8643                        dlg.finished(false);
8644
8645                        return Err(match error {
8646                            Ok(value) => common::Error::BadRequest(value),
8647                            _ => common::Error::Failure(response),
8648                        });
8649                    }
8650                    let response = {
8651                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8652                        let encoded = common::to_string(&bytes);
8653                        match serde_json::from_str(&encoded) {
8654                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8655                            Err(error) => {
8656                                dlg.response_json_decode_error(&encoded, &error);
8657                                return Err(common::Error::JsonDecodeError(
8658                                    encoded.to_string(),
8659                                    error,
8660                                ));
8661                            }
8662                        }
8663                    };
8664
8665                    dlg.finished(true);
8666                    return Ok(response);
8667                }
8668            }
8669        }
8670    }
8671
8672    /// Required. The resource name of the channel partner link to retrieve. Name uses the format: accounts/{account_id}/channelPartnerLinks/{id} where {id} is the Cloud Identity ID of the partner.
8673    ///
8674    /// Sets the *name* path property to the given value.
8675    ///
8676    /// Even though the property as already been set when instantiating this call,
8677    /// we provide this method for API completeness.
8678    pub fn name(mut self, new_value: &str) -> AccountChannelPartnerLinkGetCall<'a, C> {
8679        self._name = new_value.to_string();
8680        self
8681    }
8682    /// Optional. The level of granularity the ChannelPartnerLink will display.
8683    ///
8684    /// Sets the *view* query property to the given value.
8685    pub fn view(mut self, new_value: &str) -> AccountChannelPartnerLinkGetCall<'a, C> {
8686        self._view = Some(new_value.to_string());
8687        self
8688    }
8689    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8690    /// while executing the actual API request.
8691    ///
8692    /// ````text
8693    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8694    /// ````
8695    ///
8696    /// Sets the *delegate* property to the given value.
8697    pub fn delegate(
8698        mut self,
8699        new_value: &'a mut dyn common::Delegate,
8700    ) -> AccountChannelPartnerLinkGetCall<'a, C> {
8701        self._delegate = Some(new_value);
8702        self
8703    }
8704
8705    /// Set any additional parameter of the query string used in the request.
8706    /// It should be used to set parameters which are not yet available through their own
8707    /// setters.
8708    ///
8709    /// Please note that this method must not be used to set any of the known parameters
8710    /// which have their own setter method. If done anyway, the request will fail.
8711    ///
8712    /// # Additional Parameters
8713    ///
8714    /// * *$.xgafv* (query-string) - V1 error format.
8715    /// * *access_token* (query-string) - OAuth access token.
8716    /// * *alt* (query-string) - Data format for response.
8717    /// * *callback* (query-string) - JSONP
8718    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8719    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8720    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8721    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8722    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8723    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8724    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8725    pub fn param<T>(mut self, name: T, value: T) -> AccountChannelPartnerLinkGetCall<'a, C>
8726    where
8727        T: AsRef<str>,
8728    {
8729        self._additional_params
8730            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8731        self
8732    }
8733
8734    /// Identifies the authorization scope for the method you are building.
8735    ///
8736    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8737    /// [`Scope::AppOrder`].
8738    ///
8739    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8740    /// tokens for more than one scope.
8741    ///
8742    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8743    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8744    /// sufficient, a read-write scope will do as well.
8745    pub fn add_scope<St>(mut self, scope: St) -> AccountChannelPartnerLinkGetCall<'a, C>
8746    where
8747        St: AsRef<str>,
8748    {
8749        self._scopes.insert(String::from(scope.as_ref()));
8750        self
8751    }
8752    /// Identifies the authorization scope(s) for the method you are building.
8753    ///
8754    /// See [`Self::add_scope()`] for details.
8755    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountChannelPartnerLinkGetCall<'a, C>
8756    where
8757        I: IntoIterator<Item = St>,
8758        St: AsRef<str>,
8759    {
8760        self._scopes
8761            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8762        self
8763    }
8764
8765    /// Removes all scopes, and no default scope will be used either.
8766    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8767    /// for details).
8768    pub fn clear_scopes(mut self) -> AccountChannelPartnerLinkGetCall<'a, C> {
8769        self._scopes.clear();
8770        self
8771    }
8772}
8773
8774/// List ChannelPartnerLinks belonging to a distributor. You must be a distributor to call this method. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. Return value: The list of the distributor account's ChannelPartnerLink resources.
8775///
8776/// A builder for the *channelPartnerLinks.list* method supported by a *account* resource.
8777/// It is not used directly, but through a [`AccountMethods`] instance.
8778///
8779/// # Example
8780///
8781/// Instantiate a resource method builder
8782///
8783/// ```test_harness,no_run
8784/// # extern crate hyper;
8785/// # extern crate hyper_rustls;
8786/// # extern crate google_cloudchannel1 as cloudchannel1;
8787/// # async fn dox() {
8788/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8789///
8790/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8791/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8792/// #     .with_native_roots()
8793/// #     .unwrap()
8794/// #     .https_only()
8795/// #     .enable_http2()
8796/// #     .build();
8797///
8798/// # let executor = hyper_util::rt::TokioExecutor::new();
8799/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8800/// #     secret,
8801/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8802/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8803/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8804/// #     ),
8805/// # ).build().await.unwrap();
8806///
8807/// # let client = hyper_util::client::legacy::Client::builder(
8808/// #     hyper_util::rt::TokioExecutor::new()
8809/// # )
8810/// # .build(
8811/// #     hyper_rustls::HttpsConnectorBuilder::new()
8812/// #         .with_native_roots()
8813/// #         .unwrap()
8814/// #         .https_or_http()
8815/// #         .enable_http2()
8816/// #         .build()
8817/// # );
8818/// # let mut hub = Cloudchannel::new(client, auth);
8819/// // You can configure optional parameters by calling the respective setters at will, and
8820/// // execute the final call using `doit()`.
8821/// // Values shown here are possibly random and not representative !
8822/// let result = hub.accounts().channel_partner_links_list("parent")
8823///              .view("sed")
8824///              .page_token("ut")
8825///              .page_size(-12)
8826///              .doit().await;
8827/// # }
8828/// ```
8829pub struct AccountChannelPartnerLinkListCall<'a, C>
8830where
8831    C: 'a,
8832{
8833    hub: &'a Cloudchannel<C>,
8834    _parent: String,
8835    _view: Option<String>,
8836    _page_token: Option<String>,
8837    _page_size: Option<i32>,
8838    _delegate: Option<&'a mut dyn common::Delegate>,
8839    _additional_params: HashMap<String, String>,
8840    _scopes: BTreeSet<String>,
8841}
8842
8843impl<'a, C> common::CallBuilder for AccountChannelPartnerLinkListCall<'a, C> {}
8844
8845impl<'a, C> AccountChannelPartnerLinkListCall<'a, C>
8846where
8847    C: common::Connector,
8848{
8849    /// Perform the operation you have build so far.
8850    pub async fn doit(
8851        mut self,
8852    ) -> common::Result<(
8853        common::Response,
8854        GoogleCloudChannelV1ListChannelPartnerLinksResponse,
8855    )> {
8856        use std::borrow::Cow;
8857        use std::io::{Read, Seek};
8858
8859        use common::{url::Params, ToParts};
8860        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8861
8862        let mut dd = common::DefaultDelegate;
8863        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8864        dlg.begin(common::MethodInfo {
8865            id: "cloudchannel.accounts.channelPartnerLinks.list",
8866            http_method: hyper::Method::GET,
8867        });
8868
8869        for &field in ["alt", "parent", "view", "pageToken", "pageSize"].iter() {
8870            if self._additional_params.contains_key(field) {
8871                dlg.finished(false);
8872                return Err(common::Error::FieldClash(field));
8873            }
8874        }
8875
8876        let mut params = Params::with_capacity(6 + self._additional_params.len());
8877        params.push("parent", self._parent);
8878        if let Some(value) = self._view.as_ref() {
8879            params.push("view", value);
8880        }
8881        if let Some(value) = self._page_token.as_ref() {
8882            params.push("pageToken", value);
8883        }
8884        if let Some(value) = self._page_size.as_ref() {
8885            params.push("pageSize", value.to_string());
8886        }
8887
8888        params.extend(self._additional_params.iter());
8889
8890        params.push("alt", "json");
8891        let mut url = self.hub._base_url.clone() + "v1/{+parent}/channelPartnerLinks";
8892        if self._scopes.is_empty() {
8893            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
8894        }
8895
8896        #[allow(clippy::single_element_loop)]
8897        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8898            url = params.uri_replacement(url, param_name, find_this, true);
8899        }
8900        {
8901            let to_remove = ["parent"];
8902            params.remove_params(&to_remove);
8903        }
8904
8905        let url = params.parse_with_url(&url);
8906
8907        loop {
8908            let token = match self
8909                .hub
8910                .auth
8911                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8912                .await
8913            {
8914                Ok(token) => token,
8915                Err(e) => match dlg.token(e) {
8916                    Ok(token) => token,
8917                    Err(e) => {
8918                        dlg.finished(false);
8919                        return Err(common::Error::MissingToken(e));
8920                    }
8921                },
8922            };
8923            let mut req_result = {
8924                let client = &self.hub.client;
8925                dlg.pre_request();
8926                let mut req_builder = hyper::Request::builder()
8927                    .method(hyper::Method::GET)
8928                    .uri(url.as_str())
8929                    .header(USER_AGENT, self.hub._user_agent.clone());
8930
8931                if let Some(token) = token.as_ref() {
8932                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8933                }
8934
8935                let request = req_builder
8936                    .header(CONTENT_LENGTH, 0_u64)
8937                    .body(common::to_body::<String>(None));
8938
8939                client.request(request.unwrap()).await
8940            };
8941
8942            match req_result {
8943                Err(err) => {
8944                    if let common::Retry::After(d) = dlg.http_error(&err) {
8945                        sleep(d).await;
8946                        continue;
8947                    }
8948                    dlg.finished(false);
8949                    return Err(common::Error::HttpError(err));
8950                }
8951                Ok(res) => {
8952                    let (mut parts, body) = res.into_parts();
8953                    let mut body = common::Body::new(body);
8954                    if !parts.status.is_success() {
8955                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8956                        let error = serde_json::from_str(&common::to_string(&bytes));
8957                        let response = common::to_response(parts, bytes.into());
8958
8959                        if let common::Retry::After(d) =
8960                            dlg.http_failure(&response, error.as_ref().ok())
8961                        {
8962                            sleep(d).await;
8963                            continue;
8964                        }
8965
8966                        dlg.finished(false);
8967
8968                        return Err(match error {
8969                            Ok(value) => common::Error::BadRequest(value),
8970                            _ => common::Error::Failure(response),
8971                        });
8972                    }
8973                    let response = {
8974                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8975                        let encoded = common::to_string(&bytes);
8976                        match serde_json::from_str(&encoded) {
8977                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8978                            Err(error) => {
8979                                dlg.response_json_decode_error(&encoded, &error);
8980                                return Err(common::Error::JsonDecodeError(
8981                                    encoded.to_string(),
8982                                    error,
8983                                ));
8984                            }
8985                        }
8986                    };
8987
8988                    dlg.finished(true);
8989                    return Ok(response);
8990                }
8991            }
8992        }
8993    }
8994
8995    /// Required. The resource name of the reseller account for listing channel partner links. Parent uses the format: accounts/{account_id}
8996    ///
8997    /// Sets the *parent* path property to the given value.
8998    ///
8999    /// Even though the property as already been set when instantiating this call,
9000    /// we provide this method for API completeness.
9001    pub fn parent(mut self, new_value: &str) -> AccountChannelPartnerLinkListCall<'a, C> {
9002        self._parent = new_value.to_string();
9003        self
9004    }
9005    /// Optional. The level of granularity the ChannelPartnerLink will display.
9006    ///
9007    /// Sets the *view* query property to the given value.
9008    pub fn view(mut self, new_value: &str) -> AccountChannelPartnerLinkListCall<'a, C> {
9009        self._view = Some(new_value.to_string());
9010        self
9011    }
9012    /// Optional. A token for a page of results other than the first page. Obtained using ListChannelPartnerLinksResponse.next_page_token of the previous CloudChannelService.ListChannelPartnerLinks call.
9013    ///
9014    /// Sets the *page token* query property to the given value.
9015    pub fn page_token(mut self, new_value: &str) -> AccountChannelPartnerLinkListCall<'a, C> {
9016        self._page_token = Some(new_value.to_string());
9017        self
9018    }
9019    /// Optional. Requested page size. Server might return fewer results than requested. If unspecified, server will pick a default size (25). The maximum value is 200; the server will coerce values above 200.
9020    ///
9021    /// Sets the *page size* query property to the given value.
9022    pub fn page_size(mut self, new_value: i32) -> AccountChannelPartnerLinkListCall<'a, C> {
9023        self._page_size = Some(new_value);
9024        self
9025    }
9026    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9027    /// while executing the actual API request.
9028    ///
9029    /// ````text
9030    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9031    /// ````
9032    ///
9033    /// Sets the *delegate* property to the given value.
9034    pub fn delegate(
9035        mut self,
9036        new_value: &'a mut dyn common::Delegate,
9037    ) -> AccountChannelPartnerLinkListCall<'a, C> {
9038        self._delegate = Some(new_value);
9039        self
9040    }
9041
9042    /// Set any additional parameter of the query string used in the request.
9043    /// It should be used to set parameters which are not yet available through their own
9044    /// setters.
9045    ///
9046    /// Please note that this method must not be used to set any of the known parameters
9047    /// which have their own setter method. If done anyway, the request will fail.
9048    ///
9049    /// # Additional Parameters
9050    ///
9051    /// * *$.xgafv* (query-string) - V1 error format.
9052    /// * *access_token* (query-string) - OAuth access token.
9053    /// * *alt* (query-string) - Data format for response.
9054    /// * *callback* (query-string) - JSONP
9055    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9056    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9057    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9058    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9059    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9060    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9061    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9062    pub fn param<T>(mut self, name: T, value: T) -> AccountChannelPartnerLinkListCall<'a, C>
9063    where
9064        T: AsRef<str>,
9065    {
9066        self._additional_params
9067            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9068        self
9069    }
9070
9071    /// Identifies the authorization scope for the method you are building.
9072    ///
9073    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9074    /// [`Scope::AppOrder`].
9075    ///
9076    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9077    /// tokens for more than one scope.
9078    ///
9079    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9080    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9081    /// sufficient, a read-write scope will do as well.
9082    pub fn add_scope<St>(mut self, scope: St) -> AccountChannelPartnerLinkListCall<'a, C>
9083    where
9084        St: AsRef<str>,
9085    {
9086        self._scopes.insert(String::from(scope.as_ref()));
9087        self
9088    }
9089    /// Identifies the authorization scope(s) for the method you are building.
9090    ///
9091    /// See [`Self::add_scope()`] for details.
9092    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountChannelPartnerLinkListCall<'a, C>
9093    where
9094        I: IntoIterator<Item = St>,
9095        St: AsRef<str>,
9096    {
9097        self._scopes
9098            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9099        self
9100    }
9101
9102    /// Removes all scopes, and no default scope will be used either.
9103    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9104    /// for details).
9105    pub fn clear_scopes(mut self) -> AccountChannelPartnerLinkListCall<'a, C> {
9106        self._scopes.clear();
9107        self
9108    }
9109}
9110
9111/// Updates a channel partner link. Distributors call this method to change a link's status. For example, to suspend a partner link. You must be a distributor to call this method. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: * Required request parameters are missing or invalid. * Link state cannot change from invited to active or suspended. * Cannot send reseller_cloud_identity_id, invite_url, or name in update mask. * NOT_FOUND: ChannelPartnerLink resource not found. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The updated ChannelPartnerLink resource.
9112///
9113/// A builder for the *channelPartnerLinks.patch* method supported by a *account* resource.
9114/// It is not used directly, but through a [`AccountMethods`] instance.
9115///
9116/// # Example
9117///
9118/// Instantiate a resource method builder
9119///
9120/// ```test_harness,no_run
9121/// # extern crate hyper;
9122/// # extern crate hyper_rustls;
9123/// # extern crate google_cloudchannel1 as cloudchannel1;
9124/// use cloudchannel1::api::GoogleCloudChannelV1UpdateChannelPartnerLinkRequest;
9125/// # async fn dox() {
9126/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9127///
9128/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9129/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9130/// #     .with_native_roots()
9131/// #     .unwrap()
9132/// #     .https_only()
9133/// #     .enable_http2()
9134/// #     .build();
9135///
9136/// # let executor = hyper_util::rt::TokioExecutor::new();
9137/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9138/// #     secret,
9139/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9140/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9141/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9142/// #     ),
9143/// # ).build().await.unwrap();
9144///
9145/// # let client = hyper_util::client::legacy::Client::builder(
9146/// #     hyper_util::rt::TokioExecutor::new()
9147/// # )
9148/// # .build(
9149/// #     hyper_rustls::HttpsConnectorBuilder::new()
9150/// #         .with_native_roots()
9151/// #         .unwrap()
9152/// #         .https_or_http()
9153/// #         .enable_http2()
9154/// #         .build()
9155/// # );
9156/// # let mut hub = Cloudchannel::new(client, auth);
9157/// // As the method needs a request, you would usually fill it with the desired information
9158/// // into the respective structure. Some of the parts shown here might not be applicable !
9159/// // Values shown here are possibly random and not representative !
9160/// let mut req = GoogleCloudChannelV1UpdateChannelPartnerLinkRequest::default();
9161///
9162/// // You can configure optional parameters by calling the respective setters at will, and
9163/// // execute the final call using `doit()`.
9164/// // Values shown here are possibly random and not representative !
9165/// let result = hub.accounts().channel_partner_links_patch(req, "name")
9166///              .doit().await;
9167/// # }
9168/// ```
9169pub struct AccountChannelPartnerLinkPatchCall<'a, C>
9170where
9171    C: 'a,
9172{
9173    hub: &'a Cloudchannel<C>,
9174    _request: GoogleCloudChannelV1UpdateChannelPartnerLinkRequest,
9175    _name: String,
9176    _delegate: Option<&'a mut dyn common::Delegate>,
9177    _additional_params: HashMap<String, String>,
9178    _scopes: BTreeSet<String>,
9179}
9180
9181impl<'a, C> common::CallBuilder for AccountChannelPartnerLinkPatchCall<'a, C> {}
9182
9183impl<'a, C> AccountChannelPartnerLinkPatchCall<'a, C>
9184where
9185    C: common::Connector,
9186{
9187    /// Perform the operation you have build so far.
9188    pub async fn doit(
9189        mut self,
9190    ) -> common::Result<(common::Response, GoogleCloudChannelV1ChannelPartnerLink)> {
9191        use std::borrow::Cow;
9192        use std::io::{Read, Seek};
9193
9194        use common::{url::Params, ToParts};
9195        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9196
9197        let mut dd = common::DefaultDelegate;
9198        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9199        dlg.begin(common::MethodInfo {
9200            id: "cloudchannel.accounts.channelPartnerLinks.patch",
9201            http_method: hyper::Method::PATCH,
9202        });
9203
9204        for &field in ["alt", "name"].iter() {
9205            if self._additional_params.contains_key(field) {
9206                dlg.finished(false);
9207                return Err(common::Error::FieldClash(field));
9208            }
9209        }
9210
9211        let mut params = Params::with_capacity(4 + self._additional_params.len());
9212        params.push("name", self._name);
9213
9214        params.extend(self._additional_params.iter());
9215
9216        params.push("alt", "json");
9217        let mut url = self.hub._base_url.clone() + "v1/{+name}";
9218        if self._scopes.is_empty() {
9219            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
9220        }
9221
9222        #[allow(clippy::single_element_loop)]
9223        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9224            url = params.uri_replacement(url, param_name, find_this, true);
9225        }
9226        {
9227            let to_remove = ["name"];
9228            params.remove_params(&to_remove);
9229        }
9230
9231        let url = params.parse_with_url(&url);
9232
9233        let mut json_mime_type = mime::APPLICATION_JSON;
9234        let mut request_value_reader = {
9235            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9236            common::remove_json_null_values(&mut value);
9237            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9238            serde_json::to_writer(&mut dst, &value).unwrap();
9239            dst
9240        };
9241        let request_size = request_value_reader
9242            .seek(std::io::SeekFrom::End(0))
9243            .unwrap();
9244        request_value_reader
9245            .seek(std::io::SeekFrom::Start(0))
9246            .unwrap();
9247
9248        loop {
9249            let token = match self
9250                .hub
9251                .auth
9252                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9253                .await
9254            {
9255                Ok(token) => token,
9256                Err(e) => match dlg.token(e) {
9257                    Ok(token) => token,
9258                    Err(e) => {
9259                        dlg.finished(false);
9260                        return Err(common::Error::MissingToken(e));
9261                    }
9262                },
9263            };
9264            request_value_reader
9265                .seek(std::io::SeekFrom::Start(0))
9266                .unwrap();
9267            let mut req_result = {
9268                let client = &self.hub.client;
9269                dlg.pre_request();
9270                let mut req_builder = hyper::Request::builder()
9271                    .method(hyper::Method::PATCH)
9272                    .uri(url.as_str())
9273                    .header(USER_AGENT, self.hub._user_agent.clone());
9274
9275                if let Some(token) = token.as_ref() {
9276                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9277                }
9278
9279                let request = req_builder
9280                    .header(CONTENT_TYPE, json_mime_type.to_string())
9281                    .header(CONTENT_LENGTH, request_size as u64)
9282                    .body(common::to_body(
9283                        request_value_reader.get_ref().clone().into(),
9284                    ));
9285
9286                client.request(request.unwrap()).await
9287            };
9288
9289            match req_result {
9290                Err(err) => {
9291                    if let common::Retry::After(d) = dlg.http_error(&err) {
9292                        sleep(d).await;
9293                        continue;
9294                    }
9295                    dlg.finished(false);
9296                    return Err(common::Error::HttpError(err));
9297                }
9298                Ok(res) => {
9299                    let (mut parts, body) = res.into_parts();
9300                    let mut body = common::Body::new(body);
9301                    if !parts.status.is_success() {
9302                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9303                        let error = serde_json::from_str(&common::to_string(&bytes));
9304                        let response = common::to_response(parts, bytes.into());
9305
9306                        if let common::Retry::After(d) =
9307                            dlg.http_failure(&response, error.as_ref().ok())
9308                        {
9309                            sleep(d).await;
9310                            continue;
9311                        }
9312
9313                        dlg.finished(false);
9314
9315                        return Err(match error {
9316                            Ok(value) => common::Error::BadRequest(value),
9317                            _ => common::Error::Failure(response),
9318                        });
9319                    }
9320                    let response = {
9321                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9322                        let encoded = common::to_string(&bytes);
9323                        match serde_json::from_str(&encoded) {
9324                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9325                            Err(error) => {
9326                                dlg.response_json_decode_error(&encoded, &error);
9327                                return Err(common::Error::JsonDecodeError(
9328                                    encoded.to_string(),
9329                                    error,
9330                                ));
9331                            }
9332                        }
9333                    };
9334
9335                    dlg.finished(true);
9336                    return Ok(response);
9337                }
9338            }
9339        }
9340    }
9341
9342    ///
9343    /// Sets the *request* property to the given value.
9344    ///
9345    /// Even though the property as already been set when instantiating this call,
9346    /// we provide this method for API completeness.
9347    pub fn request(
9348        mut self,
9349        new_value: GoogleCloudChannelV1UpdateChannelPartnerLinkRequest,
9350    ) -> AccountChannelPartnerLinkPatchCall<'a, C> {
9351        self._request = new_value;
9352        self
9353    }
9354    /// Required. The resource name of the channel partner link to cancel. Name uses the format: accounts/{account_id}/channelPartnerLinks/{id} where {id} is the Cloud Identity ID of the partner.
9355    ///
9356    /// Sets the *name* path property to the given value.
9357    ///
9358    /// Even though the property as already been set when instantiating this call,
9359    /// we provide this method for API completeness.
9360    pub fn name(mut self, new_value: &str) -> AccountChannelPartnerLinkPatchCall<'a, C> {
9361        self._name = new_value.to_string();
9362        self
9363    }
9364    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9365    /// while executing the actual API request.
9366    ///
9367    /// ````text
9368    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9369    /// ````
9370    ///
9371    /// Sets the *delegate* property to the given value.
9372    pub fn delegate(
9373        mut self,
9374        new_value: &'a mut dyn common::Delegate,
9375    ) -> AccountChannelPartnerLinkPatchCall<'a, C> {
9376        self._delegate = Some(new_value);
9377        self
9378    }
9379
9380    /// Set any additional parameter of the query string used in the request.
9381    /// It should be used to set parameters which are not yet available through their own
9382    /// setters.
9383    ///
9384    /// Please note that this method must not be used to set any of the known parameters
9385    /// which have their own setter method. If done anyway, the request will fail.
9386    ///
9387    /// # Additional Parameters
9388    ///
9389    /// * *$.xgafv* (query-string) - V1 error format.
9390    /// * *access_token* (query-string) - OAuth access token.
9391    /// * *alt* (query-string) - Data format for response.
9392    /// * *callback* (query-string) - JSONP
9393    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9394    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9395    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9396    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9397    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9398    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9399    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9400    pub fn param<T>(mut self, name: T, value: T) -> AccountChannelPartnerLinkPatchCall<'a, C>
9401    where
9402        T: AsRef<str>,
9403    {
9404        self._additional_params
9405            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9406        self
9407    }
9408
9409    /// Identifies the authorization scope for the method you are building.
9410    ///
9411    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9412    /// [`Scope::AppOrder`].
9413    ///
9414    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9415    /// tokens for more than one scope.
9416    ///
9417    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9418    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9419    /// sufficient, a read-write scope will do as well.
9420    pub fn add_scope<St>(mut self, scope: St) -> AccountChannelPartnerLinkPatchCall<'a, C>
9421    where
9422        St: AsRef<str>,
9423    {
9424        self._scopes.insert(String::from(scope.as_ref()));
9425        self
9426    }
9427    /// Identifies the authorization scope(s) for the method you are building.
9428    ///
9429    /// See [`Self::add_scope()`] for details.
9430    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountChannelPartnerLinkPatchCall<'a, C>
9431    where
9432        I: IntoIterator<Item = St>,
9433        St: AsRef<str>,
9434    {
9435        self._scopes
9436            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9437        self
9438    }
9439
9440    /// Removes all scopes, and no default scope will be used either.
9441    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9442    /// for details).
9443    pub fn clear_scopes(mut self) -> AccountChannelPartnerLinkPatchCall<'a, C> {
9444        self._scopes.clear();
9445        self
9446    }
9447}
9448
9449/// Creates a CustomerRepricingConfig. Call this method to set modifications for a specific customer's bill. You can only create configs if the RepricingConfig.effective_invoice_month is a future month. If needed, you can create a config for the current month, with some restrictions. When creating a config for a future month, make sure there are no existing configs for that RepricingConfig.effective_invoice_month. The following restrictions are for creating configs in the current month. * This functionality is reserved for recovering from an erroneous config, and should not be used for regular business cases. * The new config will not modify exports used with other configs. Changes to the config may be immediate, but may take up to 24 hours. * There is a limit of ten configs for any RepricingConfig.EntitlementGranularity.entitlement, for any RepricingConfig.effective_invoice_month. * The contained CustomerRepricingConfig.repricing_config value must be different from the value used in the current config for a RepricingConfig.EntitlementGranularity.entitlement. Possible Error Codes: * PERMISSION_DENIED: If the account making the request and the account being queried are different. * INVALID_ARGUMENT: Missing or invalid required parameters in the request. Also displays if the updated config is for the current month or past months. * NOT_FOUND: The CustomerRepricingConfig specified does not exist or is not associated with the given account. * INTERNAL: Any non-user error related to technical issues in the backend. In this case, contact Cloud Channel support. Return Value: If successful, the updated CustomerRepricingConfig resource, otherwise returns an error.
9450///
9451/// A builder for the *customers.customerRepricingConfigs.create* method supported by a *account* resource.
9452/// It is not used directly, but through a [`AccountMethods`] instance.
9453///
9454/// # Example
9455///
9456/// Instantiate a resource method builder
9457///
9458/// ```test_harness,no_run
9459/// # extern crate hyper;
9460/// # extern crate hyper_rustls;
9461/// # extern crate google_cloudchannel1 as cloudchannel1;
9462/// use cloudchannel1::api::GoogleCloudChannelV1CustomerRepricingConfig;
9463/// # async fn dox() {
9464/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9465///
9466/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9467/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9468/// #     .with_native_roots()
9469/// #     .unwrap()
9470/// #     .https_only()
9471/// #     .enable_http2()
9472/// #     .build();
9473///
9474/// # let executor = hyper_util::rt::TokioExecutor::new();
9475/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9476/// #     secret,
9477/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9478/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9479/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9480/// #     ),
9481/// # ).build().await.unwrap();
9482///
9483/// # let client = hyper_util::client::legacy::Client::builder(
9484/// #     hyper_util::rt::TokioExecutor::new()
9485/// # )
9486/// # .build(
9487/// #     hyper_rustls::HttpsConnectorBuilder::new()
9488/// #         .with_native_roots()
9489/// #         .unwrap()
9490/// #         .https_or_http()
9491/// #         .enable_http2()
9492/// #         .build()
9493/// # );
9494/// # let mut hub = Cloudchannel::new(client, auth);
9495/// // As the method needs a request, you would usually fill it with the desired information
9496/// // into the respective structure. Some of the parts shown here might not be applicable !
9497/// // Values shown here are possibly random and not representative !
9498/// let mut req = GoogleCloudChannelV1CustomerRepricingConfig::default();
9499///
9500/// // You can configure optional parameters by calling the respective setters at will, and
9501/// // execute the final call using `doit()`.
9502/// // Values shown here are possibly random and not representative !
9503/// let result = hub.accounts().customers_customer_repricing_configs_create(req, "parent")
9504///              .doit().await;
9505/// # }
9506/// ```
9507pub struct AccountCustomerCustomerRepricingConfigCreateCall<'a, C>
9508where
9509    C: 'a,
9510{
9511    hub: &'a Cloudchannel<C>,
9512    _request: GoogleCloudChannelV1CustomerRepricingConfig,
9513    _parent: String,
9514    _delegate: Option<&'a mut dyn common::Delegate>,
9515    _additional_params: HashMap<String, String>,
9516    _scopes: BTreeSet<String>,
9517}
9518
9519impl<'a, C> common::CallBuilder for AccountCustomerCustomerRepricingConfigCreateCall<'a, C> {}
9520
9521impl<'a, C> AccountCustomerCustomerRepricingConfigCreateCall<'a, C>
9522where
9523    C: common::Connector,
9524{
9525    /// Perform the operation you have build so far.
9526    pub async fn doit(
9527        mut self,
9528    ) -> common::Result<(
9529        common::Response,
9530        GoogleCloudChannelV1CustomerRepricingConfig,
9531    )> {
9532        use std::borrow::Cow;
9533        use std::io::{Read, Seek};
9534
9535        use common::{url::Params, ToParts};
9536        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9537
9538        let mut dd = common::DefaultDelegate;
9539        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9540        dlg.begin(common::MethodInfo {
9541            id: "cloudchannel.accounts.customers.customerRepricingConfigs.create",
9542            http_method: hyper::Method::POST,
9543        });
9544
9545        for &field in ["alt", "parent"].iter() {
9546            if self._additional_params.contains_key(field) {
9547                dlg.finished(false);
9548                return Err(common::Error::FieldClash(field));
9549            }
9550        }
9551
9552        let mut params = Params::with_capacity(4 + self._additional_params.len());
9553        params.push("parent", self._parent);
9554
9555        params.extend(self._additional_params.iter());
9556
9557        params.push("alt", "json");
9558        let mut url = self.hub._base_url.clone() + "v1/{+parent}/customerRepricingConfigs";
9559        if self._scopes.is_empty() {
9560            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
9561        }
9562
9563        #[allow(clippy::single_element_loop)]
9564        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9565            url = params.uri_replacement(url, param_name, find_this, true);
9566        }
9567        {
9568            let to_remove = ["parent"];
9569            params.remove_params(&to_remove);
9570        }
9571
9572        let url = params.parse_with_url(&url);
9573
9574        let mut json_mime_type = mime::APPLICATION_JSON;
9575        let mut request_value_reader = {
9576            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9577            common::remove_json_null_values(&mut value);
9578            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9579            serde_json::to_writer(&mut dst, &value).unwrap();
9580            dst
9581        };
9582        let request_size = request_value_reader
9583            .seek(std::io::SeekFrom::End(0))
9584            .unwrap();
9585        request_value_reader
9586            .seek(std::io::SeekFrom::Start(0))
9587            .unwrap();
9588
9589        loop {
9590            let token = match self
9591                .hub
9592                .auth
9593                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9594                .await
9595            {
9596                Ok(token) => token,
9597                Err(e) => match dlg.token(e) {
9598                    Ok(token) => token,
9599                    Err(e) => {
9600                        dlg.finished(false);
9601                        return Err(common::Error::MissingToken(e));
9602                    }
9603                },
9604            };
9605            request_value_reader
9606                .seek(std::io::SeekFrom::Start(0))
9607                .unwrap();
9608            let mut req_result = {
9609                let client = &self.hub.client;
9610                dlg.pre_request();
9611                let mut req_builder = hyper::Request::builder()
9612                    .method(hyper::Method::POST)
9613                    .uri(url.as_str())
9614                    .header(USER_AGENT, self.hub._user_agent.clone());
9615
9616                if let Some(token) = token.as_ref() {
9617                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9618                }
9619
9620                let request = req_builder
9621                    .header(CONTENT_TYPE, json_mime_type.to_string())
9622                    .header(CONTENT_LENGTH, request_size as u64)
9623                    .body(common::to_body(
9624                        request_value_reader.get_ref().clone().into(),
9625                    ));
9626
9627                client.request(request.unwrap()).await
9628            };
9629
9630            match req_result {
9631                Err(err) => {
9632                    if let common::Retry::After(d) = dlg.http_error(&err) {
9633                        sleep(d).await;
9634                        continue;
9635                    }
9636                    dlg.finished(false);
9637                    return Err(common::Error::HttpError(err));
9638                }
9639                Ok(res) => {
9640                    let (mut parts, body) = res.into_parts();
9641                    let mut body = common::Body::new(body);
9642                    if !parts.status.is_success() {
9643                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9644                        let error = serde_json::from_str(&common::to_string(&bytes));
9645                        let response = common::to_response(parts, bytes.into());
9646
9647                        if let common::Retry::After(d) =
9648                            dlg.http_failure(&response, error.as_ref().ok())
9649                        {
9650                            sleep(d).await;
9651                            continue;
9652                        }
9653
9654                        dlg.finished(false);
9655
9656                        return Err(match error {
9657                            Ok(value) => common::Error::BadRequest(value),
9658                            _ => common::Error::Failure(response),
9659                        });
9660                    }
9661                    let response = {
9662                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9663                        let encoded = common::to_string(&bytes);
9664                        match serde_json::from_str(&encoded) {
9665                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9666                            Err(error) => {
9667                                dlg.response_json_decode_error(&encoded, &error);
9668                                return Err(common::Error::JsonDecodeError(
9669                                    encoded.to_string(),
9670                                    error,
9671                                ));
9672                            }
9673                        }
9674                    };
9675
9676                    dlg.finished(true);
9677                    return Ok(response);
9678                }
9679            }
9680        }
9681    }
9682
9683    ///
9684    /// Sets the *request* property to the given value.
9685    ///
9686    /// Even though the property as already been set when instantiating this call,
9687    /// we provide this method for API completeness.
9688    pub fn request(
9689        mut self,
9690        new_value: GoogleCloudChannelV1CustomerRepricingConfig,
9691    ) -> AccountCustomerCustomerRepricingConfigCreateCall<'a, C> {
9692        self._request = new_value;
9693        self
9694    }
9695    /// Required. The resource name of the customer that will receive this repricing config. Parent uses the format: accounts/{account_id}/customers/{customer_id}
9696    ///
9697    /// Sets the *parent* path property to the given value.
9698    ///
9699    /// Even though the property as already been set when instantiating this call,
9700    /// we provide this method for API completeness.
9701    pub fn parent(
9702        mut self,
9703        new_value: &str,
9704    ) -> AccountCustomerCustomerRepricingConfigCreateCall<'a, C> {
9705        self._parent = new_value.to_string();
9706        self
9707    }
9708    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9709    /// while executing the actual API request.
9710    ///
9711    /// ````text
9712    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9713    /// ````
9714    ///
9715    /// Sets the *delegate* property to the given value.
9716    pub fn delegate(
9717        mut self,
9718        new_value: &'a mut dyn common::Delegate,
9719    ) -> AccountCustomerCustomerRepricingConfigCreateCall<'a, C> {
9720        self._delegate = Some(new_value);
9721        self
9722    }
9723
9724    /// Set any additional parameter of the query string used in the request.
9725    /// It should be used to set parameters which are not yet available through their own
9726    /// setters.
9727    ///
9728    /// Please note that this method must not be used to set any of the known parameters
9729    /// which have their own setter method. If done anyway, the request will fail.
9730    ///
9731    /// # Additional Parameters
9732    ///
9733    /// * *$.xgafv* (query-string) - V1 error format.
9734    /// * *access_token* (query-string) - OAuth access token.
9735    /// * *alt* (query-string) - Data format for response.
9736    /// * *callback* (query-string) - JSONP
9737    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9738    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9739    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9740    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9741    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9742    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9743    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9744    pub fn param<T>(
9745        mut self,
9746        name: T,
9747        value: T,
9748    ) -> AccountCustomerCustomerRepricingConfigCreateCall<'a, C>
9749    where
9750        T: AsRef<str>,
9751    {
9752        self._additional_params
9753            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9754        self
9755    }
9756
9757    /// Identifies the authorization scope for the method you are building.
9758    ///
9759    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9760    /// [`Scope::AppOrder`].
9761    ///
9762    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9763    /// tokens for more than one scope.
9764    ///
9765    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9766    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9767    /// sufficient, a read-write scope will do as well.
9768    pub fn add_scope<St>(
9769        mut self,
9770        scope: St,
9771    ) -> AccountCustomerCustomerRepricingConfigCreateCall<'a, C>
9772    where
9773        St: AsRef<str>,
9774    {
9775        self._scopes.insert(String::from(scope.as_ref()));
9776        self
9777    }
9778    /// Identifies the authorization scope(s) for the method you are building.
9779    ///
9780    /// See [`Self::add_scope()`] for details.
9781    pub fn add_scopes<I, St>(
9782        mut self,
9783        scopes: I,
9784    ) -> AccountCustomerCustomerRepricingConfigCreateCall<'a, C>
9785    where
9786        I: IntoIterator<Item = St>,
9787        St: AsRef<str>,
9788    {
9789        self._scopes
9790            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9791        self
9792    }
9793
9794    /// Removes all scopes, and no default scope will be used either.
9795    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9796    /// for details).
9797    pub fn clear_scopes(mut self) -> AccountCustomerCustomerRepricingConfigCreateCall<'a, C> {
9798        self._scopes.clear();
9799        self
9800    }
9801}
9802
9803/// Deletes the given CustomerRepricingConfig permanently. You can only delete configs if their RepricingConfig.effective_invoice_month is set to a date after the current month. Possible error codes: * PERMISSION_DENIED: The account making the request does not own this customer. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * FAILED_PRECONDITION: The CustomerRepricingConfig is active or in the past. * NOT_FOUND: No CustomerRepricingConfig found for the name in the request.
9804///
9805/// A builder for the *customers.customerRepricingConfigs.delete* method supported by a *account* resource.
9806/// It is not used directly, but through a [`AccountMethods`] instance.
9807///
9808/// # Example
9809///
9810/// Instantiate a resource method builder
9811///
9812/// ```test_harness,no_run
9813/// # extern crate hyper;
9814/// # extern crate hyper_rustls;
9815/// # extern crate google_cloudchannel1 as cloudchannel1;
9816/// # async fn dox() {
9817/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9818///
9819/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9820/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9821/// #     .with_native_roots()
9822/// #     .unwrap()
9823/// #     .https_only()
9824/// #     .enable_http2()
9825/// #     .build();
9826///
9827/// # let executor = hyper_util::rt::TokioExecutor::new();
9828/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9829/// #     secret,
9830/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9831/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9832/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9833/// #     ),
9834/// # ).build().await.unwrap();
9835///
9836/// # let client = hyper_util::client::legacy::Client::builder(
9837/// #     hyper_util::rt::TokioExecutor::new()
9838/// # )
9839/// # .build(
9840/// #     hyper_rustls::HttpsConnectorBuilder::new()
9841/// #         .with_native_roots()
9842/// #         .unwrap()
9843/// #         .https_or_http()
9844/// #         .enable_http2()
9845/// #         .build()
9846/// # );
9847/// # let mut hub = Cloudchannel::new(client, auth);
9848/// // You can configure optional parameters by calling the respective setters at will, and
9849/// // execute the final call using `doit()`.
9850/// // Values shown here are possibly random and not representative !
9851/// let result = hub.accounts().customers_customer_repricing_configs_delete("name")
9852///              .doit().await;
9853/// # }
9854/// ```
9855pub struct AccountCustomerCustomerRepricingConfigDeleteCall<'a, C>
9856where
9857    C: 'a,
9858{
9859    hub: &'a Cloudchannel<C>,
9860    _name: String,
9861    _delegate: Option<&'a mut dyn common::Delegate>,
9862    _additional_params: HashMap<String, String>,
9863    _scopes: BTreeSet<String>,
9864}
9865
9866impl<'a, C> common::CallBuilder for AccountCustomerCustomerRepricingConfigDeleteCall<'a, C> {}
9867
9868impl<'a, C> AccountCustomerCustomerRepricingConfigDeleteCall<'a, C>
9869where
9870    C: common::Connector,
9871{
9872    /// Perform the operation you have build so far.
9873    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleProtobufEmpty)> {
9874        use std::borrow::Cow;
9875        use std::io::{Read, Seek};
9876
9877        use common::{url::Params, ToParts};
9878        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9879
9880        let mut dd = common::DefaultDelegate;
9881        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9882        dlg.begin(common::MethodInfo {
9883            id: "cloudchannel.accounts.customers.customerRepricingConfigs.delete",
9884            http_method: hyper::Method::DELETE,
9885        });
9886
9887        for &field in ["alt", "name"].iter() {
9888            if self._additional_params.contains_key(field) {
9889                dlg.finished(false);
9890                return Err(common::Error::FieldClash(field));
9891            }
9892        }
9893
9894        let mut params = Params::with_capacity(3 + self._additional_params.len());
9895        params.push("name", self._name);
9896
9897        params.extend(self._additional_params.iter());
9898
9899        params.push("alt", "json");
9900        let mut url = self.hub._base_url.clone() + "v1/{+name}";
9901        if self._scopes.is_empty() {
9902            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
9903        }
9904
9905        #[allow(clippy::single_element_loop)]
9906        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9907            url = params.uri_replacement(url, param_name, find_this, true);
9908        }
9909        {
9910            let to_remove = ["name"];
9911            params.remove_params(&to_remove);
9912        }
9913
9914        let url = params.parse_with_url(&url);
9915
9916        loop {
9917            let token = match self
9918                .hub
9919                .auth
9920                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9921                .await
9922            {
9923                Ok(token) => token,
9924                Err(e) => match dlg.token(e) {
9925                    Ok(token) => token,
9926                    Err(e) => {
9927                        dlg.finished(false);
9928                        return Err(common::Error::MissingToken(e));
9929                    }
9930                },
9931            };
9932            let mut req_result = {
9933                let client = &self.hub.client;
9934                dlg.pre_request();
9935                let mut req_builder = hyper::Request::builder()
9936                    .method(hyper::Method::DELETE)
9937                    .uri(url.as_str())
9938                    .header(USER_AGENT, self.hub._user_agent.clone());
9939
9940                if let Some(token) = token.as_ref() {
9941                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9942                }
9943
9944                let request = req_builder
9945                    .header(CONTENT_LENGTH, 0_u64)
9946                    .body(common::to_body::<String>(None));
9947
9948                client.request(request.unwrap()).await
9949            };
9950
9951            match req_result {
9952                Err(err) => {
9953                    if let common::Retry::After(d) = dlg.http_error(&err) {
9954                        sleep(d).await;
9955                        continue;
9956                    }
9957                    dlg.finished(false);
9958                    return Err(common::Error::HttpError(err));
9959                }
9960                Ok(res) => {
9961                    let (mut parts, body) = res.into_parts();
9962                    let mut body = common::Body::new(body);
9963                    if !parts.status.is_success() {
9964                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9965                        let error = serde_json::from_str(&common::to_string(&bytes));
9966                        let response = common::to_response(parts, bytes.into());
9967
9968                        if let common::Retry::After(d) =
9969                            dlg.http_failure(&response, error.as_ref().ok())
9970                        {
9971                            sleep(d).await;
9972                            continue;
9973                        }
9974
9975                        dlg.finished(false);
9976
9977                        return Err(match error {
9978                            Ok(value) => common::Error::BadRequest(value),
9979                            _ => common::Error::Failure(response),
9980                        });
9981                    }
9982                    let response = {
9983                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9984                        let encoded = common::to_string(&bytes);
9985                        match serde_json::from_str(&encoded) {
9986                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9987                            Err(error) => {
9988                                dlg.response_json_decode_error(&encoded, &error);
9989                                return Err(common::Error::JsonDecodeError(
9990                                    encoded.to_string(),
9991                                    error,
9992                                ));
9993                            }
9994                        }
9995                    };
9996
9997                    dlg.finished(true);
9998                    return Ok(response);
9999                }
10000            }
10001        }
10002    }
10003
10004    /// Required. The resource name of the customer repricing config rule to delete. Format: accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}.
10005    ///
10006    /// Sets the *name* path property to the given value.
10007    ///
10008    /// Even though the property as already been set when instantiating this call,
10009    /// we provide this method for API completeness.
10010    pub fn name(
10011        mut self,
10012        new_value: &str,
10013    ) -> AccountCustomerCustomerRepricingConfigDeleteCall<'a, C> {
10014        self._name = new_value.to_string();
10015        self
10016    }
10017    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10018    /// while executing the actual API request.
10019    ///
10020    /// ````text
10021    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10022    /// ````
10023    ///
10024    /// Sets the *delegate* property to the given value.
10025    pub fn delegate(
10026        mut self,
10027        new_value: &'a mut dyn common::Delegate,
10028    ) -> AccountCustomerCustomerRepricingConfigDeleteCall<'a, C> {
10029        self._delegate = Some(new_value);
10030        self
10031    }
10032
10033    /// Set any additional parameter of the query string used in the request.
10034    /// It should be used to set parameters which are not yet available through their own
10035    /// setters.
10036    ///
10037    /// Please note that this method must not be used to set any of the known parameters
10038    /// which have their own setter method. If done anyway, the request will fail.
10039    ///
10040    /// # Additional Parameters
10041    ///
10042    /// * *$.xgafv* (query-string) - V1 error format.
10043    /// * *access_token* (query-string) - OAuth access token.
10044    /// * *alt* (query-string) - Data format for response.
10045    /// * *callback* (query-string) - JSONP
10046    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10047    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10048    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10049    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10050    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10051    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10052    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10053    pub fn param<T>(
10054        mut self,
10055        name: T,
10056        value: T,
10057    ) -> AccountCustomerCustomerRepricingConfigDeleteCall<'a, C>
10058    where
10059        T: AsRef<str>,
10060    {
10061        self._additional_params
10062            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10063        self
10064    }
10065
10066    /// Identifies the authorization scope for the method you are building.
10067    ///
10068    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10069    /// [`Scope::AppOrder`].
10070    ///
10071    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10072    /// tokens for more than one scope.
10073    ///
10074    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10075    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10076    /// sufficient, a read-write scope will do as well.
10077    pub fn add_scope<St>(
10078        mut self,
10079        scope: St,
10080    ) -> AccountCustomerCustomerRepricingConfigDeleteCall<'a, C>
10081    where
10082        St: AsRef<str>,
10083    {
10084        self._scopes.insert(String::from(scope.as_ref()));
10085        self
10086    }
10087    /// Identifies the authorization scope(s) for the method you are building.
10088    ///
10089    /// See [`Self::add_scope()`] for details.
10090    pub fn add_scopes<I, St>(
10091        mut self,
10092        scopes: I,
10093    ) -> AccountCustomerCustomerRepricingConfigDeleteCall<'a, C>
10094    where
10095        I: IntoIterator<Item = St>,
10096        St: AsRef<str>,
10097    {
10098        self._scopes
10099            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10100        self
10101    }
10102
10103    /// Removes all scopes, and no default scope will be used either.
10104    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10105    /// for details).
10106    pub fn clear_scopes(mut self) -> AccountCustomerCustomerRepricingConfigDeleteCall<'a, C> {
10107        self._scopes.clear();
10108        self
10109    }
10110}
10111
10112/// Gets information about how a Reseller modifies their bill before sending it to a Customer. Possible Error Codes: * PERMISSION_DENIED: If the account making the request and the account being queried are different. * NOT_FOUND: The CustomerRepricingConfig was not found. * INTERNAL: Any non-user error related to technical issues in the backend. In this case, contact Cloud Channel support. Return Value: If successful, the CustomerRepricingConfig resource, otherwise returns an error.
10113///
10114/// A builder for the *customers.customerRepricingConfigs.get* method supported by a *account* resource.
10115/// It is not used directly, but through a [`AccountMethods`] instance.
10116///
10117/// # Example
10118///
10119/// Instantiate a resource method builder
10120///
10121/// ```test_harness,no_run
10122/// # extern crate hyper;
10123/// # extern crate hyper_rustls;
10124/// # extern crate google_cloudchannel1 as cloudchannel1;
10125/// # async fn dox() {
10126/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10127///
10128/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10129/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10130/// #     .with_native_roots()
10131/// #     .unwrap()
10132/// #     .https_only()
10133/// #     .enable_http2()
10134/// #     .build();
10135///
10136/// # let executor = hyper_util::rt::TokioExecutor::new();
10137/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10138/// #     secret,
10139/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10140/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10141/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10142/// #     ),
10143/// # ).build().await.unwrap();
10144///
10145/// # let client = hyper_util::client::legacy::Client::builder(
10146/// #     hyper_util::rt::TokioExecutor::new()
10147/// # )
10148/// # .build(
10149/// #     hyper_rustls::HttpsConnectorBuilder::new()
10150/// #         .with_native_roots()
10151/// #         .unwrap()
10152/// #         .https_or_http()
10153/// #         .enable_http2()
10154/// #         .build()
10155/// # );
10156/// # let mut hub = Cloudchannel::new(client, auth);
10157/// // You can configure optional parameters by calling the respective setters at will, and
10158/// // execute the final call using `doit()`.
10159/// // Values shown here are possibly random and not representative !
10160/// let result = hub.accounts().customers_customer_repricing_configs_get("name")
10161///              .doit().await;
10162/// # }
10163/// ```
10164pub struct AccountCustomerCustomerRepricingConfigGetCall<'a, C>
10165where
10166    C: 'a,
10167{
10168    hub: &'a Cloudchannel<C>,
10169    _name: String,
10170    _delegate: Option<&'a mut dyn common::Delegate>,
10171    _additional_params: HashMap<String, String>,
10172    _scopes: BTreeSet<String>,
10173}
10174
10175impl<'a, C> common::CallBuilder for AccountCustomerCustomerRepricingConfigGetCall<'a, C> {}
10176
10177impl<'a, C> AccountCustomerCustomerRepricingConfigGetCall<'a, C>
10178where
10179    C: common::Connector,
10180{
10181    /// Perform the operation you have build so far.
10182    pub async fn doit(
10183        mut self,
10184    ) -> common::Result<(
10185        common::Response,
10186        GoogleCloudChannelV1CustomerRepricingConfig,
10187    )> {
10188        use std::borrow::Cow;
10189        use std::io::{Read, Seek};
10190
10191        use common::{url::Params, ToParts};
10192        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10193
10194        let mut dd = common::DefaultDelegate;
10195        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10196        dlg.begin(common::MethodInfo {
10197            id: "cloudchannel.accounts.customers.customerRepricingConfigs.get",
10198            http_method: hyper::Method::GET,
10199        });
10200
10201        for &field in ["alt", "name"].iter() {
10202            if self._additional_params.contains_key(field) {
10203                dlg.finished(false);
10204                return Err(common::Error::FieldClash(field));
10205            }
10206        }
10207
10208        let mut params = Params::with_capacity(3 + self._additional_params.len());
10209        params.push("name", self._name);
10210
10211        params.extend(self._additional_params.iter());
10212
10213        params.push("alt", "json");
10214        let mut url = self.hub._base_url.clone() + "v1/{+name}";
10215        if self._scopes.is_empty() {
10216            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
10217        }
10218
10219        #[allow(clippy::single_element_loop)]
10220        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10221            url = params.uri_replacement(url, param_name, find_this, true);
10222        }
10223        {
10224            let to_remove = ["name"];
10225            params.remove_params(&to_remove);
10226        }
10227
10228        let url = params.parse_with_url(&url);
10229
10230        loop {
10231            let token = match self
10232                .hub
10233                .auth
10234                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10235                .await
10236            {
10237                Ok(token) => token,
10238                Err(e) => match dlg.token(e) {
10239                    Ok(token) => token,
10240                    Err(e) => {
10241                        dlg.finished(false);
10242                        return Err(common::Error::MissingToken(e));
10243                    }
10244                },
10245            };
10246            let mut req_result = {
10247                let client = &self.hub.client;
10248                dlg.pre_request();
10249                let mut req_builder = hyper::Request::builder()
10250                    .method(hyper::Method::GET)
10251                    .uri(url.as_str())
10252                    .header(USER_AGENT, self.hub._user_agent.clone());
10253
10254                if let Some(token) = token.as_ref() {
10255                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10256                }
10257
10258                let request = req_builder
10259                    .header(CONTENT_LENGTH, 0_u64)
10260                    .body(common::to_body::<String>(None));
10261
10262                client.request(request.unwrap()).await
10263            };
10264
10265            match req_result {
10266                Err(err) => {
10267                    if let common::Retry::After(d) = dlg.http_error(&err) {
10268                        sleep(d).await;
10269                        continue;
10270                    }
10271                    dlg.finished(false);
10272                    return Err(common::Error::HttpError(err));
10273                }
10274                Ok(res) => {
10275                    let (mut parts, body) = res.into_parts();
10276                    let mut body = common::Body::new(body);
10277                    if !parts.status.is_success() {
10278                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10279                        let error = serde_json::from_str(&common::to_string(&bytes));
10280                        let response = common::to_response(parts, bytes.into());
10281
10282                        if let common::Retry::After(d) =
10283                            dlg.http_failure(&response, error.as_ref().ok())
10284                        {
10285                            sleep(d).await;
10286                            continue;
10287                        }
10288
10289                        dlg.finished(false);
10290
10291                        return Err(match error {
10292                            Ok(value) => common::Error::BadRequest(value),
10293                            _ => common::Error::Failure(response),
10294                        });
10295                    }
10296                    let response = {
10297                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10298                        let encoded = common::to_string(&bytes);
10299                        match serde_json::from_str(&encoded) {
10300                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10301                            Err(error) => {
10302                                dlg.response_json_decode_error(&encoded, &error);
10303                                return Err(common::Error::JsonDecodeError(
10304                                    encoded.to_string(),
10305                                    error,
10306                                ));
10307                            }
10308                        }
10309                    };
10310
10311                    dlg.finished(true);
10312                    return Ok(response);
10313                }
10314            }
10315        }
10316    }
10317
10318    /// Required. The resource name of the CustomerRepricingConfig. Format: accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}.
10319    ///
10320    /// Sets the *name* path property to the given value.
10321    ///
10322    /// Even though the property as already been set when instantiating this call,
10323    /// we provide this method for API completeness.
10324    pub fn name(mut self, new_value: &str) -> AccountCustomerCustomerRepricingConfigGetCall<'a, C> {
10325        self._name = new_value.to_string();
10326        self
10327    }
10328    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10329    /// while executing the actual API request.
10330    ///
10331    /// ````text
10332    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10333    /// ````
10334    ///
10335    /// Sets the *delegate* property to the given value.
10336    pub fn delegate(
10337        mut self,
10338        new_value: &'a mut dyn common::Delegate,
10339    ) -> AccountCustomerCustomerRepricingConfigGetCall<'a, C> {
10340        self._delegate = Some(new_value);
10341        self
10342    }
10343
10344    /// Set any additional parameter of the query string used in the request.
10345    /// It should be used to set parameters which are not yet available through their own
10346    /// setters.
10347    ///
10348    /// Please note that this method must not be used to set any of the known parameters
10349    /// which have their own setter method. If done anyway, the request will fail.
10350    ///
10351    /// # Additional Parameters
10352    ///
10353    /// * *$.xgafv* (query-string) - V1 error format.
10354    /// * *access_token* (query-string) - OAuth access token.
10355    /// * *alt* (query-string) - Data format for response.
10356    /// * *callback* (query-string) - JSONP
10357    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10358    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10359    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10360    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10361    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10362    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10363    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10364    pub fn param<T>(
10365        mut self,
10366        name: T,
10367        value: T,
10368    ) -> AccountCustomerCustomerRepricingConfigGetCall<'a, C>
10369    where
10370        T: AsRef<str>,
10371    {
10372        self._additional_params
10373            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10374        self
10375    }
10376
10377    /// Identifies the authorization scope for the method you are building.
10378    ///
10379    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10380    /// [`Scope::AppOrder`].
10381    ///
10382    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10383    /// tokens for more than one scope.
10384    ///
10385    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10386    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10387    /// sufficient, a read-write scope will do as well.
10388    pub fn add_scope<St>(
10389        mut self,
10390        scope: St,
10391    ) -> AccountCustomerCustomerRepricingConfigGetCall<'a, C>
10392    where
10393        St: AsRef<str>,
10394    {
10395        self._scopes.insert(String::from(scope.as_ref()));
10396        self
10397    }
10398    /// Identifies the authorization scope(s) for the method you are building.
10399    ///
10400    /// See [`Self::add_scope()`] for details.
10401    pub fn add_scopes<I, St>(
10402        mut self,
10403        scopes: I,
10404    ) -> AccountCustomerCustomerRepricingConfigGetCall<'a, C>
10405    where
10406        I: IntoIterator<Item = St>,
10407        St: AsRef<str>,
10408    {
10409        self._scopes
10410            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10411        self
10412    }
10413
10414    /// Removes all scopes, and no default scope will be used either.
10415    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10416    /// for details).
10417    pub fn clear_scopes(mut self) -> AccountCustomerCustomerRepricingConfigGetCall<'a, C> {
10418        self._scopes.clear();
10419        self
10420    }
10421}
10422
10423/// Lists information about how a Reseller modifies their bill before sending it to a Customer. Possible Error Codes: * PERMISSION_DENIED: If the account making the request and the account being queried are different. * NOT_FOUND: The CustomerRepricingConfig specified does not exist or is not associated with the given account. * INTERNAL: Any non-user error related to technical issues in the backend. In this case, contact Cloud Channel support. Return Value: If successful, the CustomerRepricingConfig resources. The data for each resource is displayed in the ascending order of: * Customer ID * RepricingConfig.EntitlementGranularity.entitlement * RepricingConfig.effective_invoice_month * CustomerRepricingConfig.update_time If unsuccessful, returns an error.
10424///
10425/// A builder for the *customers.customerRepricingConfigs.list* method supported by a *account* resource.
10426/// It is not used directly, but through a [`AccountMethods`] instance.
10427///
10428/// # Example
10429///
10430/// Instantiate a resource method builder
10431///
10432/// ```test_harness,no_run
10433/// # extern crate hyper;
10434/// # extern crate hyper_rustls;
10435/// # extern crate google_cloudchannel1 as cloudchannel1;
10436/// # async fn dox() {
10437/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10438///
10439/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10440/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10441/// #     .with_native_roots()
10442/// #     .unwrap()
10443/// #     .https_only()
10444/// #     .enable_http2()
10445/// #     .build();
10446///
10447/// # let executor = hyper_util::rt::TokioExecutor::new();
10448/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10449/// #     secret,
10450/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10451/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10452/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10453/// #     ),
10454/// # ).build().await.unwrap();
10455///
10456/// # let client = hyper_util::client::legacy::Client::builder(
10457/// #     hyper_util::rt::TokioExecutor::new()
10458/// # )
10459/// # .build(
10460/// #     hyper_rustls::HttpsConnectorBuilder::new()
10461/// #         .with_native_roots()
10462/// #         .unwrap()
10463/// #         .https_or_http()
10464/// #         .enable_http2()
10465/// #         .build()
10466/// # );
10467/// # let mut hub = Cloudchannel::new(client, auth);
10468/// // You can configure optional parameters by calling the respective setters at will, and
10469/// // execute the final call using `doit()`.
10470/// // Values shown here are possibly random and not representative !
10471/// let result = hub.accounts().customers_customer_repricing_configs_list("parent")
10472///              .page_token("gubergren")
10473///              .page_size(-17)
10474///              .filter("dolor")
10475///              .doit().await;
10476/// # }
10477/// ```
10478pub struct AccountCustomerCustomerRepricingConfigListCall<'a, C>
10479where
10480    C: 'a,
10481{
10482    hub: &'a Cloudchannel<C>,
10483    _parent: String,
10484    _page_token: Option<String>,
10485    _page_size: Option<i32>,
10486    _filter: Option<String>,
10487    _delegate: Option<&'a mut dyn common::Delegate>,
10488    _additional_params: HashMap<String, String>,
10489    _scopes: BTreeSet<String>,
10490}
10491
10492impl<'a, C> common::CallBuilder for AccountCustomerCustomerRepricingConfigListCall<'a, C> {}
10493
10494impl<'a, C> AccountCustomerCustomerRepricingConfigListCall<'a, C>
10495where
10496    C: common::Connector,
10497{
10498    /// Perform the operation you have build so far.
10499    pub async fn doit(
10500        mut self,
10501    ) -> common::Result<(
10502        common::Response,
10503        GoogleCloudChannelV1ListCustomerRepricingConfigsResponse,
10504    )> {
10505        use std::borrow::Cow;
10506        use std::io::{Read, Seek};
10507
10508        use common::{url::Params, ToParts};
10509        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10510
10511        let mut dd = common::DefaultDelegate;
10512        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10513        dlg.begin(common::MethodInfo {
10514            id: "cloudchannel.accounts.customers.customerRepricingConfigs.list",
10515            http_method: hyper::Method::GET,
10516        });
10517
10518        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
10519            if self._additional_params.contains_key(field) {
10520                dlg.finished(false);
10521                return Err(common::Error::FieldClash(field));
10522            }
10523        }
10524
10525        let mut params = Params::with_capacity(6 + self._additional_params.len());
10526        params.push("parent", self._parent);
10527        if let Some(value) = self._page_token.as_ref() {
10528            params.push("pageToken", value);
10529        }
10530        if let Some(value) = self._page_size.as_ref() {
10531            params.push("pageSize", value.to_string());
10532        }
10533        if let Some(value) = self._filter.as_ref() {
10534            params.push("filter", value);
10535        }
10536
10537        params.extend(self._additional_params.iter());
10538
10539        params.push("alt", "json");
10540        let mut url = self.hub._base_url.clone() + "v1/{+parent}/customerRepricingConfigs";
10541        if self._scopes.is_empty() {
10542            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
10543        }
10544
10545        #[allow(clippy::single_element_loop)]
10546        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10547            url = params.uri_replacement(url, param_name, find_this, true);
10548        }
10549        {
10550            let to_remove = ["parent"];
10551            params.remove_params(&to_remove);
10552        }
10553
10554        let url = params.parse_with_url(&url);
10555
10556        loop {
10557            let token = match self
10558                .hub
10559                .auth
10560                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10561                .await
10562            {
10563                Ok(token) => token,
10564                Err(e) => match dlg.token(e) {
10565                    Ok(token) => token,
10566                    Err(e) => {
10567                        dlg.finished(false);
10568                        return Err(common::Error::MissingToken(e));
10569                    }
10570                },
10571            };
10572            let mut req_result = {
10573                let client = &self.hub.client;
10574                dlg.pre_request();
10575                let mut req_builder = hyper::Request::builder()
10576                    .method(hyper::Method::GET)
10577                    .uri(url.as_str())
10578                    .header(USER_AGENT, self.hub._user_agent.clone());
10579
10580                if let Some(token) = token.as_ref() {
10581                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10582                }
10583
10584                let request = req_builder
10585                    .header(CONTENT_LENGTH, 0_u64)
10586                    .body(common::to_body::<String>(None));
10587
10588                client.request(request.unwrap()).await
10589            };
10590
10591            match req_result {
10592                Err(err) => {
10593                    if let common::Retry::After(d) = dlg.http_error(&err) {
10594                        sleep(d).await;
10595                        continue;
10596                    }
10597                    dlg.finished(false);
10598                    return Err(common::Error::HttpError(err));
10599                }
10600                Ok(res) => {
10601                    let (mut parts, body) = res.into_parts();
10602                    let mut body = common::Body::new(body);
10603                    if !parts.status.is_success() {
10604                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10605                        let error = serde_json::from_str(&common::to_string(&bytes));
10606                        let response = common::to_response(parts, bytes.into());
10607
10608                        if let common::Retry::After(d) =
10609                            dlg.http_failure(&response, error.as_ref().ok())
10610                        {
10611                            sleep(d).await;
10612                            continue;
10613                        }
10614
10615                        dlg.finished(false);
10616
10617                        return Err(match error {
10618                            Ok(value) => common::Error::BadRequest(value),
10619                            _ => common::Error::Failure(response),
10620                        });
10621                    }
10622                    let response = {
10623                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10624                        let encoded = common::to_string(&bytes);
10625                        match serde_json::from_str(&encoded) {
10626                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10627                            Err(error) => {
10628                                dlg.response_json_decode_error(&encoded, &error);
10629                                return Err(common::Error::JsonDecodeError(
10630                                    encoded.to_string(),
10631                                    error,
10632                                ));
10633                            }
10634                        }
10635                    };
10636
10637                    dlg.finished(true);
10638                    return Ok(response);
10639                }
10640            }
10641        }
10642    }
10643
10644    /// Required. The resource name of the customer. Parent uses the format: accounts/{account_id}/customers/{customer_id}. Supports accounts/{account_id}/customers/- to retrieve configs for all customers.
10645    ///
10646    /// Sets the *parent* path property to the given value.
10647    ///
10648    /// Even though the property as already been set when instantiating this call,
10649    /// we provide this method for API completeness.
10650    pub fn parent(
10651        mut self,
10652        new_value: &str,
10653    ) -> AccountCustomerCustomerRepricingConfigListCall<'a, C> {
10654        self._parent = new_value.to_string();
10655        self
10656    }
10657    /// Optional. A token identifying a page of results beyond the first page. Obtained through ListCustomerRepricingConfigsResponse.next_page_token of the previous CloudChannelService.ListCustomerRepricingConfigs call.
10658    ///
10659    /// Sets the *page token* query property to the given value.
10660    pub fn page_token(
10661        mut self,
10662        new_value: &str,
10663    ) -> AccountCustomerCustomerRepricingConfigListCall<'a, C> {
10664        self._page_token = Some(new_value.to_string());
10665        self
10666    }
10667    /// Optional. The maximum number of repricing configs to return. The service may return fewer than this value. If unspecified, returns a maximum of 50 rules. The maximum value is 100; values above 100 will be coerced to 100.
10668    ///
10669    /// Sets the *page size* query property to the given value.
10670    pub fn page_size(
10671        mut self,
10672        new_value: i32,
10673    ) -> AccountCustomerCustomerRepricingConfigListCall<'a, C> {
10674        self._page_size = Some(new_value);
10675        self
10676    }
10677    /// Optional. A filter for [CloudChannelService.ListCustomerRepricingConfigs] results (customer only). You can use this filter when you support a BatchGet-like query. To use the filter, you must set `parent=accounts/{account_id}/customers/-`. Example: customer = accounts/account_id/customers/c1 OR customer = accounts/account_id/customers/c2.
10678    ///
10679    /// Sets the *filter* query property to the given value.
10680    pub fn filter(
10681        mut self,
10682        new_value: &str,
10683    ) -> AccountCustomerCustomerRepricingConfigListCall<'a, C> {
10684        self._filter = Some(new_value.to_string());
10685        self
10686    }
10687    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10688    /// while executing the actual API request.
10689    ///
10690    /// ````text
10691    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10692    /// ````
10693    ///
10694    /// Sets the *delegate* property to the given value.
10695    pub fn delegate(
10696        mut self,
10697        new_value: &'a mut dyn common::Delegate,
10698    ) -> AccountCustomerCustomerRepricingConfigListCall<'a, C> {
10699        self._delegate = Some(new_value);
10700        self
10701    }
10702
10703    /// Set any additional parameter of the query string used in the request.
10704    /// It should be used to set parameters which are not yet available through their own
10705    /// setters.
10706    ///
10707    /// Please note that this method must not be used to set any of the known parameters
10708    /// which have their own setter method. If done anyway, the request will fail.
10709    ///
10710    /// # Additional Parameters
10711    ///
10712    /// * *$.xgafv* (query-string) - V1 error format.
10713    /// * *access_token* (query-string) - OAuth access token.
10714    /// * *alt* (query-string) - Data format for response.
10715    /// * *callback* (query-string) - JSONP
10716    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10717    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10718    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10719    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10720    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10721    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10722    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10723    pub fn param<T>(
10724        mut self,
10725        name: T,
10726        value: T,
10727    ) -> AccountCustomerCustomerRepricingConfigListCall<'a, C>
10728    where
10729        T: AsRef<str>,
10730    {
10731        self._additional_params
10732            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10733        self
10734    }
10735
10736    /// Identifies the authorization scope for the method you are building.
10737    ///
10738    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10739    /// [`Scope::AppOrder`].
10740    ///
10741    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10742    /// tokens for more than one scope.
10743    ///
10744    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10745    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10746    /// sufficient, a read-write scope will do as well.
10747    pub fn add_scope<St>(
10748        mut self,
10749        scope: St,
10750    ) -> AccountCustomerCustomerRepricingConfigListCall<'a, C>
10751    where
10752        St: AsRef<str>,
10753    {
10754        self._scopes.insert(String::from(scope.as_ref()));
10755        self
10756    }
10757    /// Identifies the authorization scope(s) for the method you are building.
10758    ///
10759    /// See [`Self::add_scope()`] for details.
10760    pub fn add_scopes<I, St>(
10761        mut self,
10762        scopes: I,
10763    ) -> AccountCustomerCustomerRepricingConfigListCall<'a, C>
10764    where
10765        I: IntoIterator<Item = St>,
10766        St: AsRef<str>,
10767    {
10768        self._scopes
10769            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10770        self
10771    }
10772
10773    /// Removes all scopes, and no default scope will be used either.
10774    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10775    /// for details).
10776    pub fn clear_scopes(mut self) -> AccountCustomerCustomerRepricingConfigListCall<'a, C> {
10777        self._scopes.clear();
10778        self
10779    }
10780}
10781
10782/// Updates a CustomerRepricingConfig. Call this method to set modifications for a specific customer's bill. This method overwrites the existing CustomerRepricingConfig. You can only update configs if the RepricingConfig.effective_invoice_month is a future month. To make changes to configs for the current month, use CreateCustomerRepricingConfig, taking note of its restrictions. You cannot update the RepricingConfig.effective_invoice_month. When updating a config in the future: * This config must already exist. Possible Error Codes: * PERMISSION_DENIED: If the account making the request and the account being queried are different. * INVALID_ARGUMENT: Missing or invalid required parameters in the request. Also displays if the updated config is for the current month or past months. * NOT_FOUND: The CustomerRepricingConfig specified does not exist or is not associated with the given account. * INTERNAL: Any non-user error related to technical issues in the backend. In this case, contact Cloud Channel support. Return Value: If successful, the updated CustomerRepricingConfig resource, otherwise returns an error.
10783///
10784/// A builder for the *customers.customerRepricingConfigs.patch* method supported by a *account* resource.
10785/// It is not used directly, but through a [`AccountMethods`] instance.
10786///
10787/// # Example
10788///
10789/// Instantiate a resource method builder
10790///
10791/// ```test_harness,no_run
10792/// # extern crate hyper;
10793/// # extern crate hyper_rustls;
10794/// # extern crate google_cloudchannel1 as cloudchannel1;
10795/// use cloudchannel1::api::GoogleCloudChannelV1CustomerRepricingConfig;
10796/// # async fn dox() {
10797/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10798///
10799/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10800/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10801/// #     .with_native_roots()
10802/// #     .unwrap()
10803/// #     .https_only()
10804/// #     .enable_http2()
10805/// #     .build();
10806///
10807/// # let executor = hyper_util::rt::TokioExecutor::new();
10808/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10809/// #     secret,
10810/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10811/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10812/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10813/// #     ),
10814/// # ).build().await.unwrap();
10815///
10816/// # let client = hyper_util::client::legacy::Client::builder(
10817/// #     hyper_util::rt::TokioExecutor::new()
10818/// # )
10819/// # .build(
10820/// #     hyper_rustls::HttpsConnectorBuilder::new()
10821/// #         .with_native_roots()
10822/// #         .unwrap()
10823/// #         .https_or_http()
10824/// #         .enable_http2()
10825/// #         .build()
10826/// # );
10827/// # let mut hub = Cloudchannel::new(client, auth);
10828/// // As the method needs a request, you would usually fill it with the desired information
10829/// // into the respective structure. Some of the parts shown here might not be applicable !
10830/// // Values shown here are possibly random and not representative !
10831/// let mut req = GoogleCloudChannelV1CustomerRepricingConfig::default();
10832///
10833/// // You can configure optional parameters by calling the respective setters at will, and
10834/// // execute the final call using `doit()`.
10835/// // Values shown here are possibly random and not representative !
10836/// let result = hub.accounts().customers_customer_repricing_configs_patch(req, "name")
10837///              .doit().await;
10838/// # }
10839/// ```
10840pub struct AccountCustomerCustomerRepricingConfigPatchCall<'a, C>
10841where
10842    C: 'a,
10843{
10844    hub: &'a Cloudchannel<C>,
10845    _request: GoogleCloudChannelV1CustomerRepricingConfig,
10846    _name: String,
10847    _delegate: Option<&'a mut dyn common::Delegate>,
10848    _additional_params: HashMap<String, String>,
10849    _scopes: BTreeSet<String>,
10850}
10851
10852impl<'a, C> common::CallBuilder for AccountCustomerCustomerRepricingConfigPatchCall<'a, C> {}
10853
10854impl<'a, C> AccountCustomerCustomerRepricingConfigPatchCall<'a, C>
10855where
10856    C: common::Connector,
10857{
10858    /// Perform the operation you have build so far.
10859    pub async fn doit(
10860        mut self,
10861    ) -> common::Result<(
10862        common::Response,
10863        GoogleCloudChannelV1CustomerRepricingConfig,
10864    )> {
10865        use std::borrow::Cow;
10866        use std::io::{Read, Seek};
10867
10868        use common::{url::Params, ToParts};
10869        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10870
10871        let mut dd = common::DefaultDelegate;
10872        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10873        dlg.begin(common::MethodInfo {
10874            id: "cloudchannel.accounts.customers.customerRepricingConfigs.patch",
10875            http_method: hyper::Method::PATCH,
10876        });
10877
10878        for &field in ["alt", "name"].iter() {
10879            if self._additional_params.contains_key(field) {
10880                dlg.finished(false);
10881                return Err(common::Error::FieldClash(field));
10882            }
10883        }
10884
10885        let mut params = Params::with_capacity(4 + self._additional_params.len());
10886        params.push("name", self._name);
10887
10888        params.extend(self._additional_params.iter());
10889
10890        params.push("alt", "json");
10891        let mut url = self.hub._base_url.clone() + "v1/{+name}";
10892        if self._scopes.is_empty() {
10893            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
10894        }
10895
10896        #[allow(clippy::single_element_loop)]
10897        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10898            url = params.uri_replacement(url, param_name, find_this, true);
10899        }
10900        {
10901            let to_remove = ["name"];
10902            params.remove_params(&to_remove);
10903        }
10904
10905        let url = params.parse_with_url(&url);
10906
10907        let mut json_mime_type = mime::APPLICATION_JSON;
10908        let mut request_value_reader = {
10909            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10910            common::remove_json_null_values(&mut value);
10911            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10912            serde_json::to_writer(&mut dst, &value).unwrap();
10913            dst
10914        };
10915        let request_size = request_value_reader
10916            .seek(std::io::SeekFrom::End(0))
10917            .unwrap();
10918        request_value_reader
10919            .seek(std::io::SeekFrom::Start(0))
10920            .unwrap();
10921
10922        loop {
10923            let token = match self
10924                .hub
10925                .auth
10926                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10927                .await
10928            {
10929                Ok(token) => token,
10930                Err(e) => match dlg.token(e) {
10931                    Ok(token) => token,
10932                    Err(e) => {
10933                        dlg.finished(false);
10934                        return Err(common::Error::MissingToken(e));
10935                    }
10936                },
10937            };
10938            request_value_reader
10939                .seek(std::io::SeekFrom::Start(0))
10940                .unwrap();
10941            let mut req_result = {
10942                let client = &self.hub.client;
10943                dlg.pre_request();
10944                let mut req_builder = hyper::Request::builder()
10945                    .method(hyper::Method::PATCH)
10946                    .uri(url.as_str())
10947                    .header(USER_AGENT, self.hub._user_agent.clone());
10948
10949                if let Some(token) = token.as_ref() {
10950                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10951                }
10952
10953                let request = req_builder
10954                    .header(CONTENT_TYPE, json_mime_type.to_string())
10955                    .header(CONTENT_LENGTH, request_size as u64)
10956                    .body(common::to_body(
10957                        request_value_reader.get_ref().clone().into(),
10958                    ));
10959
10960                client.request(request.unwrap()).await
10961            };
10962
10963            match req_result {
10964                Err(err) => {
10965                    if let common::Retry::After(d) = dlg.http_error(&err) {
10966                        sleep(d).await;
10967                        continue;
10968                    }
10969                    dlg.finished(false);
10970                    return Err(common::Error::HttpError(err));
10971                }
10972                Ok(res) => {
10973                    let (mut parts, body) = res.into_parts();
10974                    let mut body = common::Body::new(body);
10975                    if !parts.status.is_success() {
10976                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10977                        let error = serde_json::from_str(&common::to_string(&bytes));
10978                        let response = common::to_response(parts, bytes.into());
10979
10980                        if let common::Retry::After(d) =
10981                            dlg.http_failure(&response, error.as_ref().ok())
10982                        {
10983                            sleep(d).await;
10984                            continue;
10985                        }
10986
10987                        dlg.finished(false);
10988
10989                        return Err(match error {
10990                            Ok(value) => common::Error::BadRequest(value),
10991                            _ => common::Error::Failure(response),
10992                        });
10993                    }
10994                    let response = {
10995                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10996                        let encoded = common::to_string(&bytes);
10997                        match serde_json::from_str(&encoded) {
10998                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10999                            Err(error) => {
11000                                dlg.response_json_decode_error(&encoded, &error);
11001                                return Err(common::Error::JsonDecodeError(
11002                                    encoded.to_string(),
11003                                    error,
11004                                ));
11005                            }
11006                        }
11007                    };
11008
11009                    dlg.finished(true);
11010                    return Ok(response);
11011                }
11012            }
11013        }
11014    }
11015
11016    ///
11017    /// Sets the *request* property to the given value.
11018    ///
11019    /// Even though the property as already been set when instantiating this call,
11020    /// we provide this method for API completeness.
11021    pub fn request(
11022        mut self,
11023        new_value: GoogleCloudChannelV1CustomerRepricingConfig,
11024    ) -> AccountCustomerCustomerRepricingConfigPatchCall<'a, C> {
11025        self._request = new_value;
11026        self
11027    }
11028    /// Output only. Resource name of the CustomerRepricingConfig. Format: accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}.
11029    ///
11030    /// Sets the *name* path property to the given value.
11031    ///
11032    /// Even though the property as already been set when instantiating this call,
11033    /// we provide this method for API completeness.
11034    pub fn name(
11035        mut self,
11036        new_value: &str,
11037    ) -> AccountCustomerCustomerRepricingConfigPatchCall<'a, C> {
11038        self._name = new_value.to_string();
11039        self
11040    }
11041    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11042    /// while executing the actual API request.
11043    ///
11044    /// ````text
11045    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11046    /// ````
11047    ///
11048    /// Sets the *delegate* property to the given value.
11049    pub fn delegate(
11050        mut self,
11051        new_value: &'a mut dyn common::Delegate,
11052    ) -> AccountCustomerCustomerRepricingConfigPatchCall<'a, C> {
11053        self._delegate = Some(new_value);
11054        self
11055    }
11056
11057    /// Set any additional parameter of the query string used in the request.
11058    /// It should be used to set parameters which are not yet available through their own
11059    /// setters.
11060    ///
11061    /// Please note that this method must not be used to set any of the known parameters
11062    /// which have their own setter method. If done anyway, the request will fail.
11063    ///
11064    /// # Additional Parameters
11065    ///
11066    /// * *$.xgafv* (query-string) - V1 error format.
11067    /// * *access_token* (query-string) - OAuth access token.
11068    /// * *alt* (query-string) - Data format for response.
11069    /// * *callback* (query-string) - JSONP
11070    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11071    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11072    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11073    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11074    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11075    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11076    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11077    pub fn param<T>(
11078        mut self,
11079        name: T,
11080        value: T,
11081    ) -> AccountCustomerCustomerRepricingConfigPatchCall<'a, C>
11082    where
11083        T: AsRef<str>,
11084    {
11085        self._additional_params
11086            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11087        self
11088    }
11089
11090    /// Identifies the authorization scope for the method you are building.
11091    ///
11092    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11093    /// [`Scope::AppOrder`].
11094    ///
11095    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11096    /// tokens for more than one scope.
11097    ///
11098    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11099    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11100    /// sufficient, a read-write scope will do as well.
11101    pub fn add_scope<St>(
11102        mut self,
11103        scope: St,
11104    ) -> AccountCustomerCustomerRepricingConfigPatchCall<'a, C>
11105    where
11106        St: AsRef<str>,
11107    {
11108        self._scopes.insert(String::from(scope.as_ref()));
11109        self
11110    }
11111    /// Identifies the authorization scope(s) for the method you are building.
11112    ///
11113    /// See [`Self::add_scope()`] for details.
11114    pub fn add_scopes<I, St>(
11115        mut self,
11116        scopes: I,
11117    ) -> AccountCustomerCustomerRepricingConfigPatchCall<'a, C>
11118    where
11119        I: IntoIterator<Item = St>,
11120        St: AsRef<str>,
11121    {
11122        self._scopes
11123            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11124        self
11125    }
11126
11127    /// Removes all scopes, and no default scope will be used either.
11128    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11129    /// for details).
11130    pub fn clear_scopes(mut self) -> AccountCustomerCustomerRepricingConfigPatchCall<'a, C> {
11131        self._scopes.clear();
11132        self
11133    }
11134}
11135
11136/// Activates a previously suspended entitlement. Entitlements suspended for pending ToS acceptance can't be activated using this method. An entitlement activation is a long-running operation and it updates the state of the customer entitlement. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: Entitlement resource not found. * SUSPENSION_NOT_RESELLER_INITIATED: Can only activate reseller-initiated suspensions and entitlements that have accepted the TOS. * NOT_SUSPENDED: Can only activate suspended entitlements not in an ACTIVE state. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata will contain an instance of OperationMetadata.
11137///
11138/// A builder for the *customers.entitlements.activate* method supported by a *account* resource.
11139/// It is not used directly, but through a [`AccountMethods`] instance.
11140///
11141/// # Example
11142///
11143/// Instantiate a resource method builder
11144///
11145/// ```test_harness,no_run
11146/// # extern crate hyper;
11147/// # extern crate hyper_rustls;
11148/// # extern crate google_cloudchannel1 as cloudchannel1;
11149/// use cloudchannel1::api::GoogleCloudChannelV1ActivateEntitlementRequest;
11150/// # async fn dox() {
11151/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11152///
11153/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11154/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11155/// #     .with_native_roots()
11156/// #     .unwrap()
11157/// #     .https_only()
11158/// #     .enable_http2()
11159/// #     .build();
11160///
11161/// # let executor = hyper_util::rt::TokioExecutor::new();
11162/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11163/// #     secret,
11164/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11165/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11166/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11167/// #     ),
11168/// # ).build().await.unwrap();
11169///
11170/// # let client = hyper_util::client::legacy::Client::builder(
11171/// #     hyper_util::rt::TokioExecutor::new()
11172/// # )
11173/// # .build(
11174/// #     hyper_rustls::HttpsConnectorBuilder::new()
11175/// #         .with_native_roots()
11176/// #         .unwrap()
11177/// #         .https_or_http()
11178/// #         .enable_http2()
11179/// #         .build()
11180/// # );
11181/// # let mut hub = Cloudchannel::new(client, auth);
11182/// // As the method needs a request, you would usually fill it with the desired information
11183/// // into the respective structure. Some of the parts shown here might not be applicable !
11184/// // Values shown here are possibly random and not representative !
11185/// let mut req = GoogleCloudChannelV1ActivateEntitlementRequest::default();
11186///
11187/// // You can configure optional parameters by calling the respective setters at will, and
11188/// // execute the final call using `doit()`.
11189/// // Values shown here are possibly random and not representative !
11190/// let result = hub.accounts().customers_entitlements_activate(req, "name")
11191///              .doit().await;
11192/// # }
11193/// ```
11194pub struct AccountCustomerEntitlementActivateCall<'a, C>
11195where
11196    C: 'a,
11197{
11198    hub: &'a Cloudchannel<C>,
11199    _request: GoogleCloudChannelV1ActivateEntitlementRequest,
11200    _name: String,
11201    _delegate: Option<&'a mut dyn common::Delegate>,
11202    _additional_params: HashMap<String, String>,
11203    _scopes: BTreeSet<String>,
11204}
11205
11206impl<'a, C> common::CallBuilder for AccountCustomerEntitlementActivateCall<'a, C> {}
11207
11208impl<'a, C> AccountCustomerEntitlementActivateCall<'a, C>
11209where
11210    C: common::Connector,
11211{
11212    /// Perform the operation you have build so far.
11213    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
11214        use std::borrow::Cow;
11215        use std::io::{Read, Seek};
11216
11217        use common::{url::Params, ToParts};
11218        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11219
11220        let mut dd = common::DefaultDelegate;
11221        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11222        dlg.begin(common::MethodInfo {
11223            id: "cloudchannel.accounts.customers.entitlements.activate",
11224            http_method: hyper::Method::POST,
11225        });
11226
11227        for &field in ["alt", "name"].iter() {
11228            if self._additional_params.contains_key(field) {
11229                dlg.finished(false);
11230                return Err(common::Error::FieldClash(field));
11231            }
11232        }
11233
11234        let mut params = Params::with_capacity(4 + self._additional_params.len());
11235        params.push("name", self._name);
11236
11237        params.extend(self._additional_params.iter());
11238
11239        params.push("alt", "json");
11240        let mut url = self.hub._base_url.clone() + "v1/{+name}:activate";
11241        if self._scopes.is_empty() {
11242            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
11243        }
11244
11245        #[allow(clippy::single_element_loop)]
11246        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11247            url = params.uri_replacement(url, param_name, find_this, true);
11248        }
11249        {
11250            let to_remove = ["name"];
11251            params.remove_params(&to_remove);
11252        }
11253
11254        let url = params.parse_with_url(&url);
11255
11256        let mut json_mime_type = mime::APPLICATION_JSON;
11257        let mut request_value_reader = {
11258            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11259            common::remove_json_null_values(&mut value);
11260            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11261            serde_json::to_writer(&mut dst, &value).unwrap();
11262            dst
11263        };
11264        let request_size = request_value_reader
11265            .seek(std::io::SeekFrom::End(0))
11266            .unwrap();
11267        request_value_reader
11268            .seek(std::io::SeekFrom::Start(0))
11269            .unwrap();
11270
11271        loop {
11272            let token = match self
11273                .hub
11274                .auth
11275                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11276                .await
11277            {
11278                Ok(token) => token,
11279                Err(e) => match dlg.token(e) {
11280                    Ok(token) => token,
11281                    Err(e) => {
11282                        dlg.finished(false);
11283                        return Err(common::Error::MissingToken(e));
11284                    }
11285                },
11286            };
11287            request_value_reader
11288                .seek(std::io::SeekFrom::Start(0))
11289                .unwrap();
11290            let mut req_result = {
11291                let client = &self.hub.client;
11292                dlg.pre_request();
11293                let mut req_builder = hyper::Request::builder()
11294                    .method(hyper::Method::POST)
11295                    .uri(url.as_str())
11296                    .header(USER_AGENT, self.hub._user_agent.clone());
11297
11298                if let Some(token) = token.as_ref() {
11299                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11300                }
11301
11302                let request = req_builder
11303                    .header(CONTENT_TYPE, json_mime_type.to_string())
11304                    .header(CONTENT_LENGTH, request_size as u64)
11305                    .body(common::to_body(
11306                        request_value_reader.get_ref().clone().into(),
11307                    ));
11308
11309                client.request(request.unwrap()).await
11310            };
11311
11312            match req_result {
11313                Err(err) => {
11314                    if let common::Retry::After(d) = dlg.http_error(&err) {
11315                        sleep(d).await;
11316                        continue;
11317                    }
11318                    dlg.finished(false);
11319                    return Err(common::Error::HttpError(err));
11320                }
11321                Ok(res) => {
11322                    let (mut parts, body) = res.into_parts();
11323                    let mut body = common::Body::new(body);
11324                    if !parts.status.is_success() {
11325                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11326                        let error = serde_json::from_str(&common::to_string(&bytes));
11327                        let response = common::to_response(parts, bytes.into());
11328
11329                        if let common::Retry::After(d) =
11330                            dlg.http_failure(&response, error.as_ref().ok())
11331                        {
11332                            sleep(d).await;
11333                            continue;
11334                        }
11335
11336                        dlg.finished(false);
11337
11338                        return Err(match error {
11339                            Ok(value) => common::Error::BadRequest(value),
11340                            _ => common::Error::Failure(response),
11341                        });
11342                    }
11343                    let response = {
11344                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11345                        let encoded = common::to_string(&bytes);
11346                        match serde_json::from_str(&encoded) {
11347                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11348                            Err(error) => {
11349                                dlg.response_json_decode_error(&encoded, &error);
11350                                return Err(common::Error::JsonDecodeError(
11351                                    encoded.to_string(),
11352                                    error,
11353                                ));
11354                            }
11355                        }
11356                    };
11357
11358                    dlg.finished(true);
11359                    return Ok(response);
11360                }
11361            }
11362        }
11363    }
11364
11365    ///
11366    /// Sets the *request* property to the given value.
11367    ///
11368    /// Even though the property as already been set when instantiating this call,
11369    /// we provide this method for API completeness.
11370    pub fn request(
11371        mut self,
11372        new_value: GoogleCloudChannelV1ActivateEntitlementRequest,
11373    ) -> AccountCustomerEntitlementActivateCall<'a, C> {
11374        self._request = new_value;
11375        self
11376    }
11377    /// Required. The resource name of the entitlement to activate. Name uses the format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
11378    ///
11379    /// Sets the *name* path property to the given value.
11380    ///
11381    /// Even though the property as already been set when instantiating this call,
11382    /// we provide this method for API completeness.
11383    pub fn name(mut self, new_value: &str) -> AccountCustomerEntitlementActivateCall<'a, C> {
11384        self._name = new_value.to_string();
11385        self
11386    }
11387    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11388    /// while executing the actual API request.
11389    ///
11390    /// ````text
11391    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11392    /// ````
11393    ///
11394    /// Sets the *delegate* property to the given value.
11395    pub fn delegate(
11396        mut self,
11397        new_value: &'a mut dyn common::Delegate,
11398    ) -> AccountCustomerEntitlementActivateCall<'a, C> {
11399        self._delegate = Some(new_value);
11400        self
11401    }
11402
11403    /// Set any additional parameter of the query string used in the request.
11404    /// It should be used to set parameters which are not yet available through their own
11405    /// setters.
11406    ///
11407    /// Please note that this method must not be used to set any of the known parameters
11408    /// which have their own setter method. If done anyway, the request will fail.
11409    ///
11410    /// # Additional Parameters
11411    ///
11412    /// * *$.xgafv* (query-string) - V1 error format.
11413    /// * *access_token* (query-string) - OAuth access token.
11414    /// * *alt* (query-string) - Data format for response.
11415    /// * *callback* (query-string) - JSONP
11416    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11417    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11418    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11419    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11420    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11421    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11422    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11423    pub fn param<T>(mut self, name: T, value: T) -> AccountCustomerEntitlementActivateCall<'a, C>
11424    where
11425        T: AsRef<str>,
11426    {
11427        self._additional_params
11428            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11429        self
11430    }
11431
11432    /// Identifies the authorization scope for the method you are building.
11433    ///
11434    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11435    /// [`Scope::AppOrder`].
11436    ///
11437    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11438    /// tokens for more than one scope.
11439    ///
11440    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11441    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11442    /// sufficient, a read-write scope will do as well.
11443    pub fn add_scope<St>(mut self, scope: St) -> AccountCustomerEntitlementActivateCall<'a, C>
11444    where
11445        St: AsRef<str>,
11446    {
11447        self._scopes.insert(String::from(scope.as_ref()));
11448        self
11449    }
11450    /// Identifies the authorization scope(s) for the method you are building.
11451    ///
11452    /// See [`Self::add_scope()`] for details.
11453    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountCustomerEntitlementActivateCall<'a, C>
11454    where
11455        I: IntoIterator<Item = St>,
11456        St: AsRef<str>,
11457    {
11458        self._scopes
11459            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11460        self
11461    }
11462
11463    /// Removes all scopes, and no default scope will be used either.
11464    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11465    /// for details).
11466    pub fn clear_scopes(mut self) -> AccountCustomerEntitlementActivateCall<'a, C> {
11467        self._scopes.clear();
11468        self
11469    }
11470}
11471
11472/// Cancels a previously fulfilled entitlement. An entitlement cancellation is a long-running operation. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * FAILED_PRECONDITION: There are Google Cloud projects linked to the Google Cloud entitlement's Cloud Billing subaccount. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: Entitlement resource not found. * DELETION_TYPE_NOT_ALLOWED: Cancel is only allowed for Google Workspace add-ons, or entitlements for Google Cloud's development platform. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The response will contain google.protobuf.Empty on success. The Operation metadata will contain an instance of OperationMetadata.
11473///
11474/// A builder for the *customers.entitlements.cancel* method supported by a *account* resource.
11475/// It is not used directly, but through a [`AccountMethods`] instance.
11476///
11477/// # Example
11478///
11479/// Instantiate a resource method builder
11480///
11481/// ```test_harness,no_run
11482/// # extern crate hyper;
11483/// # extern crate hyper_rustls;
11484/// # extern crate google_cloudchannel1 as cloudchannel1;
11485/// use cloudchannel1::api::GoogleCloudChannelV1CancelEntitlementRequest;
11486/// # async fn dox() {
11487/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11488///
11489/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11490/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11491/// #     .with_native_roots()
11492/// #     .unwrap()
11493/// #     .https_only()
11494/// #     .enable_http2()
11495/// #     .build();
11496///
11497/// # let executor = hyper_util::rt::TokioExecutor::new();
11498/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11499/// #     secret,
11500/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11501/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11502/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11503/// #     ),
11504/// # ).build().await.unwrap();
11505///
11506/// # let client = hyper_util::client::legacy::Client::builder(
11507/// #     hyper_util::rt::TokioExecutor::new()
11508/// # )
11509/// # .build(
11510/// #     hyper_rustls::HttpsConnectorBuilder::new()
11511/// #         .with_native_roots()
11512/// #         .unwrap()
11513/// #         .https_or_http()
11514/// #         .enable_http2()
11515/// #         .build()
11516/// # );
11517/// # let mut hub = Cloudchannel::new(client, auth);
11518/// // As the method needs a request, you would usually fill it with the desired information
11519/// // into the respective structure. Some of the parts shown here might not be applicable !
11520/// // Values shown here are possibly random and not representative !
11521/// let mut req = GoogleCloudChannelV1CancelEntitlementRequest::default();
11522///
11523/// // You can configure optional parameters by calling the respective setters at will, and
11524/// // execute the final call using `doit()`.
11525/// // Values shown here are possibly random and not representative !
11526/// let result = hub.accounts().customers_entitlements_cancel(req, "name")
11527///              .doit().await;
11528/// # }
11529/// ```
11530pub struct AccountCustomerEntitlementCancelCall<'a, C>
11531where
11532    C: 'a,
11533{
11534    hub: &'a Cloudchannel<C>,
11535    _request: GoogleCloudChannelV1CancelEntitlementRequest,
11536    _name: String,
11537    _delegate: Option<&'a mut dyn common::Delegate>,
11538    _additional_params: HashMap<String, String>,
11539    _scopes: BTreeSet<String>,
11540}
11541
11542impl<'a, C> common::CallBuilder for AccountCustomerEntitlementCancelCall<'a, C> {}
11543
11544impl<'a, C> AccountCustomerEntitlementCancelCall<'a, C>
11545where
11546    C: common::Connector,
11547{
11548    /// Perform the operation you have build so far.
11549    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
11550        use std::borrow::Cow;
11551        use std::io::{Read, Seek};
11552
11553        use common::{url::Params, ToParts};
11554        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11555
11556        let mut dd = common::DefaultDelegate;
11557        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11558        dlg.begin(common::MethodInfo {
11559            id: "cloudchannel.accounts.customers.entitlements.cancel",
11560            http_method: hyper::Method::POST,
11561        });
11562
11563        for &field in ["alt", "name"].iter() {
11564            if self._additional_params.contains_key(field) {
11565                dlg.finished(false);
11566                return Err(common::Error::FieldClash(field));
11567            }
11568        }
11569
11570        let mut params = Params::with_capacity(4 + self._additional_params.len());
11571        params.push("name", self._name);
11572
11573        params.extend(self._additional_params.iter());
11574
11575        params.push("alt", "json");
11576        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
11577        if self._scopes.is_empty() {
11578            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
11579        }
11580
11581        #[allow(clippy::single_element_loop)]
11582        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11583            url = params.uri_replacement(url, param_name, find_this, true);
11584        }
11585        {
11586            let to_remove = ["name"];
11587            params.remove_params(&to_remove);
11588        }
11589
11590        let url = params.parse_with_url(&url);
11591
11592        let mut json_mime_type = mime::APPLICATION_JSON;
11593        let mut request_value_reader = {
11594            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11595            common::remove_json_null_values(&mut value);
11596            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11597            serde_json::to_writer(&mut dst, &value).unwrap();
11598            dst
11599        };
11600        let request_size = request_value_reader
11601            .seek(std::io::SeekFrom::End(0))
11602            .unwrap();
11603        request_value_reader
11604            .seek(std::io::SeekFrom::Start(0))
11605            .unwrap();
11606
11607        loop {
11608            let token = match self
11609                .hub
11610                .auth
11611                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11612                .await
11613            {
11614                Ok(token) => token,
11615                Err(e) => match dlg.token(e) {
11616                    Ok(token) => token,
11617                    Err(e) => {
11618                        dlg.finished(false);
11619                        return Err(common::Error::MissingToken(e));
11620                    }
11621                },
11622            };
11623            request_value_reader
11624                .seek(std::io::SeekFrom::Start(0))
11625                .unwrap();
11626            let mut req_result = {
11627                let client = &self.hub.client;
11628                dlg.pre_request();
11629                let mut req_builder = hyper::Request::builder()
11630                    .method(hyper::Method::POST)
11631                    .uri(url.as_str())
11632                    .header(USER_AGENT, self.hub._user_agent.clone());
11633
11634                if let Some(token) = token.as_ref() {
11635                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11636                }
11637
11638                let request = req_builder
11639                    .header(CONTENT_TYPE, json_mime_type.to_string())
11640                    .header(CONTENT_LENGTH, request_size as u64)
11641                    .body(common::to_body(
11642                        request_value_reader.get_ref().clone().into(),
11643                    ));
11644
11645                client.request(request.unwrap()).await
11646            };
11647
11648            match req_result {
11649                Err(err) => {
11650                    if let common::Retry::After(d) = dlg.http_error(&err) {
11651                        sleep(d).await;
11652                        continue;
11653                    }
11654                    dlg.finished(false);
11655                    return Err(common::Error::HttpError(err));
11656                }
11657                Ok(res) => {
11658                    let (mut parts, body) = res.into_parts();
11659                    let mut body = common::Body::new(body);
11660                    if !parts.status.is_success() {
11661                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11662                        let error = serde_json::from_str(&common::to_string(&bytes));
11663                        let response = common::to_response(parts, bytes.into());
11664
11665                        if let common::Retry::After(d) =
11666                            dlg.http_failure(&response, error.as_ref().ok())
11667                        {
11668                            sleep(d).await;
11669                            continue;
11670                        }
11671
11672                        dlg.finished(false);
11673
11674                        return Err(match error {
11675                            Ok(value) => common::Error::BadRequest(value),
11676                            _ => common::Error::Failure(response),
11677                        });
11678                    }
11679                    let response = {
11680                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11681                        let encoded = common::to_string(&bytes);
11682                        match serde_json::from_str(&encoded) {
11683                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11684                            Err(error) => {
11685                                dlg.response_json_decode_error(&encoded, &error);
11686                                return Err(common::Error::JsonDecodeError(
11687                                    encoded.to_string(),
11688                                    error,
11689                                ));
11690                            }
11691                        }
11692                    };
11693
11694                    dlg.finished(true);
11695                    return Ok(response);
11696                }
11697            }
11698        }
11699    }
11700
11701    ///
11702    /// Sets the *request* property to the given value.
11703    ///
11704    /// Even though the property as already been set when instantiating this call,
11705    /// we provide this method for API completeness.
11706    pub fn request(
11707        mut self,
11708        new_value: GoogleCloudChannelV1CancelEntitlementRequest,
11709    ) -> AccountCustomerEntitlementCancelCall<'a, C> {
11710        self._request = new_value;
11711        self
11712    }
11713    /// Required. The resource name of the entitlement to cancel. Name uses the format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
11714    ///
11715    /// Sets the *name* path property to the given value.
11716    ///
11717    /// Even though the property as already been set when instantiating this call,
11718    /// we provide this method for API completeness.
11719    pub fn name(mut self, new_value: &str) -> AccountCustomerEntitlementCancelCall<'a, C> {
11720        self._name = new_value.to_string();
11721        self
11722    }
11723    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11724    /// while executing the actual API request.
11725    ///
11726    /// ````text
11727    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11728    /// ````
11729    ///
11730    /// Sets the *delegate* property to the given value.
11731    pub fn delegate(
11732        mut self,
11733        new_value: &'a mut dyn common::Delegate,
11734    ) -> AccountCustomerEntitlementCancelCall<'a, C> {
11735        self._delegate = Some(new_value);
11736        self
11737    }
11738
11739    /// Set any additional parameter of the query string used in the request.
11740    /// It should be used to set parameters which are not yet available through their own
11741    /// setters.
11742    ///
11743    /// Please note that this method must not be used to set any of the known parameters
11744    /// which have their own setter method. If done anyway, the request will fail.
11745    ///
11746    /// # Additional Parameters
11747    ///
11748    /// * *$.xgafv* (query-string) - V1 error format.
11749    /// * *access_token* (query-string) - OAuth access token.
11750    /// * *alt* (query-string) - Data format for response.
11751    /// * *callback* (query-string) - JSONP
11752    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11753    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11754    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11755    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11756    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11757    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11758    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11759    pub fn param<T>(mut self, name: T, value: T) -> AccountCustomerEntitlementCancelCall<'a, C>
11760    where
11761        T: AsRef<str>,
11762    {
11763        self._additional_params
11764            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11765        self
11766    }
11767
11768    /// Identifies the authorization scope for the method you are building.
11769    ///
11770    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11771    /// [`Scope::AppOrder`].
11772    ///
11773    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11774    /// tokens for more than one scope.
11775    ///
11776    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11777    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11778    /// sufficient, a read-write scope will do as well.
11779    pub fn add_scope<St>(mut self, scope: St) -> AccountCustomerEntitlementCancelCall<'a, C>
11780    where
11781        St: AsRef<str>,
11782    {
11783        self._scopes.insert(String::from(scope.as_ref()));
11784        self
11785    }
11786    /// Identifies the authorization scope(s) for the method you are building.
11787    ///
11788    /// See [`Self::add_scope()`] for details.
11789    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountCustomerEntitlementCancelCall<'a, C>
11790    where
11791        I: IntoIterator<Item = St>,
11792        St: AsRef<str>,
11793    {
11794        self._scopes
11795            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11796        self
11797    }
11798
11799    /// Removes all scopes, and no default scope will be used either.
11800    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11801    /// for details).
11802    pub fn clear_scopes(mut self) -> AccountCustomerEntitlementCancelCall<'a, C> {
11803        self._scopes.clear();
11804        self
11805    }
11806}
11807
11808/// Updates the Offer for an existing customer entitlement. An entitlement update is a long-running operation and it updates the entitlement as a result of fulfillment. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: Offer or Entitlement resource not found. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata will contain an instance of OperationMetadata.
11809///
11810/// A builder for the *customers.entitlements.changeOffer* method supported by a *account* resource.
11811/// It is not used directly, but through a [`AccountMethods`] instance.
11812///
11813/// # Example
11814///
11815/// Instantiate a resource method builder
11816///
11817/// ```test_harness,no_run
11818/// # extern crate hyper;
11819/// # extern crate hyper_rustls;
11820/// # extern crate google_cloudchannel1 as cloudchannel1;
11821/// use cloudchannel1::api::GoogleCloudChannelV1ChangeOfferRequest;
11822/// # async fn dox() {
11823/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11824///
11825/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11826/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11827/// #     .with_native_roots()
11828/// #     .unwrap()
11829/// #     .https_only()
11830/// #     .enable_http2()
11831/// #     .build();
11832///
11833/// # let executor = hyper_util::rt::TokioExecutor::new();
11834/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11835/// #     secret,
11836/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11837/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11838/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11839/// #     ),
11840/// # ).build().await.unwrap();
11841///
11842/// # let client = hyper_util::client::legacy::Client::builder(
11843/// #     hyper_util::rt::TokioExecutor::new()
11844/// # )
11845/// # .build(
11846/// #     hyper_rustls::HttpsConnectorBuilder::new()
11847/// #         .with_native_roots()
11848/// #         .unwrap()
11849/// #         .https_or_http()
11850/// #         .enable_http2()
11851/// #         .build()
11852/// # );
11853/// # let mut hub = Cloudchannel::new(client, auth);
11854/// // As the method needs a request, you would usually fill it with the desired information
11855/// // into the respective structure. Some of the parts shown here might not be applicable !
11856/// // Values shown here are possibly random and not representative !
11857/// let mut req = GoogleCloudChannelV1ChangeOfferRequest::default();
11858///
11859/// // You can configure optional parameters by calling the respective setters at will, and
11860/// // execute the final call using `doit()`.
11861/// // Values shown here are possibly random and not representative !
11862/// let result = hub.accounts().customers_entitlements_change_offer(req, "name")
11863///              .doit().await;
11864/// # }
11865/// ```
11866pub struct AccountCustomerEntitlementChangeOfferCall<'a, C>
11867where
11868    C: 'a,
11869{
11870    hub: &'a Cloudchannel<C>,
11871    _request: GoogleCloudChannelV1ChangeOfferRequest,
11872    _name: String,
11873    _delegate: Option<&'a mut dyn common::Delegate>,
11874    _additional_params: HashMap<String, String>,
11875    _scopes: BTreeSet<String>,
11876}
11877
11878impl<'a, C> common::CallBuilder for AccountCustomerEntitlementChangeOfferCall<'a, C> {}
11879
11880impl<'a, C> AccountCustomerEntitlementChangeOfferCall<'a, C>
11881where
11882    C: common::Connector,
11883{
11884    /// Perform the operation you have build so far.
11885    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
11886        use std::borrow::Cow;
11887        use std::io::{Read, Seek};
11888
11889        use common::{url::Params, ToParts};
11890        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11891
11892        let mut dd = common::DefaultDelegate;
11893        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11894        dlg.begin(common::MethodInfo {
11895            id: "cloudchannel.accounts.customers.entitlements.changeOffer",
11896            http_method: hyper::Method::POST,
11897        });
11898
11899        for &field in ["alt", "name"].iter() {
11900            if self._additional_params.contains_key(field) {
11901                dlg.finished(false);
11902                return Err(common::Error::FieldClash(field));
11903            }
11904        }
11905
11906        let mut params = Params::with_capacity(4 + self._additional_params.len());
11907        params.push("name", self._name);
11908
11909        params.extend(self._additional_params.iter());
11910
11911        params.push("alt", "json");
11912        let mut url = self.hub._base_url.clone() + "v1/{+name}:changeOffer";
11913        if self._scopes.is_empty() {
11914            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
11915        }
11916
11917        #[allow(clippy::single_element_loop)]
11918        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11919            url = params.uri_replacement(url, param_name, find_this, true);
11920        }
11921        {
11922            let to_remove = ["name"];
11923            params.remove_params(&to_remove);
11924        }
11925
11926        let url = params.parse_with_url(&url);
11927
11928        let mut json_mime_type = mime::APPLICATION_JSON;
11929        let mut request_value_reader = {
11930            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11931            common::remove_json_null_values(&mut value);
11932            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11933            serde_json::to_writer(&mut dst, &value).unwrap();
11934            dst
11935        };
11936        let request_size = request_value_reader
11937            .seek(std::io::SeekFrom::End(0))
11938            .unwrap();
11939        request_value_reader
11940            .seek(std::io::SeekFrom::Start(0))
11941            .unwrap();
11942
11943        loop {
11944            let token = match self
11945                .hub
11946                .auth
11947                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11948                .await
11949            {
11950                Ok(token) => token,
11951                Err(e) => match dlg.token(e) {
11952                    Ok(token) => token,
11953                    Err(e) => {
11954                        dlg.finished(false);
11955                        return Err(common::Error::MissingToken(e));
11956                    }
11957                },
11958            };
11959            request_value_reader
11960                .seek(std::io::SeekFrom::Start(0))
11961                .unwrap();
11962            let mut req_result = {
11963                let client = &self.hub.client;
11964                dlg.pre_request();
11965                let mut req_builder = hyper::Request::builder()
11966                    .method(hyper::Method::POST)
11967                    .uri(url.as_str())
11968                    .header(USER_AGENT, self.hub._user_agent.clone());
11969
11970                if let Some(token) = token.as_ref() {
11971                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11972                }
11973
11974                let request = req_builder
11975                    .header(CONTENT_TYPE, json_mime_type.to_string())
11976                    .header(CONTENT_LENGTH, request_size as u64)
11977                    .body(common::to_body(
11978                        request_value_reader.get_ref().clone().into(),
11979                    ));
11980
11981                client.request(request.unwrap()).await
11982            };
11983
11984            match req_result {
11985                Err(err) => {
11986                    if let common::Retry::After(d) = dlg.http_error(&err) {
11987                        sleep(d).await;
11988                        continue;
11989                    }
11990                    dlg.finished(false);
11991                    return Err(common::Error::HttpError(err));
11992                }
11993                Ok(res) => {
11994                    let (mut parts, body) = res.into_parts();
11995                    let mut body = common::Body::new(body);
11996                    if !parts.status.is_success() {
11997                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11998                        let error = serde_json::from_str(&common::to_string(&bytes));
11999                        let response = common::to_response(parts, bytes.into());
12000
12001                        if let common::Retry::After(d) =
12002                            dlg.http_failure(&response, error.as_ref().ok())
12003                        {
12004                            sleep(d).await;
12005                            continue;
12006                        }
12007
12008                        dlg.finished(false);
12009
12010                        return Err(match error {
12011                            Ok(value) => common::Error::BadRequest(value),
12012                            _ => common::Error::Failure(response),
12013                        });
12014                    }
12015                    let response = {
12016                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12017                        let encoded = common::to_string(&bytes);
12018                        match serde_json::from_str(&encoded) {
12019                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12020                            Err(error) => {
12021                                dlg.response_json_decode_error(&encoded, &error);
12022                                return Err(common::Error::JsonDecodeError(
12023                                    encoded.to_string(),
12024                                    error,
12025                                ));
12026                            }
12027                        }
12028                    };
12029
12030                    dlg.finished(true);
12031                    return Ok(response);
12032                }
12033            }
12034        }
12035    }
12036
12037    ///
12038    /// Sets the *request* property to the given value.
12039    ///
12040    /// Even though the property as already been set when instantiating this call,
12041    /// we provide this method for API completeness.
12042    pub fn request(
12043        mut self,
12044        new_value: GoogleCloudChannelV1ChangeOfferRequest,
12045    ) -> AccountCustomerEntitlementChangeOfferCall<'a, C> {
12046        self._request = new_value;
12047        self
12048    }
12049    /// Required. The resource name of the entitlement to update. Name uses the format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
12050    ///
12051    /// Sets the *name* path property to the given value.
12052    ///
12053    /// Even though the property as already been set when instantiating this call,
12054    /// we provide this method for API completeness.
12055    pub fn name(mut self, new_value: &str) -> AccountCustomerEntitlementChangeOfferCall<'a, C> {
12056        self._name = new_value.to_string();
12057        self
12058    }
12059    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12060    /// while executing the actual API request.
12061    ///
12062    /// ````text
12063    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12064    /// ````
12065    ///
12066    /// Sets the *delegate* property to the given value.
12067    pub fn delegate(
12068        mut self,
12069        new_value: &'a mut dyn common::Delegate,
12070    ) -> AccountCustomerEntitlementChangeOfferCall<'a, C> {
12071        self._delegate = Some(new_value);
12072        self
12073    }
12074
12075    /// Set any additional parameter of the query string used in the request.
12076    /// It should be used to set parameters which are not yet available through their own
12077    /// setters.
12078    ///
12079    /// Please note that this method must not be used to set any of the known parameters
12080    /// which have their own setter method. If done anyway, the request will fail.
12081    ///
12082    /// # Additional Parameters
12083    ///
12084    /// * *$.xgafv* (query-string) - V1 error format.
12085    /// * *access_token* (query-string) - OAuth access token.
12086    /// * *alt* (query-string) - Data format for response.
12087    /// * *callback* (query-string) - JSONP
12088    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12089    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12090    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12091    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12092    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12093    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12094    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12095    pub fn param<T>(mut self, name: T, value: T) -> AccountCustomerEntitlementChangeOfferCall<'a, C>
12096    where
12097        T: AsRef<str>,
12098    {
12099        self._additional_params
12100            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12101        self
12102    }
12103
12104    /// Identifies the authorization scope for the method you are building.
12105    ///
12106    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12107    /// [`Scope::AppOrder`].
12108    ///
12109    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12110    /// tokens for more than one scope.
12111    ///
12112    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12113    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12114    /// sufficient, a read-write scope will do as well.
12115    pub fn add_scope<St>(mut self, scope: St) -> AccountCustomerEntitlementChangeOfferCall<'a, C>
12116    where
12117        St: AsRef<str>,
12118    {
12119        self._scopes.insert(String::from(scope.as_ref()));
12120        self
12121    }
12122    /// Identifies the authorization scope(s) for the method you are building.
12123    ///
12124    /// See [`Self::add_scope()`] for details.
12125    pub fn add_scopes<I, St>(
12126        mut self,
12127        scopes: I,
12128    ) -> AccountCustomerEntitlementChangeOfferCall<'a, C>
12129    where
12130        I: IntoIterator<Item = St>,
12131        St: AsRef<str>,
12132    {
12133        self._scopes
12134            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12135        self
12136    }
12137
12138    /// Removes all scopes, and no default scope will be used either.
12139    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12140    /// for details).
12141    pub fn clear_scopes(mut self) -> AccountCustomerEntitlementChangeOfferCall<'a, C> {
12142        self._scopes.clear();
12143        self
12144    }
12145}
12146
12147/// Change parameters of the entitlement. An entitlement update is a long-running operation and it updates the entitlement as a result of fulfillment. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. For example, the number of seats being changed is greater than the allowed number of max seats, or decreasing seats for a commitment based plan. * NOT_FOUND: Entitlement resource not found. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata will contain an instance of OperationMetadata.
12148///
12149/// A builder for the *customers.entitlements.changeParameters* method supported by a *account* resource.
12150/// It is not used directly, but through a [`AccountMethods`] instance.
12151///
12152/// # Example
12153///
12154/// Instantiate a resource method builder
12155///
12156/// ```test_harness,no_run
12157/// # extern crate hyper;
12158/// # extern crate hyper_rustls;
12159/// # extern crate google_cloudchannel1 as cloudchannel1;
12160/// use cloudchannel1::api::GoogleCloudChannelV1ChangeParametersRequest;
12161/// # async fn dox() {
12162/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12163///
12164/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12165/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12166/// #     .with_native_roots()
12167/// #     .unwrap()
12168/// #     .https_only()
12169/// #     .enable_http2()
12170/// #     .build();
12171///
12172/// # let executor = hyper_util::rt::TokioExecutor::new();
12173/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12174/// #     secret,
12175/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12176/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12177/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12178/// #     ),
12179/// # ).build().await.unwrap();
12180///
12181/// # let client = hyper_util::client::legacy::Client::builder(
12182/// #     hyper_util::rt::TokioExecutor::new()
12183/// # )
12184/// # .build(
12185/// #     hyper_rustls::HttpsConnectorBuilder::new()
12186/// #         .with_native_roots()
12187/// #         .unwrap()
12188/// #         .https_or_http()
12189/// #         .enable_http2()
12190/// #         .build()
12191/// # );
12192/// # let mut hub = Cloudchannel::new(client, auth);
12193/// // As the method needs a request, you would usually fill it with the desired information
12194/// // into the respective structure. Some of the parts shown here might not be applicable !
12195/// // Values shown here are possibly random and not representative !
12196/// let mut req = GoogleCloudChannelV1ChangeParametersRequest::default();
12197///
12198/// // You can configure optional parameters by calling the respective setters at will, and
12199/// // execute the final call using `doit()`.
12200/// // Values shown here are possibly random and not representative !
12201/// let result = hub.accounts().customers_entitlements_change_parameters(req, "name")
12202///              .doit().await;
12203/// # }
12204/// ```
12205pub struct AccountCustomerEntitlementChangeParameterCall<'a, C>
12206where
12207    C: 'a,
12208{
12209    hub: &'a Cloudchannel<C>,
12210    _request: GoogleCloudChannelV1ChangeParametersRequest,
12211    _name: String,
12212    _delegate: Option<&'a mut dyn common::Delegate>,
12213    _additional_params: HashMap<String, String>,
12214    _scopes: BTreeSet<String>,
12215}
12216
12217impl<'a, C> common::CallBuilder for AccountCustomerEntitlementChangeParameterCall<'a, C> {}
12218
12219impl<'a, C> AccountCustomerEntitlementChangeParameterCall<'a, C>
12220where
12221    C: common::Connector,
12222{
12223    /// Perform the operation you have build so far.
12224    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
12225        use std::borrow::Cow;
12226        use std::io::{Read, Seek};
12227
12228        use common::{url::Params, ToParts};
12229        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12230
12231        let mut dd = common::DefaultDelegate;
12232        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12233        dlg.begin(common::MethodInfo {
12234            id: "cloudchannel.accounts.customers.entitlements.changeParameters",
12235            http_method: hyper::Method::POST,
12236        });
12237
12238        for &field in ["alt", "name"].iter() {
12239            if self._additional_params.contains_key(field) {
12240                dlg.finished(false);
12241                return Err(common::Error::FieldClash(field));
12242            }
12243        }
12244
12245        let mut params = Params::with_capacity(4 + self._additional_params.len());
12246        params.push("name", self._name);
12247
12248        params.extend(self._additional_params.iter());
12249
12250        params.push("alt", "json");
12251        let mut url = self.hub._base_url.clone() + "v1/{+name}:changeParameters";
12252        if self._scopes.is_empty() {
12253            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
12254        }
12255
12256        #[allow(clippy::single_element_loop)]
12257        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12258            url = params.uri_replacement(url, param_name, find_this, true);
12259        }
12260        {
12261            let to_remove = ["name"];
12262            params.remove_params(&to_remove);
12263        }
12264
12265        let url = params.parse_with_url(&url);
12266
12267        let mut json_mime_type = mime::APPLICATION_JSON;
12268        let mut request_value_reader = {
12269            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12270            common::remove_json_null_values(&mut value);
12271            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12272            serde_json::to_writer(&mut dst, &value).unwrap();
12273            dst
12274        };
12275        let request_size = request_value_reader
12276            .seek(std::io::SeekFrom::End(0))
12277            .unwrap();
12278        request_value_reader
12279            .seek(std::io::SeekFrom::Start(0))
12280            .unwrap();
12281
12282        loop {
12283            let token = match self
12284                .hub
12285                .auth
12286                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12287                .await
12288            {
12289                Ok(token) => token,
12290                Err(e) => match dlg.token(e) {
12291                    Ok(token) => token,
12292                    Err(e) => {
12293                        dlg.finished(false);
12294                        return Err(common::Error::MissingToken(e));
12295                    }
12296                },
12297            };
12298            request_value_reader
12299                .seek(std::io::SeekFrom::Start(0))
12300                .unwrap();
12301            let mut req_result = {
12302                let client = &self.hub.client;
12303                dlg.pre_request();
12304                let mut req_builder = hyper::Request::builder()
12305                    .method(hyper::Method::POST)
12306                    .uri(url.as_str())
12307                    .header(USER_AGENT, self.hub._user_agent.clone());
12308
12309                if let Some(token) = token.as_ref() {
12310                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12311                }
12312
12313                let request = req_builder
12314                    .header(CONTENT_TYPE, json_mime_type.to_string())
12315                    .header(CONTENT_LENGTH, request_size as u64)
12316                    .body(common::to_body(
12317                        request_value_reader.get_ref().clone().into(),
12318                    ));
12319
12320                client.request(request.unwrap()).await
12321            };
12322
12323            match req_result {
12324                Err(err) => {
12325                    if let common::Retry::After(d) = dlg.http_error(&err) {
12326                        sleep(d).await;
12327                        continue;
12328                    }
12329                    dlg.finished(false);
12330                    return Err(common::Error::HttpError(err));
12331                }
12332                Ok(res) => {
12333                    let (mut parts, body) = res.into_parts();
12334                    let mut body = common::Body::new(body);
12335                    if !parts.status.is_success() {
12336                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12337                        let error = serde_json::from_str(&common::to_string(&bytes));
12338                        let response = common::to_response(parts, bytes.into());
12339
12340                        if let common::Retry::After(d) =
12341                            dlg.http_failure(&response, error.as_ref().ok())
12342                        {
12343                            sleep(d).await;
12344                            continue;
12345                        }
12346
12347                        dlg.finished(false);
12348
12349                        return Err(match error {
12350                            Ok(value) => common::Error::BadRequest(value),
12351                            _ => common::Error::Failure(response),
12352                        });
12353                    }
12354                    let response = {
12355                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12356                        let encoded = common::to_string(&bytes);
12357                        match serde_json::from_str(&encoded) {
12358                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12359                            Err(error) => {
12360                                dlg.response_json_decode_error(&encoded, &error);
12361                                return Err(common::Error::JsonDecodeError(
12362                                    encoded.to_string(),
12363                                    error,
12364                                ));
12365                            }
12366                        }
12367                    };
12368
12369                    dlg.finished(true);
12370                    return Ok(response);
12371                }
12372            }
12373        }
12374    }
12375
12376    ///
12377    /// Sets the *request* property to the given value.
12378    ///
12379    /// Even though the property as already been set when instantiating this call,
12380    /// we provide this method for API completeness.
12381    pub fn request(
12382        mut self,
12383        new_value: GoogleCloudChannelV1ChangeParametersRequest,
12384    ) -> AccountCustomerEntitlementChangeParameterCall<'a, C> {
12385        self._request = new_value;
12386        self
12387    }
12388    /// Required. The name of the entitlement to update. Name uses the format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
12389    ///
12390    /// Sets the *name* path property to the given value.
12391    ///
12392    /// Even though the property as already been set when instantiating this call,
12393    /// we provide this method for API completeness.
12394    pub fn name(mut self, new_value: &str) -> AccountCustomerEntitlementChangeParameterCall<'a, C> {
12395        self._name = new_value.to_string();
12396        self
12397    }
12398    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12399    /// while executing the actual API request.
12400    ///
12401    /// ````text
12402    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12403    /// ````
12404    ///
12405    /// Sets the *delegate* property to the given value.
12406    pub fn delegate(
12407        mut self,
12408        new_value: &'a mut dyn common::Delegate,
12409    ) -> AccountCustomerEntitlementChangeParameterCall<'a, C> {
12410        self._delegate = Some(new_value);
12411        self
12412    }
12413
12414    /// Set any additional parameter of the query string used in the request.
12415    /// It should be used to set parameters which are not yet available through their own
12416    /// setters.
12417    ///
12418    /// Please note that this method must not be used to set any of the known parameters
12419    /// which have their own setter method. If done anyway, the request will fail.
12420    ///
12421    /// # Additional Parameters
12422    ///
12423    /// * *$.xgafv* (query-string) - V1 error format.
12424    /// * *access_token* (query-string) - OAuth access token.
12425    /// * *alt* (query-string) - Data format for response.
12426    /// * *callback* (query-string) - JSONP
12427    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12428    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12429    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12430    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12431    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12432    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12433    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12434    pub fn param<T>(
12435        mut self,
12436        name: T,
12437        value: T,
12438    ) -> AccountCustomerEntitlementChangeParameterCall<'a, C>
12439    where
12440        T: AsRef<str>,
12441    {
12442        self._additional_params
12443            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12444        self
12445    }
12446
12447    /// Identifies the authorization scope for the method you are building.
12448    ///
12449    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12450    /// [`Scope::AppOrder`].
12451    ///
12452    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12453    /// tokens for more than one scope.
12454    ///
12455    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12456    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12457    /// sufficient, a read-write scope will do as well.
12458    pub fn add_scope<St>(
12459        mut self,
12460        scope: St,
12461    ) -> AccountCustomerEntitlementChangeParameterCall<'a, C>
12462    where
12463        St: AsRef<str>,
12464    {
12465        self._scopes.insert(String::from(scope.as_ref()));
12466        self
12467    }
12468    /// Identifies the authorization scope(s) for the method you are building.
12469    ///
12470    /// See [`Self::add_scope()`] for details.
12471    pub fn add_scopes<I, St>(
12472        mut self,
12473        scopes: I,
12474    ) -> AccountCustomerEntitlementChangeParameterCall<'a, C>
12475    where
12476        I: IntoIterator<Item = St>,
12477        St: AsRef<str>,
12478    {
12479        self._scopes
12480            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12481        self
12482    }
12483
12484    /// Removes all scopes, and no default scope will be used either.
12485    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12486    /// for details).
12487    pub fn clear_scopes(mut self) -> AccountCustomerEntitlementChangeParameterCall<'a, C> {
12488        self._scopes.clear();
12489        self
12490    }
12491}
12492
12493/// Updates the renewal settings for an existing customer entitlement. An entitlement update is a long-running operation and it updates the entitlement as a result of fulfillment. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: Entitlement resource not found. * NOT_COMMITMENT_PLAN: Renewal Settings are only applicable for a commitment plan. Can't enable or disable renewals for non-commitment plans. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata will contain an instance of OperationMetadata.
12494///
12495/// A builder for the *customers.entitlements.changeRenewalSettings* method supported by a *account* resource.
12496/// It is not used directly, but through a [`AccountMethods`] instance.
12497///
12498/// # Example
12499///
12500/// Instantiate a resource method builder
12501///
12502/// ```test_harness,no_run
12503/// # extern crate hyper;
12504/// # extern crate hyper_rustls;
12505/// # extern crate google_cloudchannel1 as cloudchannel1;
12506/// use cloudchannel1::api::GoogleCloudChannelV1ChangeRenewalSettingsRequest;
12507/// # async fn dox() {
12508/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12509///
12510/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12511/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12512/// #     .with_native_roots()
12513/// #     .unwrap()
12514/// #     .https_only()
12515/// #     .enable_http2()
12516/// #     .build();
12517///
12518/// # let executor = hyper_util::rt::TokioExecutor::new();
12519/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12520/// #     secret,
12521/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12522/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12523/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12524/// #     ),
12525/// # ).build().await.unwrap();
12526///
12527/// # let client = hyper_util::client::legacy::Client::builder(
12528/// #     hyper_util::rt::TokioExecutor::new()
12529/// # )
12530/// # .build(
12531/// #     hyper_rustls::HttpsConnectorBuilder::new()
12532/// #         .with_native_roots()
12533/// #         .unwrap()
12534/// #         .https_or_http()
12535/// #         .enable_http2()
12536/// #         .build()
12537/// # );
12538/// # let mut hub = Cloudchannel::new(client, auth);
12539/// // As the method needs a request, you would usually fill it with the desired information
12540/// // into the respective structure. Some of the parts shown here might not be applicable !
12541/// // Values shown here are possibly random and not representative !
12542/// let mut req = GoogleCloudChannelV1ChangeRenewalSettingsRequest::default();
12543///
12544/// // You can configure optional parameters by calling the respective setters at will, and
12545/// // execute the final call using `doit()`.
12546/// // Values shown here are possibly random and not representative !
12547/// let result = hub.accounts().customers_entitlements_change_renewal_settings(req, "name")
12548///              .doit().await;
12549/// # }
12550/// ```
12551pub struct AccountCustomerEntitlementChangeRenewalSettingCall<'a, C>
12552where
12553    C: 'a,
12554{
12555    hub: &'a Cloudchannel<C>,
12556    _request: GoogleCloudChannelV1ChangeRenewalSettingsRequest,
12557    _name: String,
12558    _delegate: Option<&'a mut dyn common::Delegate>,
12559    _additional_params: HashMap<String, String>,
12560    _scopes: BTreeSet<String>,
12561}
12562
12563impl<'a, C> common::CallBuilder for AccountCustomerEntitlementChangeRenewalSettingCall<'a, C> {}
12564
12565impl<'a, C> AccountCustomerEntitlementChangeRenewalSettingCall<'a, C>
12566where
12567    C: common::Connector,
12568{
12569    /// Perform the operation you have build so far.
12570    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
12571        use std::borrow::Cow;
12572        use std::io::{Read, Seek};
12573
12574        use common::{url::Params, ToParts};
12575        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12576
12577        let mut dd = common::DefaultDelegate;
12578        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12579        dlg.begin(common::MethodInfo {
12580            id: "cloudchannel.accounts.customers.entitlements.changeRenewalSettings",
12581            http_method: hyper::Method::POST,
12582        });
12583
12584        for &field in ["alt", "name"].iter() {
12585            if self._additional_params.contains_key(field) {
12586                dlg.finished(false);
12587                return Err(common::Error::FieldClash(field));
12588            }
12589        }
12590
12591        let mut params = Params::with_capacity(4 + self._additional_params.len());
12592        params.push("name", self._name);
12593
12594        params.extend(self._additional_params.iter());
12595
12596        params.push("alt", "json");
12597        let mut url = self.hub._base_url.clone() + "v1/{+name}:changeRenewalSettings";
12598        if self._scopes.is_empty() {
12599            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
12600        }
12601
12602        #[allow(clippy::single_element_loop)]
12603        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12604            url = params.uri_replacement(url, param_name, find_this, true);
12605        }
12606        {
12607            let to_remove = ["name"];
12608            params.remove_params(&to_remove);
12609        }
12610
12611        let url = params.parse_with_url(&url);
12612
12613        let mut json_mime_type = mime::APPLICATION_JSON;
12614        let mut request_value_reader = {
12615            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12616            common::remove_json_null_values(&mut value);
12617            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12618            serde_json::to_writer(&mut dst, &value).unwrap();
12619            dst
12620        };
12621        let request_size = request_value_reader
12622            .seek(std::io::SeekFrom::End(0))
12623            .unwrap();
12624        request_value_reader
12625            .seek(std::io::SeekFrom::Start(0))
12626            .unwrap();
12627
12628        loop {
12629            let token = match self
12630                .hub
12631                .auth
12632                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12633                .await
12634            {
12635                Ok(token) => token,
12636                Err(e) => match dlg.token(e) {
12637                    Ok(token) => token,
12638                    Err(e) => {
12639                        dlg.finished(false);
12640                        return Err(common::Error::MissingToken(e));
12641                    }
12642                },
12643            };
12644            request_value_reader
12645                .seek(std::io::SeekFrom::Start(0))
12646                .unwrap();
12647            let mut req_result = {
12648                let client = &self.hub.client;
12649                dlg.pre_request();
12650                let mut req_builder = hyper::Request::builder()
12651                    .method(hyper::Method::POST)
12652                    .uri(url.as_str())
12653                    .header(USER_AGENT, self.hub._user_agent.clone());
12654
12655                if let Some(token) = token.as_ref() {
12656                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12657                }
12658
12659                let request = req_builder
12660                    .header(CONTENT_TYPE, json_mime_type.to_string())
12661                    .header(CONTENT_LENGTH, request_size as u64)
12662                    .body(common::to_body(
12663                        request_value_reader.get_ref().clone().into(),
12664                    ));
12665
12666                client.request(request.unwrap()).await
12667            };
12668
12669            match req_result {
12670                Err(err) => {
12671                    if let common::Retry::After(d) = dlg.http_error(&err) {
12672                        sleep(d).await;
12673                        continue;
12674                    }
12675                    dlg.finished(false);
12676                    return Err(common::Error::HttpError(err));
12677                }
12678                Ok(res) => {
12679                    let (mut parts, body) = res.into_parts();
12680                    let mut body = common::Body::new(body);
12681                    if !parts.status.is_success() {
12682                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12683                        let error = serde_json::from_str(&common::to_string(&bytes));
12684                        let response = common::to_response(parts, bytes.into());
12685
12686                        if let common::Retry::After(d) =
12687                            dlg.http_failure(&response, error.as_ref().ok())
12688                        {
12689                            sleep(d).await;
12690                            continue;
12691                        }
12692
12693                        dlg.finished(false);
12694
12695                        return Err(match error {
12696                            Ok(value) => common::Error::BadRequest(value),
12697                            _ => common::Error::Failure(response),
12698                        });
12699                    }
12700                    let response = {
12701                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12702                        let encoded = common::to_string(&bytes);
12703                        match serde_json::from_str(&encoded) {
12704                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12705                            Err(error) => {
12706                                dlg.response_json_decode_error(&encoded, &error);
12707                                return Err(common::Error::JsonDecodeError(
12708                                    encoded.to_string(),
12709                                    error,
12710                                ));
12711                            }
12712                        }
12713                    };
12714
12715                    dlg.finished(true);
12716                    return Ok(response);
12717                }
12718            }
12719        }
12720    }
12721
12722    ///
12723    /// Sets the *request* property to the given value.
12724    ///
12725    /// Even though the property as already been set when instantiating this call,
12726    /// we provide this method for API completeness.
12727    pub fn request(
12728        mut self,
12729        new_value: GoogleCloudChannelV1ChangeRenewalSettingsRequest,
12730    ) -> AccountCustomerEntitlementChangeRenewalSettingCall<'a, C> {
12731        self._request = new_value;
12732        self
12733    }
12734    /// Required. The name of the entitlement to update. Name uses the format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
12735    ///
12736    /// Sets the *name* path property to the given value.
12737    ///
12738    /// Even though the property as already been set when instantiating this call,
12739    /// we provide this method for API completeness.
12740    pub fn name(
12741        mut self,
12742        new_value: &str,
12743    ) -> AccountCustomerEntitlementChangeRenewalSettingCall<'a, C> {
12744        self._name = new_value.to_string();
12745        self
12746    }
12747    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12748    /// while executing the actual API request.
12749    ///
12750    /// ````text
12751    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12752    /// ````
12753    ///
12754    /// Sets the *delegate* property to the given value.
12755    pub fn delegate(
12756        mut self,
12757        new_value: &'a mut dyn common::Delegate,
12758    ) -> AccountCustomerEntitlementChangeRenewalSettingCall<'a, C> {
12759        self._delegate = Some(new_value);
12760        self
12761    }
12762
12763    /// Set any additional parameter of the query string used in the request.
12764    /// It should be used to set parameters which are not yet available through their own
12765    /// setters.
12766    ///
12767    /// Please note that this method must not be used to set any of the known parameters
12768    /// which have their own setter method. If done anyway, the request will fail.
12769    ///
12770    /// # Additional Parameters
12771    ///
12772    /// * *$.xgafv* (query-string) - V1 error format.
12773    /// * *access_token* (query-string) - OAuth access token.
12774    /// * *alt* (query-string) - Data format for response.
12775    /// * *callback* (query-string) - JSONP
12776    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12777    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12778    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12779    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12780    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12781    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12782    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12783    pub fn param<T>(
12784        mut self,
12785        name: T,
12786        value: T,
12787    ) -> AccountCustomerEntitlementChangeRenewalSettingCall<'a, C>
12788    where
12789        T: AsRef<str>,
12790    {
12791        self._additional_params
12792            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12793        self
12794    }
12795
12796    /// Identifies the authorization scope for the method you are building.
12797    ///
12798    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12799    /// [`Scope::AppOrder`].
12800    ///
12801    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12802    /// tokens for more than one scope.
12803    ///
12804    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12805    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12806    /// sufficient, a read-write scope will do as well.
12807    pub fn add_scope<St>(
12808        mut self,
12809        scope: St,
12810    ) -> AccountCustomerEntitlementChangeRenewalSettingCall<'a, C>
12811    where
12812        St: AsRef<str>,
12813    {
12814        self._scopes.insert(String::from(scope.as_ref()));
12815        self
12816    }
12817    /// Identifies the authorization scope(s) for the method you are building.
12818    ///
12819    /// See [`Self::add_scope()`] for details.
12820    pub fn add_scopes<I, St>(
12821        mut self,
12822        scopes: I,
12823    ) -> AccountCustomerEntitlementChangeRenewalSettingCall<'a, C>
12824    where
12825        I: IntoIterator<Item = St>,
12826        St: AsRef<str>,
12827    {
12828        self._scopes
12829            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12830        self
12831    }
12832
12833    /// Removes all scopes, and no default scope will be used either.
12834    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12835    /// for details).
12836    pub fn clear_scopes(mut self) -> AccountCustomerEntitlementChangeRenewalSettingCall<'a, C> {
12837        self._scopes.clear();
12838        self
12839    }
12840}
12841
12842/// Creates an entitlement for a customer. Possible error codes: * PERMISSION_DENIED: * The customer doesn't belong to the reseller. * The reseller is not authorized to transact on this Product. See https://support.google.com/channelservices/answer/9759265 * INVALID_ARGUMENT: * Required request parameters are missing or invalid. * There is already a customer entitlement for a SKU from the same product family. * INVALID_VALUE: Make sure the OfferId is valid. If it is, contact Google Channel support for further troubleshooting. * NOT_FOUND: The customer or offer resource was not found. * ALREADY_EXISTS: * The SKU was already purchased for the customer. * The customer's primary email already exists. Retry after changing the customer's primary contact email. * CONDITION_NOT_MET or FAILED_PRECONDITION: * The domain required for purchasing a SKU has not been verified. * A pre-requisite SKU required to purchase an Add-On SKU is missing. For example, Google Workspace Business Starter is required to purchase Vault or Drive. * (Developer accounts only) Reseller and resold domain must meet the following naming requirements: * Domain names must start with goog-test. * Domain names must include the reseller domain. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata will contain an instance of OperationMetadata.
12843///
12844/// A builder for the *customers.entitlements.create* method supported by a *account* resource.
12845/// It is not used directly, but through a [`AccountMethods`] instance.
12846///
12847/// # Example
12848///
12849/// Instantiate a resource method builder
12850///
12851/// ```test_harness,no_run
12852/// # extern crate hyper;
12853/// # extern crate hyper_rustls;
12854/// # extern crate google_cloudchannel1 as cloudchannel1;
12855/// use cloudchannel1::api::GoogleCloudChannelV1CreateEntitlementRequest;
12856/// # async fn dox() {
12857/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12858///
12859/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12860/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12861/// #     .with_native_roots()
12862/// #     .unwrap()
12863/// #     .https_only()
12864/// #     .enable_http2()
12865/// #     .build();
12866///
12867/// # let executor = hyper_util::rt::TokioExecutor::new();
12868/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12869/// #     secret,
12870/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12871/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12872/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12873/// #     ),
12874/// # ).build().await.unwrap();
12875///
12876/// # let client = hyper_util::client::legacy::Client::builder(
12877/// #     hyper_util::rt::TokioExecutor::new()
12878/// # )
12879/// # .build(
12880/// #     hyper_rustls::HttpsConnectorBuilder::new()
12881/// #         .with_native_roots()
12882/// #         .unwrap()
12883/// #         .https_or_http()
12884/// #         .enable_http2()
12885/// #         .build()
12886/// # );
12887/// # let mut hub = Cloudchannel::new(client, auth);
12888/// // As the method needs a request, you would usually fill it with the desired information
12889/// // into the respective structure. Some of the parts shown here might not be applicable !
12890/// // Values shown here are possibly random and not representative !
12891/// let mut req = GoogleCloudChannelV1CreateEntitlementRequest::default();
12892///
12893/// // You can configure optional parameters by calling the respective setters at will, and
12894/// // execute the final call using `doit()`.
12895/// // Values shown here are possibly random and not representative !
12896/// let result = hub.accounts().customers_entitlements_create(req, "parent")
12897///              .doit().await;
12898/// # }
12899/// ```
12900pub struct AccountCustomerEntitlementCreateCall<'a, C>
12901where
12902    C: 'a,
12903{
12904    hub: &'a Cloudchannel<C>,
12905    _request: GoogleCloudChannelV1CreateEntitlementRequest,
12906    _parent: String,
12907    _delegate: Option<&'a mut dyn common::Delegate>,
12908    _additional_params: HashMap<String, String>,
12909    _scopes: BTreeSet<String>,
12910}
12911
12912impl<'a, C> common::CallBuilder for AccountCustomerEntitlementCreateCall<'a, C> {}
12913
12914impl<'a, C> AccountCustomerEntitlementCreateCall<'a, C>
12915where
12916    C: common::Connector,
12917{
12918    /// Perform the operation you have build so far.
12919    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
12920        use std::borrow::Cow;
12921        use std::io::{Read, Seek};
12922
12923        use common::{url::Params, ToParts};
12924        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12925
12926        let mut dd = common::DefaultDelegate;
12927        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12928        dlg.begin(common::MethodInfo {
12929            id: "cloudchannel.accounts.customers.entitlements.create",
12930            http_method: hyper::Method::POST,
12931        });
12932
12933        for &field in ["alt", "parent"].iter() {
12934            if self._additional_params.contains_key(field) {
12935                dlg.finished(false);
12936                return Err(common::Error::FieldClash(field));
12937            }
12938        }
12939
12940        let mut params = Params::with_capacity(4 + self._additional_params.len());
12941        params.push("parent", self._parent);
12942
12943        params.extend(self._additional_params.iter());
12944
12945        params.push("alt", "json");
12946        let mut url = self.hub._base_url.clone() + "v1/{+parent}/entitlements";
12947        if self._scopes.is_empty() {
12948            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
12949        }
12950
12951        #[allow(clippy::single_element_loop)]
12952        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12953            url = params.uri_replacement(url, param_name, find_this, true);
12954        }
12955        {
12956            let to_remove = ["parent"];
12957            params.remove_params(&to_remove);
12958        }
12959
12960        let url = params.parse_with_url(&url);
12961
12962        let mut json_mime_type = mime::APPLICATION_JSON;
12963        let mut request_value_reader = {
12964            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12965            common::remove_json_null_values(&mut value);
12966            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12967            serde_json::to_writer(&mut dst, &value).unwrap();
12968            dst
12969        };
12970        let request_size = request_value_reader
12971            .seek(std::io::SeekFrom::End(0))
12972            .unwrap();
12973        request_value_reader
12974            .seek(std::io::SeekFrom::Start(0))
12975            .unwrap();
12976
12977        loop {
12978            let token = match self
12979                .hub
12980                .auth
12981                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12982                .await
12983            {
12984                Ok(token) => token,
12985                Err(e) => match dlg.token(e) {
12986                    Ok(token) => token,
12987                    Err(e) => {
12988                        dlg.finished(false);
12989                        return Err(common::Error::MissingToken(e));
12990                    }
12991                },
12992            };
12993            request_value_reader
12994                .seek(std::io::SeekFrom::Start(0))
12995                .unwrap();
12996            let mut req_result = {
12997                let client = &self.hub.client;
12998                dlg.pre_request();
12999                let mut req_builder = hyper::Request::builder()
13000                    .method(hyper::Method::POST)
13001                    .uri(url.as_str())
13002                    .header(USER_AGENT, self.hub._user_agent.clone());
13003
13004                if let Some(token) = token.as_ref() {
13005                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13006                }
13007
13008                let request = req_builder
13009                    .header(CONTENT_TYPE, json_mime_type.to_string())
13010                    .header(CONTENT_LENGTH, request_size as u64)
13011                    .body(common::to_body(
13012                        request_value_reader.get_ref().clone().into(),
13013                    ));
13014
13015                client.request(request.unwrap()).await
13016            };
13017
13018            match req_result {
13019                Err(err) => {
13020                    if let common::Retry::After(d) = dlg.http_error(&err) {
13021                        sleep(d).await;
13022                        continue;
13023                    }
13024                    dlg.finished(false);
13025                    return Err(common::Error::HttpError(err));
13026                }
13027                Ok(res) => {
13028                    let (mut parts, body) = res.into_parts();
13029                    let mut body = common::Body::new(body);
13030                    if !parts.status.is_success() {
13031                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13032                        let error = serde_json::from_str(&common::to_string(&bytes));
13033                        let response = common::to_response(parts, bytes.into());
13034
13035                        if let common::Retry::After(d) =
13036                            dlg.http_failure(&response, error.as_ref().ok())
13037                        {
13038                            sleep(d).await;
13039                            continue;
13040                        }
13041
13042                        dlg.finished(false);
13043
13044                        return Err(match error {
13045                            Ok(value) => common::Error::BadRequest(value),
13046                            _ => common::Error::Failure(response),
13047                        });
13048                    }
13049                    let response = {
13050                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13051                        let encoded = common::to_string(&bytes);
13052                        match serde_json::from_str(&encoded) {
13053                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13054                            Err(error) => {
13055                                dlg.response_json_decode_error(&encoded, &error);
13056                                return Err(common::Error::JsonDecodeError(
13057                                    encoded.to_string(),
13058                                    error,
13059                                ));
13060                            }
13061                        }
13062                    };
13063
13064                    dlg.finished(true);
13065                    return Ok(response);
13066                }
13067            }
13068        }
13069    }
13070
13071    ///
13072    /// Sets the *request* property to the given value.
13073    ///
13074    /// Even though the property as already been set when instantiating this call,
13075    /// we provide this method for API completeness.
13076    pub fn request(
13077        mut self,
13078        new_value: GoogleCloudChannelV1CreateEntitlementRequest,
13079    ) -> AccountCustomerEntitlementCreateCall<'a, C> {
13080        self._request = new_value;
13081        self
13082    }
13083    /// Required. The resource name of the reseller's customer account in which to create the entitlement. Parent uses the format: accounts/{account_id}/customers/{customer_id}
13084    ///
13085    /// Sets the *parent* path property to the given value.
13086    ///
13087    /// Even though the property as already been set when instantiating this call,
13088    /// we provide this method for API completeness.
13089    pub fn parent(mut self, new_value: &str) -> AccountCustomerEntitlementCreateCall<'a, C> {
13090        self._parent = new_value.to_string();
13091        self
13092    }
13093    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13094    /// while executing the actual API request.
13095    ///
13096    /// ````text
13097    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13098    /// ````
13099    ///
13100    /// Sets the *delegate* property to the given value.
13101    pub fn delegate(
13102        mut self,
13103        new_value: &'a mut dyn common::Delegate,
13104    ) -> AccountCustomerEntitlementCreateCall<'a, C> {
13105        self._delegate = Some(new_value);
13106        self
13107    }
13108
13109    /// Set any additional parameter of the query string used in the request.
13110    /// It should be used to set parameters which are not yet available through their own
13111    /// setters.
13112    ///
13113    /// Please note that this method must not be used to set any of the known parameters
13114    /// which have their own setter method. If done anyway, the request will fail.
13115    ///
13116    /// # Additional Parameters
13117    ///
13118    /// * *$.xgafv* (query-string) - V1 error format.
13119    /// * *access_token* (query-string) - OAuth access token.
13120    /// * *alt* (query-string) - Data format for response.
13121    /// * *callback* (query-string) - JSONP
13122    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13123    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13124    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13125    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13126    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13127    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13128    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13129    pub fn param<T>(mut self, name: T, value: T) -> AccountCustomerEntitlementCreateCall<'a, C>
13130    where
13131        T: AsRef<str>,
13132    {
13133        self._additional_params
13134            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13135        self
13136    }
13137
13138    /// Identifies the authorization scope for the method you are building.
13139    ///
13140    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13141    /// [`Scope::AppOrder`].
13142    ///
13143    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13144    /// tokens for more than one scope.
13145    ///
13146    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13147    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13148    /// sufficient, a read-write scope will do as well.
13149    pub fn add_scope<St>(mut self, scope: St) -> AccountCustomerEntitlementCreateCall<'a, C>
13150    where
13151        St: AsRef<str>,
13152    {
13153        self._scopes.insert(String::from(scope.as_ref()));
13154        self
13155    }
13156    /// Identifies the authorization scope(s) for the method you are building.
13157    ///
13158    /// See [`Self::add_scope()`] for details.
13159    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountCustomerEntitlementCreateCall<'a, C>
13160    where
13161        I: IntoIterator<Item = St>,
13162        St: AsRef<str>,
13163    {
13164        self._scopes
13165            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13166        self
13167    }
13168
13169    /// Removes all scopes, and no default scope will be used either.
13170    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13171    /// for details).
13172    pub fn clear_scopes(mut self) -> AccountCustomerEntitlementCreateCall<'a, C> {
13173        self._scopes.clear();
13174        self
13175    }
13176}
13177
13178/// Returns the requested Entitlement resource. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The customer entitlement was not found. Return value: The requested Entitlement resource.
13179///
13180/// A builder for the *customers.entitlements.get* method supported by a *account* resource.
13181/// It is not used directly, but through a [`AccountMethods`] instance.
13182///
13183/// # Example
13184///
13185/// Instantiate a resource method builder
13186///
13187/// ```test_harness,no_run
13188/// # extern crate hyper;
13189/// # extern crate hyper_rustls;
13190/// # extern crate google_cloudchannel1 as cloudchannel1;
13191/// # async fn dox() {
13192/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13193///
13194/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13195/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13196/// #     .with_native_roots()
13197/// #     .unwrap()
13198/// #     .https_only()
13199/// #     .enable_http2()
13200/// #     .build();
13201///
13202/// # let executor = hyper_util::rt::TokioExecutor::new();
13203/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13204/// #     secret,
13205/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13206/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13207/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13208/// #     ),
13209/// # ).build().await.unwrap();
13210///
13211/// # let client = hyper_util::client::legacy::Client::builder(
13212/// #     hyper_util::rt::TokioExecutor::new()
13213/// # )
13214/// # .build(
13215/// #     hyper_rustls::HttpsConnectorBuilder::new()
13216/// #         .with_native_roots()
13217/// #         .unwrap()
13218/// #         .https_or_http()
13219/// #         .enable_http2()
13220/// #         .build()
13221/// # );
13222/// # let mut hub = Cloudchannel::new(client, auth);
13223/// // You can configure optional parameters by calling the respective setters at will, and
13224/// // execute the final call using `doit()`.
13225/// // Values shown here are possibly random and not representative !
13226/// let result = hub.accounts().customers_entitlements_get("name")
13227///              .doit().await;
13228/// # }
13229/// ```
13230pub struct AccountCustomerEntitlementGetCall<'a, C>
13231where
13232    C: 'a,
13233{
13234    hub: &'a Cloudchannel<C>,
13235    _name: String,
13236    _delegate: Option<&'a mut dyn common::Delegate>,
13237    _additional_params: HashMap<String, String>,
13238    _scopes: BTreeSet<String>,
13239}
13240
13241impl<'a, C> common::CallBuilder for AccountCustomerEntitlementGetCall<'a, C> {}
13242
13243impl<'a, C> AccountCustomerEntitlementGetCall<'a, C>
13244where
13245    C: common::Connector,
13246{
13247    /// Perform the operation you have build so far.
13248    pub async fn doit(
13249        mut self,
13250    ) -> common::Result<(common::Response, GoogleCloudChannelV1Entitlement)> {
13251        use std::borrow::Cow;
13252        use std::io::{Read, Seek};
13253
13254        use common::{url::Params, ToParts};
13255        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13256
13257        let mut dd = common::DefaultDelegate;
13258        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13259        dlg.begin(common::MethodInfo {
13260            id: "cloudchannel.accounts.customers.entitlements.get",
13261            http_method: hyper::Method::GET,
13262        });
13263
13264        for &field in ["alt", "name"].iter() {
13265            if self._additional_params.contains_key(field) {
13266                dlg.finished(false);
13267                return Err(common::Error::FieldClash(field));
13268            }
13269        }
13270
13271        let mut params = Params::with_capacity(3 + self._additional_params.len());
13272        params.push("name", self._name);
13273
13274        params.extend(self._additional_params.iter());
13275
13276        params.push("alt", "json");
13277        let mut url = self.hub._base_url.clone() + "v1/{+name}";
13278        if self._scopes.is_empty() {
13279            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
13280        }
13281
13282        #[allow(clippy::single_element_loop)]
13283        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13284            url = params.uri_replacement(url, param_name, find_this, true);
13285        }
13286        {
13287            let to_remove = ["name"];
13288            params.remove_params(&to_remove);
13289        }
13290
13291        let url = params.parse_with_url(&url);
13292
13293        loop {
13294            let token = match self
13295                .hub
13296                .auth
13297                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13298                .await
13299            {
13300                Ok(token) => token,
13301                Err(e) => match dlg.token(e) {
13302                    Ok(token) => token,
13303                    Err(e) => {
13304                        dlg.finished(false);
13305                        return Err(common::Error::MissingToken(e));
13306                    }
13307                },
13308            };
13309            let mut req_result = {
13310                let client = &self.hub.client;
13311                dlg.pre_request();
13312                let mut req_builder = hyper::Request::builder()
13313                    .method(hyper::Method::GET)
13314                    .uri(url.as_str())
13315                    .header(USER_AGENT, self.hub._user_agent.clone());
13316
13317                if let Some(token) = token.as_ref() {
13318                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13319                }
13320
13321                let request = req_builder
13322                    .header(CONTENT_LENGTH, 0_u64)
13323                    .body(common::to_body::<String>(None));
13324
13325                client.request(request.unwrap()).await
13326            };
13327
13328            match req_result {
13329                Err(err) => {
13330                    if let common::Retry::After(d) = dlg.http_error(&err) {
13331                        sleep(d).await;
13332                        continue;
13333                    }
13334                    dlg.finished(false);
13335                    return Err(common::Error::HttpError(err));
13336                }
13337                Ok(res) => {
13338                    let (mut parts, body) = res.into_parts();
13339                    let mut body = common::Body::new(body);
13340                    if !parts.status.is_success() {
13341                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13342                        let error = serde_json::from_str(&common::to_string(&bytes));
13343                        let response = common::to_response(parts, bytes.into());
13344
13345                        if let common::Retry::After(d) =
13346                            dlg.http_failure(&response, error.as_ref().ok())
13347                        {
13348                            sleep(d).await;
13349                            continue;
13350                        }
13351
13352                        dlg.finished(false);
13353
13354                        return Err(match error {
13355                            Ok(value) => common::Error::BadRequest(value),
13356                            _ => common::Error::Failure(response),
13357                        });
13358                    }
13359                    let response = {
13360                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13361                        let encoded = common::to_string(&bytes);
13362                        match serde_json::from_str(&encoded) {
13363                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13364                            Err(error) => {
13365                                dlg.response_json_decode_error(&encoded, &error);
13366                                return Err(common::Error::JsonDecodeError(
13367                                    encoded.to_string(),
13368                                    error,
13369                                ));
13370                            }
13371                        }
13372                    };
13373
13374                    dlg.finished(true);
13375                    return Ok(response);
13376                }
13377            }
13378        }
13379    }
13380
13381    /// Required. The resource name of the entitlement to retrieve. Name uses the format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
13382    ///
13383    /// Sets the *name* path property to the given value.
13384    ///
13385    /// Even though the property as already been set when instantiating this call,
13386    /// we provide this method for API completeness.
13387    pub fn name(mut self, new_value: &str) -> AccountCustomerEntitlementGetCall<'a, C> {
13388        self._name = new_value.to_string();
13389        self
13390    }
13391    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13392    /// while executing the actual API request.
13393    ///
13394    /// ````text
13395    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13396    /// ````
13397    ///
13398    /// Sets the *delegate* property to the given value.
13399    pub fn delegate(
13400        mut self,
13401        new_value: &'a mut dyn common::Delegate,
13402    ) -> AccountCustomerEntitlementGetCall<'a, C> {
13403        self._delegate = Some(new_value);
13404        self
13405    }
13406
13407    /// Set any additional parameter of the query string used in the request.
13408    /// It should be used to set parameters which are not yet available through their own
13409    /// setters.
13410    ///
13411    /// Please note that this method must not be used to set any of the known parameters
13412    /// which have their own setter method. If done anyway, the request will fail.
13413    ///
13414    /// # Additional Parameters
13415    ///
13416    /// * *$.xgafv* (query-string) - V1 error format.
13417    /// * *access_token* (query-string) - OAuth access token.
13418    /// * *alt* (query-string) - Data format for response.
13419    /// * *callback* (query-string) - JSONP
13420    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13421    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13422    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13423    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13424    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13425    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13426    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13427    pub fn param<T>(mut self, name: T, value: T) -> AccountCustomerEntitlementGetCall<'a, C>
13428    where
13429        T: AsRef<str>,
13430    {
13431        self._additional_params
13432            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13433        self
13434    }
13435
13436    /// Identifies the authorization scope for the method you are building.
13437    ///
13438    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13439    /// [`Scope::AppOrder`].
13440    ///
13441    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13442    /// tokens for more than one scope.
13443    ///
13444    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13445    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13446    /// sufficient, a read-write scope will do as well.
13447    pub fn add_scope<St>(mut self, scope: St) -> AccountCustomerEntitlementGetCall<'a, C>
13448    where
13449        St: AsRef<str>,
13450    {
13451        self._scopes.insert(String::from(scope.as_ref()));
13452        self
13453    }
13454    /// Identifies the authorization scope(s) for the method you are building.
13455    ///
13456    /// See [`Self::add_scope()`] for details.
13457    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountCustomerEntitlementGetCall<'a, C>
13458    where
13459        I: IntoIterator<Item = St>,
13460        St: AsRef<str>,
13461    {
13462        self._scopes
13463            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13464        self
13465    }
13466
13467    /// Removes all scopes, and no default scope will be used either.
13468    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13469    /// for details).
13470    pub fn clear_scopes(mut self) -> AccountCustomerEntitlementGetCall<'a, C> {
13471        self._scopes.clear();
13472        self
13473    }
13474}
13475
13476/// Lists Entitlements belonging to a customer. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. Return value: A list of the customer's Entitlements.
13477///
13478/// A builder for the *customers.entitlements.list* method supported by a *account* resource.
13479/// It is not used directly, but through a [`AccountMethods`] instance.
13480///
13481/// # Example
13482///
13483/// Instantiate a resource method builder
13484///
13485/// ```test_harness,no_run
13486/// # extern crate hyper;
13487/// # extern crate hyper_rustls;
13488/// # extern crate google_cloudchannel1 as cloudchannel1;
13489/// # async fn dox() {
13490/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13491///
13492/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13493/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13494/// #     .with_native_roots()
13495/// #     .unwrap()
13496/// #     .https_only()
13497/// #     .enable_http2()
13498/// #     .build();
13499///
13500/// # let executor = hyper_util::rt::TokioExecutor::new();
13501/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13502/// #     secret,
13503/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13504/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13505/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13506/// #     ),
13507/// # ).build().await.unwrap();
13508///
13509/// # let client = hyper_util::client::legacy::Client::builder(
13510/// #     hyper_util::rt::TokioExecutor::new()
13511/// # )
13512/// # .build(
13513/// #     hyper_rustls::HttpsConnectorBuilder::new()
13514/// #         .with_native_roots()
13515/// #         .unwrap()
13516/// #         .https_or_http()
13517/// #         .enable_http2()
13518/// #         .build()
13519/// # );
13520/// # let mut hub = Cloudchannel::new(client, auth);
13521/// // You can configure optional parameters by calling the respective setters at will, and
13522/// // execute the final call using `doit()`.
13523/// // Values shown here are possibly random and not representative !
13524/// let result = hub.accounts().customers_entitlements_list("parent")
13525///              .page_token("et")
13526///              .page_size(-43)
13527///              .doit().await;
13528/// # }
13529/// ```
13530pub struct AccountCustomerEntitlementListCall<'a, C>
13531where
13532    C: 'a,
13533{
13534    hub: &'a Cloudchannel<C>,
13535    _parent: String,
13536    _page_token: Option<String>,
13537    _page_size: Option<i32>,
13538    _delegate: Option<&'a mut dyn common::Delegate>,
13539    _additional_params: HashMap<String, String>,
13540    _scopes: BTreeSet<String>,
13541}
13542
13543impl<'a, C> common::CallBuilder for AccountCustomerEntitlementListCall<'a, C> {}
13544
13545impl<'a, C> AccountCustomerEntitlementListCall<'a, C>
13546where
13547    C: common::Connector,
13548{
13549    /// Perform the operation you have build so far.
13550    pub async fn doit(
13551        mut self,
13552    ) -> common::Result<(
13553        common::Response,
13554        GoogleCloudChannelV1ListEntitlementsResponse,
13555    )> {
13556        use std::borrow::Cow;
13557        use std::io::{Read, Seek};
13558
13559        use common::{url::Params, ToParts};
13560        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13561
13562        let mut dd = common::DefaultDelegate;
13563        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13564        dlg.begin(common::MethodInfo {
13565            id: "cloudchannel.accounts.customers.entitlements.list",
13566            http_method: hyper::Method::GET,
13567        });
13568
13569        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
13570            if self._additional_params.contains_key(field) {
13571                dlg.finished(false);
13572                return Err(common::Error::FieldClash(field));
13573            }
13574        }
13575
13576        let mut params = Params::with_capacity(5 + self._additional_params.len());
13577        params.push("parent", self._parent);
13578        if let Some(value) = self._page_token.as_ref() {
13579            params.push("pageToken", value);
13580        }
13581        if let Some(value) = self._page_size.as_ref() {
13582            params.push("pageSize", value.to_string());
13583        }
13584
13585        params.extend(self._additional_params.iter());
13586
13587        params.push("alt", "json");
13588        let mut url = self.hub._base_url.clone() + "v1/{+parent}/entitlements";
13589        if self._scopes.is_empty() {
13590            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
13591        }
13592
13593        #[allow(clippy::single_element_loop)]
13594        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13595            url = params.uri_replacement(url, param_name, find_this, true);
13596        }
13597        {
13598            let to_remove = ["parent"];
13599            params.remove_params(&to_remove);
13600        }
13601
13602        let url = params.parse_with_url(&url);
13603
13604        loop {
13605            let token = match self
13606                .hub
13607                .auth
13608                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13609                .await
13610            {
13611                Ok(token) => token,
13612                Err(e) => match dlg.token(e) {
13613                    Ok(token) => token,
13614                    Err(e) => {
13615                        dlg.finished(false);
13616                        return Err(common::Error::MissingToken(e));
13617                    }
13618                },
13619            };
13620            let mut req_result = {
13621                let client = &self.hub.client;
13622                dlg.pre_request();
13623                let mut req_builder = hyper::Request::builder()
13624                    .method(hyper::Method::GET)
13625                    .uri(url.as_str())
13626                    .header(USER_AGENT, self.hub._user_agent.clone());
13627
13628                if let Some(token) = token.as_ref() {
13629                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13630                }
13631
13632                let request = req_builder
13633                    .header(CONTENT_LENGTH, 0_u64)
13634                    .body(common::to_body::<String>(None));
13635
13636                client.request(request.unwrap()).await
13637            };
13638
13639            match req_result {
13640                Err(err) => {
13641                    if let common::Retry::After(d) = dlg.http_error(&err) {
13642                        sleep(d).await;
13643                        continue;
13644                    }
13645                    dlg.finished(false);
13646                    return Err(common::Error::HttpError(err));
13647                }
13648                Ok(res) => {
13649                    let (mut parts, body) = res.into_parts();
13650                    let mut body = common::Body::new(body);
13651                    if !parts.status.is_success() {
13652                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13653                        let error = serde_json::from_str(&common::to_string(&bytes));
13654                        let response = common::to_response(parts, bytes.into());
13655
13656                        if let common::Retry::After(d) =
13657                            dlg.http_failure(&response, error.as_ref().ok())
13658                        {
13659                            sleep(d).await;
13660                            continue;
13661                        }
13662
13663                        dlg.finished(false);
13664
13665                        return Err(match error {
13666                            Ok(value) => common::Error::BadRequest(value),
13667                            _ => common::Error::Failure(response),
13668                        });
13669                    }
13670                    let response = {
13671                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13672                        let encoded = common::to_string(&bytes);
13673                        match serde_json::from_str(&encoded) {
13674                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13675                            Err(error) => {
13676                                dlg.response_json_decode_error(&encoded, &error);
13677                                return Err(common::Error::JsonDecodeError(
13678                                    encoded.to_string(),
13679                                    error,
13680                                ));
13681                            }
13682                        }
13683                    };
13684
13685                    dlg.finished(true);
13686                    return Ok(response);
13687                }
13688            }
13689        }
13690    }
13691
13692    /// Required. The resource name of the reseller's customer account to list entitlements for. Parent uses the format: accounts/{account_id}/customers/{customer_id}
13693    ///
13694    /// Sets the *parent* path property to the given value.
13695    ///
13696    /// Even though the property as already been set when instantiating this call,
13697    /// we provide this method for API completeness.
13698    pub fn parent(mut self, new_value: &str) -> AccountCustomerEntitlementListCall<'a, C> {
13699        self._parent = new_value.to_string();
13700        self
13701    }
13702    /// Optional. A token for a page of results other than the first page. Obtained using ListEntitlementsResponse.next_page_token of the previous CloudChannelService.ListEntitlements call.
13703    ///
13704    /// Sets the *page token* query property to the given value.
13705    pub fn page_token(mut self, new_value: &str) -> AccountCustomerEntitlementListCall<'a, C> {
13706        self._page_token = Some(new_value.to_string());
13707        self
13708    }
13709    /// Optional. Requested page size. Server might return fewer results than requested. If unspecified, return at most 50 entitlements. The maximum value is 100; the server will coerce values above 100.
13710    ///
13711    /// Sets the *page size* query property to the given value.
13712    pub fn page_size(mut self, new_value: i32) -> AccountCustomerEntitlementListCall<'a, C> {
13713        self._page_size = Some(new_value);
13714        self
13715    }
13716    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13717    /// while executing the actual API request.
13718    ///
13719    /// ````text
13720    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13721    /// ````
13722    ///
13723    /// Sets the *delegate* property to the given value.
13724    pub fn delegate(
13725        mut self,
13726        new_value: &'a mut dyn common::Delegate,
13727    ) -> AccountCustomerEntitlementListCall<'a, C> {
13728        self._delegate = Some(new_value);
13729        self
13730    }
13731
13732    /// Set any additional parameter of the query string used in the request.
13733    /// It should be used to set parameters which are not yet available through their own
13734    /// setters.
13735    ///
13736    /// Please note that this method must not be used to set any of the known parameters
13737    /// which have their own setter method. If done anyway, the request will fail.
13738    ///
13739    /// # Additional Parameters
13740    ///
13741    /// * *$.xgafv* (query-string) - V1 error format.
13742    /// * *access_token* (query-string) - OAuth access token.
13743    /// * *alt* (query-string) - Data format for response.
13744    /// * *callback* (query-string) - JSONP
13745    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13746    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13747    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13748    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13749    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13750    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13751    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13752    pub fn param<T>(mut self, name: T, value: T) -> AccountCustomerEntitlementListCall<'a, C>
13753    where
13754        T: AsRef<str>,
13755    {
13756        self._additional_params
13757            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13758        self
13759    }
13760
13761    /// Identifies the authorization scope for the method you are building.
13762    ///
13763    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13764    /// [`Scope::AppOrder`].
13765    ///
13766    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13767    /// tokens for more than one scope.
13768    ///
13769    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13770    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13771    /// sufficient, a read-write scope will do as well.
13772    pub fn add_scope<St>(mut self, scope: St) -> AccountCustomerEntitlementListCall<'a, C>
13773    where
13774        St: AsRef<str>,
13775    {
13776        self._scopes.insert(String::from(scope.as_ref()));
13777        self
13778    }
13779    /// Identifies the authorization scope(s) for the method you are building.
13780    ///
13781    /// See [`Self::add_scope()`] for details.
13782    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountCustomerEntitlementListCall<'a, C>
13783    where
13784        I: IntoIterator<Item = St>,
13785        St: AsRef<str>,
13786    {
13787        self._scopes
13788            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13789        self
13790    }
13791
13792    /// Removes all scopes, and no default scope will be used either.
13793    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13794    /// for details).
13795    pub fn clear_scopes(mut self) -> AccountCustomerEntitlementListCall<'a, C> {
13796        self._scopes.clear();
13797        self
13798    }
13799}
13800
13801/// List entitlement history. Possible error codes: * PERMISSION_DENIED: The reseller account making the request and the provided reseller account are different. * INVALID_ARGUMENT: Missing or invalid required fields in the request. * NOT_FOUND: The parent resource doesn't exist. Usually the result of an invalid name parameter. * INTERNAL: Any non-user error related to a technical issue in the backend. In this case, contact CloudChannel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. In this case, contact Cloud Channel support. Return value: List of EntitlementChanges.
13802///
13803/// A builder for the *customers.entitlements.listEntitlementChanges* method supported by a *account* resource.
13804/// It is not used directly, but through a [`AccountMethods`] instance.
13805///
13806/// # Example
13807///
13808/// Instantiate a resource method builder
13809///
13810/// ```test_harness,no_run
13811/// # extern crate hyper;
13812/// # extern crate hyper_rustls;
13813/// # extern crate google_cloudchannel1 as cloudchannel1;
13814/// # async fn dox() {
13815/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13816///
13817/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13818/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13819/// #     .with_native_roots()
13820/// #     .unwrap()
13821/// #     .https_only()
13822/// #     .enable_http2()
13823/// #     .build();
13824///
13825/// # let executor = hyper_util::rt::TokioExecutor::new();
13826/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13827/// #     secret,
13828/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13829/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13830/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13831/// #     ),
13832/// # ).build().await.unwrap();
13833///
13834/// # let client = hyper_util::client::legacy::Client::builder(
13835/// #     hyper_util::rt::TokioExecutor::new()
13836/// # )
13837/// # .build(
13838/// #     hyper_rustls::HttpsConnectorBuilder::new()
13839/// #         .with_native_roots()
13840/// #         .unwrap()
13841/// #         .https_or_http()
13842/// #         .enable_http2()
13843/// #         .build()
13844/// # );
13845/// # let mut hub = Cloudchannel::new(client, auth);
13846/// // You can configure optional parameters by calling the respective setters at will, and
13847/// // execute the final call using `doit()`.
13848/// // Values shown here are possibly random and not representative !
13849/// let result = hub.accounts().customers_entitlements_list_entitlement_changes("parent")
13850///              .page_token("et")
13851///              .page_size(-76)
13852///              .filter("erat")
13853///              .doit().await;
13854/// # }
13855/// ```
13856pub struct AccountCustomerEntitlementListEntitlementChangeCall<'a, C>
13857where
13858    C: 'a,
13859{
13860    hub: &'a Cloudchannel<C>,
13861    _parent: String,
13862    _page_token: Option<String>,
13863    _page_size: Option<i32>,
13864    _filter: Option<String>,
13865    _delegate: Option<&'a mut dyn common::Delegate>,
13866    _additional_params: HashMap<String, String>,
13867    _scopes: BTreeSet<String>,
13868}
13869
13870impl<'a, C> common::CallBuilder for AccountCustomerEntitlementListEntitlementChangeCall<'a, C> {}
13871
13872impl<'a, C> AccountCustomerEntitlementListEntitlementChangeCall<'a, C>
13873where
13874    C: common::Connector,
13875{
13876    /// Perform the operation you have build so far.
13877    pub async fn doit(
13878        mut self,
13879    ) -> common::Result<(
13880        common::Response,
13881        GoogleCloudChannelV1ListEntitlementChangesResponse,
13882    )> {
13883        use std::borrow::Cow;
13884        use std::io::{Read, Seek};
13885
13886        use common::{url::Params, ToParts};
13887        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13888
13889        let mut dd = common::DefaultDelegate;
13890        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13891        dlg.begin(common::MethodInfo {
13892            id: "cloudchannel.accounts.customers.entitlements.listEntitlementChanges",
13893            http_method: hyper::Method::GET,
13894        });
13895
13896        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
13897            if self._additional_params.contains_key(field) {
13898                dlg.finished(false);
13899                return Err(common::Error::FieldClash(field));
13900            }
13901        }
13902
13903        let mut params = Params::with_capacity(6 + self._additional_params.len());
13904        params.push("parent", self._parent);
13905        if let Some(value) = self._page_token.as_ref() {
13906            params.push("pageToken", value);
13907        }
13908        if let Some(value) = self._page_size.as_ref() {
13909            params.push("pageSize", value.to_string());
13910        }
13911        if let Some(value) = self._filter.as_ref() {
13912            params.push("filter", value);
13913        }
13914
13915        params.extend(self._additional_params.iter());
13916
13917        params.push("alt", "json");
13918        let mut url = self.hub._base_url.clone() + "v1/{+parent}:listEntitlementChanges";
13919        if self._scopes.is_empty() {
13920            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
13921        }
13922
13923        #[allow(clippy::single_element_loop)]
13924        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13925            url = params.uri_replacement(url, param_name, find_this, true);
13926        }
13927        {
13928            let to_remove = ["parent"];
13929            params.remove_params(&to_remove);
13930        }
13931
13932        let url = params.parse_with_url(&url);
13933
13934        loop {
13935            let token = match self
13936                .hub
13937                .auth
13938                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13939                .await
13940            {
13941                Ok(token) => token,
13942                Err(e) => match dlg.token(e) {
13943                    Ok(token) => token,
13944                    Err(e) => {
13945                        dlg.finished(false);
13946                        return Err(common::Error::MissingToken(e));
13947                    }
13948                },
13949            };
13950            let mut req_result = {
13951                let client = &self.hub.client;
13952                dlg.pre_request();
13953                let mut req_builder = hyper::Request::builder()
13954                    .method(hyper::Method::GET)
13955                    .uri(url.as_str())
13956                    .header(USER_AGENT, self.hub._user_agent.clone());
13957
13958                if let Some(token) = token.as_ref() {
13959                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13960                }
13961
13962                let request = req_builder
13963                    .header(CONTENT_LENGTH, 0_u64)
13964                    .body(common::to_body::<String>(None));
13965
13966                client.request(request.unwrap()).await
13967            };
13968
13969            match req_result {
13970                Err(err) => {
13971                    if let common::Retry::After(d) = dlg.http_error(&err) {
13972                        sleep(d).await;
13973                        continue;
13974                    }
13975                    dlg.finished(false);
13976                    return Err(common::Error::HttpError(err));
13977                }
13978                Ok(res) => {
13979                    let (mut parts, body) = res.into_parts();
13980                    let mut body = common::Body::new(body);
13981                    if !parts.status.is_success() {
13982                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13983                        let error = serde_json::from_str(&common::to_string(&bytes));
13984                        let response = common::to_response(parts, bytes.into());
13985
13986                        if let common::Retry::After(d) =
13987                            dlg.http_failure(&response, error.as_ref().ok())
13988                        {
13989                            sleep(d).await;
13990                            continue;
13991                        }
13992
13993                        dlg.finished(false);
13994
13995                        return Err(match error {
13996                            Ok(value) => common::Error::BadRequest(value),
13997                            _ => common::Error::Failure(response),
13998                        });
13999                    }
14000                    let response = {
14001                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14002                        let encoded = common::to_string(&bytes);
14003                        match serde_json::from_str(&encoded) {
14004                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14005                            Err(error) => {
14006                                dlg.response_json_decode_error(&encoded, &error);
14007                                return Err(common::Error::JsonDecodeError(
14008                                    encoded.to_string(),
14009                                    error,
14010                                ));
14011                            }
14012                        }
14013                    };
14014
14015                    dlg.finished(true);
14016                    return Ok(response);
14017                }
14018            }
14019        }
14020    }
14021
14022    /// Required. The resource name of the entitlement for which to list entitlement changes. The `-` wildcard may be used to match entitlements across a customer. Formats: * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} * accounts/{account_id}/customers/{customer_id}/entitlements/-
14023    ///
14024    /// Sets the *parent* path property to the given value.
14025    ///
14026    /// Even though the property as already been set when instantiating this call,
14027    /// we provide this method for API completeness.
14028    pub fn parent(
14029        mut self,
14030        new_value: &str,
14031    ) -> AccountCustomerEntitlementListEntitlementChangeCall<'a, C> {
14032        self._parent = new_value.to_string();
14033        self
14034    }
14035    /// Optional. A page token, received from a previous CloudChannelService.ListEntitlementChanges call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to CloudChannelService.ListEntitlementChanges must match the call that provided the page token.
14036    ///
14037    /// Sets the *page token* query property to the given value.
14038    pub fn page_token(
14039        mut self,
14040        new_value: &str,
14041    ) -> AccountCustomerEntitlementListEntitlementChangeCall<'a, C> {
14042        self._page_token = Some(new_value.to_string());
14043        self
14044    }
14045    /// Optional. The maximum number of entitlement changes to return. The service may return fewer than this value. If unspecified, returns at most 10 entitlement changes. The maximum value is 50; the server will coerce values above 50.
14046    ///
14047    /// Sets the *page size* query property to the given value.
14048    pub fn page_size(
14049        mut self,
14050        new_value: i32,
14051    ) -> AccountCustomerEntitlementListEntitlementChangeCall<'a, C> {
14052        self._page_size = Some(new_value);
14053        self
14054    }
14055    /// Optional. Filters applied to the list results.
14056    ///
14057    /// Sets the *filter* query property to the given value.
14058    pub fn filter(
14059        mut self,
14060        new_value: &str,
14061    ) -> AccountCustomerEntitlementListEntitlementChangeCall<'a, C> {
14062        self._filter = Some(new_value.to_string());
14063        self
14064    }
14065    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14066    /// while executing the actual API request.
14067    ///
14068    /// ````text
14069    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14070    /// ````
14071    ///
14072    /// Sets the *delegate* property to the given value.
14073    pub fn delegate(
14074        mut self,
14075        new_value: &'a mut dyn common::Delegate,
14076    ) -> AccountCustomerEntitlementListEntitlementChangeCall<'a, C> {
14077        self._delegate = Some(new_value);
14078        self
14079    }
14080
14081    /// Set any additional parameter of the query string used in the request.
14082    /// It should be used to set parameters which are not yet available through their own
14083    /// setters.
14084    ///
14085    /// Please note that this method must not be used to set any of the known parameters
14086    /// which have their own setter method. If done anyway, the request will fail.
14087    ///
14088    /// # Additional Parameters
14089    ///
14090    /// * *$.xgafv* (query-string) - V1 error format.
14091    /// * *access_token* (query-string) - OAuth access token.
14092    /// * *alt* (query-string) - Data format for response.
14093    /// * *callback* (query-string) - JSONP
14094    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14095    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14096    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14097    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14098    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14099    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14100    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14101    pub fn param<T>(
14102        mut self,
14103        name: T,
14104        value: T,
14105    ) -> AccountCustomerEntitlementListEntitlementChangeCall<'a, C>
14106    where
14107        T: AsRef<str>,
14108    {
14109        self._additional_params
14110            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14111        self
14112    }
14113
14114    /// Identifies the authorization scope for the method you are building.
14115    ///
14116    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14117    /// [`Scope::AppOrder`].
14118    ///
14119    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14120    /// tokens for more than one scope.
14121    ///
14122    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14123    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14124    /// sufficient, a read-write scope will do as well.
14125    pub fn add_scope<St>(
14126        mut self,
14127        scope: St,
14128    ) -> AccountCustomerEntitlementListEntitlementChangeCall<'a, C>
14129    where
14130        St: AsRef<str>,
14131    {
14132        self._scopes.insert(String::from(scope.as_ref()));
14133        self
14134    }
14135    /// Identifies the authorization scope(s) for the method you are building.
14136    ///
14137    /// See [`Self::add_scope()`] for details.
14138    pub fn add_scopes<I, St>(
14139        mut self,
14140        scopes: I,
14141    ) -> AccountCustomerEntitlementListEntitlementChangeCall<'a, C>
14142    where
14143        I: IntoIterator<Item = St>,
14144        St: AsRef<str>,
14145    {
14146        self._scopes
14147            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14148        self
14149    }
14150
14151    /// Removes all scopes, and no default scope will be used either.
14152    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14153    /// for details).
14154    pub fn clear_scopes(mut self) -> AccountCustomerEntitlementListEntitlementChangeCall<'a, C> {
14155        self._scopes.clear();
14156        self
14157    }
14158}
14159
14160/// Returns the requested Offer resource. Possible error codes: * PERMISSION_DENIED: The entitlement doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: Entitlement or offer was not found. Return value: The Offer resource.
14161///
14162/// A builder for the *customers.entitlements.lookupOffer* method supported by a *account* resource.
14163/// It is not used directly, but through a [`AccountMethods`] instance.
14164///
14165/// # Example
14166///
14167/// Instantiate a resource method builder
14168///
14169/// ```test_harness,no_run
14170/// # extern crate hyper;
14171/// # extern crate hyper_rustls;
14172/// # extern crate google_cloudchannel1 as cloudchannel1;
14173/// # async fn dox() {
14174/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14175///
14176/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14177/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14178/// #     .with_native_roots()
14179/// #     .unwrap()
14180/// #     .https_only()
14181/// #     .enable_http2()
14182/// #     .build();
14183///
14184/// # let executor = hyper_util::rt::TokioExecutor::new();
14185/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14186/// #     secret,
14187/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14188/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14189/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14190/// #     ),
14191/// # ).build().await.unwrap();
14192///
14193/// # let client = hyper_util::client::legacy::Client::builder(
14194/// #     hyper_util::rt::TokioExecutor::new()
14195/// # )
14196/// # .build(
14197/// #     hyper_rustls::HttpsConnectorBuilder::new()
14198/// #         .with_native_roots()
14199/// #         .unwrap()
14200/// #         .https_or_http()
14201/// #         .enable_http2()
14202/// #         .build()
14203/// # );
14204/// # let mut hub = Cloudchannel::new(client, auth);
14205/// // You can configure optional parameters by calling the respective setters at will, and
14206/// // execute the final call using `doit()`.
14207/// // Values shown here are possibly random and not representative !
14208/// let result = hub.accounts().customers_entitlements_lookup_offer("entitlement")
14209///              .doit().await;
14210/// # }
14211/// ```
14212pub struct AccountCustomerEntitlementLookupOfferCall<'a, C>
14213where
14214    C: 'a,
14215{
14216    hub: &'a Cloudchannel<C>,
14217    _entitlement: String,
14218    _delegate: Option<&'a mut dyn common::Delegate>,
14219    _additional_params: HashMap<String, String>,
14220    _scopes: BTreeSet<String>,
14221}
14222
14223impl<'a, C> common::CallBuilder for AccountCustomerEntitlementLookupOfferCall<'a, C> {}
14224
14225impl<'a, C> AccountCustomerEntitlementLookupOfferCall<'a, C>
14226where
14227    C: common::Connector,
14228{
14229    /// Perform the operation you have build so far.
14230    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleCloudChannelV1Offer)> {
14231        use std::borrow::Cow;
14232        use std::io::{Read, Seek};
14233
14234        use common::{url::Params, ToParts};
14235        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14236
14237        let mut dd = common::DefaultDelegate;
14238        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14239        dlg.begin(common::MethodInfo {
14240            id: "cloudchannel.accounts.customers.entitlements.lookupOffer",
14241            http_method: hyper::Method::GET,
14242        });
14243
14244        for &field in ["alt", "entitlement"].iter() {
14245            if self._additional_params.contains_key(field) {
14246                dlg.finished(false);
14247                return Err(common::Error::FieldClash(field));
14248            }
14249        }
14250
14251        let mut params = Params::with_capacity(3 + self._additional_params.len());
14252        params.push("entitlement", self._entitlement);
14253
14254        params.extend(self._additional_params.iter());
14255
14256        params.push("alt", "json");
14257        let mut url = self.hub._base_url.clone() + "v1/{+entitlement}:lookupOffer";
14258        if self._scopes.is_empty() {
14259            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
14260        }
14261
14262        #[allow(clippy::single_element_loop)]
14263        for &(find_this, param_name) in [("{+entitlement}", "entitlement")].iter() {
14264            url = params.uri_replacement(url, param_name, find_this, true);
14265        }
14266        {
14267            let to_remove = ["entitlement"];
14268            params.remove_params(&to_remove);
14269        }
14270
14271        let url = params.parse_with_url(&url);
14272
14273        loop {
14274            let token = match self
14275                .hub
14276                .auth
14277                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14278                .await
14279            {
14280                Ok(token) => token,
14281                Err(e) => match dlg.token(e) {
14282                    Ok(token) => token,
14283                    Err(e) => {
14284                        dlg.finished(false);
14285                        return Err(common::Error::MissingToken(e));
14286                    }
14287                },
14288            };
14289            let mut req_result = {
14290                let client = &self.hub.client;
14291                dlg.pre_request();
14292                let mut req_builder = hyper::Request::builder()
14293                    .method(hyper::Method::GET)
14294                    .uri(url.as_str())
14295                    .header(USER_AGENT, self.hub._user_agent.clone());
14296
14297                if let Some(token) = token.as_ref() {
14298                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14299                }
14300
14301                let request = req_builder
14302                    .header(CONTENT_LENGTH, 0_u64)
14303                    .body(common::to_body::<String>(None));
14304
14305                client.request(request.unwrap()).await
14306            };
14307
14308            match req_result {
14309                Err(err) => {
14310                    if let common::Retry::After(d) = dlg.http_error(&err) {
14311                        sleep(d).await;
14312                        continue;
14313                    }
14314                    dlg.finished(false);
14315                    return Err(common::Error::HttpError(err));
14316                }
14317                Ok(res) => {
14318                    let (mut parts, body) = res.into_parts();
14319                    let mut body = common::Body::new(body);
14320                    if !parts.status.is_success() {
14321                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14322                        let error = serde_json::from_str(&common::to_string(&bytes));
14323                        let response = common::to_response(parts, bytes.into());
14324
14325                        if let common::Retry::After(d) =
14326                            dlg.http_failure(&response, error.as_ref().ok())
14327                        {
14328                            sleep(d).await;
14329                            continue;
14330                        }
14331
14332                        dlg.finished(false);
14333
14334                        return Err(match error {
14335                            Ok(value) => common::Error::BadRequest(value),
14336                            _ => common::Error::Failure(response),
14337                        });
14338                    }
14339                    let response = {
14340                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14341                        let encoded = common::to_string(&bytes);
14342                        match serde_json::from_str(&encoded) {
14343                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14344                            Err(error) => {
14345                                dlg.response_json_decode_error(&encoded, &error);
14346                                return Err(common::Error::JsonDecodeError(
14347                                    encoded.to_string(),
14348                                    error,
14349                                ));
14350                            }
14351                        }
14352                    };
14353
14354                    dlg.finished(true);
14355                    return Ok(response);
14356                }
14357            }
14358        }
14359    }
14360
14361    /// Required. The resource name of the entitlement to retrieve the Offer. Entitlement uses the format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
14362    ///
14363    /// Sets the *entitlement* path property to the given value.
14364    ///
14365    /// Even though the property as already been set when instantiating this call,
14366    /// we provide this method for API completeness.
14367    pub fn entitlement(
14368        mut self,
14369        new_value: &str,
14370    ) -> AccountCustomerEntitlementLookupOfferCall<'a, C> {
14371        self._entitlement = new_value.to_string();
14372        self
14373    }
14374    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14375    /// while executing the actual API request.
14376    ///
14377    /// ````text
14378    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14379    /// ````
14380    ///
14381    /// Sets the *delegate* property to the given value.
14382    pub fn delegate(
14383        mut self,
14384        new_value: &'a mut dyn common::Delegate,
14385    ) -> AccountCustomerEntitlementLookupOfferCall<'a, C> {
14386        self._delegate = Some(new_value);
14387        self
14388    }
14389
14390    /// Set any additional parameter of the query string used in the request.
14391    /// It should be used to set parameters which are not yet available through their own
14392    /// setters.
14393    ///
14394    /// Please note that this method must not be used to set any of the known parameters
14395    /// which have their own setter method. If done anyway, the request will fail.
14396    ///
14397    /// # Additional Parameters
14398    ///
14399    /// * *$.xgafv* (query-string) - V1 error format.
14400    /// * *access_token* (query-string) - OAuth access token.
14401    /// * *alt* (query-string) - Data format for response.
14402    /// * *callback* (query-string) - JSONP
14403    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14404    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14405    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14406    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14407    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14408    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14409    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14410    pub fn param<T>(mut self, name: T, value: T) -> AccountCustomerEntitlementLookupOfferCall<'a, C>
14411    where
14412        T: AsRef<str>,
14413    {
14414        self._additional_params
14415            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14416        self
14417    }
14418
14419    /// Identifies the authorization scope for the method you are building.
14420    ///
14421    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14422    /// [`Scope::AppOrder`].
14423    ///
14424    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14425    /// tokens for more than one scope.
14426    ///
14427    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14428    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14429    /// sufficient, a read-write scope will do as well.
14430    pub fn add_scope<St>(mut self, scope: St) -> AccountCustomerEntitlementLookupOfferCall<'a, C>
14431    where
14432        St: AsRef<str>,
14433    {
14434        self._scopes.insert(String::from(scope.as_ref()));
14435        self
14436    }
14437    /// Identifies the authorization scope(s) for the method you are building.
14438    ///
14439    /// See [`Self::add_scope()`] for details.
14440    pub fn add_scopes<I, St>(
14441        mut self,
14442        scopes: I,
14443    ) -> AccountCustomerEntitlementLookupOfferCall<'a, C>
14444    where
14445        I: IntoIterator<Item = St>,
14446        St: AsRef<str>,
14447    {
14448        self._scopes
14449            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14450        self
14451    }
14452
14453    /// Removes all scopes, and no default scope will be used either.
14454    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14455    /// for details).
14456    pub fn clear_scopes(mut self) -> AccountCustomerEntitlementLookupOfferCall<'a, C> {
14457        self._scopes.clear();
14458        self
14459    }
14460}
14461
14462/// Starts paid service for a trial entitlement. Starts paid service for a trial entitlement immediately. This method is only applicable if a plan is set up for a trial entitlement but has some trial days remaining. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: Entitlement resource not found. * FAILED_PRECONDITION/NOT_IN_TRIAL: This method only works for entitlement on trial plans. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata will contain an instance of OperationMetadata.
14463///
14464/// A builder for the *customers.entitlements.startPaidService* method supported by a *account* resource.
14465/// It is not used directly, but through a [`AccountMethods`] instance.
14466///
14467/// # Example
14468///
14469/// Instantiate a resource method builder
14470///
14471/// ```test_harness,no_run
14472/// # extern crate hyper;
14473/// # extern crate hyper_rustls;
14474/// # extern crate google_cloudchannel1 as cloudchannel1;
14475/// use cloudchannel1::api::GoogleCloudChannelV1StartPaidServiceRequest;
14476/// # async fn dox() {
14477/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14478///
14479/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14480/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14481/// #     .with_native_roots()
14482/// #     .unwrap()
14483/// #     .https_only()
14484/// #     .enable_http2()
14485/// #     .build();
14486///
14487/// # let executor = hyper_util::rt::TokioExecutor::new();
14488/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14489/// #     secret,
14490/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14491/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14492/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14493/// #     ),
14494/// # ).build().await.unwrap();
14495///
14496/// # let client = hyper_util::client::legacy::Client::builder(
14497/// #     hyper_util::rt::TokioExecutor::new()
14498/// # )
14499/// # .build(
14500/// #     hyper_rustls::HttpsConnectorBuilder::new()
14501/// #         .with_native_roots()
14502/// #         .unwrap()
14503/// #         .https_or_http()
14504/// #         .enable_http2()
14505/// #         .build()
14506/// # );
14507/// # let mut hub = Cloudchannel::new(client, auth);
14508/// // As the method needs a request, you would usually fill it with the desired information
14509/// // into the respective structure. Some of the parts shown here might not be applicable !
14510/// // Values shown here are possibly random and not representative !
14511/// let mut req = GoogleCloudChannelV1StartPaidServiceRequest::default();
14512///
14513/// // You can configure optional parameters by calling the respective setters at will, and
14514/// // execute the final call using `doit()`.
14515/// // Values shown here are possibly random and not representative !
14516/// let result = hub.accounts().customers_entitlements_start_paid_service(req, "name")
14517///              .doit().await;
14518/// # }
14519/// ```
14520pub struct AccountCustomerEntitlementStartPaidServiceCall<'a, C>
14521where
14522    C: 'a,
14523{
14524    hub: &'a Cloudchannel<C>,
14525    _request: GoogleCloudChannelV1StartPaidServiceRequest,
14526    _name: String,
14527    _delegate: Option<&'a mut dyn common::Delegate>,
14528    _additional_params: HashMap<String, String>,
14529    _scopes: BTreeSet<String>,
14530}
14531
14532impl<'a, C> common::CallBuilder for AccountCustomerEntitlementStartPaidServiceCall<'a, C> {}
14533
14534impl<'a, C> AccountCustomerEntitlementStartPaidServiceCall<'a, C>
14535where
14536    C: common::Connector,
14537{
14538    /// Perform the operation you have build so far.
14539    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
14540        use std::borrow::Cow;
14541        use std::io::{Read, Seek};
14542
14543        use common::{url::Params, ToParts};
14544        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14545
14546        let mut dd = common::DefaultDelegate;
14547        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14548        dlg.begin(common::MethodInfo {
14549            id: "cloudchannel.accounts.customers.entitlements.startPaidService",
14550            http_method: hyper::Method::POST,
14551        });
14552
14553        for &field in ["alt", "name"].iter() {
14554            if self._additional_params.contains_key(field) {
14555                dlg.finished(false);
14556                return Err(common::Error::FieldClash(field));
14557            }
14558        }
14559
14560        let mut params = Params::with_capacity(4 + self._additional_params.len());
14561        params.push("name", self._name);
14562
14563        params.extend(self._additional_params.iter());
14564
14565        params.push("alt", "json");
14566        let mut url = self.hub._base_url.clone() + "v1/{+name}:startPaidService";
14567        if self._scopes.is_empty() {
14568            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
14569        }
14570
14571        #[allow(clippy::single_element_loop)]
14572        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14573            url = params.uri_replacement(url, param_name, find_this, true);
14574        }
14575        {
14576            let to_remove = ["name"];
14577            params.remove_params(&to_remove);
14578        }
14579
14580        let url = params.parse_with_url(&url);
14581
14582        let mut json_mime_type = mime::APPLICATION_JSON;
14583        let mut request_value_reader = {
14584            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14585            common::remove_json_null_values(&mut value);
14586            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14587            serde_json::to_writer(&mut dst, &value).unwrap();
14588            dst
14589        };
14590        let request_size = request_value_reader
14591            .seek(std::io::SeekFrom::End(0))
14592            .unwrap();
14593        request_value_reader
14594            .seek(std::io::SeekFrom::Start(0))
14595            .unwrap();
14596
14597        loop {
14598            let token = match self
14599                .hub
14600                .auth
14601                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14602                .await
14603            {
14604                Ok(token) => token,
14605                Err(e) => match dlg.token(e) {
14606                    Ok(token) => token,
14607                    Err(e) => {
14608                        dlg.finished(false);
14609                        return Err(common::Error::MissingToken(e));
14610                    }
14611                },
14612            };
14613            request_value_reader
14614                .seek(std::io::SeekFrom::Start(0))
14615                .unwrap();
14616            let mut req_result = {
14617                let client = &self.hub.client;
14618                dlg.pre_request();
14619                let mut req_builder = hyper::Request::builder()
14620                    .method(hyper::Method::POST)
14621                    .uri(url.as_str())
14622                    .header(USER_AGENT, self.hub._user_agent.clone());
14623
14624                if let Some(token) = token.as_ref() {
14625                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14626                }
14627
14628                let request = req_builder
14629                    .header(CONTENT_TYPE, json_mime_type.to_string())
14630                    .header(CONTENT_LENGTH, request_size as u64)
14631                    .body(common::to_body(
14632                        request_value_reader.get_ref().clone().into(),
14633                    ));
14634
14635                client.request(request.unwrap()).await
14636            };
14637
14638            match req_result {
14639                Err(err) => {
14640                    if let common::Retry::After(d) = dlg.http_error(&err) {
14641                        sleep(d).await;
14642                        continue;
14643                    }
14644                    dlg.finished(false);
14645                    return Err(common::Error::HttpError(err));
14646                }
14647                Ok(res) => {
14648                    let (mut parts, body) = res.into_parts();
14649                    let mut body = common::Body::new(body);
14650                    if !parts.status.is_success() {
14651                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14652                        let error = serde_json::from_str(&common::to_string(&bytes));
14653                        let response = common::to_response(parts, bytes.into());
14654
14655                        if let common::Retry::After(d) =
14656                            dlg.http_failure(&response, error.as_ref().ok())
14657                        {
14658                            sleep(d).await;
14659                            continue;
14660                        }
14661
14662                        dlg.finished(false);
14663
14664                        return Err(match error {
14665                            Ok(value) => common::Error::BadRequest(value),
14666                            _ => common::Error::Failure(response),
14667                        });
14668                    }
14669                    let response = {
14670                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14671                        let encoded = common::to_string(&bytes);
14672                        match serde_json::from_str(&encoded) {
14673                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14674                            Err(error) => {
14675                                dlg.response_json_decode_error(&encoded, &error);
14676                                return Err(common::Error::JsonDecodeError(
14677                                    encoded.to_string(),
14678                                    error,
14679                                ));
14680                            }
14681                        }
14682                    };
14683
14684                    dlg.finished(true);
14685                    return Ok(response);
14686                }
14687            }
14688        }
14689    }
14690
14691    ///
14692    /// Sets the *request* property to the given value.
14693    ///
14694    /// Even though the property as already been set when instantiating this call,
14695    /// we provide this method for API completeness.
14696    pub fn request(
14697        mut self,
14698        new_value: GoogleCloudChannelV1StartPaidServiceRequest,
14699    ) -> AccountCustomerEntitlementStartPaidServiceCall<'a, C> {
14700        self._request = new_value;
14701        self
14702    }
14703    /// Required. The name of the entitlement to start a paid service for. Name uses the format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
14704    ///
14705    /// Sets the *name* path property to the given value.
14706    ///
14707    /// Even though the property as already been set when instantiating this call,
14708    /// we provide this method for API completeness.
14709    pub fn name(
14710        mut self,
14711        new_value: &str,
14712    ) -> AccountCustomerEntitlementStartPaidServiceCall<'a, C> {
14713        self._name = new_value.to_string();
14714        self
14715    }
14716    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14717    /// while executing the actual API request.
14718    ///
14719    /// ````text
14720    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14721    /// ````
14722    ///
14723    /// Sets the *delegate* property to the given value.
14724    pub fn delegate(
14725        mut self,
14726        new_value: &'a mut dyn common::Delegate,
14727    ) -> AccountCustomerEntitlementStartPaidServiceCall<'a, C> {
14728        self._delegate = Some(new_value);
14729        self
14730    }
14731
14732    /// Set any additional parameter of the query string used in the request.
14733    /// It should be used to set parameters which are not yet available through their own
14734    /// setters.
14735    ///
14736    /// Please note that this method must not be used to set any of the known parameters
14737    /// which have their own setter method. If done anyway, the request will fail.
14738    ///
14739    /// # Additional Parameters
14740    ///
14741    /// * *$.xgafv* (query-string) - V1 error format.
14742    /// * *access_token* (query-string) - OAuth access token.
14743    /// * *alt* (query-string) - Data format for response.
14744    /// * *callback* (query-string) - JSONP
14745    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14746    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14747    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14748    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14749    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14750    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14751    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14752    pub fn param<T>(
14753        mut self,
14754        name: T,
14755        value: T,
14756    ) -> AccountCustomerEntitlementStartPaidServiceCall<'a, C>
14757    where
14758        T: AsRef<str>,
14759    {
14760        self._additional_params
14761            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14762        self
14763    }
14764
14765    /// Identifies the authorization scope for the method you are building.
14766    ///
14767    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14768    /// [`Scope::AppOrder`].
14769    ///
14770    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14771    /// tokens for more than one scope.
14772    ///
14773    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14774    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14775    /// sufficient, a read-write scope will do as well.
14776    pub fn add_scope<St>(
14777        mut self,
14778        scope: St,
14779    ) -> AccountCustomerEntitlementStartPaidServiceCall<'a, C>
14780    where
14781        St: AsRef<str>,
14782    {
14783        self._scopes.insert(String::from(scope.as_ref()));
14784        self
14785    }
14786    /// Identifies the authorization scope(s) for the method you are building.
14787    ///
14788    /// See [`Self::add_scope()`] for details.
14789    pub fn add_scopes<I, St>(
14790        mut self,
14791        scopes: I,
14792    ) -> AccountCustomerEntitlementStartPaidServiceCall<'a, C>
14793    where
14794        I: IntoIterator<Item = St>,
14795        St: AsRef<str>,
14796    {
14797        self._scopes
14798            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14799        self
14800    }
14801
14802    /// Removes all scopes, and no default scope will be used either.
14803    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14804    /// for details).
14805    pub fn clear_scopes(mut self) -> AccountCustomerEntitlementStartPaidServiceCall<'a, C> {
14806        self._scopes.clear();
14807        self
14808    }
14809}
14810
14811/// Suspends a previously fulfilled entitlement. An entitlement suspension is a long-running operation. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: Entitlement resource not found. * NOT_ACTIVE: Entitlement is not active. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata will contain an instance of OperationMetadata.
14812///
14813/// A builder for the *customers.entitlements.suspend* method supported by a *account* resource.
14814/// It is not used directly, but through a [`AccountMethods`] instance.
14815///
14816/// # Example
14817///
14818/// Instantiate a resource method builder
14819///
14820/// ```test_harness,no_run
14821/// # extern crate hyper;
14822/// # extern crate hyper_rustls;
14823/// # extern crate google_cloudchannel1 as cloudchannel1;
14824/// use cloudchannel1::api::GoogleCloudChannelV1SuspendEntitlementRequest;
14825/// # async fn dox() {
14826/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14827///
14828/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14829/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14830/// #     .with_native_roots()
14831/// #     .unwrap()
14832/// #     .https_only()
14833/// #     .enable_http2()
14834/// #     .build();
14835///
14836/// # let executor = hyper_util::rt::TokioExecutor::new();
14837/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14838/// #     secret,
14839/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14840/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14841/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14842/// #     ),
14843/// # ).build().await.unwrap();
14844///
14845/// # let client = hyper_util::client::legacy::Client::builder(
14846/// #     hyper_util::rt::TokioExecutor::new()
14847/// # )
14848/// # .build(
14849/// #     hyper_rustls::HttpsConnectorBuilder::new()
14850/// #         .with_native_roots()
14851/// #         .unwrap()
14852/// #         .https_or_http()
14853/// #         .enable_http2()
14854/// #         .build()
14855/// # );
14856/// # let mut hub = Cloudchannel::new(client, auth);
14857/// // As the method needs a request, you would usually fill it with the desired information
14858/// // into the respective structure. Some of the parts shown here might not be applicable !
14859/// // Values shown here are possibly random and not representative !
14860/// let mut req = GoogleCloudChannelV1SuspendEntitlementRequest::default();
14861///
14862/// // You can configure optional parameters by calling the respective setters at will, and
14863/// // execute the final call using `doit()`.
14864/// // Values shown here are possibly random and not representative !
14865/// let result = hub.accounts().customers_entitlements_suspend(req, "name")
14866///              .doit().await;
14867/// # }
14868/// ```
14869pub struct AccountCustomerEntitlementSuspendCall<'a, C>
14870where
14871    C: 'a,
14872{
14873    hub: &'a Cloudchannel<C>,
14874    _request: GoogleCloudChannelV1SuspendEntitlementRequest,
14875    _name: String,
14876    _delegate: Option<&'a mut dyn common::Delegate>,
14877    _additional_params: HashMap<String, String>,
14878    _scopes: BTreeSet<String>,
14879}
14880
14881impl<'a, C> common::CallBuilder for AccountCustomerEntitlementSuspendCall<'a, C> {}
14882
14883impl<'a, C> AccountCustomerEntitlementSuspendCall<'a, C>
14884where
14885    C: common::Connector,
14886{
14887    /// Perform the operation you have build so far.
14888    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
14889        use std::borrow::Cow;
14890        use std::io::{Read, Seek};
14891
14892        use common::{url::Params, ToParts};
14893        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14894
14895        let mut dd = common::DefaultDelegate;
14896        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14897        dlg.begin(common::MethodInfo {
14898            id: "cloudchannel.accounts.customers.entitlements.suspend",
14899            http_method: hyper::Method::POST,
14900        });
14901
14902        for &field in ["alt", "name"].iter() {
14903            if self._additional_params.contains_key(field) {
14904                dlg.finished(false);
14905                return Err(common::Error::FieldClash(field));
14906            }
14907        }
14908
14909        let mut params = Params::with_capacity(4 + self._additional_params.len());
14910        params.push("name", self._name);
14911
14912        params.extend(self._additional_params.iter());
14913
14914        params.push("alt", "json");
14915        let mut url = self.hub._base_url.clone() + "v1/{+name}:suspend";
14916        if self._scopes.is_empty() {
14917            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
14918        }
14919
14920        #[allow(clippy::single_element_loop)]
14921        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14922            url = params.uri_replacement(url, param_name, find_this, true);
14923        }
14924        {
14925            let to_remove = ["name"];
14926            params.remove_params(&to_remove);
14927        }
14928
14929        let url = params.parse_with_url(&url);
14930
14931        let mut json_mime_type = mime::APPLICATION_JSON;
14932        let mut request_value_reader = {
14933            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14934            common::remove_json_null_values(&mut value);
14935            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14936            serde_json::to_writer(&mut dst, &value).unwrap();
14937            dst
14938        };
14939        let request_size = request_value_reader
14940            .seek(std::io::SeekFrom::End(0))
14941            .unwrap();
14942        request_value_reader
14943            .seek(std::io::SeekFrom::Start(0))
14944            .unwrap();
14945
14946        loop {
14947            let token = match self
14948                .hub
14949                .auth
14950                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14951                .await
14952            {
14953                Ok(token) => token,
14954                Err(e) => match dlg.token(e) {
14955                    Ok(token) => token,
14956                    Err(e) => {
14957                        dlg.finished(false);
14958                        return Err(common::Error::MissingToken(e));
14959                    }
14960                },
14961            };
14962            request_value_reader
14963                .seek(std::io::SeekFrom::Start(0))
14964                .unwrap();
14965            let mut req_result = {
14966                let client = &self.hub.client;
14967                dlg.pre_request();
14968                let mut req_builder = hyper::Request::builder()
14969                    .method(hyper::Method::POST)
14970                    .uri(url.as_str())
14971                    .header(USER_AGENT, self.hub._user_agent.clone());
14972
14973                if let Some(token) = token.as_ref() {
14974                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14975                }
14976
14977                let request = req_builder
14978                    .header(CONTENT_TYPE, json_mime_type.to_string())
14979                    .header(CONTENT_LENGTH, request_size as u64)
14980                    .body(common::to_body(
14981                        request_value_reader.get_ref().clone().into(),
14982                    ));
14983
14984                client.request(request.unwrap()).await
14985            };
14986
14987            match req_result {
14988                Err(err) => {
14989                    if let common::Retry::After(d) = dlg.http_error(&err) {
14990                        sleep(d).await;
14991                        continue;
14992                    }
14993                    dlg.finished(false);
14994                    return Err(common::Error::HttpError(err));
14995                }
14996                Ok(res) => {
14997                    let (mut parts, body) = res.into_parts();
14998                    let mut body = common::Body::new(body);
14999                    if !parts.status.is_success() {
15000                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15001                        let error = serde_json::from_str(&common::to_string(&bytes));
15002                        let response = common::to_response(parts, bytes.into());
15003
15004                        if let common::Retry::After(d) =
15005                            dlg.http_failure(&response, error.as_ref().ok())
15006                        {
15007                            sleep(d).await;
15008                            continue;
15009                        }
15010
15011                        dlg.finished(false);
15012
15013                        return Err(match error {
15014                            Ok(value) => common::Error::BadRequest(value),
15015                            _ => common::Error::Failure(response),
15016                        });
15017                    }
15018                    let response = {
15019                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15020                        let encoded = common::to_string(&bytes);
15021                        match serde_json::from_str(&encoded) {
15022                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15023                            Err(error) => {
15024                                dlg.response_json_decode_error(&encoded, &error);
15025                                return Err(common::Error::JsonDecodeError(
15026                                    encoded.to_string(),
15027                                    error,
15028                                ));
15029                            }
15030                        }
15031                    };
15032
15033                    dlg.finished(true);
15034                    return Ok(response);
15035                }
15036            }
15037        }
15038    }
15039
15040    ///
15041    /// Sets the *request* property to the given value.
15042    ///
15043    /// Even though the property as already been set when instantiating this call,
15044    /// we provide this method for API completeness.
15045    pub fn request(
15046        mut self,
15047        new_value: GoogleCloudChannelV1SuspendEntitlementRequest,
15048    ) -> AccountCustomerEntitlementSuspendCall<'a, C> {
15049        self._request = new_value;
15050        self
15051    }
15052    /// Required. The resource name of the entitlement to suspend. Name uses the format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
15053    ///
15054    /// Sets the *name* path property to the given value.
15055    ///
15056    /// Even though the property as already been set when instantiating this call,
15057    /// we provide this method for API completeness.
15058    pub fn name(mut self, new_value: &str) -> AccountCustomerEntitlementSuspendCall<'a, C> {
15059        self._name = new_value.to_string();
15060        self
15061    }
15062    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15063    /// while executing the actual API request.
15064    ///
15065    /// ````text
15066    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15067    /// ````
15068    ///
15069    /// Sets the *delegate* property to the given value.
15070    pub fn delegate(
15071        mut self,
15072        new_value: &'a mut dyn common::Delegate,
15073    ) -> AccountCustomerEntitlementSuspendCall<'a, C> {
15074        self._delegate = Some(new_value);
15075        self
15076    }
15077
15078    /// Set any additional parameter of the query string used in the request.
15079    /// It should be used to set parameters which are not yet available through their own
15080    /// setters.
15081    ///
15082    /// Please note that this method must not be used to set any of the known parameters
15083    /// which have their own setter method. If done anyway, the request will fail.
15084    ///
15085    /// # Additional Parameters
15086    ///
15087    /// * *$.xgafv* (query-string) - V1 error format.
15088    /// * *access_token* (query-string) - OAuth access token.
15089    /// * *alt* (query-string) - Data format for response.
15090    /// * *callback* (query-string) - JSONP
15091    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15092    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15093    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15094    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15095    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15096    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15097    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15098    pub fn param<T>(mut self, name: T, value: T) -> AccountCustomerEntitlementSuspendCall<'a, C>
15099    where
15100        T: AsRef<str>,
15101    {
15102        self._additional_params
15103            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15104        self
15105    }
15106
15107    /// Identifies the authorization scope for the method you are building.
15108    ///
15109    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15110    /// [`Scope::AppOrder`].
15111    ///
15112    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15113    /// tokens for more than one scope.
15114    ///
15115    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15116    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15117    /// sufficient, a read-write scope will do as well.
15118    pub fn add_scope<St>(mut self, scope: St) -> AccountCustomerEntitlementSuspendCall<'a, C>
15119    where
15120        St: AsRef<str>,
15121    {
15122        self._scopes.insert(String::from(scope.as_ref()));
15123        self
15124    }
15125    /// Identifies the authorization scope(s) for the method you are building.
15126    ///
15127    /// See [`Self::add_scope()`] for details.
15128    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountCustomerEntitlementSuspendCall<'a, C>
15129    where
15130        I: IntoIterator<Item = St>,
15131        St: AsRef<str>,
15132    {
15133        self._scopes
15134            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15135        self
15136    }
15137
15138    /// Removes all scopes, and no default scope will be used either.
15139    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15140    /// for details).
15141    pub fn clear_scopes(mut self) -> AccountCustomerEntitlementSuspendCall<'a, C> {
15142        self._scopes.clear();
15143        self
15144    }
15145}
15146
15147/// Creates a new Customer resource under the reseller or distributor account. Possible error codes: * PERMISSION_DENIED: * The reseller account making the request is different from the reseller account in the API request. * You are not authorized to create a customer. See https://support.google.com/channelservices/answer/9759265 * INVALID_ARGUMENT: * Required request parameters are missing or invalid. * Domain field value doesn't match the primary email domain. Return value: The newly created Customer resource.
15148///
15149/// A builder for the *customers.create* method supported by a *account* resource.
15150/// It is not used directly, but through a [`AccountMethods`] instance.
15151///
15152/// # Example
15153///
15154/// Instantiate a resource method builder
15155///
15156/// ```test_harness,no_run
15157/// # extern crate hyper;
15158/// # extern crate hyper_rustls;
15159/// # extern crate google_cloudchannel1 as cloudchannel1;
15160/// use cloudchannel1::api::GoogleCloudChannelV1Customer;
15161/// # async fn dox() {
15162/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15163///
15164/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15165/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15166/// #     .with_native_roots()
15167/// #     .unwrap()
15168/// #     .https_only()
15169/// #     .enable_http2()
15170/// #     .build();
15171///
15172/// # let executor = hyper_util::rt::TokioExecutor::new();
15173/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15174/// #     secret,
15175/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15176/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15177/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15178/// #     ),
15179/// # ).build().await.unwrap();
15180///
15181/// # let client = hyper_util::client::legacy::Client::builder(
15182/// #     hyper_util::rt::TokioExecutor::new()
15183/// # )
15184/// # .build(
15185/// #     hyper_rustls::HttpsConnectorBuilder::new()
15186/// #         .with_native_roots()
15187/// #         .unwrap()
15188/// #         .https_or_http()
15189/// #         .enable_http2()
15190/// #         .build()
15191/// # );
15192/// # let mut hub = Cloudchannel::new(client, auth);
15193/// // As the method needs a request, you would usually fill it with the desired information
15194/// // into the respective structure. Some of the parts shown here might not be applicable !
15195/// // Values shown here are possibly random and not representative !
15196/// let mut req = GoogleCloudChannelV1Customer::default();
15197///
15198/// // You can configure optional parameters by calling the respective setters at will, and
15199/// // execute the final call using `doit()`.
15200/// // Values shown here are possibly random and not representative !
15201/// let result = hub.accounts().customers_create(req, "parent")
15202///              .doit().await;
15203/// # }
15204/// ```
15205pub struct AccountCustomerCreateCall<'a, C>
15206where
15207    C: 'a,
15208{
15209    hub: &'a Cloudchannel<C>,
15210    _request: GoogleCloudChannelV1Customer,
15211    _parent: String,
15212    _delegate: Option<&'a mut dyn common::Delegate>,
15213    _additional_params: HashMap<String, String>,
15214    _scopes: BTreeSet<String>,
15215}
15216
15217impl<'a, C> common::CallBuilder for AccountCustomerCreateCall<'a, C> {}
15218
15219impl<'a, C> AccountCustomerCreateCall<'a, C>
15220where
15221    C: common::Connector,
15222{
15223    /// Perform the operation you have build so far.
15224    pub async fn doit(
15225        mut self,
15226    ) -> common::Result<(common::Response, GoogleCloudChannelV1Customer)> {
15227        use std::borrow::Cow;
15228        use std::io::{Read, Seek};
15229
15230        use common::{url::Params, ToParts};
15231        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15232
15233        let mut dd = common::DefaultDelegate;
15234        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15235        dlg.begin(common::MethodInfo {
15236            id: "cloudchannel.accounts.customers.create",
15237            http_method: hyper::Method::POST,
15238        });
15239
15240        for &field in ["alt", "parent"].iter() {
15241            if self._additional_params.contains_key(field) {
15242                dlg.finished(false);
15243                return Err(common::Error::FieldClash(field));
15244            }
15245        }
15246
15247        let mut params = Params::with_capacity(4 + self._additional_params.len());
15248        params.push("parent", self._parent);
15249
15250        params.extend(self._additional_params.iter());
15251
15252        params.push("alt", "json");
15253        let mut url = self.hub._base_url.clone() + "v1/{+parent}/customers";
15254        if self._scopes.is_empty() {
15255            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
15256        }
15257
15258        #[allow(clippy::single_element_loop)]
15259        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15260            url = params.uri_replacement(url, param_name, find_this, true);
15261        }
15262        {
15263            let to_remove = ["parent"];
15264            params.remove_params(&to_remove);
15265        }
15266
15267        let url = params.parse_with_url(&url);
15268
15269        let mut json_mime_type = mime::APPLICATION_JSON;
15270        let mut request_value_reader = {
15271            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15272            common::remove_json_null_values(&mut value);
15273            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15274            serde_json::to_writer(&mut dst, &value).unwrap();
15275            dst
15276        };
15277        let request_size = request_value_reader
15278            .seek(std::io::SeekFrom::End(0))
15279            .unwrap();
15280        request_value_reader
15281            .seek(std::io::SeekFrom::Start(0))
15282            .unwrap();
15283
15284        loop {
15285            let token = match self
15286                .hub
15287                .auth
15288                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15289                .await
15290            {
15291                Ok(token) => token,
15292                Err(e) => match dlg.token(e) {
15293                    Ok(token) => token,
15294                    Err(e) => {
15295                        dlg.finished(false);
15296                        return Err(common::Error::MissingToken(e));
15297                    }
15298                },
15299            };
15300            request_value_reader
15301                .seek(std::io::SeekFrom::Start(0))
15302                .unwrap();
15303            let mut req_result = {
15304                let client = &self.hub.client;
15305                dlg.pre_request();
15306                let mut req_builder = hyper::Request::builder()
15307                    .method(hyper::Method::POST)
15308                    .uri(url.as_str())
15309                    .header(USER_AGENT, self.hub._user_agent.clone());
15310
15311                if let Some(token) = token.as_ref() {
15312                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15313                }
15314
15315                let request = req_builder
15316                    .header(CONTENT_TYPE, json_mime_type.to_string())
15317                    .header(CONTENT_LENGTH, request_size as u64)
15318                    .body(common::to_body(
15319                        request_value_reader.get_ref().clone().into(),
15320                    ));
15321
15322                client.request(request.unwrap()).await
15323            };
15324
15325            match req_result {
15326                Err(err) => {
15327                    if let common::Retry::After(d) = dlg.http_error(&err) {
15328                        sleep(d).await;
15329                        continue;
15330                    }
15331                    dlg.finished(false);
15332                    return Err(common::Error::HttpError(err));
15333                }
15334                Ok(res) => {
15335                    let (mut parts, body) = res.into_parts();
15336                    let mut body = common::Body::new(body);
15337                    if !parts.status.is_success() {
15338                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15339                        let error = serde_json::from_str(&common::to_string(&bytes));
15340                        let response = common::to_response(parts, bytes.into());
15341
15342                        if let common::Retry::After(d) =
15343                            dlg.http_failure(&response, error.as_ref().ok())
15344                        {
15345                            sleep(d).await;
15346                            continue;
15347                        }
15348
15349                        dlg.finished(false);
15350
15351                        return Err(match error {
15352                            Ok(value) => common::Error::BadRequest(value),
15353                            _ => common::Error::Failure(response),
15354                        });
15355                    }
15356                    let response = {
15357                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15358                        let encoded = common::to_string(&bytes);
15359                        match serde_json::from_str(&encoded) {
15360                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15361                            Err(error) => {
15362                                dlg.response_json_decode_error(&encoded, &error);
15363                                return Err(common::Error::JsonDecodeError(
15364                                    encoded.to_string(),
15365                                    error,
15366                                ));
15367                            }
15368                        }
15369                    };
15370
15371                    dlg.finished(true);
15372                    return Ok(response);
15373                }
15374            }
15375        }
15376    }
15377
15378    ///
15379    /// Sets the *request* property to the given value.
15380    ///
15381    /// Even though the property as already been set when instantiating this call,
15382    /// we provide this method for API completeness.
15383    pub fn request(
15384        mut self,
15385        new_value: GoogleCloudChannelV1Customer,
15386    ) -> AccountCustomerCreateCall<'a, C> {
15387        self._request = new_value;
15388        self
15389    }
15390    /// Required. The resource name of reseller account in which to create the customer. Parent uses the format: accounts/{account_id}
15391    ///
15392    /// Sets the *parent* path property to the given value.
15393    ///
15394    /// Even though the property as already been set when instantiating this call,
15395    /// we provide this method for API completeness.
15396    pub fn parent(mut self, new_value: &str) -> AccountCustomerCreateCall<'a, C> {
15397        self._parent = new_value.to_string();
15398        self
15399    }
15400    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15401    /// while executing the actual API request.
15402    ///
15403    /// ````text
15404    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15405    /// ````
15406    ///
15407    /// Sets the *delegate* property to the given value.
15408    pub fn delegate(
15409        mut self,
15410        new_value: &'a mut dyn common::Delegate,
15411    ) -> AccountCustomerCreateCall<'a, C> {
15412        self._delegate = Some(new_value);
15413        self
15414    }
15415
15416    /// Set any additional parameter of the query string used in the request.
15417    /// It should be used to set parameters which are not yet available through their own
15418    /// setters.
15419    ///
15420    /// Please note that this method must not be used to set any of the known parameters
15421    /// which have their own setter method. If done anyway, the request will fail.
15422    ///
15423    /// # Additional Parameters
15424    ///
15425    /// * *$.xgafv* (query-string) - V1 error format.
15426    /// * *access_token* (query-string) - OAuth access token.
15427    /// * *alt* (query-string) - Data format for response.
15428    /// * *callback* (query-string) - JSONP
15429    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15430    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15431    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15432    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15433    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15434    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15435    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15436    pub fn param<T>(mut self, name: T, value: T) -> AccountCustomerCreateCall<'a, C>
15437    where
15438        T: AsRef<str>,
15439    {
15440        self._additional_params
15441            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15442        self
15443    }
15444
15445    /// Identifies the authorization scope for the method you are building.
15446    ///
15447    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15448    /// [`Scope::AppOrder`].
15449    ///
15450    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15451    /// tokens for more than one scope.
15452    ///
15453    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15454    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15455    /// sufficient, a read-write scope will do as well.
15456    pub fn add_scope<St>(mut self, scope: St) -> AccountCustomerCreateCall<'a, C>
15457    where
15458        St: AsRef<str>,
15459    {
15460        self._scopes.insert(String::from(scope.as_ref()));
15461        self
15462    }
15463    /// Identifies the authorization scope(s) for the method you are building.
15464    ///
15465    /// See [`Self::add_scope()`] for details.
15466    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountCustomerCreateCall<'a, C>
15467    where
15468        I: IntoIterator<Item = St>,
15469        St: AsRef<str>,
15470    {
15471        self._scopes
15472            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15473        self
15474    }
15475
15476    /// Removes all scopes, and no default scope will be used either.
15477    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15478    /// for details).
15479    pub fn clear_scopes(mut self) -> AccountCustomerCreateCall<'a, C> {
15480        self._scopes.clear();
15481        self
15482    }
15483}
15484
15485/// Deletes the given Customer permanently. Possible error codes: * PERMISSION_DENIED: The account making the request does not own this customer. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * FAILED_PRECONDITION: The customer has existing entitlements. * NOT_FOUND: No Customer resource found for the name in the request.
15486///
15487/// A builder for the *customers.delete* method supported by a *account* resource.
15488/// It is not used directly, but through a [`AccountMethods`] instance.
15489///
15490/// # Example
15491///
15492/// Instantiate a resource method builder
15493///
15494/// ```test_harness,no_run
15495/// # extern crate hyper;
15496/// # extern crate hyper_rustls;
15497/// # extern crate google_cloudchannel1 as cloudchannel1;
15498/// # async fn dox() {
15499/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15500///
15501/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15502/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15503/// #     .with_native_roots()
15504/// #     .unwrap()
15505/// #     .https_only()
15506/// #     .enable_http2()
15507/// #     .build();
15508///
15509/// # let executor = hyper_util::rt::TokioExecutor::new();
15510/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15511/// #     secret,
15512/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15513/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15514/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15515/// #     ),
15516/// # ).build().await.unwrap();
15517///
15518/// # let client = hyper_util::client::legacy::Client::builder(
15519/// #     hyper_util::rt::TokioExecutor::new()
15520/// # )
15521/// # .build(
15522/// #     hyper_rustls::HttpsConnectorBuilder::new()
15523/// #         .with_native_roots()
15524/// #         .unwrap()
15525/// #         .https_or_http()
15526/// #         .enable_http2()
15527/// #         .build()
15528/// # );
15529/// # let mut hub = Cloudchannel::new(client, auth);
15530/// // You can configure optional parameters by calling the respective setters at will, and
15531/// // execute the final call using `doit()`.
15532/// // Values shown here are possibly random and not representative !
15533/// let result = hub.accounts().customers_delete("name")
15534///              .doit().await;
15535/// # }
15536/// ```
15537pub struct AccountCustomerDeleteCall<'a, C>
15538where
15539    C: 'a,
15540{
15541    hub: &'a Cloudchannel<C>,
15542    _name: String,
15543    _delegate: Option<&'a mut dyn common::Delegate>,
15544    _additional_params: HashMap<String, String>,
15545    _scopes: BTreeSet<String>,
15546}
15547
15548impl<'a, C> common::CallBuilder for AccountCustomerDeleteCall<'a, C> {}
15549
15550impl<'a, C> AccountCustomerDeleteCall<'a, C>
15551where
15552    C: common::Connector,
15553{
15554    /// Perform the operation you have build so far.
15555    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleProtobufEmpty)> {
15556        use std::borrow::Cow;
15557        use std::io::{Read, Seek};
15558
15559        use common::{url::Params, ToParts};
15560        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15561
15562        let mut dd = common::DefaultDelegate;
15563        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15564        dlg.begin(common::MethodInfo {
15565            id: "cloudchannel.accounts.customers.delete",
15566            http_method: hyper::Method::DELETE,
15567        });
15568
15569        for &field in ["alt", "name"].iter() {
15570            if self._additional_params.contains_key(field) {
15571                dlg.finished(false);
15572                return Err(common::Error::FieldClash(field));
15573            }
15574        }
15575
15576        let mut params = Params::with_capacity(3 + self._additional_params.len());
15577        params.push("name", self._name);
15578
15579        params.extend(self._additional_params.iter());
15580
15581        params.push("alt", "json");
15582        let mut url = self.hub._base_url.clone() + "v1/{+name}";
15583        if self._scopes.is_empty() {
15584            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
15585        }
15586
15587        #[allow(clippy::single_element_loop)]
15588        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15589            url = params.uri_replacement(url, param_name, find_this, true);
15590        }
15591        {
15592            let to_remove = ["name"];
15593            params.remove_params(&to_remove);
15594        }
15595
15596        let url = params.parse_with_url(&url);
15597
15598        loop {
15599            let token = match self
15600                .hub
15601                .auth
15602                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15603                .await
15604            {
15605                Ok(token) => token,
15606                Err(e) => match dlg.token(e) {
15607                    Ok(token) => token,
15608                    Err(e) => {
15609                        dlg.finished(false);
15610                        return Err(common::Error::MissingToken(e));
15611                    }
15612                },
15613            };
15614            let mut req_result = {
15615                let client = &self.hub.client;
15616                dlg.pre_request();
15617                let mut req_builder = hyper::Request::builder()
15618                    .method(hyper::Method::DELETE)
15619                    .uri(url.as_str())
15620                    .header(USER_AGENT, self.hub._user_agent.clone());
15621
15622                if let Some(token) = token.as_ref() {
15623                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15624                }
15625
15626                let request = req_builder
15627                    .header(CONTENT_LENGTH, 0_u64)
15628                    .body(common::to_body::<String>(None));
15629
15630                client.request(request.unwrap()).await
15631            };
15632
15633            match req_result {
15634                Err(err) => {
15635                    if let common::Retry::After(d) = dlg.http_error(&err) {
15636                        sleep(d).await;
15637                        continue;
15638                    }
15639                    dlg.finished(false);
15640                    return Err(common::Error::HttpError(err));
15641                }
15642                Ok(res) => {
15643                    let (mut parts, body) = res.into_parts();
15644                    let mut body = common::Body::new(body);
15645                    if !parts.status.is_success() {
15646                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15647                        let error = serde_json::from_str(&common::to_string(&bytes));
15648                        let response = common::to_response(parts, bytes.into());
15649
15650                        if let common::Retry::After(d) =
15651                            dlg.http_failure(&response, error.as_ref().ok())
15652                        {
15653                            sleep(d).await;
15654                            continue;
15655                        }
15656
15657                        dlg.finished(false);
15658
15659                        return Err(match error {
15660                            Ok(value) => common::Error::BadRequest(value),
15661                            _ => common::Error::Failure(response),
15662                        });
15663                    }
15664                    let response = {
15665                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15666                        let encoded = common::to_string(&bytes);
15667                        match serde_json::from_str(&encoded) {
15668                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15669                            Err(error) => {
15670                                dlg.response_json_decode_error(&encoded, &error);
15671                                return Err(common::Error::JsonDecodeError(
15672                                    encoded.to_string(),
15673                                    error,
15674                                ));
15675                            }
15676                        }
15677                    };
15678
15679                    dlg.finished(true);
15680                    return Ok(response);
15681                }
15682            }
15683        }
15684    }
15685
15686    /// Required. The resource name of the customer to delete.
15687    ///
15688    /// Sets the *name* path property to the given value.
15689    ///
15690    /// Even though the property as already been set when instantiating this call,
15691    /// we provide this method for API completeness.
15692    pub fn name(mut self, new_value: &str) -> AccountCustomerDeleteCall<'a, C> {
15693        self._name = new_value.to_string();
15694        self
15695    }
15696    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15697    /// while executing the actual API request.
15698    ///
15699    /// ````text
15700    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15701    /// ````
15702    ///
15703    /// Sets the *delegate* property to the given value.
15704    pub fn delegate(
15705        mut self,
15706        new_value: &'a mut dyn common::Delegate,
15707    ) -> AccountCustomerDeleteCall<'a, C> {
15708        self._delegate = Some(new_value);
15709        self
15710    }
15711
15712    /// Set any additional parameter of the query string used in the request.
15713    /// It should be used to set parameters which are not yet available through their own
15714    /// setters.
15715    ///
15716    /// Please note that this method must not be used to set any of the known parameters
15717    /// which have their own setter method. If done anyway, the request will fail.
15718    ///
15719    /// # Additional Parameters
15720    ///
15721    /// * *$.xgafv* (query-string) - V1 error format.
15722    /// * *access_token* (query-string) - OAuth access token.
15723    /// * *alt* (query-string) - Data format for response.
15724    /// * *callback* (query-string) - JSONP
15725    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15726    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15727    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15728    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15729    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15730    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15731    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15732    pub fn param<T>(mut self, name: T, value: T) -> AccountCustomerDeleteCall<'a, C>
15733    where
15734        T: AsRef<str>,
15735    {
15736        self._additional_params
15737            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15738        self
15739    }
15740
15741    /// Identifies the authorization scope for the method you are building.
15742    ///
15743    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15744    /// [`Scope::AppOrder`].
15745    ///
15746    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15747    /// tokens for more than one scope.
15748    ///
15749    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15750    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15751    /// sufficient, a read-write scope will do as well.
15752    pub fn add_scope<St>(mut self, scope: St) -> AccountCustomerDeleteCall<'a, C>
15753    where
15754        St: AsRef<str>,
15755    {
15756        self._scopes.insert(String::from(scope.as_ref()));
15757        self
15758    }
15759    /// Identifies the authorization scope(s) for the method you are building.
15760    ///
15761    /// See [`Self::add_scope()`] for details.
15762    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountCustomerDeleteCall<'a, C>
15763    where
15764        I: IntoIterator<Item = St>,
15765        St: AsRef<str>,
15766    {
15767        self._scopes
15768            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15769        self
15770    }
15771
15772    /// Removes all scopes, and no default scope will be used either.
15773    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15774    /// for details).
15775    pub fn clear_scopes(mut self) -> AccountCustomerDeleteCall<'a, C> {
15776        self._scopes.clear();
15777        self
15778    }
15779}
15780
15781/// Returns the requested Customer resource. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The customer resource doesn't exist. Usually the result of an invalid name parameter. Return value: The Customer resource.
15782///
15783/// A builder for the *customers.get* method supported by a *account* resource.
15784/// It is not used directly, but through a [`AccountMethods`] instance.
15785///
15786/// # Example
15787///
15788/// Instantiate a resource method builder
15789///
15790/// ```test_harness,no_run
15791/// # extern crate hyper;
15792/// # extern crate hyper_rustls;
15793/// # extern crate google_cloudchannel1 as cloudchannel1;
15794/// # async fn dox() {
15795/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15796///
15797/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15798/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15799/// #     .with_native_roots()
15800/// #     .unwrap()
15801/// #     .https_only()
15802/// #     .enable_http2()
15803/// #     .build();
15804///
15805/// # let executor = hyper_util::rt::TokioExecutor::new();
15806/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15807/// #     secret,
15808/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15809/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15810/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15811/// #     ),
15812/// # ).build().await.unwrap();
15813///
15814/// # let client = hyper_util::client::legacy::Client::builder(
15815/// #     hyper_util::rt::TokioExecutor::new()
15816/// # )
15817/// # .build(
15818/// #     hyper_rustls::HttpsConnectorBuilder::new()
15819/// #         .with_native_roots()
15820/// #         .unwrap()
15821/// #         .https_or_http()
15822/// #         .enable_http2()
15823/// #         .build()
15824/// # );
15825/// # let mut hub = Cloudchannel::new(client, auth);
15826/// // You can configure optional parameters by calling the respective setters at will, and
15827/// // execute the final call using `doit()`.
15828/// // Values shown here are possibly random and not representative !
15829/// let result = hub.accounts().customers_get("name")
15830///              .doit().await;
15831/// # }
15832/// ```
15833pub struct AccountCustomerGetCall<'a, C>
15834where
15835    C: 'a,
15836{
15837    hub: &'a Cloudchannel<C>,
15838    _name: String,
15839    _delegate: Option<&'a mut dyn common::Delegate>,
15840    _additional_params: HashMap<String, String>,
15841    _scopes: BTreeSet<String>,
15842}
15843
15844impl<'a, C> common::CallBuilder for AccountCustomerGetCall<'a, C> {}
15845
15846impl<'a, C> AccountCustomerGetCall<'a, C>
15847where
15848    C: common::Connector,
15849{
15850    /// Perform the operation you have build so far.
15851    pub async fn doit(
15852        mut self,
15853    ) -> common::Result<(common::Response, GoogleCloudChannelV1Customer)> {
15854        use std::borrow::Cow;
15855        use std::io::{Read, Seek};
15856
15857        use common::{url::Params, ToParts};
15858        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15859
15860        let mut dd = common::DefaultDelegate;
15861        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15862        dlg.begin(common::MethodInfo {
15863            id: "cloudchannel.accounts.customers.get",
15864            http_method: hyper::Method::GET,
15865        });
15866
15867        for &field in ["alt", "name"].iter() {
15868            if self._additional_params.contains_key(field) {
15869                dlg.finished(false);
15870                return Err(common::Error::FieldClash(field));
15871            }
15872        }
15873
15874        let mut params = Params::with_capacity(3 + self._additional_params.len());
15875        params.push("name", self._name);
15876
15877        params.extend(self._additional_params.iter());
15878
15879        params.push("alt", "json");
15880        let mut url = self.hub._base_url.clone() + "v1/{+name}";
15881        if self._scopes.is_empty() {
15882            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
15883        }
15884
15885        #[allow(clippy::single_element_loop)]
15886        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15887            url = params.uri_replacement(url, param_name, find_this, true);
15888        }
15889        {
15890            let to_remove = ["name"];
15891            params.remove_params(&to_remove);
15892        }
15893
15894        let url = params.parse_with_url(&url);
15895
15896        loop {
15897            let token = match self
15898                .hub
15899                .auth
15900                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15901                .await
15902            {
15903                Ok(token) => token,
15904                Err(e) => match dlg.token(e) {
15905                    Ok(token) => token,
15906                    Err(e) => {
15907                        dlg.finished(false);
15908                        return Err(common::Error::MissingToken(e));
15909                    }
15910                },
15911            };
15912            let mut req_result = {
15913                let client = &self.hub.client;
15914                dlg.pre_request();
15915                let mut req_builder = hyper::Request::builder()
15916                    .method(hyper::Method::GET)
15917                    .uri(url.as_str())
15918                    .header(USER_AGENT, self.hub._user_agent.clone());
15919
15920                if let Some(token) = token.as_ref() {
15921                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15922                }
15923
15924                let request = req_builder
15925                    .header(CONTENT_LENGTH, 0_u64)
15926                    .body(common::to_body::<String>(None));
15927
15928                client.request(request.unwrap()).await
15929            };
15930
15931            match req_result {
15932                Err(err) => {
15933                    if let common::Retry::After(d) = dlg.http_error(&err) {
15934                        sleep(d).await;
15935                        continue;
15936                    }
15937                    dlg.finished(false);
15938                    return Err(common::Error::HttpError(err));
15939                }
15940                Ok(res) => {
15941                    let (mut parts, body) = res.into_parts();
15942                    let mut body = common::Body::new(body);
15943                    if !parts.status.is_success() {
15944                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15945                        let error = serde_json::from_str(&common::to_string(&bytes));
15946                        let response = common::to_response(parts, bytes.into());
15947
15948                        if let common::Retry::After(d) =
15949                            dlg.http_failure(&response, error.as_ref().ok())
15950                        {
15951                            sleep(d).await;
15952                            continue;
15953                        }
15954
15955                        dlg.finished(false);
15956
15957                        return Err(match error {
15958                            Ok(value) => common::Error::BadRequest(value),
15959                            _ => common::Error::Failure(response),
15960                        });
15961                    }
15962                    let response = {
15963                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15964                        let encoded = common::to_string(&bytes);
15965                        match serde_json::from_str(&encoded) {
15966                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15967                            Err(error) => {
15968                                dlg.response_json_decode_error(&encoded, &error);
15969                                return Err(common::Error::JsonDecodeError(
15970                                    encoded.to_string(),
15971                                    error,
15972                                ));
15973                            }
15974                        }
15975                    };
15976
15977                    dlg.finished(true);
15978                    return Ok(response);
15979                }
15980            }
15981        }
15982    }
15983
15984    /// Required. The resource name of the customer to retrieve. Name uses the format: accounts/{account_id}/customers/{customer_id}
15985    ///
15986    /// Sets the *name* path property to the given value.
15987    ///
15988    /// Even though the property as already been set when instantiating this call,
15989    /// we provide this method for API completeness.
15990    pub fn name(mut self, new_value: &str) -> AccountCustomerGetCall<'a, C> {
15991        self._name = new_value.to_string();
15992        self
15993    }
15994    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15995    /// while executing the actual API request.
15996    ///
15997    /// ````text
15998    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15999    /// ````
16000    ///
16001    /// Sets the *delegate* property to the given value.
16002    pub fn delegate(
16003        mut self,
16004        new_value: &'a mut dyn common::Delegate,
16005    ) -> AccountCustomerGetCall<'a, C> {
16006        self._delegate = Some(new_value);
16007        self
16008    }
16009
16010    /// Set any additional parameter of the query string used in the request.
16011    /// It should be used to set parameters which are not yet available through their own
16012    /// setters.
16013    ///
16014    /// Please note that this method must not be used to set any of the known parameters
16015    /// which have their own setter method. If done anyway, the request will fail.
16016    ///
16017    /// # Additional Parameters
16018    ///
16019    /// * *$.xgafv* (query-string) - V1 error format.
16020    /// * *access_token* (query-string) - OAuth access token.
16021    /// * *alt* (query-string) - Data format for response.
16022    /// * *callback* (query-string) - JSONP
16023    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16024    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16025    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16026    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16027    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16028    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16029    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16030    pub fn param<T>(mut self, name: T, value: T) -> AccountCustomerGetCall<'a, C>
16031    where
16032        T: AsRef<str>,
16033    {
16034        self._additional_params
16035            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16036        self
16037    }
16038
16039    /// Identifies the authorization scope for the method you are building.
16040    ///
16041    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16042    /// [`Scope::AppOrder`].
16043    ///
16044    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16045    /// tokens for more than one scope.
16046    ///
16047    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16048    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16049    /// sufficient, a read-write scope will do as well.
16050    pub fn add_scope<St>(mut self, scope: St) -> AccountCustomerGetCall<'a, C>
16051    where
16052        St: AsRef<str>,
16053    {
16054        self._scopes.insert(String::from(scope.as_ref()));
16055        self
16056    }
16057    /// Identifies the authorization scope(s) for the method you are building.
16058    ///
16059    /// See [`Self::add_scope()`] for details.
16060    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountCustomerGetCall<'a, C>
16061    where
16062        I: IntoIterator<Item = St>,
16063        St: AsRef<str>,
16064    {
16065        self._scopes
16066            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16067        self
16068    }
16069
16070    /// Removes all scopes, and no default scope will be used either.
16071    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16072    /// for details).
16073    pub fn clear_scopes(mut self) -> AccountCustomerGetCall<'a, C> {
16074        self._scopes.clear();
16075        self
16076    }
16077}
16078
16079/// Imports a Customer from the Cloud Identity associated with the provided Cloud Identity ID or domain before a TransferEntitlements call. If a linked Customer already exists and overwrite_if_exists is true, it will update that Customer's data. Possible error codes: * PERMISSION_DENIED: * The reseller account making the request is different from the reseller account in the API request. * You are not authorized to import the customer. See https://support.google.com/channelservices/answer/9759265 * NOT_FOUND: Cloud Identity doesn't exist or was deleted. * INVALID_ARGUMENT: Required parameters are missing, or the auth_token is expired or invalid. * ALREADY_EXISTS: A customer already exists and has conflicting critical fields. Requires an overwrite. Return value: The Customer.
16080///
16081/// A builder for the *customers.import* method supported by a *account* resource.
16082/// It is not used directly, but through a [`AccountMethods`] instance.
16083///
16084/// # Example
16085///
16086/// Instantiate a resource method builder
16087///
16088/// ```test_harness,no_run
16089/// # extern crate hyper;
16090/// # extern crate hyper_rustls;
16091/// # extern crate google_cloudchannel1 as cloudchannel1;
16092/// use cloudchannel1::api::GoogleCloudChannelV1ImportCustomerRequest;
16093/// # async fn dox() {
16094/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16095///
16096/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16097/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16098/// #     .with_native_roots()
16099/// #     .unwrap()
16100/// #     .https_only()
16101/// #     .enable_http2()
16102/// #     .build();
16103///
16104/// # let executor = hyper_util::rt::TokioExecutor::new();
16105/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16106/// #     secret,
16107/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16108/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16109/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16110/// #     ),
16111/// # ).build().await.unwrap();
16112///
16113/// # let client = hyper_util::client::legacy::Client::builder(
16114/// #     hyper_util::rt::TokioExecutor::new()
16115/// # )
16116/// # .build(
16117/// #     hyper_rustls::HttpsConnectorBuilder::new()
16118/// #         .with_native_roots()
16119/// #         .unwrap()
16120/// #         .https_or_http()
16121/// #         .enable_http2()
16122/// #         .build()
16123/// # );
16124/// # let mut hub = Cloudchannel::new(client, auth);
16125/// // As the method needs a request, you would usually fill it with the desired information
16126/// // into the respective structure. Some of the parts shown here might not be applicable !
16127/// // Values shown here are possibly random and not representative !
16128/// let mut req = GoogleCloudChannelV1ImportCustomerRequest::default();
16129///
16130/// // You can configure optional parameters by calling the respective setters at will, and
16131/// // execute the final call using `doit()`.
16132/// // Values shown here are possibly random and not representative !
16133/// let result = hub.accounts().customers_import(req, "parent")
16134///              .doit().await;
16135/// # }
16136/// ```
16137pub struct AccountCustomerImportCall<'a, C>
16138where
16139    C: 'a,
16140{
16141    hub: &'a Cloudchannel<C>,
16142    _request: GoogleCloudChannelV1ImportCustomerRequest,
16143    _parent: String,
16144    _delegate: Option<&'a mut dyn common::Delegate>,
16145    _additional_params: HashMap<String, String>,
16146    _scopes: BTreeSet<String>,
16147}
16148
16149impl<'a, C> common::CallBuilder for AccountCustomerImportCall<'a, C> {}
16150
16151impl<'a, C> AccountCustomerImportCall<'a, C>
16152where
16153    C: common::Connector,
16154{
16155    /// Perform the operation you have build so far.
16156    pub async fn doit(
16157        mut self,
16158    ) -> common::Result<(common::Response, GoogleCloudChannelV1Customer)> {
16159        use std::borrow::Cow;
16160        use std::io::{Read, Seek};
16161
16162        use common::{url::Params, ToParts};
16163        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16164
16165        let mut dd = common::DefaultDelegate;
16166        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16167        dlg.begin(common::MethodInfo {
16168            id: "cloudchannel.accounts.customers.import",
16169            http_method: hyper::Method::POST,
16170        });
16171
16172        for &field in ["alt", "parent"].iter() {
16173            if self._additional_params.contains_key(field) {
16174                dlg.finished(false);
16175                return Err(common::Error::FieldClash(field));
16176            }
16177        }
16178
16179        let mut params = Params::with_capacity(4 + self._additional_params.len());
16180        params.push("parent", self._parent);
16181
16182        params.extend(self._additional_params.iter());
16183
16184        params.push("alt", "json");
16185        let mut url = self.hub._base_url.clone() + "v1/{+parent}/customers:import";
16186        if self._scopes.is_empty() {
16187            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
16188        }
16189
16190        #[allow(clippy::single_element_loop)]
16191        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16192            url = params.uri_replacement(url, param_name, find_this, true);
16193        }
16194        {
16195            let to_remove = ["parent"];
16196            params.remove_params(&to_remove);
16197        }
16198
16199        let url = params.parse_with_url(&url);
16200
16201        let mut json_mime_type = mime::APPLICATION_JSON;
16202        let mut request_value_reader = {
16203            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16204            common::remove_json_null_values(&mut value);
16205            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16206            serde_json::to_writer(&mut dst, &value).unwrap();
16207            dst
16208        };
16209        let request_size = request_value_reader
16210            .seek(std::io::SeekFrom::End(0))
16211            .unwrap();
16212        request_value_reader
16213            .seek(std::io::SeekFrom::Start(0))
16214            .unwrap();
16215
16216        loop {
16217            let token = match self
16218                .hub
16219                .auth
16220                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16221                .await
16222            {
16223                Ok(token) => token,
16224                Err(e) => match dlg.token(e) {
16225                    Ok(token) => token,
16226                    Err(e) => {
16227                        dlg.finished(false);
16228                        return Err(common::Error::MissingToken(e));
16229                    }
16230                },
16231            };
16232            request_value_reader
16233                .seek(std::io::SeekFrom::Start(0))
16234                .unwrap();
16235            let mut req_result = {
16236                let client = &self.hub.client;
16237                dlg.pre_request();
16238                let mut req_builder = hyper::Request::builder()
16239                    .method(hyper::Method::POST)
16240                    .uri(url.as_str())
16241                    .header(USER_AGENT, self.hub._user_agent.clone());
16242
16243                if let Some(token) = token.as_ref() {
16244                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16245                }
16246
16247                let request = req_builder
16248                    .header(CONTENT_TYPE, json_mime_type.to_string())
16249                    .header(CONTENT_LENGTH, request_size as u64)
16250                    .body(common::to_body(
16251                        request_value_reader.get_ref().clone().into(),
16252                    ));
16253
16254                client.request(request.unwrap()).await
16255            };
16256
16257            match req_result {
16258                Err(err) => {
16259                    if let common::Retry::After(d) = dlg.http_error(&err) {
16260                        sleep(d).await;
16261                        continue;
16262                    }
16263                    dlg.finished(false);
16264                    return Err(common::Error::HttpError(err));
16265                }
16266                Ok(res) => {
16267                    let (mut parts, body) = res.into_parts();
16268                    let mut body = common::Body::new(body);
16269                    if !parts.status.is_success() {
16270                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16271                        let error = serde_json::from_str(&common::to_string(&bytes));
16272                        let response = common::to_response(parts, bytes.into());
16273
16274                        if let common::Retry::After(d) =
16275                            dlg.http_failure(&response, error.as_ref().ok())
16276                        {
16277                            sleep(d).await;
16278                            continue;
16279                        }
16280
16281                        dlg.finished(false);
16282
16283                        return Err(match error {
16284                            Ok(value) => common::Error::BadRequest(value),
16285                            _ => common::Error::Failure(response),
16286                        });
16287                    }
16288                    let response = {
16289                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16290                        let encoded = common::to_string(&bytes);
16291                        match serde_json::from_str(&encoded) {
16292                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16293                            Err(error) => {
16294                                dlg.response_json_decode_error(&encoded, &error);
16295                                return Err(common::Error::JsonDecodeError(
16296                                    encoded.to_string(),
16297                                    error,
16298                                ));
16299                            }
16300                        }
16301                    };
16302
16303                    dlg.finished(true);
16304                    return Ok(response);
16305                }
16306            }
16307        }
16308    }
16309
16310    ///
16311    /// Sets the *request* property to the given value.
16312    ///
16313    /// Even though the property as already been set when instantiating this call,
16314    /// we provide this method for API completeness.
16315    pub fn request(
16316        mut self,
16317        new_value: GoogleCloudChannelV1ImportCustomerRequest,
16318    ) -> AccountCustomerImportCall<'a, C> {
16319        self._request = new_value;
16320        self
16321    }
16322    /// Required. The resource name of the reseller's account. Parent takes the format: accounts/{account_id} or accounts/{account_id}/channelPartnerLinks/{channel_partner_id}
16323    ///
16324    /// Sets the *parent* path property to the given value.
16325    ///
16326    /// Even though the property as already been set when instantiating this call,
16327    /// we provide this method for API completeness.
16328    pub fn parent(mut self, new_value: &str) -> AccountCustomerImportCall<'a, C> {
16329        self._parent = new_value.to_string();
16330        self
16331    }
16332    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16333    /// while executing the actual API request.
16334    ///
16335    /// ````text
16336    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16337    /// ````
16338    ///
16339    /// Sets the *delegate* property to the given value.
16340    pub fn delegate(
16341        mut self,
16342        new_value: &'a mut dyn common::Delegate,
16343    ) -> AccountCustomerImportCall<'a, C> {
16344        self._delegate = Some(new_value);
16345        self
16346    }
16347
16348    /// Set any additional parameter of the query string used in the request.
16349    /// It should be used to set parameters which are not yet available through their own
16350    /// setters.
16351    ///
16352    /// Please note that this method must not be used to set any of the known parameters
16353    /// which have their own setter method. If done anyway, the request will fail.
16354    ///
16355    /// # Additional Parameters
16356    ///
16357    /// * *$.xgafv* (query-string) - V1 error format.
16358    /// * *access_token* (query-string) - OAuth access token.
16359    /// * *alt* (query-string) - Data format for response.
16360    /// * *callback* (query-string) - JSONP
16361    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16362    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16363    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16364    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16365    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16366    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16367    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16368    pub fn param<T>(mut self, name: T, value: T) -> AccountCustomerImportCall<'a, C>
16369    where
16370        T: AsRef<str>,
16371    {
16372        self._additional_params
16373            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16374        self
16375    }
16376
16377    /// Identifies the authorization scope for the method you are building.
16378    ///
16379    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16380    /// [`Scope::AppOrder`].
16381    ///
16382    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16383    /// tokens for more than one scope.
16384    ///
16385    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16386    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16387    /// sufficient, a read-write scope will do as well.
16388    pub fn add_scope<St>(mut self, scope: St) -> AccountCustomerImportCall<'a, C>
16389    where
16390        St: AsRef<str>,
16391    {
16392        self._scopes.insert(String::from(scope.as_ref()));
16393        self
16394    }
16395    /// Identifies the authorization scope(s) for the method you are building.
16396    ///
16397    /// See [`Self::add_scope()`] for details.
16398    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountCustomerImportCall<'a, C>
16399    where
16400        I: IntoIterator<Item = St>,
16401        St: AsRef<str>,
16402    {
16403        self._scopes
16404            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16405        self
16406    }
16407
16408    /// Removes all scopes, and no default scope will be used either.
16409    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16410    /// for details).
16411    pub fn clear_scopes(mut self) -> AccountCustomerImportCall<'a, C> {
16412        self._scopes.clear();
16413        self
16414    }
16415}
16416
16417/// List Customers. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. Return value: List of Customers, or an empty list if there are no customers.
16418///
16419/// A builder for the *customers.list* method supported by a *account* resource.
16420/// It is not used directly, but through a [`AccountMethods`] instance.
16421///
16422/// # Example
16423///
16424/// Instantiate a resource method builder
16425///
16426/// ```test_harness,no_run
16427/// # extern crate hyper;
16428/// # extern crate hyper_rustls;
16429/// # extern crate google_cloudchannel1 as cloudchannel1;
16430/// # async fn dox() {
16431/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16432///
16433/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16434/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16435/// #     .with_native_roots()
16436/// #     .unwrap()
16437/// #     .https_only()
16438/// #     .enable_http2()
16439/// #     .build();
16440///
16441/// # let executor = hyper_util::rt::TokioExecutor::new();
16442/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16443/// #     secret,
16444/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16445/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16446/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16447/// #     ),
16448/// # ).build().await.unwrap();
16449///
16450/// # let client = hyper_util::client::legacy::Client::builder(
16451/// #     hyper_util::rt::TokioExecutor::new()
16452/// # )
16453/// # .build(
16454/// #     hyper_rustls::HttpsConnectorBuilder::new()
16455/// #         .with_native_roots()
16456/// #         .unwrap()
16457/// #         .https_or_http()
16458/// #         .enable_http2()
16459/// #         .build()
16460/// # );
16461/// # let mut hub = Cloudchannel::new(client, auth);
16462/// // You can configure optional parameters by calling the respective setters at will, and
16463/// // execute the final call using `doit()`.
16464/// // Values shown here are possibly random and not representative !
16465/// let result = hub.accounts().customers_list("parent")
16466///              .page_token("dolor")
16467///              .page_size(-18)
16468///              .filter("et")
16469///              .doit().await;
16470/// # }
16471/// ```
16472pub struct AccountCustomerListCall<'a, C>
16473where
16474    C: 'a,
16475{
16476    hub: &'a Cloudchannel<C>,
16477    _parent: String,
16478    _page_token: Option<String>,
16479    _page_size: Option<i32>,
16480    _filter: Option<String>,
16481    _delegate: Option<&'a mut dyn common::Delegate>,
16482    _additional_params: HashMap<String, String>,
16483    _scopes: BTreeSet<String>,
16484}
16485
16486impl<'a, C> common::CallBuilder for AccountCustomerListCall<'a, C> {}
16487
16488impl<'a, C> AccountCustomerListCall<'a, C>
16489where
16490    C: common::Connector,
16491{
16492    /// Perform the operation you have build so far.
16493    pub async fn doit(
16494        mut self,
16495    ) -> common::Result<(common::Response, GoogleCloudChannelV1ListCustomersResponse)> {
16496        use std::borrow::Cow;
16497        use std::io::{Read, Seek};
16498
16499        use common::{url::Params, ToParts};
16500        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16501
16502        let mut dd = common::DefaultDelegate;
16503        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16504        dlg.begin(common::MethodInfo {
16505            id: "cloudchannel.accounts.customers.list",
16506            http_method: hyper::Method::GET,
16507        });
16508
16509        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
16510            if self._additional_params.contains_key(field) {
16511                dlg.finished(false);
16512                return Err(common::Error::FieldClash(field));
16513            }
16514        }
16515
16516        let mut params = Params::with_capacity(6 + self._additional_params.len());
16517        params.push("parent", self._parent);
16518        if let Some(value) = self._page_token.as_ref() {
16519            params.push("pageToken", value);
16520        }
16521        if let Some(value) = self._page_size.as_ref() {
16522            params.push("pageSize", value.to_string());
16523        }
16524        if let Some(value) = self._filter.as_ref() {
16525            params.push("filter", value);
16526        }
16527
16528        params.extend(self._additional_params.iter());
16529
16530        params.push("alt", "json");
16531        let mut url = self.hub._base_url.clone() + "v1/{+parent}/customers";
16532        if self._scopes.is_empty() {
16533            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
16534        }
16535
16536        #[allow(clippy::single_element_loop)]
16537        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16538            url = params.uri_replacement(url, param_name, find_this, true);
16539        }
16540        {
16541            let to_remove = ["parent"];
16542            params.remove_params(&to_remove);
16543        }
16544
16545        let url = params.parse_with_url(&url);
16546
16547        loop {
16548            let token = match self
16549                .hub
16550                .auth
16551                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16552                .await
16553            {
16554                Ok(token) => token,
16555                Err(e) => match dlg.token(e) {
16556                    Ok(token) => token,
16557                    Err(e) => {
16558                        dlg.finished(false);
16559                        return Err(common::Error::MissingToken(e));
16560                    }
16561                },
16562            };
16563            let mut req_result = {
16564                let client = &self.hub.client;
16565                dlg.pre_request();
16566                let mut req_builder = hyper::Request::builder()
16567                    .method(hyper::Method::GET)
16568                    .uri(url.as_str())
16569                    .header(USER_AGENT, self.hub._user_agent.clone());
16570
16571                if let Some(token) = token.as_ref() {
16572                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16573                }
16574
16575                let request = req_builder
16576                    .header(CONTENT_LENGTH, 0_u64)
16577                    .body(common::to_body::<String>(None));
16578
16579                client.request(request.unwrap()).await
16580            };
16581
16582            match req_result {
16583                Err(err) => {
16584                    if let common::Retry::After(d) = dlg.http_error(&err) {
16585                        sleep(d).await;
16586                        continue;
16587                    }
16588                    dlg.finished(false);
16589                    return Err(common::Error::HttpError(err));
16590                }
16591                Ok(res) => {
16592                    let (mut parts, body) = res.into_parts();
16593                    let mut body = common::Body::new(body);
16594                    if !parts.status.is_success() {
16595                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16596                        let error = serde_json::from_str(&common::to_string(&bytes));
16597                        let response = common::to_response(parts, bytes.into());
16598
16599                        if let common::Retry::After(d) =
16600                            dlg.http_failure(&response, error.as_ref().ok())
16601                        {
16602                            sleep(d).await;
16603                            continue;
16604                        }
16605
16606                        dlg.finished(false);
16607
16608                        return Err(match error {
16609                            Ok(value) => common::Error::BadRequest(value),
16610                            _ => common::Error::Failure(response),
16611                        });
16612                    }
16613                    let response = {
16614                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16615                        let encoded = common::to_string(&bytes);
16616                        match serde_json::from_str(&encoded) {
16617                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16618                            Err(error) => {
16619                                dlg.response_json_decode_error(&encoded, &error);
16620                                return Err(common::Error::JsonDecodeError(
16621                                    encoded.to_string(),
16622                                    error,
16623                                ));
16624                            }
16625                        }
16626                    };
16627
16628                    dlg.finished(true);
16629                    return Ok(response);
16630                }
16631            }
16632        }
16633    }
16634
16635    /// Required. The resource name of the reseller account to list customers from. Parent uses the format: accounts/{account_id}.
16636    ///
16637    /// Sets the *parent* path property to the given value.
16638    ///
16639    /// Even though the property as already been set when instantiating this call,
16640    /// we provide this method for API completeness.
16641    pub fn parent(mut self, new_value: &str) -> AccountCustomerListCall<'a, C> {
16642        self._parent = new_value.to_string();
16643        self
16644    }
16645    /// Optional. A token identifying a page of results other than the first page. Obtained through ListCustomersResponse.next_page_token of the previous CloudChannelService.ListCustomers call.
16646    ///
16647    /// Sets the *page token* query property to the given value.
16648    pub fn page_token(mut self, new_value: &str) -> AccountCustomerListCall<'a, C> {
16649        self._page_token = Some(new_value.to_string());
16650        self
16651    }
16652    /// Optional. The maximum number of customers to return. The service may return fewer than this value. If unspecified, returns at most 10 customers. The maximum value is 50.
16653    ///
16654    /// Sets the *page size* query property to the given value.
16655    pub fn page_size(mut self, new_value: i32) -> AccountCustomerListCall<'a, C> {
16656        self._page_size = Some(new_value);
16657        self
16658    }
16659    /// Optional. Filters applied to the [CloudChannelService.ListCustomers] results. See https://cloud.google.com/channel/docs/concepts/google-cloud/filter-customers for more information.
16660    ///
16661    /// Sets the *filter* query property to the given value.
16662    pub fn filter(mut self, new_value: &str) -> AccountCustomerListCall<'a, C> {
16663        self._filter = Some(new_value.to_string());
16664        self
16665    }
16666    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16667    /// while executing the actual API request.
16668    ///
16669    /// ````text
16670    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16671    /// ````
16672    ///
16673    /// Sets the *delegate* property to the given value.
16674    pub fn delegate(
16675        mut self,
16676        new_value: &'a mut dyn common::Delegate,
16677    ) -> AccountCustomerListCall<'a, C> {
16678        self._delegate = Some(new_value);
16679        self
16680    }
16681
16682    /// Set any additional parameter of the query string used in the request.
16683    /// It should be used to set parameters which are not yet available through their own
16684    /// setters.
16685    ///
16686    /// Please note that this method must not be used to set any of the known parameters
16687    /// which have their own setter method. If done anyway, the request will fail.
16688    ///
16689    /// # Additional Parameters
16690    ///
16691    /// * *$.xgafv* (query-string) - V1 error format.
16692    /// * *access_token* (query-string) - OAuth access token.
16693    /// * *alt* (query-string) - Data format for response.
16694    /// * *callback* (query-string) - JSONP
16695    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16696    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16697    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16698    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16699    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16700    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16701    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16702    pub fn param<T>(mut self, name: T, value: T) -> AccountCustomerListCall<'a, C>
16703    where
16704        T: AsRef<str>,
16705    {
16706        self._additional_params
16707            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16708        self
16709    }
16710
16711    /// Identifies the authorization scope for the method you are building.
16712    ///
16713    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16714    /// [`Scope::AppOrder`].
16715    ///
16716    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16717    /// tokens for more than one scope.
16718    ///
16719    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16720    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16721    /// sufficient, a read-write scope will do as well.
16722    pub fn add_scope<St>(mut self, scope: St) -> AccountCustomerListCall<'a, C>
16723    where
16724        St: AsRef<str>,
16725    {
16726        self._scopes.insert(String::from(scope.as_ref()));
16727        self
16728    }
16729    /// Identifies the authorization scope(s) for the method you are building.
16730    ///
16731    /// See [`Self::add_scope()`] for details.
16732    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountCustomerListCall<'a, C>
16733    where
16734        I: IntoIterator<Item = St>,
16735        St: AsRef<str>,
16736    {
16737        self._scopes
16738            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16739        self
16740    }
16741
16742    /// Removes all scopes, and no default scope will be used either.
16743    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16744    /// for details).
16745    pub fn clear_scopes(mut self) -> AccountCustomerListCall<'a, C> {
16746        self._scopes.clear();
16747        self
16748    }
16749}
16750
16751/// Lists the following: * Offers that you can purchase for a customer. * Offers that you can change for an entitlement. Possible error codes: * PERMISSION_DENIED: * The customer doesn't belong to the reseller * The reseller is not authorized to transact on this Product. See https://support.google.com/channelservices/answer/9759265 * INVALID_ARGUMENT: Required request parameters are missing or invalid.
16752///
16753/// A builder for the *customers.listPurchasableOffers* method supported by a *account* resource.
16754/// It is not used directly, but through a [`AccountMethods`] instance.
16755///
16756/// # Example
16757///
16758/// Instantiate a resource method builder
16759///
16760/// ```test_harness,no_run
16761/// # extern crate hyper;
16762/// # extern crate hyper_rustls;
16763/// # extern crate google_cloudchannel1 as cloudchannel1;
16764/// # async fn dox() {
16765/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16766///
16767/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16768/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16769/// #     .with_native_roots()
16770/// #     .unwrap()
16771/// #     .https_only()
16772/// #     .enable_http2()
16773/// #     .build();
16774///
16775/// # let executor = hyper_util::rt::TokioExecutor::new();
16776/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16777/// #     secret,
16778/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16779/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16780/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16781/// #     ),
16782/// # ).build().await.unwrap();
16783///
16784/// # let client = hyper_util::client::legacy::Client::builder(
16785/// #     hyper_util::rt::TokioExecutor::new()
16786/// # )
16787/// # .build(
16788/// #     hyper_rustls::HttpsConnectorBuilder::new()
16789/// #         .with_native_roots()
16790/// #         .unwrap()
16791/// #         .https_or_http()
16792/// #         .enable_http2()
16793/// #         .build()
16794/// # );
16795/// # let mut hub = Cloudchannel::new(client, auth);
16796/// // You can configure optional parameters by calling the respective setters at will, and
16797/// // execute the final call using `doit()`.
16798/// // Values shown here are possibly random and not representative !
16799/// let result = hub.accounts().customers_list_purchasable_offers("customer")
16800///              .page_token("Stet")
16801///              .page_size(-99)
16802///              .language_code("duo")
16803///              .create_entitlement_purchase_sku("vero")
16804///              .create_entitlement_purchase_billing_account("vero")
16805///              .change_offer_purchase_new_sku("invidunt")
16806///              .change_offer_purchase_entitlement("Stet")
16807///              .change_offer_purchase_billing_account("vero")
16808///              .doit().await;
16809/// # }
16810/// ```
16811pub struct AccountCustomerListPurchasableOfferCall<'a, C>
16812where
16813    C: 'a,
16814{
16815    hub: &'a Cloudchannel<C>,
16816    _customer: String,
16817    _page_token: Option<String>,
16818    _page_size: Option<i32>,
16819    _language_code: Option<String>,
16820    _create_entitlement_purchase_sku: Option<String>,
16821    _create_entitlement_purchase_billing_account: Option<String>,
16822    _change_offer_purchase_new_sku: Option<String>,
16823    _change_offer_purchase_entitlement: Option<String>,
16824    _change_offer_purchase_billing_account: Option<String>,
16825    _delegate: Option<&'a mut dyn common::Delegate>,
16826    _additional_params: HashMap<String, String>,
16827    _scopes: BTreeSet<String>,
16828}
16829
16830impl<'a, C> common::CallBuilder for AccountCustomerListPurchasableOfferCall<'a, C> {}
16831
16832impl<'a, C> AccountCustomerListPurchasableOfferCall<'a, C>
16833where
16834    C: common::Connector,
16835{
16836    /// Perform the operation you have build so far.
16837    pub async fn doit(
16838        mut self,
16839    ) -> common::Result<(
16840        common::Response,
16841        GoogleCloudChannelV1ListPurchasableOffersResponse,
16842    )> {
16843        use std::borrow::Cow;
16844        use std::io::{Read, Seek};
16845
16846        use common::{url::Params, ToParts};
16847        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16848
16849        let mut dd = common::DefaultDelegate;
16850        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16851        dlg.begin(common::MethodInfo {
16852            id: "cloudchannel.accounts.customers.listPurchasableOffers",
16853            http_method: hyper::Method::GET,
16854        });
16855
16856        for &field in [
16857            "alt",
16858            "customer",
16859            "pageToken",
16860            "pageSize",
16861            "languageCode",
16862            "createEntitlementPurchase.sku",
16863            "createEntitlementPurchase.billingAccount",
16864            "changeOfferPurchase.newSku",
16865            "changeOfferPurchase.entitlement",
16866            "changeOfferPurchase.billingAccount",
16867        ]
16868        .iter()
16869        {
16870            if self._additional_params.contains_key(field) {
16871                dlg.finished(false);
16872                return Err(common::Error::FieldClash(field));
16873            }
16874        }
16875
16876        let mut params = Params::with_capacity(11 + self._additional_params.len());
16877        params.push("customer", self._customer);
16878        if let Some(value) = self._page_token.as_ref() {
16879            params.push("pageToken", value);
16880        }
16881        if let Some(value) = self._page_size.as_ref() {
16882            params.push("pageSize", value.to_string());
16883        }
16884        if let Some(value) = self._language_code.as_ref() {
16885            params.push("languageCode", value);
16886        }
16887        if let Some(value) = self._create_entitlement_purchase_sku.as_ref() {
16888            params.push("createEntitlementPurchase.sku", value);
16889        }
16890        if let Some(value) = self._create_entitlement_purchase_billing_account.as_ref() {
16891            params.push("createEntitlementPurchase.billingAccount", value);
16892        }
16893        if let Some(value) = self._change_offer_purchase_new_sku.as_ref() {
16894            params.push("changeOfferPurchase.newSku", value);
16895        }
16896        if let Some(value) = self._change_offer_purchase_entitlement.as_ref() {
16897            params.push("changeOfferPurchase.entitlement", value);
16898        }
16899        if let Some(value) = self._change_offer_purchase_billing_account.as_ref() {
16900            params.push("changeOfferPurchase.billingAccount", value);
16901        }
16902
16903        params.extend(self._additional_params.iter());
16904
16905        params.push("alt", "json");
16906        let mut url = self.hub._base_url.clone() + "v1/{+customer}:listPurchasableOffers";
16907        if self._scopes.is_empty() {
16908            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
16909        }
16910
16911        #[allow(clippy::single_element_loop)]
16912        for &(find_this, param_name) in [("{+customer}", "customer")].iter() {
16913            url = params.uri_replacement(url, param_name, find_this, true);
16914        }
16915        {
16916            let to_remove = ["customer"];
16917            params.remove_params(&to_remove);
16918        }
16919
16920        let url = params.parse_with_url(&url);
16921
16922        loop {
16923            let token = match self
16924                .hub
16925                .auth
16926                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16927                .await
16928            {
16929                Ok(token) => token,
16930                Err(e) => match dlg.token(e) {
16931                    Ok(token) => token,
16932                    Err(e) => {
16933                        dlg.finished(false);
16934                        return Err(common::Error::MissingToken(e));
16935                    }
16936                },
16937            };
16938            let mut req_result = {
16939                let client = &self.hub.client;
16940                dlg.pre_request();
16941                let mut req_builder = hyper::Request::builder()
16942                    .method(hyper::Method::GET)
16943                    .uri(url.as_str())
16944                    .header(USER_AGENT, self.hub._user_agent.clone());
16945
16946                if let Some(token) = token.as_ref() {
16947                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16948                }
16949
16950                let request = req_builder
16951                    .header(CONTENT_LENGTH, 0_u64)
16952                    .body(common::to_body::<String>(None));
16953
16954                client.request(request.unwrap()).await
16955            };
16956
16957            match req_result {
16958                Err(err) => {
16959                    if let common::Retry::After(d) = dlg.http_error(&err) {
16960                        sleep(d).await;
16961                        continue;
16962                    }
16963                    dlg.finished(false);
16964                    return Err(common::Error::HttpError(err));
16965                }
16966                Ok(res) => {
16967                    let (mut parts, body) = res.into_parts();
16968                    let mut body = common::Body::new(body);
16969                    if !parts.status.is_success() {
16970                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16971                        let error = serde_json::from_str(&common::to_string(&bytes));
16972                        let response = common::to_response(parts, bytes.into());
16973
16974                        if let common::Retry::After(d) =
16975                            dlg.http_failure(&response, error.as_ref().ok())
16976                        {
16977                            sleep(d).await;
16978                            continue;
16979                        }
16980
16981                        dlg.finished(false);
16982
16983                        return Err(match error {
16984                            Ok(value) => common::Error::BadRequest(value),
16985                            _ => common::Error::Failure(response),
16986                        });
16987                    }
16988                    let response = {
16989                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16990                        let encoded = common::to_string(&bytes);
16991                        match serde_json::from_str(&encoded) {
16992                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16993                            Err(error) => {
16994                                dlg.response_json_decode_error(&encoded, &error);
16995                                return Err(common::Error::JsonDecodeError(
16996                                    encoded.to_string(),
16997                                    error,
16998                                ));
16999                            }
17000                        }
17001                    };
17002
17003                    dlg.finished(true);
17004                    return Ok(response);
17005                }
17006            }
17007        }
17008    }
17009
17010    /// Required. The resource name of the customer to list Offers for. Format: accounts/{account_id}/customers/{customer_id}.
17011    ///
17012    /// Sets the *customer* path property to the given value.
17013    ///
17014    /// Even though the property as already been set when instantiating this call,
17015    /// we provide this method for API completeness.
17016    pub fn customer(mut self, new_value: &str) -> AccountCustomerListPurchasableOfferCall<'a, C> {
17017        self._customer = new_value.to_string();
17018        self
17019    }
17020    /// Optional. A token for a page of results other than the first page.
17021    ///
17022    /// Sets the *page token* query property to the given value.
17023    pub fn page_token(mut self, new_value: &str) -> AccountCustomerListPurchasableOfferCall<'a, C> {
17024        self._page_token = Some(new_value.to_string());
17025        self
17026    }
17027    /// Optional. Requested page size. Server might return fewer results than requested. If unspecified, returns at most 100 Offers. The maximum value is 1000; the server will coerce values above 1000.
17028    ///
17029    /// Sets the *page size* query property to the given value.
17030    pub fn page_size(mut self, new_value: i32) -> AccountCustomerListPurchasableOfferCall<'a, C> {
17031        self._page_size = Some(new_value);
17032        self
17033    }
17034    /// Optional. The BCP-47 language code. For example, "en-US". The response will localize in the corresponding language code, if specified. The default value is "en-US".
17035    ///
17036    /// Sets the *language code* query property to the given value.
17037    pub fn language_code(
17038        mut self,
17039        new_value: &str,
17040    ) -> AccountCustomerListPurchasableOfferCall<'a, C> {
17041        self._language_code = Some(new_value.to_string());
17042        self
17043    }
17044    /// Required. SKU that the result should be restricted to. Format: products/{product_id}/skus/{sku_id}.
17045    ///
17046    /// Sets the *create entitlement purchase.sku* query property to the given value.
17047    pub fn create_entitlement_purchase_sku(
17048        mut self,
17049        new_value: &str,
17050    ) -> AccountCustomerListPurchasableOfferCall<'a, C> {
17051        self._create_entitlement_purchase_sku = Some(new_value.to_string());
17052        self
17053    }
17054    /// Optional. Billing account that the result should be restricted to. Format: accounts/{account_id}/billingAccounts/{billing_account_id}.
17055    ///
17056    /// Sets the *create entitlement purchase.billing account* query property to the given value.
17057    pub fn create_entitlement_purchase_billing_account(
17058        mut self,
17059        new_value: &str,
17060    ) -> AccountCustomerListPurchasableOfferCall<'a, C> {
17061        self._create_entitlement_purchase_billing_account = Some(new_value.to_string());
17062        self
17063    }
17064    /// Optional. Resource name of the new target SKU. Provide this SKU when upgrading or downgrading an entitlement. Format: products/{product_id}/skus/{sku_id}
17065    ///
17066    /// Sets the *change offer purchase.new sku* query property to the given value.
17067    pub fn change_offer_purchase_new_sku(
17068        mut self,
17069        new_value: &str,
17070    ) -> AccountCustomerListPurchasableOfferCall<'a, C> {
17071        self._change_offer_purchase_new_sku = Some(new_value.to_string());
17072        self
17073    }
17074    /// Required. Resource name of the entitlement. Format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
17075    ///
17076    /// Sets the *change offer purchase.entitlement* query property to the given value.
17077    pub fn change_offer_purchase_entitlement(
17078        mut self,
17079        new_value: &str,
17080    ) -> AccountCustomerListPurchasableOfferCall<'a, C> {
17081        self._change_offer_purchase_entitlement = Some(new_value.to_string());
17082        self
17083    }
17084    /// Optional. Resource name of the new target Billing Account. Provide this Billing Account when setting up billing for a trial subscription. Format: accounts/{account_id}/billingAccounts/{billing_account_id}. This field is only relevant for multi-currency accounts. It should be left empty for single currency accounts.
17085    ///
17086    /// Sets the *change offer purchase.billing account* query property to the given value.
17087    pub fn change_offer_purchase_billing_account(
17088        mut self,
17089        new_value: &str,
17090    ) -> AccountCustomerListPurchasableOfferCall<'a, C> {
17091        self._change_offer_purchase_billing_account = Some(new_value.to_string());
17092        self
17093    }
17094    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17095    /// while executing the actual API request.
17096    ///
17097    /// ````text
17098    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17099    /// ````
17100    ///
17101    /// Sets the *delegate* property to the given value.
17102    pub fn delegate(
17103        mut self,
17104        new_value: &'a mut dyn common::Delegate,
17105    ) -> AccountCustomerListPurchasableOfferCall<'a, C> {
17106        self._delegate = Some(new_value);
17107        self
17108    }
17109
17110    /// Set any additional parameter of the query string used in the request.
17111    /// It should be used to set parameters which are not yet available through their own
17112    /// setters.
17113    ///
17114    /// Please note that this method must not be used to set any of the known parameters
17115    /// which have their own setter method. If done anyway, the request will fail.
17116    ///
17117    /// # Additional Parameters
17118    ///
17119    /// * *$.xgafv* (query-string) - V1 error format.
17120    /// * *access_token* (query-string) - OAuth access token.
17121    /// * *alt* (query-string) - Data format for response.
17122    /// * *callback* (query-string) - JSONP
17123    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17124    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17125    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17126    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17127    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17128    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17129    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17130    pub fn param<T>(mut self, name: T, value: T) -> AccountCustomerListPurchasableOfferCall<'a, C>
17131    where
17132        T: AsRef<str>,
17133    {
17134        self._additional_params
17135            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17136        self
17137    }
17138
17139    /// Identifies the authorization scope for the method you are building.
17140    ///
17141    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17142    /// [`Scope::AppOrder`].
17143    ///
17144    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17145    /// tokens for more than one scope.
17146    ///
17147    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17148    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17149    /// sufficient, a read-write scope will do as well.
17150    pub fn add_scope<St>(mut self, scope: St) -> AccountCustomerListPurchasableOfferCall<'a, C>
17151    where
17152        St: AsRef<str>,
17153    {
17154        self._scopes.insert(String::from(scope.as_ref()));
17155        self
17156    }
17157    /// Identifies the authorization scope(s) for the method you are building.
17158    ///
17159    /// See [`Self::add_scope()`] for details.
17160    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountCustomerListPurchasableOfferCall<'a, C>
17161    where
17162        I: IntoIterator<Item = St>,
17163        St: AsRef<str>,
17164    {
17165        self._scopes
17166            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17167        self
17168    }
17169
17170    /// Removes all scopes, and no default scope will be used either.
17171    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17172    /// for details).
17173    pub fn clear_scopes(mut self) -> AccountCustomerListPurchasableOfferCall<'a, C> {
17174        self._scopes.clear();
17175        self
17176    }
17177}
17178
17179/// Lists the following: * SKUs that you can purchase for a customer * SKUs that you can upgrade or downgrade for an entitlement. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid.
17180///
17181/// A builder for the *customers.listPurchasableSkus* method supported by a *account* resource.
17182/// It is not used directly, but through a [`AccountMethods`] instance.
17183///
17184/// # Example
17185///
17186/// Instantiate a resource method builder
17187///
17188/// ```test_harness,no_run
17189/// # extern crate hyper;
17190/// # extern crate hyper_rustls;
17191/// # extern crate google_cloudchannel1 as cloudchannel1;
17192/// # async fn dox() {
17193/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17194///
17195/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17196/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17197/// #     .with_native_roots()
17198/// #     .unwrap()
17199/// #     .https_only()
17200/// #     .enable_http2()
17201/// #     .build();
17202///
17203/// # let executor = hyper_util::rt::TokioExecutor::new();
17204/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17205/// #     secret,
17206/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17207/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17208/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17209/// #     ),
17210/// # ).build().await.unwrap();
17211///
17212/// # let client = hyper_util::client::legacy::Client::builder(
17213/// #     hyper_util::rt::TokioExecutor::new()
17214/// # )
17215/// # .build(
17216/// #     hyper_rustls::HttpsConnectorBuilder::new()
17217/// #         .with_native_roots()
17218/// #         .unwrap()
17219/// #         .https_or_http()
17220/// #         .enable_http2()
17221/// #         .build()
17222/// # );
17223/// # let mut hub = Cloudchannel::new(client, auth);
17224/// // You can configure optional parameters by calling the respective setters at will, and
17225/// // execute the final call using `doit()`.
17226/// // Values shown here are possibly random and not representative !
17227/// let result = hub.accounts().customers_list_purchasable_skus("customer")
17228///              .page_token("Lorem")
17229///              .page_size(-29)
17230///              .language_code("no")
17231///              .create_entitlement_purchase_product("ipsum")
17232///              .change_offer_purchase_entitlement("accusam")
17233///              .change_offer_purchase_change_type("takimata")
17234///              .doit().await;
17235/// # }
17236/// ```
17237pub struct AccountCustomerListPurchasableSkuCall<'a, C>
17238where
17239    C: 'a,
17240{
17241    hub: &'a Cloudchannel<C>,
17242    _customer: String,
17243    _page_token: Option<String>,
17244    _page_size: Option<i32>,
17245    _language_code: Option<String>,
17246    _create_entitlement_purchase_product: Option<String>,
17247    _change_offer_purchase_entitlement: Option<String>,
17248    _change_offer_purchase_change_type: Option<String>,
17249    _delegate: Option<&'a mut dyn common::Delegate>,
17250    _additional_params: HashMap<String, String>,
17251    _scopes: BTreeSet<String>,
17252}
17253
17254impl<'a, C> common::CallBuilder for AccountCustomerListPurchasableSkuCall<'a, C> {}
17255
17256impl<'a, C> AccountCustomerListPurchasableSkuCall<'a, C>
17257where
17258    C: common::Connector,
17259{
17260    /// Perform the operation you have build so far.
17261    pub async fn doit(
17262        mut self,
17263    ) -> common::Result<(
17264        common::Response,
17265        GoogleCloudChannelV1ListPurchasableSkusResponse,
17266    )> {
17267        use std::borrow::Cow;
17268        use std::io::{Read, Seek};
17269
17270        use common::{url::Params, ToParts};
17271        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17272
17273        let mut dd = common::DefaultDelegate;
17274        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17275        dlg.begin(common::MethodInfo {
17276            id: "cloudchannel.accounts.customers.listPurchasableSkus",
17277            http_method: hyper::Method::GET,
17278        });
17279
17280        for &field in [
17281            "alt",
17282            "customer",
17283            "pageToken",
17284            "pageSize",
17285            "languageCode",
17286            "createEntitlementPurchase.product",
17287            "changeOfferPurchase.entitlement",
17288            "changeOfferPurchase.changeType",
17289        ]
17290        .iter()
17291        {
17292            if self._additional_params.contains_key(field) {
17293                dlg.finished(false);
17294                return Err(common::Error::FieldClash(field));
17295            }
17296        }
17297
17298        let mut params = Params::with_capacity(9 + self._additional_params.len());
17299        params.push("customer", self._customer);
17300        if let Some(value) = self._page_token.as_ref() {
17301            params.push("pageToken", value);
17302        }
17303        if let Some(value) = self._page_size.as_ref() {
17304            params.push("pageSize", value.to_string());
17305        }
17306        if let Some(value) = self._language_code.as_ref() {
17307            params.push("languageCode", value);
17308        }
17309        if let Some(value) = self._create_entitlement_purchase_product.as_ref() {
17310            params.push("createEntitlementPurchase.product", value);
17311        }
17312        if let Some(value) = self._change_offer_purchase_entitlement.as_ref() {
17313            params.push("changeOfferPurchase.entitlement", value);
17314        }
17315        if let Some(value) = self._change_offer_purchase_change_type.as_ref() {
17316            params.push("changeOfferPurchase.changeType", value);
17317        }
17318
17319        params.extend(self._additional_params.iter());
17320
17321        params.push("alt", "json");
17322        let mut url = self.hub._base_url.clone() + "v1/{+customer}:listPurchasableSkus";
17323        if self._scopes.is_empty() {
17324            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
17325        }
17326
17327        #[allow(clippy::single_element_loop)]
17328        for &(find_this, param_name) in [("{+customer}", "customer")].iter() {
17329            url = params.uri_replacement(url, param_name, find_this, true);
17330        }
17331        {
17332            let to_remove = ["customer"];
17333            params.remove_params(&to_remove);
17334        }
17335
17336        let url = params.parse_with_url(&url);
17337
17338        loop {
17339            let token = match self
17340                .hub
17341                .auth
17342                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17343                .await
17344            {
17345                Ok(token) => token,
17346                Err(e) => match dlg.token(e) {
17347                    Ok(token) => token,
17348                    Err(e) => {
17349                        dlg.finished(false);
17350                        return Err(common::Error::MissingToken(e));
17351                    }
17352                },
17353            };
17354            let mut req_result = {
17355                let client = &self.hub.client;
17356                dlg.pre_request();
17357                let mut req_builder = hyper::Request::builder()
17358                    .method(hyper::Method::GET)
17359                    .uri(url.as_str())
17360                    .header(USER_AGENT, self.hub._user_agent.clone());
17361
17362                if let Some(token) = token.as_ref() {
17363                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17364                }
17365
17366                let request = req_builder
17367                    .header(CONTENT_LENGTH, 0_u64)
17368                    .body(common::to_body::<String>(None));
17369
17370                client.request(request.unwrap()).await
17371            };
17372
17373            match req_result {
17374                Err(err) => {
17375                    if let common::Retry::After(d) = dlg.http_error(&err) {
17376                        sleep(d).await;
17377                        continue;
17378                    }
17379                    dlg.finished(false);
17380                    return Err(common::Error::HttpError(err));
17381                }
17382                Ok(res) => {
17383                    let (mut parts, body) = res.into_parts();
17384                    let mut body = common::Body::new(body);
17385                    if !parts.status.is_success() {
17386                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17387                        let error = serde_json::from_str(&common::to_string(&bytes));
17388                        let response = common::to_response(parts, bytes.into());
17389
17390                        if let common::Retry::After(d) =
17391                            dlg.http_failure(&response, error.as_ref().ok())
17392                        {
17393                            sleep(d).await;
17394                            continue;
17395                        }
17396
17397                        dlg.finished(false);
17398
17399                        return Err(match error {
17400                            Ok(value) => common::Error::BadRequest(value),
17401                            _ => common::Error::Failure(response),
17402                        });
17403                    }
17404                    let response = {
17405                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17406                        let encoded = common::to_string(&bytes);
17407                        match serde_json::from_str(&encoded) {
17408                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17409                            Err(error) => {
17410                                dlg.response_json_decode_error(&encoded, &error);
17411                                return Err(common::Error::JsonDecodeError(
17412                                    encoded.to_string(),
17413                                    error,
17414                                ));
17415                            }
17416                        }
17417                    };
17418
17419                    dlg.finished(true);
17420                    return Ok(response);
17421                }
17422            }
17423        }
17424    }
17425
17426    /// Required. The resource name of the customer to list SKUs for. Format: accounts/{account_id}/customers/{customer_id}.
17427    ///
17428    /// Sets the *customer* path property to the given value.
17429    ///
17430    /// Even though the property as already been set when instantiating this call,
17431    /// we provide this method for API completeness.
17432    pub fn customer(mut self, new_value: &str) -> AccountCustomerListPurchasableSkuCall<'a, C> {
17433        self._customer = new_value.to_string();
17434        self
17435    }
17436    /// Optional. A token for a page of results other than the first page.
17437    ///
17438    /// Sets the *page token* query property to the given value.
17439    pub fn page_token(mut self, new_value: &str) -> AccountCustomerListPurchasableSkuCall<'a, C> {
17440        self._page_token = Some(new_value.to_string());
17441        self
17442    }
17443    /// Optional. Requested page size. Server might return fewer results than requested. If unspecified, returns at most 100 SKUs. The maximum value is 1000; the server will coerce values above 1000.
17444    ///
17445    /// Sets the *page size* query property to the given value.
17446    pub fn page_size(mut self, new_value: i32) -> AccountCustomerListPurchasableSkuCall<'a, C> {
17447        self._page_size = Some(new_value);
17448        self
17449    }
17450    /// Optional. The BCP-47 language code. For example, "en-US". The response will localize in the corresponding language code, if specified. The default value is "en-US".
17451    ///
17452    /// Sets the *language code* query property to the given value.
17453    pub fn language_code(
17454        mut self,
17455        new_value: &str,
17456    ) -> AccountCustomerListPurchasableSkuCall<'a, C> {
17457        self._language_code = Some(new_value.to_string());
17458        self
17459    }
17460    /// Required. List SKUs belonging to this Product. Format: products/{product_id}. Supports products/- to retrieve SKUs for all products.
17461    ///
17462    /// Sets the *create entitlement purchase.product* query property to the given value.
17463    pub fn create_entitlement_purchase_product(
17464        mut self,
17465        new_value: &str,
17466    ) -> AccountCustomerListPurchasableSkuCall<'a, C> {
17467        self._create_entitlement_purchase_product = Some(new_value.to_string());
17468        self
17469    }
17470    /// Required. Resource name of the entitlement. Format: accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
17471    ///
17472    /// Sets the *change offer purchase.entitlement* query property to the given value.
17473    pub fn change_offer_purchase_entitlement(
17474        mut self,
17475        new_value: &str,
17476    ) -> AccountCustomerListPurchasableSkuCall<'a, C> {
17477        self._change_offer_purchase_entitlement = Some(new_value.to_string());
17478        self
17479    }
17480    /// Required. Change Type for the entitlement.
17481    ///
17482    /// Sets the *change offer purchase.change type* query property to the given value.
17483    pub fn change_offer_purchase_change_type(
17484        mut self,
17485        new_value: &str,
17486    ) -> AccountCustomerListPurchasableSkuCall<'a, C> {
17487        self._change_offer_purchase_change_type = Some(new_value.to_string());
17488        self
17489    }
17490    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17491    /// while executing the actual API request.
17492    ///
17493    /// ````text
17494    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17495    /// ````
17496    ///
17497    /// Sets the *delegate* property to the given value.
17498    pub fn delegate(
17499        mut self,
17500        new_value: &'a mut dyn common::Delegate,
17501    ) -> AccountCustomerListPurchasableSkuCall<'a, C> {
17502        self._delegate = Some(new_value);
17503        self
17504    }
17505
17506    /// Set any additional parameter of the query string used in the request.
17507    /// It should be used to set parameters which are not yet available through their own
17508    /// setters.
17509    ///
17510    /// Please note that this method must not be used to set any of the known parameters
17511    /// which have their own setter method. If done anyway, the request will fail.
17512    ///
17513    /// # Additional Parameters
17514    ///
17515    /// * *$.xgafv* (query-string) - V1 error format.
17516    /// * *access_token* (query-string) - OAuth access token.
17517    /// * *alt* (query-string) - Data format for response.
17518    /// * *callback* (query-string) - JSONP
17519    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17520    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17521    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17522    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17523    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17524    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17525    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17526    pub fn param<T>(mut self, name: T, value: T) -> AccountCustomerListPurchasableSkuCall<'a, C>
17527    where
17528        T: AsRef<str>,
17529    {
17530        self._additional_params
17531            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17532        self
17533    }
17534
17535    /// Identifies the authorization scope for the method you are building.
17536    ///
17537    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17538    /// [`Scope::AppOrder`].
17539    ///
17540    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17541    /// tokens for more than one scope.
17542    ///
17543    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17544    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17545    /// sufficient, a read-write scope will do as well.
17546    pub fn add_scope<St>(mut self, scope: St) -> AccountCustomerListPurchasableSkuCall<'a, C>
17547    where
17548        St: AsRef<str>,
17549    {
17550        self._scopes.insert(String::from(scope.as_ref()));
17551        self
17552    }
17553    /// Identifies the authorization scope(s) for the method you are building.
17554    ///
17555    /// See [`Self::add_scope()`] for details.
17556    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountCustomerListPurchasableSkuCall<'a, C>
17557    where
17558        I: IntoIterator<Item = St>,
17559        St: AsRef<str>,
17560    {
17561        self._scopes
17562            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17563        self
17564    }
17565
17566    /// Removes all scopes, and no default scope will be used either.
17567    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17568    /// for details).
17569    pub fn clear_scopes(mut self) -> AccountCustomerListPurchasableSkuCall<'a, C> {
17570        self._scopes.clear();
17571        self
17572    }
17573}
17574
17575/// Updates an existing Customer resource for the reseller or distributor. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: No Customer resource found for the name in the request. Return value: The updated Customer resource.
17576///
17577/// A builder for the *customers.patch* method supported by a *account* resource.
17578/// It is not used directly, but through a [`AccountMethods`] instance.
17579///
17580/// # Example
17581///
17582/// Instantiate a resource method builder
17583///
17584/// ```test_harness,no_run
17585/// # extern crate hyper;
17586/// # extern crate hyper_rustls;
17587/// # extern crate google_cloudchannel1 as cloudchannel1;
17588/// use cloudchannel1::api::GoogleCloudChannelV1Customer;
17589/// # async fn dox() {
17590/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17591///
17592/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17593/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17594/// #     .with_native_roots()
17595/// #     .unwrap()
17596/// #     .https_only()
17597/// #     .enable_http2()
17598/// #     .build();
17599///
17600/// # let executor = hyper_util::rt::TokioExecutor::new();
17601/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17602/// #     secret,
17603/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17604/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17605/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17606/// #     ),
17607/// # ).build().await.unwrap();
17608///
17609/// # let client = hyper_util::client::legacy::Client::builder(
17610/// #     hyper_util::rt::TokioExecutor::new()
17611/// # )
17612/// # .build(
17613/// #     hyper_rustls::HttpsConnectorBuilder::new()
17614/// #         .with_native_roots()
17615/// #         .unwrap()
17616/// #         .https_or_http()
17617/// #         .enable_http2()
17618/// #         .build()
17619/// # );
17620/// # let mut hub = Cloudchannel::new(client, auth);
17621/// // As the method needs a request, you would usually fill it with the desired information
17622/// // into the respective structure. Some of the parts shown here might not be applicable !
17623/// // Values shown here are possibly random and not representative !
17624/// let mut req = GoogleCloudChannelV1Customer::default();
17625///
17626/// // You can configure optional parameters by calling the respective setters at will, and
17627/// // execute the final call using `doit()`.
17628/// // Values shown here are possibly random and not representative !
17629/// let result = hub.accounts().customers_patch(req, "name")
17630///              .update_mask(FieldMask::new::<&str>(&[]))
17631///              .doit().await;
17632/// # }
17633/// ```
17634pub struct AccountCustomerPatchCall<'a, C>
17635where
17636    C: 'a,
17637{
17638    hub: &'a Cloudchannel<C>,
17639    _request: GoogleCloudChannelV1Customer,
17640    _name: String,
17641    _update_mask: Option<common::FieldMask>,
17642    _delegate: Option<&'a mut dyn common::Delegate>,
17643    _additional_params: HashMap<String, String>,
17644    _scopes: BTreeSet<String>,
17645}
17646
17647impl<'a, C> common::CallBuilder for AccountCustomerPatchCall<'a, C> {}
17648
17649impl<'a, C> AccountCustomerPatchCall<'a, C>
17650where
17651    C: common::Connector,
17652{
17653    /// Perform the operation you have build so far.
17654    pub async fn doit(
17655        mut self,
17656    ) -> common::Result<(common::Response, GoogleCloudChannelV1Customer)> {
17657        use std::borrow::Cow;
17658        use std::io::{Read, Seek};
17659
17660        use common::{url::Params, ToParts};
17661        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17662
17663        let mut dd = common::DefaultDelegate;
17664        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17665        dlg.begin(common::MethodInfo {
17666            id: "cloudchannel.accounts.customers.patch",
17667            http_method: hyper::Method::PATCH,
17668        });
17669
17670        for &field in ["alt", "name", "updateMask"].iter() {
17671            if self._additional_params.contains_key(field) {
17672                dlg.finished(false);
17673                return Err(common::Error::FieldClash(field));
17674            }
17675        }
17676
17677        let mut params = Params::with_capacity(5 + self._additional_params.len());
17678        params.push("name", self._name);
17679        if let Some(value) = self._update_mask.as_ref() {
17680            params.push("updateMask", value.to_string());
17681        }
17682
17683        params.extend(self._additional_params.iter());
17684
17685        params.push("alt", "json");
17686        let mut url = self.hub._base_url.clone() + "v1/{+name}";
17687        if self._scopes.is_empty() {
17688            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
17689        }
17690
17691        #[allow(clippy::single_element_loop)]
17692        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17693            url = params.uri_replacement(url, param_name, find_this, true);
17694        }
17695        {
17696            let to_remove = ["name"];
17697            params.remove_params(&to_remove);
17698        }
17699
17700        let url = params.parse_with_url(&url);
17701
17702        let mut json_mime_type = mime::APPLICATION_JSON;
17703        let mut request_value_reader = {
17704            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17705            common::remove_json_null_values(&mut value);
17706            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17707            serde_json::to_writer(&mut dst, &value).unwrap();
17708            dst
17709        };
17710        let request_size = request_value_reader
17711            .seek(std::io::SeekFrom::End(0))
17712            .unwrap();
17713        request_value_reader
17714            .seek(std::io::SeekFrom::Start(0))
17715            .unwrap();
17716
17717        loop {
17718            let token = match self
17719                .hub
17720                .auth
17721                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17722                .await
17723            {
17724                Ok(token) => token,
17725                Err(e) => match dlg.token(e) {
17726                    Ok(token) => token,
17727                    Err(e) => {
17728                        dlg.finished(false);
17729                        return Err(common::Error::MissingToken(e));
17730                    }
17731                },
17732            };
17733            request_value_reader
17734                .seek(std::io::SeekFrom::Start(0))
17735                .unwrap();
17736            let mut req_result = {
17737                let client = &self.hub.client;
17738                dlg.pre_request();
17739                let mut req_builder = hyper::Request::builder()
17740                    .method(hyper::Method::PATCH)
17741                    .uri(url.as_str())
17742                    .header(USER_AGENT, self.hub._user_agent.clone());
17743
17744                if let Some(token) = token.as_ref() {
17745                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17746                }
17747
17748                let request = req_builder
17749                    .header(CONTENT_TYPE, json_mime_type.to_string())
17750                    .header(CONTENT_LENGTH, request_size as u64)
17751                    .body(common::to_body(
17752                        request_value_reader.get_ref().clone().into(),
17753                    ));
17754
17755                client.request(request.unwrap()).await
17756            };
17757
17758            match req_result {
17759                Err(err) => {
17760                    if let common::Retry::After(d) = dlg.http_error(&err) {
17761                        sleep(d).await;
17762                        continue;
17763                    }
17764                    dlg.finished(false);
17765                    return Err(common::Error::HttpError(err));
17766                }
17767                Ok(res) => {
17768                    let (mut parts, body) = res.into_parts();
17769                    let mut body = common::Body::new(body);
17770                    if !parts.status.is_success() {
17771                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17772                        let error = serde_json::from_str(&common::to_string(&bytes));
17773                        let response = common::to_response(parts, bytes.into());
17774
17775                        if let common::Retry::After(d) =
17776                            dlg.http_failure(&response, error.as_ref().ok())
17777                        {
17778                            sleep(d).await;
17779                            continue;
17780                        }
17781
17782                        dlg.finished(false);
17783
17784                        return Err(match error {
17785                            Ok(value) => common::Error::BadRequest(value),
17786                            _ => common::Error::Failure(response),
17787                        });
17788                    }
17789                    let response = {
17790                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17791                        let encoded = common::to_string(&bytes);
17792                        match serde_json::from_str(&encoded) {
17793                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17794                            Err(error) => {
17795                                dlg.response_json_decode_error(&encoded, &error);
17796                                return Err(common::Error::JsonDecodeError(
17797                                    encoded.to_string(),
17798                                    error,
17799                                ));
17800                            }
17801                        }
17802                    };
17803
17804                    dlg.finished(true);
17805                    return Ok(response);
17806                }
17807            }
17808        }
17809    }
17810
17811    ///
17812    /// Sets the *request* property to the given value.
17813    ///
17814    /// Even though the property as already been set when instantiating this call,
17815    /// we provide this method for API completeness.
17816    pub fn request(
17817        mut self,
17818        new_value: GoogleCloudChannelV1Customer,
17819    ) -> AccountCustomerPatchCall<'a, C> {
17820        self._request = new_value;
17821        self
17822    }
17823    /// Output only. Resource name of the customer. Format: accounts/{account_id}/customers/{customer_id}
17824    ///
17825    /// Sets the *name* path property to the given value.
17826    ///
17827    /// Even though the property as already been set when instantiating this call,
17828    /// we provide this method for API completeness.
17829    pub fn name(mut self, new_value: &str) -> AccountCustomerPatchCall<'a, C> {
17830        self._name = new_value.to_string();
17831        self
17832    }
17833    /// The update mask that applies to the resource. Optional.
17834    ///
17835    /// Sets the *update mask* query property to the given value.
17836    pub fn update_mask(mut self, new_value: common::FieldMask) -> AccountCustomerPatchCall<'a, C> {
17837        self._update_mask = Some(new_value);
17838        self
17839    }
17840    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17841    /// while executing the actual API request.
17842    ///
17843    /// ````text
17844    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17845    /// ````
17846    ///
17847    /// Sets the *delegate* property to the given value.
17848    pub fn delegate(
17849        mut self,
17850        new_value: &'a mut dyn common::Delegate,
17851    ) -> AccountCustomerPatchCall<'a, C> {
17852        self._delegate = Some(new_value);
17853        self
17854    }
17855
17856    /// Set any additional parameter of the query string used in the request.
17857    /// It should be used to set parameters which are not yet available through their own
17858    /// setters.
17859    ///
17860    /// Please note that this method must not be used to set any of the known parameters
17861    /// which have their own setter method. If done anyway, the request will fail.
17862    ///
17863    /// # Additional Parameters
17864    ///
17865    /// * *$.xgafv* (query-string) - V1 error format.
17866    /// * *access_token* (query-string) - OAuth access token.
17867    /// * *alt* (query-string) - Data format for response.
17868    /// * *callback* (query-string) - JSONP
17869    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17870    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17871    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17872    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17873    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17874    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17875    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17876    pub fn param<T>(mut self, name: T, value: T) -> AccountCustomerPatchCall<'a, C>
17877    where
17878        T: AsRef<str>,
17879    {
17880        self._additional_params
17881            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17882        self
17883    }
17884
17885    /// Identifies the authorization scope for the method you are building.
17886    ///
17887    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17888    /// [`Scope::AppOrder`].
17889    ///
17890    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17891    /// tokens for more than one scope.
17892    ///
17893    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17894    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17895    /// sufficient, a read-write scope will do as well.
17896    pub fn add_scope<St>(mut self, scope: St) -> AccountCustomerPatchCall<'a, C>
17897    where
17898        St: AsRef<str>,
17899    {
17900        self._scopes.insert(String::from(scope.as_ref()));
17901        self
17902    }
17903    /// Identifies the authorization scope(s) for the method you are building.
17904    ///
17905    /// See [`Self::add_scope()`] for details.
17906    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountCustomerPatchCall<'a, C>
17907    where
17908        I: IntoIterator<Item = St>,
17909        St: AsRef<str>,
17910    {
17911        self._scopes
17912            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17913        self
17914    }
17915
17916    /// Removes all scopes, and no default scope will be used either.
17917    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17918    /// for details).
17919    pub fn clear_scopes(mut self) -> AccountCustomerPatchCall<'a, C> {
17920        self._scopes.clear();
17921        self
17922    }
17923}
17924
17925/// Creates a Cloud Identity for the given customer using the customer's information, or the information provided here. Possible error codes: * PERMISSION_DENIED: * The customer doesn't belong to the reseller. * You are not authorized to provision cloud identity id. See https://support.google.com/channelservices/answer/9759265 * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The customer was not found. * ALREADY_EXISTS: The customer's primary email already exists. Retry after changing the customer's primary contact email. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata contains an instance of OperationMetadata.
17926///
17927/// A builder for the *customers.provisionCloudIdentity* method supported by a *account* resource.
17928/// It is not used directly, but through a [`AccountMethods`] instance.
17929///
17930/// # Example
17931///
17932/// Instantiate a resource method builder
17933///
17934/// ```test_harness,no_run
17935/// # extern crate hyper;
17936/// # extern crate hyper_rustls;
17937/// # extern crate google_cloudchannel1 as cloudchannel1;
17938/// use cloudchannel1::api::GoogleCloudChannelV1ProvisionCloudIdentityRequest;
17939/// # async fn dox() {
17940/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17941///
17942/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17943/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17944/// #     .with_native_roots()
17945/// #     .unwrap()
17946/// #     .https_only()
17947/// #     .enable_http2()
17948/// #     .build();
17949///
17950/// # let executor = hyper_util::rt::TokioExecutor::new();
17951/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17952/// #     secret,
17953/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17954/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17955/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17956/// #     ),
17957/// # ).build().await.unwrap();
17958///
17959/// # let client = hyper_util::client::legacy::Client::builder(
17960/// #     hyper_util::rt::TokioExecutor::new()
17961/// # )
17962/// # .build(
17963/// #     hyper_rustls::HttpsConnectorBuilder::new()
17964/// #         .with_native_roots()
17965/// #         .unwrap()
17966/// #         .https_or_http()
17967/// #         .enable_http2()
17968/// #         .build()
17969/// # );
17970/// # let mut hub = Cloudchannel::new(client, auth);
17971/// // As the method needs a request, you would usually fill it with the desired information
17972/// // into the respective structure. Some of the parts shown here might not be applicable !
17973/// // Values shown here are possibly random and not representative !
17974/// let mut req = GoogleCloudChannelV1ProvisionCloudIdentityRequest::default();
17975///
17976/// // You can configure optional parameters by calling the respective setters at will, and
17977/// // execute the final call using `doit()`.
17978/// // Values shown here are possibly random and not representative !
17979/// let result = hub.accounts().customers_provision_cloud_identity(req, "customer")
17980///              .doit().await;
17981/// # }
17982/// ```
17983pub struct AccountCustomerProvisionCloudIdentityCall<'a, C>
17984where
17985    C: 'a,
17986{
17987    hub: &'a Cloudchannel<C>,
17988    _request: GoogleCloudChannelV1ProvisionCloudIdentityRequest,
17989    _customer: String,
17990    _delegate: Option<&'a mut dyn common::Delegate>,
17991    _additional_params: HashMap<String, String>,
17992    _scopes: BTreeSet<String>,
17993}
17994
17995impl<'a, C> common::CallBuilder for AccountCustomerProvisionCloudIdentityCall<'a, C> {}
17996
17997impl<'a, C> AccountCustomerProvisionCloudIdentityCall<'a, C>
17998where
17999    C: common::Connector,
18000{
18001    /// Perform the operation you have build so far.
18002    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
18003        use std::borrow::Cow;
18004        use std::io::{Read, Seek};
18005
18006        use common::{url::Params, ToParts};
18007        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18008
18009        let mut dd = common::DefaultDelegate;
18010        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18011        dlg.begin(common::MethodInfo {
18012            id: "cloudchannel.accounts.customers.provisionCloudIdentity",
18013            http_method: hyper::Method::POST,
18014        });
18015
18016        for &field in ["alt", "customer"].iter() {
18017            if self._additional_params.contains_key(field) {
18018                dlg.finished(false);
18019                return Err(common::Error::FieldClash(field));
18020            }
18021        }
18022
18023        let mut params = Params::with_capacity(4 + self._additional_params.len());
18024        params.push("customer", self._customer);
18025
18026        params.extend(self._additional_params.iter());
18027
18028        params.push("alt", "json");
18029        let mut url = self.hub._base_url.clone() + "v1/{+customer}:provisionCloudIdentity";
18030        if self._scopes.is_empty() {
18031            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
18032        }
18033
18034        #[allow(clippy::single_element_loop)]
18035        for &(find_this, param_name) in [("{+customer}", "customer")].iter() {
18036            url = params.uri_replacement(url, param_name, find_this, true);
18037        }
18038        {
18039            let to_remove = ["customer"];
18040            params.remove_params(&to_remove);
18041        }
18042
18043        let url = params.parse_with_url(&url);
18044
18045        let mut json_mime_type = mime::APPLICATION_JSON;
18046        let mut request_value_reader = {
18047            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18048            common::remove_json_null_values(&mut value);
18049            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18050            serde_json::to_writer(&mut dst, &value).unwrap();
18051            dst
18052        };
18053        let request_size = request_value_reader
18054            .seek(std::io::SeekFrom::End(0))
18055            .unwrap();
18056        request_value_reader
18057            .seek(std::io::SeekFrom::Start(0))
18058            .unwrap();
18059
18060        loop {
18061            let token = match self
18062                .hub
18063                .auth
18064                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18065                .await
18066            {
18067                Ok(token) => token,
18068                Err(e) => match dlg.token(e) {
18069                    Ok(token) => token,
18070                    Err(e) => {
18071                        dlg.finished(false);
18072                        return Err(common::Error::MissingToken(e));
18073                    }
18074                },
18075            };
18076            request_value_reader
18077                .seek(std::io::SeekFrom::Start(0))
18078                .unwrap();
18079            let mut req_result = {
18080                let client = &self.hub.client;
18081                dlg.pre_request();
18082                let mut req_builder = hyper::Request::builder()
18083                    .method(hyper::Method::POST)
18084                    .uri(url.as_str())
18085                    .header(USER_AGENT, self.hub._user_agent.clone());
18086
18087                if let Some(token) = token.as_ref() {
18088                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18089                }
18090
18091                let request = req_builder
18092                    .header(CONTENT_TYPE, json_mime_type.to_string())
18093                    .header(CONTENT_LENGTH, request_size as u64)
18094                    .body(common::to_body(
18095                        request_value_reader.get_ref().clone().into(),
18096                    ));
18097
18098                client.request(request.unwrap()).await
18099            };
18100
18101            match req_result {
18102                Err(err) => {
18103                    if let common::Retry::After(d) = dlg.http_error(&err) {
18104                        sleep(d).await;
18105                        continue;
18106                    }
18107                    dlg.finished(false);
18108                    return Err(common::Error::HttpError(err));
18109                }
18110                Ok(res) => {
18111                    let (mut parts, body) = res.into_parts();
18112                    let mut body = common::Body::new(body);
18113                    if !parts.status.is_success() {
18114                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18115                        let error = serde_json::from_str(&common::to_string(&bytes));
18116                        let response = common::to_response(parts, bytes.into());
18117
18118                        if let common::Retry::After(d) =
18119                            dlg.http_failure(&response, error.as_ref().ok())
18120                        {
18121                            sleep(d).await;
18122                            continue;
18123                        }
18124
18125                        dlg.finished(false);
18126
18127                        return Err(match error {
18128                            Ok(value) => common::Error::BadRequest(value),
18129                            _ => common::Error::Failure(response),
18130                        });
18131                    }
18132                    let response = {
18133                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18134                        let encoded = common::to_string(&bytes);
18135                        match serde_json::from_str(&encoded) {
18136                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18137                            Err(error) => {
18138                                dlg.response_json_decode_error(&encoded, &error);
18139                                return Err(common::Error::JsonDecodeError(
18140                                    encoded.to_string(),
18141                                    error,
18142                                ));
18143                            }
18144                        }
18145                    };
18146
18147                    dlg.finished(true);
18148                    return Ok(response);
18149                }
18150            }
18151        }
18152    }
18153
18154    ///
18155    /// Sets the *request* property to the given value.
18156    ///
18157    /// Even though the property as already been set when instantiating this call,
18158    /// we provide this method for API completeness.
18159    pub fn request(
18160        mut self,
18161        new_value: GoogleCloudChannelV1ProvisionCloudIdentityRequest,
18162    ) -> AccountCustomerProvisionCloudIdentityCall<'a, C> {
18163        self._request = new_value;
18164        self
18165    }
18166    /// Required. Resource name of the customer. Format: accounts/{account_id}/customers/{customer_id}
18167    ///
18168    /// Sets the *customer* path property to the given value.
18169    ///
18170    /// Even though the property as already been set when instantiating this call,
18171    /// we provide this method for API completeness.
18172    pub fn customer(mut self, new_value: &str) -> AccountCustomerProvisionCloudIdentityCall<'a, C> {
18173        self._customer = new_value.to_string();
18174        self
18175    }
18176    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18177    /// while executing the actual API request.
18178    ///
18179    /// ````text
18180    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18181    /// ````
18182    ///
18183    /// Sets the *delegate* property to the given value.
18184    pub fn delegate(
18185        mut self,
18186        new_value: &'a mut dyn common::Delegate,
18187    ) -> AccountCustomerProvisionCloudIdentityCall<'a, C> {
18188        self._delegate = Some(new_value);
18189        self
18190    }
18191
18192    /// Set any additional parameter of the query string used in the request.
18193    /// It should be used to set parameters which are not yet available through their own
18194    /// setters.
18195    ///
18196    /// Please note that this method must not be used to set any of the known parameters
18197    /// which have their own setter method. If done anyway, the request will fail.
18198    ///
18199    /// # Additional Parameters
18200    ///
18201    /// * *$.xgafv* (query-string) - V1 error format.
18202    /// * *access_token* (query-string) - OAuth access token.
18203    /// * *alt* (query-string) - Data format for response.
18204    /// * *callback* (query-string) - JSONP
18205    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18206    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18207    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18208    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18209    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18210    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18211    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18212    pub fn param<T>(mut self, name: T, value: T) -> AccountCustomerProvisionCloudIdentityCall<'a, C>
18213    where
18214        T: AsRef<str>,
18215    {
18216        self._additional_params
18217            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18218        self
18219    }
18220
18221    /// Identifies the authorization scope for the method you are building.
18222    ///
18223    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18224    /// [`Scope::AppOrder`].
18225    ///
18226    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18227    /// tokens for more than one scope.
18228    ///
18229    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18230    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18231    /// sufficient, a read-write scope will do as well.
18232    pub fn add_scope<St>(mut self, scope: St) -> AccountCustomerProvisionCloudIdentityCall<'a, C>
18233    where
18234        St: AsRef<str>,
18235    {
18236        self._scopes.insert(String::from(scope.as_ref()));
18237        self
18238    }
18239    /// Identifies the authorization scope(s) for the method you are building.
18240    ///
18241    /// See [`Self::add_scope()`] for details.
18242    pub fn add_scopes<I, St>(
18243        mut self,
18244        scopes: I,
18245    ) -> AccountCustomerProvisionCloudIdentityCall<'a, C>
18246    where
18247        I: IntoIterator<Item = St>,
18248        St: AsRef<str>,
18249    {
18250        self._scopes
18251            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18252        self
18253    }
18254
18255    /// Removes all scopes, and no default scope will be used either.
18256    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18257    /// for details).
18258    pub fn clear_scopes(mut self) -> AccountCustomerProvisionCloudIdentityCall<'a, C> {
18259        self._scopes.clear();
18260        self
18261    }
18262}
18263
18264/// Lists the billing accounts that are eligible to purchase particular SKUs for a given customer. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. Return value: Based on the provided list of SKUs, returns a list of SKU groups that must be purchased using the same billing account and the billing accounts eligible to purchase each SKU group.
18265///
18266/// A builder for the *customers.queryEligibleBillingAccounts* method supported by a *account* resource.
18267/// It is not used directly, but through a [`AccountMethods`] instance.
18268///
18269/// # Example
18270///
18271/// Instantiate a resource method builder
18272///
18273/// ```test_harness,no_run
18274/// # extern crate hyper;
18275/// # extern crate hyper_rustls;
18276/// # extern crate google_cloudchannel1 as cloudchannel1;
18277/// # async fn dox() {
18278/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18279///
18280/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18281/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18282/// #     .with_native_roots()
18283/// #     .unwrap()
18284/// #     .https_only()
18285/// #     .enable_http2()
18286/// #     .build();
18287///
18288/// # let executor = hyper_util::rt::TokioExecutor::new();
18289/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18290/// #     secret,
18291/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18292/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18293/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18294/// #     ),
18295/// # ).build().await.unwrap();
18296///
18297/// # let client = hyper_util::client::legacy::Client::builder(
18298/// #     hyper_util::rt::TokioExecutor::new()
18299/// # )
18300/// # .build(
18301/// #     hyper_rustls::HttpsConnectorBuilder::new()
18302/// #         .with_native_roots()
18303/// #         .unwrap()
18304/// #         .https_or_http()
18305/// #         .enable_http2()
18306/// #         .build()
18307/// # );
18308/// # let mut hub = Cloudchannel::new(client, auth);
18309/// // You can configure optional parameters by calling the respective setters at will, and
18310/// // execute the final call using `doit()`.
18311/// // Values shown here are possibly random and not representative !
18312/// let result = hub.accounts().customers_query_eligible_billing_accounts("customer")
18313///              .add_skus("erat")
18314///              .doit().await;
18315/// # }
18316/// ```
18317pub struct AccountCustomerQueryEligibleBillingAccountCall<'a, C>
18318where
18319    C: 'a,
18320{
18321    hub: &'a Cloudchannel<C>,
18322    _customer: String,
18323    _skus: Vec<String>,
18324    _delegate: Option<&'a mut dyn common::Delegate>,
18325    _additional_params: HashMap<String, String>,
18326    _scopes: BTreeSet<String>,
18327}
18328
18329impl<'a, C> common::CallBuilder for AccountCustomerQueryEligibleBillingAccountCall<'a, C> {}
18330
18331impl<'a, C> AccountCustomerQueryEligibleBillingAccountCall<'a, C>
18332where
18333    C: common::Connector,
18334{
18335    /// Perform the operation you have build so far.
18336    pub async fn doit(
18337        mut self,
18338    ) -> common::Result<(
18339        common::Response,
18340        GoogleCloudChannelV1QueryEligibleBillingAccountsResponse,
18341    )> {
18342        use std::borrow::Cow;
18343        use std::io::{Read, Seek};
18344
18345        use common::{url::Params, ToParts};
18346        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18347
18348        let mut dd = common::DefaultDelegate;
18349        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18350        dlg.begin(common::MethodInfo {
18351            id: "cloudchannel.accounts.customers.queryEligibleBillingAccounts",
18352            http_method: hyper::Method::GET,
18353        });
18354
18355        for &field in ["alt", "customer", "skus"].iter() {
18356            if self._additional_params.contains_key(field) {
18357                dlg.finished(false);
18358                return Err(common::Error::FieldClash(field));
18359            }
18360        }
18361
18362        let mut params = Params::with_capacity(4 + self._additional_params.len());
18363        params.push("customer", self._customer);
18364        if !self._skus.is_empty() {
18365            for f in self._skus.iter() {
18366                params.push("skus", f);
18367            }
18368        }
18369
18370        params.extend(self._additional_params.iter());
18371
18372        params.push("alt", "json");
18373        let mut url = self.hub._base_url.clone() + "v1/{+customer}:queryEligibleBillingAccounts";
18374        if self._scopes.is_empty() {
18375            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
18376        }
18377
18378        #[allow(clippy::single_element_loop)]
18379        for &(find_this, param_name) in [("{+customer}", "customer")].iter() {
18380            url = params.uri_replacement(url, param_name, find_this, true);
18381        }
18382        {
18383            let to_remove = ["customer"];
18384            params.remove_params(&to_remove);
18385        }
18386
18387        let url = params.parse_with_url(&url);
18388
18389        loop {
18390            let token = match self
18391                .hub
18392                .auth
18393                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18394                .await
18395            {
18396                Ok(token) => token,
18397                Err(e) => match dlg.token(e) {
18398                    Ok(token) => token,
18399                    Err(e) => {
18400                        dlg.finished(false);
18401                        return Err(common::Error::MissingToken(e));
18402                    }
18403                },
18404            };
18405            let mut req_result = {
18406                let client = &self.hub.client;
18407                dlg.pre_request();
18408                let mut req_builder = hyper::Request::builder()
18409                    .method(hyper::Method::GET)
18410                    .uri(url.as_str())
18411                    .header(USER_AGENT, self.hub._user_agent.clone());
18412
18413                if let Some(token) = token.as_ref() {
18414                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18415                }
18416
18417                let request = req_builder
18418                    .header(CONTENT_LENGTH, 0_u64)
18419                    .body(common::to_body::<String>(None));
18420
18421                client.request(request.unwrap()).await
18422            };
18423
18424            match req_result {
18425                Err(err) => {
18426                    if let common::Retry::After(d) = dlg.http_error(&err) {
18427                        sleep(d).await;
18428                        continue;
18429                    }
18430                    dlg.finished(false);
18431                    return Err(common::Error::HttpError(err));
18432                }
18433                Ok(res) => {
18434                    let (mut parts, body) = res.into_parts();
18435                    let mut body = common::Body::new(body);
18436                    if !parts.status.is_success() {
18437                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18438                        let error = serde_json::from_str(&common::to_string(&bytes));
18439                        let response = common::to_response(parts, bytes.into());
18440
18441                        if let common::Retry::After(d) =
18442                            dlg.http_failure(&response, error.as_ref().ok())
18443                        {
18444                            sleep(d).await;
18445                            continue;
18446                        }
18447
18448                        dlg.finished(false);
18449
18450                        return Err(match error {
18451                            Ok(value) => common::Error::BadRequest(value),
18452                            _ => common::Error::Failure(response),
18453                        });
18454                    }
18455                    let response = {
18456                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18457                        let encoded = common::to_string(&bytes);
18458                        match serde_json::from_str(&encoded) {
18459                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18460                            Err(error) => {
18461                                dlg.response_json_decode_error(&encoded, &error);
18462                                return Err(common::Error::JsonDecodeError(
18463                                    encoded.to_string(),
18464                                    error,
18465                                ));
18466                            }
18467                        }
18468                    };
18469
18470                    dlg.finished(true);
18471                    return Ok(response);
18472                }
18473            }
18474        }
18475    }
18476
18477    /// Required. The resource name of the customer to list eligible billing accounts for. Format: accounts/{account_id}/customers/{customer_id}.
18478    ///
18479    /// Sets the *customer* path property to the given value.
18480    ///
18481    /// Even though the property as already been set when instantiating this call,
18482    /// we provide this method for API completeness.
18483    pub fn customer(
18484        mut self,
18485        new_value: &str,
18486    ) -> AccountCustomerQueryEligibleBillingAccountCall<'a, C> {
18487        self._customer = new_value.to_string();
18488        self
18489    }
18490    /// Required. List of SKUs to list eligible billing accounts for. At least one SKU is required. Format: products/{product_id}/skus/{sku_id}.
18491    ///
18492    /// Append the given value to the *skus* query property.
18493    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
18494    pub fn add_skus(
18495        mut self,
18496        new_value: &str,
18497    ) -> AccountCustomerQueryEligibleBillingAccountCall<'a, C> {
18498        self._skus.push(new_value.to_string());
18499        self
18500    }
18501    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18502    /// while executing the actual API request.
18503    ///
18504    /// ````text
18505    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18506    /// ````
18507    ///
18508    /// Sets the *delegate* property to the given value.
18509    pub fn delegate(
18510        mut self,
18511        new_value: &'a mut dyn common::Delegate,
18512    ) -> AccountCustomerQueryEligibleBillingAccountCall<'a, C> {
18513        self._delegate = Some(new_value);
18514        self
18515    }
18516
18517    /// Set any additional parameter of the query string used in the request.
18518    /// It should be used to set parameters which are not yet available through their own
18519    /// setters.
18520    ///
18521    /// Please note that this method must not be used to set any of the known parameters
18522    /// which have their own setter method. If done anyway, the request will fail.
18523    ///
18524    /// # Additional Parameters
18525    ///
18526    /// * *$.xgafv* (query-string) - V1 error format.
18527    /// * *access_token* (query-string) - OAuth access token.
18528    /// * *alt* (query-string) - Data format for response.
18529    /// * *callback* (query-string) - JSONP
18530    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18531    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18532    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18533    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18534    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18535    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18536    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18537    pub fn param<T>(
18538        mut self,
18539        name: T,
18540        value: T,
18541    ) -> AccountCustomerQueryEligibleBillingAccountCall<'a, C>
18542    where
18543        T: AsRef<str>,
18544    {
18545        self._additional_params
18546            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18547        self
18548    }
18549
18550    /// Identifies the authorization scope for the method you are building.
18551    ///
18552    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18553    /// [`Scope::AppOrder`].
18554    ///
18555    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18556    /// tokens for more than one scope.
18557    ///
18558    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18559    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18560    /// sufficient, a read-write scope will do as well.
18561    pub fn add_scope<St>(
18562        mut self,
18563        scope: St,
18564    ) -> AccountCustomerQueryEligibleBillingAccountCall<'a, C>
18565    where
18566        St: AsRef<str>,
18567    {
18568        self._scopes.insert(String::from(scope.as_ref()));
18569        self
18570    }
18571    /// Identifies the authorization scope(s) for the method you are building.
18572    ///
18573    /// See [`Self::add_scope()`] for details.
18574    pub fn add_scopes<I, St>(
18575        mut self,
18576        scopes: I,
18577    ) -> AccountCustomerQueryEligibleBillingAccountCall<'a, C>
18578    where
18579        I: IntoIterator<Item = St>,
18580        St: AsRef<str>,
18581    {
18582        self._scopes
18583            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18584        self
18585    }
18586
18587    /// Removes all scopes, and no default scope will be used either.
18588    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18589    /// for details).
18590    pub fn clear_scopes(mut self) -> AccountCustomerQueryEligibleBillingAccountCall<'a, C> {
18591        self._scopes.clear();
18592        self
18593    }
18594}
18595
18596/// Transfers customer entitlements to new reseller. Possible error codes: * PERMISSION_DENIED: * The customer doesn't belong to the reseller. * The reseller is not authorized to transact on this Product. See https://support.google.com/channelservices/answer/9759265 * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The customer or offer resource was not found. * ALREADY_EXISTS: The SKU was already transferred for the customer. * CONDITION_NOT_MET or FAILED_PRECONDITION: * The SKU requires domain verification to transfer, but the domain is not verified. * An Add-On SKU (example, Vault or Drive) is missing the pre-requisite SKU (example, G Suite Basic). * (Developer accounts only) Reseller and resold domain must meet the following naming requirements: * Domain names must start with goog-test. * Domain names must include the reseller domain. * Specify all transferring entitlements. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata will contain an instance of OperationMetadata.
18597///
18598/// A builder for the *customers.transferEntitlements* method supported by a *account* resource.
18599/// It is not used directly, but through a [`AccountMethods`] instance.
18600///
18601/// # Example
18602///
18603/// Instantiate a resource method builder
18604///
18605/// ```test_harness,no_run
18606/// # extern crate hyper;
18607/// # extern crate hyper_rustls;
18608/// # extern crate google_cloudchannel1 as cloudchannel1;
18609/// use cloudchannel1::api::GoogleCloudChannelV1TransferEntitlementsRequest;
18610/// # async fn dox() {
18611/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18612///
18613/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18614/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18615/// #     .with_native_roots()
18616/// #     .unwrap()
18617/// #     .https_only()
18618/// #     .enable_http2()
18619/// #     .build();
18620///
18621/// # let executor = hyper_util::rt::TokioExecutor::new();
18622/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18623/// #     secret,
18624/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18625/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18626/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18627/// #     ),
18628/// # ).build().await.unwrap();
18629///
18630/// # let client = hyper_util::client::legacy::Client::builder(
18631/// #     hyper_util::rt::TokioExecutor::new()
18632/// # )
18633/// # .build(
18634/// #     hyper_rustls::HttpsConnectorBuilder::new()
18635/// #         .with_native_roots()
18636/// #         .unwrap()
18637/// #         .https_or_http()
18638/// #         .enable_http2()
18639/// #         .build()
18640/// # );
18641/// # let mut hub = Cloudchannel::new(client, auth);
18642/// // As the method needs a request, you would usually fill it with the desired information
18643/// // into the respective structure. Some of the parts shown here might not be applicable !
18644/// // Values shown here are possibly random and not representative !
18645/// let mut req = GoogleCloudChannelV1TransferEntitlementsRequest::default();
18646///
18647/// // You can configure optional parameters by calling the respective setters at will, and
18648/// // execute the final call using `doit()`.
18649/// // Values shown here are possibly random and not representative !
18650/// let result = hub.accounts().customers_transfer_entitlements(req, "parent")
18651///              .doit().await;
18652/// # }
18653/// ```
18654pub struct AccountCustomerTransferEntitlementCall<'a, C>
18655where
18656    C: 'a,
18657{
18658    hub: &'a Cloudchannel<C>,
18659    _request: GoogleCloudChannelV1TransferEntitlementsRequest,
18660    _parent: String,
18661    _delegate: Option<&'a mut dyn common::Delegate>,
18662    _additional_params: HashMap<String, String>,
18663    _scopes: BTreeSet<String>,
18664}
18665
18666impl<'a, C> common::CallBuilder for AccountCustomerTransferEntitlementCall<'a, C> {}
18667
18668impl<'a, C> AccountCustomerTransferEntitlementCall<'a, C>
18669where
18670    C: common::Connector,
18671{
18672    /// Perform the operation you have build so far.
18673    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
18674        use std::borrow::Cow;
18675        use std::io::{Read, Seek};
18676
18677        use common::{url::Params, ToParts};
18678        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18679
18680        let mut dd = common::DefaultDelegate;
18681        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18682        dlg.begin(common::MethodInfo {
18683            id: "cloudchannel.accounts.customers.transferEntitlements",
18684            http_method: hyper::Method::POST,
18685        });
18686
18687        for &field in ["alt", "parent"].iter() {
18688            if self._additional_params.contains_key(field) {
18689                dlg.finished(false);
18690                return Err(common::Error::FieldClash(field));
18691            }
18692        }
18693
18694        let mut params = Params::with_capacity(4 + self._additional_params.len());
18695        params.push("parent", self._parent);
18696
18697        params.extend(self._additional_params.iter());
18698
18699        params.push("alt", "json");
18700        let mut url = self.hub._base_url.clone() + "v1/{+parent}:transferEntitlements";
18701        if self._scopes.is_empty() {
18702            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
18703        }
18704
18705        #[allow(clippy::single_element_loop)]
18706        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18707            url = params.uri_replacement(url, param_name, find_this, true);
18708        }
18709        {
18710            let to_remove = ["parent"];
18711            params.remove_params(&to_remove);
18712        }
18713
18714        let url = params.parse_with_url(&url);
18715
18716        let mut json_mime_type = mime::APPLICATION_JSON;
18717        let mut request_value_reader = {
18718            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18719            common::remove_json_null_values(&mut value);
18720            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18721            serde_json::to_writer(&mut dst, &value).unwrap();
18722            dst
18723        };
18724        let request_size = request_value_reader
18725            .seek(std::io::SeekFrom::End(0))
18726            .unwrap();
18727        request_value_reader
18728            .seek(std::io::SeekFrom::Start(0))
18729            .unwrap();
18730
18731        loop {
18732            let token = match self
18733                .hub
18734                .auth
18735                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18736                .await
18737            {
18738                Ok(token) => token,
18739                Err(e) => match dlg.token(e) {
18740                    Ok(token) => token,
18741                    Err(e) => {
18742                        dlg.finished(false);
18743                        return Err(common::Error::MissingToken(e));
18744                    }
18745                },
18746            };
18747            request_value_reader
18748                .seek(std::io::SeekFrom::Start(0))
18749                .unwrap();
18750            let mut req_result = {
18751                let client = &self.hub.client;
18752                dlg.pre_request();
18753                let mut req_builder = hyper::Request::builder()
18754                    .method(hyper::Method::POST)
18755                    .uri(url.as_str())
18756                    .header(USER_AGENT, self.hub._user_agent.clone());
18757
18758                if let Some(token) = token.as_ref() {
18759                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18760                }
18761
18762                let request = req_builder
18763                    .header(CONTENT_TYPE, json_mime_type.to_string())
18764                    .header(CONTENT_LENGTH, request_size as u64)
18765                    .body(common::to_body(
18766                        request_value_reader.get_ref().clone().into(),
18767                    ));
18768
18769                client.request(request.unwrap()).await
18770            };
18771
18772            match req_result {
18773                Err(err) => {
18774                    if let common::Retry::After(d) = dlg.http_error(&err) {
18775                        sleep(d).await;
18776                        continue;
18777                    }
18778                    dlg.finished(false);
18779                    return Err(common::Error::HttpError(err));
18780                }
18781                Ok(res) => {
18782                    let (mut parts, body) = res.into_parts();
18783                    let mut body = common::Body::new(body);
18784                    if !parts.status.is_success() {
18785                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18786                        let error = serde_json::from_str(&common::to_string(&bytes));
18787                        let response = common::to_response(parts, bytes.into());
18788
18789                        if let common::Retry::After(d) =
18790                            dlg.http_failure(&response, error.as_ref().ok())
18791                        {
18792                            sleep(d).await;
18793                            continue;
18794                        }
18795
18796                        dlg.finished(false);
18797
18798                        return Err(match error {
18799                            Ok(value) => common::Error::BadRequest(value),
18800                            _ => common::Error::Failure(response),
18801                        });
18802                    }
18803                    let response = {
18804                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18805                        let encoded = common::to_string(&bytes);
18806                        match serde_json::from_str(&encoded) {
18807                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18808                            Err(error) => {
18809                                dlg.response_json_decode_error(&encoded, &error);
18810                                return Err(common::Error::JsonDecodeError(
18811                                    encoded.to_string(),
18812                                    error,
18813                                ));
18814                            }
18815                        }
18816                    };
18817
18818                    dlg.finished(true);
18819                    return Ok(response);
18820                }
18821            }
18822        }
18823    }
18824
18825    ///
18826    /// Sets the *request* property to the given value.
18827    ///
18828    /// Even though the property as already been set when instantiating this call,
18829    /// we provide this method for API completeness.
18830    pub fn request(
18831        mut self,
18832        new_value: GoogleCloudChannelV1TransferEntitlementsRequest,
18833    ) -> AccountCustomerTransferEntitlementCall<'a, C> {
18834        self._request = new_value;
18835        self
18836    }
18837    /// Required. The resource name of the reseller's customer account that will receive transferred entitlements. Parent uses the format: accounts/{account_id}/customers/{customer_id}
18838    ///
18839    /// Sets the *parent* path property to the given value.
18840    ///
18841    /// Even though the property as already been set when instantiating this call,
18842    /// we provide this method for API completeness.
18843    pub fn parent(mut self, new_value: &str) -> AccountCustomerTransferEntitlementCall<'a, C> {
18844        self._parent = new_value.to_string();
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    ) -> AccountCustomerTransferEntitlementCall<'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) -> AccountCustomerTransferEntitlementCall<'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::AppOrder`].
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) -> AccountCustomerTransferEntitlementCall<'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) -> AccountCustomerTransferEntitlementCall<'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) -> AccountCustomerTransferEntitlementCall<'a, C> {
18927        self._scopes.clear();
18928        self
18929    }
18930}
18931
18932/// Transfers customer entitlements from their current reseller to Google. Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The customer or offer resource was not found. * ALREADY_EXISTS: The SKU was already transferred for the customer. * CONDITION_NOT_MET or FAILED_PRECONDITION: * The SKU requires domain verification to transfer, but the domain is not verified. * An Add-On SKU (example, Vault or Drive) is missing the pre-requisite SKU (example, G Suite Basic). * (Developer accounts only) Reseller and resold domain must meet the following naming requirements: * Domain names must start with goog-test. * Domain names must include the reseller domain. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The response will contain google.protobuf.Empty on success. The Operation metadata will contain an instance of OperationMetadata.
18933///
18934/// A builder for the *customers.transferEntitlementsToGoogle* method supported by a *account* resource.
18935/// It is not used directly, but through a [`AccountMethods`] 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_cloudchannel1 as cloudchannel1;
18945/// use cloudchannel1::api::GoogleCloudChannelV1TransferEntitlementsToGoogleRequest;
18946/// # async fn dox() {
18947/// # use cloudchannel1::{Cloudchannel, 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 = Cloudchannel::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 = GoogleCloudChannelV1TransferEntitlementsToGoogleRequest::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.accounts().customers_transfer_entitlements_to_google(req, "parent")
18987///              .doit().await;
18988/// # }
18989/// ```
18990pub struct AccountCustomerTransferEntitlementsToGoogleCall<'a, C>
18991where
18992    C: 'a,
18993{
18994    hub: &'a Cloudchannel<C>,
18995    _request: GoogleCloudChannelV1TransferEntitlementsToGoogleRequest,
18996    _parent: String,
18997    _delegate: Option<&'a mut dyn common::Delegate>,
18998    _additional_params: HashMap<String, String>,
18999    _scopes: BTreeSet<String>,
19000}
19001
19002impl<'a, C> common::CallBuilder for AccountCustomerTransferEntitlementsToGoogleCall<'a, C> {}
19003
19004impl<'a, C> AccountCustomerTransferEntitlementsToGoogleCall<'a, C>
19005where
19006    C: common::Connector,
19007{
19008    /// Perform the operation you have build so far.
19009    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
19010        use std::borrow::Cow;
19011        use std::io::{Read, Seek};
19012
19013        use common::{url::Params, ToParts};
19014        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19015
19016        let mut dd = common::DefaultDelegate;
19017        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19018        dlg.begin(common::MethodInfo {
19019            id: "cloudchannel.accounts.customers.transferEntitlementsToGoogle",
19020            http_method: hyper::Method::POST,
19021        });
19022
19023        for &field in ["alt", "parent"].iter() {
19024            if self._additional_params.contains_key(field) {
19025                dlg.finished(false);
19026                return Err(common::Error::FieldClash(field));
19027            }
19028        }
19029
19030        let mut params = Params::with_capacity(4 + self._additional_params.len());
19031        params.push("parent", self._parent);
19032
19033        params.extend(self._additional_params.iter());
19034
19035        params.push("alt", "json");
19036        let mut url = self.hub._base_url.clone() + "v1/{+parent}:transferEntitlementsToGoogle";
19037        if self._scopes.is_empty() {
19038            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
19039        }
19040
19041        #[allow(clippy::single_element_loop)]
19042        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19043            url = params.uri_replacement(url, param_name, find_this, true);
19044        }
19045        {
19046            let to_remove = ["parent"];
19047            params.remove_params(&to_remove);
19048        }
19049
19050        let url = params.parse_with_url(&url);
19051
19052        let mut json_mime_type = mime::APPLICATION_JSON;
19053        let mut request_value_reader = {
19054            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19055            common::remove_json_null_values(&mut value);
19056            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19057            serde_json::to_writer(&mut dst, &value).unwrap();
19058            dst
19059        };
19060        let request_size = request_value_reader
19061            .seek(std::io::SeekFrom::End(0))
19062            .unwrap();
19063        request_value_reader
19064            .seek(std::io::SeekFrom::Start(0))
19065            .unwrap();
19066
19067        loop {
19068            let token = match self
19069                .hub
19070                .auth
19071                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19072                .await
19073            {
19074                Ok(token) => token,
19075                Err(e) => match dlg.token(e) {
19076                    Ok(token) => token,
19077                    Err(e) => {
19078                        dlg.finished(false);
19079                        return Err(common::Error::MissingToken(e));
19080                    }
19081                },
19082            };
19083            request_value_reader
19084                .seek(std::io::SeekFrom::Start(0))
19085                .unwrap();
19086            let mut req_result = {
19087                let client = &self.hub.client;
19088                dlg.pre_request();
19089                let mut req_builder = hyper::Request::builder()
19090                    .method(hyper::Method::POST)
19091                    .uri(url.as_str())
19092                    .header(USER_AGENT, self.hub._user_agent.clone());
19093
19094                if let Some(token) = token.as_ref() {
19095                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19096                }
19097
19098                let request = req_builder
19099                    .header(CONTENT_TYPE, json_mime_type.to_string())
19100                    .header(CONTENT_LENGTH, request_size as u64)
19101                    .body(common::to_body(
19102                        request_value_reader.get_ref().clone().into(),
19103                    ));
19104
19105                client.request(request.unwrap()).await
19106            };
19107
19108            match req_result {
19109                Err(err) => {
19110                    if let common::Retry::After(d) = dlg.http_error(&err) {
19111                        sleep(d).await;
19112                        continue;
19113                    }
19114                    dlg.finished(false);
19115                    return Err(common::Error::HttpError(err));
19116                }
19117                Ok(res) => {
19118                    let (mut parts, body) = res.into_parts();
19119                    let mut body = common::Body::new(body);
19120                    if !parts.status.is_success() {
19121                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19122                        let error = serde_json::from_str(&common::to_string(&bytes));
19123                        let response = common::to_response(parts, bytes.into());
19124
19125                        if let common::Retry::After(d) =
19126                            dlg.http_failure(&response, error.as_ref().ok())
19127                        {
19128                            sleep(d).await;
19129                            continue;
19130                        }
19131
19132                        dlg.finished(false);
19133
19134                        return Err(match error {
19135                            Ok(value) => common::Error::BadRequest(value),
19136                            _ => common::Error::Failure(response),
19137                        });
19138                    }
19139                    let response = {
19140                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19141                        let encoded = common::to_string(&bytes);
19142                        match serde_json::from_str(&encoded) {
19143                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19144                            Err(error) => {
19145                                dlg.response_json_decode_error(&encoded, &error);
19146                                return Err(common::Error::JsonDecodeError(
19147                                    encoded.to_string(),
19148                                    error,
19149                                ));
19150                            }
19151                        }
19152                    };
19153
19154                    dlg.finished(true);
19155                    return Ok(response);
19156                }
19157            }
19158        }
19159    }
19160
19161    ///
19162    /// Sets the *request* property to the given value.
19163    ///
19164    /// Even though the property as already been set when instantiating this call,
19165    /// we provide this method for API completeness.
19166    pub fn request(
19167        mut self,
19168        new_value: GoogleCloudChannelV1TransferEntitlementsToGoogleRequest,
19169    ) -> AccountCustomerTransferEntitlementsToGoogleCall<'a, C> {
19170        self._request = new_value;
19171        self
19172    }
19173    /// Required. The resource name of the reseller's customer account where the entitlements transfer from. Parent uses the format: accounts/{account_id}/customers/{customer_id}
19174    ///
19175    /// Sets the *parent* path property to the given value.
19176    ///
19177    /// Even though the property as already been set when instantiating this call,
19178    /// we provide this method for API completeness.
19179    pub fn parent(
19180        mut self,
19181        new_value: &str,
19182    ) -> AccountCustomerTransferEntitlementsToGoogleCall<'a, C> {
19183        self._parent = new_value.to_string();
19184        self
19185    }
19186    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19187    /// while executing the actual API request.
19188    ///
19189    /// ````text
19190    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19191    /// ````
19192    ///
19193    /// Sets the *delegate* property to the given value.
19194    pub fn delegate(
19195        mut self,
19196        new_value: &'a mut dyn common::Delegate,
19197    ) -> AccountCustomerTransferEntitlementsToGoogleCall<'a, C> {
19198        self._delegate = Some(new_value);
19199        self
19200    }
19201
19202    /// Set any additional parameter of the query string used in the request.
19203    /// It should be used to set parameters which are not yet available through their own
19204    /// setters.
19205    ///
19206    /// Please note that this method must not be used to set any of the known parameters
19207    /// which have their own setter method. If done anyway, the request will fail.
19208    ///
19209    /// # Additional Parameters
19210    ///
19211    /// * *$.xgafv* (query-string) - V1 error format.
19212    /// * *access_token* (query-string) - OAuth access token.
19213    /// * *alt* (query-string) - Data format for response.
19214    /// * *callback* (query-string) - JSONP
19215    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19216    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19217    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19218    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19219    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19220    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19221    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19222    pub fn param<T>(
19223        mut self,
19224        name: T,
19225        value: T,
19226    ) -> AccountCustomerTransferEntitlementsToGoogleCall<'a, C>
19227    where
19228        T: AsRef<str>,
19229    {
19230        self._additional_params
19231            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19232        self
19233    }
19234
19235    /// Identifies the authorization scope for the method you are building.
19236    ///
19237    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19238    /// [`Scope::AppOrder`].
19239    ///
19240    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19241    /// tokens for more than one scope.
19242    ///
19243    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19244    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19245    /// sufficient, a read-write scope will do as well.
19246    pub fn add_scope<St>(
19247        mut self,
19248        scope: St,
19249    ) -> AccountCustomerTransferEntitlementsToGoogleCall<'a, C>
19250    where
19251        St: AsRef<str>,
19252    {
19253        self._scopes.insert(String::from(scope.as_ref()));
19254        self
19255    }
19256    /// Identifies the authorization scope(s) for the method you are building.
19257    ///
19258    /// See [`Self::add_scope()`] for details.
19259    pub fn add_scopes<I, St>(
19260        mut self,
19261        scopes: I,
19262    ) -> AccountCustomerTransferEntitlementsToGoogleCall<'a, C>
19263    where
19264        I: IntoIterator<Item = St>,
19265        St: AsRef<str>,
19266    {
19267        self._scopes
19268            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19269        self
19270    }
19271
19272    /// Removes all scopes, and no default scope will be used either.
19273    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19274    /// for details).
19275    pub fn clear_scopes(mut self) -> AccountCustomerTransferEntitlementsToGoogleCall<'a, C> {
19276        self._scopes.clear();
19277        self
19278    }
19279}
19280
19281/// Lists the Offers the reseller can sell. Possible error codes: * INVALID_ARGUMENT: Required request parameters are missing or invalid.
19282///
19283/// A builder for the *offers.list* method supported by a *account* resource.
19284/// It is not used directly, but through a [`AccountMethods`] instance.
19285///
19286/// # Example
19287///
19288/// Instantiate a resource method builder
19289///
19290/// ```test_harness,no_run
19291/// # extern crate hyper;
19292/// # extern crate hyper_rustls;
19293/// # extern crate google_cloudchannel1 as cloudchannel1;
19294/// # async fn dox() {
19295/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19296///
19297/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19298/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19299/// #     .with_native_roots()
19300/// #     .unwrap()
19301/// #     .https_only()
19302/// #     .enable_http2()
19303/// #     .build();
19304///
19305/// # let executor = hyper_util::rt::TokioExecutor::new();
19306/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19307/// #     secret,
19308/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19309/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19310/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19311/// #     ),
19312/// # ).build().await.unwrap();
19313///
19314/// # let client = hyper_util::client::legacy::Client::builder(
19315/// #     hyper_util::rt::TokioExecutor::new()
19316/// # )
19317/// # .build(
19318/// #     hyper_rustls::HttpsConnectorBuilder::new()
19319/// #         .with_native_roots()
19320/// #         .unwrap()
19321/// #         .https_or_http()
19322/// #         .enable_http2()
19323/// #         .build()
19324/// # );
19325/// # let mut hub = Cloudchannel::new(client, auth);
19326/// // You can configure optional parameters by calling the respective setters at will, and
19327/// // execute the final call using `doit()`.
19328/// // Values shown here are possibly random and not representative !
19329/// let result = hub.accounts().offers_list("parent")
19330///              .show_future_offers(true)
19331///              .page_token("et")
19332///              .page_size(-23)
19333///              .language_code("voluptua.")
19334///              .filter("dolore")
19335///              .doit().await;
19336/// # }
19337/// ```
19338pub struct AccountOfferListCall<'a, C>
19339where
19340    C: 'a,
19341{
19342    hub: &'a Cloudchannel<C>,
19343    _parent: String,
19344    _show_future_offers: Option<bool>,
19345    _page_token: Option<String>,
19346    _page_size: Option<i32>,
19347    _language_code: Option<String>,
19348    _filter: Option<String>,
19349    _delegate: Option<&'a mut dyn common::Delegate>,
19350    _additional_params: HashMap<String, String>,
19351    _scopes: BTreeSet<String>,
19352}
19353
19354impl<'a, C> common::CallBuilder for AccountOfferListCall<'a, C> {}
19355
19356impl<'a, C> AccountOfferListCall<'a, C>
19357where
19358    C: common::Connector,
19359{
19360    /// Perform the operation you have build so far.
19361    pub async fn doit(
19362        mut self,
19363    ) -> common::Result<(common::Response, GoogleCloudChannelV1ListOffersResponse)> {
19364        use std::borrow::Cow;
19365        use std::io::{Read, Seek};
19366
19367        use common::{url::Params, ToParts};
19368        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19369
19370        let mut dd = common::DefaultDelegate;
19371        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19372        dlg.begin(common::MethodInfo {
19373            id: "cloudchannel.accounts.offers.list",
19374            http_method: hyper::Method::GET,
19375        });
19376
19377        for &field in [
19378            "alt",
19379            "parent",
19380            "showFutureOffers",
19381            "pageToken",
19382            "pageSize",
19383            "languageCode",
19384            "filter",
19385        ]
19386        .iter()
19387        {
19388            if self._additional_params.contains_key(field) {
19389                dlg.finished(false);
19390                return Err(common::Error::FieldClash(field));
19391            }
19392        }
19393
19394        let mut params = Params::with_capacity(8 + self._additional_params.len());
19395        params.push("parent", self._parent);
19396        if let Some(value) = self._show_future_offers.as_ref() {
19397            params.push("showFutureOffers", value.to_string());
19398        }
19399        if let Some(value) = self._page_token.as_ref() {
19400            params.push("pageToken", value);
19401        }
19402        if let Some(value) = self._page_size.as_ref() {
19403            params.push("pageSize", value.to_string());
19404        }
19405        if let Some(value) = self._language_code.as_ref() {
19406            params.push("languageCode", value);
19407        }
19408        if let Some(value) = self._filter.as_ref() {
19409            params.push("filter", value);
19410        }
19411
19412        params.extend(self._additional_params.iter());
19413
19414        params.push("alt", "json");
19415        let mut url = self.hub._base_url.clone() + "v1/{+parent}/offers";
19416        if self._scopes.is_empty() {
19417            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
19418        }
19419
19420        #[allow(clippy::single_element_loop)]
19421        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19422            url = params.uri_replacement(url, param_name, find_this, true);
19423        }
19424        {
19425            let to_remove = ["parent"];
19426            params.remove_params(&to_remove);
19427        }
19428
19429        let url = params.parse_with_url(&url);
19430
19431        loop {
19432            let token = match self
19433                .hub
19434                .auth
19435                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19436                .await
19437            {
19438                Ok(token) => token,
19439                Err(e) => match dlg.token(e) {
19440                    Ok(token) => token,
19441                    Err(e) => {
19442                        dlg.finished(false);
19443                        return Err(common::Error::MissingToken(e));
19444                    }
19445                },
19446            };
19447            let mut req_result = {
19448                let client = &self.hub.client;
19449                dlg.pre_request();
19450                let mut req_builder = hyper::Request::builder()
19451                    .method(hyper::Method::GET)
19452                    .uri(url.as_str())
19453                    .header(USER_AGENT, self.hub._user_agent.clone());
19454
19455                if let Some(token) = token.as_ref() {
19456                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19457                }
19458
19459                let request = req_builder
19460                    .header(CONTENT_LENGTH, 0_u64)
19461                    .body(common::to_body::<String>(None));
19462
19463                client.request(request.unwrap()).await
19464            };
19465
19466            match req_result {
19467                Err(err) => {
19468                    if let common::Retry::After(d) = dlg.http_error(&err) {
19469                        sleep(d).await;
19470                        continue;
19471                    }
19472                    dlg.finished(false);
19473                    return Err(common::Error::HttpError(err));
19474                }
19475                Ok(res) => {
19476                    let (mut parts, body) = res.into_parts();
19477                    let mut body = common::Body::new(body);
19478                    if !parts.status.is_success() {
19479                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19480                        let error = serde_json::from_str(&common::to_string(&bytes));
19481                        let response = common::to_response(parts, bytes.into());
19482
19483                        if let common::Retry::After(d) =
19484                            dlg.http_failure(&response, error.as_ref().ok())
19485                        {
19486                            sleep(d).await;
19487                            continue;
19488                        }
19489
19490                        dlg.finished(false);
19491
19492                        return Err(match error {
19493                            Ok(value) => common::Error::BadRequest(value),
19494                            _ => common::Error::Failure(response),
19495                        });
19496                    }
19497                    let response = {
19498                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19499                        let encoded = common::to_string(&bytes);
19500                        match serde_json::from_str(&encoded) {
19501                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19502                            Err(error) => {
19503                                dlg.response_json_decode_error(&encoded, &error);
19504                                return Err(common::Error::JsonDecodeError(
19505                                    encoded.to_string(),
19506                                    error,
19507                                ));
19508                            }
19509                        }
19510                    };
19511
19512                    dlg.finished(true);
19513                    return Ok(response);
19514                }
19515            }
19516        }
19517    }
19518
19519    /// Required. The resource name of the reseller account from which to list Offers. Parent uses the format: accounts/{account_id}.
19520    ///
19521    /// Sets the *parent* path property to the given value.
19522    ///
19523    /// Even though the property as already been set when instantiating this call,
19524    /// we provide this method for API completeness.
19525    pub fn parent(mut self, new_value: &str) -> AccountOfferListCall<'a, C> {
19526        self._parent = new_value.to_string();
19527        self
19528    }
19529    /// Optional. A boolean flag that determines if a response returns future offers 30 days from now. If the show_future_offers is true, the response will only contain offers that are scheduled to be available 30 days from now.
19530    ///
19531    /// Sets the *show future offers* query property to the given value.
19532    pub fn show_future_offers(mut self, new_value: bool) -> AccountOfferListCall<'a, C> {
19533        self._show_future_offers = Some(new_value);
19534        self
19535    }
19536    /// Optional. A token for a page of results other than the first page.
19537    ///
19538    /// Sets the *page token* query property to the given value.
19539    pub fn page_token(mut self, new_value: &str) -> AccountOfferListCall<'a, C> {
19540        self._page_token = Some(new_value.to_string());
19541        self
19542    }
19543    /// Optional. Requested page size. Server might return fewer results than requested. If unspecified, returns at most 500 Offers. The maximum value is 1000; the server will coerce values above 1000.
19544    ///
19545    /// Sets the *page size* query property to the given value.
19546    pub fn page_size(mut self, new_value: i32) -> AccountOfferListCall<'a, C> {
19547        self._page_size = Some(new_value);
19548        self
19549    }
19550    /// Optional. The BCP-47 language code. For example, "en-US". The response will localize in the corresponding language code, if specified. The default value is "en-US".
19551    ///
19552    /// Sets the *language code* query property to the given value.
19553    pub fn language_code(mut self, new_value: &str) -> AccountOfferListCall<'a, C> {
19554        self._language_code = Some(new_value.to_string());
19555        self
19556    }
19557    /// Optional. The expression to filter results by name (name of the Offer), sku.name (name of the SKU), or sku.product.name (name of the Product). Example 1: sku.product.name=products/p1 AND sku.name!=products/p1/skus/s1 Example 2: name=accounts/a1/offers/o1
19558    ///
19559    /// Sets the *filter* query property to the given value.
19560    pub fn filter(mut self, new_value: &str) -> AccountOfferListCall<'a, C> {
19561        self._filter = Some(new_value.to_string());
19562        self
19563    }
19564    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19565    /// while executing the actual API request.
19566    ///
19567    /// ````text
19568    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19569    /// ````
19570    ///
19571    /// Sets the *delegate* property to the given value.
19572    pub fn delegate(
19573        mut self,
19574        new_value: &'a mut dyn common::Delegate,
19575    ) -> AccountOfferListCall<'a, C> {
19576        self._delegate = Some(new_value);
19577        self
19578    }
19579
19580    /// Set any additional parameter of the query string used in the request.
19581    /// It should be used to set parameters which are not yet available through their own
19582    /// setters.
19583    ///
19584    /// Please note that this method must not be used to set any of the known parameters
19585    /// which have their own setter method. If done anyway, the request will fail.
19586    ///
19587    /// # Additional Parameters
19588    ///
19589    /// * *$.xgafv* (query-string) - V1 error format.
19590    /// * *access_token* (query-string) - OAuth access token.
19591    /// * *alt* (query-string) - Data format for response.
19592    /// * *callback* (query-string) - JSONP
19593    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19594    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19595    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19596    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19597    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19598    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19599    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19600    pub fn param<T>(mut self, name: T, value: T) -> AccountOfferListCall<'a, C>
19601    where
19602        T: AsRef<str>,
19603    {
19604        self._additional_params
19605            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19606        self
19607    }
19608
19609    /// Identifies the authorization scope for the method you are building.
19610    ///
19611    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19612    /// [`Scope::AppOrder`].
19613    ///
19614    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19615    /// tokens for more than one scope.
19616    ///
19617    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19618    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19619    /// sufficient, a read-write scope will do as well.
19620    pub fn add_scope<St>(mut self, scope: St) -> AccountOfferListCall<'a, C>
19621    where
19622        St: AsRef<str>,
19623    {
19624        self._scopes.insert(String::from(scope.as_ref()));
19625        self
19626    }
19627    /// Identifies the authorization scope(s) for the method you are building.
19628    ///
19629    /// See [`Self::add_scope()`] for details.
19630    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountOfferListCall<'a, C>
19631    where
19632        I: IntoIterator<Item = St>,
19633        St: AsRef<str>,
19634    {
19635        self._scopes
19636            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19637        self
19638    }
19639
19640    /// Removes all scopes, and no default scope will be used either.
19641    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19642    /// for details).
19643    pub fn clear_scopes(mut self) -> AccountOfferListCall<'a, C> {
19644        self._scopes.clear();
19645        self
19646    }
19647}
19648
19649/// Retrieves data generated by CloudChannelReportsService.RunReportJob. Deprecated: Please use [Export Channel Services data to BigQuery](https://cloud.google.com/channel/docs/rebilling/export-data-to-bigquery) instead.
19650///
19651/// A builder for the *reportJobs.fetchReportResults* method supported by a *account* resource.
19652/// It is not used directly, but through a [`AccountMethods`] instance.
19653///
19654/// # Example
19655///
19656/// Instantiate a resource method builder
19657///
19658/// ```test_harness,no_run
19659/// # extern crate hyper;
19660/// # extern crate hyper_rustls;
19661/// # extern crate google_cloudchannel1 as cloudchannel1;
19662/// use cloudchannel1::api::GoogleCloudChannelV1FetchReportResultsRequest;
19663/// # async fn dox() {
19664/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19665///
19666/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19667/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19668/// #     .with_native_roots()
19669/// #     .unwrap()
19670/// #     .https_only()
19671/// #     .enable_http2()
19672/// #     .build();
19673///
19674/// # let executor = hyper_util::rt::TokioExecutor::new();
19675/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19676/// #     secret,
19677/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19678/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19679/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19680/// #     ),
19681/// # ).build().await.unwrap();
19682///
19683/// # let client = hyper_util::client::legacy::Client::builder(
19684/// #     hyper_util::rt::TokioExecutor::new()
19685/// # )
19686/// # .build(
19687/// #     hyper_rustls::HttpsConnectorBuilder::new()
19688/// #         .with_native_roots()
19689/// #         .unwrap()
19690/// #         .https_or_http()
19691/// #         .enable_http2()
19692/// #         .build()
19693/// # );
19694/// # let mut hub = Cloudchannel::new(client, auth);
19695/// // As the method needs a request, you would usually fill it with the desired information
19696/// // into the respective structure. Some of the parts shown here might not be applicable !
19697/// // Values shown here are possibly random and not representative !
19698/// let mut req = GoogleCloudChannelV1FetchReportResultsRequest::default();
19699///
19700/// // You can configure optional parameters by calling the respective setters at will, and
19701/// // execute the final call using `doit()`.
19702/// // Values shown here are possibly random and not representative !
19703/// let result = hub.accounts().report_jobs_fetch_report_results(req, "reportJob")
19704///              .doit().await;
19705/// # }
19706/// ```
19707pub struct AccountReportJobFetchReportResultCall<'a, C>
19708where
19709    C: 'a,
19710{
19711    hub: &'a Cloudchannel<C>,
19712    _request: GoogleCloudChannelV1FetchReportResultsRequest,
19713    _report_job: String,
19714    _delegate: Option<&'a mut dyn common::Delegate>,
19715    _additional_params: HashMap<String, String>,
19716    _scopes: BTreeSet<String>,
19717}
19718
19719impl<'a, C> common::CallBuilder for AccountReportJobFetchReportResultCall<'a, C> {}
19720
19721impl<'a, C> AccountReportJobFetchReportResultCall<'a, C>
19722where
19723    C: common::Connector,
19724{
19725    /// Perform the operation you have build so far.
19726    pub async fn doit(
19727        mut self,
19728    ) -> common::Result<(
19729        common::Response,
19730        GoogleCloudChannelV1FetchReportResultsResponse,
19731    )> {
19732        use std::borrow::Cow;
19733        use std::io::{Read, Seek};
19734
19735        use common::{url::Params, ToParts};
19736        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19737
19738        let mut dd = common::DefaultDelegate;
19739        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19740        dlg.begin(common::MethodInfo {
19741            id: "cloudchannel.accounts.reportJobs.fetchReportResults",
19742            http_method: hyper::Method::POST,
19743        });
19744
19745        for &field in ["alt", "reportJob"].iter() {
19746            if self._additional_params.contains_key(field) {
19747                dlg.finished(false);
19748                return Err(common::Error::FieldClash(field));
19749            }
19750        }
19751
19752        let mut params = Params::with_capacity(4 + self._additional_params.len());
19753        params.push("reportJob", self._report_job);
19754
19755        params.extend(self._additional_params.iter());
19756
19757        params.push("alt", "json");
19758        let mut url = self.hub._base_url.clone() + "v1/{+reportJob}:fetchReportResults";
19759        if self._scopes.is_empty() {
19760            self._scopes
19761                .insert(Scope::AppReportUsageReadonly.as_ref().to_string());
19762        }
19763
19764        #[allow(clippy::single_element_loop)]
19765        for &(find_this, param_name) in [("{+reportJob}", "reportJob")].iter() {
19766            url = params.uri_replacement(url, param_name, find_this, true);
19767        }
19768        {
19769            let to_remove = ["reportJob"];
19770            params.remove_params(&to_remove);
19771        }
19772
19773        let url = params.parse_with_url(&url);
19774
19775        let mut json_mime_type = mime::APPLICATION_JSON;
19776        let mut request_value_reader = {
19777            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19778            common::remove_json_null_values(&mut value);
19779            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19780            serde_json::to_writer(&mut dst, &value).unwrap();
19781            dst
19782        };
19783        let request_size = request_value_reader
19784            .seek(std::io::SeekFrom::End(0))
19785            .unwrap();
19786        request_value_reader
19787            .seek(std::io::SeekFrom::Start(0))
19788            .unwrap();
19789
19790        loop {
19791            let token = match self
19792                .hub
19793                .auth
19794                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19795                .await
19796            {
19797                Ok(token) => token,
19798                Err(e) => match dlg.token(e) {
19799                    Ok(token) => token,
19800                    Err(e) => {
19801                        dlg.finished(false);
19802                        return Err(common::Error::MissingToken(e));
19803                    }
19804                },
19805            };
19806            request_value_reader
19807                .seek(std::io::SeekFrom::Start(0))
19808                .unwrap();
19809            let mut req_result = {
19810                let client = &self.hub.client;
19811                dlg.pre_request();
19812                let mut req_builder = hyper::Request::builder()
19813                    .method(hyper::Method::POST)
19814                    .uri(url.as_str())
19815                    .header(USER_AGENT, self.hub._user_agent.clone());
19816
19817                if let Some(token) = token.as_ref() {
19818                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19819                }
19820
19821                let request = req_builder
19822                    .header(CONTENT_TYPE, json_mime_type.to_string())
19823                    .header(CONTENT_LENGTH, request_size as u64)
19824                    .body(common::to_body(
19825                        request_value_reader.get_ref().clone().into(),
19826                    ));
19827
19828                client.request(request.unwrap()).await
19829            };
19830
19831            match req_result {
19832                Err(err) => {
19833                    if let common::Retry::After(d) = dlg.http_error(&err) {
19834                        sleep(d).await;
19835                        continue;
19836                    }
19837                    dlg.finished(false);
19838                    return Err(common::Error::HttpError(err));
19839                }
19840                Ok(res) => {
19841                    let (mut parts, body) = res.into_parts();
19842                    let mut body = common::Body::new(body);
19843                    if !parts.status.is_success() {
19844                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19845                        let error = serde_json::from_str(&common::to_string(&bytes));
19846                        let response = common::to_response(parts, bytes.into());
19847
19848                        if let common::Retry::After(d) =
19849                            dlg.http_failure(&response, error.as_ref().ok())
19850                        {
19851                            sleep(d).await;
19852                            continue;
19853                        }
19854
19855                        dlg.finished(false);
19856
19857                        return Err(match error {
19858                            Ok(value) => common::Error::BadRequest(value),
19859                            _ => common::Error::Failure(response),
19860                        });
19861                    }
19862                    let response = {
19863                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19864                        let encoded = common::to_string(&bytes);
19865                        match serde_json::from_str(&encoded) {
19866                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19867                            Err(error) => {
19868                                dlg.response_json_decode_error(&encoded, &error);
19869                                return Err(common::Error::JsonDecodeError(
19870                                    encoded.to_string(),
19871                                    error,
19872                                ));
19873                            }
19874                        }
19875                    };
19876
19877                    dlg.finished(true);
19878                    return Ok(response);
19879                }
19880            }
19881        }
19882    }
19883
19884    ///
19885    /// Sets the *request* property to the given value.
19886    ///
19887    /// Even though the property as already been set when instantiating this call,
19888    /// we provide this method for API completeness.
19889    pub fn request(
19890        mut self,
19891        new_value: GoogleCloudChannelV1FetchReportResultsRequest,
19892    ) -> AccountReportJobFetchReportResultCall<'a, C> {
19893        self._request = new_value;
19894        self
19895    }
19896    /// Required. The report job created by CloudChannelReportsService.RunReportJob. Report_job uses the format: accounts/{account_id}/reportJobs/{report_job_id}
19897    ///
19898    /// Sets the *report job* path property to the given value.
19899    ///
19900    /// Even though the property as already been set when instantiating this call,
19901    /// we provide this method for API completeness.
19902    pub fn report_job(mut self, new_value: &str) -> AccountReportJobFetchReportResultCall<'a, C> {
19903        self._report_job = new_value.to_string();
19904        self
19905    }
19906    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19907    /// while executing the actual API request.
19908    ///
19909    /// ````text
19910    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19911    /// ````
19912    ///
19913    /// Sets the *delegate* property to the given value.
19914    pub fn delegate(
19915        mut self,
19916        new_value: &'a mut dyn common::Delegate,
19917    ) -> AccountReportJobFetchReportResultCall<'a, C> {
19918        self._delegate = Some(new_value);
19919        self
19920    }
19921
19922    /// Set any additional parameter of the query string used in the request.
19923    /// It should be used to set parameters which are not yet available through their own
19924    /// setters.
19925    ///
19926    /// Please note that this method must not be used to set any of the known parameters
19927    /// which have their own setter method. If done anyway, the request will fail.
19928    ///
19929    /// # Additional Parameters
19930    ///
19931    /// * *$.xgafv* (query-string) - V1 error format.
19932    /// * *access_token* (query-string) - OAuth access token.
19933    /// * *alt* (query-string) - Data format for response.
19934    /// * *callback* (query-string) - JSONP
19935    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19936    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19937    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19938    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19939    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19940    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19941    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19942    pub fn param<T>(mut self, name: T, value: T) -> AccountReportJobFetchReportResultCall<'a, C>
19943    where
19944        T: AsRef<str>,
19945    {
19946        self._additional_params
19947            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19948        self
19949    }
19950
19951    /// Identifies the authorization scope for the method you are building.
19952    ///
19953    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19954    /// [`Scope::AppReportUsageReadonly`].
19955    ///
19956    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19957    /// tokens for more than one scope.
19958    ///
19959    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19960    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19961    /// sufficient, a read-write scope will do as well.
19962    pub fn add_scope<St>(mut self, scope: St) -> AccountReportJobFetchReportResultCall<'a, C>
19963    where
19964        St: AsRef<str>,
19965    {
19966        self._scopes.insert(String::from(scope.as_ref()));
19967        self
19968    }
19969    /// Identifies the authorization scope(s) for the method you are building.
19970    ///
19971    /// See [`Self::add_scope()`] for details.
19972    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountReportJobFetchReportResultCall<'a, C>
19973    where
19974        I: IntoIterator<Item = St>,
19975        St: AsRef<str>,
19976    {
19977        self._scopes
19978            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19979        self
19980    }
19981
19982    /// Removes all scopes, and no default scope will be used either.
19983    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19984    /// for details).
19985    pub fn clear_scopes(mut self) -> AccountReportJobFetchReportResultCall<'a, C> {
19986        self._scopes.clear();
19987        self
19988    }
19989}
19990
19991/// Lists the reports that RunReportJob can run. These reports include an ID, a description, and the list of columns that will be in the result. Deprecated: Please use [Export Channel Services data to BigQuery](https://cloud.google.com/channel/docs/rebilling/export-data-to-bigquery) instead.
19992///
19993/// A builder for the *reports.list* method supported by a *account* resource.
19994/// It is not used directly, but through a [`AccountMethods`] instance.
19995///
19996/// # Example
19997///
19998/// Instantiate a resource method builder
19999///
20000/// ```test_harness,no_run
20001/// # extern crate hyper;
20002/// # extern crate hyper_rustls;
20003/// # extern crate google_cloudchannel1 as cloudchannel1;
20004/// # async fn dox() {
20005/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20006///
20007/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20008/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20009/// #     .with_native_roots()
20010/// #     .unwrap()
20011/// #     .https_only()
20012/// #     .enable_http2()
20013/// #     .build();
20014///
20015/// # let executor = hyper_util::rt::TokioExecutor::new();
20016/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20017/// #     secret,
20018/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20019/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20020/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20021/// #     ),
20022/// # ).build().await.unwrap();
20023///
20024/// # let client = hyper_util::client::legacy::Client::builder(
20025/// #     hyper_util::rt::TokioExecutor::new()
20026/// # )
20027/// # .build(
20028/// #     hyper_rustls::HttpsConnectorBuilder::new()
20029/// #         .with_native_roots()
20030/// #         .unwrap()
20031/// #         .https_or_http()
20032/// #         .enable_http2()
20033/// #         .build()
20034/// # );
20035/// # let mut hub = Cloudchannel::new(client, auth);
20036/// // You can configure optional parameters by calling the respective setters at will, and
20037/// // execute the final call using `doit()`.
20038/// // Values shown here are possibly random and not representative !
20039/// let result = hub.accounts().reports_list("parent")
20040///              .page_token("voluptua.")
20041///              .page_size(-2)
20042///              .language_code("ea")
20043///              .doit().await;
20044/// # }
20045/// ```
20046pub struct AccountReportListCall<'a, C>
20047where
20048    C: 'a,
20049{
20050    hub: &'a Cloudchannel<C>,
20051    _parent: String,
20052    _page_token: Option<String>,
20053    _page_size: Option<i32>,
20054    _language_code: Option<String>,
20055    _delegate: Option<&'a mut dyn common::Delegate>,
20056    _additional_params: HashMap<String, String>,
20057    _scopes: BTreeSet<String>,
20058}
20059
20060impl<'a, C> common::CallBuilder for AccountReportListCall<'a, C> {}
20061
20062impl<'a, C> AccountReportListCall<'a, C>
20063where
20064    C: common::Connector,
20065{
20066    /// Perform the operation you have build so far.
20067    pub async fn doit(
20068        mut self,
20069    ) -> common::Result<(common::Response, GoogleCloudChannelV1ListReportsResponse)> {
20070        use std::borrow::Cow;
20071        use std::io::{Read, Seek};
20072
20073        use common::{url::Params, ToParts};
20074        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20075
20076        let mut dd = common::DefaultDelegate;
20077        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20078        dlg.begin(common::MethodInfo {
20079            id: "cloudchannel.accounts.reports.list",
20080            http_method: hyper::Method::GET,
20081        });
20082
20083        for &field in ["alt", "parent", "pageToken", "pageSize", "languageCode"].iter() {
20084            if self._additional_params.contains_key(field) {
20085                dlg.finished(false);
20086                return Err(common::Error::FieldClash(field));
20087            }
20088        }
20089
20090        let mut params = Params::with_capacity(6 + self._additional_params.len());
20091        params.push("parent", self._parent);
20092        if let Some(value) = self._page_token.as_ref() {
20093            params.push("pageToken", value);
20094        }
20095        if let Some(value) = self._page_size.as_ref() {
20096            params.push("pageSize", value.to_string());
20097        }
20098        if let Some(value) = self._language_code.as_ref() {
20099            params.push("languageCode", value);
20100        }
20101
20102        params.extend(self._additional_params.iter());
20103
20104        params.push("alt", "json");
20105        let mut url = self.hub._base_url.clone() + "v1/{+parent}/reports";
20106        if self._scopes.is_empty() {
20107            self._scopes
20108                .insert(Scope::AppReportUsageReadonly.as_ref().to_string());
20109        }
20110
20111        #[allow(clippy::single_element_loop)]
20112        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
20113            url = params.uri_replacement(url, param_name, find_this, true);
20114        }
20115        {
20116            let to_remove = ["parent"];
20117            params.remove_params(&to_remove);
20118        }
20119
20120        let url = params.parse_with_url(&url);
20121
20122        loop {
20123            let token = match self
20124                .hub
20125                .auth
20126                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20127                .await
20128            {
20129                Ok(token) => token,
20130                Err(e) => match dlg.token(e) {
20131                    Ok(token) => token,
20132                    Err(e) => {
20133                        dlg.finished(false);
20134                        return Err(common::Error::MissingToken(e));
20135                    }
20136                },
20137            };
20138            let mut req_result = {
20139                let client = &self.hub.client;
20140                dlg.pre_request();
20141                let mut req_builder = hyper::Request::builder()
20142                    .method(hyper::Method::GET)
20143                    .uri(url.as_str())
20144                    .header(USER_AGENT, self.hub._user_agent.clone());
20145
20146                if let Some(token) = token.as_ref() {
20147                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20148                }
20149
20150                let request = req_builder
20151                    .header(CONTENT_LENGTH, 0_u64)
20152                    .body(common::to_body::<String>(None));
20153
20154                client.request(request.unwrap()).await
20155            };
20156
20157            match req_result {
20158                Err(err) => {
20159                    if let common::Retry::After(d) = dlg.http_error(&err) {
20160                        sleep(d).await;
20161                        continue;
20162                    }
20163                    dlg.finished(false);
20164                    return Err(common::Error::HttpError(err));
20165                }
20166                Ok(res) => {
20167                    let (mut parts, body) = res.into_parts();
20168                    let mut body = common::Body::new(body);
20169                    if !parts.status.is_success() {
20170                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20171                        let error = serde_json::from_str(&common::to_string(&bytes));
20172                        let response = common::to_response(parts, bytes.into());
20173
20174                        if let common::Retry::After(d) =
20175                            dlg.http_failure(&response, error.as_ref().ok())
20176                        {
20177                            sleep(d).await;
20178                            continue;
20179                        }
20180
20181                        dlg.finished(false);
20182
20183                        return Err(match error {
20184                            Ok(value) => common::Error::BadRequest(value),
20185                            _ => common::Error::Failure(response),
20186                        });
20187                    }
20188                    let response = {
20189                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20190                        let encoded = common::to_string(&bytes);
20191                        match serde_json::from_str(&encoded) {
20192                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20193                            Err(error) => {
20194                                dlg.response_json_decode_error(&encoded, &error);
20195                                return Err(common::Error::JsonDecodeError(
20196                                    encoded.to_string(),
20197                                    error,
20198                                ));
20199                            }
20200                        }
20201                    };
20202
20203                    dlg.finished(true);
20204                    return Ok(response);
20205                }
20206            }
20207        }
20208    }
20209
20210    /// Required. The resource name of the partner account to list available reports for. Parent uses the format: accounts/{account_id}
20211    ///
20212    /// Sets the *parent* path property to the given value.
20213    ///
20214    /// Even though the property as already been set when instantiating this call,
20215    /// we provide this method for API completeness.
20216    pub fn parent(mut self, new_value: &str) -> AccountReportListCall<'a, C> {
20217        self._parent = new_value.to_string();
20218        self
20219    }
20220    /// Optional. A token that specifies a page of results beyond the first page. Obtained through ListReportsResponse.next_page_token of the previous CloudChannelReportsService.ListReports call.
20221    ///
20222    /// Sets the *page token* query property to the given value.
20223    pub fn page_token(mut self, new_value: &str) -> AccountReportListCall<'a, C> {
20224        self._page_token = Some(new_value.to_string());
20225        self
20226    }
20227    /// Optional. Requested page size of the report. The server might return fewer results than requested. If unspecified, returns 20 reports. The maximum value is 100.
20228    ///
20229    /// Sets the *page size* query property to the given value.
20230    pub fn page_size(mut self, new_value: i32) -> AccountReportListCall<'a, C> {
20231        self._page_size = Some(new_value);
20232        self
20233    }
20234    /// Optional. The BCP-47 language code, such as "en-US". If specified, the response is localized to the corresponding language code if the original data sources support it. Default is "en-US".
20235    ///
20236    /// Sets the *language code* query property to the given value.
20237    pub fn language_code(mut self, new_value: &str) -> AccountReportListCall<'a, C> {
20238        self._language_code = Some(new_value.to_string());
20239        self
20240    }
20241    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20242    /// while executing the actual API request.
20243    ///
20244    /// ````text
20245    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20246    /// ````
20247    ///
20248    /// Sets the *delegate* property to the given value.
20249    pub fn delegate(
20250        mut self,
20251        new_value: &'a mut dyn common::Delegate,
20252    ) -> AccountReportListCall<'a, C> {
20253        self._delegate = Some(new_value);
20254        self
20255    }
20256
20257    /// Set any additional parameter of the query string used in the request.
20258    /// It should be used to set parameters which are not yet available through their own
20259    /// setters.
20260    ///
20261    /// Please note that this method must not be used to set any of the known parameters
20262    /// which have their own setter method. If done anyway, the request will fail.
20263    ///
20264    /// # Additional Parameters
20265    ///
20266    /// * *$.xgafv* (query-string) - V1 error format.
20267    /// * *access_token* (query-string) - OAuth access token.
20268    /// * *alt* (query-string) - Data format for response.
20269    /// * *callback* (query-string) - JSONP
20270    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20271    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20272    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20273    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20274    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20275    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20276    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20277    pub fn param<T>(mut self, name: T, value: T) -> AccountReportListCall<'a, C>
20278    where
20279        T: AsRef<str>,
20280    {
20281        self._additional_params
20282            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20283        self
20284    }
20285
20286    /// Identifies the authorization scope for the method you are building.
20287    ///
20288    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20289    /// [`Scope::AppReportUsageReadonly`].
20290    ///
20291    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20292    /// tokens for more than one scope.
20293    ///
20294    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20295    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20296    /// sufficient, a read-write scope will do as well.
20297    pub fn add_scope<St>(mut self, scope: St) -> AccountReportListCall<'a, C>
20298    where
20299        St: AsRef<str>,
20300    {
20301        self._scopes.insert(String::from(scope.as_ref()));
20302        self
20303    }
20304    /// Identifies the authorization scope(s) for the method you are building.
20305    ///
20306    /// See [`Self::add_scope()`] for details.
20307    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountReportListCall<'a, C>
20308    where
20309        I: IntoIterator<Item = St>,
20310        St: AsRef<str>,
20311    {
20312        self._scopes
20313            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20314        self
20315    }
20316
20317    /// Removes all scopes, and no default scope will be used either.
20318    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20319    /// for details).
20320    pub fn clear_scopes(mut self) -> AccountReportListCall<'a, C> {
20321        self._scopes.clear();
20322        self
20323    }
20324}
20325
20326/// Begins generation of data for a given report. The report identifier is a UID (for example, `613bf59q`). Possible error codes: * PERMISSION_DENIED: The user doesn't have access to this report. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The report identifier was not found. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The ID of a long-running operation. To get the results of the operation, call the GetOperation method of CloudChannelOperationsService. The Operation metadata contains an instance of OperationMetadata. To get the results of report generation, call CloudChannelReportsService.FetchReportResults with the RunReportJobResponse.report_job. Deprecated: Please use [Export Channel Services data to BigQuery](https://cloud.google.com/channel/docs/rebilling/export-data-to-bigquery) instead.
20327///
20328/// A builder for the *reports.run* method supported by a *account* resource.
20329/// It is not used directly, but through a [`AccountMethods`] instance.
20330///
20331/// # Example
20332///
20333/// Instantiate a resource method builder
20334///
20335/// ```test_harness,no_run
20336/// # extern crate hyper;
20337/// # extern crate hyper_rustls;
20338/// # extern crate google_cloudchannel1 as cloudchannel1;
20339/// use cloudchannel1::api::GoogleCloudChannelV1RunReportJobRequest;
20340/// # async fn dox() {
20341/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20342///
20343/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20344/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20345/// #     .with_native_roots()
20346/// #     .unwrap()
20347/// #     .https_only()
20348/// #     .enable_http2()
20349/// #     .build();
20350///
20351/// # let executor = hyper_util::rt::TokioExecutor::new();
20352/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20353/// #     secret,
20354/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20355/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20356/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20357/// #     ),
20358/// # ).build().await.unwrap();
20359///
20360/// # let client = hyper_util::client::legacy::Client::builder(
20361/// #     hyper_util::rt::TokioExecutor::new()
20362/// # )
20363/// # .build(
20364/// #     hyper_rustls::HttpsConnectorBuilder::new()
20365/// #         .with_native_roots()
20366/// #         .unwrap()
20367/// #         .https_or_http()
20368/// #         .enable_http2()
20369/// #         .build()
20370/// # );
20371/// # let mut hub = Cloudchannel::new(client, auth);
20372/// // As the method needs a request, you would usually fill it with the desired information
20373/// // into the respective structure. Some of the parts shown here might not be applicable !
20374/// // Values shown here are possibly random and not representative !
20375/// let mut req = GoogleCloudChannelV1RunReportJobRequest::default();
20376///
20377/// // You can configure optional parameters by calling the respective setters at will, and
20378/// // execute the final call using `doit()`.
20379/// // Values shown here are possibly random and not representative !
20380/// let result = hub.accounts().reports_run(req, "name")
20381///              .doit().await;
20382/// # }
20383/// ```
20384pub struct AccountReportRunCall<'a, C>
20385where
20386    C: 'a,
20387{
20388    hub: &'a Cloudchannel<C>,
20389    _request: GoogleCloudChannelV1RunReportJobRequest,
20390    _name: String,
20391    _delegate: Option<&'a mut dyn common::Delegate>,
20392    _additional_params: HashMap<String, String>,
20393    _scopes: BTreeSet<String>,
20394}
20395
20396impl<'a, C> common::CallBuilder for AccountReportRunCall<'a, C> {}
20397
20398impl<'a, C> AccountReportRunCall<'a, C>
20399where
20400    C: common::Connector,
20401{
20402    /// Perform the operation you have build so far.
20403    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
20404        use std::borrow::Cow;
20405        use std::io::{Read, Seek};
20406
20407        use common::{url::Params, ToParts};
20408        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20409
20410        let mut dd = common::DefaultDelegate;
20411        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20412        dlg.begin(common::MethodInfo {
20413            id: "cloudchannel.accounts.reports.run",
20414            http_method: hyper::Method::POST,
20415        });
20416
20417        for &field in ["alt", "name"].iter() {
20418            if self._additional_params.contains_key(field) {
20419                dlg.finished(false);
20420                return Err(common::Error::FieldClash(field));
20421            }
20422        }
20423
20424        let mut params = Params::with_capacity(4 + self._additional_params.len());
20425        params.push("name", self._name);
20426
20427        params.extend(self._additional_params.iter());
20428
20429        params.push("alt", "json");
20430        let mut url = self.hub._base_url.clone() + "v1/{+name}:run";
20431        if self._scopes.is_empty() {
20432            self._scopes
20433                .insert(Scope::AppReportUsageReadonly.as_ref().to_string());
20434        }
20435
20436        #[allow(clippy::single_element_loop)]
20437        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20438            url = params.uri_replacement(url, param_name, find_this, true);
20439        }
20440        {
20441            let to_remove = ["name"];
20442            params.remove_params(&to_remove);
20443        }
20444
20445        let url = params.parse_with_url(&url);
20446
20447        let mut json_mime_type = mime::APPLICATION_JSON;
20448        let mut request_value_reader = {
20449            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20450            common::remove_json_null_values(&mut value);
20451            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20452            serde_json::to_writer(&mut dst, &value).unwrap();
20453            dst
20454        };
20455        let request_size = request_value_reader
20456            .seek(std::io::SeekFrom::End(0))
20457            .unwrap();
20458        request_value_reader
20459            .seek(std::io::SeekFrom::Start(0))
20460            .unwrap();
20461
20462        loop {
20463            let token = match self
20464                .hub
20465                .auth
20466                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20467                .await
20468            {
20469                Ok(token) => token,
20470                Err(e) => match dlg.token(e) {
20471                    Ok(token) => token,
20472                    Err(e) => {
20473                        dlg.finished(false);
20474                        return Err(common::Error::MissingToken(e));
20475                    }
20476                },
20477            };
20478            request_value_reader
20479                .seek(std::io::SeekFrom::Start(0))
20480                .unwrap();
20481            let mut req_result = {
20482                let client = &self.hub.client;
20483                dlg.pre_request();
20484                let mut req_builder = hyper::Request::builder()
20485                    .method(hyper::Method::POST)
20486                    .uri(url.as_str())
20487                    .header(USER_AGENT, self.hub._user_agent.clone());
20488
20489                if let Some(token) = token.as_ref() {
20490                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20491                }
20492
20493                let request = req_builder
20494                    .header(CONTENT_TYPE, json_mime_type.to_string())
20495                    .header(CONTENT_LENGTH, request_size as u64)
20496                    .body(common::to_body(
20497                        request_value_reader.get_ref().clone().into(),
20498                    ));
20499
20500                client.request(request.unwrap()).await
20501            };
20502
20503            match req_result {
20504                Err(err) => {
20505                    if let common::Retry::After(d) = dlg.http_error(&err) {
20506                        sleep(d).await;
20507                        continue;
20508                    }
20509                    dlg.finished(false);
20510                    return Err(common::Error::HttpError(err));
20511                }
20512                Ok(res) => {
20513                    let (mut parts, body) = res.into_parts();
20514                    let mut body = common::Body::new(body);
20515                    if !parts.status.is_success() {
20516                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20517                        let error = serde_json::from_str(&common::to_string(&bytes));
20518                        let response = common::to_response(parts, bytes.into());
20519
20520                        if let common::Retry::After(d) =
20521                            dlg.http_failure(&response, error.as_ref().ok())
20522                        {
20523                            sleep(d).await;
20524                            continue;
20525                        }
20526
20527                        dlg.finished(false);
20528
20529                        return Err(match error {
20530                            Ok(value) => common::Error::BadRequest(value),
20531                            _ => common::Error::Failure(response),
20532                        });
20533                    }
20534                    let response = {
20535                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20536                        let encoded = common::to_string(&bytes);
20537                        match serde_json::from_str(&encoded) {
20538                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20539                            Err(error) => {
20540                                dlg.response_json_decode_error(&encoded, &error);
20541                                return Err(common::Error::JsonDecodeError(
20542                                    encoded.to_string(),
20543                                    error,
20544                                ));
20545                            }
20546                        }
20547                    };
20548
20549                    dlg.finished(true);
20550                    return Ok(response);
20551                }
20552            }
20553        }
20554    }
20555
20556    ///
20557    /// Sets the *request* property to the given value.
20558    ///
20559    /// Even though the property as already been set when instantiating this call,
20560    /// we provide this method for API completeness.
20561    pub fn request(
20562        mut self,
20563        new_value: GoogleCloudChannelV1RunReportJobRequest,
20564    ) -> AccountReportRunCall<'a, C> {
20565        self._request = new_value;
20566        self
20567    }
20568    /// Required. The report's resource name. Specifies the account and report used to generate report data. The report_id identifier is a UID (for example, `613bf59q`). Name uses the format: accounts/{account_id}/reports/{report_id}
20569    ///
20570    /// Sets the *name* path property to the given value.
20571    ///
20572    /// Even though the property as already been set when instantiating this call,
20573    /// we provide this method for API completeness.
20574    pub fn name(mut self, new_value: &str) -> AccountReportRunCall<'a, C> {
20575        self._name = new_value.to_string();
20576        self
20577    }
20578    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20579    /// while executing the actual API request.
20580    ///
20581    /// ````text
20582    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20583    /// ````
20584    ///
20585    /// Sets the *delegate* property to the given value.
20586    pub fn delegate(
20587        mut self,
20588        new_value: &'a mut dyn common::Delegate,
20589    ) -> AccountReportRunCall<'a, C> {
20590        self._delegate = Some(new_value);
20591        self
20592    }
20593
20594    /// Set any additional parameter of the query string used in the request.
20595    /// It should be used to set parameters which are not yet available through their own
20596    /// setters.
20597    ///
20598    /// Please note that this method must not be used to set any of the known parameters
20599    /// which have their own setter method. If done anyway, the request will fail.
20600    ///
20601    /// # Additional Parameters
20602    ///
20603    /// * *$.xgafv* (query-string) - V1 error format.
20604    /// * *access_token* (query-string) - OAuth access token.
20605    /// * *alt* (query-string) - Data format for response.
20606    /// * *callback* (query-string) - JSONP
20607    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20608    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20609    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20610    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20611    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20612    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20613    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20614    pub fn param<T>(mut self, name: T, value: T) -> AccountReportRunCall<'a, C>
20615    where
20616        T: AsRef<str>,
20617    {
20618        self._additional_params
20619            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20620        self
20621    }
20622
20623    /// Identifies the authorization scope for the method you are building.
20624    ///
20625    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20626    /// [`Scope::AppReportUsageReadonly`].
20627    ///
20628    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20629    /// tokens for more than one scope.
20630    ///
20631    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20632    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20633    /// sufficient, a read-write scope will do as well.
20634    pub fn add_scope<St>(mut self, scope: St) -> AccountReportRunCall<'a, C>
20635    where
20636        St: AsRef<str>,
20637    {
20638        self._scopes.insert(String::from(scope.as_ref()));
20639        self
20640    }
20641    /// Identifies the authorization scope(s) for the method you are building.
20642    ///
20643    /// See [`Self::add_scope()`] for details.
20644    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountReportRunCall<'a, C>
20645    where
20646        I: IntoIterator<Item = St>,
20647        St: AsRef<str>,
20648    {
20649        self._scopes
20650            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20651        self
20652    }
20653
20654    /// Removes all scopes, and no default scope will be used either.
20655    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20656    /// for details).
20657    pub fn clear_scopes(mut self) -> AccountReportRunCall<'a, C> {
20658        self._scopes.clear();
20659        self
20660    }
20661}
20662
20663/// Lists the Billable SKUs in a given SKU group. Possible error codes: PERMISSION_DENIED: If the account making the request and the account being queried for are different, or the account doesn't exist. INVALID_ARGUMENT: Missing or invalid required parameters in the request. INTERNAL: Any non-user error related to technical issue in the backend. In this case, contact cloud channel support. Return Value: If successful, the BillableSku resources. The data for each resource is displayed in the ascending order of: * BillableSku.service_display_name * BillableSku.sku_display_name If unsuccessful, returns an error.
20664///
20665/// A builder for the *skuGroups.billableSkus.list* method supported by a *account* resource.
20666/// It is not used directly, but through a [`AccountMethods`] instance.
20667///
20668/// # Example
20669///
20670/// Instantiate a resource method builder
20671///
20672/// ```test_harness,no_run
20673/// # extern crate hyper;
20674/// # extern crate hyper_rustls;
20675/// # extern crate google_cloudchannel1 as cloudchannel1;
20676/// # async fn dox() {
20677/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20678///
20679/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20680/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20681/// #     .with_native_roots()
20682/// #     .unwrap()
20683/// #     .https_only()
20684/// #     .enable_http2()
20685/// #     .build();
20686///
20687/// # let executor = hyper_util::rt::TokioExecutor::new();
20688/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20689/// #     secret,
20690/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20691/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20692/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20693/// #     ),
20694/// # ).build().await.unwrap();
20695///
20696/// # let client = hyper_util::client::legacy::Client::builder(
20697/// #     hyper_util::rt::TokioExecutor::new()
20698/// # )
20699/// # .build(
20700/// #     hyper_rustls::HttpsConnectorBuilder::new()
20701/// #         .with_native_roots()
20702/// #         .unwrap()
20703/// #         .https_or_http()
20704/// #         .enable_http2()
20705/// #         .build()
20706/// # );
20707/// # let mut hub = Cloudchannel::new(client, auth);
20708/// // You can configure optional parameters by calling the respective setters at will, and
20709/// // execute the final call using `doit()`.
20710/// // Values shown here are possibly random and not representative !
20711/// let result = hub.accounts().sku_groups_billable_skus_list("parent")
20712///              .page_token("invidunt")
20713///              .page_size(-11)
20714///              .doit().await;
20715/// # }
20716/// ```
20717pub struct AccountSkuGroupBillableSkuListCall<'a, C>
20718where
20719    C: 'a,
20720{
20721    hub: &'a Cloudchannel<C>,
20722    _parent: String,
20723    _page_token: Option<String>,
20724    _page_size: Option<i32>,
20725    _delegate: Option<&'a mut dyn common::Delegate>,
20726    _additional_params: HashMap<String, String>,
20727    _scopes: BTreeSet<String>,
20728}
20729
20730impl<'a, C> common::CallBuilder for AccountSkuGroupBillableSkuListCall<'a, C> {}
20731
20732impl<'a, C> AccountSkuGroupBillableSkuListCall<'a, C>
20733where
20734    C: common::Connector,
20735{
20736    /// Perform the operation you have build so far.
20737    pub async fn doit(
20738        mut self,
20739    ) -> common::Result<(
20740        common::Response,
20741        GoogleCloudChannelV1ListSkuGroupBillableSkusResponse,
20742    )> {
20743        use std::borrow::Cow;
20744        use std::io::{Read, Seek};
20745
20746        use common::{url::Params, ToParts};
20747        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20748
20749        let mut dd = common::DefaultDelegate;
20750        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20751        dlg.begin(common::MethodInfo {
20752            id: "cloudchannel.accounts.skuGroups.billableSkus.list",
20753            http_method: hyper::Method::GET,
20754        });
20755
20756        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
20757            if self._additional_params.contains_key(field) {
20758                dlg.finished(false);
20759                return Err(common::Error::FieldClash(field));
20760            }
20761        }
20762
20763        let mut params = Params::with_capacity(5 + self._additional_params.len());
20764        params.push("parent", self._parent);
20765        if let Some(value) = self._page_token.as_ref() {
20766            params.push("pageToken", value);
20767        }
20768        if let Some(value) = self._page_size.as_ref() {
20769            params.push("pageSize", value.to_string());
20770        }
20771
20772        params.extend(self._additional_params.iter());
20773
20774        params.push("alt", "json");
20775        let mut url = self.hub._base_url.clone() + "v1/{+parent}/billableSkus";
20776        if self._scopes.is_empty() {
20777            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
20778        }
20779
20780        #[allow(clippy::single_element_loop)]
20781        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
20782            url = params.uri_replacement(url, param_name, find_this, true);
20783        }
20784        {
20785            let to_remove = ["parent"];
20786            params.remove_params(&to_remove);
20787        }
20788
20789        let url = params.parse_with_url(&url);
20790
20791        loop {
20792            let token = match self
20793                .hub
20794                .auth
20795                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20796                .await
20797            {
20798                Ok(token) => token,
20799                Err(e) => match dlg.token(e) {
20800                    Ok(token) => token,
20801                    Err(e) => {
20802                        dlg.finished(false);
20803                        return Err(common::Error::MissingToken(e));
20804                    }
20805                },
20806            };
20807            let mut req_result = {
20808                let client = &self.hub.client;
20809                dlg.pre_request();
20810                let mut req_builder = hyper::Request::builder()
20811                    .method(hyper::Method::GET)
20812                    .uri(url.as_str())
20813                    .header(USER_AGENT, self.hub._user_agent.clone());
20814
20815                if let Some(token) = token.as_ref() {
20816                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20817                }
20818
20819                let request = req_builder
20820                    .header(CONTENT_LENGTH, 0_u64)
20821                    .body(common::to_body::<String>(None));
20822
20823                client.request(request.unwrap()).await
20824            };
20825
20826            match req_result {
20827                Err(err) => {
20828                    if let common::Retry::After(d) = dlg.http_error(&err) {
20829                        sleep(d).await;
20830                        continue;
20831                    }
20832                    dlg.finished(false);
20833                    return Err(common::Error::HttpError(err));
20834                }
20835                Ok(res) => {
20836                    let (mut parts, body) = res.into_parts();
20837                    let mut body = common::Body::new(body);
20838                    if !parts.status.is_success() {
20839                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20840                        let error = serde_json::from_str(&common::to_string(&bytes));
20841                        let response = common::to_response(parts, bytes.into());
20842
20843                        if let common::Retry::After(d) =
20844                            dlg.http_failure(&response, error.as_ref().ok())
20845                        {
20846                            sleep(d).await;
20847                            continue;
20848                        }
20849
20850                        dlg.finished(false);
20851
20852                        return Err(match error {
20853                            Ok(value) => common::Error::BadRequest(value),
20854                            _ => common::Error::Failure(response),
20855                        });
20856                    }
20857                    let response = {
20858                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20859                        let encoded = common::to_string(&bytes);
20860                        match serde_json::from_str(&encoded) {
20861                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20862                            Err(error) => {
20863                                dlg.response_json_decode_error(&encoded, &error);
20864                                return Err(common::Error::JsonDecodeError(
20865                                    encoded.to_string(),
20866                                    error,
20867                                ));
20868                            }
20869                        }
20870                    };
20871
20872                    dlg.finished(true);
20873                    return Ok(response);
20874                }
20875            }
20876        }
20877    }
20878
20879    /// Required. Resource name of the SKU group. Format: accounts/{account}/skuGroups/{sku_group}.
20880    ///
20881    /// Sets the *parent* path property to the given value.
20882    ///
20883    /// Even though the property as already been set when instantiating this call,
20884    /// we provide this method for API completeness.
20885    pub fn parent(mut self, new_value: &str) -> AccountSkuGroupBillableSkuListCall<'a, C> {
20886        self._parent = new_value.to_string();
20887        self
20888    }
20889    /// Optional. A token identifying a page of results beyond the first page. Obtained through ListSkuGroupBillableSkusResponse.next_page_token of the previous CloudChannelService.ListSkuGroupBillableSkus call.
20890    ///
20891    /// Sets the *page token* query property to the given value.
20892    pub fn page_token(mut self, new_value: &str) -> AccountSkuGroupBillableSkuListCall<'a, C> {
20893        self._page_token = Some(new_value.to_string());
20894        self
20895    }
20896    /// Optional. The maximum number of SKUs to return. The service may return fewer than this value. If unspecified, returns a maximum of 100000 SKUs. The maximum value is 100000; values above 100000 will be coerced to 100000.
20897    ///
20898    /// Sets the *page size* query property to the given value.
20899    pub fn page_size(mut self, new_value: i32) -> AccountSkuGroupBillableSkuListCall<'a, C> {
20900        self._page_size = Some(new_value);
20901        self
20902    }
20903    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20904    /// while executing the actual API request.
20905    ///
20906    /// ````text
20907    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20908    /// ````
20909    ///
20910    /// Sets the *delegate* property to the given value.
20911    pub fn delegate(
20912        mut self,
20913        new_value: &'a mut dyn common::Delegate,
20914    ) -> AccountSkuGroupBillableSkuListCall<'a, C> {
20915        self._delegate = Some(new_value);
20916        self
20917    }
20918
20919    /// Set any additional parameter of the query string used in the request.
20920    /// It should be used to set parameters which are not yet available through their own
20921    /// setters.
20922    ///
20923    /// Please note that this method must not be used to set any of the known parameters
20924    /// which have their own setter method. If done anyway, the request will fail.
20925    ///
20926    /// # Additional Parameters
20927    ///
20928    /// * *$.xgafv* (query-string) - V1 error format.
20929    /// * *access_token* (query-string) - OAuth access token.
20930    /// * *alt* (query-string) - Data format for response.
20931    /// * *callback* (query-string) - JSONP
20932    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20933    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20934    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20935    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20936    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20937    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20938    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20939    pub fn param<T>(mut self, name: T, value: T) -> AccountSkuGroupBillableSkuListCall<'a, C>
20940    where
20941        T: AsRef<str>,
20942    {
20943        self._additional_params
20944            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20945        self
20946    }
20947
20948    /// Identifies the authorization scope for the method you are building.
20949    ///
20950    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20951    /// [`Scope::AppOrder`].
20952    ///
20953    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20954    /// tokens for more than one scope.
20955    ///
20956    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20957    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20958    /// sufficient, a read-write scope will do as well.
20959    pub fn add_scope<St>(mut self, scope: St) -> AccountSkuGroupBillableSkuListCall<'a, C>
20960    where
20961        St: AsRef<str>,
20962    {
20963        self._scopes.insert(String::from(scope.as_ref()));
20964        self
20965    }
20966    /// Identifies the authorization scope(s) for the method you are building.
20967    ///
20968    /// See [`Self::add_scope()`] for details.
20969    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountSkuGroupBillableSkuListCall<'a, C>
20970    where
20971        I: IntoIterator<Item = St>,
20972        St: AsRef<str>,
20973    {
20974        self._scopes
20975            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20976        self
20977    }
20978
20979    /// Removes all scopes, and no default scope will be used either.
20980    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20981    /// for details).
20982    pub fn clear_scopes(mut self) -> AccountSkuGroupBillableSkuListCall<'a, C> {
20983        self._scopes.clear();
20984        self
20985    }
20986}
20987
20988/// Lists the Rebilling supported SKU groups the account is authorized to sell. Reference: https://cloud.google.com/skus/sku-groups Possible Error Codes: * PERMISSION_DENIED: If the account making the request and the account being queried are different, or the account doesn't exist. * INTERNAL: Any non-user error related to technical issues in the backend. In this case, contact Cloud Channel support. Return Value: If successful, the SkuGroup resources. The data for each resource is displayed in the alphabetical order of SKU group display name. The data for each resource is displayed in the ascending order of SkuGroup.display_name If unsuccessful, returns an error.
20989///
20990/// A builder for the *skuGroups.list* method supported by a *account* resource.
20991/// It is not used directly, but through a [`AccountMethods`] instance.
20992///
20993/// # Example
20994///
20995/// Instantiate a resource method builder
20996///
20997/// ```test_harness,no_run
20998/// # extern crate hyper;
20999/// # extern crate hyper_rustls;
21000/// # extern crate google_cloudchannel1 as cloudchannel1;
21001/// # async fn dox() {
21002/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21003///
21004/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21005/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21006/// #     .with_native_roots()
21007/// #     .unwrap()
21008/// #     .https_only()
21009/// #     .enable_http2()
21010/// #     .build();
21011///
21012/// # let executor = hyper_util::rt::TokioExecutor::new();
21013/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21014/// #     secret,
21015/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21016/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21017/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21018/// #     ),
21019/// # ).build().await.unwrap();
21020///
21021/// # let client = hyper_util::client::legacy::Client::builder(
21022/// #     hyper_util::rt::TokioExecutor::new()
21023/// # )
21024/// # .build(
21025/// #     hyper_rustls::HttpsConnectorBuilder::new()
21026/// #         .with_native_roots()
21027/// #         .unwrap()
21028/// #         .https_or_http()
21029/// #         .enable_http2()
21030/// #         .build()
21031/// # );
21032/// # let mut hub = Cloudchannel::new(client, auth);
21033/// // You can configure optional parameters by calling the respective setters at will, and
21034/// // execute the final call using `doit()`.
21035/// // Values shown here are possibly random and not representative !
21036/// let result = hub.accounts().sku_groups_list("parent")
21037///              .page_token("At")
21038///              .page_size(-43)
21039///              .doit().await;
21040/// # }
21041/// ```
21042pub struct AccountSkuGroupListCall<'a, C>
21043where
21044    C: 'a,
21045{
21046    hub: &'a Cloudchannel<C>,
21047    _parent: String,
21048    _page_token: Option<String>,
21049    _page_size: Option<i32>,
21050    _delegate: Option<&'a mut dyn common::Delegate>,
21051    _additional_params: HashMap<String, String>,
21052    _scopes: BTreeSet<String>,
21053}
21054
21055impl<'a, C> common::CallBuilder for AccountSkuGroupListCall<'a, C> {}
21056
21057impl<'a, C> AccountSkuGroupListCall<'a, C>
21058where
21059    C: common::Connector,
21060{
21061    /// Perform the operation you have build so far.
21062    pub async fn doit(
21063        mut self,
21064    ) -> common::Result<(common::Response, GoogleCloudChannelV1ListSkuGroupsResponse)> {
21065        use std::borrow::Cow;
21066        use std::io::{Read, Seek};
21067
21068        use common::{url::Params, ToParts};
21069        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21070
21071        let mut dd = common::DefaultDelegate;
21072        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21073        dlg.begin(common::MethodInfo {
21074            id: "cloudchannel.accounts.skuGroups.list",
21075            http_method: hyper::Method::GET,
21076        });
21077
21078        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
21079            if self._additional_params.contains_key(field) {
21080                dlg.finished(false);
21081                return Err(common::Error::FieldClash(field));
21082            }
21083        }
21084
21085        let mut params = Params::with_capacity(5 + self._additional_params.len());
21086        params.push("parent", self._parent);
21087        if let Some(value) = self._page_token.as_ref() {
21088            params.push("pageToken", value);
21089        }
21090        if let Some(value) = self._page_size.as_ref() {
21091            params.push("pageSize", value.to_string());
21092        }
21093
21094        params.extend(self._additional_params.iter());
21095
21096        params.push("alt", "json");
21097        let mut url = self.hub._base_url.clone() + "v1/{+parent}/skuGroups";
21098        if self._scopes.is_empty() {
21099            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
21100        }
21101
21102        #[allow(clippy::single_element_loop)]
21103        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21104            url = params.uri_replacement(url, param_name, find_this, true);
21105        }
21106        {
21107            let to_remove = ["parent"];
21108            params.remove_params(&to_remove);
21109        }
21110
21111        let url = params.parse_with_url(&url);
21112
21113        loop {
21114            let token = match self
21115                .hub
21116                .auth
21117                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21118                .await
21119            {
21120                Ok(token) => token,
21121                Err(e) => match dlg.token(e) {
21122                    Ok(token) => token,
21123                    Err(e) => {
21124                        dlg.finished(false);
21125                        return Err(common::Error::MissingToken(e));
21126                    }
21127                },
21128            };
21129            let mut req_result = {
21130                let client = &self.hub.client;
21131                dlg.pre_request();
21132                let mut req_builder = hyper::Request::builder()
21133                    .method(hyper::Method::GET)
21134                    .uri(url.as_str())
21135                    .header(USER_AGENT, self.hub._user_agent.clone());
21136
21137                if let Some(token) = token.as_ref() {
21138                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21139                }
21140
21141                let request = req_builder
21142                    .header(CONTENT_LENGTH, 0_u64)
21143                    .body(common::to_body::<String>(None));
21144
21145                client.request(request.unwrap()).await
21146            };
21147
21148            match req_result {
21149                Err(err) => {
21150                    if let common::Retry::After(d) = dlg.http_error(&err) {
21151                        sleep(d).await;
21152                        continue;
21153                    }
21154                    dlg.finished(false);
21155                    return Err(common::Error::HttpError(err));
21156                }
21157                Ok(res) => {
21158                    let (mut parts, body) = res.into_parts();
21159                    let mut body = common::Body::new(body);
21160                    if !parts.status.is_success() {
21161                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21162                        let error = serde_json::from_str(&common::to_string(&bytes));
21163                        let response = common::to_response(parts, bytes.into());
21164
21165                        if let common::Retry::After(d) =
21166                            dlg.http_failure(&response, error.as_ref().ok())
21167                        {
21168                            sleep(d).await;
21169                            continue;
21170                        }
21171
21172                        dlg.finished(false);
21173
21174                        return Err(match error {
21175                            Ok(value) => common::Error::BadRequest(value),
21176                            _ => common::Error::Failure(response),
21177                        });
21178                    }
21179                    let response = {
21180                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21181                        let encoded = common::to_string(&bytes);
21182                        match serde_json::from_str(&encoded) {
21183                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21184                            Err(error) => {
21185                                dlg.response_json_decode_error(&encoded, &error);
21186                                return Err(common::Error::JsonDecodeError(
21187                                    encoded.to_string(),
21188                                    error,
21189                                ));
21190                            }
21191                        }
21192                    };
21193
21194                    dlg.finished(true);
21195                    return Ok(response);
21196                }
21197            }
21198        }
21199    }
21200
21201    /// Required. The resource name of the account from which to list SKU groups. Parent uses the format: accounts/{account}.
21202    ///
21203    /// Sets the *parent* path property to the given value.
21204    ///
21205    /// Even though the property as already been set when instantiating this call,
21206    /// we provide this method for API completeness.
21207    pub fn parent(mut self, new_value: &str) -> AccountSkuGroupListCall<'a, C> {
21208        self._parent = new_value.to_string();
21209        self
21210    }
21211    /// Optional. A token identifying a page of results beyond the first page. Obtained through ListSkuGroupsResponse.next_page_token of the previous CloudChannelService.ListSkuGroups call.
21212    ///
21213    /// Sets the *page token* query property to the given value.
21214    pub fn page_token(mut self, new_value: &str) -> AccountSkuGroupListCall<'a, C> {
21215        self._page_token = Some(new_value.to_string());
21216        self
21217    }
21218    /// Optional. The maximum number of SKU groups to return. The service may return fewer than this value. If unspecified, returns a maximum of 1000 SKU groups. The maximum value is 1000; values above 1000 will be coerced to 1000.
21219    ///
21220    /// Sets the *page size* query property to the given value.
21221    pub fn page_size(mut self, new_value: i32) -> AccountSkuGroupListCall<'a, C> {
21222        self._page_size = Some(new_value);
21223        self
21224    }
21225    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21226    /// while executing the actual API request.
21227    ///
21228    /// ````text
21229    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21230    /// ````
21231    ///
21232    /// Sets the *delegate* property to the given value.
21233    pub fn delegate(
21234        mut self,
21235        new_value: &'a mut dyn common::Delegate,
21236    ) -> AccountSkuGroupListCall<'a, C> {
21237        self._delegate = Some(new_value);
21238        self
21239    }
21240
21241    /// Set any additional parameter of the query string used in the request.
21242    /// It should be used to set parameters which are not yet available through their own
21243    /// setters.
21244    ///
21245    /// Please note that this method must not be used to set any of the known parameters
21246    /// which have their own setter method. If done anyway, the request will fail.
21247    ///
21248    /// # Additional Parameters
21249    ///
21250    /// * *$.xgafv* (query-string) - V1 error format.
21251    /// * *access_token* (query-string) - OAuth access token.
21252    /// * *alt* (query-string) - Data format for response.
21253    /// * *callback* (query-string) - JSONP
21254    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21255    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21256    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21257    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21258    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21259    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21260    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21261    pub fn param<T>(mut self, name: T, value: T) -> AccountSkuGroupListCall<'a, C>
21262    where
21263        T: AsRef<str>,
21264    {
21265        self._additional_params
21266            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21267        self
21268    }
21269
21270    /// Identifies the authorization scope for the method you are building.
21271    ///
21272    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21273    /// [`Scope::AppOrder`].
21274    ///
21275    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21276    /// tokens for more than one scope.
21277    ///
21278    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21279    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21280    /// sufficient, a read-write scope will do as well.
21281    pub fn add_scope<St>(mut self, scope: St) -> AccountSkuGroupListCall<'a, C>
21282    where
21283        St: AsRef<str>,
21284    {
21285        self._scopes.insert(String::from(scope.as_ref()));
21286        self
21287    }
21288    /// Identifies the authorization scope(s) for the method you are building.
21289    ///
21290    /// See [`Self::add_scope()`] for details.
21291    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountSkuGroupListCall<'a, C>
21292    where
21293        I: IntoIterator<Item = St>,
21294        St: AsRef<str>,
21295    {
21296        self._scopes
21297            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21298        self
21299    }
21300
21301    /// Removes all scopes, and no default scope will be used either.
21302    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21303    /// for details).
21304    pub fn clear_scopes(mut self) -> AccountSkuGroupListCall<'a, C> {
21305        self._scopes.clear();
21306        self
21307    }
21308}
21309
21310/// Confirms the existence of Cloud Identity accounts based on the domain and if the Cloud Identity accounts are owned by the reseller. Possible error codes: * PERMISSION_DENIED: The reseller account making the request is different from the reseller account in the API request. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * INVALID_VALUE: Invalid domain value in the request. Return value: A list of CloudIdentityCustomerAccount resources for the domain (may be empty) Note: in the v1alpha1 version of the API, a NOT_FOUND error returns if no CloudIdentityCustomerAccount resources match the domain.
21311///
21312/// A builder for the *checkCloudIdentityAccountsExist* method supported by a *account* resource.
21313/// It is not used directly, but through a [`AccountMethods`] instance.
21314///
21315/// # Example
21316///
21317/// Instantiate a resource method builder
21318///
21319/// ```test_harness,no_run
21320/// # extern crate hyper;
21321/// # extern crate hyper_rustls;
21322/// # extern crate google_cloudchannel1 as cloudchannel1;
21323/// use cloudchannel1::api::GoogleCloudChannelV1CheckCloudIdentityAccountsExistRequest;
21324/// # async fn dox() {
21325/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21326///
21327/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21328/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21329/// #     .with_native_roots()
21330/// #     .unwrap()
21331/// #     .https_only()
21332/// #     .enable_http2()
21333/// #     .build();
21334///
21335/// # let executor = hyper_util::rt::TokioExecutor::new();
21336/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21337/// #     secret,
21338/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21339/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21340/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21341/// #     ),
21342/// # ).build().await.unwrap();
21343///
21344/// # let client = hyper_util::client::legacy::Client::builder(
21345/// #     hyper_util::rt::TokioExecutor::new()
21346/// # )
21347/// # .build(
21348/// #     hyper_rustls::HttpsConnectorBuilder::new()
21349/// #         .with_native_roots()
21350/// #         .unwrap()
21351/// #         .https_or_http()
21352/// #         .enable_http2()
21353/// #         .build()
21354/// # );
21355/// # let mut hub = Cloudchannel::new(client, auth);
21356/// // As the method needs a request, you would usually fill it with the desired information
21357/// // into the respective structure. Some of the parts shown here might not be applicable !
21358/// // Values shown here are possibly random and not representative !
21359/// let mut req = GoogleCloudChannelV1CheckCloudIdentityAccountsExistRequest::default();
21360///
21361/// // You can configure optional parameters by calling the respective setters at will, and
21362/// // execute the final call using `doit()`.
21363/// // Values shown here are possibly random and not representative !
21364/// let result = hub.accounts().check_cloud_identity_accounts_exist(req, "parent")
21365///              .doit().await;
21366/// # }
21367/// ```
21368pub struct AccountCheckCloudIdentityAccountsExistCall<'a, C>
21369where
21370    C: 'a,
21371{
21372    hub: &'a Cloudchannel<C>,
21373    _request: GoogleCloudChannelV1CheckCloudIdentityAccountsExistRequest,
21374    _parent: String,
21375    _delegate: Option<&'a mut dyn common::Delegate>,
21376    _additional_params: HashMap<String, String>,
21377    _scopes: BTreeSet<String>,
21378}
21379
21380impl<'a, C> common::CallBuilder for AccountCheckCloudIdentityAccountsExistCall<'a, C> {}
21381
21382impl<'a, C> AccountCheckCloudIdentityAccountsExistCall<'a, C>
21383where
21384    C: common::Connector,
21385{
21386    /// Perform the operation you have build so far.
21387    pub async fn doit(
21388        mut self,
21389    ) -> common::Result<(
21390        common::Response,
21391        GoogleCloudChannelV1CheckCloudIdentityAccountsExistResponse,
21392    )> {
21393        use std::borrow::Cow;
21394        use std::io::{Read, Seek};
21395
21396        use common::{url::Params, ToParts};
21397        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21398
21399        let mut dd = common::DefaultDelegate;
21400        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21401        dlg.begin(common::MethodInfo {
21402            id: "cloudchannel.accounts.checkCloudIdentityAccountsExist",
21403            http_method: hyper::Method::POST,
21404        });
21405
21406        for &field in ["alt", "parent"].iter() {
21407            if self._additional_params.contains_key(field) {
21408                dlg.finished(false);
21409                return Err(common::Error::FieldClash(field));
21410            }
21411        }
21412
21413        let mut params = Params::with_capacity(4 + self._additional_params.len());
21414        params.push("parent", self._parent);
21415
21416        params.extend(self._additional_params.iter());
21417
21418        params.push("alt", "json");
21419        let mut url = self.hub._base_url.clone() + "v1/{+parent}:checkCloudIdentityAccountsExist";
21420        if self._scopes.is_empty() {
21421            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
21422        }
21423
21424        #[allow(clippy::single_element_loop)]
21425        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21426            url = params.uri_replacement(url, param_name, find_this, true);
21427        }
21428        {
21429            let to_remove = ["parent"];
21430            params.remove_params(&to_remove);
21431        }
21432
21433        let url = params.parse_with_url(&url);
21434
21435        let mut json_mime_type = mime::APPLICATION_JSON;
21436        let mut request_value_reader = {
21437            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21438            common::remove_json_null_values(&mut value);
21439            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21440            serde_json::to_writer(&mut dst, &value).unwrap();
21441            dst
21442        };
21443        let request_size = request_value_reader
21444            .seek(std::io::SeekFrom::End(0))
21445            .unwrap();
21446        request_value_reader
21447            .seek(std::io::SeekFrom::Start(0))
21448            .unwrap();
21449
21450        loop {
21451            let token = match self
21452                .hub
21453                .auth
21454                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21455                .await
21456            {
21457                Ok(token) => token,
21458                Err(e) => match dlg.token(e) {
21459                    Ok(token) => token,
21460                    Err(e) => {
21461                        dlg.finished(false);
21462                        return Err(common::Error::MissingToken(e));
21463                    }
21464                },
21465            };
21466            request_value_reader
21467                .seek(std::io::SeekFrom::Start(0))
21468                .unwrap();
21469            let mut req_result = {
21470                let client = &self.hub.client;
21471                dlg.pre_request();
21472                let mut req_builder = hyper::Request::builder()
21473                    .method(hyper::Method::POST)
21474                    .uri(url.as_str())
21475                    .header(USER_AGENT, self.hub._user_agent.clone());
21476
21477                if let Some(token) = token.as_ref() {
21478                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21479                }
21480
21481                let request = req_builder
21482                    .header(CONTENT_TYPE, json_mime_type.to_string())
21483                    .header(CONTENT_LENGTH, request_size as u64)
21484                    .body(common::to_body(
21485                        request_value_reader.get_ref().clone().into(),
21486                    ));
21487
21488                client.request(request.unwrap()).await
21489            };
21490
21491            match req_result {
21492                Err(err) => {
21493                    if let common::Retry::After(d) = dlg.http_error(&err) {
21494                        sleep(d).await;
21495                        continue;
21496                    }
21497                    dlg.finished(false);
21498                    return Err(common::Error::HttpError(err));
21499                }
21500                Ok(res) => {
21501                    let (mut parts, body) = res.into_parts();
21502                    let mut body = common::Body::new(body);
21503                    if !parts.status.is_success() {
21504                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21505                        let error = serde_json::from_str(&common::to_string(&bytes));
21506                        let response = common::to_response(parts, bytes.into());
21507
21508                        if let common::Retry::After(d) =
21509                            dlg.http_failure(&response, error.as_ref().ok())
21510                        {
21511                            sleep(d).await;
21512                            continue;
21513                        }
21514
21515                        dlg.finished(false);
21516
21517                        return Err(match error {
21518                            Ok(value) => common::Error::BadRequest(value),
21519                            _ => common::Error::Failure(response),
21520                        });
21521                    }
21522                    let response = {
21523                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21524                        let encoded = common::to_string(&bytes);
21525                        match serde_json::from_str(&encoded) {
21526                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21527                            Err(error) => {
21528                                dlg.response_json_decode_error(&encoded, &error);
21529                                return Err(common::Error::JsonDecodeError(
21530                                    encoded.to_string(),
21531                                    error,
21532                                ));
21533                            }
21534                        }
21535                    };
21536
21537                    dlg.finished(true);
21538                    return Ok(response);
21539                }
21540            }
21541        }
21542    }
21543
21544    ///
21545    /// Sets the *request* property to the given value.
21546    ///
21547    /// Even though the property as already been set when instantiating this call,
21548    /// we provide this method for API completeness.
21549    pub fn request(
21550        mut self,
21551        new_value: GoogleCloudChannelV1CheckCloudIdentityAccountsExistRequest,
21552    ) -> AccountCheckCloudIdentityAccountsExistCall<'a, C> {
21553        self._request = new_value;
21554        self
21555    }
21556    /// Required. The reseller account's resource name. Parent uses the format: accounts/{account_id}
21557    ///
21558    /// Sets the *parent* path property to the given value.
21559    ///
21560    /// Even though the property as already been set when instantiating this call,
21561    /// we provide this method for API completeness.
21562    pub fn parent(mut self, new_value: &str) -> AccountCheckCloudIdentityAccountsExistCall<'a, C> {
21563        self._parent = new_value.to_string();
21564        self
21565    }
21566    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21567    /// while executing the actual API request.
21568    ///
21569    /// ````text
21570    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21571    /// ````
21572    ///
21573    /// Sets the *delegate* property to the given value.
21574    pub fn delegate(
21575        mut self,
21576        new_value: &'a mut dyn common::Delegate,
21577    ) -> AccountCheckCloudIdentityAccountsExistCall<'a, C> {
21578        self._delegate = Some(new_value);
21579        self
21580    }
21581
21582    /// Set any additional parameter of the query string used in the request.
21583    /// It should be used to set parameters which are not yet available through their own
21584    /// setters.
21585    ///
21586    /// Please note that this method must not be used to set any of the known parameters
21587    /// which have their own setter method. If done anyway, the request will fail.
21588    ///
21589    /// # Additional Parameters
21590    ///
21591    /// * *$.xgafv* (query-string) - V1 error format.
21592    /// * *access_token* (query-string) - OAuth access token.
21593    /// * *alt* (query-string) - Data format for response.
21594    /// * *callback* (query-string) - JSONP
21595    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21596    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21597    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21598    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21599    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21600    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21601    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21602    pub fn param<T>(
21603        mut self,
21604        name: T,
21605        value: T,
21606    ) -> AccountCheckCloudIdentityAccountsExistCall<'a, C>
21607    where
21608        T: AsRef<str>,
21609    {
21610        self._additional_params
21611            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21612        self
21613    }
21614
21615    /// Identifies the authorization scope for the method you are building.
21616    ///
21617    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21618    /// [`Scope::AppOrder`].
21619    ///
21620    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21621    /// tokens for more than one scope.
21622    ///
21623    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21624    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21625    /// sufficient, a read-write scope will do as well.
21626    pub fn add_scope<St>(mut self, scope: St) -> AccountCheckCloudIdentityAccountsExistCall<'a, C>
21627    where
21628        St: AsRef<str>,
21629    {
21630        self._scopes.insert(String::from(scope.as_ref()));
21631        self
21632    }
21633    /// Identifies the authorization scope(s) for the method you are building.
21634    ///
21635    /// See [`Self::add_scope()`] for details.
21636    pub fn add_scopes<I, St>(
21637        mut self,
21638        scopes: I,
21639    ) -> AccountCheckCloudIdentityAccountsExistCall<'a, C>
21640    where
21641        I: IntoIterator<Item = St>,
21642        St: AsRef<str>,
21643    {
21644        self._scopes
21645            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21646        self
21647    }
21648
21649    /// Removes all scopes, and no default scope will be used either.
21650    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21651    /// for details).
21652    pub fn clear_scopes(mut self) -> AccountCheckCloudIdentityAccountsExistCall<'a, C> {
21653        self._scopes.clear();
21654        self
21655    }
21656}
21657
21658/// Lists service accounts with subscriber privileges on the Pub/Sub topic created for this Channel Services account or integrator. Possible error codes: * PERMISSION_DENIED: The reseller account making the request and the provided reseller account are different, or the impersonated user is not a super admin. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The topic resource doesn't exist. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: A list of service email addresses.
21659///
21660/// A builder for the *listSubscribers* method supported by a *account* resource.
21661/// It is not used directly, but through a [`AccountMethods`] instance.
21662///
21663/// # Example
21664///
21665/// Instantiate a resource method builder
21666///
21667/// ```test_harness,no_run
21668/// # extern crate hyper;
21669/// # extern crate hyper_rustls;
21670/// # extern crate google_cloudchannel1 as cloudchannel1;
21671/// # async fn dox() {
21672/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21673///
21674/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21675/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21676/// #     .with_native_roots()
21677/// #     .unwrap()
21678/// #     .https_only()
21679/// #     .enable_http2()
21680/// #     .build();
21681///
21682/// # let executor = hyper_util::rt::TokioExecutor::new();
21683/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21684/// #     secret,
21685/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21686/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21687/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21688/// #     ),
21689/// # ).build().await.unwrap();
21690///
21691/// # let client = hyper_util::client::legacy::Client::builder(
21692/// #     hyper_util::rt::TokioExecutor::new()
21693/// # )
21694/// # .build(
21695/// #     hyper_rustls::HttpsConnectorBuilder::new()
21696/// #         .with_native_roots()
21697/// #         .unwrap()
21698/// #         .https_or_http()
21699/// #         .enable_http2()
21700/// #         .build()
21701/// # );
21702/// # let mut hub = Cloudchannel::new(client, auth);
21703/// // You can configure optional parameters by calling the respective setters at will, and
21704/// // execute the final call using `doit()`.
21705/// // Values shown here are possibly random and not representative !
21706/// let result = hub.accounts().list_subscribers("account")
21707///              .page_token("tempor")
21708///              .page_size(-32)
21709///              .integrator("ipsum")
21710///              .doit().await;
21711/// # }
21712/// ```
21713pub struct AccountListSubscriberCall<'a, C>
21714where
21715    C: 'a,
21716{
21717    hub: &'a Cloudchannel<C>,
21718    _account: String,
21719    _page_token: Option<String>,
21720    _page_size: Option<i32>,
21721    _integrator: Option<String>,
21722    _delegate: Option<&'a mut dyn common::Delegate>,
21723    _additional_params: HashMap<String, String>,
21724    _scopes: BTreeSet<String>,
21725}
21726
21727impl<'a, C> common::CallBuilder for AccountListSubscriberCall<'a, C> {}
21728
21729impl<'a, C> AccountListSubscriberCall<'a, C>
21730where
21731    C: common::Connector,
21732{
21733    /// Perform the operation you have build so far.
21734    pub async fn doit(
21735        mut self,
21736    ) -> common::Result<(
21737        common::Response,
21738        GoogleCloudChannelV1ListSubscribersResponse,
21739    )> {
21740        use std::borrow::Cow;
21741        use std::io::{Read, Seek};
21742
21743        use common::{url::Params, ToParts};
21744        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21745
21746        let mut dd = common::DefaultDelegate;
21747        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21748        dlg.begin(common::MethodInfo {
21749            id: "cloudchannel.accounts.listSubscribers",
21750            http_method: hyper::Method::GET,
21751        });
21752
21753        for &field in ["alt", "account", "pageToken", "pageSize", "integrator"].iter() {
21754            if self._additional_params.contains_key(field) {
21755                dlg.finished(false);
21756                return Err(common::Error::FieldClash(field));
21757            }
21758        }
21759
21760        let mut params = Params::with_capacity(6 + self._additional_params.len());
21761        params.push("account", self._account);
21762        if let Some(value) = self._page_token.as_ref() {
21763            params.push("pageToken", value);
21764        }
21765        if let Some(value) = self._page_size.as_ref() {
21766            params.push("pageSize", value.to_string());
21767        }
21768        if let Some(value) = self._integrator.as_ref() {
21769            params.push("integrator", value);
21770        }
21771
21772        params.extend(self._additional_params.iter());
21773
21774        params.push("alt", "json");
21775        let mut url = self.hub._base_url.clone() + "v1/{+account}:listSubscribers";
21776        if self._scopes.is_empty() {
21777            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
21778        }
21779
21780        #[allow(clippy::single_element_loop)]
21781        for &(find_this, param_name) in [("{+account}", "account")].iter() {
21782            url = params.uri_replacement(url, param_name, find_this, true);
21783        }
21784        {
21785            let to_remove = ["account"];
21786            params.remove_params(&to_remove);
21787        }
21788
21789        let url = params.parse_with_url(&url);
21790
21791        loop {
21792            let token = match self
21793                .hub
21794                .auth
21795                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21796                .await
21797            {
21798                Ok(token) => token,
21799                Err(e) => match dlg.token(e) {
21800                    Ok(token) => token,
21801                    Err(e) => {
21802                        dlg.finished(false);
21803                        return Err(common::Error::MissingToken(e));
21804                    }
21805                },
21806            };
21807            let mut req_result = {
21808                let client = &self.hub.client;
21809                dlg.pre_request();
21810                let mut req_builder = hyper::Request::builder()
21811                    .method(hyper::Method::GET)
21812                    .uri(url.as_str())
21813                    .header(USER_AGENT, self.hub._user_agent.clone());
21814
21815                if let Some(token) = token.as_ref() {
21816                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21817                }
21818
21819                let request = req_builder
21820                    .header(CONTENT_LENGTH, 0_u64)
21821                    .body(common::to_body::<String>(None));
21822
21823                client.request(request.unwrap()).await
21824            };
21825
21826            match req_result {
21827                Err(err) => {
21828                    if let common::Retry::After(d) = dlg.http_error(&err) {
21829                        sleep(d).await;
21830                        continue;
21831                    }
21832                    dlg.finished(false);
21833                    return Err(common::Error::HttpError(err));
21834                }
21835                Ok(res) => {
21836                    let (mut parts, body) = res.into_parts();
21837                    let mut body = common::Body::new(body);
21838                    if !parts.status.is_success() {
21839                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21840                        let error = serde_json::from_str(&common::to_string(&bytes));
21841                        let response = common::to_response(parts, bytes.into());
21842
21843                        if let common::Retry::After(d) =
21844                            dlg.http_failure(&response, error.as_ref().ok())
21845                        {
21846                            sleep(d).await;
21847                            continue;
21848                        }
21849
21850                        dlg.finished(false);
21851
21852                        return Err(match error {
21853                            Ok(value) => common::Error::BadRequest(value),
21854                            _ => common::Error::Failure(response),
21855                        });
21856                    }
21857                    let response = {
21858                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21859                        let encoded = common::to_string(&bytes);
21860                        match serde_json::from_str(&encoded) {
21861                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21862                            Err(error) => {
21863                                dlg.response_json_decode_error(&encoded, &error);
21864                                return Err(common::Error::JsonDecodeError(
21865                                    encoded.to_string(),
21866                                    error,
21867                                ));
21868                            }
21869                        }
21870                    };
21871
21872                    dlg.finished(true);
21873                    return Ok(response);
21874                }
21875            }
21876        }
21877    }
21878
21879    /// Optional. Resource name of the account. Required if integrator is not provided. Otherwise, leave this field empty/unset.
21880    ///
21881    /// Sets the *account* path property to the given value.
21882    ///
21883    /// Even though the property as already been set when instantiating this call,
21884    /// we provide this method for API completeness.
21885    pub fn account(mut self, new_value: &str) -> AccountListSubscriberCall<'a, C> {
21886        self._account = new_value.to_string();
21887        self
21888    }
21889    /// Optional. A page token, received from a previous `ListSubscribers` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListSubscribers` must match the call that provided the page token.
21890    ///
21891    /// Sets the *page token* query property to the given value.
21892    pub fn page_token(mut self, new_value: &str) -> AccountListSubscriberCall<'a, C> {
21893        self._page_token = Some(new_value.to_string());
21894        self
21895    }
21896    /// Optional. The maximum number of service accounts to return. The service may return fewer than this value. If unspecified, returns at most 100 service accounts. The maximum value is 1000; the server will coerce values above 1000.
21897    ///
21898    /// Sets the *page size* query property to the given value.
21899    pub fn page_size(mut self, new_value: i32) -> AccountListSubscriberCall<'a, C> {
21900        self._page_size = Some(new_value);
21901        self
21902    }
21903    /// Optional. Resource name of the integrator. Required if account is not provided. Otherwise, leave this field empty/unset.
21904    ///
21905    /// Sets the *integrator* query property to the given value.
21906    pub fn integrator(mut self, new_value: &str) -> AccountListSubscriberCall<'a, C> {
21907        self._integrator = Some(new_value.to_string());
21908        self
21909    }
21910    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21911    /// while executing the actual API request.
21912    ///
21913    /// ````text
21914    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21915    /// ````
21916    ///
21917    /// Sets the *delegate* property to the given value.
21918    pub fn delegate(
21919        mut self,
21920        new_value: &'a mut dyn common::Delegate,
21921    ) -> AccountListSubscriberCall<'a, C> {
21922        self._delegate = Some(new_value);
21923        self
21924    }
21925
21926    /// Set any additional parameter of the query string used in the request.
21927    /// It should be used to set parameters which are not yet available through their own
21928    /// setters.
21929    ///
21930    /// Please note that this method must not be used to set any of the known parameters
21931    /// which have their own setter method. If done anyway, the request will fail.
21932    ///
21933    /// # Additional Parameters
21934    ///
21935    /// * *$.xgafv* (query-string) - V1 error format.
21936    /// * *access_token* (query-string) - OAuth access token.
21937    /// * *alt* (query-string) - Data format for response.
21938    /// * *callback* (query-string) - JSONP
21939    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21940    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21941    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21942    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21943    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21944    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21945    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21946    pub fn param<T>(mut self, name: T, value: T) -> AccountListSubscriberCall<'a, C>
21947    where
21948        T: AsRef<str>,
21949    {
21950        self._additional_params
21951            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21952        self
21953    }
21954
21955    /// Identifies the authorization scope for the method you are building.
21956    ///
21957    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21958    /// [`Scope::AppOrder`].
21959    ///
21960    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21961    /// tokens for more than one scope.
21962    ///
21963    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21964    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21965    /// sufficient, a read-write scope will do as well.
21966    pub fn add_scope<St>(mut self, scope: St) -> AccountListSubscriberCall<'a, C>
21967    where
21968        St: AsRef<str>,
21969    {
21970        self._scopes.insert(String::from(scope.as_ref()));
21971        self
21972    }
21973    /// Identifies the authorization scope(s) for the method you are building.
21974    ///
21975    /// See [`Self::add_scope()`] for details.
21976    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountListSubscriberCall<'a, C>
21977    where
21978        I: IntoIterator<Item = St>,
21979        St: AsRef<str>,
21980    {
21981        self._scopes
21982            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21983        self
21984    }
21985
21986    /// Removes all scopes, and no default scope will be used either.
21987    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21988    /// for details).
21989    pub fn clear_scopes(mut self) -> AccountListSubscriberCall<'a, C> {
21990        self._scopes.clear();
21991        self
21992    }
21993}
21994
21995/// List TransferableOffers of a customer based on Cloud Identity ID or Customer Name in the request. Use this method when a reseller gets the entitlement information of an unowned customer. The reseller should provide the customer's Cloud Identity ID or Customer Name. Possible error codes: * PERMISSION_DENIED: * The customer doesn't belong to the reseller and has no auth token. * The customer provided incorrect reseller information when generating auth token. * The reseller account making the request is different from the reseller account in the query. * The reseller is not authorized to transact on this Product. See https://support.google.com/channelservices/answer/9759265 * INVALID_ARGUMENT: Required request parameters are missing or invalid. Return value: List of TransferableOffer for the given customer and SKU.
21996///
21997/// A builder for the *listTransferableOffers* method supported by a *account* resource.
21998/// It is not used directly, but through a [`AccountMethods`] instance.
21999///
22000/// # Example
22001///
22002/// Instantiate a resource method builder
22003///
22004/// ```test_harness,no_run
22005/// # extern crate hyper;
22006/// # extern crate hyper_rustls;
22007/// # extern crate google_cloudchannel1 as cloudchannel1;
22008/// use cloudchannel1::api::GoogleCloudChannelV1ListTransferableOffersRequest;
22009/// # async fn dox() {
22010/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22011///
22012/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22013/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22014/// #     .with_native_roots()
22015/// #     .unwrap()
22016/// #     .https_only()
22017/// #     .enable_http2()
22018/// #     .build();
22019///
22020/// # let executor = hyper_util::rt::TokioExecutor::new();
22021/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22022/// #     secret,
22023/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22024/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22025/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22026/// #     ),
22027/// # ).build().await.unwrap();
22028///
22029/// # let client = hyper_util::client::legacy::Client::builder(
22030/// #     hyper_util::rt::TokioExecutor::new()
22031/// # )
22032/// # .build(
22033/// #     hyper_rustls::HttpsConnectorBuilder::new()
22034/// #         .with_native_roots()
22035/// #         .unwrap()
22036/// #         .https_or_http()
22037/// #         .enable_http2()
22038/// #         .build()
22039/// # );
22040/// # let mut hub = Cloudchannel::new(client, auth);
22041/// // As the method needs a request, you would usually fill it with the desired information
22042/// // into the respective structure. Some of the parts shown here might not be applicable !
22043/// // Values shown here are possibly random and not representative !
22044/// let mut req = GoogleCloudChannelV1ListTransferableOffersRequest::default();
22045///
22046/// // You can configure optional parameters by calling the respective setters at will, and
22047/// // execute the final call using `doit()`.
22048/// // Values shown here are possibly random and not representative !
22049/// let result = hub.accounts().list_transferable_offers(req, "parent")
22050///              .doit().await;
22051/// # }
22052/// ```
22053pub struct AccountListTransferableOfferCall<'a, C>
22054where
22055    C: 'a,
22056{
22057    hub: &'a Cloudchannel<C>,
22058    _request: GoogleCloudChannelV1ListTransferableOffersRequest,
22059    _parent: String,
22060    _delegate: Option<&'a mut dyn common::Delegate>,
22061    _additional_params: HashMap<String, String>,
22062    _scopes: BTreeSet<String>,
22063}
22064
22065impl<'a, C> common::CallBuilder for AccountListTransferableOfferCall<'a, C> {}
22066
22067impl<'a, C> AccountListTransferableOfferCall<'a, C>
22068where
22069    C: common::Connector,
22070{
22071    /// Perform the operation you have build so far.
22072    pub async fn doit(
22073        mut self,
22074    ) -> common::Result<(
22075        common::Response,
22076        GoogleCloudChannelV1ListTransferableOffersResponse,
22077    )> {
22078        use std::borrow::Cow;
22079        use std::io::{Read, Seek};
22080
22081        use common::{url::Params, ToParts};
22082        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22083
22084        let mut dd = common::DefaultDelegate;
22085        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22086        dlg.begin(common::MethodInfo {
22087            id: "cloudchannel.accounts.listTransferableOffers",
22088            http_method: hyper::Method::POST,
22089        });
22090
22091        for &field in ["alt", "parent"].iter() {
22092            if self._additional_params.contains_key(field) {
22093                dlg.finished(false);
22094                return Err(common::Error::FieldClash(field));
22095            }
22096        }
22097
22098        let mut params = Params::with_capacity(4 + self._additional_params.len());
22099        params.push("parent", self._parent);
22100
22101        params.extend(self._additional_params.iter());
22102
22103        params.push("alt", "json");
22104        let mut url = self.hub._base_url.clone() + "v1/{+parent}:listTransferableOffers";
22105        if self._scopes.is_empty() {
22106            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
22107        }
22108
22109        #[allow(clippy::single_element_loop)]
22110        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
22111            url = params.uri_replacement(url, param_name, find_this, true);
22112        }
22113        {
22114            let to_remove = ["parent"];
22115            params.remove_params(&to_remove);
22116        }
22117
22118        let url = params.parse_with_url(&url);
22119
22120        let mut json_mime_type = mime::APPLICATION_JSON;
22121        let mut request_value_reader = {
22122            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22123            common::remove_json_null_values(&mut value);
22124            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22125            serde_json::to_writer(&mut dst, &value).unwrap();
22126            dst
22127        };
22128        let request_size = request_value_reader
22129            .seek(std::io::SeekFrom::End(0))
22130            .unwrap();
22131        request_value_reader
22132            .seek(std::io::SeekFrom::Start(0))
22133            .unwrap();
22134
22135        loop {
22136            let token = match self
22137                .hub
22138                .auth
22139                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22140                .await
22141            {
22142                Ok(token) => token,
22143                Err(e) => match dlg.token(e) {
22144                    Ok(token) => token,
22145                    Err(e) => {
22146                        dlg.finished(false);
22147                        return Err(common::Error::MissingToken(e));
22148                    }
22149                },
22150            };
22151            request_value_reader
22152                .seek(std::io::SeekFrom::Start(0))
22153                .unwrap();
22154            let mut req_result = {
22155                let client = &self.hub.client;
22156                dlg.pre_request();
22157                let mut req_builder = hyper::Request::builder()
22158                    .method(hyper::Method::POST)
22159                    .uri(url.as_str())
22160                    .header(USER_AGENT, self.hub._user_agent.clone());
22161
22162                if let Some(token) = token.as_ref() {
22163                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22164                }
22165
22166                let request = req_builder
22167                    .header(CONTENT_TYPE, json_mime_type.to_string())
22168                    .header(CONTENT_LENGTH, request_size as u64)
22169                    .body(common::to_body(
22170                        request_value_reader.get_ref().clone().into(),
22171                    ));
22172
22173                client.request(request.unwrap()).await
22174            };
22175
22176            match req_result {
22177                Err(err) => {
22178                    if let common::Retry::After(d) = dlg.http_error(&err) {
22179                        sleep(d).await;
22180                        continue;
22181                    }
22182                    dlg.finished(false);
22183                    return Err(common::Error::HttpError(err));
22184                }
22185                Ok(res) => {
22186                    let (mut parts, body) = res.into_parts();
22187                    let mut body = common::Body::new(body);
22188                    if !parts.status.is_success() {
22189                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22190                        let error = serde_json::from_str(&common::to_string(&bytes));
22191                        let response = common::to_response(parts, bytes.into());
22192
22193                        if let common::Retry::After(d) =
22194                            dlg.http_failure(&response, error.as_ref().ok())
22195                        {
22196                            sleep(d).await;
22197                            continue;
22198                        }
22199
22200                        dlg.finished(false);
22201
22202                        return Err(match error {
22203                            Ok(value) => common::Error::BadRequest(value),
22204                            _ => common::Error::Failure(response),
22205                        });
22206                    }
22207                    let response = {
22208                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22209                        let encoded = common::to_string(&bytes);
22210                        match serde_json::from_str(&encoded) {
22211                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22212                            Err(error) => {
22213                                dlg.response_json_decode_error(&encoded, &error);
22214                                return Err(common::Error::JsonDecodeError(
22215                                    encoded.to_string(),
22216                                    error,
22217                                ));
22218                            }
22219                        }
22220                    };
22221
22222                    dlg.finished(true);
22223                    return Ok(response);
22224                }
22225            }
22226        }
22227    }
22228
22229    ///
22230    /// Sets the *request* property to the given value.
22231    ///
22232    /// Even though the property as already been set when instantiating this call,
22233    /// we provide this method for API completeness.
22234    pub fn request(
22235        mut self,
22236        new_value: GoogleCloudChannelV1ListTransferableOffersRequest,
22237    ) -> AccountListTransferableOfferCall<'a, C> {
22238        self._request = new_value;
22239        self
22240    }
22241    /// Required. The resource name of the reseller's account.
22242    ///
22243    /// Sets the *parent* path property to the given value.
22244    ///
22245    /// Even though the property as already been set when instantiating this call,
22246    /// we provide this method for API completeness.
22247    pub fn parent(mut self, new_value: &str) -> AccountListTransferableOfferCall<'a, C> {
22248        self._parent = new_value.to_string();
22249        self
22250    }
22251    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22252    /// while executing the actual API request.
22253    ///
22254    /// ````text
22255    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22256    /// ````
22257    ///
22258    /// Sets the *delegate* property to the given value.
22259    pub fn delegate(
22260        mut self,
22261        new_value: &'a mut dyn common::Delegate,
22262    ) -> AccountListTransferableOfferCall<'a, C> {
22263        self._delegate = Some(new_value);
22264        self
22265    }
22266
22267    /// Set any additional parameter of the query string used in the request.
22268    /// It should be used to set parameters which are not yet available through their own
22269    /// setters.
22270    ///
22271    /// Please note that this method must not be used to set any of the known parameters
22272    /// which have their own setter method. If done anyway, the request will fail.
22273    ///
22274    /// # Additional Parameters
22275    ///
22276    /// * *$.xgafv* (query-string) - V1 error format.
22277    /// * *access_token* (query-string) - OAuth access token.
22278    /// * *alt* (query-string) - Data format for response.
22279    /// * *callback* (query-string) - JSONP
22280    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22281    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22282    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22283    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22284    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22285    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22286    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22287    pub fn param<T>(mut self, name: T, value: T) -> AccountListTransferableOfferCall<'a, C>
22288    where
22289        T: AsRef<str>,
22290    {
22291        self._additional_params
22292            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22293        self
22294    }
22295
22296    /// Identifies the authorization scope for the method you are building.
22297    ///
22298    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22299    /// [`Scope::AppOrder`].
22300    ///
22301    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22302    /// tokens for more than one scope.
22303    ///
22304    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22305    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22306    /// sufficient, a read-write scope will do as well.
22307    pub fn add_scope<St>(mut self, scope: St) -> AccountListTransferableOfferCall<'a, C>
22308    where
22309        St: AsRef<str>,
22310    {
22311        self._scopes.insert(String::from(scope.as_ref()));
22312        self
22313    }
22314    /// Identifies the authorization scope(s) for the method you are building.
22315    ///
22316    /// See [`Self::add_scope()`] for details.
22317    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountListTransferableOfferCall<'a, C>
22318    where
22319        I: IntoIterator<Item = St>,
22320        St: AsRef<str>,
22321    {
22322        self._scopes
22323            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22324        self
22325    }
22326
22327    /// Removes all scopes, and no default scope will be used either.
22328    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22329    /// for details).
22330    pub fn clear_scopes(mut self) -> AccountListTransferableOfferCall<'a, C> {
22331        self._scopes.clear();
22332        self
22333    }
22334}
22335
22336/// List TransferableSkus of a customer based on the Cloud Identity ID or Customer Name in the request. Use this method to list the entitlements information of an unowned customer. You should provide the customer's Cloud Identity ID or Customer Name. Possible error codes: * PERMISSION_DENIED: * The customer doesn't belong to the reseller and has no auth token. * The supplied auth token is invalid. * The reseller account making the request is different from the reseller account in the query. * INVALID_ARGUMENT: Required request parameters are missing or invalid. Return value: A list of the customer's TransferableSku.
22337///
22338/// A builder for the *listTransferableSkus* method supported by a *account* resource.
22339/// It is not used directly, but through a [`AccountMethods`] instance.
22340///
22341/// # Example
22342///
22343/// Instantiate a resource method builder
22344///
22345/// ```test_harness,no_run
22346/// # extern crate hyper;
22347/// # extern crate hyper_rustls;
22348/// # extern crate google_cloudchannel1 as cloudchannel1;
22349/// use cloudchannel1::api::GoogleCloudChannelV1ListTransferableSkusRequest;
22350/// # async fn dox() {
22351/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22352///
22353/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22354/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22355/// #     .with_native_roots()
22356/// #     .unwrap()
22357/// #     .https_only()
22358/// #     .enable_http2()
22359/// #     .build();
22360///
22361/// # let executor = hyper_util::rt::TokioExecutor::new();
22362/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22363/// #     secret,
22364/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22365/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22366/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22367/// #     ),
22368/// # ).build().await.unwrap();
22369///
22370/// # let client = hyper_util::client::legacy::Client::builder(
22371/// #     hyper_util::rt::TokioExecutor::new()
22372/// # )
22373/// # .build(
22374/// #     hyper_rustls::HttpsConnectorBuilder::new()
22375/// #         .with_native_roots()
22376/// #         .unwrap()
22377/// #         .https_or_http()
22378/// #         .enable_http2()
22379/// #         .build()
22380/// # );
22381/// # let mut hub = Cloudchannel::new(client, auth);
22382/// // As the method needs a request, you would usually fill it with the desired information
22383/// // into the respective structure. Some of the parts shown here might not be applicable !
22384/// // Values shown here are possibly random and not representative !
22385/// let mut req = GoogleCloudChannelV1ListTransferableSkusRequest::default();
22386///
22387/// // You can configure optional parameters by calling the respective setters at will, and
22388/// // execute the final call using `doit()`.
22389/// // Values shown here are possibly random and not representative !
22390/// let result = hub.accounts().list_transferable_skus(req, "parent")
22391///              .doit().await;
22392/// # }
22393/// ```
22394pub struct AccountListTransferableSkuCall<'a, C>
22395where
22396    C: 'a,
22397{
22398    hub: &'a Cloudchannel<C>,
22399    _request: GoogleCloudChannelV1ListTransferableSkusRequest,
22400    _parent: String,
22401    _delegate: Option<&'a mut dyn common::Delegate>,
22402    _additional_params: HashMap<String, String>,
22403    _scopes: BTreeSet<String>,
22404}
22405
22406impl<'a, C> common::CallBuilder for AccountListTransferableSkuCall<'a, C> {}
22407
22408impl<'a, C> AccountListTransferableSkuCall<'a, C>
22409where
22410    C: common::Connector,
22411{
22412    /// Perform the operation you have build so far.
22413    pub async fn doit(
22414        mut self,
22415    ) -> common::Result<(
22416        common::Response,
22417        GoogleCloudChannelV1ListTransferableSkusResponse,
22418    )> {
22419        use std::borrow::Cow;
22420        use std::io::{Read, Seek};
22421
22422        use common::{url::Params, ToParts};
22423        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22424
22425        let mut dd = common::DefaultDelegate;
22426        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22427        dlg.begin(common::MethodInfo {
22428            id: "cloudchannel.accounts.listTransferableSkus",
22429            http_method: hyper::Method::POST,
22430        });
22431
22432        for &field in ["alt", "parent"].iter() {
22433            if self._additional_params.contains_key(field) {
22434                dlg.finished(false);
22435                return Err(common::Error::FieldClash(field));
22436            }
22437        }
22438
22439        let mut params = Params::with_capacity(4 + self._additional_params.len());
22440        params.push("parent", self._parent);
22441
22442        params.extend(self._additional_params.iter());
22443
22444        params.push("alt", "json");
22445        let mut url = self.hub._base_url.clone() + "v1/{+parent}:listTransferableSkus";
22446        if self._scopes.is_empty() {
22447            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
22448        }
22449
22450        #[allow(clippy::single_element_loop)]
22451        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
22452            url = params.uri_replacement(url, param_name, find_this, true);
22453        }
22454        {
22455            let to_remove = ["parent"];
22456            params.remove_params(&to_remove);
22457        }
22458
22459        let url = params.parse_with_url(&url);
22460
22461        let mut json_mime_type = mime::APPLICATION_JSON;
22462        let mut request_value_reader = {
22463            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22464            common::remove_json_null_values(&mut value);
22465            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22466            serde_json::to_writer(&mut dst, &value).unwrap();
22467            dst
22468        };
22469        let request_size = request_value_reader
22470            .seek(std::io::SeekFrom::End(0))
22471            .unwrap();
22472        request_value_reader
22473            .seek(std::io::SeekFrom::Start(0))
22474            .unwrap();
22475
22476        loop {
22477            let token = match self
22478                .hub
22479                .auth
22480                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22481                .await
22482            {
22483                Ok(token) => token,
22484                Err(e) => match dlg.token(e) {
22485                    Ok(token) => token,
22486                    Err(e) => {
22487                        dlg.finished(false);
22488                        return Err(common::Error::MissingToken(e));
22489                    }
22490                },
22491            };
22492            request_value_reader
22493                .seek(std::io::SeekFrom::Start(0))
22494                .unwrap();
22495            let mut req_result = {
22496                let client = &self.hub.client;
22497                dlg.pre_request();
22498                let mut req_builder = hyper::Request::builder()
22499                    .method(hyper::Method::POST)
22500                    .uri(url.as_str())
22501                    .header(USER_AGENT, self.hub._user_agent.clone());
22502
22503                if let Some(token) = token.as_ref() {
22504                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22505                }
22506
22507                let request = req_builder
22508                    .header(CONTENT_TYPE, json_mime_type.to_string())
22509                    .header(CONTENT_LENGTH, request_size as u64)
22510                    .body(common::to_body(
22511                        request_value_reader.get_ref().clone().into(),
22512                    ));
22513
22514                client.request(request.unwrap()).await
22515            };
22516
22517            match req_result {
22518                Err(err) => {
22519                    if let common::Retry::After(d) = dlg.http_error(&err) {
22520                        sleep(d).await;
22521                        continue;
22522                    }
22523                    dlg.finished(false);
22524                    return Err(common::Error::HttpError(err));
22525                }
22526                Ok(res) => {
22527                    let (mut parts, body) = res.into_parts();
22528                    let mut body = common::Body::new(body);
22529                    if !parts.status.is_success() {
22530                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22531                        let error = serde_json::from_str(&common::to_string(&bytes));
22532                        let response = common::to_response(parts, bytes.into());
22533
22534                        if let common::Retry::After(d) =
22535                            dlg.http_failure(&response, error.as_ref().ok())
22536                        {
22537                            sleep(d).await;
22538                            continue;
22539                        }
22540
22541                        dlg.finished(false);
22542
22543                        return Err(match error {
22544                            Ok(value) => common::Error::BadRequest(value),
22545                            _ => common::Error::Failure(response),
22546                        });
22547                    }
22548                    let response = {
22549                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22550                        let encoded = common::to_string(&bytes);
22551                        match serde_json::from_str(&encoded) {
22552                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22553                            Err(error) => {
22554                                dlg.response_json_decode_error(&encoded, &error);
22555                                return Err(common::Error::JsonDecodeError(
22556                                    encoded.to_string(),
22557                                    error,
22558                                ));
22559                            }
22560                        }
22561                    };
22562
22563                    dlg.finished(true);
22564                    return Ok(response);
22565                }
22566            }
22567        }
22568    }
22569
22570    ///
22571    /// Sets the *request* property to the given value.
22572    ///
22573    /// Even though the property as already been set when instantiating this call,
22574    /// we provide this method for API completeness.
22575    pub fn request(
22576        mut self,
22577        new_value: GoogleCloudChannelV1ListTransferableSkusRequest,
22578    ) -> AccountListTransferableSkuCall<'a, C> {
22579        self._request = new_value;
22580        self
22581    }
22582    /// Required. The reseller account's resource name. Parent uses the format: accounts/{account_id}
22583    ///
22584    /// Sets the *parent* path property to the given value.
22585    ///
22586    /// Even though the property as already been set when instantiating this call,
22587    /// we provide this method for API completeness.
22588    pub fn parent(mut self, new_value: &str) -> AccountListTransferableSkuCall<'a, C> {
22589        self._parent = new_value.to_string();
22590        self
22591    }
22592    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22593    /// while executing the actual API request.
22594    ///
22595    /// ````text
22596    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22597    /// ````
22598    ///
22599    /// Sets the *delegate* property to the given value.
22600    pub fn delegate(
22601        mut self,
22602        new_value: &'a mut dyn common::Delegate,
22603    ) -> AccountListTransferableSkuCall<'a, C> {
22604        self._delegate = Some(new_value);
22605        self
22606    }
22607
22608    /// Set any additional parameter of the query string used in the request.
22609    /// It should be used to set parameters which are not yet available through their own
22610    /// setters.
22611    ///
22612    /// Please note that this method must not be used to set any of the known parameters
22613    /// which have their own setter method. If done anyway, the request will fail.
22614    ///
22615    /// # Additional Parameters
22616    ///
22617    /// * *$.xgafv* (query-string) - V1 error format.
22618    /// * *access_token* (query-string) - OAuth access token.
22619    /// * *alt* (query-string) - Data format for response.
22620    /// * *callback* (query-string) - JSONP
22621    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22622    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22623    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22624    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22625    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22626    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22627    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22628    pub fn param<T>(mut self, name: T, value: T) -> AccountListTransferableSkuCall<'a, C>
22629    where
22630        T: AsRef<str>,
22631    {
22632        self._additional_params
22633            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22634        self
22635    }
22636
22637    /// Identifies the authorization scope for the method you are building.
22638    ///
22639    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22640    /// [`Scope::AppOrder`].
22641    ///
22642    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22643    /// tokens for more than one scope.
22644    ///
22645    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22646    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22647    /// sufficient, a read-write scope will do as well.
22648    pub fn add_scope<St>(mut self, scope: St) -> AccountListTransferableSkuCall<'a, C>
22649    where
22650        St: AsRef<str>,
22651    {
22652        self._scopes.insert(String::from(scope.as_ref()));
22653        self
22654    }
22655    /// Identifies the authorization scope(s) for the method you are building.
22656    ///
22657    /// See [`Self::add_scope()`] for details.
22658    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountListTransferableSkuCall<'a, C>
22659    where
22660        I: IntoIterator<Item = St>,
22661        St: AsRef<str>,
22662    {
22663        self._scopes
22664            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22665        self
22666    }
22667
22668    /// Removes all scopes, and no default scope will be used either.
22669    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22670    /// for details).
22671    pub fn clear_scopes(mut self) -> AccountListTransferableSkuCall<'a, C> {
22672        self._scopes.clear();
22673        self
22674    }
22675}
22676
22677/// Registers a service account with subscriber privileges on the Pub/Sub topic for this Channel Services account or integrator. After you create a subscriber, you get the events through SubscriberEvent Possible error codes: * PERMISSION_DENIED: The reseller account making the request and the provided reseller account are different, or the impersonated user is not a super admin. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The topic name with the registered service email address.
22678///
22679/// A builder for the *register* method supported by a *account* resource.
22680/// It is not used directly, but through a [`AccountMethods`] instance.
22681///
22682/// # Example
22683///
22684/// Instantiate a resource method builder
22685///
22686/// ```test_harness,no_run
22687/// # extern crate hyper;
22688/// # extern crate hyper_rustls;
22689/// # extern crate google_cloudchannel1 as cloudchannel1;
22690/// use cloudchannel1::api::GoogleCloudChannelV1RegisterSubscriberRequest;
22691/// # async fn dox() {
22692/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22693///
22694/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22695/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22696/// #     .with_native_roots()
22697/// #     .unwrap()
22698/// #     .https_only()
22699/// #     .enable_http2()
22700/// #     .build();
22701///
22702/// # let executor = hyper_util::rt::TokioExecutor::new();
22703/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22704/// #     secret,
22705/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22706/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22707/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22708/// #     ),
22709/// # ).build().await.unwrap();
22710///
22711/// # let client = hyper_util::client::legacy::Client::builder(
22712/// #     hyper_util::rt::TokioExecutor::new()
22713/// # )
22714/// # .build(
22715/// #     hyper_rustls::HttpsConnectorBuilder::new()
22716/// #         .with_native_roots()
22717/// #         .unwrap()
22718/// #         .https_or_http()
22719/// #         .enable_http2()
22720/// #         .build()
22721/// # );
22722/// # let mut hub = Cloudchannel::new(client, auth);
22723/// // As the method needs a request, you would usually fill it with the desired information
22724/// // into the respective structure. Some of the parts shown here might not be applicable !
22725/// // Values shown here are possibly random and not representative !
22726/// let mut req = GoogleCloudChannelV1RegisterSubscriberRequest::default();
22727///
22728/// // You can configure optional parameters by calling the respective setters at will, and
22729/// // execute the final call using `doit()`.
22730/// // Values shown here are possibly random and not representative !
22731/// let result = hub.accounts().register(req, "account")
22732///              .doit().await;
22733/// # }
22734/// ```
22735pub struct AccountRegisterCall<'a, C>
22736where
22737    C: 'a,
22738{
22739    hub: &'a Cloudchannel<C>,
22740    _request: GoogleCloudChannelV1RegisterSubscriberRequest,
22741    _account: String,
22742    _delegate: Option<&'a mut dyn common::Delegate>,
22743    _additional_params: HashMap<String, String>,
22744    _scopes: BTreeSet<String>,
22745}
22746
22747impl<'a, C> common::CallBuilder for AccountRegisterCall<'a, C> {}
22748
22749impl<'a, C> AccountRegisterCall<'a, C>
22750where
22751    C: common::Connector,
22752{
22753    /// Perform the operation you have build so far.
22754    pub async fn doit(
22755        mut self,
22756    ) -> common::Result<(
22757        common::Response,
22758        GoogleCloudChannelV1RegisterSubscriberResponse,
22759    )> {
22760        use std::borrow::Cow;
22761        use std::io::{Read, Seek};
22762
22763        use common::{url::Params, ToParts};
22764        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22765
22766        let mut dd = common::DefaultDelegate;
22767        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22768        dlg.begin(common::MethodInfo {
22769            id: "cloudchannel.accounts.register",
22770            http_method: hyper::Method::POST,
22771        });
22772
22773        for &field in ["alt", "account"].iter() {
22774            if self._additional_params.contains_key(field) {
22775                dlg.finished(false);
22776                return Err(common::Error::FieldClash(field));
22777            }
22778        }
22779
22780        let mut params = Params::with_capacity(4 + self._additional_params.len());
22781        params.push("account", self._account);
22782
22783        params.extend(self._additional_params.iter());
22784
22785        params.push("alt", "json");
22786        let mut url = self.hub._base_url.clone() + "v1/{+account}:register";
22787        if self._scopes.is_empty() {
22788            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
22789        }
22790
22791        #[allow(clippy::single_element_loop)]
22792        for &(find_this, param_name) in [("{+account}", "account")].iter() {
22793            url = params.uri_replacement(url, param_name, find_this, true);
22794        }
22795        {
22796            let to_remove = ["account"];
22797            params.remove_params(&to_remove);
22798        }
22799
22800        let url = params.parse_with_url(&url);
22801
22802        let mut json_mime_type = mime::APPLICATION_JSON;
22803        let mut request_value_reader = {
22804            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22805            common::remove_json_null_values(&mut value);
22806            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22807            serde_json::to_writer(&mut dst, &value).unwrap();
22808            dst
22809        };
22810        let request_size = request_value_reader
22811            .seek(std::io::SeekFrom::End(0))
22812            .unwrap();
22813        request_value_reader
22814            .seek(std::io::SeekFrom::Start(0))
22815            .unwrap();
22816
22817        loop {
22818            let token = match self
22819                .hub
22820                .auth
22821                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22822                .await
22823            {
22824                Ok(token) => token,
22825                Err(e) => match dlg.token(e) {
22826                    Ok(token) => token,
22827                    Err(e) => {
22828                        dlg.finished(false);
22829                        return Err(common::Error::MissingToken(e));
22830                    }
22831                },
22832            };
22833            request_value_reader
22834                .seek(std::io::SeekFrom::Start(0))
22835                .unwrap();
22836            let mut req_result = {
22837                let client = &self.hub.client;
22838                dlg.pre_request();
22839                let mut req_builder = hyper::Request::builder()
22840                    .method(hyper::Method::POST)
22841                    .uri(url.as_str())
22842                    .header(USER_AGENT, self.hub._user_agent.clone());
22843
22844                if let Some(token) = token.as_ref() {
22845                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22846                }
22847
22848                let request = req_builder
22849                    .header(CONTENT_TYPE, json_mime_type.to_string())
22850                    .header(CONTENT_LENGTH, request_size as u64)
22851                    .body(common::to_body(
22852                        request_value_reader.get_ref().clone().into(),
22853                    ));
22854
22855                client.request(request.unwrap()).await
22856            };
22857
22858            match req_result {
22859                Err(err) => {
22860                    if let common::Retry::After(d) = dlg.http_error(&err) {
22861                        sleep(d).await;
22862                        continue;
22863                    }
22864                    dlg.finished(false);
22865                    return Err(common::Error::HttpError(err));
22866                }
22867                Ok(res) => {
22868                    let (mut parts, body) = res.into_parts();
22869                    let mut body = common::Body::new(body);
22870                    if !parts.status.is_success() {
22871                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22872                        let error = serde_json::from_str(&common::to_string(&bytes));
22873                        let response = common::to_response(parts, bytes.into());
22874
22875                        if let common::Retry::After(d) =
22876                            dlg.http_failure(&response, error.as_ref().ok())
22877                        {
22878                            sleep(d).await;
22879                            continue;
22880                        }
22881
22882                        dlg.finished(false);
22883
22884                        return Err(match error {
22885                            Ok(value) => common::Error::BadRequest(value),
22886                            _ => common::Error::Failure(response),
22887                        });
22888                    }
22889                    let response = {
22890                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22891                        let encoded = common::to_string(&bytes);
22892                        match serde_json::from_str(&encoded) {
22893                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22894                            Err(error) => {
22895                                dlg.response_json_decode_error(&encoded, &error);
22896                                return Err(common::Error::JsonDecodeError(
22897                                    encoded.to_string(),
22898                                    error,
22899                                ));
22900                            }
22901                        }
22902                    };
22903
22904                    dlg.finished(true);
22905                    return Ok(response);
22906                }
22907            }
22908        }
22909    }
22910
22911    ///
22912    /// Sets the *request* property to the given value.
22913    ///
22914    /// Even though the property as already been set when instantiating this call,
22915    /// we provide this method for API completeness.
22916    pub fn request(
22917        mut self,
22918        new_value: GoogleCloudChannelV1RegisterSubscriberRequest,
22919    ) -> AccountRegisterCall<'a, C> {
22920        self._request = new_value;
22921        self
22922    }
22923    /// Optional. Resource name of the account. Required if integrator is not provided. Otherwise, leave this field empty/unset.
22924    ///
22925    /// Sets the *account* path property to the given value.
22926    ///
22927    /// Even though the property as already been set when instantiating this call,
22928    /// we provide this method for API completeness.
22929    pub fn account(mut self, new_value: &str) -> AccountRegisterCall<'a, C> {
22930        self._account = new_value.to_string();
22931        self
22932    }
22933    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22934    /// while executing the actual API request.
22935    ///
22936    /// ````text
22937    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22938    /// ````
22939    ///
22940    /// Sets the *delegate* property to the given value.
22941    pub fn delegate(
22942        mut self,
22943        new_value: &'a mut dyn common::Delegate,
22944    ) -> AccountRegisterCall<'a, C> {
22945        self._delegate = Some(new_value);
22946        self
22947    }
22948
22949    /// Set any additional parameter of the query string used in the request.
22950    /// It should be used to set parameters which are not yet available through their own
22951    /// setters.
22952    ///
22953    /// Please note that this method must not be used to set any of the known parameters
22954    /// which have their own setter method. If done anyway, the request will fail.
22955    ///
22956    /// # Additional Parameters
22957    ///
22958    /// * *$.xgafv* (query-string) - V1 error format.
22959    /// * *access_token* (query-string) - OAuth access token.
22960    /// * *alt* (query-string) - Data format for response.
22961    /// * *callback* (query-string) - JSONP
22962    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22963    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22964    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22965    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22966    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22967    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22968    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22969    pub fn param<T>(mut self, name: T, value: T) -> AccountRegisterCall<'a, C>
22970    where
22971        T: AsRef<str>,
22972    {
22973        self._additional_params
22974            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22975        self
22976    }
22977
22978    /// Identifies the authorization scope for the method you are building.
22979    ///
22980    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22981    /// [`Scope::AppOrder`].
22982    ///
22983    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22984    /// tokens for more than one scope.
22985    ///
22986    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22987    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22988    /// sufficient, a read-write scope will do as well.
22989    pub fn add_scope<St>(mut self, scope: St) -> AccountRegisterCall<'a, C>
22990    where
22991        St: AsRef<str>,
22992    {
22993        self._scopes.insert(String::from(scope.as_ref()));
22994        self
22995    }
22996    /// Identifies the authorization scope(s) for the method you are building.
22997    ///
22998    /// See [`Self::add_scope()`] for details.
22999    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountRegisterCall<'a, C>
23000    where
23001        I: IntoIterator<Item = St>,
23002        St: AsRef<str>,
23003    {
23004        self._scopes
23005            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23006        self
23007    }
23008
23009    /// Removes all scopes, and no default scope will be used either.
23010    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23011    /// for details).
23012    pub fn clear_scopes(mut self) -> AccountRegisterCall<'a, C> {
23013        self._scopes.clear();
23014        self
23015    }
23016}
23017
23018/// Unregisters a service account with subscriber privileges on the Pub/Sub topic created for this Channel Services account or integrator. If there are no service accounts left with subscriber privileges, this deletes the topic. You can call ListSubscribers to check for these accounts. Possible error codes: * PERMISSION_DENIED: The reseller account making the request and the provided reseller account are different, or the impersonated user is not a super admin. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The topic resource doesn't exist. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The topic name that unregistered the service email address. Returns a success response if the service email address wasn't registered with the topic.
23019///
23020/// A builder for the *unregister* method supported by a *account* resource.
23021/// It is not used directly, but through a [`AccountMethods`] instance.
23022///
23023/// # Example
23024///
23025/// Instantiate a resource method builder
23026///
23027/// ```test_harness,no_run
23028/// # extern crate hyper;
23029/// # extern crate hyper_rustls;
23030/// # extern crate google_cloudchannel1 as cloudchannel1;
23031/// use cloudchannel1::api::GoogleCloudChannelV1UnregisterSubscriberRequest;
23032/// # async fn dox() {
23033/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23034///
23035/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23036/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23037/// #     .with_native_roots()
23038/// #     .unwrap()
23039/// #     .https_only()
23040/// #     .enable_http2()
23041/// #     .build();
23042///
23043/// # let executor = hyper_util::rt::TokioExecutor::new();
23044/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23045/// #     secret,
23046/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23047/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23048/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23049/// #     ),
23050/// # ).build().await.unwrap();
23051///
23052/// # let client = hyper_util::client::legacy::Client::builder(
23053/// #     hyper_util::rt::TokioExecutor::new()
23054/// # )
23055/// # .build(
23056/// #     hyper_rustls::HttpsConnectorBuilder::new()
23057/// #         .with_native_roots()
23058/// #         .unwrap()
23059/// #         .https_or_http()
23060/// #         .enable_http2()
23061/// #         .build()
23062/// # );
23063/// # let mut hub = Cloudchannel::new(client, auth);
23064/// // As the method needs a request, you would usually fill it with the desired information
23065/// // into the respective structure. Some of the parts shown here might not be applicable !
23066/// // Values shown here are possibly random and not representative !
23067/// let mut req = GoogleCloudChannelV1UnregisterSubscriberRequest::default();
23068///
23069/// // You can configure optional parameters by calling the respective setters at will, and
23070/// // execute the final call using `doit()`.
23071/// // Values shown here are possibly random and not representative !
23072/// let result = hub.accounts().unregister(req, "account")
23073///              .doit().await;
23074/// # }
23075/// ```
23076pub struct AccountUnregisterCall<'a, C>
23077where
23078    C: 'a,
23079{
23080    hub: &'a Cloudchannel<C>,
23081    _request: GoogleCloudChannelV1UnregisterSubscriberRequest,
23082    _account: String,
23083    _delegate: Option<&'a mut dyn common::Delegate>,
23084    _additional_params: HashMap<String, String>,
23085    _scopes: BTreeSet<String>,
23086}
23087
23088impl<'a, C> common::CallBuilder for AccountUnregisterCall<'a, C> {}
23089
23090impl<'a, C> AccountUnregisterCall<'a, C>
23091where
23092    C: common::Connector,
23093{
23094    /// Perform the operation you have build so far.
23095    pub async fn doit(
23096        mut self,
23097    ) -> common::Result<(
23098        common::Response,
23099        GoogleCloudChannelV1UnregisterSubscriberResponse,
23100    )> {
23101        use std::borrow::Cow;
23102        use std::io::{Read, Seek};
23103
23104        use common::{url::Params, ToParts};
23105        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23106
23107        let mut dd = common::DefaultDelegate;
23108        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23109        dlg.begin(common::MethodInfo {
23110            id: "cloudchannel.accounts.unregister",
23111            http_method: hyper::Method::POST,
23112        });
23113
23114        for &field in ["alt", "account"].iter() {
23115            if self._additional_params.contains_key(field) {
23116                dlg.finished(false);
23117                return Err(common::Error::FieldClash(field));
23118            }
23119        }
23120
23121        let mut params = Params::with_capacity(4 + self._additional_params.len());
23122        params.push("account", self._account);
23123
23124        params.extend(self._additional_params.iter());
23125
23126        params.push("alt", "json");
23127        let mut url = self.hub._base_url.clone() + "v1/{+account}:unregister";
23128        if self._scopes.is_empty() {
23129            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
23130        }
23131
23132        #[allow(clippy::single_element_loop)]
23133        for &(find_this, param_name) in [("{+account}", "account")].iter() {
23134            url = params.uri_replacement(url, param_name, find_this, true);
23135        }
23136        {
23137            let to_remove = ["account"];
23138            params.remove_params(&to_remove);
23139        }
23140
23141        let url = params.parse_with_url(&url);
23142
23143        let mut json_mime_type = mime::APPLICATION_JSON;
23144        let mut request_value_reader = {
23145            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23146            common::remove_json_null_values(&mut value);
23147            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23148            serde_json::to_writer(&mut dst, &value).unwrap();
23149            dst
23150        };
23151        let request_size = request_value_reader
23152            .seek(std::io::SeekFrom::End(0))
23153            .unwrap();
23154        request_value_reader
23155            .seek(std::io::SeekFrom::Start(0))
23156            .unwrap();
23157
23158        loop {
23159            let token = match self
23160                .hub
23161                .auth
23162                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23163                .await
23164            {
23165                Ok(token) => token,
23166                Err(e) => match dlg.token(e) {
23167                    Ok(token) => token,
23168                    Err(e) => {
23169                        dlg.finished(false);
23170                        return Err(common::Error::MissingToken(e));
23171                    }
23172                },
23173            };
23174            request_value_reader
23175                .seek(std::io::SeekFrom::Start(0))
23176                .unwrap();
23177            let mut req_result = {
23178                let client = &self.hub.client;
23179                dlg.pre_request();
23180                let mut req_builder = hyper::Request::builder()
23181                    .method(hyper::Method::POST)
23182                    .uri(url.as_str())
23183                    .header(USER_AGENT, self.hub._user_agent.clone());
23184
23185                if let Some(token) = token.as_ref() {
23186                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23187                }
23188
23189                let request = req_builder
23190                    .header(CONTENT_TYPE, json_mime_type.to_string())
23191                    .header(CONTENT_LENGTH, request_size as u64)
23192                    .body(common::to_body(
23193                        request_value_reader.get_ref().clone().into(),
23194                    ));
23195
23196                client.request(request.unwrap()).await
23197            };
23198
23199            match req_result {
23200                Err(err) => {
23201                    if let common::Retry::After(d) = dlg.http_error(&err) {
23202                        sleep(d).await;
23203                        continue;
23204                    }
23205                    dlg.finished(false);
23206                    return Err(common::Error::HttpError(err));
23207                }
23208                Ok(res) => {
23209                    let (mut parts, body) = res.into_parts();
23210                    let mut body = common::Body::new(body);
23211                    if !parts.status.is_success() {
23212                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23213                        let error = serde_json::from_str(&common::to_string(&bytes));
23214                        let response = common::to_response(parts, bytes.into());
23215
23216                        if let common::Retry::After(d) =
23217                            dlg.http_failure(&response, error.as_ref().ok())
23218                        {
23219                            sleep(d).await;
23220                            continue;
23221                        }
23222
23223                        dlg.finished(false);
23224
23225                        return Err(match error {
23226                            Ok(value) => common::Error::BadRequest(value),
23227                            _ => common::Error::Failure(response),
23228                        });
23229                    }
23230                    let response = {
23231                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23232                        let encoded = common::to_string(&bytes);
23233                        match serde_json::from_str(&encoded) {
23234                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23235                            Err(error) => {
23236                                dlg.response_json_decode_error(&encoded, &error);
23237                                return Err(common::Error::JsonDecodeError(
23238                                    encoded.to_string(),
23239                                    error,
23240                                ));
23241                            }
23242                        }
23243                    };
23244
23245                    dlg.finished(true);
23246                    return Ok(response);
23247                }
23248            }
23249        }
23250    }
23251
23252    ///
23253    /// Sets the *request* property to the given value.
23254    ///
23255    /// Even though the property as already been set when instantiating this call,
23256    /// we provide this method for API completeness.
23257    pub fn request(
23258        mut self,
23259        new_value: GoogleCloudChannelV1UnregisterSubscriberRequest,
23260    ) -> AccountUnregisterCall<'a, C> {
23261        self._request = new_value;
23262        self
23263    }
23264    /// Optional. Resource name of the account. Required if integrator is not provided. Otherwise, leave this field empty/unset.
23265    ///
23266    /// Sets the *account* path property to the given value.
23267    ///
23268    /// Even though the property as already been set when instantiating this call,
23269    /// we provide this method for API completeness.
23270    pub fn account(mut self, new_value: &str) -> AccountUnregisterCall<'a, C> {
23271        self._account = new_value.to_string();
23272        self
23273    }
23274    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23275    /// while executing the actual API request.
23276    ///
23277    /// ````text
23278    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23279    /// ````
23280    ///
23281    /// Sets the *delegate* property to the given value.
23282    pub fn delegate(
23283        mut self,
23284        new_value: &'a mut dyn common::Delegate,
23285    ) -> AccountUnregisterCall<'a, C> {
23286        self._delegate = Some(new_value);
23287        self
23288    }
23289
23290    /// Set any additional parameter of the query string used in the request.
23291    /// It should be used to set parameters which are not yet available through their own
23292    /// setters.
23293    ///
23294    /// Please note that this method must not be used to set any of the known parameters
23295    /// which have their own setter method. If done anyway, the request will fail.
23296    ///
23297    /// # Additional Parameters
23298    ///
23299    /// * *$.xgafv* (query-string) - V1 error format.
23300    /// * *access_token* (query-string) - OAuth access token.
23301    /// * *alt* (query-string) - Data format for response.
23302    /// * *callback* (query-string) - JSONP
23303    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23304    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23305    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23306    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23307    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23308    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23309    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23310    pub fn param<T>(mut self, name: T, value: T) -> AccountUnregisterCall<'a, C>
23311    where
23312        T: AsRef<str>,
23313    {
23314        self._additional_params
23315            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23316        self
23317    }
23318
23319    /// Identifies the authorization scope for the method you are building.
23320    ///
23321    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23322    /// [`Scope::AppOrder`].
23323    ///
23324    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23325    /// tokens for more than one scope.
23326    ///
23327    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23328    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23329    /// sufficient, a read-write scope will do as well.
23330    pub fn add_scope<St>(mut self, scope: St) -> AccountUnregisterCall<'a, C>
23331    where
23332        St: AsRef<str>,
23333    {
23334        self._scopes.insert(String::from(scope.as_ref()));
23335        self
23336    }
23337    /// Identifies the authorization scope(s) for the method you are building.
23338    ///
23339    /// See [`Self::add_scope()`] for details.
23340    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUnregisterCall<'a, C>
23341    where
23342        I: IntoIterator<Item = St>,
23343        St: AsRef<str>,
23344    {
23345        self._scopes
23346            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23347        self
23348    }
23349
23350    /// Removes all scopes, and no default scope will be used either.
23351    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23352    /// for details).
23353    pub fn clear_scopes(mut self) -> AccountUnregisterCall<'a, C> {
23354        self._scopes.clear();
23355        self
23356    }
23357}
23358
23359/// Lists service accounts with subscriber privileges on the Pub/Sub topic created for this Channel Services account or integrator. Possible error codes: * PERMISSION_DENIED: The reseller account making the request and the provided reseller account are different, or the impersonated user is not a super admin. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The topic resource doesn't exist. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: A list of service email addresses.
23360///
23361/// A builder for the *listSubscribers* method supported by a *integrator* resource.
23362/// It is not used directly, but through a [`IntegratorMethods`] instance.
23363///
23364/// # Example
23365///
23366/// Instantiate a resource method builder
23367///
23368/// ```test_harness,no_run
23369/// # extern crate hyper;
23370/// # extern crate hyper_rustls;
23371/// # extern crate google_cloudchannel1 as cloudchannel1;
23372/// # async fn dox() {
23373/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23374///
23375/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23376/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23377/// #     .with_native_roots()
23378/// #     .unwrap()
23379/// #     .https_only()
23380/// #     .enable_http2()
23381/// #     .build();
23382///
23383/// # let executor = hyper_util::rt::TokioExecutor::new();
23384/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23385/// #     secret,
23386/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23387/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23388/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23389/// #     ),
23390/// # ).build().await.unwrap();
23391///
23392/// # let client = hyper_util::client::legacy::Client::builder(
23393/// #     hyper_util::rt::TokioExecutor::new()
23394/// # )
23395/// # .build(
23396/// #     hyper_rustls::HttpsConnectorBuilder::new()
23397/// #         .with_native_roots()
23398/// #         .unwrap()
23399/// #         .https_or_http()
23400/// #         .enable_http2()
23401/// #         .build()
23402/// # );
23403/// # let mut hub = Cloudchannel::new(client, auth);
23404/// // You can configure optional parameters by calling the respective setters at will, and
23405/// // execute the final call using `doit()`.
23406/// // Values shown here are possibly random and not representative !
23407/// let result = hub.integrators().list_subscribers("integrator")
23408///              .page_token("diam")
23409///              .page_size(-19)
23410///              .account("dolores")
23411///              .doit().await;
23412/// # }
23413/// ```
23414pub struct IntegratorListSubscriberCall<'a, C>
23415where
23416    C: 'a,
23417{
23418    hub: &'a Cloudchannel<C>,
23419    _integrator: String,
23420    _page_token: Option<String>,
23421    _page_size: Option<i32>,
23422    _account: Option<String>,
23423    _delegate: Option<&'a mut dyn common::Delegate>,
23424    _additional_params: HashMap<String, String>,
23425    _scopes: BTreeSet<String>,
23426}
23427
23428impl<'a, C> common::CallBuilder for IntegratorListSubscriberCall<'a, C> {}
23429
23430impl<'a, C> IntegratorListSubscriberCall<'a, C>
23431where
23432    C: common::Connector,
23433{
23434    /// Perform the operation you have build so far.
23435    pub async fn doit(
23436        mut self,
23437    ) -> common::Result<(
23438        common::Response,
23439        GoogleCloudChannelV1ListSubscribersResponse,
23440    )> {
23441        use std::borrow::Cow;
23442        use std::io::{Read, Seek};
23443
23444        use common::{url::Params, ToParts};
23445        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23446
23447        let mut dd = common::DefaultDelegate;
23448        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23449        dlg.begin(common::MethodInfo {
23450            id: "cloudchannel.integrators.listSubscribers",
23451            http_method: hyper::Method::GET,
23452        });
23453
23454        for &field in ["alt", "integrator", "pageToken", "pageSize", "account"].iter() {
23455            if self._additional_params.contains_key(field) {
23456                dlg.finished(false);
23457                return Err(common::Error::FieldClash(field));
23458            }
23459        }
23460
23461        let mut params = Params::with_capacity(6 + self._additional_params.len());
23462        params.push("integrator", self._integrator);
23463        if let Some(value) = self._page_token.as_ref() {
23464            params.push("pageToken", value);
23465        }
23466        if let Some(value) = self._page_size.as_ref() {
23467            params.push("pageSize", value.to_string());
23468        }
23469        if let Some(value) = self._account.as_ref() {
23470            params.push("account", value);
23471        }
23472
23473        params.extend(self._additional_params.iter());
23474
23475        params.push("alt", "json");
23476        let mut url = self.hub._base_url.clone() + "v1/{+integrator}:listSubscribers";
23477        if self._scopes.is_empty() {
23478            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
23479        }
23480
23481        #[allow(clippy::single_element_loop)]
23482        for &(find_this, param_name) in [("{+integrator}", "integrator")].iter() {
23483            url = params.uri_replacement(url, param_name, find_this, true);
23484        }
23485        {
23486            let to_remove = ["integrator"];
23487            params.remove_params(&to_remove);
23488        }
23489
23490        let url = params.parse_with_url(&url);
23491
23492        loop {
23493            let token = match self
23494                .hub
23495                .auth
23496                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23497                .await
23498            {
23499                Ok(token) => token,
23500                Err(e) => match dlg.token(e) {
23501                    Ok(token) => token,
23502                    Err(e) => {
23503                        dlg.finished(false);
23504                        return Err(common::Error::MissingToken(e));
23505                    }
23506                },
23507            };
23508            let mut req_result = {
23509                let client = &self.hub.client;
23510                dlg.pre_request();
23511                let mut req_builder = hyper::Request::builder()
23512                    .method(hyper::Method::GET)
23513                    .uri(url.as_str())
23514                    .header(USER_AGENT, self.hub._user_agent.clone());
23515
23516                if let Some(token) = token.as_ref() {
23517                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23518                }
23519
23520                let request = req_builder
23521                    .header(CONTENT_LENGTH, 0_u64)
23522                    .body(common::to_body::<String>(None));
23523
23524                client.request(request.unwrap()).await
23525            };
23526
23527            match req_result {
23528                Err(err) => {
23529                    if let common::Retry::After(d) = dlg.http_error(&err) {
23530                        sleep(d).await;
23531                        continue;
23532                    }
23533                    dlg.finished(false);
23534                    return Err(common::Error::HttpError(err));
23535                }
23536                Ok(res) => {
23537                    let (mut parts, body) = res.into_parts();
23538                    let mut body = common::Body::new(body);
23539                    if !parts.status.is_success() {
23540                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23541                        let error = serde_json::from_str(&common::to_string(&bytes));
23542                        let response = common::to_response(parts, bytes.into());
23543
23544                        if let common::Retry::After(d) =
23545                            dlg.http_failure(&response, error.as_ref().ok())
23546                        {
23547                            sleep(d).await;
23548                            continue;
23549                        }
23550
23551                        dlg.finished(false);
23552
23553                        return Err(match error {
23554                            Ok(value) => common::Error::BadRequest(value),
23555                            _ => common::Error::Failure(response),
23556                        });
23557                    }
23558                    let response = {
23559                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23560                        let encoded = common::to_string(&bytes);
23561                        match serde_json::from_str(&encoded) {
23562                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23563                            Err(error) => {
23564                                dlg.response_json_decode_error(&encoded, &error);
23565                                return Err(common::Error::JsonDecodeError(
23566                                    encoded.to_string(),
23567                                    error,
23568                                ));
23569                            }
23570                        }
23571                    };
23572
23573                    dlg.finished(true);
23574                    return Ok(response);
23575                }
23576            }
23577        }
23578    }
23579
23580    /// Optional. Resource name of the integrator. Required if account is not provided. Otherwise, leave this field empty/unset.
23581    ///
23582    /// Sets the *integrator* path property to the given value.
23583    ///
23584    /// Even though the property as already been set when instantiating this call,
23585    /// we provide this method for API completeness.
23586    pub fn integrator(mut self, new_value: &str) -> IntegratorListSubscriberCall<'a, C> {
23587        self._integrator = new_value.to_string();
23588        self
23589    }
23590    /// Optional. A page token, received from a previous `ListSubscribers` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListSubscribers` must match the call that provided the page token.
23591    ///
23592    /// Sets the *page token* query property to the given value.
23593    pub fn page_token(mut self, new_value: &str) -> IntegratorListSubscriberCall<'a, C> {
23594        self._page_token = Some(new_value.to_string());
23595        self
23596    }
23597    /// Optional. The maximum number of service accounts to return. The service may return fewer than this value. If unspecified, returns at most 100 service accounts. The maximum value is 1000; the server will coerce values above 1000.
23598    ///
23599    /// Sets the *page size* query property to the given value.
23600    pub fn page_size(mut self, new_value: i32) -> IntegratorListSubscriberCall<'a, C> {
23601        self._page_size = Some(new_value);
23602        self
23603    }
23604    /// Optional. Resource name of the account. Required if integrator is not provided. Otherwise, leave this field empty/unset.
23605    ///
23606    /// Sets the *account* query property to the given value.
23607    pub fn account(mut self, new_value: &str) -> IntegratorListSubscriberCall<'a, C> {
23608        self._account = Some(new_value.to_string());
23609        self
23610    }
23611    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23612    /// while executing the actual API request.
23613    ///
23614    /// ````text
23615    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23616    /// ````
23617    ///
23618    /// Sets the *delegate* property to the given value.
23619    pub fn delegate(
23620        mut self,
23621        new_value: &'a mut dyn common::Delegate,
23622    ) -> IntegratorListSubscriberCall<'a, C> {
23623        self._delegate = Some(new_value);
23624        self
23625    }
23626
23627    /// Set any additional parameter of the query string used in the request.
23628    /// It should be used to set parameters which are not yet available through their own
23629    /// setters.
23630    ///
23631    /// Please note that this method must not be used to set any of the known parameters
23632    /// which have their own setter method. If done anyway, the request will fail.
23633    ///
23634    /// # Additional Parameters
23635    ///
23636    /// * *$.xgafv* (query-string) - V1 error format.
23637    /// * *access_token* (query-string) - OAuth access token.
23638    /// * *alt* (query-string) - Data format for response.
23639    /// * *callback* (query-string) - JSONP
23640    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23641    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23642    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23643    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23644    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23645    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23646    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23647    pub fn param<T>(mut self, name: T, value: T) -> IntegratorListSubscriberCall<'a, C>
23648    where
23649        T: AsRef<str>,
23650    {
23651        self._additional_params
23652            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23653        self
23654    }
23655
23656    /// Identifies the authorization scope for the method you are building.
23657    ///
23658    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23659    /// [`Scope::AppOrder`].
23660    ///
23661    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23662    /// tokens for more than one scope.
23663    ///
23664    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23665    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23666    /// sufficient, a read-write scope will do as well.
23667    pub fn add_scope<St>(mut self, scope: St) -> IntegratorListSubscriberCall<'a, C>
23668    where
23669        St: AsRef<str>,
23670    {
23671        self._scopes.insert(String::from(scope.as_ref()));
23672        self
23673    }
23674    /// Identifies the authorization scope(s) for the method you are building.
23675    ///
23676    /// See [`Self::add_scope()`] for details.
23677    pub fn add_scopes<I, St>(mut self, scopes: I) -> IntegratorListSubscriberCall<'a, C>
23678    where
23679        I: IntoIterator<Item = St>,
23680        St: AsRef<str>,
23681    {
23682        self._scopes
23683            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23684        self
23685    }
23686
23687    /// Removes all scopes, and no default scope will be used either.
23688    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23689    /// for details).
23690    pub fn clear_scopes(mut self) -> IntegratorListSubscriberCall<'a, C> {
23691        self._scopes.clear();
23692        self
23693    }
23694}
23695
23696/// Registers a service account with subscriber privileges on the Pub/Sub topic for this Channel Services account or integrator. After you create a subscriber, you get the events through SubscriberEvent Possible error codes: * PERMISSION_DENIED: The reseller account making the request and the provided reseller account are different, or the impersonated user is not a super admin. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The topic name with the registered service email address.
23697///
23698/// A builder for the *registerSubscriber* method supported by a *integrator* resource.
23699/// It is not used directly, but through a [`IntegratorMethods`] instance.
23700///
23701/// # Example
23702///
23703/// Instantiate a resource method builder
23704///
23705/// ```test_harness,no_run
23706/// # extern crate hyper;
23707/// # extern crate hyper_rustls;
23708/// # extern crate google_cloudchannel1 as cloudchannel1;
23709/// use cloudchannel1::api::GoogleCloudChannelV1RegisterSubscriberRequest;
23710/// # async fn dox() {
23711/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23712///
23713/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23714/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23715/// #     .with_native_roots()
23716/// #     .unwrap()
23717/// #     .https_only()
23718/// #     .enable_http2()
23719/// #     .build();
23720///
23721/// # let executor = hyper_util::rt::TokioExecutor::new();
23722/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23723/// #     secret,
23724/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23725/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23726/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23727/// #     ),
23728/// # ).build().await.unwrap();
23729///
23730/// # let client = hyper_util::client::legacy::Client::builder(
23731/// #     hyper_util::rt::TokioExecutor::new()
23732/// # )
23733/// # .build(
23734/// #     hyper_rustls::HttpsConnectorBuilder::new()
23735/// #         .with_native_roots()
23736/// #         .unwrap()
23737/// #         .https_or_http()
23738/// #         .enable_http2()
23739/// #         .build()
23740/// # );
23741/// # let mut hub = Cloudchannel::new(client, auth);
23742/// // As the method needs a request, you would usually fill it with the desired information
23743/// // into the respective structure. Some of the parts shown here might not be applicable !
23744/// // Values shown here are possibly random and not representative !
23745/// let mut req = GoogleCloudChannelV1RegisterSubscriberRequest::default();
23746///
23747/// // You can configure optional parameters by calling the respective setters at will, and
23748/// // execute the final call using `doit()`.
23749/// // Values shown here are possibly random and not representative !
23750/// let result = hub.integrators().register_subscriber(req, "integrator")
23751///              .doit().await;
23752/// # }
23753/// ```
23754pub struct IntegratorRegisterSubscriberCall<'a, C>
23755where
23756    C: 'a,
23757{
23758    hub: &'a Cloudchannel<C>,
23759    _request: GoogleCloudChannelV1RegisterSubscriberRequest,
23760    _integrator: String,
23761    _delegate: Option<&'a mut dyn common::Delegate>,
23762    _additional_params: HashMap<String, String>,
23763    _scopes: BTreeSet<String>,
23764}
23765
23766impl<'a, C> common::CallBuilder for IntegratorRegisterSubscriberCall<'a, C> {}
23767
23768impl<'a, C> IntegratorRegisterSubscriberCall<'a, C>
23769where
23770    C: common::Connector,
23771{
23772    /// Perform the operation you have build so far.
23773    pub async fn doit(
23774        mut self,
23775    ) -> common::Result<(
23776        common::Response,
23777        GoogleCloudChannelV1RegisterSubscriberResponse,
23778    )> {
23779        use std::borrow::Cow;
23780        use std::io::{Read, Seek};
23781
23782        use common::{url::Params, ToParts};
23783        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23784
23785        let mut dd = common::DefaultDelegate;
23786        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23787        dlg.begin(common::MethodInfo {
23788            id: "cloudchannel.integrators.registerSubscriber",
23789            http_method: hyper::Method::POST,
23790        });
23791
23792        for &field in ["alt", "integrator"].iter() {
23793            if self._additional_params.contains_key(field) {
23794                dlg.finished(false);
23795                return Err(common::Error::FieldClash(field));
23796            }
23797        }
23798
23799        let mut params = Params::with_capacity(4 + self._additional_params.len());
23800        params.push("integrator", self._integrator);
23801
23802        params.extend(self._additional_params.iter());
23803
23804        params.push("alt", "json");
23805        let mut url = self.hub._base_url.clone() + "v1/{+integrator}:registerSubscriber";
23806        if self._scopes.is_empty() {
23807            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
23808        }
23809
23810        #[allow(clippy::single_element_loop)]
23811        for &(find_this, param_name) in [("{+integrator}", "integrator")].iter() {
23812            url = params.uri_replacement(url, param_name, find_this, true);
23813        }
23814        {
23815            let to_remove = ["integrator"];
23816            params.remove_params(&to_remove);
23817        }
23818
23819        let url = params.parse_with_url(&url);
23820
23821        let mut json_mime_type = mime::APPLICATION_JSON;
23822        let mut request_value_reader = {
23823            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23824            common::remove_json_null_values(&mut value);
23825            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23826            serde_json::to_writer(&mut dst, &value).unwrap();
23827            dst
23828        };
23829        let request_size = request_value_reader
23830            .seek(std::io::SeekFrom::End(0))
23831            .unwrap();
23832        request_value_reader
23833            .seek(std::io::SeekFrom::Start(0))
23834            .unwrap();
23835
23836        loop {
23837            let token = match self
23838                .hub
23839                .auth
23840                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23841                .await
23842            {
23843                Ok(token) => token,
23844                Err(e) => match dlg.token(e) {
23845                    Ok(token) => token,
23846                    Err(e) => {
23847                        dlg.finished(false);
23848                        return Err(common::Error::MissingToken(e));
23849                    }
23850                },
23851            };
23852            request_value_reader
23853                .seek(std::io::SeekFrom::Start(0))
23854                .unwrap();
23855            let mut req_result = {
23856                let client = &self.hub.client;
23857                dlg.pre_request();
23858                let mut req_builder = hyper::Request::builder()
23859                    .method(hyper::Method::POST)
23860                    .uri(url.as_str())
23861                    .header(USER_AGENT, self.hub._user_agent.clone());
23862
23863                if let Some(token) = token.as_ref() {
23864                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23865                }
23866
23867                let request = req_builder
23868                    .header(CONTENT_TYPE, json_mime_type.to_string())
23869                    .header(CONTENT_LENGTH, request_size as u64)
23870                    .body(common::to_body(
23871                        request_value_reader.get_ref().clone().into(),
23872                    ));
23873
23874                client.request(request.unwrap()).await
23875            };
23876
23877            match req_result {
23878                Err(err) => {
23879                    if let common::Retry::After(d) = dlg.http_error(&err) {
23880                        sleep(d).await;
23881                        continue;
23882                    }
23883                    dlg.finished(false);
23884                    return Err(common::Error::HttpError(err));
23885                }
23886                Ok(res) => {
23887                    let (mut parts, body) = res.into_parts();
23888                    let mut body = common::Body::new(body);
23889                    if !parts.status.is_success() {
23890                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23891                        let error = serde_json::from_str(&common::to_string(&bytes));
23892                        let response = common::to_response(parts, bytes.into());
23893
23894                        if let common::Retry::After(d) =
23895                            dlg.http_failure(&response, error.as_ref().ok())
23896                        {
23897                            sleep(d).await;
23898                            continue;
23899                        }
23900
23901                        dlg.finished(false);
23902
23903                        return Err(match error {
23904                            Ok(value) => common::Error::BadRequest(value),
23905                            _ => common::Error::Failure(response),
23906                        });
23907                    }
23908                    let response = {
23909                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23910                        let encoded = common::to_string(&bytes);
23911                        match serde_json::from_str(&encoded) {
23912                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23913                            Err(error) => {
23914                                dlg.response_json_decode_error(&encoded, &error);
23915                                return Err(common::Error::JsonDecodeError(
23916                                    encoded.to_string(),
23917                                    error,
23918                                ));
23919                            }
23920                        }
23921                    };
23922
23923                    dlg.finished(true);
23924                    return Ok(response);
23925                }
23926            }
23927        }
23928    }
23929
23930    ///
23931    /// Sets the *request* property to the given value.
23932    ///
23933    /// Even though the property as already been set when instantiating this call,
23934    /// we provide this method for API completeness.
23935    pub fn request(
23936        mut self,
23937        new_value: GoogleCloudChannelV1RegisterSubscriberRequest,
23938    ) -> IntegratorRegisterSubscriberCall<'a, C> {
23939        self._request = new_value;
23940        self
23941    }
23942    /// Optional. Resource name of the integrator. Required if account is not provided. Otherwise, leave this field empty/unset.
23943    ///
23944    /// Sets the *integrator* path property to the given value.
23945    ///
23946    /// Even though the property as already been set when instantiating this call,
23947    /// we provide this method for API completeness.
23948    pub fn integrator(mut self, new_value: &str) -> IntegratorRegisterSubscriberCall<'a, C> {
23949        self._integrator = new_value.to_string();
23950        self
23951    }
23952    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23953    /// while executing the actual API request.
23954    ///
23955    /// ````text
23956    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23957    /// ````
23958    ///
23959    /// Sets the *delegate* property to the given value.
23960    pub fn delegate(
23961        mut self,
23962        new_value: &'a mut dyn common::Delegate,
23963    ) -> IntegratorRegisterSubscriberCall<'a, C> {
23964        self._delegate = Some(new_value);
23965        self
23966    }
23967
23968    /// Set any additional parameter of the query string used in the request.
23969    /// It should be used to set parameters which are not yet available through their own
23970    /// setters.
23971    ///
23972    /// Please note that this method must not be used to set any of the known parameters
23973    /// which have their own setter method. If done anyway, the request will fail.
23974    ///
23975    /// # Additional Parameters
23976    ///
23977    /// * *$.xgafv* (query-string) - V1 error format.
23978    /// * *access_token* (query-string) - OAuth access token.
23979    /// * *alt* (query-string) - Data format for response.
23980    /// * *callback* (query-string) - JSONP
23981    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23982    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23983    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23984    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23985    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23986    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23987    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23988    pub fn param<T>(mut self, name: T, value: T) -> IntegratorRegisterSubscriberCall<'a, C>
23989    where
23990        T: AsRef<str>,
23991    {
23992        self._additional_params
23993            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23994        self
23995    }
23996
23997    /// Identifies the authorization scope for the method you are building.
23998    ///
23999    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24000    /// [`Scope::AppOrder`].
24001    ///
24002    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24003    /// tokens for more than one scope.
24004    ///
24005    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24006    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24007    /// sufficient, a read-write scope will do as well.
24008    pub fn add_scope<St>(mut self, scope: St) -> IntegratorRegisterSubscriberCall<'a, C>
24009    where
24010        St: AsRef<str>,
24011    {
24012        self._scopes.insert(String::from(scope.as_ref()));
24013        self
24014    }
24015    /// Identifies the authorization scope(s) for the method you are building.
24016    ///
24017    /// See [`Self::add_scope()`] for details.
24018    pub fn add_scopes<I, St>(mut self, scopes: I) -> IntegratorRegisterSubscriberCall<'a, C>
24019    where
24020        I: IntoIterator<Item = St>,
24021        St: AsRef<str>,
24022    {
24023        self._scopes
24024            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24025        self
24026    }
24027
24028    /// Removes all scopes, and no default scope will be used either.
24029    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24030    /// for details).
24031    pub fn clear_scopes(mut self) -> IntegratorRegisterSubscriberCall<'a, C> {
24032        self._scopes.clear();
24033        self
24034    }
24035}
24036
24037/// Unregisters a service account with subscriber privileges on the Pub/Sub topic created for this Channel Services account or integrator. If there are no service accounts left with subscriber privileges, this deletes the topic. You can call ListSubscribers to check for these accounts. Possible error codes: * PERMISSION_DENIED: The reseller account making the request and the provided reseller account are different, or the impersonated user is not a super admin. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * NOT_FOUND: The topic resource doesn't exist. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The topic name that unregistered the service email address. Returns a success response if the service email address wasn't registered with the topic.
24038///
24039/// A builder for the *unregisterSubscriber* method supported by a *integrator* resource.
24040/// It is not used directly, but through a [`IntegratorMethods`] instance.
24041///
24042/// # Example
24043///
24044/// Instantiate a resource method builder
24045///
24046/// ```test_harness,no_run
24047/// # extern crate hyper;
24048/// # extern crate hyper_rustls;
24049/// # extern crate google_cloudchannel1 as cloudchannel1;
24050/// use cloudchannel1::api::GoogleCloudChannelV1UnregisterSubscriberRequest;
24051/// # async fn dox() {
24052/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24053///
24054/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24055/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24056/// #     .with_native_roots()
24057/// #     .unwrap()
24058/// #     .https_only()
24059/// #     .enable_http2()
24060/// #     .build();
24061///
24062/// # let executor = hyper_util::rt::TokioExecutor::new();
24063/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24064/// #     secret,
24065/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24066/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
24067/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
24068/// #     ),
24069/// # ).build().await.unwrap();
24070///
24071/// # let client = hyper_util::client::legacy::Client::builder(
24072/// #     hyper_util::rt::TokioExecutor::new()
24073/// # )
24074/// # .build(
24075/// #     hyper_rustls::HttpsConnectorBuilder::new()
24076/// #         .with_native_roots()
24077/// #         .unwrap()
24078/// #         .https_or_http()
24079/// #         .enable_http2()
24080/// #         .build()
24081/// # );
24082/// # let mut hub = Cloudchannel::new(client, auth);
24083/// // As the method needs a request, you would usually fill it with the desired information
24084/// // into the respective structure. Some of the parts shown here might not be applicable !
24085/// // Values shown here are possibly random and not representative !
24086/// let mut req = GoogleCloudChannelV1UnregisterSubscriberRequest::default();
24087///
24088/// // You can configure optional parameters by calling the respective setters at will, and
24089/// // execute the final call using `doit()`.
24090/// // Values shown here are possibly random and not representative !
24091/// let result = hub.integrators().unregister_subscriber(req, "integrator")
24092///              .doit().await;
24093/// # }
24094/// ```
24095pub struct IntegratorUnregisterSubscriberCall<'a, C>
24096where
24097    C: 'a,
24098{
24099    hub: &'a Cloudchannel<C>,
24100    _request: GoogleCloudChannelV1UnregisterSubscriberRequest,
24101    _integrator: String,
24102    _delegate: Option<&'a mut dyn common::Delegate>,
24103    _additional_params: HashMap<String, String>,
24104    _scopes: BTreeSet<String>,
24105}
24106
24107impl<'a, C> common::CallBuilder for IntegratorUnregisterSubscriberCall<'a, C> {}
24108
24109impl<'a, C> IntegratorUnregisterSubscriberCall<'a, C>
24110where
24111    C: common::Connector,
24112{
24113    /// Perform the operation you have build so far.
24114    pub async fn doit(
24115        mut self,
24116    ) -> common::Result<(
24117        common::Response,
24118        GoogleCloudChannelV1UnregisterSubscriberResponse,
24119    )> {
24120        use std::borrow::Cow;
24121        use std::io::{Read, Seek};
24122
24123        use common::{url::Params, ToParts};
24124        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24125
24126        let mut dd = common::DefaultDelegate;
24127        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24128        dlg.begin(common::MethodInfo {
24129            id: "cloudchannel.integrators.unregisterSubscriber",
24130            http_method: hyper::Method::POST,
24131        });
24132
24133        for &field in ["alt", "integrator"].iter() {
24134            if self._additional_params.contains_key(field) {
24135                dlg.finished(false);
24136                return Err(common::Error::FieldClash(field));
24137            }
24138        }
24139
24140        let mut params = Params::with_capacity(4 + self._additional_params.len());
24141        params.push("integrator", self._integrator);
24142
24143        params.extend(self._additional_params.iter());
24144
24145        params.push("alt", "json");
24146        let mut url = self.hub._base_url.clone() + "v1/{+integrator}:unregisterSubscriber";
24147        if self._scopes.is_empty() {
24148            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
24149        }
24150
24151        #[allow(clippy::single_element_loop)]
24152        for &(find_this, param_name) in [("{+integrator}", "integrator")].iter() {
24153            url = params.uri_replacement(url, param_name, find_this, true);
24154        }
24155        {
24156            let to_remove = ["integrator"];
24157            params.remove_params(&to_remove);
24158        }
24159
24160        let url = params.parse_with_url(&url);
24161
24162        let mut json_mime_type = mime::APPLICATION_JSON;
24163        let mut request_value_reader = {
24164            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24165            common::remove_json_null_values(&mut value);
24166            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24167            serde_json::to_writer(&mut dst, &value).unwrap();
24168            dst
24169        };
24170        let request_size = request_value_reader
24171            .seek(std::io::SeekFrom::End(0))
24172            .unwrap();
24173        request_value_reader
24174            .seek(std::io::SeekFrom::Start(0))
24175            .unwrap();
24176
24177        loop {
24178            let token = match self
24179                .hub
24180                .auth
24181                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24182                .await
24183            {
24184                Ok(token) => token,
24185                Err(e) => match dlg.token(e) {
24186                    Ok(token) => token,
24187                    Err(e) => {
24188                        dlg.finished(false);
24189                        return Err(common::Error::MissingToken(e));
24190                    }
24191                },
24192            };
24193            request_value_reader
24194                .seek(std::io::SeekFrom::Start(0))
24195                .unwrap();
24196            let mut req_result = {
24197                let client = &self.hub.client;
24198                dlg.pre_request();
24199                let mut req_builder = hyper::Request::builder()
24200                    .method(hyper::Method::POST)
24201                    .uri(url.as_str())
24202                    .header(USER_AGENT, self.hub._user_agent.clone());
24203
24204                if let Some(token) = token.as_ref() {
24205                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24206                }
24207
24208                let request = req_builder
24209                    .header(CONTENT_TYPE, json_mime_type.to_string())
24210                    .header(CONTENT_LENGTH, request_size as u64)
24211                    .body(common::to_body(
24212                        request_value_reader.get_ref().clone().into(),
24213                    ));
24214
24215                client.request(request.unwrap()).await
24216            };
24217
24218            match req_result {
24219                Err(err) => {
24220                    if let common::Retry::After(d) = dlg.http_error(&err) {
24221                        sleep(d).await;
24222                        continue;
24223                    }
24224                    dlg.finished(false);
24225                    return Err(common::Error::HttpError(err));
24226                }
24227                Ok(res) => {
24228                    let (mut parts, body) = res.into_parts();
24229                    let mut body = common::Body::new(body);
24230                    if !parts.status.is_success() {
24231                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24232                        let error = serde_json::from_str(&common::to_string(&bytes));
24233                        let response = common::to_response(parts, bytes.into());
24234
24235                        if let common::Retry::After(d) =
24236                            dlg.http_failure(&response, error.as_ref().ok())
24237                        {
24238                            sleep(d).await;
24239                            continue;
24240                        }
24241
24242                        dlg.finished(false);
24243
24244                        return Err(match error {
24245                            Ok(value) => common::Error::BadRequest(value),
24246                            _ => common::Error::Failure(response),
24247                        });
24248                    }
24249                    let response = {
24250                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24251                        let encoded = common::to_string(&bytes);
24252                        match serde_json::from_str(&encoded) {
24253                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24254                            Err(error) => {
24255                                dlg.response_json_decode_error(&encoded, &error);
24256                                return Err(common::Error::JsonDecodeError(
24257                                    encoded.to_string(),
24258                                    error,
24259                                ));
24260                            }
24261                        }
24262                    };
24263
24264                    dlg.finished(true);
24265                    return Ok(response);
24266                }
24267            }
24268        }
24269    }
24270
24271    ///
24272    /// Sets the *request* property to the given value.
24273    ///
24274    /// Even though the property as already been set when instantiating this call,
24275    /// we provide this method for API completeness.
24276    pub fn request(
24277        mut self,
24278        new_value: GoogleCloudChannelV1UnregisterSubscriberRequest,
24279    ) -> IntegratorUnregisterSubscriberCall<'a, C> {
24280        self._request = new_value;
24281        self
24282    }
24283    /// Optional. Resource name of the integrator. Required if account is not provided. Otherwise, leave this field empty/unset.
24284    ///
24285    /// Sets the *integrator* path property to the given value.
24286    ///
24287    /// Even though the property as already been set when instantiating this call,
24288    /// we provide this method for API completeness.
24289    pub fn integrator(mut self, new_value: &str) -> IntegratorUnregisterSubscriberCall<'a, C> {
24290        self._integrator = new_value.to_string();
24291        self
24292    }
24293    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24294    /// while executing the actual API request.
24295    ///
24296    /// ````text
24297    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24298    /// ````
24299    ///
24300    /// Sets the *delegate* property to the given value.
24301    pub fn delegate(
24302        mut self,
24303        new_value: &'a mut dyn common::Delegate,
24304    ) -> IntegratorUnregisterSubscriberCall<'a, C> {
24305        self._delegate = Some(new_value);
24306        self
24307    }
24308
24309    /// Set any additional parameter of the query string used in the request.
24310    /// It should be used to set parameters which are not yet available through their own
24311    /// setters.
24312    ///
24313    /// Please note that this method must not be used to set any of the known parameters
24314    /// which have their own setter method. If done anyway, the request will fail.
24315    ///
24316    /// # Additional Parameters
24317    ///
24318    /// * *$.xgafv* (query-string) - V1 error format.
24319    /// * *access_token* (query-string) - OAuth access token.
24320    /// * *alt* (query-string) - Data format for response.
24321    /// * *callback* (query-string) - JSONP
24322    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24323    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24324    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24325    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24326    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24327    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24328    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24329    pub fn param<T>(mut self, name: T, value: T) -> IntegratorUnregisterSubscriberCall<'a, C>
24330    where
24331        T: AsRef<str>,
24332    {
24333        self._additional_params
24334            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24335        self
24336    }
24337
24338    /// Identifies the authorization scope for the method you are building.
24339    ///
24340    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24341    /// [`Scope::AppOrder`].
24342    ///
24343    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24344    /// tokens for more than one scope.
24345    ///
24346    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24347    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24348    /// sufficient, a read-write scope will do as well.
24349    pub fn add_scope<St>(mut self, scope: St) -> IntegratorUnregisterSubscriberCall<'a, C>
24350    where
24351        St: AsRef<str>,
24352    {
24353        self._scopes.insert(String::from(scope.as_ref()));
24354        self
24355    }
24356    /// Identifies the authorization scope(s) for the method you are building.
24357    ///
24358    /// See [`Self::add_scope()`] for details.
24359    pub fn add_scopes<I, St>(mut self, scopes: I) -> IntegratorUnregisterSubscriberCall<'a, C>
24360    where
24361        I: IntoIterator<Item = St>,
24362        St: AsRef<str>,
24363    {
24364        self._scopes
24365            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24366        self
24367    }
24368
24369    /// Removes all scopes, and no default scope will be used either.
24370    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24371    /// for details).
24372    pub fn clear_scopes(mut self) -> IntegratorUnregisterSubscriberCall<'a, C> {
24373        self._scopes.clear();
24374        self
24375    }
24376}
24377
24378/// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of `1`, corresponding to `Code.CANCELLED`.
24379///
24380/// A builder for the *cancel* method supported by a *operation* resource.
24381/// It is not used directly, but through a [`OperationMethods`] instance.
24382///
24383/// # Example
24384///
24385/// Instantiate a resource method builder
24386///
24387/// ```test_harness,no_run
24388/// # extern crate hyper;
24389/// # extern crate hyper_rustls;
24390/// # extern crate google_cloudchannel1 as cloudchannel1;
24391/// use cloudchannel1::api::GoogleLongrunningCancelOperationRequest;
24392/// # async fn dox() {
24393/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24394///
24395/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24396/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24397/// #     .with_native_roots()
24398/// #     .unwrap()
24399/// #     .https_only()
24400/// #     .enable_http2()
24401/// #     .build();
24402///
24403/// # let executor = hyper_util::rt::TokioExecutor::new();
24404/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24405/// #     secret,
24406/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24407/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
24408/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
24409/// #     ),
24410/// # ).build().await.unwrap();
24411///
24412/// # let client = hyper_util::client::legacy::Client::builder(
24413/// #     hyper_util::rt::TokioExecutor::new()
24414/// # )
24415/// # .build(
24416/// #     hyper_rustls::HttpsConnectorBuilder::new()
24417/// #         .with_native_roots()
24418/// #         .unwrap()
24419/// #         .https_or_http()
24420/// #         .enable_http2()
24421/// #         .build()
24422/// # );
24423/// # let mut hub = Cloudchannel::new(client, auth);
24424/// // As the method needs a request, you would usually fill it with the desired information
24425/// // into the respective structure. Some of the parts shown here might not be applicable !
24426/// // Values shown here are possibly random and not representative !
24427/// let mut req = GoogleLongrunningCancelOperationRequest::default();
24428///
24429/// // You can configure optional parameters by calling the respective setters at will, and
24430/// // execute the final call using `doit()`.
24431/// // Values shown here are possibly random and not representative !
24432/// let result = hub.operations().cancel(req, "name")
24433///              .doit().await;
24434/// # }
24435/// ```
24436pub struct OperationCancelCall<'a, C>
24437where
24438    C: 'a,
24439{
24440    hub: &'a Cloudchannel<C>,
24441    _request: GoogleLongrunningCancelOperationRequest,
24442    _name: String,
24443    _delegate: Option<&'a mut dyn common::Delegate>,
24444    _additional_params: HashMap<String, String>,
24445    _scopes: BTreeSet<String>,
24446}
24447
24448impl<'a, C> common::CallBuilder for OperationCancelCall<'a, C> {}
24449
24450impl<'a, C> OperationCancelCall<'a, C>
24451where
24452    C: common::Connector,
24453{
24454    /// Perform the operation you have build so far.
24455    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleProtobufEmpty)> {
24456        use std::borrow::Cow;
24457        use std::io::{Read, Seek};
24458
24459        use common::{url::Params, ToParts};
24460        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24461
24462        let mut dd = common::DefaultDelegate;
24463        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24464        dlg.begin(common::MethodInfo {
24465            id: "cloudchannel.operations.cancel",
24466            http_method: hyper::Method::POST,
24467        });
24468
24469        for &field in ["alt", "name"].iter() {
24470            if self._additional_params.contains_key(field) {
24471                dlg.finished(false);
24472                return Err(common::Error::FieldClash(field));
24473            }
24474        }
24475
24476        let mut params = Params::with_capacity(4 + self._additional_params.len());
24477        params.push("name", self._name);
24478
24479        params.extend(self._additional_params.iter());
24480
24481        params.push("alt", "json");
24482        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
24483        if self._scopes.is_empty() {
24484            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
24485        }
24486
24487        #[allow(clippy::single_element_loop)]
24488        for &(find_this, param_name) in [("{+name}", "name")].iter() {
24489            url = params.uri_replacement(url, param_name, find_this, true);
24490        }
24491        {
24492            let to_remove = ["name"];
24493            params.remove_params(&to_remove);
24494        }
24495
24496        let url = params.parse_with_url(&url);
24497
24498        let mut json_mime_type = mime::APPLICATION_JSON;
24499        let mut request_value_reader = {
24500            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24501            common::remove_json_null_values(&mut value);
24502            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24503            serde_json::to_writer(&mut dst, &value).unwrap();
24504            dst
24505        };
24506        let request_size = request_value_reader
24507            .seek(std::io::SeekFrom::End(0))
24508            .unwrap();
24509        request_value_reader
24510            .seek(std::io::SeekFrom::Start(0))
24511            .unwrap();
24512
24513        loop {
24514            let token = match self
24515                .hub
24516                .auth
24517                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24518                .await
24519            {
24520                Ok(token) => token,
24521                Err(e) => match dlg.token(e) {
24522                    Ok(token) => token,
24523                    Err(e) => {
24524                        dlg.finished(false);
24525                        return Err(common::Error::MissingToken(e));
24526                    }
24527                },
24528            };
24529            request_value_reader
24530                .seek(std::io::SeekFrom::Start(0))
24531                .unwrap();
24532            let mut req_result = {
24533                let client = &self.hub.client;
24534                dlg.pre_request();
24535                let mut req_builder = hyper::Request::builder()
24536                    .method(hyper::Method::POST)
24537                    .uri(url.as_str())
24538                    .header(USER_AGENT, self.hub._user_agent.clone());
24539
24540                if let Some(token) = token.as_ref() {
24541                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24542                }
24543
24544                let request = req_builder
24545                    .header(CONTENT_TYPE, json_mime_type.to_string())
24546                    .header(CONTENT_LENGTH, request_size as u64)
24547                    .body(common::to_body(
24548                        request_value_reader.get_ref().clone().into(),
24549                    ));
24550
24551                client.request(request.unwrap()).await
24552            };
24553
24554            match req_result {
24555                Err(err) => {
24556                    if let common::Retry::After(d) = dlg.http_error(&err) {
24557                        sleep(d).await;
24558                        continue;
24559                    }
24560                    dlg.finished(false);
24561                    return Err(common::Error::HttpError(err));
24562                }
24563                Ok(res) => {
24564                    let (mut parts, body) = res.into_parts();
24565                    let mut body = common::Body::new(body);
24566                    if !parts.status.is_success() {
24567                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24568                        let error = serde_json::from_str(&common::to_string(&bytes));
24569                        let response = common::to_response(parts, bytes.into());
24570
24571                        if let common::Retry::After(d) =
24572                            dlg.http_failure(&response, error.as_ref().ok())
24573                        {
24574                            sleep(d).await;
24575                            continue;
24576                        }
24577
24578                        dlg.finished(false);
24579
24580                        return Err(match error {
24581                            Ok(value) => common::Error::BadRequest(value),
24582                            _ => common::Error::Failure(response),
24583                        });
24584                    }
24585                    let response = {
24586                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24587                        let encoded = common::to_string(&bytes);
24588                        match serde_json::from_str(&encoded) {
24589                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24590                            Err(error) => {
24591                                dlg.response_json_decode_error(&encoded, &error);
24592                                return Err(common::Error::JsonDecodeError(
24593                                    encoded.to_string(),
24594                                    error,
24595                                ));
24596                            }
24597                        }
24598                    };
24599
24600                    dlg.finished(true);
24601                    return Ok(response);
24602                }
24603            }
24604        }
24605    }
24606
24607    ///
24608    /// Sets the *request* property to the given value.
24609    ///
24610    /// Even though the property as already been set when instantiating this call,
24611    /// we provide this method for API completeness.
24612    pub fn request(
24613        mut self,
24614        new_value: GoogleLongrunningCancelOperationRequest,
24615    ) -> OperationCancelCall<'a, C> {
24616        self._request = new_value;
24617        self
24618    }
24619    /// The name of the operation resource to be cancelled.
24620    ///
24621    /// Sets the *name* path property to the given value.
24622    ///
24623    /// Even though the property as already been set when instantiating this call,
24624    /// we provide this method for API completeness.
24625    pub fn name(mut self, new_value: &str) -> OperationCancelCall<'a, C> {
24626        self._name = new_value.to_string();
24627        self
24628    }
24629    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24630    /// while executing the actual API request.
24631    ///
24632    /// ````text
24633    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24634    /// ````
24635    ///
24636    /// Sets the *delegate* property to the given value.
24637    pub fn delegate(
24638        mut self,
24639        new_value: &'a mut dyn common::Delegate,
24640    ) -> OperationCancelCall<'a, C> {
24641        self._delegate = Some(new_value);
24642        self
24643    }
24644
24645    /// Set any additional parameter of the query string used in the request.
24646    /// It should be used to set parameters which are not yet available through their own
24647    /// setters.
24648    ///
24649    /// Please note that this method must not be used to set any of the known parameters
24650    /// which have their own setter method. If done anyway, the request will fail.
24651    ///
24652    /// # Additional Parameters
24653    ///
24654    /// * *$.xgafv* (query-string) - V1 error format.
24655    /// * *access_token* (query-string) - OAuth access token.
24656    /// * *alt* (query-string) - Data format for response.
24657    /// * *callback* (query-string) - JSONP
24658    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24659    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24660    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24661    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24662    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24663    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24664    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24665    pub fn param<T>(mut self, name: T, value: T) -> OperationCancelCall<'a, C>
24666    where
24667        T: AsRef<str>,
24668    {
24669        self._additional_params
24670            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24671        self
24672    }
24673
24674    /// Identifies the authorization scope for the method you are building.
24675    ///
24676    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24677    /// [`Scope::AppOrder`].
24678    ///
24679    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24680    /// tokens for more than one scope.
24681    ///
24682    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24683    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24684    /// sufficient, a read-write scope will do as well.
24685    pub fn add_scope<St>(mut self, scope: St) -> OperationCancelCall<'a, C>
24686    where
24687        St: AsRef<str>,
24688    {
24689        self._scopes.insert(String::from(scope.as_ref()));
24690        self
24691    }
24692    /// Identifies the authorization scope(s) for the method you are building.
24693    ///
24694    /// See [`Self::add_scope()`] for details.
24695    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationCancelCall<'a, C>
24696    where
24697        I: IntoIterator<Item = St>,
24698        St: AsRef<str>,
24699    {
24700        self._scopes
24701            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24702        self
24703    }
24704
24705    /// Removes all scopes, and no default scope will be used either.
24706    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24707    /// for details).
24708    pub fn clear_scopes(mut self) -> OperationCancelCall<'a, C> {
24709        self._scopes.clear();
24710        self
24711    }
24712}
24713
24714/// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
24715///
24716/// A builder for the *delete* method supported by a *operation* resource.
24717/// It is not used directly, but through a [`OperationMethods`] instance.
24718///
24719/// # Example
24720///
24721/// Instantiate a resource method builder
24722///
24723/// ```test_harness,no_run
24724/// # extern crate hyper;
24725/// # extern crate hyper_rustls;
24726/// # extern crate google_cloudchannel1 as cloudchannel1;
24727/// # async fn dox() {
24728/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24729///
24730/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24731/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24732/// #     .with_native_roots()
24733/// #     .unwrap()
24734/// #     .https_only()
24735/// #     .enable_http2()
24736/// #     .build();
24737///
24738/// # let executor = hyper_util::rt::TokioExecutor::new();
24739/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24740/// #     secret,
24741/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24742/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
24743/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
24744/// #     ),
24745/// # ).build().await.unwrap();
24746///
24747/// # let client = hyper_util::client::legacy::Client::builder(
24748/// #     hyper_util::rt::TokioExecutor::new()
24749/// # )
24750/// # .build(
24751/// #     hyper_rustls::HttpsConnectorBuilder::new()
24752/// #         .with_native_roots()
24753/// #         .unwrap()
24754/// #         .https_or_http()
24755/// #         .enable_http2()
24756/// #         .build()
24757/// # );
24758/// # let mut hub = Cloudchannel::new(client, auth);
24759/// // You can configure optional parameters by calling the respective setters at will, and
24760/// // execute the final call using `doit()`.
24761/// // Values shown here are possibly random and not representative !
24762/// let result = hub.operations().delete("name")
24763///              .doit().await;
24764/// # }
24765/// ```
24766pub struct OperationDeleteCall<'a, C>
24767where
24768    C: 'a,
24769{
24770    hub: &'a Cloudchannel<C>,
24771    _name: String,
24772    _delegate: Option<&'a mut dyn common::Delegate>,
24773    _additional_params: HashMap<String, String>,
24774    _scopes: BTreeSet<String>,
24775}
24776
24777impl<'a, C> common::CallBuilder for OperationDeleteCall<'a, C> {}
24778
24779impl<'a, C> OperationDeleteCall<'a, C>
24780where
24781    C: common::Connector,
24782{
24783    /// Perform the operation you have build so far.
24784    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleProtobufEmpty)> {
24785        use std::borrow::Cow;
24786        use std::io::{Read, Seek};
24787
24788        use common::{url::Params, ToParts};
24789        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24790
24791        let mut dd = common::DefaultDelegate;
24792        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24793        dlg.begin(common::MethodInfo {
24794            id: "cloudchannel.operations.delete",
24795            http_method: hyper::Method::DELETE,
24796        });
24797
24798        for &field in ["alt", "name"].iter() {
24799            if self._additional_params.contains_key(field) {
24800                dlg.finished(false);
24801                return Err(common::Error::FieldClash(field));
24802            }
24803        }
24804
24805        let mut params = Params::with_capacity(3 + self._additional_params.len());
24806        params.push("name", self._name);
24807
24808        params.extend(self._additional_params.iter());
24809
24810        params.push("alt", "json");
24811        let mut url = self.hub._base_url.clone() + "v1/{+name}";
24812        if self._scopes.is_empty() {
24813            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
24814        }
24815
24816        #[allow(clippy::single_element_loop)]
24817        for &(find_this, param_name) in [("{+name}", "name")].iter() {
24818            url = params.uri_replacement(url, param_name, find_this, true);
24819        }
24820        {
24821            let to_remove = ["name"];
24822            params.remove_params(&to_remove);
24823        }
24824
24825        let url = params.parse_with_url(&url);
24826
24827        loop {
24828            let token = match self
24829                .hub
24830                .auth
24831                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24832                .await
24833            {
24834                Ok(token) => token,
24835                Err(e) => match dlg.token(e) {
24836                    Ok(token) => token,
24837                    Err(e) => {
24838                        dlg.finished(false);
24839                        return Err(common::Error::MissingToken(e));
24840                    }
24841                },
24842            };
24843            let mut req_result = {
24844                let client = &self.hub.client;
24845                dlg.pre_request();
24846                let mut req_builder = hyper::Request::builder()
24847                    .method(hyper::Method::DELETE)
24848                    .uri(url.as_str())
24849                    .header(USER_AGENT, self.hub._user_agent.clone());
24850
24851                if let Some(token) = token.as_ref() {
24852                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24853                }
24854
24855                let request = req_builder
24856                    .header(CONTENT_LENGTH, 0_u64)
24857                    .body(common::to_body::<String>(None));
24858
24859                client.request(request.unwrap()).await
24860            };
24861
24862            match req_result {
24863                Err(err) => {
24864                    if let common::Retry::After(d) = dlg.http_error(&err) {
24865                        sleep(d).await;
24866                        continue;
24867                    }
24868                    dlg.finished(false);
24869                    return Err(common::Error::HttpError(err));
24870                }
24871                Ok(res) => {
24872                    let (mut parts, body) = res.into_parts();
24873                    let mut body = common::Body::new(body);
24874                    if !parts.status.is_success() {
24875                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24876                        let error = serde_json::from_str(&common::to_string(&bytes));
24877                        let response = common::to_response(parts, bytes.into());
24878
24879                        if let common::Retry::After(d) =
24880                            dlg.http_failure(&response, error.as_ref().ok())
24881                        {
24882                            sleep(d).await;
24883                            continue;
24884                        }
24885
24886                        dlg.finished(false);
24887
24888                        return Err(match error {
24889                            Ok(value) => common::Error::BadRequest(value),
24890                            _ => common::Error::Failure(response),
24891                        });
24892                    }
24893                    let response = {
24894                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24895                        let encoded = common::to_string(&bytes);
24896                        match serde_json::from_str(&encoded) {
24897                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24898                            Err(error) => {
24899                                dlg.response_json_decode_error(&encoded, &error);
24900                                return Err(common::Error::JsonDecodeError(
24901                                    encoded.to_string(),
24902                                    error,
24903                                ));
24904                            }
24905                        }
24906                    };
24907
24908                    dlg.finished(true);
24909                    return Ok(response);
24910                }
24911            }
24912        }
24913    }
24914
24915    /// The name of the operation resource to be deleted.
24916    ///
24917    /// Sets the *name* path property to the given value.
24918    ///
24919    /// Even though the property as already been set when instantiating this call,
24920    /// we provide this method for API completeness.
24921    pub fn name(mut self, new_value: &str) -> OperationDeleteCall<'a, C> {
24922        self._name = new_value.to_string();
24923        self
24924    }
24925    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24926    /// while executing the actual API request.
24927    ///
24928    /// ````text
24929    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24930    /// ````
24931    ///
24932    /// Sets the *delegate* property to the given value.
24933    pub fn delegate(
24934        mut self,
24935        new_value: &'a mut dyn common::Delegate,
24936    ) -> OperationDeleteCall<'a, C> {
24937        self._delegate = Some(new_value);
24938        self
24939    }
24940
24941    /// Set any additional parameter of the query string used in the request.
24942    /// It should be used to set parameters which are not yet available through their own
24943    /// setters.
24944    ///
24945    /// Please note that this method must not be used to set any of the known parameters
24946    /// which have their own setter method. If done anyway, the request will fail.
24947    ///
24948    /// # Additional Parameters
24949    ///
24950    /// * *$.xgafv* (query-string) - V1 error format.
24951    /// * *access_token* (query-string) - OAuth access token.
24952    /// * *alt* (query-string) - Data format for response.
24953    /// * *callback* (query-string) - JSONP
24954    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24955    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24956    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24957    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24958    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24959    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24960    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24961    pub fn param<T>(mut self, name: T, value: T) -> OperationDeleteCall<'a, C>
24962    where
24963        T: AsRef<str>,
24964    {
24965        self._additional_params
24966            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24967        self
24968    }
24969
24970    /// Identifies the authorization scope for the method you are building.
24971    ///
24972    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24973    /// [`Scope::AppOrder`].
24974    ///
24975    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24976    /// tokens for more than one scope.
24977    ///
24978    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24979    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24980    /// sufficient, a read-write scope will do as well.
24981    pub fn add_scope<St>(mut self, scope: St) -> OperationDeleteCall<'a, C>
24982    where
24983        St: AsRef<str>,
24984    {
24985        self._scopes.insert(String::from(scope.as_ref()));
24986        self
24987    }
24988    /// Identifies the authorization scope(s) for the method you are building.
24989    ///
24990    /// See [`Self::add_scope()`] for details.
24991    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationDeleteCall<'a, C>
24992    where
24993        I: IntoIterator<Item = St>,
24994        St: AsRef<str>,
24995    {
24996        self._scopes
24997            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24998        self
24999    }
25000
25001    /// Removes all scopes, and no default scope will be used either.
25002    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25003    /// for details).
25004    pub fn clear_scopes(mut self) -> OperationDeleteCall<'a, C> {
25005        self._scopes.clear();
25006        self
25007    }
25008}
25009
25010/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
25011///
25012/// A builder for the *get* method supported by a *operation* resource.
25013/// It is not used directly, but through a [`OperationMethods`] instance.
25014///
25015/// # Example
25016///
25017/// Instantiate a resource method builder
25018///
25019/// ```test_harness,no_run
25020/// # extern crate hyper;
25021/// # extern crate hyper_rustls;
25022/// # extern crate google_cloudchannel1 as cloudchannel1;
25023/// # async fn dox() {
25024/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25025///
25026/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25027/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25028/// #     .with_native_roots()
25029/// #     .unwrap()
25030/// #     .https_only()
25031/// #     .enable_http2()
25032/// #     .build();
25033///
25034/// # let executor = hyper_util::rt::TokioExecutor::new();
25035/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25036/// #     secret,
25037/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25038/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
25039/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
25040/// #     ),
25041/// # ).build().await.unwrap();
25042///
25043/// # let client = hyper_util::client::legacy::Client::builder(
25044/// #     hyper_util::rt::TokioExecutor::new()
25045/// # )
25046/// # .build(
25047/// #     hyper_rustls::HttpsConnectorBuilder::new()
25048/// #         .with_native_roots()
25049/// #         .unwrap()
25050/// #         .https_or_http()
25051/// #         .enable_http2()
25052/// #         .build()
25053/// # );
25054/// # let mut hub = Cloudchannel::new(client, auth);
25055/// // You can configure optional parameters by calling the respective setters at will, and
25056/// // execute the final call using `doit()`.
25057/// // Values shown here are possibly random and not representative !
25058/// let result = hub.operations().get("name")
25059///              .doit().await;
25060/// # }
25061/// ```
25062pub struct OperationGetCall<'a, C>
25063where
25064    C: 'a,
25065{
25066    hub: &'a Cloudchannel<C>,
25067    _name: String,
25068    _delegate: Option<&'a mut dyn common::Delegate>,
25069    _additional_params: HashMap<String, String>,
25070    _scopes: BTreeSet<String>,
25071}
25072
25073impl<'a, C> common::CallBuilder for OperationGetCall<'a, C> {}
25074
25075impl<'a, C> OperationGetCall<'a, C>
25076where
25077    C: common::Connector,
25078{
25079    /// Perform the operation you have build so far.
25080    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
25081        use std::borrow::Cow;
25082        use std::io::{Read, Seek};
25083
25084        use common::{url::Params, ToParts};
25085        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25086
25087        let mut dd = common::DefaultDelegate;
25088        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25089        dlg.begin(common::MethodInfo {
25090            id: "cloudchannel.operations.get",
25091            http_method: hyper::Method::GET,
25092        });
25093
25094        for &field in ["alt", "name"].iter() {
25095            if self._additional_params.contains_key(field) {
25096                dlg.finished(false);
25097                return Err(common::Error::FieldClash(field));
25098            }
25099        }
25100
25101        let mut params = Params::with_capacity(3 + self._additional_params.len());
25102        params.push("name", self._name);
25103
25104        params.extend(self._additional_params.iter());
25105
25106        params.push("alt", "json");
25107        let mut url = self.hub._base_url.clone() + "v1/{+name}";
25108        if self._scopes.is_empty() {
25109            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
25110        }
25111
25112        #[allow(clippy::single_element_loop)]
25113        for &(find_this, param_name) in [("{+name}", "name")].iter() {
25114            url = params.uri_replacement(url, param_name, find_this, true);
25115        }
25116        {
25117            let to_remove = ["name"];
25118            params.remove_params(&to_remove);
25119        }
25120
25121        let url = params.parse_with_url(&url);
25122
25123        loop {
25124            let token = match self
25125                .hub
25126                .auth
25127                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25128                .await
25129            {
25130                Ok(token) => token,
25131                Err(e) => match dlg.token(e) {
25132                    Ok(token) => token,
25133                    Err(e) => {
25134                        dlg.finished(false);
25135                        return Err(common::Error::MissingToken(e));
25136                    }
25137                },
25138            };
25139            let mut req_result = {
25140                let client = &self.hub.client;
25141                dlg.pre_request();
25142                let mut req_builder = hyper::Request::builder()
25143                    .method(hyper::Method::GET)
25144                    .uri(url.as_str())
25145                    .header(USER_AGENT, self.hub._user_agent.clone());
25146
25147                if let Some(token) = token.as_ref() {
25148                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25149                }
25150
25151                let request = req_builder
25152                    .header(CONTENT_LENGTH, 0_u64)
25153                    .body(common::to_body::<String>(None));
25154
25155                client.request(request.unwrap()).await
25156            };
25157
25158            match req_result {
25159                Err(err) => {
25160                    if let common::Retry::After(d) = dlg.http_error(&err) {
25161                        sleep(d).await;
25162                        continue;
25163                    }
25164                    dlg.finished(false);
25165                    return Err(common::Error::HttpError(err));
25166                }
25167                Ok(res) => {
25168                    let (mut parts, body) = res.into_parts();
25169                    let mut body = common::Body::new(body);
25170                    if !parts.status.is_success() {
25171                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25172                        let error = serde_json::from_str(&common::to_string(&bytes));
25173                        let response = common::to_response(parts, bytes.into());
25174
25175                        if let common::Retry::After(d) =
25176                            dlg.http_failure(&response, error.as_ref().ok())
25177                        {
25178                            sleep(d).await;
25179                            continue;
25180                        }
25181
25182                        dlg.finished(false);
25183
25184                        return Err(match error {
25185                            Ok(value) => common::Error::BadRequest(value),
25186                            _ => common::Error::Failure(response),
25187                        });
25188                    }
25189                    let response = {
25190                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25191                        let encoded = common::to_string(&bytes);
25192                        match serde_json::from_str(&encoded) {
25193                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25194                            Err(error) => {
25195                                dlg.response_json_decode_error(&encoded, &error);
25196                                return Err(common::Error::JsonDecodeError(
25197                                    encoded.to_string(),
25198                                    error,
25199                                ));
25200                            }
25201                        }
25202                    };
25203
25204                    dlg.finished(true);
25205                    return Ok(response);
25206                }
25207            }
25208        }
25209    }
25210
25211    /// The name of the operation resource.
25212    ///
25213    /// Sets the *name* path property to the given value.
25214    ///
25215    /// Even though the property as already been set when instantiating this call,
25216    /// we provide this method for API completeness.
25217    pub fn name(mut self, new_value: &str) -> OperationGetCall<'a, C> {
25218        self._name = new_value.to_string();
25219        self
25220    }
25221    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25222    /// while executing the actual API request.
25223    ///
25224    /// ````text
25225    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25226    /// ````
25227    ///
25228    /// Sets the *delegate* property to the given value.
25229    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationGetCall<'a, C> {
25230        self._delegate = Some(new_value);
25231        self
25232    }
25233
25234    /// Set any additional parameter of the query string used in the request.
25235    /// It should be used to set parameters which are not yet available through their own
25236    /// setters.
25237    ///
25238    /// Please note that this method must not be used to set any of the known parameters
25239    /// which have their own setter method. If done anyway, the request will fail.
25240    ///
25241    /// # Additional Parameters
25242    ///
25243    /// * *$.xgafv* (query-string) - V1 error format.
25244    /// * *access_token* (query-string) - OAuth access token.
25245    /// * *alt* (query-string) - Data format for response.
25246    /// * *callback* (query-string) - JSONP
25247    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25248    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25249    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25250    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25251    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25252    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25253    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25254    pub fn param<T>(mut self, name: T, value: T) -> OperationGetCall<'a, C>
25255    where
25256        T: AsRef<str>,
25257    {
25258        self._additional_params
25259            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25260        self
25261    }
25262
25263    /// Identifies the authorization scope for the method you are building.
25264    ///
25265    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25266    /// [`Scope::AppOrder`].
25267    ///
25268    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25269    /// tokens for more than one scope.
25270    ///
25271    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25272    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25273    /// sufficient, a read-write scope will do as well.
25274    pub fn add_scope<St>(mut self, scope: St) -> OperationGetCall<'a, C>
25275    where
25276        St: AsRef<str>,
25277    {
25278        self._scopes.insert(String::from(scope.as_ref()));
25279        self
25280    }
25281    /// Identifies the authorization scope(s) for the method you are building.
25282    ///
25283    /// See [`Self::add_scope()`] for details.
25284    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationGetCall<'a, C>
25285    where
25286        I: IntoIterator<Item = St>,
25287        St: AsRef<str>,
25288    {
25289        self._scopes
25290            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25291        self
25292    }
25293
25294    /// Removes all scopes, and no default scope will be used either.
25295    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25296    /// for details).
25297    pub fn clear_scopes(mut self) -> OperationGetCall<'a, C> {
25298        self._scopes.clear();
25299        self
25300    }
25301}
25302
25303/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
25304///
25305/// A builder for the *list* method supported by a *operation* resource.
25306/// It is not used directly, but through a [`OperationMethods`] instance.
25307///
25308/// # Example
25309///
25310/// Instantiate a resource method builder
25311///
25312/// ```test_harness,no_run
25313/// # extern crate hyper;
25314/// # extern crate hyper_rustls;
25315/// # extern crate google_cloudchannel1 as cloudchannel1;
25316/// # async fn dox() {
25317/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25318///
25319/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25320/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25321/// #     .with_native_roots()
25322/// #     .unwrap()
25323/// #     .https_only()
25324/// #     .enable_http2()
25325/// #     .build();
25326///
25327/// # let executor = hyper_util::rt::TokioExecutor::new();
25328/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25329/// #     secret,
25330/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25331/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
25332/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
25333/// #     ),
25334/// # ).build().await.unwrap();
25335///
25336/// # let client = hyper_util::client::legacy::Client::builder(
25337/// #     hyper_util::rt::TokioExecutor::new()
25338/// # )
25339/// # .build(
25340/// #     hyper_rustls::HttpsConnectorBuilder::new()
25341/// #         .with_native_roots()
25342/// #         .unwrap()
25343/// #         .https_or_http()
25344/// #         .enable_http2()
25345/// #         .build()
25346/// # );
25347/// # let mut hub = Cloudchannel::new(client, auth);
25348/// // You can configure optional parameters by calling the respective setters at will, and
25349/// // execute the final call using `doit()`.
25350/// // Values shown here are possibly random and not representative !
25351/// let result = hub.operations().list("name")
25352///              .return_partial_success(true)
25353///              .page_token("nonumy")
25354///              .page_size(-77)
25355///              .filter("sadipscing")
25356///              .doit().await;
25357/// # }
25358/// ```
25359pub struct OperationListCall<'a, C>
25360where
25361    C: 'a,
25362{
25363    hub: &'a Cloudchannel<C>,
25364    _name: String,
25365    _return_partial_success: Option<bool>,
25366    _page_token: Option<String>,
25367    _page_size: Option<i32>,
25368    _filter: Option<String>,
25369    _delegate: Option<&'a mut dyn common::Delegate>,
25370    _additional_params: HashMap<String, String>,
25371    _scopes: BTreeSet<String>,
25372}
25373
25374impl<'a, C> common::CallBuilder for OperationListCall<'a, C> {}
25375
25376impl<'a, C> OperationListCall<'a, C>
25377where
25378    C: common::Connector,
25379{
25380    /// Perform the operation you have build so far.
25381    pub async fn doit(
25382        mut self,
25383    ) -> common::Result<(common::Response, GoogleLongrunningListOperationsResponse)> {
25384        use std::borrow::Cow;
25385        use std::io::{Read, Seek};
25386
25387        use common::{url::Params, ToParts};
25388        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25389
25390        let mut dd = common::DefaultDelegate;
25391        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25392        dlg.begin(common::MethodInfo {
25393            id: "cloudchannel.operations.list",
25394            http_method: hyper::Method::GET,
25395        });
25396
25397        for &field in [
25398            "alt",
25399            "name",
25400            "returnPartialSuccess",
25401            "pageToken",
25402            "pageSize",
25403            "filter",
25404        ]
25405        .iter()
25406        {
25407            if self._additional_params.contains_key(field) {
25408                dlg.finished(false);
25409                return Err(common::Error::FieldClash(field));
25410            }
25411        }
25412
25413        let mut params = Params::with_capacity(7 + self._additional_params.len());
25414        params.push("name", self._name);
25415        if let Some(value) = self._return_partial_success.as_ref() {
25416            params.push("returnPartialSuccess", value.to_string());
25417        }
25418        if let Some(value) = self._page_token.as_ref() {
25419            params.push("pageToken", value);
25420        }
25421        if let Some(value) = self._page_size.as_ref() {
25422            params.push("pageSize", value.to_string());
25423        }
25424        if let Some(value) = self._filter.as_ref() {
25425            params.push("filter", value);
25426        }
25427
25428        params.extend(self._additional_params.iter());
25429
25430        params.push("alt", "json");
25431        let mut url = self.hub._base_url.clone() + "v1/{+name}";
25432        if self._scopes.is_empty() {
25433            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
25434        }
25435
25436        #[allow(clippy::single_element_loop)]
25437        for &(find_this, param_name) in [("{+name}", "name")].iter() {
25438            url = params.uri_replacement(url, param_name, find_this, true);
25439        }
25440        {
25441            let to_remove = ["name"];
25442            params.remove_params(&to_remove);
25443        }
25444
25445        let url = params.parse_with_url(&url);
25446
25447        loop {
25448            let token = match self
25449                .hub
25450                .auth
25451                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25452                .await
25453            {
25454                Ok(token) => token,
25455                Err(e) => match dlg.token(e) {
25456                    Ok(token) => token,
25457                    Err(e) => {
25458                        dlg.finished(false);
25459                        return Err(common::Error::MissingToken(e));
25460                    }
25461                },
25462            };
25463            let mut req_result = {
25464                let client = &self.hub.client;
25465                dlg.pre_request();
25466                let mut req_builder = hyper::Request::builder()
25467                    .method(hyper::Method::GET)
25468                    .uri(url.as_str())
25469                    .header(USER_AGENT, self.hub._user_agent.clone());
25470
25471                if let Some(token) = token.as_ref() {
25472                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25473                }
25474
25475                let request = req_builder
25476                    .header(CONTENT_LENGTH, 0_u64)
25477                    .body(common::to_body::<String>(None));
25478
25479                client.request(request.unwrap()).await
25480            };
25481
25482            match req_result {
25483                Err(err) => {
25484                    if let common::Retry::After(d) = dlg.http_error(&err) {
25485                        sleep(d).await;
25486                        continue;
25487                    }
25488                    dlg.finished(false);
25489                    return Err(common::Error::HttpError(err));
25490                }
25491                Ok(res) => {
25492                    let (mut parts, body) = res.into_parts();
25493                    let mut body = common::Body::new(body);
25494                    if !parts.status.is_success() {
25495                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25496                        let error = serde_json::from_str(&common::to_string(&bytes));
25497                        let response = common::to_response(parts, bytes.into());
25498
25499                        if let common::Retry::After(d) =
25500                            dlg.http_failure(&response, error.as_ref().ok())
25501                        {
25502                            sleep(d).await;
25503                            continue;
25504                        }
25505
25506                        dlg.finished(false);
25507
25508                        return Err(match error {
25509                            Ok(value) => common::Error::BadRequest(value),
25510                            _ => common::Error::Failure(response),
25511                        });
25512                    }
25513                    let response = {
25514                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25515                        let encoded = common::to_string(&bytes);
25516                        match serde_json::from_str(&encoded) {
25517                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25518                            Err(error) => {
25519                                dlg.response_json_decode_error(&encoded, &error);
25520                                return Err(common::Error::JsonDecodeError(
25521                                    encoded.to_string(),
25522                                    error,
25523                                ));
25524                            }
25525                        }
25526                    };
25527
25528                    dlg.finished(true);
25529                    return Ok(response);
25530                }
25531            }
25532        }
25533    }
25534
25535    /// The name of the operation's parent resource.
25536    ///
25537    /// Sets the *name* path property to the given value.
25538    ///
25539    /// Even though the property as already been set when instantiating this call,
25540    /// we provide this method for API completeness.
25541    pub fn name(mut self, new_value: &str) -> OperationListCall<'a, C> {
25542        self._name = new_value.to_string();
25543        self
25544    }
25545    /// When set to `true`, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field. This can only be `true` when reading across collections. For example, when `parent` is set to `"projects/example/locations/-"`. This field is not supported by default and will result in an `UNIMPLEMENTED` error if set unless explicitly documented otherwise in service or product specific documentation.
25546    ///
25547    /// Sets the *return partial success* query property to the given value.
25548    pub fn return_partial_success(mut self, new_value: bool) -> OperationListCall<'a, C> {
25549        self._return_partial_success = Some(new_value);
25550        self
25551    }
25552    /// The standard list page token.
25553    ///
25554    /// Sets the *page token* query property to the given value.
25555    pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a, C> {
25556        self._page_token = Some(new_value.to_string());
25557        self
25558    }
25559    /// The standard list page size.
25560    ///
25561    /// Sets the *page size* query property to the given value.
25562    pub fn page_size(mut self, new_value: i32) -> OperationListCall<'a, C> {
25563        self._page_size = Some(new_value);
25564        self
25565    }
25566    /// The standard list filter.
25567    ///
25568    /// Sets the *filter* query property to the given value.
25569    pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C> {
25570        self._filter = Some(new_value.to_string());
25571        self
25572    }
25573    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25574    /// while executing the actual API request.
25575    ///
25576    /// ````text
25577    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25578    /// ````
25579    ///
25580    /// Sets the *delegate* property to the given value.
25581    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationListCall<'a, C> {
25582        self._delegate = Some(new_value);
25583        self
25584    }
25585
25586    /// Set any additional parameter of the query string used in the request.
25587    /// It should be used to set parameters which are not yet available through their own
25588    /// setters.
25589    ///
25590    /// Please note that this method must not be used to set any of the known parameters
25591    /// which have their own setter method. If done anyway, the request will fail.
25592    ///
25593    /// # Additional Parameters
25594    ///
25595    /// * *$.xgafv* (query-string) - V1 error format.
25596    /// * *access_token* (query-string) - OAuth access token.
25597    /// * *alt* (query-string) - Data format for response.
25598    /// * *callback* (query-string) - JSONP
25599    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25600    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25601    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25602    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25603    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25604    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25605    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25606    pub fn param<T>(mut self, name: T, value: T) -> OperationListCall<'a, C>
25607    where
25608        T: AsRef<str>,
25609    {
25610        self._additional_params
25611            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25612        self
25613    }
25614
25615    /// Identifies the authorization scope for the method you are building.
25616    ///
25617    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25618    /// [`Scope::AppOrder`].
25619    ///
25620    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25621    /// tokens for more than one scope.
25622    ///
25623    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25624    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25625    /// sufficient, a read-write scope will do as well.
25626    pub fn add_scope<St>(mut self, scope: St) -> OperationListCall<'a, C>
25627    where
25628        St: AsRef<str>,
25629    {
25630        self._scopes.insert(String::from(scope.as_ref()));
25631        self
25632    }
25633    /// Identifies the authorization scope(s) for the method you are building.
25634    ///
25635    /// See [`Self::add_scope()`] for details.
25636    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationListCall<'a, C>
25637    where
25638        I: IntoIterator<Item = St>,
25639        St: AsRef<str>,
25640    {
25641        self._scopes
25642            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25643        self
25644    }
25645
25646    /// Removes all scopes, and no default scope will be used either.
25647    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25648    /// for details).
25649    pub fn clear_scopes(mut self) -> OperationListCall<'a, C> {
25650        self._scopes.clear();
25651        self
25652    }
25653}
25654
25655/// Lists the SKUs for a product the reseller is authorized to sell. Possible error codes: * INVALID_ARGUMENT: Required request parameters are missing or invalid.
25656///
25657/// A builder for the *skus.list* method supported by a *product* resource.
25658/// It is not used directly, but through a [`ProductMethods`] instance.
25659///
25660/// # Example
25661///
25662/// Instantiate a resource method builder
25663///
25664/// ```test_harness,no_run
25665/// # extern crate hyper;
25666/// # extern crate hyper_rustls;
25667/// # extern crate google_cloudchannel1 as cloudchannel1;
25668/// # async fn dox() {
25669/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25670///
25671/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25672/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25673/// #     .with_native_roots()
25674/// #     .unwrap()
25675/// #     .https_only()
25676/// #     .enable_http2()
25677/// #     .build();
25678///
25679/// # let executor = hyper_util::rt::TokioExecutor::new();
25680/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25681/// #     secret,
25682/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25683/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
25684/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
25685/// #     ),
25686/// # ).build().await.unwrap();
25687///
25688/// # let client = hyper_util::client::legacy::Client::builder(
25689/// #     hyper_util::rt::TokioExecutor::new()
25690/// # )
25691/// # .build(
25692/// #     hyper_rustls::HttpsConnectorBuilder::new()
25693/// #         .with_native_roots()
25694/// #         .unwrap()
25695/// #         .https_or_http()
25696/// #         .enable_http2()
25697/// #         .build()
25698/// # );
25699/// # let mut hub = Cloudchannel::new(client, auth);
25700/// // You can configure optional parameters by calling the respective setters at will, and
25701/// // execute the final call using `doit()`.
25702/// // Values shown here are possibly random and not representative !
25703/// let result = hub.products().skus_list("parent")
25704///              .page_token("dolores")
25705///              .page_size(-95)
25706///              .language_code("erat")
25707///              .account("aliquyam")
25708///              .doit().await;
25709/// # }
25710/// ```
25711pub struct ProductSkuListCall<'a, C>
25712where
25713    C: 'a,
25714{
25715    hub: &'a Cloudchannel<C>,
25716    _parent: String,
25717    _page_token: Option<String>,
25718    _page_size: Option<i32>,
25719    _language_code: Option<String>,
25720    _account: Option<String>,
25721    _delegate: Option<&'a mut dyn common::Delegate>,
25722    _additional_params: HashMap<String, String>,
25723    _scopes: BTreeSet<String>,
25724}
25725
25726impl<'a, C> common::CallBuilder for ProductSkuListCall<'a, C> {}
25727
25728impl<'a, C> ProductSkuListCall<'a, C>
25729where
25730    C: common::Connector,
25731{
25732    /// Perform the operation you have build so far.
25733    pub async fn doit(
25734        mut self,
25735    ) -> common::Result<(common::Response, GoogleCloudChannelV1ListSkusResponse)> {
25736        use std::borrow::Cow;
25737        use std::io::{Read, Seek};
25738
25739        use common::{url::Params, ToParts};
25740        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25741
25742        let mut dd = common::DefaultDelegate;
25743        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25744        dlg.begin(common::MethodInfo {
25745            id: "cloudchannel.products.skus.list",
25746            http_method: hyper::Method::GET,
25747        });
25748
25749        for &field in [
25750            "alt",
25751            "parent",
25752            "pageToken",
25753            "pageSize",
25754            "languageCode",
25755            "account",
25756        ]
25757        .iter()
25758        {
25759            if self._additional_params.contains_key(field) {
25760                dlg.finished(false);
25761                return Err(common::Error::FieldClash(field));
25762            }
25763        }
25764
25765        let mut params = Params::with_capacity(7 + self._additional_params.len());
25766        params.push("parent", self._parent);
25767        if let Some(value) = self._page_token.as_ref() {
25768            params.push("pageToken", value);
25769        }
25770        if let Some(value) = self._page_size.as_ref() {
25771            params.push("pageSize", value.to_string());
25772        }
25773        if let Some(value) = self._language_code.as_ref() {
25774            params.push("languageCode", value);
25775        }
25776        if let Some(value) = self._account.as_ref() {
25777            params.push("account", value);
25778        }
25779
25780        params.extend(self._additional_params.iter());
25781
25782        params.push("alt", "json");
25783        let mut url = self.hub._base_url.clone() + "v1/{+parent}/skus";
25784        if self._scopes.is_empty() {
25785            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
25786        }
25787
25788        #[allow(clippy::single_element_loop)]
25789        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
25790            url = params.uri_replacement(url, param_name, find_this, true);
25791        }
25792        {
25793            let to_remove = ["parent"];
25794            params.remove_params(&to_remove);
25795        }
25796
25797        let url = params.parse_with_url(&url);
25798
25799        loop {
25800            let token = match self
25801                .hub
25802                .auth
25803                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25804                .await
25805            {
25806                Ok(token) => token,
25807                Err(e) => match dlg.token(e) {
25808                    Ok(token) => token,
25809                    Err(e) => {
25810                        dlg.finished(false);
25811                        return Err(common::Error::MissingToken(e));
25812                    }
25813                },
25814            };
25815            let mut req_result = {
25816                let client = &self.hub.client;
25817                dlg.pre_request();
25818                let mut req_builder = hyper::Request::builder()
25819                    .method(hyper::Method::GET)
25820                    .uri(url.as_str())
25821                    .header(USER_AGENT, self.hub._user_agent.clone());
25822
25823                if let Some(token) = token.as_ref() {
25824                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25825                }
25826
25827                let request = req_builder
25828                    .header(CONTENT_LENGTH, 0_u64)
25829                    .body(common::to_body::<String>(None));
25830
25831                client.request(request.unwrap()).await
25832            };
25833
25834            match req_result {
25835                Err(err) => {
25836                    if let common::Retry::After(d) = dlg.http_error(&err) {
25837                        sleep(d).await;
25838                        continue;
25839                    }
25840                    dlg.finished(false);
25841                    return Err(common::Error::HttpError(err));
25842                }
25843                Ok(res) => {
25844                    let (mut parts, body) = res.into_parts();
25845                    let mut body = common::Body::new(body);
25846                    if !parts.status.is_success() {
25847                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25848                        let error = serde_json::from_str(&common::to_string(&bytes));
25849                        let response = common::to_response(parts, bytes.into());
25850
25851                        if let common::Retry::After(d) =
25852                            dlg.http_failure(&response, error.as_ref().ok())
25853                        {
25854                            sleep(d).await;
25855                            continue;
25856                        }
25857
25858                        dlg.finished(false);
25859
25860                        return Err(match error {
25861                            Ok(value) => common::Error::BadRequest(value),
25862                            _ => common::Error::Failure(response),
25863                        });
25864                    }
25865                    let response = {
25866                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25867                        let encoded = common::to_string(&bytes);
25868                        match serde_json::from_str(&encoded) {
25869                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25870                            Err(error) => {
25871                                dlg.response_json_decode_error(&encoded, &error);
25872                                return Err(common::Error::JsonDecodeError(
25873                                    encoded.to_string(),
25874                                    error,
25875                                ));
25876                            }
25877                        }
25878                    };
25879
25880                    dlg.finished(true);
25881                    return Ok(response);
25882                }
25883            }
25884        }
25885    }
25886
25887    /// Required. The resource name of the Product to list SKUs for. Parent uses the format: products/{product_id}. Supports products/- to retrieve SKUs for all products.
25888    ///
25889    /// Sets the *parent* path property to the given value.
25890    ///
25891    /// Even though the property as already been set when instantiating this call,
25892    /// we provide this method for API completeness.
25893    pub fn parent(mut self, new_value: &str) -> ProductSkuListCall<'a, C> {
25894        self._parent = new_value.to_string();
25895        self
25896    }
25897    /// Optional. A token for a page of results other than the first page. Optional.
25898    ///
25899    /// Sets the *page token* query property to the given value.
25900    pub fn page_token(mut self, new_value: &str) -> ProductSkuListCall<'a, C> {
25901        self._page_token = Some(new_value.to_string());
25902        self
25903    }
25904    /// Optional. Requested page size. Server might return fewer results than requested. If unspecified, returns at most 100 SKUs. The maximum value is 1000; the server will coerce values above 1000.
25905    ///
25906    /// Sets the *page size* query property to the given value.
25907    pub fn page_size(mut self, new_value: i32) -> ProductSkuListCall<'a, C> {
25908        self._page_size = Some(new_value);
25909        self
25910    }
25911    /// Optional. The BCP-47 language code. For example, "en-US". The response will localize in the corresponding language code, if specified. The default value is "en-US".
25912    ///
25913    /// Sets the *language code* query property to the given value.
25914    pub fn language_code(mut self, new_value: &str) -> ProductSkuListCall<'a, C> {
25915        self._language_code = Some(new_value.to_string());
25916        self
25917    }
25918    /// Required. Resource name of the reseller. Format: accounts/{account_id}.
25919    ///
25920    /// Sets the *account* query property to the given value.
25921    pub fn account(mut self, new_value: &str) -> ProductSkuListCall<'a, C> {
25922        self._account = Some(new_value.to_string());
25923        self
25924    }
25925    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25926    /// while executing the actual API request.
25927    ///
25928    /// ````text
25929    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25930    /// ````
25931    ///
25932    /// Sets the *delegate* property to the given value.
25933    pub fn delegate(
25934        mut self,
25935        new_value: &'a mut dyn common::Delegate,
25936    ) -> ProductSkuListCall<'a, C> {
25937        self._delegate = Some(new_value);
25938        self
25939    }
25940
25941    /// Set any additional parameter of the query string used in the request.
25942    /// It should be used to set parameters which are not yet available through their own
25943    /// setters.
25944    ///
25945    /// Please note that this method must not be used to set any of the known parameters
25946    /// which have their own setter method. If done anyway, the request will fail.
25947    ///
25948    /// # Additional Parameters
25949    ///
25950    /// * *$.xgafv* (query-string) - V1 error format.
25951    /// * *access_token* (query-string) - OAuth access token.
25952    /// * *alt* (query-string) - Data format for response.
25953    /// * *callback* (query-string) - JSONP
25954    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25955    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25956    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25957    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25958    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25959    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25960    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25961    pub fn param<T>(mut self, name: T, value: T) -> ProductSkuListCall<'a, C>
25962    where
25963        T: AsRef<str>,
25964    {
25965        self._additional_params
25966            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25967        self
25968    }
25969
25970    /// Identifies the authorization scope for the method you are building.
25971    ///
25972    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25973    /// [`Scope::AppOrder`].
25974    ///
25975    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25976    /// tokens for more than one scope.
25977    ///
25978    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25979    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25980    /// sufficient, a read-write scope will do as well.
25981    pub fn add_scope<St>(mut self, scope: St) -> ProductSkuListCall<'a, C>
25982    where
25983        St: AsRef<str>,
25984    {
25985        self._scopes.insert(String::from(scope.as_ref()));
25986        self
25987    }
25988    /// Identifies the authorization scope(s) for the method you are building.
25989    ///
25990    /// See [`Self::add_scope()`] for details.
25991    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProductSkuListCall<'a, C>
25992    where
25993        I: IntoIterator<Item = St>,
25994        St: AsRef<str>,
25995    {
25996        self._scopes
25997            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25998        self
25999    }
26000
26001    /// Removes all scopes, and no default scope will be used either.
26002    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26003    /// for details).
26004    pub fn clear_scopes(mut self) -> ProductSkuListCall<'a, C> {
26005        self._scopes.clear();
26006        self
26007    }
26008}
26009
26010/// Lists the Products the reseller is authorized to sell. Possible error codes: * INVALID_ARGUMENT: Required request parameters are missing or invalid.
26011///
26012/// A builder for the *list* method supported by a *product* resource.
26013/// It is not used directly, but through a [`ProductMethods`] instance.
26014///
26015/// # Example
26016///
26017/// Instantiate a resource method builder
26018///
26019/// ```test_harness,no_run
26020/// # extern crate hyper;
26021/// # extern crate hyper_rustls;
26022/// # extern crate google_cloudchannel1 as cloudchannel1;
26023/// # async fn dox() {
26024/// # use cloudchannel1::{Cloudchannel, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26025///
26026/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26027/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26028/// #     .with_native_roots()
26029/// #     .unwrap()
26030/// #     .https_only()
26031/// #     .enable_http2()
26032/// #     .build();
26033///
26034/// # let executor = hyper_util::rt::TokioExecutor::new();
26035/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26036/// #     secret,
26037/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26038/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
26039/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
26040/// #     ),
26041/// # ).build().await.unwrap();
26042///
26043/// # let client = hyper_util::client::legacy::Client::builder(
26044/// #     hyper_util::rt::TokioExecutor::new()
26045/// # )
26046/// # .build(
26047/// #     hyper_rustls::HttpsConnectorBuilder::new()
26048/// #         .with_native_roots()
26049/// #         .unwrap()
26050/// #         .https_or_http()
26051/// #         .enable_http2()
26052/// #         .build()
26053/// # );
26054/// # let mut hub = Cloudchannel::new(client, auth);
26055/// // You can configure optional parameters by calling the respective setters at will, and
26056/// // execute the final call using `doit()`.
26057/// // Values shown here are possibly random and not representative !
26058/// let result = hub.products().list()
26059///              .page_token("amet")
26060///              .page_size(-57)
26061///              .language_code("et")
26062///              .account("sea")
26063///              .doit().await;
26064/// # }
26065/// ```
26066pub struct ProductListCall<'a, C>
26067where
26068    C: 'a,
26069{
26070    hub: &'a Cloudchannel<C>,
26071    _page_token: Option<String>,
26072    _page_size: Option<i32>,
26073    _language_code: Option<String>,
26074    _account: Option<String>,
26075    _delegate: Option<&'a mut dyn common::Delegate>,
26076    _additional_params: HashMap<String, String>,
26077    _scopes: BTreeSet<String>,
26078}
26079
26080impl<'a, C> common::CallBuilder for ProductListCall<'a, C> {}
26081
26082impl<'a, C> ProductListCall<'a, C>
26083where
26084    C: common::Connector,
26085{
26086    /// Perform the operation you have build so far.
26087    pub async fn doit(
26088        mut self,
26089    ) -> common::Result<(common::Response, GoogleCloudChannelV1ListProductsResponse)> {
26090        use std::borrow::Cow;
26091        use std::io::{Read, Seek};
26092
26093        use common::{url::Params, ToParts};
26094        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26095
26096        let mut dd = common::DefaultDelegate;
26097        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26098        dlg.begin(common::MethodInfo {
26099            id: "cloudchannel.products.list",
26100            http_method: hyper::Method::GET,
26101        });
26102
26103        for &field in ["alt", "pageToken", "pageSize", "languageCode", "account"].iter() {
26104            if self._additional_params.contains_key(field) {
26105                dlg.finished(false);
26106                return Err(common::Error::FieldClash(field));
26107            }
26108        }
26109
26110        let mut params = Params::with_capacity(6 + self._additional_params.len());
26111        if let Some(value) = self._page_token.as_ref() {
26112            params.push("pageToken", value);
26113        }
26114        if let Some(value) = self._page_size.as_ref() {
26115            params.push("pageSize", value.to_string());
26116        }
26117        if let Some(value) = self._language_code.as_ref() {
26118            params.push("languageCode", value);
26119        }
26120        if let Some(value) = self._account.as_ref() {
26121            params.push("account", value);
26122        }
26123
26124        params.extend(self._additional_params.iter());
26125
26126        params.push("alt", "json");
26127        let mut url = self.hub._base_url.clone() + "v1/products";
26128        if self._scopes.is_empty() {
26129            self._scopes.insert(Scope::AppOrder.as_ref().to_string());
26130        }
26131
26132        let url = params.parse_with_url(&url);
26133
26134        loop {
26135            let token = match self
26136                .hub
26137                .auth
26138                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26139                .await
26140            {
26141                Ok(token) => token,
26142                Err(e) => match dlg.token(e) {
26143                    Ok(token) => token,
26144                    Err(e) => {
26145                        dlg.finished(false);
26146                        return Err(common::Error::MissingToken(e));
26147                    }
26148                },
26149            };
26150            let mut req_result = {
26151                let client = &self.hub.client;
26152                dlg.pre_request();
26153                let mut req_builder = hyper::Request::builder()
26154                    .method(hyper::Method::GET)
26155                    .uri(url.as_str())
26156                    .header(USER_AGENT, self.hub._user_agent.clone());
26157
26158                if let Some(token) = token.as_ref() {
26159                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26160                }
26161
26162                let request = req_builder
26163                    .header(CONTENT_LENGTH, 0_u64)
26164                    .body(common::to_body::<String>(None));
26165
26166                client.request(request.unwrap()).await
26167            };
26168
26169            match req_result {
26170                Err(err) => {
26171                    if let common::Retry::After(d) = dlg.http_error(&err) {
26172                        sleep(d).await;
26173                        continue;
26174                    }
26175                    dlg.finished(false);
26176                    return Err(common::Error::HttpError(err));
26177                }
26178                Ok(res) => {
26179                    let (mut parts, body) = res.into_parts();
26180                    let mut body = common::Body::new(body);
26181                    if !parts.status.is_success() {
26182                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26183                        let error = serde_json::from_str(&common::to_string(&bytes));
26184                        let response = common::to_response(parts, bytes.into());
26185
26186                        if let common::Retry::After(d) =
26187                            dlg.http_failure(&response, error.as_ref().ok())
26188                        {
26189                            sleep(d).await;
26190                            continue;
26191                        }
26192
26193                        dlg.finished(false);
26194
26195                        return Err(match error {
26196                            Ok(value) => common::Error::BadRequest(value),
26197                            _ => common::Error::Failure(response),
26198                        });
26199                    }
26200                    let response = {
26201                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26202                        let encoded = common::to_string(&bytes);
26203                        match serde_json::from_str(&encoded) {
26204                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26205                            Err(error) => {
26206                                dlg.response_json_decode_error(&encoded, &error);
26207                                return Err(common::Error::JsonDecodeError(
26208                                    encoded.to_string(),
26209                                    error,
26210                                ));
26211                            }
26212                        }
26213                    };
26214
26215                    dlg.finished(true);
26216                    return Ok(response);
26217                }
26218            }
26219        }
26220    }
26221
26222    /// Optional. A token for a page of results other than the first page.
26223    ///
26224    /// Sets the *page token* query property to the given value.
26225    pub fn page_token(mut self, new_value: &str) -> ProductListCall<'a, C> {
26226        self._page_token = Some(new_value.to_string());
26227        self
26228    }
26229    /// Optional. Requested page size. Server might return fewer results than requested. If unspecified, returns at most 100 Products. The maximum value is 1000; the server will coerce values above 1000.
26230    ///
26231    /// Sets the *page size* query property to the given value.
26232    pub fn page_size(mut self, new_value: i32) -> ProductListCall<'a, C> {
26233        self._page_size = Some(new_value);
26234        self
26235    }
26236    /// Optional. The BCP-47 language code. For example, "en-US". The response will localize in the corresponding language code, if specified. The default value is "en-US".
26237    ///
26238    /// Sets the *language code* query property to the given value.
26239    pub fn language_code(mut self, new_value: &str) -> ProductListCall<'a, C> {
26240        self._language_code = Some(new_value.to_string());
26241        self
26242    }
26243    /// Required. The resource name of the reseller account. Format: accounts/{account_id}.
26244    ///
26245    /// Sets the *account* query property to the given value.
26246    pub fn account(mut self, new_value: &str) -> ProductListCall<'a, C> {
26247        self._account = Some(new_value.to_string());
26248        self
26249    }
26250    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26251    /// while executing the actual API request.
26252    ///
26253    /// ````text
26254    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26255    /// ````
26256    ///
26257    /// Sets the *delegate* property to the given value.
26258    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProductListCall<'a, C> {
26259        self._delegate = Some(new_value);
26260        self
26261    }
26262
26263    /// Set any additional parameter of the query string used in the request.
26264    /// It should be used to set parameters which are not yet available through their own
26265    /// setters.
26266    ///
26267    /// Please note that this method must not be used to set any of the known parameters
26268    /// which have their own setter method. If done anyway, the request will fail.
26269    ///
26270    /// # Additional Parameters
26271    ///
26272    /// * *$.xgafv* (query-string) - V1 error format.
26273    /// * *access_token* (query-string) - OAuth access token.
26274    /// * *alt* (query-string) - Data format for response.
26275    /// * *callback* (query-string) - JSONP
26276    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26277    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26278    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26279    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26280    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26281    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26282    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26283    pub fn param<T>(mut self, name: T, value: T) -> ProductListCall<'a, C>
26284    where
26285        T: AsRef<str>,
26286    {
26287        self._additional_params
26288            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26289        self
26290    }
26291
26292    /// Identifies the authorization scope for the method you are building.
26293    ///
26294    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26295    /// [`Scope::AppOrder`].
26296    ///
26297    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26298    /// tokens for more than one scope.
26299    ///
26300    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26301    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26302    /// sufficient, a read-write scope will do as well.
26303    pub fn add_scope<St>(mut self, scope: St) -> ProductListCall<'a, C>
26304    where
26305        St: AsRef<str>,
26306    {
26307        self._scopes.insert(String::from(scope.as_ref()));
26308        self
26309    }
26310    /// Identifies the authorization scope(s) for the method you are building.
26311    ///
26312    /// See [`Self::add_scope()`] for details.
26313    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProductListCall<'a, C>
26314    where
26315        I: IntoIterator<Item = St>,
26316        St: AsRef<str>,
26317    {
26318        self._scopes
26319            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26320        self
26321    }
26322
26323    /// Removes all scopes, and no default scope will be used either.
26324    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26325    /// for details).
26326    pub fn clear_scopes(mut self) -> ProductListCall<'a, C> {
26327        self._scopes.clear();
26328        self
26329    }
26330}