google_androiddeviceprovisioning1/
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// ########
12// HUB ###
13// ######
14
15/// Central instance to access all AndroidProvisioningPartner related resource activities
16///
17/// # Examples
18///
19/// Instantiate a new hub
20///
21/// ```test_harness,no_run
22/// extern crate hyper;
23/// extern crate hyper_rustls;
24/// extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
25/// use androiddeviceprovisioning1::api::CustomerApplyConfigurationRequest;
26/// use androiddeviceprovisioning1::{Result, Error};
27/// # async fn dox() {
28/// use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29///
30/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
31/// // `client_secret`, among other things.
32/// let secret: yup_oauth2::ApplicationSecret = Default::default();
33/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
34/// // unless you replace  `None` with the desired Flow.
35/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
36/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
37/// // retrieve them from storage.
38/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
39///     secret,
40///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
41/// ).build().await.unwrap();
42///
43/// let client = hyper_util::client::legacy::Client::builder(
44///     hyper_util::rt::TokioExecutor::new()
45/// )
46/// .build(
47///     hyper_rustls::HttpsConnectorBuilder::new()
48///         .with_native_roots()
49///         .unwrap()
50///         .https_or_http()
51///         .enable_http1()
52///         .build()
53/// );
54/// let mut hub = AndroidProvisioningPartner::new(client, auth);
55/// // As the method needs a request, you would usually fill it with the desired information
56/// // into the respective structure. Some of the parts shown here might not be applicable !
57/// // Values shown here are possibly random and not representative !
58/// let mut req = CustomerApplyConfigurationRequest::default();
59///
60/// // You can configure optional parameters by calling the respective setters at will, and
61/// // execute the final call using `doit()`.
62/// // Values shown here are possibly random and not representative !
63/// let result = hub.customers().devices_apply_configuration(req, "parent")
64///              .doit().await;
65///
66/// match result {
67///     Err(e) => match e {
68///         // The Error enum provides details about what exactly happened.
69///         // You can also just use its `Debug`, `Display` or `Error` traits
70///          Error::HttpError(_)
71///         |Error::Io(_)
72///         |Error::MissingAPIKey
73///         |Error::MissingToken(_)
74///         |Error::Cancelled
75///         |Error::UploadSizeLimitExceeded(_, _)
76///         |Error::Failure(_)
77///         |Error::BadRequest(_)
78///         |Error::FieldClash(_)
79///         |Error::JsonDecodeError(_, _) => println!("{}", e),
80///     },
81///     Ok(res) => println!("Success: {:?}", res),
82/// }
83/// # }
84/// ```
85#[derive(Clone)]
86pub struct AndroidProvisioningPartner<C> {
87    pub client: common::Client<C>,
88    pub auth: Box<dyn common::GetToken>,
89    _user_agent: String,
90    _base_url: String,
91    _root_url: String,
92}
93
94impl<C> common::Hub for AndroidProvisioningPartner<C> {}
95
96impl<'a, C> AndroidProvisioningPartner<C> {
97    pub fn new<A: 'static + common::GetToken>(
98        client: common::Client<C>,
99        auth: A,
100    ) -> AndroidProvisioningPartner<C> {
101        AndroidProvisioningPartner {
102            client,
103            auth: Box::new(auth),
104            _user_agent: "google-api-rust-client/6.0.0".to_string(),
105            _base_url: "https://androiddeviceprovisioning.googleapis.com/".to_string(),
106            _root_url: "https://androiddeviceprovisioning.googleapis.com/".to_string(),
107        }
108    }
109
110    pub fn customers(&'a self) -> CustomerMethods<'a, C> {
111        CustomerMethods { hub: self }
112    }
113    pub fn operations(&'a self) -> OperationMethods<'a, C> {
114        OperationMethods { hub: self }
115    }
116    pub fn partners(&'a self) -> PartnerMethods<'a, C> {
117        PartnerMethods { hub: self }
118    }
119
120    /// Set the user-agent header field to use in all requests to the server.
121    /// It defaults to `google-api-rust-client/6.0.0`.
122    ///
123    /// Returns the previously set user-agent.
124    pub fn user_agent(&mut self, agent_name: String) -> String {
125        std::mem::replace(&mut self._user_agent, agent_name)
126    }
127
128    /// Set the base url to use in all requests to the server.
129    /// It defaults to `https://androiddeviceprovisioning.googleapis.com/`.
130    ///
131    /// Returns the previously set base url.
132    pub fn base_url(&mut self, new_base_url: String) -> String {
133        std::mem::replace(&mut self._base_url, new_base_url)
134    }
135
136    /// Set the root url to use in all requests to the server.
137    /// It defaults to `https://androiddeviceprovisioning.googleapis.com/`.
138    ///
139    /// Returns the previously set root url.
140    pub fn root_url(&mut self, new_root_url: String) -> String {
141        std::mem::replace(&mut self._root_url, new_root_url)
142    }
143}
144
145// ############
146// SCHEMAS ###
147// ##########
148/// Request message to claim a device on behalf of a customer.
149///
150/// # Activities
151///
152/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
153/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
154///
155/// * [devices claim partners](PartnerDeviceClaimCall) (request)
156#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
157#[serde_with::serde_as]
158#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
159pub struct ClaimDeviceRequest {
160    /// Optional. The ID of the configuration applied to the device section.
161    #[serde(rename = "configurationId")]
162    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
163    pub configuration_id: Option<i64>,
164    /// The ID of the customer for whom the device is being claimed.
165    #[serde(rename = "customerId")]
166    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
167    pub customer_id: Option<i64>,
168    /// Required. Required. The device identifier of the device to claim.
169    #[serde(rename = "deviceIdentifier")]
170    pub device_identifier: Option<DeviceIdentifier>,
171    /// Optional. The metadata to attach to the device.
172    #[serde(rename = "deviceMetadata")]
173    pub device_metadata: Option<DeviceMetadata>,
174    /// The Google Workspace customer ID.
175    #[serde(rename = "googleWorkspaceCustomerId")]
176    pub google_workspace_customer_id: Option<String>,
177    /// Optional. Must and can only be set for Chrome OS devices.
178    #[serde(rename = "preProvisioningToken")]
179    pub pre_provisioning_token: Option<String>,
180    /// Required. The section type of the device's provisioning record.
181    #[serde(rename = "sectionType")]
182    pub section_type: Option<String>,
183    /// Optional. Must and can only be set when DeviceProvisioningSectionType is SECTION_TYPE_SIM_LOCK. The unique identifier of the SimLock profile.
184    #[serde(rename = "simlockProfileId")]
185    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
186    pub simlock_profile_id: Option<i64>,
187}
188
189impl common::RequestValue for ClaimDeviceRequest {}
190
191/// Response message containing device id of the claim.
192///
193/// # Activities
194///
195/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
196/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
197///
198/// * [devices claim partners](PartnerDeviceClaimCall) (response)
199#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
200#[serde_with::serde_as]
201#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
202pub struct ClaimDeviceResponse {
203    /// The device ID of the claimed device.
204    #[serde(rename = "deviceId")]
205    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
206    pub device_id: Option<i64>,
207    /// The resource name of the device in the format `partners/[PARTNER_ID]/devices/[DEVICE_ID]`.
208    #[serde(rename = "deviceName")]
209    pub device_name: Option<String>,
210}
211
212impl common::ResponseResult for ClaimDeviceResponse {}
213
214/// Request to claim devices asynchronously in batch. Claiming a device adds the device to zero-touch enrollment and shows the device in the customer’s view of the portal.
215///
216/// # Activities
217///
218/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
219/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
220///
221/// * [devices claim async partners](PartnerDeviceClaimAsyncCall) (request)
222#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
223#[serde_with::serde_as]
224#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
225pub struct ClaimDevicesRequest {
226    /// Required. A list of device claims.
227    pub claims: Option<Vec<PartnerClaim>>,
228}
229
230impl common::RequestValue for ClaimDevicesRequest {}
231
232/// A reseller, vendor, or customer in the zero-touch reseller and customer APIs.
233///
234/// # Activities
235///
236/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
237/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
238///
239/// * [customers create partners](PartnerCustomerCreateCall) (response)
240#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
241#[serde_with::serde_as]
242#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
243pub struct Company {
244    /// Optional. Email address of customer's users in the admin role. Each email address must be associated with a Google Account.
245    #[serde(rename = "adminEmails")]
246    pub admin_emails: Option<Vec<String>>,
247    /// Output only. The ID of the company. Assigned by the server.
248    #[serde(rename = "companyId")]
249    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
250    pub company_id: Option<i64>,
251    /// Required. The name of the company. For example _XYZ Corp_. Displayed to the company's employees in the zero-touch enrollment portal.
252    #[serde(rename = "companyName")]
253    pub company_name: Option<String>,
254    /// Output only. The Google Workspace account associated with this customer. Only used for customer Companies.
255    #[serde(rename = "googleWorkspaceAccount")]
256    pub google_workspace_account: Option<GoogleWorkspaceAccount>,
257    /// Input only. The preferred locale of the customer represented as a BCP47 language code. This field is validated on input and requests containing unsupported language codes will be rejected. Supported language codes: Arabic (ar) Chinese (Hong Kong) (zh-HK) Chinese (Simplified) (zh-CN) Chinese (Traditional) (zh-TW) Czech (cs) Danish (da) Dutch (nl) English (UK) (en-GB) English (US) (en-US) Filipino (fil) Finnish (fi) French (fr) German (de) Hebrew (iw) Hindi (hi) Hungarian (hu) Indonesian (id) Italian (it) Japanese (ja) Korean (ko) Norwegian (Bokmal) (no) Polish (pl) Portuguese (Brazil) (pt-BR) Portuguese (Portugal) (pt-PT) Russian (ru) Spanish (es) Spanish (Latin America) (es-419) Swedish (sv) Thai (th) Turkish (tr) Ukrainian (uk) Vietnamese (vi)
258    #[serde(rename = "languageCode")]
259    pub language_code: Option<String>,
260    /// Output only. The API resource name of the company. The resource name is one of the following formats: * `partners/[PARTNER_ID]/customers/[CUSTOMER_ID]` * `partners/[PARTNER_ID]/vendors/[VENDOR_ID]` * `partners/[PARTNER_ID]/vendors/[VENDOR_ID]/customers/[CUSTOMER_ID]` Assigned by the server.
261    pub name: Option<String>,
262    /// Required. Input only. Email address of customer's users in the owner role. At least one `owner_email` is required. Owners share the same access as admins but can also add, delete, and edit your organization's portal users.
263    #[serde(rename = "ownerEmails")]
264    pub owner_emails: Option<Vec<String>>,
265    /// Input only. If set to true, welcome email will not be sent to the customer. It is recommended to skip the welcome email if devices will be claimed with additional DEVICE_PROTECTION service, as the customer will receive separate emails at device claim time. This field is ignored if this is not a Zero-touch customer.
266    #[serde(rename = "skipWelcomeEmail")]
267    pub skip_welcome_email: Option<bool>,
268    /// Output only. Whether any user from the company has accepted the latest Terms of Service (ToS). See TermsStatus.
269    #[serde(rename = "termsStatus")]
270    pub terms_status: Option<String>,
271}
272
273impl common::ResponseResult for Company {}
274
275/// A configuration collects the provisioning options for Android devices. Each configuration combines the following: * The EMM device policy controller (DPC) installed on the devices. * EMM policies enforced on the devices. * Metadata displayed on the device to help users during setup. Customers can add as many configurations as they need. However, zero-touch enrollment works best when a customer sets a default configuration that’s applied to any new devices the organization purchases.
276///
277/// # Activities
278///
279/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
280/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
281///
282/// * [configurations create customers](CustomerConfigurationCreateCall) (request|response)
283/// * [configurations get customers](CustomerConfigurationGetCall) (response)
284/// * [configurations patch customers](CustomerConfigurationPatchCall) (request|response)
285#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
286#[serde_with::serde_as]
287#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
288pub struct Configuration {
289    /// Required. The name of the organization. Zero-touch enrollment shows this organization name to device users during device provisioning.
290    #[serde(rename = "companyName")]
291    pub company_name: Option<String>,
292    /// Output only. The ID of the configuration. Assigned by the server.
293    #[serde(rename = "configurationId")]
294    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
295    pub configuration_id: Option<i64>,
296    /// Required. A short name that describes the configuration's purpose. For example, _Sales team_ or _Temporary employees_. The zero-touch enrollment portal displays this name to IT admins.
297    #[serde(rename = "configurationName")]
298    pub configuration_name: Option<String>,
299    /// Required. The email address that device users can contact to get help. Zero-touch enrollment shows this email address to device users before device provisioning. The value is validated on input.
300    #[serde(rename = "contactEmail")]
301    pub contact_email: Option<String>,
302    /// Required. The telephone number that device users can call, using another device, to get help. Zero-touch enrollment shows this number to device users before device provisioning. Accepts numerals, spaces, the plus sign, hyphens, and parentheses.
303    #[serde(rename = "contactPhone")]
304    pub contact_phone: Option<String>,
305    /// A message, containing one or two sentences, to help device users get help or give them more details about what’s happening to their device. Zero-touch enrollment shows this message before the device is provisioned.
306    #[serde(rename = "customMessage")]
307    pub custom_message: Option<String>,
308    /// The JSON-formatted EMM provisioning extras that are passed to the DPC.
309    #[serde(rename = "dpcExtras")]
310    pub dpc_extras: Option<String>,
311    /// Required. The resource name of the selected DPC (device policy controller) in the format `customers/[CUSTOMER_ID]/dpcs/*`. To list the supported DPCs, call `customers.dpcs.list`.
312    #[serde(rename = "dpcResourcePath")]
313    pub dpc_resource_path: Option<String>,
314    /// Optional. The timeout before forcing factory reset the device if the device doesn't go through provisioning in the setup wizard, usually due to lack of network connectivity during setup wizard. Ranges from 0-6 hours, with 2 hours being the default if unset.
315    #[serde(rename = "forcedResetTime")]
316    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
317    pub forced_reset_time: Option<chrono::Duration>,
318    /// Required. Whether this is the default configuration that zero-touch enrollment applies to any new devices the organization purchases in the future. Only one customer configuration can be the default. Setting this value to `true`, changes the previous default configuration's `isDefault` value to `false`.
319    #[serde(rename = "isDefault")]
320    pub is_default: Option<bool>,
321    /// Output only. The API resource name in the format `customers/[CUSTOMER_ID]/configurations/[CONFIGURATION_ID]`. Assigned by the server.
322    pub name: Option<String>,
323}
324
325impl common::RequestValue for Configuration {}
326impl common::ResponseResult for Configuration {}
327
328/// Request message to create a customer.
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 create partners](PartnerCustomerCreateCall) (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 CreateCustomerRequest {
340    /// Required. The company data to populate the new customer. Must contain a value for `companyName` and at least one `owner_email` that's associated with a Google Account. The values for `companyId` and `name` must be empty.
341    pub customer: Option<Company>,
342}
343
344impl common::RequestValue for CreateCustomerRequest {}
345
346/// Request message for customer to assign a configuration to device.
347///
348/// # Activities
349///
350/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
351/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
352///
353/// * [devices apply configuration customers](CustomerDeviceApplyConfigurationCall) (request)
354#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
355#[serde_with::serde_as]
356#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
357pub struct CustomerApplyConfigurationRequest {
358    /// Required. The configuration applied to the device in the format `customers/[CUSTOMER_ID]/configurations/[CONFIGURATION_ID]`.
359    pub configuration: Option<String>,
360    /// Required. The device the configuration is applied to. There are custom validations in ApplyConfigurationRequestValidator
361    pub device: Option<DeviceReference>,
362}
363
364impl common::RequestValue for CustomerApplyConfigurationRequest {}
365
366/// Response message of customer’s listing configuration.
367///
368/// # Activities
369///
370/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
371/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
372///
373/// * [configurations list customers](CustomerConfigurationListCall) (response)
374#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
375#[serde_with::serde_as]
376#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
377pub struct CustomerListConfigurationsResponse {
378    /// The configurations.
379    pub configurations: Option<Vec<Configuration>>,
380}
381
382impl common::ResponseResult for CustomerListConfigurationsResponse {}
383
384/// Response message for listing my customers.
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/// * [list customers](CustomerListCall) (response)
392#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
393#[serde_with::serde_as]
394#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
395pub struct CustomerListCustomersResponse {
396    /// The customer accounts the calling user is a member of.
397    pub customers: Option<Vec<Company>>,
398    /// A token used to access the next page of results. Omitted if no further results are available.
399    #[serde(rename = "nextPageToken")]
400    pub next_page_token: Option<String>,
401}
402
403impl common::ResponseResult for CustomerListCustomersResponse {}
404
405/// Response message of customer’s liting devices.
406///
407/// # Activities
408///
409/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
410/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
411///
412/// * [devices list customers](CustomerDeviceListCall) (response)
413#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
414#[serde_with::serde_as]
415#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
416pub struct CustomerListDevicesResponse {
417    /// The customer's devices.
418    pub devices: Option<Vec<Device>>,
419    /// A token used to access the next page of results. Omitted if no further results are available.
420    #[serde(rename = "nextPageToken")]
421    pub next_page_token: Option<String>,
422}
423
424impl common::ResponseResult for CustomerListDevicesResponse {}
425
426/// Response message of customer’s listing DPCs.
427///
428/// # Activities
429///
430/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
431/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
432///
433/// * [dpcs list customers](CustomerDpcListCall) (response)
434#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
435#[serde_with::serde_as]
436#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
437pub struct CustomerListDpcsResponse {
438    /// The list of DPCs available to the customer that support zero-touch enrollment.
439    pub dpcs: Option<Vec<Dpc>>,
440}
441
442impl common::ResponseResult for CustomerListDpcsResponse {}
443
444/// Request message for customer to remove the configuration from device.
445///
446/// # Activities
447///
448/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
449/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
450///
451/// * [devices remove configuration customers](CustomerDeviceRemoveConfigurationCall) (request)
452#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
453#[serde_with::serde_as]
454#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
455pub struct CustomerRemoveConfigurationRequest {
456    /// Required. The device to remove the configuration from. There are custom validations in RemoveConfigurationRequestValidator
457    pub device: Option<DeviceReference>,
458}
459
460impl common::RequestValue for CustomerRemoveConfigurationRequest {}
461
462/// Request message for customer to unclaim a device.
463///
464/// # Activities
465///
466/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
467/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
468///
469/// * [devices unclaim customers](CustomerDeviceUnclaimCall) (request)
470#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
471#[serde_with::serde_as]
472#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
473pub struct CustomerUnclaimDeviceRequest {
474    /// Required. The device to unclaim. There are custom validations in UnclaimDeviceRequestValidator.
475    pub device: Option<DeviceReference>,
476}
477
478impl common::RequestValue for CustomerUnclaimDeviceRequest {}
479
480/// An Android or Chrome OS device registered for zero-touch enrollment.
481///
482/// # Activities
483///
484/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
485/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
486///
487/// * [devices get customers](CustomerDeviceGetCall) (response)
488/// * [devices get partners](PartnerDeviceGetCall) (response)
489#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
490#[serde_with::serde_as]
491#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
492pub struct Device {
493    /// Output only. The provisioning claims for a device. Devices claimed for zero-touch enrollment have a claim with the type `SECTION_TYPE_ZERO_TOUCH`. Call `partners.devices.unclaim` or `partners.devices.unclaimAsync` to remove the device from zero-touch enrollment.
494    pub claims: Option<Vec<DeviceClaim>>,
495    /// Not available to resellers.
496    pub configuration: Option<String>,
497    /// Output only. The ID of the device. Assigned by the server.
498    #[serde(rename = "deviceId")]
499    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
500    pub device_id: Option<i64>,
501    /// The hardware IDs that identify a manufactured device. To learn more, read [Identifiers](https://developers.google.com/zero-touch/guides/identifiers).
502    #[serde(rename = "deviceIdentifier")]
503    pub device_identifier: Option<DeviceIdentifier>,
504    /// The metadata attached to the device. Structured as key-value pairs. To learn more, read [Device metadata](https://developers.google.com/zero-touch/guides/metadata).
505    #[serde(rename = "deviceMetadata")]
506    pub device_metadata: Option<DeviceMetadata>,
507    /// Output only. The API resource name in the format `partners/[PARTNER_ID]/devices/[DEVICE_ID]`. Assigned by the server.
508    pub name: Option<String>,
509}
510
511impl common::ResponseResult for Device {}
512
513/// A record of a device claimed by a reseller for a customer. Devices claimed for zero-touch enrollment have a claim with the type `SECTION_TYPE_ZERO_TOUCH`. To learn more, read [Claim devices for customers](https://developers.google.com/zero-touch/guides/how-it-works#claim).
514///
515/// This type is not used in any activity, and only used as *part* of another schema.
516#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
517#[serde_with::serde_as]
518#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
519pub struct DeviceClaim {
520    /// The Additional service registered for the device.
521    #[serde(rename = "additionalService")]
522    pub additional_service: Option<String>,
523    /// The ID of the Google Workspace account that owns the Chrome OS device.
524    #[serde(rename = "googleWorkspaceCustomerId")]
525    pub google_workspace_customer_id: Option<String>,
526    /// The ID of the Customer that purchased the device.
527    #[serde(rename = "ownerCompanyId")]
528    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
529    pub owner_company_id: Option<i64>,
530    /// The ID of the reseller that claimed the device.
531    #[serde(rename = "resellerId")]
532    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
533    pub reseller_id: Option<i64>,
534    /// Output only. The type of claim made on the device.
535    #[serde(rename = "sectionType")]
536    pub section_type: Option<String>,
537    /// The timestamp when the device will exit ‘vacation mode’. This value is present iff the device is in 'vacation mode'.
538    #[serde(rename = "vacationModeExpireTime")]
539    pub vacation_mode_expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
540    /// The timestamp when the device was put into ‘vacation mode’. This value is present iff the device is in 'vacation mode'.
541    #[serde(rename = "vacationModeStartTime")]
542    pub vacation_mode_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
543}
544
545impl common::Part for DeviceClaim {}
546
547/// Encapsulates hardware and product IDs to identify a manufactured device. To understand requirements on identifier sets, read [Identifiers](https://developers.google.com/zero-touch/guides/identifiers).
548///
549/// This type is not used in any activity, and only used as *part* of another schema.
550///
551#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
552#[serde_with::serde_as]
553#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
554pub struct DeviceIdentifier {
555    /// An identifier provided by OEMs, carried through the production and sales process. Only applicable to Chrome OS devices.
556    #[serde(rename = "chromeOsAttestedDeviceId")]
557    pub chrome_os_attested_device_id: Option<String>,
558    /// The type of the device
559    #[serde(rename = "deviceType")]
560    pub device_type: Option<String>,
561    /// The device’s IMEI number. Validated on input.
562    pub imei: Option<String>,
563    /// The device manufacturer’s name. Matches the device’s built-in value returned from `android.os.Build.MANUFACTURER`. Allowed values are listed in [Android manufacturers](https://developers.google.com/zero-touch/resources/manufacturer-names#manufacturers-names).
564    pub manufacturer: Option<String>,
565    /// The device’s MEID number.
566    pub meid: Option<String>,
567    /// The device model’s name. Allowed values are listed in [Android models](https://developers.google.com/zero-touch/resources/manufacturer-names#model-names) and [Chrome OS models](https://support.google.com/chrome/a/answer/10130175#identify_compatible).
568    pub model: Option<String>,
569    /// The manufacturer's serial number for the device. This value might not be unique across different device models.
570    #[serde(rename = "serialNumber")]
571    pub serial_number: Option<String>,
572}
573
574impl common::Part for DeviceIdentifier {}
575
576/// Metadata entries that can be attached to a `Device`. To learn more, read [Device metadata](https://developers.google.com/zero-touch/guides/metadata).
577///
578/// # Activities
579///
580/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
581/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
582///
583/// * [devices metadata partners](PartnerDeviceMetadataCall) (response)
584#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
585#[serde_with::serde_as]
586#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
587pub struct DeviceMetadata {
588    /// Metadata entries recorded as key-value pairs.
589    pub entries: Option<HashMap<String, String>>,
590}
591
592impl common::ResponseResult for DeviceMetadata {}
593
594/// A `DeviceReference` is an API abstraction that lets you supply a _device_ argument to a method using one of the following identifier types: * A numeric API resource ID. * Real-world hardware IDs, such as IMEI number, belonging to the manufactured device. Methods that operate on devices take a `DeviceReference` as a parameter type because it's more flexible for the caller. To learn more about device identifiers, read [Identifiers](https://developers.google.com/zero-touch/guides/identifiers).
595///
596/// This type is not used in any activity, and only used as *part* of another schema.
597///
598#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
599#[serde_with::serde_as]
600#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
601pub struct DeviceReference {
602    /// The ID of the device.
603    #[serde(rename = "deviceId")]
604    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
605    pub device_id: Option<i64>,
606    /// The hardware IDs of the device.
607    #[serde(rename = "deviceIdentifier")]
608    pub device_identifier: Option<DeviceIdentifier>,
609}
610
611impl common::Part for DeviceReference {}
612
613/// An EMM's DPC ([device policy controller](http://developer.android.com/work/dpc/build-dpc.html)). Zero-touch enrollment installs a DPC (listed in the `Configuration`) on a device to maintain the customer's mobile policies. All the DPCs listed by the API support zero-touch enrollment and are available in Google Play.
614///
615/// This type is not used in any activity, and only used as *part* of another schema.
616///
617#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
618#[serde_with::serde_as]
619#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
620pub struct Dpc {
621    /// Output only. The title of the DPC app in Google Play. For example, _Google Apps Device Policy_. Useful in an application's user interface.
622    #[serde(rename = "dpcName")]
623    pub dpc_name: Option<String>,
624    /// Output only. The API resource name in the format `customers/[CUSTOMER_ID]/dpcs/[DPC_ID]`. Assigned by the server. To maintain a reference to a DPC across customer accounts, persist and match the last path component (`DPC_ID`).
625    pub name: Option<String>,
626    /// Output only. The DPC's Android application ID that looks like a Java package name. Zero-touch enrollment installs the DPC app onto a device using this identifier.
627    #[serde(rename = "packageName")]
628    pub package_name: Option<String>,
629}
630
631impl common::Part for Dpc {}
632
633/// 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); }
634///
635/// # Activities
636///
637/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
638/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
639///
640/// * [configurations delete customers](CustomerConfigurationDeleteCall) (response)
641/// * [devices apply configuration customers](CustomerDeviceApplyConfigurationCall) (response)
642/// * [devices remove configuration customers](CustomerDeviceRemoveConfigurationCall) (response)
643/// * [devices unclaim customers](CustomerDeviceUnclaimCall) (response)
644/// * [devices unclaim partners](PartnerDeviceUnclaimCall) (response)
645#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
646#[serde_with::serde_as]
647#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
648pub struct Empty {
649    _never_set: Option<bool>,
650}
651
652impl common::ResponseResult for Empty {}
653
654/// Request to find devices.
655///
656/// # Activities
657///
658/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
659/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
660///
661/// * [devices find by identifier partners](PartnerDeviceFindByIdentifierCall) (request)
662#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
663#[serde_with::serde_as]
664#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
665pub struct FindDevicesByDeviceIdentifierRequest {
666    /// Required. Required. The device identifier to search for.
667    #[serde(rename = "deviceIdentifier")]
668    pub device_identifier: Option<DeviceIdentifier>,
669    /// Required. The maximum number of devices to show in a page of results. Must be between 1 and 100 inclusive.
670    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
671    pub limit: Option<i64>,
672    /// A token specifying which result page to return.
673    #[serde(rename = "pageToken")]
674    pub page_token: Option<String>,
675}
676
677impl common::RequestValue for FindDevicesByDeviceIdentifierRequest {}
678
679/// Response containing found devices.
680///
681/// # Activities
682///
683/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
684/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
685///
686/// * [devices find by identifier partners](PartnerDeviceFindByIdentifierCall) (response)
687#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
688#[serde_with::serde_as]
689#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
690pub struct FindDevicesByDeviceIdentifierResponse {
691    /// Found devices.
692    pub devices: Option<Vec<Device>>,
693    /// A token used to access the next page of results. Omitted if no further results are available.
694    #[serde(rename = "nextPageToken")]
695    pub next_page_token: Option<String>,
696    /// The total count of items in the list irrespective of pagination.
697    #[serde(rename = "totalSize")]
698    pub total_size: Option<i32>,
699}
700
701impl common::ResponseResult for FindDevicesByDeviceIdentifierResponse {}
702
703/// Request to find devices by customers.
704///
705/// # Activities
706///
707/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
708/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
709///
710/// * [devices find by owner partners](PartnerDeviceFindByOwnerCall) (request)
711#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
712#[serde_with::serde_as]
713#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
714pub struct FindDevicesByOwnerRequest {
715    /// The list of customer IDs to search for.
716    #[serde(rename = "customerId")]
717    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
718    pub customer_id: Option<Vec<i64>>,
719    /// The list of IDs of Google Workspace accounts to search for.
720    #[serde(rename = "googleWorkspaceCustomerId")]
721    pub google_workspace_customer_id: Option<Vec<String>>,
722    /// Required. The maximum number of devices to show in a page of results. Must be between 1 and 100 inclusive.
723    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
724    pub limit: Option<i64>,
725    /// A token specifying which result page to return.
726    #[serde(rename = "pageToken")]
727    pub page_token: Option<String>,
728    /// Required. The section type of the device's provisioning record.
729    #[serde(rename = "sectionType")]
730    pub section_type: Option<String>,
731}
732
733impl common::RequestValue for FindDevicesByOwnerRequest {}
734
735/// Response containing found devices.
736///
737/// # Activities
738///
739/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
740/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
741///
742/// * [devices find by owner partners](PartnerDeviceFindByOwnerCall) (response)
743#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
744#[serde_with::serde_as]
745#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
746pub struct FindDevicesByOwnerResponse {
747    /// The customer's devices.
748    pub devices: Option<Vec<Device>>,
749    /// A token used to access the next page of results. Omitted if no further results are available.
750    #[serde(rename = "nextPageToken")]
751    pub next_page_token: Option<String>,
752    /// The total count of items in the list irrespective of pagination.
753    #[serde(rename = "totalSize")]
754    pub total_size: Option<i32>,
755}
756
757impl common::ResponseResult for FindDevicesByOwnerResponse {}
758
759/// Request to get a device’s SIM lock status.
760///
761/// # Activities
762///
763/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
764/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
765///
766/// * [devices get sim lock state partners](PartnerDeviceGetSimLockStateCall) (request)
767#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
768#[serde_with::serde_as]
769#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
770pub struct GetDeviceSimLockStateRequest {
771    /// Required. Required. The device identifier to search for.
772    #[serde(rename = "deviceIdentifier")]
773    pub device_identifier: Option<DeviceIdentifier>,
774}
775
776impl common::RequestValue for GetDeviceSimLockStateRequest {}
777
778/// Response containing a device’s SimLock state.
779///
780/// # Activities
781///
782/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
783/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
784///
785/// * [devices get sim lock state partners](PartnerDeviceGetSimLockStateCall) (response)
786#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
787#[serde_with::serde_as]
788#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
789pub struct GetDeviceSimLockStateResponse {
790    /// no description provided
791    #[serde(rename = "simLockState")]
792    pub sim_lock_state: Option<String>,
793}
794
795impl common::ResponseResult for GetDeviceSimLockStateResponse {}
796
797/// A Google Workspace customer.
798///
799/// This type is not used in any activity, and only used as *part* of another schema.
800///
801#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
802#[serde_with::serde_as]
803#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
804pub struct GoogleWorkspaceAccount {
805    /// Required. The customer ID.
806    #[serde(rename = "customerId")]
807    pub customer_id: Option<String>,
808    /// Output only. The pre-provisioning tokens previously used to claim devices.
809    #[serde(rename = "preProvisioningTokens")]
810    pub pre_provisioning_tokens: Option<Vec<String>>,
811}
812
813impl common::Part for GoogleWorkspaceAccount {}
814
815/// Response message of all customers related to this partner.
816///
817/// # Activities
818///
819/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
820/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
821///
822/// * [customers list partners](PartnerCustomerListCall) (response)
823#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
824#[serde_with::serde_as]
825#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
826pub struct ListCustomersResponse {
827    /// List of customers related to this reseller partner.
828    pub customers: Option<Vec<Company>>,
829    /// A token to retrieve the next page of results. Omitted if no further results are available.
830    #[serde(rename = "nextPageToken")]
831    pub next_page_token: Option<String>,
832    /// The total count of items in the list irrespective of pagination.
833    #[serde(rename = "totalSize")]
834    pub total_size: Option<i32>,
835}
836
837impl common::ResponseResult for ListCustomersResponse {}
838
839/// Response message to list customers of the vendor.
840///
841/// # Activities
842///
843/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
844/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
845///
846/// * [vendors customers list partners](PartnerVendorCustomerListCall) (response)
847#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
848#[serde_with::serde_as]
849#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
850pub struct ListVendorCustomersResponse {
851    /// List of customers of the vendor.
852    pub customers: Option<Vec<Company>>,
853    /// A token to retrieve the next page of results. Omitted if no further results are available.
854    #[serde(rename = "nextPageToken")]
855    pub next_page_token: Option<String>,
856    /// The total count of items in the list irrespective of pagination.
857    #[serde(rename = "totalSize")]
858    pub total_size: Option<i32>,
859}
860
861impl common::ResponseResult for ListVendorCustomersResponse {}
862
863/// Response message to list vendors of the partner.
864///
865/// # Activities
866///
867/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
868/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
869///
870/// * [vendors list partners](PartnerVendorListCall) (response)
871#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
872#[serde_with::serde_as]
873#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
874pub struct ListVendorsResponse {
875    /// A token to retrieve the next page of results. Omitted if no further results are available.
876    #[serde(rename = "nextPageToken")]
877    pub next_page_token: Option<String>,
878    /// The total count of items in the list irrespective of pagination.
879    #[serde(rename = "totalSize")]
880    pub total_size: Option<i32>,
881    /// List of vendors of the reseller partner. Fields `name`, `companyId` and `companyName` are populated to the Company object.
882    pub vendors: Option<Vec<Company>>,
883}
884
885impl common::ResponseResult for ListVendorsResponse {}
886
887/// This resource represents a long-running operation that is the result of a network API call.
888///
889/// # Activities
890///
891/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
892/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
893///
894/// * [get operations](OperationGetCall) (response)
895/// * [devices claim async partners](PartnerDeviceClaimAsyncCall) (response)
896/// * [devices unclaim async partners](PartnerDeviceUnclaimAsyncCall) (response)
897/// * [devices update metadata async partners](PartnerDeviceUpdateMetadataAsyncCall) (response)
898#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
899#[serde_with::serde_as]
900#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
901pub struct Operation {
902    /// 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.
903    pub done: Option<bool>,
904    /// This field will always be not set if the operation is created by `claimAsync`, `unclaimAsync`, or `updateMetadataAsync`. In this case, error information for each device is set in `response.perDeviceStatus.result.status`.
905    pub error: Option<Status>,
906    /// This field will contain a `DevicesLongRunningOperationMetadata` object if the operation is created by `claimAsync`, `unclaimAsync`, or `updateMetadataAsync`.
907    pub metadata: Option<HashMap<String, serde_json::Value>>,
908    /// 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}`.
909    pub name: Option<String>,
910    /// This field will contain a `DevicesLongRunningOperationResponse` object if the operation is created by `claimAsync`, `unclaimAsync`, or `updateMetadataAsync`.
911    pub response: Option<HashMap<String, serde_json::Value>>,
912}
913
914impl common::Resource for Operation {}
915impl common::ResponseResult for Operation {}
916
917/// Identifies one claim request.
918///
919/// This type is not used in any activity, and only used as *part* of another schema.
920///
921#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
922#[serde_with::serde_as]
923#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
924pub struct PartnerClaim {
925    /// Optional. The ID of the configuration applied to the device section.
926    #[serde(rename = "configurationId")]
927    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
928    pub configuration_id: Option<i64>,
929    /// The ID of the customer for whom the device is being claimed.
930    #[serde(rename = "customerId")]
931    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
932    pub customer_id: Option<i64>,
933    /// Required. Required. Device identifier of the device.
934    #[serde(rename = "deviceIdentifier")]
935    pub device_identifier: Option<DeviceIdentifier>,
936    /// Required. The metadata to attach to the device at claim.
937    #[serde(rename = "deviceMetadata")]
938    pub device_metadata: Option<DeviceMetadata>,
939    /// The Google Workspace customer ID.
940    #[serde(rename = "googleWorkspaceCustomerId")]
941    pub google_workspace_customer_id: Option<String>,
942    /// Optional. Must and can only be set for Chrome OS devices.
943    #[serde(rename = "preProvisioningToken")]
944    pub pre_provisioning_token: Option<String>,
945    /// Required. The section type of the device's provisioning record.
946    #[serde(rename = "sectionType")]
947    pub section_type: Option<String>,
948    /// Optional. Must and can only be set when DeviceProvisioningSectionType is SECTION_TYPE_SIM_LOCK. The unique identifier of the SimLock profile.
949    #[serde(rename = "simlockProfileId")]
950    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
951    pub simlock_profile_id: Option<i64>,
952}
953
954impl common::Part for PartnerClaim {}
955
956/// Identifies one unclaim request.
957///
958/// This type is not used in any activity, and only used as *part* of another schema.
959///
960#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
961#[serde_with::serde_as]
962#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
963pub struct PartnerUnclaim {
964    /// Required. Device ID of the device.
965    #[serde(rename = "deviceId")]
966    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
967    pub device_id: Option<i64>,
968    /// Required. Device identifier of the device.
969    #[serde(rename = "deviceIdentifier")]
970    pub device_identifier: Option<DeviceIdentifier>,
971    /// Required. The section type of the device's provisioning record.
972    #[serde(rename = "sectionType")]
973    pub section_type: Option<String>,
974    /// Optional. The duration of the vacation unlock starting from when the request is processed. (1 day is treated as 24 hours)
975    #[serde(rename = "vacationModeDays")]
976    pub vacation_mode_days: Option<i32>,
977    /// Optional. The expiration time of the vacation unlock.
978    #[serde(rename = "vacationModeExpireTime")]
979    pub vacation_mode_expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
980}
981
982impl common::Part for PartnerUnclaim {}
983
984/// 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).
985///
986/// This type is not used in any activity, and only used as *part* of another schema.
987///
988#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
989#[serde_with::serde_as]
990#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
991pub struct Status {
992    /// The status code, which should be an enum value of google.rpc.Code.
993    pub code: Option<i32>,
994    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
995    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
996    /// 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.
997    pub message: Option<String>,
998}
999
1000impl common::Part for Status {}
1001
1002/// Request message to unclaim a device.
1003///
1004/// # Activities
1005///
1006/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1007/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1008///
1009/// * [devices unclaim partners](PartnerDeviceUnclaimCall) (request)
1010#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1011#[serde_with::serde_as]
1012#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1013pub struct UnclaimDeviceRequest {
1014    /// Required. The device ID returned by `ClaimDevice`.
1015    #[serde(rename = "deviceId")]
1016    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1017    pub device_id: Option<i64>,
1018    /// Required. The device identifier you used when you claimed this device.
1019    #[serde(rename = "deviceIdentifier")]
1020    pub device_identifier: Option<DeviceIdentifier>,
1021    /// Required. The section type of the device's provisioning record.
1022    #[serde(rename = "sectionType")]
1023    pub section_type: Option<String>,
1024    /// The duration of the vacation unlock starting from when the request is processed. (1 day is treated as 24 hours)
1025    #[serde(rename = "vacationModeDays")]
1026    pub vacation_mode_days: Option<i32>,
1027    /// The expiration time of the vacation unlock.
1028    #[serde(rename = "vacationModeExpireTime")]
1029    pub vacation_mode_expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1030}
1031
1032impl common::RequestValue for UnclaimDeviceRequest {}
1033
1034/// Request to unclaim devices asynchronously in batch.
1035///
1036/// # Activities
1037///
1038/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1039/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1040///
1041/// * [devices unclaim async partners](PartnerDeviceUnclaimAsyncCall) (request)
1042#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1043#[serde_with::serde_as]
1044#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1045pub struct UnclaimDevicesRequest {
1046    /// Required. The list of devices to unclaim.
1047    pub unclaims: Option<Vec<PartnerUnclaim>>,
1048}
1049
1050impl common::RequestValue for UnclaimDevicesRequest {}
1051
1052/// Request to update device metadata in batch.
1053///
1054/// # Activities
1055///
1056/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1057/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1058///
1059/// * [devices update metadata async partners](PartnerDeviceUpdateMetadataAsyncCall) (request)
1060#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1061#[serde_with::serde_as]
1062#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1063pub struct UpdateDeviceMetadataInBatchRequest {
1064    /// Required. The list of metadata updates.
1065    pub updates: Option<Vec<UpdateMetadataArguments>>,
1066}
1067
1068impl common::RequestValue for UpdateDeviceMetadataInBatchRequest {}
1069
1070/// Request to set metadata for a device.
1071///
1072/// # Activities
1073///
1074/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1075/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1076///
1077/// * [devices metadata partners](PartnerDeviceMetadataCall) (request)
1078#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1079#[serde_with::serde_as]
1080#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1081pub struct UpdateDeviceMetadataRequest {
1082    /// Required. The metadata to attach to the device.
1083    #[serde(rename = "deviceMetadata")]
1084    pub device_metadata: Option<DeviceMetadata>,
1085}
1086
1087impl common::RequestValue for UpdateDeviceMetadataRequest {}
1088
1089/// Identifies metadata updates to one device.
1090///
1091/// This type is not used in any activity, and only used as *part* of another schema.
1092///
1093#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1094#[serde_with::serde_as]
1095#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1096pub struct UpdateMetadataArguments {
1097    /// Required. Device ID of the device.
1098    #[serde(rename = "deviceId")]
1099    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1100    pub device_id: Option<i64>,
1101    /// Required. Device identifier.
1102    #[serde(rename = "deviceIdentifier")]
1103    pub device_identifier: Option<DeviceIdentifier>,
1104    /// Required. The metadata to update.
1105    #[serde(rename = "deviceMetadata")]
1106    pub device_metadata: Option<DeviceMetadata>,
1107}
1108
1109impl common::Part for UpdateMetadataArguments {}
1110
1111// ###################
1112// MethodBuilders ###
1113// #################
1114
1115/// A builder providing access to all methods supported on *customer* resources.
1116/// It is not used directly, but through the [`AndroidProvisioningPartner`] hub.
1117///
1118/// # Example
1119///
1120/// Instantiate a resource builder
1121///
1122/// ```test_harness,no_run
1123/// extern crate hyper;
1124/// extern crate hyper_rustls;
1125/// extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
1126///
1127/// # async fn dox() {
1128/// use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1129///
1130/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1131/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1132///     secret,
1133///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1134/// ).build().await.unwrap();
1135///
1136/// let client = hyper_util::client::legacy::Client::builder(
1137///     hyper_util::rt::TokioExecutor::new()
1138/// )
1139/// .build(
1140///     hyper_rustls::HttpsConnectorBuilder::new()
1141///         .with_native_roots()
1142///         .unwrap()
1143///         .https_or_http()
1144///         .enable_http1()
1145///         .build()
1146/// );
1147/// let mut hub = AndroidProvisioningPartner::new(client, auth);
1148/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1149/// // like `configurations_create(...)`, `configurations_delete(...)`, `configurations_get(...)`, `configurations_list(...)`, `configurations_patch(...)`, `devices_apply_configuration(...)`, `devices_get(...)`, `devices_list(...)`, `devices_remove_configuration(...)`, `devices_unclaim(...)`, `dpcs_list(...)` and `list(...)`
1150/// // to build up your call.
1151/// let rb = hub.customers();
1152/// # }
1153/// ```
1154pub struct CustomerMethods<'a, C>
1155where
1156    C: 'a,
1157{
1158    hub: &'a AndroidProvisioningPartner<C>,
1159}
1160
1161impl<'a, C> common::MethodsBuilder for CustomerMethods<'a, C> {}
1162
1163impl<'a, C> CustomerMethods<'a, C> {
1164    /// Create a builder to help you perform the following task:
1165    ///
1166    /// Creates a new configuration. Once created, a customer can apply the configuration to devices.
1167    ///
1168    /// # Arguments
1169    ///
1170    /// * `request` - No description provided.
1171    /// * `parent` - Required. The customer that manages the configuration. An API resource name in the format `customers/[CUSTOMER_ID]`. This field has custom validation in CreateConfigurationRequestValidator
1172    pub fn configurations_create(
1173        &self,
1174        request: Configuration,
1175        parent: &str,
1176    ) -> CustomerConfigurationCreateCall<'a, C> {
1177        CustomerConfigurationCreateCall {
1178            hub: self.hub,
1179            _request: request,
1180            _parent: parent.to_string(),
1181            _delegate: Default::default(),
1182            _additional_params: Default::default(),
1183        }
1184    }
1185
1186    /// Create a builder to help you perform the following task:
1187    ///
1188    /// Deletes an unused configuration. The API call fails if the customer has devices with the configuration applied.
1189    ///
1190    /// # Arguments
1191    ///
1192    /// * `name` - Required. The configuration to delete. An API resource name in the format `customers/[CUSTOMER_ID]/configurations/[CONFIGURATION_ID]`. If the configuration is applied to any devices, the API call fails.
1193    pub fn configurations_delete(&self, name: &str) -> CustomerConfigurationDeleteCall<'a, C> {
1194        CustomerConfigurationDeleteCall {
1195            hub: self.hub,
1196            _name: name.to_string(),
1197            _delegate: Default::default(),
1198            _additional_params: Default::default(),
1199        }
1200    }
1201
1202    /// Create a builder to help you perform the following task:
1203    ///
1204    /// Gets the details of a configuration.
1205    ///
1206    /// # Arguments
1207    ///
1208    /// * `name` - Required. The configuration to get. An API resource name in the format `customers/[CUSTOMER_ID]/configurations/[CONFIGURATION_ID]`.
1209    pub fn configurations_get(&self, name: &str) -> CustomerConfigurationGetCall<'a, C> {
1210        CustomerConfigurationGetCall {
1211            hub: self.hub,
1212            _name: name.to_string(),
1213            _delegate: Default::default(),
1214            _additional_params: Default::default(),
1215        }
1216    }
1217
1218    /// Create a builder to help you perform the following task:
1219    ///
1220    /// Lists a customer's configurations.
1221    ///
1222    /// # Arguments
1223    ///
1224    /// * `parent` - Required. The customer that manages the listed configurations. An API resource name in the format `customers/[CUSTOMER_ID]`.
1225    pub fn configurations_list(&self, parent: &str) -> CustomerConfigurationListCall<'a, C> {
1226        CustomerConfigurationListCall {
1227            hub: self.hub,
1228            _parent: parent.to_string(),
1229            _delegate: Default::default(),
1230            _additional_params: Default::default(),
1231        }
1232    }
1233
1234    /// Create a builder to help you perform the following task:
1235    ///
1236    /// Updates a configuration's field values.
1237    ///
1238    /// # Arguments
1239    ///
1240    /// * `request` - No description provided.
1241    /// * `name` - Output only. The API resource name in the format `customers/[CUSTOMER_ID]/configurations/[CONFIGURATION_ID]`. Assigned by the server.
1242    pub fn configurations_patch(
1243        &self,
1244        request: Configuration,
1245        name: &str,
1246    ) -> CustomerConfigurationPatchCall<'a, C> {
1247        CustomerConfigurationPatchCall {
1248            hub: self.hub,
1249            _request: request,
1250            _name: name.to_string(),
1251            _update_mask: Default::default(),
1252            _delegate: Default::default(),
1253            _additional_params: Default::default(),
1254        }
1255    }
1256
1257    /// Create a builder to help you perform the following task:
1258    ///
1259    /// Applies a Configuration to the device to register the device for zero-touch enrollment. After applying a configuration to a device, the device automatically provisions itself on first boot, or next factory reset.
1260    ///
1261    /// # Arguments
1262    ///
1263    /// * `request` - No description provided.
1264    /// * `parent` - Required. The customer managing the device. An API resource name in the format `customers/[CUSTOMER_ID]`.
1265    pub fn devices_apply_configuration(
1266        &self,
1267        request: CustomerApplyConfigurationRequest,
1268        parent: &str,
1269    ) -> CustomerDeviceApplyConfigurationCall<'a, C> {
1270        CustomerDeviceApplyConfigurationCall {
1271            hub: self.hub,
1272            _request: request,
1273            _parent: parent.to_string(),
1274            _delegate: Default::default(),
1275            _additional_params: Default::default(),
1276        }
1277    }
1278
1279    /// Create a builder to help you perform the following task:
1280    ///
1281    /// Gets the details of a device.
1282    ///
1283    /// # Arguments
1284    ///
1285    /// * `name` - Required. The device to get. An API resource name in the format `customers/[CUSTOMER_ID]/devices/[DEVICE_ID]`.
1286    pub fn devices_get(&self, name: &str) -> CustomerDeviceGetCall<'a, C> {
1287        CustomerDeviceGetCall {
1288            hub: self.hub,
1289            _name: name.to_string(),
1290            _delegate: Default::default(),
1291            _additional_params: Default::default(),
1292        }
1293    }
1294
1295    /// Create a builder to help you perform the following task:
1296    ///
1297    /// Lists a customer's devices.
1298    ///
1299    /// # Arguments
1300    ///
1301    /// * `parent` - Required. The customer managing the devices. An API resource name in the format `customers/[CUSTOMER_ID]`.
1302    pub fn devices_list(&self, parent: &str) -> CustomerDeviceListCall<'a, C> {
1303        CustomerDeviceListCall {
1304            hub: self.hub,
1305            _parent: parent.to_string(),
1306            _page_token: Default::default(),
1307            _page_size: Default::default(),
1308            _delegate: Default::default(),
1309            _additional_params: Default::default(),
1310        }
1311    }
1312
1313    /// Create a builder to help you perform the following task:
1314    ///
1315    /// Removes a configuration from device.
1316    ///
1317    /// # Arguments
1318    ///
1319    /// * `request` - No description provided.
1320    /// * `parent` - Required. The customer managing the device in the format `customers/[CUSTOMER_ID]`.
1321    pub fn devices_remove_configuration(
1322        &self,
1323        request: CustomerRemoveConfigurationRequest,
1324        parent: &str,
1325    ) -> CustomerDeviceRemoveConfigurationCall<'a, C> {
1326        CustomerDeviceRemoveConfigurationCall {
1327            hub: self.hub,
1328            _request: request,
1329            _parent: parent.to_string(),
1330            _delegate: Default::default(),
1331            _additional_params: Default::default(),
1332        }
1333    }
1334
1335    /// Create a builder to help you perform the following task:
1336    ///
1337    /// Unclaims a device from a customer and removes it from zero-touch enrollment. After removing a device, a customer must contact their reseller to register the device into zero-touch enrollment again.
1338    ///
1339    /// # Arguments
1340    ///
1341    /// * `request` - No description provided.
1342    /// * `parent` - Required. The customer managing the device. An API resource name in the format `customers/[CUSTOMER_ID]`.
1343    pub fn devices_unclaim(
1344        &self,
1345        request: CustomerUnclaimDeviceRequest,
1346        parent: &str,
1347    ) -> CustomerDeviceUnclaimCall<'a, C> {
1348        CustomerDeviceUnclaimCall {
1349            hub: self.hub,
1350            _request: request,
1351            _parent: parent.to_string(),
1352            _delegate: Default::default(),
1353            _additional_params: Default::default(),
1354        }
1355    }
1356
1357    /// Create a builder to help you perform the following task:
1358    ///
1359    /// Lists the DPCs (device policy controllers) that support zero-touch enrollment.
1360    ///
1361    /// # Arguments
1362    ///
1363    /// * `parent` - Required. The customer that can use the DPCs in configurations. An API resource name in the format `customers/[CUSTOMER_ID]`.
1364    pub fn dpcs_list(&self, parent: &str) -> CustomerDpcListCall<'a, C> {
1365        CustomerDpcListCall {
1366            hub: self.hub,
1367            _parent: parent.to_string(),
1368            _delegate: Default::default(),
1369            _additional_params: Default::default(),
1370        }
1371    }
1372
1373    /// Create a builder to help you perform the following task:
1374    ///
1375    /// Lists the user's customer accounts.
1376    pub fn list(&self) -> CustomerListCall<'a, C> {
1377        CustomerListCall {
1378            hub: self.hub,
1379            _page_token: Default::default(),
1380            _page_size: Default::default(),
1381            _delegate: Default::default(),
1382            _additional_params: Default::default(),
1383        }
1384    }
1385}
1386
1387/// A builder providing access to all methods supported on *operation* resources.
1388/// It is not used directly, but through the [`AndroidProvisioningPartner`] hub.
1389///
1390/// # Example
1391///
1392/// Instantiate a resource builder
1393///
1394/// ```test_harness,no_run
1395/// extern crate hyper;
1396/// extern crate hyper_rustls;
1397/// extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
1398///
1399/// # async fn dox() {
1400/// use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1401///
1402/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1403/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1404///     secret,
1405///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1406/// ).build().await.unwrap();
1407///
1408/// let client = hyper_util::client::legacy::Client::builder(
1409///     hyper_util::rt::TokioExecutor::new()
1410/// )
1411/// .build(
1412///     hyper_rustls::HttpsConnectorBuilder::new()
1413///         .with_native_roots()
1414///         .unwrap()
1415///         .https_or_http()
1416///         .enable_http1()
1417///         .build()
1418/// );
1419/// let mut hub = AndroidProvisioningPartner::new(client, auth);
1420/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1421/// // like `get(...)`
1422/// // to build up your call.
1423/// let rb = hub.operations();
1424/// # }
1425/// ```
1426pub struct OperationMethods<'a, C>
1427where
1428    C: 'a,
1429{
1430    hub: &'a AndroidProvisioningPartner<C>,
1431}
1432
1433impl<'a, C> common::MethodsBuilder for OperationMethods<'a, C> {}
1434
1435impl<'a, C> OperationMethods<'a, C> {
1436    /// Create a builder to help you perform the following task:
1437    ///
1438    /// 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.
1439    ///
1440    /// # Arguments
1441    ///
1442    /// * `name` - The name of the operation resource.
1443    pub fn get(&self, name: &str) -> OperationGetCall<'a, C> {
1444        OperationGetCall {
1445            hub: self.hub,
1446            _name: name.to_string(),
1447            _delegate: Default::default(),
1448            _additional_params: Default::default(),
1449        }
1450    }
1451}
1452
1453/// A builder providing access to all methods supported on *partner* resources.
1454/// It is not used directly, but through the [`AndroidProvisioningPartner`] hub.
1455///
1456/// # Example
1457///
1458/// Instantiate a resource builder
1459///
1460/// ```test_harness,no_run
1461/// extern crate hyper;
1462/// extern crate hyper_rustls;
1463/// extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
1464///
1465/// # async fn dox() {
1466/// use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1467///
1468/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1469/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1470///     secret,
1471///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1472/// ).build().await.unwrap();
1473///
1474/// let client = hyper_util::client::legacy::Client::builder(
1475///     hyper_util::rt::TokioExecutor::new()
1476/// )
1477/// .build(
1478///     hyper_rustls::HttpsConnectorBuilder::new()
1479///         .with_native_roots()
1480///         .unwrap()
1481///         .https_or_http()
1482///         .enable_http1()
1483///         .build()
1484/// );
1485/// let mut hub = AndroidProvisioningPartner::new(client, auth);
1486/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1487/// // like `customers_create(...)`, `customers_list(...)`, `devices_claim(...)`, `devices_claim_async(...)`, `devices_find_by_identifier(...)`, `devices_find_by_owner(...)`, `devices_get(...)`, `devices_get_sim_lock_state(...)`, `devices_metadata(...)`, `devices_unclaim(...)`, `devices_unclaim_async(...)`, `devices_update_metadata_async(...)`, `vendors_customers_list(...)` and `vendors_list(...)`
1488/// // to build up your call.
1489/// let rb = hub.partners();
1490/// # }
1491/// ```
1492pub struct PartnerMethods<'a, C>
1493where
1494    C: 'a,
1495{
1496    hub: &'a AndroidProvisioningPartner<C>,
1497}
1498
1499impl<'a, C> common::MethodsBuilder for PartnerMethods<'a, C> {}
1500
1501impl<'a, C> PartnerMethods<'a, C> {
1502    /// Create a builder to help you perform the following task:
1503    ///
1504    /// Creates a customer for zero-touch enrollment. After the method returns successfully, admin and owner roles can manage devices and EMM configs by calling API methods or using their zero-touch enrollment portal. The customer receives an email that welcomes them to zero-touch enrollment and explains how to sign into the portal.
1505    ///
1506    /// # Arguments
1507    ///
1508    /// * `request` - No description provided.
1509    /// * `parent` - Required. The parent resource ID in the format `partners/[PARTNER_ID]` that identifies the reseller.
1510    pub fn customers_create(
1511        &self,
1512        request: CreateCustomerRequest,
1513        parent: &str,
1514    ) -> PartnerCustomerCreateCall<'a, C> {
1515        PartnerCustomerCreateCall {
1516            hub: self.hub,
1517            _request: request,
1518            _parent: parent.to_string(),
1519            _delegate: Default::default(),
1520            _additional_params: Default::default(),
1521        }
1522    }
1523
1524    /// Create a builder to help you perform the following task:
1525    ///
1526    /// Lists the customers that are enrolled to the reseller identified by the `partnerId` argument. This list includes customers that the reseller created and customers that enrolled themselves using the portal.
1527    ///
1528    /// # Arguments
1529    ///
1530    /// * `partnerId` - Required. The ID of the reseller partner.
1531    pub fn customers_list(&self, partner_id: i64) -> PartnerCustomerListCall<'a, C> {
1532        PartnerCustomerListCall {
1533            hub: self.hub,
1534            _partner_id: partner_id,
1535            _page_token: Default::default(),
1536            _page_size: Default::default(),
1537            _delegate: Default::default(),
1538            _additional_params: Default::default(),
1539        }
1540    }
1541
1542    /// Create a builder to help you perform the following task:
1543    ///
1544    /// Claims a device for a customer and adds it to zero-touch enrollment. If the device is already claimed by another customer, the call returns an error.
1545    ///
1546    /// # Arguments
1547    ///
1548    /// * `request` - No description provided.
1549    /// * `partnerId` - Required. The ID of the reseller partner.
1550    pub fn devices_claim(
1551        &self,
1552        request: ClaimDeviceRequest,
1553        partner_id: i64,
1554    ) -> PartnerDeviceClaimCall<'a, C> {
1555        PartnerDeviceClaimCall {
1556            hub: self.hub,
1557            _request: request,
1558            _partner_id: partner_id,
1559            _delegate: Default::default(),
1560            _additional_params: Default::default(),
1561        }
1562    }
1563
1564    /// Create a builder to help you perform the following task:
1565    ///
1566    /// Claims a batch of devices for a customer asynchronously. Adds the devices to zero-touch enrollment. To learn more, read [Long‑running batch operations](https://developers.google.com/zero-touch/guides/how-it-works#operations).
1567    ///
1568    /// # Arguments
1569    ///
1570    /// * `request` - No description provided.
1571    /// * `partnerId` - Required. The ID of the reseller partner.
1572    pub fn devices_claim_async(
1573        &self,
1574        request: ClaimDevicesRequest,
1575        partner_id: i64,
1576    ) -> PartnerDeviceClaimAsyncCall<'a, C> {
1577        PartnerDeviceClaimAsyncCall {
1578            hub: self.hub,
1579            _request: request,
1580            _partner_id: partner_id,
1581            _delegate: Default::default(),
1582            _additional_params: Default::default(),
1583        }
1584    }
1585
1586    /// Create a builder to help you perform the following task:
1587    ///
1588    /// Finds devices by hardware identifiers, such as IMEI.
1589    ///
1590    /// # Arguments
1591    ///
1592    /// * `request` - No description provided.
1593    /// * `partnerId` - Required. The ID of the reseller partner.
1594    pub fn devices_find_by_identifier(
1595        &self,
1596        request: FindDevicesByDeviceIdentifierRequest,
1597        partner_id: i64,
1598    ) -> PartnerDeviceFindByIdentifierCall<'a, C> {
1599        PartnerDeviceFindByIdentifierCall {
1600            hub: self.hub,
1601            _request: request,
1602            _partner_id: partner_id,
1603            _delegate: Default::default(),
1604            _additional_params: Default::default(),
1605        }
1606    }
1607
1608    /// Create a builder to help you perform the following task:
1609    ///
1610    /// Finds devices claimed for customers. The results only contain devices registered to the reseller that's identified by the `partnerId` argument. The customer's devices purchased from other resellers don't appear in the results.
1611    ///
1612    /// # Arguments
1613    ///
1614    /// * `request` - No description provided.
1615    /// * `partnerId` - Required. The ID of the reseller partner.
1616    pub fn devices_find_by_owner(
1617        &self,
1618        request: FindDevicesByOwnerRequest,
1619        partner_id: i64,
1620    ) -> PartnerDeviceFindByOwnerCall<'a, C> {
1621        PartnerDeviceFindByOwnerCall {
1622            hub: self.hub,
1623            _request: request,
1624            _partner_id: partner_id,
1625            _delegate: Default::default(),
1626            _additional_params: Default::default(),
1627        }
1628    }
1629
1630    /// Create a builder to help you perform the following task:
1631    ///
1632    /// Gets a device.
1633    ///
1634    /// # Arguments
1635    ///
1636    /// * `name` - Required. The device API resource name in the format `partners/[PARTNER_ID]/devices/[DEVICE_ID]`.
1637    pub fn devices_get(&self, name: &str) -> PartnerDeviceGetCall<'a, C> {
1638        PartnerDeviceGetCall {
1639            hub: self.hub,
1640            _name: name.to_string(),
1641            _delegate: Default::default(),
1642            _additional_params: Default::default(),
1643        }
1644    }
1645
1646    /// Create a builder to help you perform the following task:
1647    ///
1648    /// Gets a device's SIM lock state.
1649    ///
1650    /// # Arguments
1651    ///
1652    /// * `request` - No description provided.
1653    /// * `partnerId` - Required. The ID of the partner.
1654    pub fn devices_get_sim_lock_state(
1655        &self,
1656        request: GetDeviceSimLockStateRequest,
1657        partner_id: i64,
1658    ) -> PartnerDeviceGetSimLockStateCall<'a, C> {
1659        PartnerDeviceGetSimLockStateCall {
1660            hub: self.hub,
1661            _request: request,
1662            _partner_id: partner_id,
1663            _delegate: Default::default(),
1664            _additional_params: Default::default(),
1665        }
1666    }
1667
1668    /// Create a builder to help you perform the following task:
1669    ///
1670    /// Updates reseller metadata associated with the device. Android devices only.
1671    ///
1672    /// # Arguments
1673    ///
1674    /// * `request` - No description provided.
1675    /// * `metadataOwnerId` - Required. The owner of the newly set metadata. Set this to the partner ID.
1676    /// * `deviceId` - Required. The ID of the device.
1677    pub fn devices_metadata(
1678        &self,
1679        request: UpdateDeviceMetadataRequest,
1680        metadata_owner_id: i64,
1681        device_id: i64,
1682    ) -> PartnerDeviceMetadataCall<'a, C> {
1683        PartnerDeviceMetadataCall {
1684            hub: self.hub,
1685            _request: request,
1686            _metadata_owner_id: metadata_owner_id,
1687            _device_id: device_id,
1688            _delegate: Default::default(),
1689            _additional_params: Default::default(),
1690        }
1691    }
1692
1693    /// Create a builder to help you perform the following task:
1694    ///
1695    /// Unclaims a device from a customer and removes it from zero-touch enrollment.
1696    ///
1697    /// # Arguments
1698    ///
1699    /// * `request` - No description provided.
1700    /// * `partnerId` - Required. The ID of the reseller partner.
1701    pub fn devices_unclaim(
1702        &self,
1703        request: UnclaimDeviceRequest,
1704        partner_id: i64,
1705    ) -> PartnerDeviceUnclaimCall<'a, C> {
1706        PartnerDeviceUnclaimCall {
1707            hub: self.hub,
1708            _request: request,
1709            _partner_id: partner_id,
1710            _delegate: Default::default(),
1711            _additional_params: Default::default(),
1712        }
1713    }
1714
1715    /// Create a builder to help you perform the following task:
1716    ///
1717    /// Unclaims a batch of devices for a customer asynchronously. Removes the devices from zero-touch enrollment. To learn more, read [Long‑running batch operations](https://developers.google.com/zero-touch/guides/how-it-works#operations).
1718    ///
1719    /// # Arguments
1720    ///
1721    /// * `request` - No description provided.
1722    /// * `partnerId` - Required. The reseller partner ID.
1723    pub fn devices_unclaim_async(
1724        &self,
1725        request: UnclaimDevicesRequest,
1726        partner_id: i64,
1727    ) -> PartnerDeviceUnclaimAsyncCall<'a, C> {
1728        PartnerDeviceUnclaimAsyncCall {
1729            hub: self.hub,
1730            _request: request,
1731            _partner_id: partner_id,
1732            _delegate: Default::default(),
1733            _additional_params: Default::default(),
1734        }
1735    }
1736
1737    /// Create a builder to help you perform the following task:
1738    ///
1739    /// Updates the reseller metadata attached to a batch of devices. This method updates devices asynchronously and returns an `Operation` that can be used to track progress. Read [Long‑running batch operations](https://developers.google.com/zero-touch/guides/how-it-works#operations). Android Devices only.
1740    ///
1741    /// # Arguments
1742    ///
1743    /// * `request` - No description provided.
1744    /// * `partnerId` - Required. The reseller partner ID.
1745    pub fn devices_update_metadata_async(
1746        &self,
1747        request: UpdateDeviceMetadataInBatchRequest,
1748        partner_id: i64,
1749    ) -> PartnerDeviceUpdateMetadataAsyncCall<'a, C> {
1750        PartnerDeviceUpdateMetadataAsyncCall {
1751            hub: self.hub,
1752            _request: request,
1753            _partner_id: partner_id,
1754            _delegate: Default::default(),
1755            _additional_params: Default::default(),
1756        }
1757    }
1758
1759    /// Create a builder to help you perform the following task:
1760    ///
1761    /// Lists the customers of the vendor.
1762    ///
1763    /// # Arguments
1764    ///
1765    /// * `parent` - Required. The resource name in the format `partners/[PARTNER_ID]/vendors/[VENDOR_ID]`.
1766    pub fn vendors_customers_list(&self, parent: &str) -> PartnerVendorCustomerListCall<'a, C> {
1767        PartnerVendorCustomerListCall {
1768            hub: self.hub,
1769            _parent: parent.to_string(),
1770            _page_token: Default::default(),
1771            _page_size: Default::default(),
1772            _delegate: Default::default(),
1773            _additional_params: Default::default(),
1774        }
1775    }
1776
1777    /// Create a builder to help you perform the following task:
1778    ///
1779    /// Lists the vendors of the partner.
1780    ///
1781    /// # Arguments
1782    ///
1783    /// * `parent` - Required. The resource name in the format `partners/[PARTNER_ID]`.
1784    pub fn vendors_list(&self, parent: &str) -> PartnerVendorListCall<'a, C> {
1785        PartnerVendorListCall {
1786            hub: self.hub,
1787            _parent: parent.to_string(),
1788            _page_token: Default::default(),
1789            _page_size: Default::default(),
1790            _delegate: Default::default(),
1791            _additional_params: Default::default(),
1792        }
1793    }
1794}
1795
1796// ###################
1797// CallBuilders   ###
1798// #################
1799
1800/// Creates a new configuration. Once created, a customer can apply the configuration to devices.
1801///
1802/// A builder for the *configurations.create* method supported by a *customer* resource.
1803/// It is not used directly, but through a [`CustomerMethods`] instance.
1804///
1805/// # Example
1806///
1807/// Instantiate a resource method builder
1808///
1809/// ```test_harness,no_run
1810/// # extern crate hyper;
1811/// # extern crate hyper_rustls;
1812/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
1813/// use androiddeviceprovisioning1::api::Configuration;
1814/// # async fn dox() {
1815/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1816///
1817/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1818/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1819/// #     secret,
1820/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1821/// # ).build().await.unwrap();
1822///
1823/// # let client = hyper_util::client::legacy::Client::builder(
1824/// #     hyper_util::rt::TokioExecutor::new()
1825/// # )
1826/// # .build(
1827/// #     hyper_rustls::HttpsConnectorBuilder::new()
1828/// #         .with_native_roots()
1829/// #         .unwrap()
1830/// #         .https_or_http()
1831/// #         .enable_http1()
1832/// #         .build()
1833/// # );
1834/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
1835/// // As the method needs a request, you would usually fill it with the desired information
1836/// // into the respective structure. Some of the parts shown here might not be applicable !
1837/// // Values shown here are possibly random and not representative !
1838/// let mut req = Configuration::default();
1839///
1840/// // You can configure optional parameters by calling the respective setters at will, and
1841/// // execute the final call using `doit()`.
1842/// // Values shown here are possibly random and not representative !
1843/// let result = hub.customers().configurations_create(req, "parent")
1844///              .doit().await;
1845/// # }
1846/// ```
1847pub struct CustomerConfigurationCreateCall<'a, C>
1848where
1849    C: 'a,
1850{
1851    hub: &'a AndroidProvisioningPartner<C>,
1852    _request: Configuration,
1853    _parent: String,
1854    _delegate: Option<&'a mut dyn common::Delegate>,
1855    _additional_params: HashMap<String, String>,
1856}
1857
1858impl<'a, C> common::CallBuilder for CustomerConfigurationCreateCall<'a, C> {}
1859
1860impl<'a, C> CustomerConfigurationCreateCall<'a, C>
1861where
1862    C: common::Connector,
1863{
1864    /// Perform the operation you have build so far.
1865    pub async fn doit(mut self) -> common::Result<(common::Response, Configuration)> {
1866        use std::borrow::Cow;
1867        use std::io::{Read, Seek};
1868
1869        use common::{url::Params, ToParts};
1870        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1871
1872        let mut dd = common::DefaultDelegate;
1873        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1874        dlg.begin(common::MethodInfo {
1875            id: "androiddeviceprovisioning.customers.configurations.create",
1876            http_method: hyper::Method::POST,
1877        });
1878
1879        for &field in ["alt", "parent"].iter() {
1880            if self._additional_params.contains_key(field) {
1881                dlg.finished(false);
1882                return Err(common::Error::FieldClash(field));
1883            }
1884        }
1885
1886        let mut params = Params::with_capacity(4 + self._additional_params.len());
1887        params.push("parent", self._parent);
1888
1889        params.extend(self._additional_params.iter());
1890
1891        params.push("alt", "json");
1892        let mut url = self.hub._base_url.clone() + "v1/{+parent}/configurations";
1893
1894        match dlg.api_key() {
1895            Some(value) => params.push("key", value),
1896            None => {
1897                dlg.finished(false);
1898                return Err(common::Error::MissingAPIKey);
1899            }
1900        }
1901
1902        #[allow(clippy::single_element_loop)]
1903        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1904            url = params.uri_replacement(url, param_name, find_this, true);
1905        }
1906        {
1907            let to_remove = ["parent"];
1908            params.remove_params(&to_remove);
1909        }
1910
1911        let url = params.parse_with_url(&url);
1912
1913        let mut json_mime_type = mime::APPLICATION_JSON;
1914        let mut request_value_reader = {
1915            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1916            common::remove_json_null_values(&mut value);
1917            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1918            serde_json::to_writer(&mut dst, &value).unwrap();
1919            dst
1920        };
1921        let request_size = request_value_reader
1922            .seek(std::io::SeekFrom::End(0))
1923            .unwrap();
1924        request_value_reader
1925            .seek(std::io::SeekFrom::Start(0))
1926            .unwrap();
1927
1928        loop {
1929            request_value_reader
1930                .seek(std::io::SeekFrom::Start(0))
1931                .unwrap();
1932            let mut req_result = {
1933                let client = &self.hub.client;
1934                dlg.pre_request();
1935                let mut req_builder = hyper::Request::builder()
1936                    .method(hyper::Method::POST)
1937                    .uri(url.as_str())
1938                    .header(USER_AGENT, self.hub._user_agent.clone());
1939
1940                let request = req_builder
1941                    .header(CONTENT_TYPE, json_mime_type.to_string())
1942                    .header(CONTENT_LENGTH, request_size as u64)
1943                    .body(common::to_body(
1944                        request_value_reader.get_ref().clone().into(),
1945                    ));
1946
1947                client.request(request.unwrap()).await
1948            };
1949
1950            match req_result {
1951                Err(err) => {
1952                    if let common::Retry::After(d) = dlg.http_error(&err) {
1953                        sleep(d).await;
1954                        continue;
1955                    }
1956                    dlg.finished(false);
1957                    return Err(common::Error::HttpError(err));
1958                }
1959                Ok(res) => {
1960                    let (mut parts, body) = res.into_parts();
1961                    let mut body = common::Body::new(body);
1962                    if !parts.status.is_success() {
1963                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1964                        let error = serde_json::from_str(&common::to_string(&bytes));
1965                        let response = common::to_response(parts, bytes.into());
1966
1967                        if let common::Retry::After(d) =
1968                            dlg.http_failure(&response, error.as_ref().ok())
1969                        {
1970                            sleep(d).await;
1971                            continue;
1972                        }
1973
1974                        dlg.finished(false);
1975
1976                        return Err(match error {
1977                            Ok(value) => common::Error::BadRequest(value),
1978                            _ => common::Error::Failure(response),
1979                        });
1980                    }
1981                    let response = {
1982                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1983                        let encoded = common::to_string(&bytes);
1984                        match serde_json::from_str(&encoded) {
1985                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1986                            Err(error) => {
1987                                dlg.response_json_decode_error(&encoded, &error);
1988                                return Err(common::Error::JsonDecodeError(
1989                                    encoded.to_string(),
1990                                    error,
1991                                ));
1992                            }
1993                        }
1994                    };
1995
1996                    dlg.finished(true);
1997                    return Ok(response);
1998                }
1999            }
2000        }
2001    }
2002
2003    ///
2004    /// Sets the *request* property to the given value.
2005    ///
2006    /// Even though the property as already been set when instantiating this call,
2007    /// we provide this method for API completeness.
2008    pub fn request(mut self, new_value: Configuration) -> CustomerConfigurationCreateCall<'a, C> {
2009        self._request = new_value;
2010        self
2011    }
2012    /// Required. The customer that manages the configuration. An API resource name in the format `customers/[CUSTOMER_ID]`. This field has custom validation in CreateConfigurationRequestValidator
2013    ///
2014    /// Sets the *parent* path property to the given value.
2015    ///
2016    /// Even though the property as already been set when instantiating this call,
2017    /// we provide this method for API completeness.
2018    pub fn parent(mut self, new_value: &str) -> CustomerConfigurationCreateCall<'a, C> {
2019        self._parent = new_value.to_string();
2020        self
2021    }
2022    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2023    /// while executing the actual API request.
2024    ///
2025    /// ````text
2026    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2027    /// ````
2028    ///
2029    /// Sets the *delegate* property to the given value.
2030    pub fn delegate(
2031        mut self,
2032        new_value: &'a mut dyn common::Delegate,
2033    ) -> CustomerConfigurationCreateCall<'a, C> {
2034        self._delegate = Some(new_value);
2035        self
2036    }
2037
2038    /// Set any additional parameter of the query string used in the request.
2039    /// It should be used to set parameters which are not yet available through their own
2040    /// setters.
2041    ///
2042    /// Please note that this method must not be used to set any of the known parameters
2043    /// which have their own setter method. If done anyway, the request will fail.
2044    ///
2045    /// # Additional Parameters
2046    ///
2047    /// * *$.xgafv* (query-string) - V1 error format.
2048    /// * *access_token* (query-string) - OAuth access token.
2049    /// * *alt* (query-string) - Data format for response.
2050    /// * *callback* (query-string) - JSONP
2051    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2052    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2053    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2054    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2055    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2056    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2057    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2058    pub fn param<T>(mut self, name: T, value: T) -> CustomerConfigurationCreateCall<'a, C>
2059    where
2060        T: AsRef<str>,
2061    {
2062        self._additional_params
2063            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2064        self
2065    }
2066}
2067
2068/// Deletes an unused configuration. The API call fails if the customer has devices with the configuration applied.
2069///
2070/// A builder for the *configurations.delete* method supported by a *customer* resource.
2071/// It is not used directly, but through a [`CustomerMethods`] instance.
2072///
2073/// # Example
2074///
2075/// Instantiate a resource method builder
2076///
2077/// ```test_harness,no_run
2078/// # extern crate hyper;
2079/// # extern crate hyper_rustls;
2080/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
2081/// # async fn dox() {
2082/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2083///
2084/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2085/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2086/// #     secret,
2087/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2088/// # ).build().await.unwrap();
2089///
2090/// # let client = hyper_util::client::legacy::Client::builder(
2091/// #     hyper_util::rt::TokioExecutor::new()
2092/// # )
2093/// # .build(
2094/// #     hyper_rustls::HttpsConnectorBuilder::new()
2095/// #         .with_native_roots()
2096/// #         .unwrap()
2097/// #         .https_or_http()
2098/// #         .enable_http1()
2099/// #         .build()
2100/// # );
2101/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
2102/// // You can configure optional parameters by calling the respective setters at will, and
2103/// // execute the final call using `doit()`.
2104/// // Values shown here are possibly random and not representative !
2105/// let result = hub.customers().configurations_delete("name")
2106///              .doit().await;
2107/// # }
2108/// ```
2109pub struct CustomerConfigurationDeleteCall<'a, C>
2110where
2111    C: 'a,
2112{
2113    hub: &'a AndroidProvisioningPartner<C>,
2114    _name: String,
2115    _delegate: Option<&'a mut dyn common::Delegate>,
2116    _additional_params: HashMap<String, String>,
2117}
2118
2119impl<'a, C> common::CallBuilder for CustomerConfigurationDeleteCall<'a, C> {}
2120
2121impl<'a, C> CustomerConfigurationDeleteCall<'a, C>
2122where
2123    C: common::Connector,
2124{
2125    /// Perform the operation you have build so far.
2126    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
2127        use std::borrow::Cow;
2128        use std::io::{Read, Seek};
2129
2130        use common::{url::Params, ToParts};
2131        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2132
2133        let mut dd = common::DefaultDelegate;
2134        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2135        dlg.begin(common::MethodInfo {
2136            id: "androiddeviceprovisioning.customers.configurations.delete",
2137            http_method: hyper::Method::DELETE,
2138        });
2139
2140        for &field in ["alt", "name"].iter() {
2141            if self._additional_params.contains_key(field) {
2142                dlg.finished(false);
2143                return Err(common::Error::FieldClash(field));
2144            }
2145        }
2146
2147        let mut params = Params::with_capacity(3 + self._additional_params.len());
2148        params.push("name", self._name);
2149
2150        params.extend(self._additional_params.iter());
2151
2152        params.push("alt", "json");
2153        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2154
2155        match dlg.api_key() {
2156            Some(value) => params.push("key", value),
2157            None => {
2158                dlg.finished(false);
2159                return Err(common::Error::MissingAPIKey);
2160            }
2161        }
2162
2163        #[allow(clippy::single_element_loop)]
2164        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2165            url = params.uri_replacement(url, param_name, find_this, true);
2166        }
2167        {
2168            let to_remove = ["name"];
2169            params.remove_params(&to_remove);
2170        }
2171
2172        let url = params.parse_with_url(&url);
2173
2174        loop {
2175            let mut req_result = {
2176                let client = &self.hub.client;
2177                dlg.pre_request();
2178                let mut req_builder = hyper::Request::builder()
2179                    .method(hyper::Method::DELETE)
2180                    .uri(url.as_str())
2181                    .header(USER_AGENT, self.hub._user_agent.clone());
2182
2183                let request = req_builder
2184                    .header(CONTENT_LENGTH, 0_u64)
2185                    .body(common::to_body::<String>(None));
2186
2187                client.request(request.unwrap()).await
2188            };
2189
2190            match req_result {
2191                Err(err) => {
2192                    if let common::Retry::After(d) = dlg.http_error(&err) {
2193                        sleep(d).await;
2194                        continue;
2195                    }
2196                    dlg.finished(false);
2197                    return Err(common::Error::HttpError(err));
2198                }
2199                Ok(res) => {
2200                    let (mut parts, body) = res.into_parts();
2201                    let mut body = common::Body::new(body);
2202                    if !parts.status.is_success() {
2203                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2204                        let error = serde_json::from_str(&common::to_string(&bytes));
2205                        let response = common::to_response(parts, bytes.into());
2206
2207                        if let common::Retry::After(d) =
2208                            dlg.http_failure(&response, error.as_ref().ok())
2209                        {
2210                            sleep(d).await;
2211                            continue;
2212                        }
2213
2214                        dlg.finished(false);
2215
2216                        return Err(match error {
2217                            Ok(value) => common::Error::BadRequest(value),
2218                            _ => common::Error::Failure(response),
2219                        });
2220                    }
2221                    let response = {
2222                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2223                        let encoded = common::to_string(&bytes);
2224                        match serde_json::from_str(&encoded) {
2225                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2226                            Err(error) => {
2227                                dlg.response_json_decode_error(&encoded, &error);
2228                                return Err(common::Error::JsonDecodeError(
2229                                    encoded.to_string(),
2230                                    error,
2231                                ));
2232                            }
2233                        }
2234                    };
2235
2236                    dlg.finished(true);
2237                    return Ok(response);
2238                }
2239            }
2240        }
2241    }
2242
2243    /// Required. The configuration to delete. An API resource name in the format `customers/[CUSTOMER_ID]/configurations/[CONFIGURATION_ID]`. If the configuration is applied to any devices, the API call fails.
2244    ///
2245    /// Sets the *name* path property to the given value.
2246    ///
2247    /// Even though the property as already been set when instantiating this call,
2248    /// we provide this method for API completeness.
2249    pub fn name(mut self, new_value: &str) -> CustomerConfigurationDeleteCall<'a, C> {
2250        self._name = new_value.to_string();
2251        self
2252    }
2253    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2254    /// while executing the actual API request.
2255    ///
2256    /// ````text
2257    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2258    /// ````
2259    ///
2260    /// Sets the *delegate* property to the given value.
2261    pub fn delegate(
2262        mut self,
2263        new_value: &'a mut dyn common::Delegate,
2264    ) -> CustomerConfigurationDeleteCall<'a, C> {
2265        self._delegate = Some(new_value);
2266        self
2267    }
2268
2269    /// Set any additional parameter of the query string used in the request.
2270    /// It should be used to set parameters which are not yet available through their own
2271    /// setters.
2272    ///
2273    /// Please note that this method must not be used to set any of the known parameters
2274    /// which have their own setter method. If done anyway, the request will fail.
2275    ///
2276    /// # Additional Parameters
2277    ///
2278    /// * *$.xgafv* (query-string) - V1 error format.
2279    /// * *access_token* (query-string) - OAuth access token.
2280    /// * *alt* (query-string) - Data format for response.
2281    /// * *callback* (query-string) - JSONP
2282    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2283    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2284    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2285    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2286    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2287    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2288    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2289    pub fn param<T>(mut self, name: T, value: T) -> CustomerConfigurationDeleteCall<'a, C>
2290    where
2291        T: AsRef<str>,
2292    {
2293        self._additional_params
2294            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2295        self
2296    }
2297}
2298
2299/// Gets the details of a configuration.
2300///
2301/// A builder for the *configurations.get* method supported by a *customer* resource.
2302/// It is not used directly, but through a [`CustomerMethods`] instance.
2303///
2304/// # Example
2305///
2306/// Instantiate a resource method builder
2307///
2308/// ```test_harness,no_run
2309/// # extern crate hyper;
2310/// # extern crate hyper_rustls;
2311/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
2312/// # async fn dox() {
2313/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2314///
2315/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2316/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2317/// #     secret,
2318/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2319/// # ).build().await.unwrap();
2320///
2321/// # let client = hyper_util::client::legacy::Client::builder(
2322/// #     hyper_util::rt::TokioExecutor::new()
2323/// # )
2324/// # .build(
2325/// #     hyper_rustls::HttpsConnectorBuilder::new()
2326/// #         .with_native_roots()
2327/// #         .unwrap()
2328/// #         .https_or_http()
2329/// #         .enable_http1()
2330/// #         .build()
2331/// # );
2332/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
2333/// // You can configure optional parameters by calling the respective setters at will, and
2334/// // execute the final call using `doit()`.
2335/// // Values shown here are possibly random and not representative !
2336/// let result = hub.customers().configurations_get("name")
2337///              .doit().await;
2338/// # }
2339/// ```
2340pub struct CustomerConfigurationGetCall<'a, C>
2341where
2342    C: 'a,
2343{
2344    hub: &'a AndroidProvisioningPartner<C>,
2345    _name: String,
2346    _delegate: Option<&'a mut dyn common::Delegate>,
2347    _additional_params: HashMap<String, String>,
2348}
2349
2350impl<'a, C> common::CallBuilder for CustomerConfigurationGetCall<'a, C> {}
2351
2352impl<'a, C> CustomerConfigurationGetCall<'a, C>
2353where
2354    C: common::Connector,
2355{
2356    /// Perform the operation you have build so far.
2357    pub async fn doit(mut self) -> common::Result<(common::Response, Configuration)> {
2358        use std::borrow::Cow;
2359        use std::io::{Read, Seek};
2360
2361        use common::{url::Params, ToParts};
2362        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2363
2364        let mut dd = common::DefaultDelegate;
2365        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2366        dlg.begin(common::MethodInfo {
2367            id: "androiddeviceprovisioning.customers.configurations.get",
2368            http_method: hyper::Method::GET,
2369        });
2370
2371        for &field in ["alt", "name"].iter() {
2372            if self._additional_params.contains_key(field) {
2373                dlg.finished(false);
2374                return Err(common::Error::FieldClash(field));
2375            }
2376        }
2377
2378        let mut params = Params::with_capacity(3 + self._additional_params.len());
2379        params.push("name", self._name);
2380
2381        params.extend(self._additional_params.iter());
2382
2383        params.push("alt", "json");
2384        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2385
2386        match dlg.api_key() {
2387            Some(value) => params.push("key", value),
2388            None => {
2389                dlg.finished(false);
2390                return Err(common::Error::MissingAPIKey);
2391            }
2392        }
2393
2394        #[allow(clippy::single_element_loop)]
2395        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2396            url = params.uri_replacement(url, param_name, find_this, true);
2397        }
2398        {
2399            let to_remove = ["name"];
2400            params.remove_params(&to_remove);
2401        }
2402
2403        let url = params.parse_with_url(&url);
2404
2405        loop {
2406            let mut req_result = {
2407                let client = &self.hub.client;
2408                dlg.pre_request();
2409                let mut req_builder = hyper::Request::builder()
2410                    .method(hyper::Method::GET)
2411                    .uri(url.as_str())
2412                    .header(USER_AGENT, self.hub._user_agent.clone());
2413
2414                let request = req_builder
2415                    .header(CONTENT_LENGTH, 0_u64)
2416                    .body(common::to_body::<String>(None));
2417
2418                client.request(request.unwrap()).await
2419            };
2420
2421            match req_result {
2422                Err(err) => {
2423                    if let common::Retry::After(d) = dlg.http_error(&err) {
2424                        sleep(d).await;
2425                        continue;
2426                    }
2427                    dlg.finished(false);
2428                    return Err(common::Error::HttpError(err));
2429                }
2430                Ok(res) => {
2431                    let (mut parts, body) = res.into_parts();
2432                    let mut body = common::Body::new(body);
2433                    if !parts.status.is_success() {
2434                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2435                        let error = serde_json::from_str(&common::to_string(&bytes));
2436                        let response = common::to_response(parts, bytes.into());
2437
2438                        if let common::Retry::After(d) =
2439                            dlg.http_failure(&response, error.as_ref().ok())
2440                        {
2441                            sleep(d).await;
2442                            continue;
2443                        }
2444
2445                        dlg.finished(false);
2446
2447                        return Err(match error {
2448                            Ok(value) => common::Error::BadRequest(value),
2449                            _ => common::Error::Failure(response),
2450                        });
2451                    }
2452                    let response = {
2453                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2454                        let encoded = common::to_string(&bytes);
2455                        match serde_json::from_str(&encoded) {
2456                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2457                            Err(error) => {
2458                                dlg.response_json_decode_error(&encoded, &error);
2459                                return Err(common::Error::JsonDecodeError(
2460                                    encoded.to_string(),
2461                                    error,
2462                                ));
2463                            }
2464                        }
2465                    };
2466
2467                    dlg.finished(true);
2468                    return Ok(response);
2469                }
2470            }
2471        }
2472    }
2473
2474    /// Required. The configuration to get. An API resource name in the format `customers/[CUSTOMER_ID]/configurations/[CONFIGURATION_ID]`.
2475    ///
2476    /// Sets the *name* path property to the given value.
2477    ///
2478    /// Even though the property as already been set when instantiating this call,
2479    /// we provide this method for API completeness.
2480    pub fn name(mut self, new_value: &str) -> CustomerConfigurationGetCall<'a, C> {
2481        self._name = new_value.to_string();
2482        self
2483    }
2484    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2485    /// while executing the actual API request.
2486    ///
2487    /// ````text
2488    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2489    /// ````
2490    ///
2491    /// Sets the *delegate* property to the given value.
2492    pub fn delegate(
2493        mut self,
2494        new_value: &'a mut dyn common::Delegate,
2495    ) -> CustomerConfigurationGetCall<'a, C> {
2496        self._delegate = Some(new_value);
2497        self
2498    }
2499
2500    /// Set any additional parameter of the query string used in the request.
2501    /// It should be used to set parameters which are not yet available through their own
2502    /// setters.
2503    ///
2504    /// Please note that this method must not be used to set any of the known parameters
2505    /// which have their own setter method. If done anyway, the request will fail.
2506    ///
2507    /// # Additional Parameters
2508    ///
2509    /// * *$.xgafv* (query-string) - V1 error format.
2510    /// * *access_token* (query-string) - OAuth access token.
2511    /// * *alt* (query-string) - Data format for response.
2512    /// * *callback* (query-string) - JSONP
2513    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2514    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2515    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2516    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2517    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2518    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2519    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2520    pub fn param<T>(mut self, name: T, value: T) -> CustomerConfigurationGetCall<'a, C>
2521    where
2522        T: AsRef<str>,
2523    {
2524        self._additional_params
2525            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2526        self
2527    }
2528}
2529
2530/// Lists a customer's configurations.
2531///
2532/// A builder for the *configurations.list* method supported by a *customer* resource.
2533/// It is not used directly, but through a [`CustomerMethods`] instance.
2534///
2535/// # Example
2536///
2537/// Instantiate a resource method builder
2538///
2539/// ```test_harness,no_run
2540/// # extern crate hyper;
2541/// # extern crate hyper_rustls;
2542/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
2543/// # async fn dox() {
2544/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2545///
2546/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2547/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2548/// #     secret,
2549/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2550/// # ).build().await.unwrap();
2551///
2552/// # let client = hyper_util::client::legacy::Client::builder(
2553/// #     hyper_util::rt::TokioExecutor::new()
2554/// # )
2555/// # .build(
2556/// #     hyper_rustls::HttpsConnectorBuilder::new()
2557/// #         .with_native_roots()
2558/// #         .unwrap()
2559/// #         .https_or_http()
2560/// #         .enable_http1()
2561/// #         .build()
2562/// # );
2563/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
2564/// // You can configure optional parameters by calling the respective setters at will, and
2565/// // execute the final call using `doit()`.
2566/// // Values shown here are possibly random and not representative !
2567/// let result = hub.customers().configurations_list("parent")
2568///              .doit().await;
2569/// # }
2570/// ```
2571pub struct CustomerConfigurationListCall<'a, C>
2572where
2573    C: 'a,
2574{
2575    hub: &'a AndroidProvisioningPartner<C>,
2576    _parent: String,
2577    _delegate: Option<&'a mut dyn common::Delegate>,
2578    _additional_params: HashMap<String, String>,
2579}
2580
2581impl<'a, C> common::CallBuilder for CustomerConfigurationListCall<'a, C> {}
2582
2583impl<'a, C> CustomerConfigurationListCall<'a, C>
2584where
2585    C: common::Connector,
2586{
2587    /// Perform the operation you have build so far.
2588    pub async fn doit(
2589        mut self,
2590    ) -> common::Result<(common::Response, CustomerListConfigurationsResponse)> {
2591        use std::borrow::Cow;
2592        use std::io::{Read, Seek};
2593
2594        use common::{url::Params, ToParts};
2595        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2596
2597        let mut dd = common::DefaultDelegate;
2598        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2599        dlg.begin(common::MethodInfo {
2600            id: "androiddeviceprovisioning.customers.configurations.list",
2601            http_method: hyper::Method::GET,
2602        });
2603
2604        for &field in ["alt", "parent"].iter() {
2605            if self._additional_params.contains_key(field) {
2606                dlg.finished(false);
2607                return Err(common::Error::FieldClash(field));
2608            }
2609        }
2610
2611        let mut params = Params::with_capacity(3 + self._additional_params.len());
2612        params.push("parent", self._parent);
2613
2614        params.extend(self._additional_params.iter());
2615
2616        params.push("alt", "json");
2617        let mut url = self.hub._base_url.clone() + "v1/{+parent}/configurations";
2618
2619        match dlg.api_key() {
2620            Some(value) => params.push("key", value),
2621            None => {
2622                dlg.finished(false);
2623                return Err(common::Error::MissingAPIKey);
2624            }
2625        }
2626
2627        #[allow(clippy::single_element_loop)]
2628        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2629            url = params.uri_replacement(url, param_name, find_this, true);
2630        }
2631        {
2632            let to_remove = ["parent"];
2633            params.remove_params(&to_remove);
2634        }
2635
2636        let url = params.parse_with_url(&url);
2637
2638        loop {
2639            let mut req_result = {
2640                let client = &self.hub.client;
2641                dlg.pre_request();
2642                let mut req_builder = hyper::Request::builder()
2643                    .method(hyper::Method::GET)
2644                    .uri(url.as_str())
2645                    .header(USER_AGENT, self.hub._user_agent.clone());
2646
2647                let request = req_builder
2648                    .header(CONTENT_LENGTH, 0_u64)
2649                    .body(common::to_body::<String>(None));
2650
2651                client.request(request.unwrap()).await
2652            };
2653
2654            match req_result {
2655                Err(err) => {
2656                    if let common::Retry::After(d) = dlg.http_error(&err) {
2657                        sleep(d).await;
2658                        continue;
2659                    }
2660                    dlg.finished(false);
2661                    return Err(common::Error::HttpError(err));
2662                }
2663                Ok(res) => {
2664                    let (mut parts, body) = res.into_parts();
2665                    let mut body = common::Body::new(body);
2666                    if !parts.status.is_success() {
2667                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2668                        let error = serde_json::from_str(&common::to_string(&bytes));
2669                        let response = common::to_response(parts, bytes.into());
2670
2671                        if let common::Retry::After(d) =
2672                            dlg.http_failure(&response, error.as_ref().ok())
2673                        {
2674                            sleep(d).await;
2675                            continue;
2676                        }
2677
2678                        dlg.finished(false);
2679
2680                        return Err(match error {
2681                            Ok(value) => common::Error::BadRequest(value),
2682                            _ => common::Error::Failure(response),
2683                        });
2684                    }
2685                    let response = {
2686                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2687                        let encoded = common::to_string(&bytes);
2688                        match serde_json::from_str(&encoded) {
2689                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2690                            Err(error) => {
2691                                dlg.response_json_decode_error(&encoded, &error);
2692                                return Err(common::Error::JsonDecodeError(
2693                                    encoded.to_string(),
2694                                    error,
2695                                ));
2696                            }
2697                        }
2698                    };
2699
2700                    dlg.finished(true);
2701                    return Ok(response);
2702                }
2703            }
2704        }
2705    }
2706
2707    /// Required. The customer that manages the listed configurations. An API resource name in the format `customers/[CUSTOMER_ID]`.
2708    ///
2709    /// Sets the *parent* path property to the given value.
2710    ///
2711    /// Even though the property as already been set when instantiating this call,
2712    /// we provide this method for API completeness.
2713    pub fn parent(mut self, new_value: &str) -> CustomerConfigurationListCall<'a, C> {
2714        self._parent = new_value.to_string();
2715        self
2716    }
2717    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2718    /// while executing the actual API request.
2719    ///
2720    /// ````text
2721    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2722    /// ````
2723    ///
2724    /// Sets the *delegate* property to the given value.
2725    pub fn delegate(
2726        mut self,
2727        new_value: &'a mut dyn common::Delegate,
2728    ) -> CustomerConfigurationListCall<'a, C> {
2729        self._delegate = Some(new_value);
2730        self
2731    }
2732
2733    /// Set any additional parameter of the query string used in the request.
2734    /// It should be used to set parameters which are not yet available through their own
2735    /// setters.
2736    ///
2737    /// Please note that this method must not be used to set any of the known parameters
2738    /// which have their own setter method. If done anyway, the request will fail.
2739    ///
2740    /// # Additional Parameters
2741    ///
2742    /// * *$.xgafv* (query-string) - V1 error format.
2743    /// * *access_token* (query-string) - OAuth access token.
2744    /// * *alt* (query-string) - Data format for response.
2745    /// * *callback* (query-string) - JSONP
2746    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2747    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2748    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2749    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2750    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2751    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2752    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2753    pub fn param<T>(mut self, name: T, value: T) -> CustomerConfigurationListCall<'a, C>
2754    where
2755        T: AsRef<str>,
2756    {
2757        self._additional_params
2758            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2759        self
2760    }
2761}
2762
2763/// Updates a configuration's field values.
2764///
2765/// A builder for the *configurations.patch* method supported by a *customer* resource.
2766/// It is not used directly, but through a [`CustomerMethods`] instance.
2767///
2768/// # Example
2769///
2770/// Instantiate a resource method builder
2771///
2772/// ```test_harness,no_run
2773/// # extern crate hyper;
2774/// # extern crate hyper_rustls;
2775/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
2776/// use androiddeviceprovisioning1::api::Configuration;
2777/// # async fn dox() {
2778/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2779///
2780/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2781/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2782/// #     secret,
2783/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2784/// # ).build().await.unwrap();
2785///
2786/// # let client = hyper_util::client::legacy::Client::builder(
2787/// #     hyper_util::rt::TokioExecutor::new()
2788/// # )
2789/// # .build(
2790/// #     hyper_rustls::HttpsConnectorBuilder::new()
2791/// #         .with_native_roots()
2792/// #         .unwrap()
2793/// #         .https_or_http()
2794/// #         .enable_http1()
2795/// #         .build()
2796/// # );
2797/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
2798/// // As the method needs a request, you would usually fill it with the desired information
2799/// // into the respective structure. Some of the parts shown here might not be applicable !
2800/// // Values shown here are possibly random and not representative !
2801/// let mut req = Configuration::default();
2802///
2803/// // You can configure optional parameters by calling the respective setters at will, and
2804/// // execute the final call using `doit()`.
2805/// // Values shown here are possibly random and not representative !
2806/// let result = hub.customers().configurations_patch(req, "name")
2807///              .update_mask(FieldMask::new::<&str>(&[]))
2808///              .doit().await;
2809/// # }
2810/// ```
2811pub struct CustomerConfigurationPatchCall<'a, C>
2812where
2813    C: 'a,
2814{
2815    hub: &'a AndroidProvisioningPartner<C>,
2816    _request: Configuration,
2817    _name: String,
2818    _update_mask: Option<common::FieldMask>,
2819    _delegate: Option<&'a mut dyn common::Delegate>,
2820    _additional_params: HashMap<String, String>,
2821}
2822
2823impl<'a, C> common::CallBuilder for CustomerConfigurationPatchCall<'a, C> {}
2824
2825impl<'a, C> CustomerConfigurationPatchCall<'a, C>
2826where
2827    C: common::Connector,
2828{
2829    /// Perform the operation you have build so far.
2830    pub async fn doit(mut self) -> common::Result<(common::Response, Configuration)> {
2831        use std::borrow::Cow;
2832        use std::io::{Read, Seek};
2833
2834        use common::{url::Params, ToParts};
2835        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2836
2837        let mut dd = common::DefaultDelegate;
2838        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2839        dlg.begin(common::MethodInfo {
2840            id: "androiddeviceprovisioning.customers.configurations.patch",
2841            http_method: hyper::Method::PATCH,
2842        });
2843
2844        for &field in ["alt", "name", "updateMask"].iter() {
2845            if self._additional_params.contains_key(field) {
2846                dlg.finished(false);
2847                return Err(common::Error::FieldClash(field));
2848            }
2849        }
2850
2851        let mut params = Params::with_capacity(5 + self._additional_params.len());
2852        params.push("name", self._name);
2853        if let Some(value) = self._update_mask.as_ref() {
2854            params.push("updateMask", value.to_string());
2855        }
2856
2857        params.extend(self._additional_params.iter());
2858
2859        params.push("alt", "json");
2860        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2861
2862        match dlg.api_key() {
2863            Some(value) => params.push("key", value),
2864            None => {
2865                dlg.finished(false);
2866                return Err(common::Error::MissingAPIKey);
2867            }
2868        }
2869
2870        #[allow(clippy::single_element_loop)]
2871        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2872            url = params.uri_replacement(url, param_name, find_this, true);
2873        }
2874        {
2875            let to_remove = ["name"];
2876            params.remove_params(&to_remove);
2877        }
2878
2879        let url = params.parse_with_url(&url);
2880
2881        let mut json_mime_type = mime::APPLICATION_JSON;
2882        let mut request_value_reader = {
2883            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2884            common::remove_json_null_values(&mut value);
2885            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2886            serde_json::to_writer(&mut dst, &value).unwrap();
2887            dst
2888        };
2889        let request_size = request_value_reader
2890            .seek(std::io::SeekFrom::End(0))
2891            .unwrap();
2892        request_value_reader
2893            .seek(std::io::SeekFrom::Start(0))
2894            .unwrap();
2895
2896        loop {
2897            request_value_reader
2898                .seek(std::io::SeekFrom::Start(0))
2899                .unwrap();
2900            let mut req_result = {
2901                let client = &self.hub.client;
2902                dlg.pre_request();
2903                let mut req_builder = hyper::Request::builder()
2904                    .method(hyper::Method::PATCH)
2905                    .uri(url.as_str())
2906                    .header(USER_AGENT, self.hub._user_agent.clone());
2907
2908                let request = req_builder
2909                    .header(CONTENT_TYPE, json_mime_type.to_string())
2910                    .header(CONTENT_LENGTH, request_size as u64)
2911                    .body(common::to_body(
2912                        request_value_reader.get_ref().clone().into(),
2913                    ));
2914
2915                client.request(request.unwrap()).await
2916            };
2917
2918            match req_result {
2919                Err(err) => {
2920                    if let common::Retry::After(d) = dlg.http_error(&err) {
2921                        sleep(d).await;
2922                        continue;
2923                    }
2924                    dlg.finished(false);
2925                    return Err(common::Error::HttpError(err));
2926                }
2927                Ok(res) => {
2928                    let (mut parts, body) = res.into_parts();
2929                    let mut body = common::Body::new(body);
2930                    if !parts.status.is_success() {
2931                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2932                        let error = serde_json::from_str(&common::to_string(&bytes));
2933                        let response = common::to_response(parts, bytes.into());
2934
2935                        if let common::Retry::After(d) =
2936                            dlg.http_failure(&response, error.as_ref().ok())
2937                        {
2938                            sleep(d).await;
2939                            continue;
2940                        }
2941
2942                        dlg.finished(false);
2943
2944                        return Err(match error {
2945                            Ok(value) => common::Error::BadRequest(value),
2946                            _ => common::Error::Failure(response),
2947                        });
2948                    }
2949                    let response = {
2950                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2951                        let encoded = common::to_string(&bytes);
2952                        match serde_json::from_str(&encoded) {
2953                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2954                            Err(error) => {
2955                                dlg.response_json_decode_error(&encoded, &error);
2956                                return Err(common::Error::JsonDecodeError(
2957                                    encoded.to_string(),
2958                                    error,
2959                                ));
2960                            }
2961                        }
2962                    };
2963
2964                    dlg.finished(true);
2965                    return Ok(response);
2966                }
2967            }
2968        }
2969    }
2970
2971    ///
2972    /// Sets the *request* property to the given value.
2973    ///
2974    /// Even though the property as already been set when instantiating this call,
2975    /// we provide this method for API completeness.
2976    pub fn request(mut self, new_value: Configuration) -> CustomerConfigurationPatchCall<'a, C> {
2977        self._request = new_value;
2978        self
2979    }
2980    /// Output only. The API resource name in the format `customers/[CUSTOMER_ID]/configurations/[CONFIGURATION_ID]`. Assigned by the server.
2981    ///
2982    /// Sets the *name* path property to the given value.
2983    ///
2984    /// Even though the property as already been set when instantiating this call,
2985    /// we provide this method for API completeness.
2986    pub fn name(mut self, new_value: &str) -> CustomerConfigurationPatchCall<'a, C> {
2987        self._name = new_value.to_string();
2988        self
2989    }
2990    /// Required. The field mask applied to the target `Configuration` before updating the fields. To learn more about using field masks, read [FieldMask](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask) in the Protocol Buffers documentation.
2991    ///
2992    /// Sets the *update mask* query property to the given value.
2993    pub fn update_mask(
2994        mut self,
2995        new_value: common::FieldMask,
2996    ) -> CustomerConfigurationPatchCall<'a, C> {
2997        self._update_mask = Some(new_value);
2998        self
2999    }
3000    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3001    /// while executing the actual API request.
3002    ///
3003    /// ````text
3004    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3005    /// ````
3006    ///
3007    /// Sets the *delegate* property to the given value.
3008    pub fn delegate(
3009        mut self,
3010        new_value: &'a mut dyn common::Delegate,
3011    ) -> CustomerConfigurationPatchCall<'a, C> {
3012        self._delegate = Some(new_value);
3013        self
3014    }
3015
3016    /// Set any additional parameter of the query string used in the request.
3017    /// It should be used to set parameters which are not yet available through their own
3018    /// setters.
3019    ///
3020    /// Please note that this method must not be used to set any of the known parameters
3021    /// which have their own setter method. If done anyway, the request will fail.
3022    ///
3023    /// # Additional Parameters
3024    ///
3025    /// * *$.xgafv* (query-string) - V1 error format.
3026    /// * *access_token* (query-string) - OAuth access token.
3027    /// * *alt* (query-string) - Data format for response.
3028    /// * *callback* (query-string) - JSONP
3029    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3030    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3031    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3032    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3033    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3034    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3035    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3036    pub fn param<T>(mut self, name: T, value: T) -> CustomerConfigurationPatchCall<'a, C>
3037    where
3038        T: AsRef<str>,
3039    {
3040        self._additional_params
3041            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3042        self
3043    }
3044}
3045
3046/// Applies a Configuration to the device to register the device for zero-touch enrollment. After applying a configuration to a device, the device automatically provisions itself on first boot, or next factory reset.
3047///
3048/// A builder for the *devices.applyConfiguration* method supported by a *customer* resource.
3049/// It is not used directly, but through a [`CustomerMethods`] instance.
3050///
3051/// # Example
3052///
3053/// Instantiate a resource method builder
3054///
3055/// ```test_harness,no_run
3056/// # extern crate hyper;
3057/// # extern crate hyper_rustls;
3058/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
3059/// use androiddeviceprovisioning1::api::CustomerApplyConfigurationRequest;
3060/// # async fn dox() {
3061/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3062///
3063/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3064/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3065/// #     secret,
3066/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3067/// # ).build().await.unwrap();
3068///
3069/// # let client = hyper_util::client::legacy::Client::builder(
3070/// #     hyper_util::rt::TokioExecutor::new()
3071/// # )
3072/// # .build(
3073/// #     hyper_rustls::HttpsConnectorBuilder::new()
3074/// #         .with_native_roots()
3075/// #         .unwrap()
3076/// #         .https_or_http()
3077/// #         .enable_http1()
3078/// #         .build()
3079/// # );
3080/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
3081/// // As the method needs a request, you would usually fill it with the desired information
3082/// // into the respective structure. Some of the parts shown here might not be applicable !
3083/// // Values shown here are possibly random and not representative !
3084/// let mut req = CustomerApplyConfigurationRequest::default();
3085///
3086/// // You can configure optional parameters by calling the respective setters at will, and
3087/// // execute the final call using `doit()`.
3088/// // Values shown here are possibly random and not representative !
3089/// let result = hub.customers().devices_apply_configuration(req, "parent")
3090///              .doit().await;
3091/// # }
3092/// ```
3093pub struct CustomerDeviceApplyConfigurationCall<'a, C>
3094where
3095    C: 'a,
3096{
3097    hub: &'a AndroidProvisioningPartner<C>,
3098    _request: CustomerApplyConfigurationRequest,
3099    _parent: String,
3100    _delegate: Option<&'a mut dyn common::Delegate>,
3101    _additional_params: HashMap<String, String>,
3102}
3103
3104impl<'a, C> common::CallBuilder for CustomerDeviceApplyConfigurationCall<'a, C> {}
3105
3106impl<'a, C> CustomerDeviceApplyConfigurationCall<'a, C>
3107where
3108    C: common::Connector,
3109{
3110    /// Perform the operation you have build so far.
3111    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
3112        use std::borrow::Cow;
3113        use std::io::{Read, Seek};
3114
3115        use common::{url::Params, ToParts};
3116        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3117
3118        let mut dd = common::DefaultDelegate;
3119        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3120        dlg.begin(common::MethodInfo {
3121            id: "androiddeviceprovisioning.customers.devices.applyConfiguration",
3122            http_method: hyper::Method::POST,
3123        });
3124
3125        for &field in ["alt", "parent"].iter() {
3126            if self._additional_params.contains_key(field) {
3127                dlg.finished(false);
3128                return Err(common::Error::FieldClash(field));
3129            }
3130        }
3131
3132        let mut params = Params::with_capacity(4 + self._additional_params.len());
3133        params.push("parent", self._parent);
3134
3135        params.extend(self._additional_params.iter());
3136
3137        params.push("alt", "json");
3138        let mut url = self.hub._base_url.clone() + "v1/{+parent}/devices:applyConfiguration";
3139
3140        match dlg.api_key() {
3141            Some(value) => params.push("key", value),
3142            None => {
3143                dlg.finished(false);
3144                return Err(common::Error::MissingAPIKey);
3145            }
3146        }
3147
3148        #[allow(clippy::single_element_loop)]
3149        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3150            url = params.uri_replacement(url, param_name, find_this, true);
3151        }
3152        {
3153            let to_remove = ["parent"];
3154            params.remove_params(&to_remove);
3155        }
3156
3157        let url = params.parse_with_url(&url);
3158
3159        let mut json_mime_type = mime::APPLICATION_JSON;
3160        let mut request_value_reader = {
3161            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3162            common::remove_json_null_values(&mut value);
3163            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3164            serde_json::to_writer(&mut dst, &value).unwrap();
3165            dst
3166        };
3167        let request_size = request_value_reader
3168            .seek(std::io::SeekFrom::End(0))
3169            .unwrap();
3170        request_value_reader
3171            .seek(std::io::SeekFrom::Start(0))
3172            .unwrap();
3173
3174        loop {
3175            request_value_reader
3176                .seek(std::io::SeekFrom::Start(0))
3177                .unwrap();
3178            let mut req_result = {
3179                let client = &self.hub.client;
3180                dlg.pre_request();
3181                let mut req_builder = hyper::Request::builder()
3182                    .method(hyper::Method::POST)
3183                    .uri(url.as_str())
3184                    .header(USER_AGENT, self.hub._user_agent.clone());
3185
3186                let request = req_builder
3187                    .header(CONTENT_TYPE, json_mime_type.to_string())
3188                    .header(CONTENT_LENGTH, request_size as u64)
3189                    .body(common::to_body(
3190                        request_value_reader.get_ref().clone().into(),
3191                    ));
3192
3193                client.request(request.unwrap()).await
3194            };
3195
3196            match req_result {
3197                Err(err) => {
3198                    if let common::Retry::After(d) = dlg.http_error(&err) {
3199                        sleep(d).await;
3200                        continue;
3201                    }
3202                    dlg.finished(false);
3203                    return Err(common::Error::HttpError(err));
3204                }
3205                Ok(res) => {
3206                    let (mut parts, body) = res.into_parts();
3207                    let mut body = common::Body::new(body);
3208                    if !parts.status.is_success() {
3209                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3210                        let error = serde_json::from_str(&common::to_string(&bytes));
3211                        let response = common::to_response(parts, bytes.into());
3212
3213                        if let common::Retry::After(d) =
3214                            dlg.http_failure(&response, error.as_ref().ok())
3215                        {
3216                            sleep(d).await;
3217                            continue;
3218                        }
3219
3220                        dlg.finished(false);
3221
3222                        return Err(match error {
3223                            Ok(value) => common::Error::BadRequest(value),
3224                            _ => common::Error::Failure(response),
3225                        });
3226                    }
3227                    let response = {
3228                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3229                        let encoded = common::to_string(&bytes);
3230                        match serde_json::from_str(&encoded) {
3231                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3232                            Err(error) => {
3233                                dlg.response_json_decode_error(&encoded, &error);
3234                                return Err(common::Error::JsonDecodeError(
3235                                    encoded.to_string(),
3236                                    error,
3237                                ));
3238                            }
3239                        }
3240                    };
3241
3242                    dlg.finished(true);
3243                    return Ok(response);
3244                }
3245            }
3246        }
3247    }
3248
3249    ///
3250    /// Sets the *request* property to the given value.
3251    ///
3252    /// Even though the property as already been set when instantiating this call,
3253    /// we provide this method for API completeness.
3254    pub fn request(
3255        mut self,
3256        new_value: CustomerApplyConfigurationRequest,
3257    ) -> CustomerDeviceApplyConfigurationCall<'a, C> {
3258        self._request = new_value;
3259        self
3260    }
3261    /// Required. The customer managing the device. An API resource name in the format `customers/[CUSTOMER_ID]`.
3262    ///
3263    /// Sets the *parent* path property to the given value.
3264    ///
3265    /// Even though the property as already been set when instantiating this call,
3266    /// we provide this method for API completeness.
3267    pub fn parent(mut self, new_value: &str) -> CustomerDeviceApplyConfigurationCall<'a, C> {
3268        self._parent = new_value.to_string();
3269        self
3270    }
3271    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3272    /// while executing the actual API request.
3273    ///
3274    /// ````text
3275    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3276    /// ````
3277    ///
3278    /// Sets the *delegate* property to the given value.
3279    pub fn delegate(
3280        mut self,
3281        new_value: &'a mut dyn common::Delegate,
3282    ) -> CustomerDeviceApplyConfigurationCall<'a, C> {
3283        self._delegate = Some(new_value);
3284        self
3285    }
3286
3287    /// Set any additional parameter of the query string used in the request.
3288    /// It should be used to set parameters which are not yet available through their own
3289    /// setters.
3290    ///
3291    /// Please note that this method must not be used to set any of the known parameters
3292    /// which have their own setter method. If done anyway, the request will fail.
3293    ///
3294    /// # Additional Parameters
3295    ///
3296    /// * *$.xgafv* (query-string) - V1 error format.
3297    /// * *access_token* (query-string) - OAuth access token.
3298    /// * *alt* (query-string) - Data format for response.
3299    /// * *callback* (query-string) - JSONP
3300    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3301    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3302    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3303    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3304    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3305    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3306    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3307    pub fn param<T>(mut self, name: T, value: T) -> CustomerDeviceApplyConfigurationCall<'a, C>
3308    where
3309        T: AsRef<str>,
3310    {
3311        self._additional_params
3312            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3313        self
3314    }
3315}
3316
3317/// Gets the details of a device.
3318///
3319/// A builder for the *devices.get* method supported by a *customer* resource.
3320/// It is not used directly, but through a [`CustomerMethods`] instance.
3321///
3322/// # Example
3323///
3324/// Instantiate a resource method builder
3325///
3326/// ```test_harness,no_run
3327/// # extern crate hyper;
3328/// # extern crate hyper_rustls;
3329/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
3330/// # async fn dox() {
3331/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3332///
3333/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3334/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3335/// #     secret,
3336/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3337/// # ).build().await.unwrap();
3338///
3339/// # let client = hyper_util::client::legacy::Client::builder(
3340/// #     hyper_util::rt::TokioExecutor::new()
3341/// # )
3342/// # .build(
3343/// #     hyper_rustls::HttpsConnectorBuilder::new()
3344/// #         .with_native_roots()
3345/// #         .unwrap()
3346/// #         .https_or_http()
3347/// #         .enable_http1()
3348/// #         .build()
3349/// # );
3350/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
3351/// // You can configure optional parameters by calling the respective setters at will, and
3352/// // execute the final call using `doit()`.
3353/// // Values shown here are possibly random and not representative !
3354/// let result = hub.customers().devices_get("name")
3355///              .doit().await;
3356/// # }
3357/// ```
3358pub struct CustomerDeviceGetCall<'a, C>
3359where
3360    C: 'a,
3361{
3362    hub: &'a AndroidProvisioningPartner<C>,
3363    _name: String,
3364    _delegate: Option<&'a mut dyn common::Delegate>,
3365    _additional_params: HashMap<String, String>,
3366}
3367
3368impl<'a, C> common::CallBuilder for CustomerDeviceGetCall<'a, C> {}
3369
3370impl<'a, C> CustomerDeviceGetCall<'a, C>
3371where
3372    C: common::Connector,
3373{
3374    /// Perform the operation you have build so far.
3375    pub async fn doit(mut self) -> common::Result<(common::Response, Device)> {
3376        use std::borrow::Cow;
3377        use std::io::{Read, Seek};
3378
3379        use common::{url::Params, ToParts};
3380        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3381
3382        let mut dd = common::DefaultDelegate;
3383        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3384        dlg.begin(common::MethodInfo {
3385            id: "androiddeviceprovisioning.customers.devices.get",
3386            http_method: hyper::Method::GET,
3387        });
3388
3389        for &field in ["alt", "name"].iter() {
3390            if self._additional_params.contains_key(field) {
3391                dlg.finished(false);
3392                return Err(common::Error::FieldClash(field));
3393            }
3394        }
3395
3396        let mut params = Params::with_capacity(3 + self._additional_params.len());
3397        params.push("name", self._name);
3398
3399        params.extend(self._additional_params.iter());
3400
3401        params.push("alt", "json");
3402        let mut url = self.hub._base_url.clone() + "v1/{+name}";
3403
3404        match dlg.api_key() {
3405            Some(value) => params.push("key", value),
3406            None => {
3407                dlg.finished(false);
3408                return Err(common::Error::MissingAPIKey);
3409            }
3410        }
3411
3412        #[allow(clippy::single_element_loop)]
3413        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3414            url = params.uri_replacement(url, param_name, find_this, true);
3415        }
3416        {
3417            let to_remove = ["name"];
3418            params.remove_params(&to_remove);
3419        }
3420
3421        let url = params.parse_with_url(&url);
3422
3423        loop {
3424            let mut req_result = {
3425                let client = &self.hub.client;
3426                dlg.pre_request();
3427                let mut req_builder = hyper::Request::builder()
3428                    .method(hyper::Method::GET)
3429                    .uri(url.as_str())
3430                    .header(USER_AGENT, self.hub._user_agent.clone());
3431
3432                let request = req_builder
3433                    .header(CONTENT_LENGTH, 0_u64)
3434                    .body(common::to_body::<String>(None));
3435
3436                client.request(request.unwrap()).await
3437            };
3438
3439            match req_result {
3440                Err(err) => {
3441                    if let common::Retry::After(d) = dlg.http_error(&err) {
3442                        sleep(d).await;
3443                        continue;
3444                    }
3445                    dlg.finished(false);
3446                    return Err(common::Error::HttpError(err));
3447                }
3448                Ok(res) => {
3449                    let (mut parts, body) = res.into_parts();
3450                    let mut body = common::Body::new(body);
3451                    if !parts.status.is_success() {
3452                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3453                        let error = serde_json::from_str(&common::to_string(&bytes));
3454                        let response = common::to_response(parts, bytes.into());
3455
3456                        if let common::Retry::After(d) =
3457                            dlg.http_failure(&response, error.as_ref().ok())
3458                        {
3459                            sleep(d).await;
3460                            continue;
3461                        }
3462
3463                        dlg.finished(false);
3464
3465                        return Err(match error {
3466                            Ok(value) => common::Error::BadRequest(value),
3467                            _ => common::Error::Failure(response),
3468                        });
3469                    }
3470                    let response = {
3471                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3472                        let encoded = common::to_string(&bytes);
3473                        match serde_json::from_str(&encoded) {
3474                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3475                            Err(error) => {
3476                                dlg.response_json_decode_error(&encoded, &error);
3477                                return Err(common::Error::JsonDecodeError(
3478                                    encoded.to_string(),
3479                                    error,
3480                                ));
3481                            }
3482                        }
3483                    };
3484
3485                    dlg.finished(true);
3486                    return Ok(response);
3487                }
3488            }
3489        }
3490    }
3491
3492    /// Required. The device to get. An API resource name in the format `customers/[CUSTOMER_ID]/devices/[DEVICE_ID]`.
3493    ///
3494    /// Sets the *name* path property to the given value.
3495    ///
3496    /// Even though the property as already been set when instantiating this call,
3497    /// we provide this method for API completeness.
3498    pub fn name(mut self, new_value: &str) -> CustomerDeviceGetCall<'a, C> {
3499        self._name = new_value.to_string();
3500        self
3501    }
3502    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3503    /// while executing the actual API request.
3504    ///
3505    /// ````text
3506    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3507    /// ````
3508    ///
3509    /// Sets the *delegate* property to the given value.
3510    pub fn delegate(
3511        mut self,
3512        new_value: &'a mut dyn common::Delegate,
3513    ) -> CustomerDeviceGetCall<'a, C> {
3514        self._delegate = Some(new_value);
3515        self
3516    }
3517
3518    /// Set any additional parameter of the query string used in the request.
3519    /// It should be used to set parameters which are not yet available through their own
3520    /// setters.
3521    ///
3522    /// Please note that this method must not be used to set any of the known parameters
3523    /// which have their own setter method. If done anyway, the request will fail.
3524    ///
3525    /// # Additional Parameters
3526    ///
3527    /// * *$.xgafv* (query-string) - V1 error format.
3528    /// * *access_token* (query-string) - OAuth access token.
3529    /// * *alt* (query-string) - Data format for response.
3530    /// * *callback* (query-string) - JSONP
3531    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3532    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3533    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3534    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3535    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3536    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3537    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3538    pub fn param<T>(mut self, name: T, value: T) -> CustomerDeviceGetCall<'a, C>
3539    where
3540        T: AsRef<str>,
3541    {
3542        self._additional_params
3543            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3544        self
3545    }
3546}
3547
3548/// Lists a customer's devices.
3549///
3550/// A builder for the *devices.list* method supported by a *customer* resource.
3551/// It is not used directly, but through a [`CustomerMethods`] instance.
3552///
3553/// # Example
3554///
3555/// Instantiate a resource method builder
3556///
3557/// ```test_harness,no_run
3558/// # extern crate hyper;
3559/// # extern crate hyper_rustls;
3560/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
3561/// # async fn dox() {
3562/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3563///
3564/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3565/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3566/// #     secret,
3567/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3568/// # ).build().await.unwrap();
3569///
3570/// # let client = hyper_util::client::legacy::Client::builder(
3571/// #     hyper_util::rt::TokioExecutor::new()
3572/// # )
3573/// # .build(
3574/// #     hyper_rustls::HttpsConnectorBuilder::new()
3575/// #         .with_native_roots()
3576/// #         .unwrap()
3577/// #         .https_or_http()
3578/// #         .enable_http1()
3579/// #         .build()
3580/// # );
3581/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
3582/// // You can configure optional parameters by calling the respective setters at will, and
3583/// // execute the final call using `doit()`.
3584/// // Values shown here are possibly random and not representative !
3585/// let result = hub.customers().devices_list("parent")
3586///              .page_token("duo")
3587///              .page_size(-55)
3588///              .doit().await;
3589/// # }
3590/// ```
3591pub struct CustomerDeviceListCall<'a, C>
3592where
3593    C: 'a,
3594{
3595    hub: &'a AndroidProvisioningPartner<C>,
3596    _parent: String,
3597    _page_token: Option<String>,
3598    _page_size: Option<i64>,
3599    _delegate: Option<&'a mut dyn common::Delegate>,
3600    _additional_params: HashMap<String, String>,
3601}
3602
3603impl<'a, C> common::CallBuilder for CustomerDeviceListCall<'a, C> {}
3604
3605impl<'a, C> CustomerDeviceListCall<'a, C>
3606where
3607    C: common::Connector,
3608{
3609    /// Perform the operation you have build so far.
3610    pub async fn doit(mut self) -> common::Result<(common::Response, CustomerListDevicesResponse)> {
3611        use std::borrow::Cow;
3612        use std::io::{Read, Seek};
3613
3614        use common::{url::Params, ToParts};
3615        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3616
3617        let mut dd = common::DefaultDelegate;
3618        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3619        dlg.begin(common::MethodInfo {
3620            id: "androiddeviceprovisioning.customers.devices.list",
3621            http_method: hyper::Method::GET,
3622        });
3623
3624        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
3625            if self._additional_params.contains_key(field) {
3626                dlg.finished(false);
3627                return Err(common::Error::FieldClash(field));
3628            }
3629        }
3630
3631        let mut params = Params::with_capacity(5 + self._additional_params.len());
3632        params.push("parent", self._parent);
3633        if let Some(value) = self._page_token.as_ref() {
3634            params.push("pageToken", value);
3635        }
3636        if let Some(value) = self._page_size.as_ref() {
3637            params.push("pageSize", value.to_string());
3638        }
3639
3640        params.extend(self._additional_params.iter());
3641
3642        params.push("alt", "json");
3643        let mut url = self.hub._base_url.clone() + "v1/{+parent}/devices";
3644
3645        match dlg.api_key() {
3646            Some(value) => params.push("key", value),
3647            None => {
3648                dlg.finished(false);
3649                return Err(common::Error::MissingAPIKey);
3650            }
3651        }
3652
3653        #[allow(clippy::single_element_loop)]
3654        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3655            url = params.uri_replacement(url, param_name, find_this, true);
3656        }
3657        {
3658            let to_remove = ["parent"];
3659            params.remove_params(&to_remove);
3660        }
3661
3662        let url = params.parse_with_url(&url);
3663
3664        loop {
3665            let mut req_result = {
3666                let client = &self.hub.client;
3667                dlg.pre_request();
3668                let mut req_builder = hyper::Request::builder()
3669                    .method(hyper::Method::GET)
3670                    .uri(url.as_str())
3671                    .header(USER_AGENT, self.hub._user_agent.clone());
3672
3673                let request = req_builder
3674                    .header(CONTENT_LENGTH, 0_u64)
3675                    .body(common::to_body::<String>(None));
3676
3677                client.request(request.unwrap()).await
3678            };
3679
3680            match req_result {
3681                Err(err) => {
3682                    if let common::Retry::After(d) = dlg.http_error(&err) {
3683                        sleep(d).await;
3684                        continue;
3685                    }
3686                    dlg.finished(false);
3687                    return Err(common::Error::HttpError(err));
3688                }
3689                Ok(res) => {
3690                    let (mut parts, body) = res.into_parts();
3691                    let mut body = common::Body::new(body);
3692                    if !parts.status.is_success() {
3693                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3694                        let error = serde_json::from_str(&common::to_string(&bytes));
3695                        let response = common::to_response(parts, bytes.into());
3696
3697                        if let common::Retry::After(d) =
3698                            dlg.http_failure(&response, error.as_ref().ok())
3699                        {
3700                            sleep(d).await;
3701                            continue;
3702                        }
3703
3704                        dlg.finished(false);
3705
3706                        return Err(match error {
3707                            Ok(value) => common::Error::BadRequest(value),
3708                            _ => common::Error::Failure(response),
3709                        });
3710                    }
3711                    let response = {
3712                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3713                        let encoded = common::to_string(&bytes);
3714                        match serde_json::from_str(&encoded) {
3715                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3716                            Err(error) => {
3717                                dlg.response_json_decode_error(&encoded, &error);
3718                                return Err(common::Error::JsonDecodeError(
3719                                    encoded.to_string(),
3720                                    error,
3721                                ));
3722                            }
3723                        }
3724                    };
3725
3726                    dlg.finished(true);
3727                    return Ok(response);
3728                }
3729            }
3730        }
3731    }
3732
3733    /// Required. The customer managing the devices. An API resource name in the format `customers/[CUSTOMER_ID]`.
3734    ///
3735    /// Sets the *parent* path property to the given value.
3736    ///
3737    /// Even though the property as already been set when instantiating this call,
3738    /// we provide this method for API completeness.
3739    pub fn parent(mut self, new_value: &str) -> CustomerDeviceListCall<'a, C> {
3740        self._parent = new_value.to_string();
3741        self
3742    }
3743    /// A token specifying which result page to return.
3744    ///
3745    /// Sets the *page token* query property to the given value.
3746    pub fn page_token(mut self, new_value: &str) -> CustomerDeviceListCall<'a, C> {
3747        self._page_token = Some(new_value.to_string());
3748        self
3749    }
3750    /// The maximum number of devices to show in a page of results. Must be between 1 and 100 inclusive.
3751    ///
3752    /// Sets the *page size* query property to the given value.
3753    pub fn page_size(mut self, new_value: i64) -> CustomerDeviceListCall<'a, C> {
3754        self._page_size = Some(new_value);
3755        self
3756    }
3757    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3758    /// while executing the actual API request.
3759    ///
3760    /// ````text
3761    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3762    /// ````
3763    ///
3764    /// Sets the *delegate* property to the given value.
3765    pub fn delegate(
3766        mut self,
3767        new_value: &'a mut dyn common::Delegate,
3768    ) -> CustomerDeviceListCall<'a, C> {
3769        self._delegate = Some(new_value);
3770        self
3771    }
3772
3773    /// Set any additional parameter of the query string used in the request.
3774    /// It should be used to set parameters which are not yet available through their own
3775    /// setters.
3776    ///
3777    /// Please note that this method must not be used to set any of the known parameters
3778    /// which have their own setter method. If done anyway, the request will fail.
3779    ///
3780    /// # Additional Parameters
3781    ///
3782    /// * *$.xgafv* (query-string) - V1 error format.
3783    /// * *access_token* (query-string) - OAuth access token.
3784    /// * *alt* (query-string) - Data format for response.
3785    /// * *callback* (query-string) - JSONP
3786    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3787    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3788    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3789    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3790    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3791    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3792    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3793    pub fn param<T>(mut self, name: T, value: T) -> CustomerDeviceListCall<'a, C>
3794    where
3795        T: AsRef<str>,
3796    {
3797        self._additional_params
3798            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3799        self
3800    }
3801}
3802
3803/// Removes a configuration from device.
3804///
3805/// A builder for the *devices.removeConfiguration* method supported by a *customer* resource.
3806/// It is not used directly, but through a [`CustomerMethods`] instance.
3807///
3808/// # Example
3809///
3810/// Instantiate a resource method builder
3811///
3812/// ```test_harness,no_run
3813/// # extern crate hyper;
3814/// # extern crate hyper_rustls;
3815/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
3816/// use androiddeviceprovisioning1::api::CustomerRemoveConfigurationRequest;
3817/// # async fn dox() {
3818/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3819///
3820/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3821/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3822/// #     secret,
3823/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3824/// # ).build().await.unwrap();
3825///
3826/// # let client = hyper_util::client::legacy::Client::builder(
3827/// #     hyper_util::rt::TokioExecutor::new()
3828/// # )
3829/// # .build(
3830/// #     hyper_rustls::HttpsConnectorBuilder::new()
3831/// #         .with_native_roots()
3832/// #         .unwrap()
3833/// #         .https_or_http()
3834/// #         .enable_http1()
3835/// #         .build()
3836/// # );
3837/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
3838/// // As the method needs a request, you would usually fill it with the desired information
3839/// // into the respective structure. Some of the parts shown here might not be applicable !
3840/// // Values shown here are possibly random and not representative !
3841/// let mut req = CustomerRemoveConfigurationRequest::default();
3842///
3843/// // You can configure optional parameters by calling the respective setters at will, and
3844/// // execute the final call using `doit()`.
3845/// // Values shown here are possibly random and not representative !
3846/// let result = hub.customers().devices_remove_configuration(req, "parent")
3847///              .doit().await;
3848/// # }
3849/// ```
3850pub struct CustomerDeviceRemoveConfigurationCall<'a, C>
3851where
3852    C: 'a,
3853{
3854    hub: &'a AndroidProvisioningPartner<C>,
3855    _request: CustomerRemoveConfigurationRequest,
3856    _parent: String,
3857    _delegate: Option<&'a mut dyn common::Delegate>,
3858    _additional_params: HashMap<String, String>,
3859}
3860
3861impl<'a, C> common::CallBuilder for CustomerDeviceRemoveConfigurationCall<'a, C> {}
3862
3863impl<'a, C> CustomerDeviceRemoveConfigurationCall<'a, C>
3864where
3865    C: common::Connector,
3866{
3867    /// Perform the operation you have build so far.
3868    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
3869        use std::borrow::Cow;
3870        use std::io::{Read, Seek};
3871
3872        use common::{url::Params, ToParts};
3873        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3874
3875        let mut dd = common::DefaultDelegate;
3876        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3877        dlg.begin(common::MethodInfo {
3878            id: "androiddeviceprovisioning.customers.devices.removeConfiguration",
3879            http_method: hyper::Method::POST,
3880        });
3881
3882        for &field in ["alt", "parent"].iter() {
3883            if self._additional_params.contains_key(field) {
3884                dlg.finished(false);
3885                return Err(common::Error::FieldClash(field));
3886            }
3887        }
3888
3889        let mut params = Params::with_capacity(4 + self._additional_params.len());
3890        params.push("parent", self._parent);
3891
3892        params.extend(self._additional_params.iter());
3893
3894        params.push("alt", "json");
3895        let mut url = self.hub._base_url.clone() + "v1/{+parent}/devices:removeConfiguration";
3896
3897        match dlg.api_key() {
3898            Some(value) => params.push("key", value),
3899            None => {
3900                dlg.finished(false);
3901                return Err(common::Error::MissingAPIKey);
3902            }
3903        }
3904
3905        #[allow(clippy::single_element_loop)]
3906        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3907            url = params.uri_replacement(url, param_name, find_this, true);
3908        }
3909        {
3910            let to_remove = ["parent"];
3911            params.remove_params(&to_remove);
3912        }
3913
3914        let url = params.parse_with_url(&url);
3915
3916        let mut json_mime_type = mime::APPLICATION_JSON;
3917        let mut request_value_reader = {
3918            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3919            common::remove_json_null_values(&mut value);
3920            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3921            serde_json::to_writer(&mut dst, &value).unwrap();
3922            dst
3923        };
3924        let request_size = request_value_reader
3925            .seek(std::io::SeekFrom::End(0))
3926            .unwrap();
3927        request_value_reader
3928            .seek(std::io::SeekFrom::Start(0))
3929            .unwrap();
3930
3931        loop {
3932            request_value_reader
3933                .seek(std::io::SeekFrom::Start(0))
3934                .unwrap();
3935            let mut req_result = {
3936                let client = &self.hub.client;
3937                dlg.pre_request();
3938                let mut req_builder = hyper::Request::builder()
3939                    .method(hyper::Method::POST)
3940                    .uri(url.as_str())
3941                    .header(USER_AGENT, self.hub._user_agent.clone());
3942
3943                let request = req_builder
3944                    .header(CONTENT_TYPE, json_mime_type.to_string())
3945                    .header(CONTENT_LENGTH, request_size as u64)
3946                    .body(common::to_body(
3947                        request_value_reader.get_ref().clone().into(),
3948                    ));
3949
3950                client.request(request.unwrap()).await
3951            };
3952
3953            match req_result {
3954                Err(err) => {
3955                    if let common::Retry::After(d) = dlg.http_error(&err) {
3956                        sleep(d).await;
3957                        continue;
3958                    }
3959                    dlg.finished(false);
3960                    return Err(common::Error::HttpError(err));
3961                }
3962                Ok(res) => {
3963                    let (mut parts, body) = res.into_parts();
3964                    let mut body = common::Body::new(body);
3965                    if !parts.status.is_success() {
3966                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3967                        let error = serde_json::from_str(&common::to_string(&bytes));
3968                        let response = common::to_response(parts, bytes.into());
3969
3970                        if let common::Retry::After(d) =
3971                            dlg.http_failure(&response, error.as_ref().ok())
3972                        {
3973                            sleep(d).await;
3974                            continue;
3975                        }
3976
3977                        dlg.finished(false);
3978
3979                        return Err(match error {
3980                            Ok(value) => common::Error::BadRequest(value),
3981                            _ => common::Error::Failure(response),
3982                        });
3983                    }
3984                    let response = {
3985                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3986                        let encoded = common::to_string(&bytes);
3987                        match serde_json::from_str(&encoded) {
3988                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3989                            Err(error) => {
3990                                dlg.response_json_decode_error(&encoded, &error);
3991                                return Err(common::Error::JsonDecodeError(
3992                                    encoded.to_string(),
3993                                    error,
3994                                ));
3995                            }
3996                        }
3997                    };
3998
3999                    dlg.finished(true);
4000                    return Ok(response);
4001                }
4002            }
4003        }
4004    }
4005
4006    ///
4007    /// Sets the *request* property to the given value.
4008    ///
4009    /// Even though the property as already been set when instantiating this call,
4010    /// we provide this method for API completeness.
4011    pub fn request(
4012        mut self,
4013        new_value: CustomerRemoveConfigurationRequest,
4014    ) -> CustomerDeviceRemoveConfigurationCall<'a, C> {
4015        self._request = new_value;
4016        self
4017    }
4018    /// Required. The customer managing the device in the format `customers/[CUSTOMER_ID]`.
4019    ///
4020    /// Sets the *parent* path property to the given value.
4021    ///
4022    /// Even though the property as already been set when instantiating this call,
4023    /// we provide this method for API completeness.
4024    pub fn parent(mut self, new_value: &str) -> CustomerDeviceRemoveConfigurationCall<'a, C> {
4025        self._parent = new_value.to_string();
4026        self
4027    }
4028    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4029    /// while executing the actual API request.
4030    ///
4031    /// ````text
4032    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4033    /// ````
4034    ///
4035    /// Sets the *delegate* property to the given value.
4036    pub fn delegate(
4037        mut self,
4038        new_value: &'a mut dyn common::Delegate,
4039    ) -> CustomerDeviceRemoveConfigurationCall<'a, C> {
4040        self._delegate = Some(new_value);
4041        self
4042    }
4043
4044    /// Set any additional parameter of the query string used in the request.
4045    /// It should be used to set parameters which are not yet available through their own
4046    /// setters.
4047    ///
4048    /// Please note that this method must not be used to set any of the known parameters
4049    /// which have their own setter method. If done anyway, the request will fail.
4050    ///
4051    /// # Additional Parameters
4052    ///
4053    /// * *$.xgafv* (query-string) - V1 error format.
4054    /// * *access_token* (query-string) - OAuth access token.
4055    /// * *alt* (query-string) - Data format for response.
4056    /// * *callback* (query-string) - JSONP
4057    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4058    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4059    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4060    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4061    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4062    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4063    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4064    pub fn param<T>(mut self, name: T, value: T) -> CustomerDeviceRemoveConfigurationCall<'a, C>
4065    where
4066        T: AsRef<str>,
4067    {
4068        self._additional_params
4069            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4070        self
4071    }
4072}
4073
4074/// Unclaims a device from a customer and removes it from zero-touch enrollment. After removing a device, a customer must contact their reseller to register the device into zero-touch enrollment again.
4075///
4076/// A builder for the *devices.unclaim* method supported by a *customer* resource.
4077/// It is not used directly, but through a [`CustomerMethods`] instance.
4078///
4079/// # Example
4080///
4081/// Instantiate a resource method builder
4082///
4083/// ```test_harness,no_run
4084/// # extern crate hyper;
4085/// # extern crate hyper_rustls;
4086/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
4087/// use androiddeviceprovisioning1::api::CustomerUnclaimDeviceRequest;
4088/// # async fn dox() {
4089/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4090///
4091/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4092/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4093/// #     secret,
4094/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4095/// # ).build().await.unwrap();
4096///
4097/// # let client = hyper_util::client::legacy::Client::builder(
4098/// #     hyper_util::rt::TokioExecutor::new()
4099/// # )
4100/// # .build(
4101/// #     hyper_rustls::HttpsConnectorBuilder::new()
4102/// #         .with_native_roots()
4103/// #         .unwrap()
4104/// #         .https_or_http()
4105/// #         .enable_http1()
4106/// #         .build()
4107/// # );
4108/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
4109/// // As the method needs a request, you would usually fill it with the desired information
4110/// // into the respective structure. Some of the parts shown here might not be applicable !
4111/// // Values shown here are possibly random and not representative !
4112/// let mut req = CustomerUnclaimDeviceRequest::default();
4113///
4114/// // You can configure optional parameters by calling the respective setters at will, and
4115/// // execute the final call using `doit()`.
4116/// // Values shown here are possibly random and not representative !
4117/// let result = hub.customers().devices_unclaim(req, "parent")
4118///              .doit().await;
4119/// # }
4120/// ```
4121pub struct CustomerDeviceUnclaimCall<'a, C>
4122where
4123    C: 'a,
4124{
4125    hub: &'a AndroidProvisioningPartner<C>,
4126    _request: CustomerUnclaimDeviceRequest,
4127    _parent: String,
4128    _delegate: Option<&'a mut dyn common::Delegate>,
4129    _additional_params: HashMap<String, String>,
4130}
4131
4132impl<'a, C> common::CallBuilder for CustomerDeviceUnclaimCall<'a, C> {}
4133
4134impl<'a, C> CustomerDeviceUnclaimCall<'a, C>
4135where
4136    C: common::Connector,
4137{
4138    /// Perform the operation you have build so far.
4139    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
4140        use std::borrow::Cow;
4141        use std::io::{Read, Seek};
4142
4143        use common::{url::Params, ToParts};
4144        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4145
4146        let mut dd = common::DefaultDelegate;
4147        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4148        dlg.begin(common::MethodInfo {
4149            id: "androiddeviceprovisioning.customers.devices.unclaim",
4150            http_method: hyper::Method::POST,
4151        });
4152
4153        for &field in ["alt", "parent"].iter() {
4154            if self._additional_params.contains_key(field) {
4155                dlg.finished(false);
4156                return Err(common::Error::FieldClash(field));
4157            }
4158        }
4159
4160        let mut params = Params::with_capacity(4 + self._additional_params.len());
4161        params.push("parent", self._parent);
4162
4163        params.extend(self._additional_params.iter());
4164
4165        params.push("alt", "json");
4166        let mut url = self.hub._base_url.clone() + "v1/{+parent}/devices:unclaim";
4167
4168        match dlg.api_key() {
4169            Some(value) => params.push("key", value),
4170            None => {
4171                dlg.finished(false);
4172                return Err(common::Error::MissingAPIKey);
4173            }
4174        }
4175
4176        #[allow(clippy::single_element_loop)]
4177        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4178            url = params.uri_replacement(url, param_name, find_this, true);
4179        }
4180        {
4181            let to_remove = ["parent"];
4182            params.remove_params(&to_remove);
4183        }
4184
4185        let url = params.parse_with_url(&url);
4186
4187        let mut json_mime_type = mime::APPLICATION_JSON;
4188        let mut request_value_reader = {
4189            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4190            common::remove_json_null_values(&mut value);
4191            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4192            serde_json::to_writer(&mut dst, &value).unwrap();
4193            dst
4194        };
4195        let request_size = request_value_reader
4196            .seek(std::io::SeekFrom::End(0))
4197            .unwrap();
4198        request_value_reader
4199            .seek(std::io::SeekFrom::Start(0))
4200            .unwrap();
4201
4202        loop {
4203            request_value_reader
4204                .seek(std::io::SeekFrom::Start(0))
4205                .unwrap();
4206            let mut req_result = {
4207                let client = &self.hub.client;
4208                dlg.pre_request();
4209                let mut req_builder = hyper::Request::builder()
4210                    .method(hyper::Method::POST)
4211                    .uri(url.as_str())
4212                    .header(USER_AGENT, self.hub._user_agent.clone());
4213
4214                let request = req_builder
4215                    .header(CONTENT_TYPE, json_mime_type.to_string())
4216                    .header(CONTENT_LENGTH, request_size as u64)
4217                    .body(common::to_body(
4218                        request_value_reader.get_ref().clone().into(),
4219                    ));
4220
4221                client.request(request.unwrap()).await
4222            };
4223
4224            match req_result {
4225                Err(err) => {
4226                    if let common::Retry::After(d) = dlg.http_error(&err) {
4227                        sleep(d).await;
4228                        continue;
4229                    }
4230                    dlg.finished(false);
4231                    return Err(common::Error::HttpError(err));
4232                }
4233                Ok(res) => {
4234                    let (mut parts, body) = res.into_parts();
4235                    let mut body = common::Body::new(body);
4236                    if !parts.status.is_success() {
4237                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4238                        let error = serde_json::from_str(&common::to_string(&bytes));
4239                        let response = common::to_response(parts, bytes.into());
4240
4241                        if let common::Retry::After(d) =
4242                            dlg.http_failure(&response, error.as_ref().ok())
4243                        {
4244                            sleep(d).await;
4245                            continue;
4246                        }
4247
4248                        dlg.finished(false);
4249
4250                        return Err(match error {
4251                            Ok(value) => common::Error::BadRequest(value),
4252                            _ => common::Error::Failure(response),
4253                        });
4254                    }
4255                    let response = {
4256                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4257                        let encoded = common::to_string(&bytes);
4258                        match serde_json::from_str(&encoded) {
4259                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4260                            Err(error) => {
4261                                dlg.response_json_decode_error(&encoded, &error);
4262                                return Err(common::Error::JsonDecodeError(
4263                                    encoded.to_string(),
4264                                    error,
4265                                ));
4266                            }
4267                        }
4268                    };
4269
4270                    dlg.finished(true);
4271                    return Ok(response);
4272                }
4273            }
4274        }
4275    }
4276
4277    ///
4278    /// Sets the *request* property to the given value.
4279    ///
4280    /// Even though the property as already been set when instantiating this call,
4281    /// we provide this method for API completeness.
4282    pub fn request(
4283        mut self,
4284        new_value: CustomerUnclaimDeviceRequest,
4285    ) -> CustomerDeviceUnclaimCall<'a, C> {
4286        self._request = new_value;
4287        self
4288    }
4289    /// Required. The customer managing the device. An API resource name in the format `customers/[CUSTOMER_ID]`.
4290    ///
4291    /// Sets the *parent* path property to the given value.
4292    ///
4293    /// Even though the property as already been set when instantiating this call,
4294    /// we provide this method for API completeness.
4295    pub fn parent(mut self, new_value: &str) -> CustomerDeviceUnclaimCall<'a, C> {
4296        self._parent = new_value.to_string();
4297        self
4298    }
4299    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4300    /// while executing the actual API request.
4301    ///
4302    /// ````text
4303    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4304    /// ````
4305    ///
4306    /// Sets the *delegate* property to the given value.
4307    pub fn delegate(
4308        mut self,
4309        new_value: &'a mut dyn common::Delegate,
4310    ) -> CustomerDeviceUnclaimCall<'a, C> {
4311        self._delegate = Some(new_value);
4312        self
4313    }
4314
4315    /// Set any additional parameter of the query string used in the request.
4316    /// It should be used to set parameters which are not yet available through their own
4317    /// setters.
4318    ///
4319    /// Please note that this method must not be used to set any of the known parameters
4320    /// which have their own setter method. If done anyway, the request will fail.
4321    ///
4322    /// # Additional Parameters
4323    ///
4324    /// * *$.xgafv* (query-string) - V1 error format.
4325    /// * *access_token* (query-string) - OAuth access token.
4326    /// * *alt* (query-string) - Data format for response.
4327    /// * *callback* (query-string) - JSONP
4328    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4329    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4330    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4331    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4332    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4333    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4334    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4335    pub fn param<T>(mut self, name: T, value: T) -> CustomerDeviceUnclaimCall<'a, C>
4336    where
4337        T: AsRef<str>,
4338    {
4339        self._additional_params
4340            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4341        self
4342    }
4343}
4344
4345/// Lists the DPCs (device policy controllers) that support zero-touch enrollment.
4346///
4347/// A builder for the *dpcs.list* method supported by a *customer* resource.
4348/// It is not used directly, but through a [`CustomerMethods`] instance.
4349///
4350/// # Example
4351///
4352/// Instantiate a resource method builder
4353///
4354/// ```test_harness,no_run
4355/// # extern crate hyper;
4356/// # extern crate hyper_rustls;
4357/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
4358/// # async fn dox() {
4359/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4360///
4361/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4362/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4363/// #     secret,
4364/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4365/// # ).build().await.unwrap();
4366///
4367/// # let client = hyper_util::client::legacy::Client::builder(
4368/// #     hyper_util::rt::TokioExecutor::new()
4369/// # )
4370/// # .build(
4371/// #     hyper_rustls::HttpsConnectorBuilder::new()
4372/// #         .with_native_roots()
4373/// #         .unwrap()
4374/// #         .https_or_http()
4375/// #         .enable_http1()
4376/// #         .build()
4377/// # );
4378/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
4379/// // You can configure optional parameters by calling the respective setters at will, and
4380/// // execute the final call using `doit()`.
4381/// // Values shown here are possibly random and not representative !
4382/// let result = hub.customers().dpcs_list("parent")
4383///              .doit().await;
4384/// # }
4385/// ```
4386pub struct CustomerDpcListCall<'a, C>
4387where
4388    C: 'a,
4389{
4390    hub: &'a AndroidProvisioningPartner<C>,
4391    _parent: String,
4392    _delegate: Option<&'a mut dyn common::Delegate>,
4393    _additional_params: HashMap<String, String>,
4394}
4395
4396impl<'a, C> common::CallBuilder for CustomerDpcListCall<'a, C> {}
4397
4398impl<'a, C> CustomerDpcListCall<'a, C>
4399where
4400    C: common::Connector,
4401{
4402    /// Perform the operation you have build so far.
4403    pub async fn doit(mut self) -> common::Result<(common::Response, CustomerListDpcsResponse)> {
4404        use std::borrow::Cow;
4405        use std::io::{Read, Seek};
4406
4407        use common::{url::Params, ToParts};
4408        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4409
4410        let mut dd = common::DefaultDelegate;
4411        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4412        dlg.begin(common::MethodInfo {
4413            id: "androiddeviceprovisioning.customers.dpcs.list",
4414            http_method: hyper::Method::GET,
4415        });
4416
4417        for &field in ["alt", "parent"].iter() {
4418            if self._additional_params.contains_key(field) {
4419                dlg.finished(false);
4420                return Err(common::Error::FieldClash(field));
4421            }
4422        }
4423
4424        let mut params = Params::with_capacity(3 + self._additional_params.len());
4425        params.push("parent", self._parent);
4426
4427        params.extend(self._additional_params.iter());
4428
4429        params.push("alt", "json");
4430        let mut url = self.hub._base_url.clone() + "v1/{+parent}/dpcs";
4431
4432        match dlg.api_key() {
4433            Some(value) => params.push("key", value),
4434            None => {
4435                dlg.finished(false);
4436                return Err(common::Error::MissingAPIKey);
4437            }
4438        }
4439
4440        #[allow(clippy::single_element_loop)]
4441        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4442            url = params.uri_replacement(url, param_name, find_this, true);
4443        }
4444        {
4445            let to_remove = ["parent"];
4446            params.remove_params(&to_remove);
4447        }
4448
4449        let url = params.parse_with_url(&url);
4450
4451        loop {
4452            let mut req_result = {
4453                let client = &self.hub.client;
4454                dlg.pre_request();
4455                let mut req_builder = hyper::Request::builder()
4456                    .method(hyper::Method::GET)
4457                    .uri(url.as_str())
4458                    .header(USER_AGENT, self.hub._user_agent.clone());
4459
4460                let request = req_builder
4461                    .header(CONTENT_LENGTH, 0_u64)
4462                    .body(common::to_body::<String>(None));
4463
4464                client.request(request.unwrap()).await
4465            };
4466
4467            match req_result {
4468                Err(err) => {
4469                    if let common::Retry::After(d) = dlg.http_error(&err) {
4470                        sleep(d).await;
4471                        continue;
4472                    }
4473                    dlg.finished(false);
4474                    return Err(common::Error::HttpError(err));
4475                }
4476                Ok(res) => {
4477                    let (mut parts, body) = res.into_parts();
4478                    let mut body = common::Body::new(body);
4479                    if !parts.status.is_success() {
4480                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4481                        let error = serde_json::from_str(&common::to_string(&bytes));
4482                        let response = common::to_response(parts, bytes.into());
4483
4484                        if let common::Retry::After(d) =
4485                            dlg.http_failure(&response, error.as_ref().ok())
4486                        {
4487                            sleep(d).await;
4488                            continue;
4489                        }
4490
4491                        dlg.finished(false);
4492
4493                        return Err(match error {
4494                            Ok(value) => common::Error::BadRequest(value),
4495                            _ => common::Error::Failure(response),
4496                        });
4497                    }
4498                    let response = {
4499                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4500                        let encoded = common::to_string(&bytes);
4501                        match serde_json::from_str(&encoded) {
4502                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4503                            Err(error) => {
4504                                dlg.response_json_decode_error(&encoded, &error);
4505                                return Err(common::Error::JsonDecodeError(
4506                                    encoded.to_string(),
4507                                    error,
4508                                ));
4509                            }
4510                        }
4511                    };
4512
4513                    dlg.finished(true);
4514                    return Ok(response);
4515                }
4516            }
4517        }
4518    }
4519
4520    /// Required. The customer that can use the DPCs in configurations. An API resource name in the format `customers/[CUSTOMER_ID]`.
4521    ///
4522    /// Sets the *parent* path property to the given value.
4523    ///
4524    /// Even though the property as already been set when instantiating this call,
4525    /// we provide this method for API completeness.
4526    pub fn parent(mut self, new_value: &str) -> CustomerDpcListCall<'a, C> {
4527        self._parent = new_value.to_string();
4528        self
4529    }
4530    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4531    /// while executing the actual API request.
4532    ///
4533    /// ````text
4534    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4535    /// ````
4536    ///
4537    /// Sets the *delegate* property to the given value.
4538    pub fn delegate(
4539        mut self,
4540        new_value: &'a mut dyn common::Delegate,
4541    ) -> CustomerDpcListCall<'a, C> {
4542        self._delegate = Some(new_value);
4543        self
4544    }
4545
4546    /// Set any additional parameter of the query string used in the request.
4547    /// It should be used to set parameters which are not yet available through their own
4548    /// setters.
4549    ///
4550    /// Please note that this method must not be used to set any of the known parameters
4551    /// which have their own setter method. If done anyway, the request will fail.
4552    ///
4553    /// # Additional Parameters
4554    ///
4555    /// * *$.xgafv* (query-string) - V1 error format.
4556    /// * *access_token* (query-string) - OAuth access token.
4557    /// * *alt* (query-string) - Data format for response.
4558    /// * *callback* (query-string) - JSONP
4559    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4560    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4561    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4562    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4563    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4564    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4565    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4566    pub fn param<T>(mut self, name: T, value: T) -> CustomerDpcListCall<'a, C>
4567    where
4568        T: AsRef<str>,
4569    {
4570        self._additional_params
4571            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4572        self
4573    }
4574}
4575
4576/// Lists the user's customer accounts.
4577///
4578/// A builder for the *list* method supported by a *customer* resource.
4579/// It is not used directly, but through a [`CustomerMethods`] instance.
4580///
4581/// # Example
4582///
4583/// Instantiate a resource method builder
4584///
4585/// ```test_harness,no_run
4586/// # extern crate hyper;
4587/// # extern crate hyper_rustls;
4588/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
4589/// # async fn dox() {
4590/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4591///
4592/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4593/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4594/// #     secret,
4595/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4596/// # ).build().await.unwrap();
4597///
4598/// # let client = hyper_util::client::legacy::Client::builder(
4599/// #     hyper_util::rt::TokioExecutor::new()
4600/// # )
4601/// # .build(
4602/// #     hyper_rustls::HttpsConnectorBuilder::new()
4603/// #         .with_native_roots()
4604/// #         .unwrap()
4605/// #         .https_or_http()
4606/// #         .enable_http1()
4607/// #         .build()
4608/// # );
4609/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
4610/// // You can configure optional parameters by calling the respective setters at will, and
4611/// // execute the final call using `doit()`.
4612/// // Values shown here are possibly random and not representative !
4613/// let result = hub.customers().list()
4614///              .page_token("eos")
4615///              .page_size(-4)
4616///              .doit().await;
4617/// # }
4618/// ```
4619pub struct CustomerListCall<'a, C>
4620where
4621    C: 'a,
4622{
4623    hub: &'a AndroidProvisioningPartner<C>,
4624    _page_token: Option<String>,
4625    _page_size: Option<i32>,
4626    _delegate: Option<&'a mut dyn common::Delegate>,
4627    _additional_params: HashMap<String, String>,
4628}
4629
4630impl<'a, C> common::CallBuilder for CustomerListCall<'a, C> {}
4631
4632impl<'a, C> CustomerListCall<'a, C>
4633where
4634    C: common::Connector,
4635{
4636    /// Perform the operation you have build so far.
4637    pub async fn doit(
4638        mut self,
4639    ) -> common::Result<(common::Response, CustomerListCustomersResponse)> {
4640        use std::borrow::Cow;
4641        use std::io::{Read, Seek};
4642
4643        use common::{url::Params, ToParts};
4644        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4645
4646        let mut dd = common::DefaultDelegate;
4647        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4648        dlg.begin(common::MethodInfo {
4649            id: "androiddeviceprovisioning.customers.list",
4650            http_method: hyper::Method::GET,
4651        });
4652
4653        for &field in ["alt", "pageToken", "pageSize"].iter() {
4654            if self._additional_params.contains_key(field) {
4655                dlg.finished(false);
4656                return Err(common::Error::FieldClash(field));
4657            }
4658        }
4659
4660        let mut params = Params::with_capacity(4 + self._additional_params.len());
4661        if let Some(value) = self._page_token.as_ref() {
4662            params.push("pageToken", value);
4663        }
4664        if let Some(value) = self._page_size.as_ref() {
4665            params.push("pageSize", value.to_string());
4666        }
4667
4668        params.extend(self._additional_params.iter());
4669
4670        params.push("alt", "json");
4671        let mut url = self.hub._base_url.clone() + "v1/customers";
4672
4673        match dlg.api_key() {
4674            Some(value) => params.push("key", value),
4675            None => {
4676                dlg.finished(false);
4677                return Err(common::Error::MissingAPIKey);
4678            }
4679        }
4680
4681        let url = params.parse_with_url(&url);
4682
4683        loop {
4684            let mut req_result = {
4685                let client = &self.hub.client;
4686                dlg.pre_request();
4687                let mut req_builder = hyper::Request::builder()
4688                    .method(hyper::Method::GET)
4689                    .uri(url.as_str())
4690                    .header(USER_AGENT, self.hub._user_agent.clone());
4691
4692                let request = req_builder
4693                    .header(CONTENT_LENGTH, 0_u64)
4694                    .body(common::to_body::<String>(None));
4695
4696                client.request(request.unwrap()).await
4697            };
4698
4699            match req_result {
4700                Err(err) => {
4701                    if let common::Retry::After(d) = dlg.http_error(&err) {
4702                        sleep(d).await;
4703                        continue;
4704                    }
4705                    dlg.finished(false);
4706                    return Err(common::Error::HttpError(err));
4707                }
4708                Ok(res) => {
4709                    let (mut parts, body) = res.into_parts();
4710                    let mut body = common::Body::new(body);
4711                    if !parts.status.is_success() {
4712                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4713                        let error = serde_json::from_str(&common::to_string(&bytes));
4714                        let response = common::to_response(parts, bytes.into());
4715
4716                        if let common::Retry::After(d) =
4717                            dlg.http_failure(&response, error.as_ref().ok())
4718                        {
4719                            sleep(d).await;
4720                            continue;
4721                        }
4722
4723                        dlg.finished(false);
4724
4725                        return Err(match error {
4726                            Ok(value) => common::Error::BadRequest(value),
4727                            _ => common::Error::Failure(response),
4728                        });
4729                    }
4730                    let response = {
4731                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4732                        let encoded = common::to_string(&bytes);
4733                        match serde_json::from_str(&encoded) {
4734                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4735                            Err(error) => {
4736                                dlg.response_json_decode_error(&encoded, &error);
4737                                return Err(common::Error::JsonDecodeError(
4738                                    encoded.to_string(),
4739                                    error,
4740                                ));
4741                            }
4742                        }
4743                    };
4744
4745                    dlg.finished(true);
4746                    return Ok(response);
4747                }
4748            }
4749        }
4750    }
4751
4752    /// A token specifying which result page to return. This field has custom validations in ListCustomersRequestValidator
4753    ///
4754    /// Sets the *page token* query property to the given value.
4755    pub fn page_token(mut self, new_value: &str) -> CustomerListCall<'a, C> {
4756        self._page_token = Some(new_value.to_string());
4757        self
4758    }
4759    /// The maximum number of customers to show in a page of results. A number between 1 and 100 (inclusive).
4760    ///
4761    /// Sets the *page size* query property to the given value.
4762    pub fn page_size(mut self, new_value: i32) -> CustomerListCall<'a, C> {
4763        self._page_size = Some(new_value);
4764        self
4765    }
4766    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4767    /// while executing the actual API request.
4768    ///
4769    /// ````text
4770    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4771    /// ````
4772    ///
4773    /// Sets the *delegate* property to the given value.
4774    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> CustomerListCall<'a, C> {
4775        self._delegate = Some(new_value);
4776        self
4777    }
4778
4779    /// Set any additional parameter of the query string used in the request.
4780    /// It should be used to set parameters which are not yet available through their own
4781    /// setters.
4782    ///
4783    /// Please note that this method must not be used to set any of the known parameters
4784    /// which have their own setter method. If done anyway, the request will fail.
4785    ///
4786    /// # Additional Parameters
4787    ///
4788    /// * *$.xgafv* (query-string) - V1 error format.
4789    /// * *access_token* (query-string) - OAuth access token.
4790    /// * *alt* (query-string) - Data format for response.
4791    /// * *callback* (query-string) - JSONP
4792    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4793    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4794    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4795    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4796    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4797    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4798    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4799    pub fn param<T>(mut self, name: T, value: T) -> CustomerListCall<'a, C>
4800    where
4801        T: AsRef<str>,
4802    {
4803        self._additional_params
4804            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4805        self
4806    }
4807}
4808
4809/// 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.
4810///
4811/// A builder for the *get* method supported by a *operation* resource.
4812/// It is not used directly, but through a [`OperationMethods`] instance.
4813///
4814/// # Example
4815///
4816/// Instantiate a resource method builder
4817///
4818/// ```test_harness,no_run
4819/// # extern crate hyper;
4820/// # extern crate hyper_rustls;
4821/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
4822/// # async fn dox() {
4823/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4824///
4825/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4826/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4827/// #     secret,
4828/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4829/// # ).build().await.unwrap();
4830///
4831/// # let client = hyper_util::client::legacy::Client::builder(
4832/// #     hyper_util::rt::TokioExecutor::new()
4833/// # )
4834/// # .build(
4835/// #     hyper_rustls::HttpsConnectorBuilder::new()
4836/// #         .with_native_roots()
4837/// #         .unwrap()
4838/// #         .https_or_http()
4839/// #         .enable_http1()
4840/// #         .build()
4841/// # );
4842/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
4843/// // You can configure optional parameters by calling the respective setters at will, and
4844/// // execute the final call using `doit()`.
4845/// // Values shown here are possibly random and not representative !
4846/// let result = hub.operations().get("name")
4847///              .doit().await;
4848/// # }
4849/// ```
4850pub struct OperationGetCall<'a, C>
4851where
4852    C: 'a,
4853{
4854    hub: &'a AndroidProvisioningPartner<C>,
4855    _name: String,
4856    _delegate: Option<&'a mut dyn common::Delegate>,
4857    _additional_params: HashMap<String, String>,
4858}
4859
4860impl<'a, C> common::CallBuilder for OperationGetCall<'a, C> {}
4861
4862impl<'a, C> OperationGetCall<'a, C>
4863where
4864    C: common::Connector,
4865{
4866    /// Perform the operation you have build so far.
4867    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4868        use std::borrow::Cow;
4869        use std::io::{Read, Seek};
4870
4871        use common::{url::Params, ToParts};
4872        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4873
4874        let mut dd = common::DefaultDelegate;
4875        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4876        dlg.begin(common::MethodInfo {
4877            id: "androiddeviceprovisioning.operations.get",
4878            http_method: hyper::Method::GET,
4879        });
4880
4881        for &field in ["alt", "name"].iter() {
4882            if self._additional_params.contains_key(field) {
4883                dlg.finished(false);
4884                return Err(common::Error::FieldClash(field));
4885            }
4886        }
4887
4888        let mut params = Params::with_capacity(3 + self._additional_params.len());
4889        params.push("name", self._name);
4890
4891        params.extend(self._additional_params.iter());
4892
4893        params.push("alt", "json");
4894        let mut url = self.hub._base_url.clone() + "v1/{+name}";
4895
4896        match dlg.api_key() {
4897            Some(value) => params.push("key", value),
4898            None => {
4899                dlg.finished(false);
4900                return Err(common::Error::MissingAPIKey);
4901            }
4902        }
4903
4904        #[allow(clippy::single_element_loop)]
4905        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4906            url = params.uri_replacement(url, param_name, find_this, true);
4907        }
4908        {
4909            let to_remove = ["name"];
4910            params.remove_params(&to_remove);
4911        }
4912
4913        let url = params.parse_with_url(&url);
4914
4915        loop {
4916            let mut req_result = {
4917                let client = &self.hub.client;
4918                dlg.pre_request();
4919                let mut req_builder = hyper::Request::builder()
4920                    .method(hyper::Method::GET)
4921                    .uri(url.as_str())
4922                    .header(USER_AGENT, self.hub._user_agent.clone());
4923
4924                let request = req_builder
4925                    .header(CONTENT_LENGTH, 0_u64)
4926                    .body(common::to_body::<String>(None));
4927
4928                client.request(request.unwrap()).await
4929            };
4930
4931            match req_result {
4932                Err(err) => {
4933                    if let common::Retry::After(d) = dlg.http_error(&err) {
4934                        sleep(d).await;
4935                        continue;
4936                    }
4937                    dlg.finished(false);
4938                    return Err(common::Error::HttpError(err));
4939                }
4940                Ok(res) => {
4941                    let (mut parts, body) = res.into_parts();
4942                    let mut body = common::Body::new(body);
4943                    if !parts.status.is_success() {
4944                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4945                        let error = serde_json::from_str(&common::to_string(&bytes));
4946                        let response = common::to_response(parts, bytes.into());
4947
4948                        if let common::Retry::After(d) =
4949                            dlg.http_failure(&response, error.as_ref().ok())
4950                        {
4951                            sleep(d).await;
4952                            continue;
4953                        }
4954
4955                        dlg.finished(false);
4956
4957                        return Err(match error {
4958                            Ok(value) => common::Error::BadRequest(value),
4959                            _ => common::Error::Failure(response),
4960                        });
4961                    }
4962                    let response = {
4963                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4964                        let encoded = common::to_string(&bytes);
4965                        match serde_json::from_str(&encoded) {
4966                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4967                            Err(error) => {
4968                                dlg.response_json_decode_error(&encoded, &error);
4969                                return Err(common::Error::JsonDecodeError(
4970                                    encoded.to_string(),
4971                                    error,
4972                                ));
4973                            }
4974                        }
4975                    };
4976
4977                    dlg.finished(true);
4978                    return Ok(response);
4979                }
4980            }
4981        }
4982    }
4983
4984    /// The name of the operation resource.
4985    ///
4986    /// Sets the *name* path property to the given value.
4987    ///
4988    /// Even though the property as already been set when instantiating this call,
4989    /// we provide this method for API completeness.
4990    pub fn name(mut self, new_value: &str) -> OperationGetCall<'a, C> {
4991        self._name = new_value.to_string();
4992        self
4993    }
4994    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4995    /// while executing the actual API request.
4996    ///
4997    /// ````text
4998    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4999    /// ````
5000    ///
5001    /// Sets the *delegate* property to the given value.
5002    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationGetCall<'a, C> {
5003        self._delegate = Some(new_value);
5004        self
5005    }
5006
5007    /// Set any additional parameter of the query string used in the request.
5008    /// It should be used to set parameters which are not yet available through their own
5009    /// setters.
5010    ///
5011    /// Please note that this method must not be used to set any of the known parameters
5012    /// which have their own setter method. If done anyway, the request will fail.
5013    ///
5014    /// # Additional Parameters
5015    ///
5016    /// * *$.xgafv* (query-string) - V1 error format.
5017    /// * *access_token* (query-string) - OAuth access token.
5018    /// * *alt* (query-string) - Data format for response.
5019    /// * *callback* (query-string) - JSONP
5020    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5021    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5022    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5023    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5024    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5025    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5026    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5027    pub fn param<T>(mut self, name: T, value: T) -> OperationGetCall<'a, C>
5028    where
5029        T: AsRef<str>,
5030    {
5031        self._additional_params
5032            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5033        self
5034    }
5035}
5036
5037/// Creates a customer for zero-touch enrollment. After the method returns successfully, admin and owner roles can manage devices and EMM configs by calling API methods or using their zero-touch enrollment portal. The customer receives an email that welcomes them to zero-touch enrollment and explains how to sign into the portal.
5038///
5039/// A builder for the *customers.create* method supported by a *partner* resource.
5040/// It is not used directly, but through a [`PartnerMethods`] instance.
5041///
5042/// # Example
5043///
5044/// Instantiate a resource method builder
5045///
5046/// ```test_harness,no_run
5047/// # extern crate hyper;
5048/// # extern crate hyper_rustls;
5049/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
5050/// use androiddeviceprovisioning1::api::CreateCustomerRequest;
5051/// # async fn dox() {
5052/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5053///
5054/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5055/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5056/// #     secret,
5057/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5058/// # ).build().await.unwrap();
5059///
5060/// # let client = hyper_util::client::legacy::Client::builder(
5061/// #     hyper_util::rt::TokioExecutor::new()
5062/// # )
5063/// # .build(
5064/// #     hyper_rustls::HttpsConnectorBuilder::new()
5065/// #         .with_native_roots()
5066/// #         .unwrap()
5067/// #         .https_or_http()
5068/// #         .enable_http1()
5069/// #         .build()
5070/// # );
5071/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
5072/// // As the method needs a request, you would usually fill it with the desired information
5073/// // into the respective structure. Some of the parts shown here might not be applicable !
5074/// // Values shown here are possibly random and not representative !
5075/// let mut req = CreateCustomerRequest::default();
5076///
5077/// // You can configure optional parameters by calling the respective setters at will, and
5078/// // execute the final call using `doit()`.
5079/// // Values shown here are possibly random and not representative !
5080/// let result = hub.partners().customers_create(req, "parent")
5081///              .doit().await;
5082/// # }
5083/// ```
5084pub struct PartnerCustomerCreateCall<'a, C>
5085where
5086    C: 'a,
5087{
5088    hub: &'a AndroidProvisioningPartner<C>,
5089    _request: CreateCustomerRequest,
5090    _parent: String,
5091    _delegate: Option<&'a mut dyn common::Delegate>,
5092    _additional_params: HashMap<String, String>,
5093}
5094
5095impl<'a, C> common::CallBuilder for PartnerCustomerCreateCall<'a, C> {}
5096
5097impl<'a, C> PartnerCustomerCreateCall<'a, C>
5098where
5099    C: common::Connector,
5100{
5101    /// Perform the operation you have build so far.
5102    pub async fn doit(mut self) -> common::Result<(common::Response, Company)> {
5103        use std::borrow::Cow;
5104        use std::io::{Read, Seek};
5105
5106        use common::{url::Params, ToParts};
5107        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5108
5109        let mut dd = common::DefaultDelegate;
5110        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5111        dlg.begin(common::MethodInfo {
5112            id: "androiddeviceprovisioning.partners.customers.create",
5113            http_method: hyper::Method::POST,
5114        });
5115
5116        for &field in ["alt", "parent"].iter() {
5117            if self._additional_params.contains_key(field) {
5118                dlg.finished(false);
5119                return Err(common::Error::FieldClash(field));
5120            }
5121        }
5122
5123        let mut params = Params::with_capacity(4 + self._additional_params.len());
5124        params.push("parent", self._parent);
5125
5126        params.extend(self._additional_params.iter());
5127
5128        params.push("alt", "json");
5129        let mut url = self.hub._base_url.clone() + "v1/{+parent}/customers";
5130
5131        match dlg.api_key() {
5132            Some(value) => params.push("key", value),
5133            None => {
5134                dlg.finished(false);
5135                return Err(common::Error::MissingAPIKey);
5136            }
5137        }
5138
5139        #[allow(clippy::single_element_loop)]
5140        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5141            url = params.uri_replacement(url, param_name, find_this, true);
5142        }
5143        {
5144            let to_remove = ["parent"];
5145            params.remove_params(&to_remove);
5146        }
5147
5148        let url = params.parse_with_url(&url);
5149
5150        let mut json_mime_type = mime::APPLICATION_JSON;
5151        let mut request_value_reader = {
5152            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5153            common::remove_json_null_values(&mut value);
5154            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5155            serde_json::to_writer(&mut dst, &value).unwrap();
5156            dst
5157        };
5158        let request_size = request_value_reader
5159            .seek(std::io::SeekFrom::End(0))
5160            .unwrap();
5161        request_value_reader
5162            .seek(std::io::SeekFrom::Start(0))
5163            .unwrap();
5164
5165        loop {
5166            request_value_reader
5167                .seek(std::io::SeekFrom::Start(0))
5168                .unwrap();
5169            let mut req_result = {
5170                let client = &self.hub.client;
5171                dlg.pre_request();
5172                let mut req_builder = hyper::Request::builder()
5173                    .method(hyper::Method::POST)
5174                    .uri(url.as_str())
5175                    .header(USER_AGENT, self.hub._user_agent.clone());
5176
5177                let request = req_builder
5178                    .header(CONTENT_TYPE, json_mime_type.to_string())
5179                    .header(CONTENT_LENGTH, request_size as u64)
5180                    .body(common::to_body(
5181                        request_value_reader.get_ref().clone().into(),
5182                    ));
5183
5184                client.request(request.unwrap()).await
5185            };
5186
5187            match req_result {
5188                Err(err) => {
5189                    if let common::Retry::After(d) = dlg.http_error(&err) {
5190                        sleep(d).await;
5191                        continue;
5192                    }
5193                    dlg.finished(false);
5194                    return Err(common::Error::HttpError(err));
5195                }
5196                Ok(res) => {
5197                    let (mut parts, body) = res.into_parts();
5198                    let mut body = common::Body::new(body);
5199                    if !parts.status.is_success() {
5200                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5201                        let error = serde_json::from_str(&common::to_string(&bytes));
5202                        let response = common::to_response(parts, bytes.into());
5203
5204                        if let common::Retry::After(d) =
5205                            dlg.http_failure(&response, error.as_ref().ok())
5206                        {
5207                            sleep(d).await;
5208                            continue;
5209                        }
5210
5211                        dlg.finished(false);
5212
5213                        return Err(match error {
5214                            Ok(value) => common::Error::BadRequest(value),
5215                            _ => common::Error::Failure(response),
5216                        });
5217                    }
5218                    let response = {
5219                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5220                        let encoded = common::to_string(&bytes);
5221                        match serde_json::from_str(&encoded) {
5222                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5223                            Err(error) => {
5224                                dlg.response_json_decode_error(&encoded, &error);
5225                                return Err(common::Error::JsonDecodeError(
5226                                    encoded.to_string(),
5227                                    error,
5228                                ));
5229                            }
5230                        }
5231                    };
5232
5233                    dlg.finished(true);
5234                    return Ok(response);
5235                }
5236            }
5237        }
5238    }
5239
5240    ///
5241    /// Sets the *request* property to the given value.
5242    ///
5243    /// Even though the property as already been set when instantiating this call,
5244    /// we provide this method for API completeness.
5245    pub fn request(mut self, new_value: CreateCustomerRequest) -> PartnerCustomerCreateCall<'a, C> {
5246        self._request = new_value;
5247        self
5248    }
5249    /// Required. The parent resource ID in the format `partners/[PARTNER_ID]` that identifies the reseller.
5250    ///
5251    /// Sets the *parent* path property to the given value.
5252    ///
5253    /// Even though the property as already been set when instantiating this call,
5254    /// we provide this method for API completeness.
5255    pub fn parent(mut self, new_value: &str) -> PartnerCustomerCreateCall<'a, C> {
5256        self._parent = new_value.to_string();
5257        self
5258    }
5259    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5260    /// while executing the actual API request.
5261    ///
5262    /// ````text
5263    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5264    /// ````
5265    ///
5266    /// Sets the *delegate* property to the given value.
5267    pub fn delegate(
5268        mut self,
5269        new_value: &'a mut dyn common::Delegate,
5270    ) -> PartnerCustomerCreateCall<'a, C> {
5271        self._delegate = Some(new_value);
5272        self
5273    }
5274
5275    /// Set any additional parameter of the query string used in the request.
5276    /// It should be used to set parameters which are not yet available through their own
5277    /// setters.
5278    ///
5279    /// Please note that this method must not be used to set any of the known parameters
5280    /// which have their own setter method. If done anyway, the request will fail.
5281    ///
5282    /// # Additional Parameters
5283    ///
5284    /// * *$.xgafv* (query-string) - V1 error format.
5285    /// * *access_token* (query-string) - OAuth access token.
5286    /// * *alt* (query-string) - Data format for response.
5287    /// * *callback* (query-string) - JSONP
5288    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5289    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5290    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5291    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5292    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5293    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5294    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5295    pub fn param<T>(mut self, name: T, value: T) -> PartnerCustomerCreateCall<'a, C>
5296    where
5297        T: AsRef<str>,
5298    {
5299        self._additional_params
5300            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5301        self
5302    }
5303}
5304
5305/// Lists the customers that are enrolled to the reseller identified by the `partnerId` argument. This list includes customers that the reseller created and customers that enrolled themselves using the portal.
5306///
5307/// A builder for the *customers.list* method supported by a *partner* resource.
5308/// It is not used directly, but through a [`PartnerMethods`] instance.
5309///
5310/// # Example
5311///
5312/// Instantiate a resource method builder
5313///
5314/// ```test_harness,no_run
5315/// # extern crate hyper;
5316/// # extern crate hyper_rustls;
5317/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
5318/// # async fn dox() {
5319/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5320///
5321/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5322/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5323/// #     secret,
5324/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5325/// # ).build().await.unwrap();
5326///
5327/// # let client = hyper_util::client::legacy::Client::builder(
5328/// #     hyper_util::rt::TokioExecutor::new()
5329/// # )
5330/// # .build(
5331/// #     hyper_rustls::HttpsConnectorBuilder::new()
5332/// #         .with_native_roots()
5333/// #         .unwrap()
5334/// #         .https_or_http()
5335/// #         .enable_http1()
5336/// #         .build()
5337/// # );
5338/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
5339/// // You can configure optional parameters by calling the respective setters at will, and
5340/// // execute the final call using `doit()`.
5341/// // Values shown here are possibly random and not representative !
5342/// let result = hub.partners().customers_list(-88)
5343///              .page_token("amet")
5344///              .page_size(-20)
5345///              .doit().await;
5346/// # }
5347/// ```
5348pub struct PartnerCustomerListCall<'a, C>
5349where
5350    C: 'a,
5351{
5352    hub: &'a AndroidProvisioningPartner<C>,
5353    _partner_id: i64,
5354    _page_token: Option<String>,
5355    _page_size: Option<i32>,
5356    _delegate: Option<&'a mut dyn common::Delegate>,
5357    _additional_params: HashMap<String, String>,
5358}
5359
5360impl<'a, C> common::CallBuilder for PartnerCustomerListCall<'a, C> {}
5361
5362impl<'a, C> PartnerCustomerListCall<'a, C>
5363where
5364    C: common::Connector,
5365{
5366    /// Perform the operation you have build so far.
5367    pub async fn doit(mut self) -> common::Result<(common::Response, ListCustomersResponse)> {
5368        use std::borrow::Cow;
5369        use std::io::{Read, Seek};
5370
5371        use common::{url::Params, ToParts};
5372        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5373
5374        let mut dd = common::DefaultDelegate;
5375        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5376        dlg.begin(common::MethodInfo {
5377            id: "androiddeviceprovisioning.partners.customers.list",
5378            http_method: hyper::Method::GET,
5379        });
5380
5381        for &field in ["alt", "partnerId", "pageToken", "pageSize"].iter() {
5382            if self._additional_params.contains_key(field) {
5383                dlg.finished(false);
5384                return Err(common::Error::FieldClash(field));
5385            }
5386        }
5387
5388        let mut params = Params::with_capacity(5 + self._additional_params.len());
5389        params.push("partnerId", self._partner_id.to_string());
5390        if let Some(value) = self._page_token.as_ref() {
5391            params.push("pageToken", value);
5392        }
5393        if let Some(value) = self._page_size.as_ref() {
5394            params.push("pageSize", value.to_string());
5395        }
5396
5397        params.extend(self._additional_params.iter());
5398
5399        params.push("alt", "json");
5400        let mut url = self.hub._base_url.clone() + "v1/partners/{+partnerId}/customers";
5401
5402        match dlg.api_key() {
5403            Some(value) => params.push("key", value),
5404            None => {
5405                dlg.finished(false);
5406                return Err(common::Error::MissingAPIKey);
5407            }
5408        }
5409
5410        #[allow(clippy::single_element_loop)]
5411        for &(find_this, param_name) in [("{+partnerId}", "partnerId")].iter() {
5412            url = params.uri_replacement(url, param_name, find_this, true);
5413        }
5414        {
5415            let to_remove = ["partnerId"];
5416            params.remove_params(&to_remove);
5417        }
5418
5419        let url = params.parse_with_url(&url);
5420
5421        loop {
5422            let mut req_result = {
5423                let client = &self.hub.client;
5424                dlg.pre_request();
5425                let mut req_builder = hyper::Request::builder()
5426                    .method(hyper::Method::GET)
5427                    .uri(url.as_str())
5428                    .header(USER_AGENT, self.hub._user_agent.clone());
5429
5430                let request = req_builder
5431                    .header(CONTENT_LENGTH, 0_u64)
5432                    .body(common::to_body::<String>(None));
5433
5434                client.request(request.unwrap()).await
5435            };
5436
5437            match req_result {
5438                Err(err) => {
5439                    if let common::Retry::After(d) = dlg.http_error(&err) {
5440                        sleep(d).await;
5441                        continue;
5442                    }
5443                    dlg.finished(false);
5444                    return Err(common::Error::HttpError(err));
5445                }
5446                Ok(res) => {
5447                    let (mut parts, body) = res.into_parts();
5448                    let mut body = common::Body::new(body);
5449                    if !parts.status.is_success() {
5450                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5451                        let error = serde_json::from_str(&common::to_string(&bytes));
5452                        let response = common::to_response(parts, bytes.into());
5453
5454                        if let common::Retry::After(d) =
5455                            dlg.http_failure(&response, error.as_ref().ok())
5456                        {
5457                            sleep(d).await;
5458                            continue;
5459                        }
5460
5461                        dlg.finished(false);
5462
5463                        return Err(match error {
5464                            Ok(value) => common::Error::BadRequest(value),
5465                            _ => common::Error::Failure(response),
5466                        });
5467                    }
5468                    let response = {
5469                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5470                        let encoded = common::to_string(&bytes);
5471                        match serde_json::from_str(&encoded) {
5472                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5473                            Err(error) => {
5474                                dlg.response_json_decode_error(&encoded, &error);
5475                                return Err(common::Error::JsonDecodeError(
5476                                    encoded.to_string(),
5477                                    error,
5478                                ));
5479                            }
5480                        }
5481                    };
5482
5483                    dlg.finished(true);
5484                    return Ok(response);
5485                }
5486            }
5487        }
5488    }
5489
5490    /// Required. The ID of the reseller partner.
5491    ///
5492    /// Sets the *partner id* path property to the given value.
5493    ///
5494    /// Even though the property as already been set when instantiating this call,
5495    /// we provide this method for API completeness.
5496    pub fn partner_id(mut self, new_value: i64) -> PartnerCustomerListCall<'a, C> {
5497        self._partner_id = new_value;
5498        self
5499    }
5500    /// A token identifying a page of results returned by the server.
5501    ///
5502    /// Sets the *page token* query property to the given value.
5503    pub fn page_token(mut self, new_value: &str) -> PartnerCustomerListCall<'a, C> {
5504        self._page_token = Some(new_value.to_string());
5505        self
5506    }
5507    /// The maximum number of results to be returned. If not specified or 0, all the records are returned.
5508    ///
5509    /// Sets the *page size* query property to the given value.
5510    pub fn page_size(mut self, new_value: i32) -> PartnerCustomerListCall<'a, C> {
5511        self._page_size = Some(new_value);
5512        self
5513    }
5514    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5515    /// while executing the actual API request.
5516    ///
5517    /// ````text
5518    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5519    /// ````
5520    ///
5521    /// Sets the *delegate* property to the given value.
5522    pub fn delegate(
5523        mut self,
5524        new_value: &'a mut dyn common::Delegate,
5525    ) -> PartnerCustomerListCall<'a, C> {
5526        self._delegate = Some(new_value);
5527        self
5528    }
5529
5530    /// Set any additional parameter of the query string used in the request.
5531    /// It should be used to set parameters which are not yet available through their own
5532    /// setters.
5533    ///
5534    /// Please note that this method must not be used to set any of the known parameters
5535    /// which have their own setter method. If done anyway, the request will fail.
5536    ///
5537    /// # Additional Parameters
5538    ///
5539    /// * *$.xgafv* (query-string) - V1 error format.
5540    /// * *access_token* (query-string) - OAuth access token.
5541    /// * *alt* (query-string) - Data format for response.
5542    /// * *callback* (query-string) - JSONP
5543    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5544    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5545    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5546    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5547    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5548    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5549    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5550    pub fn param<T>(mut self, name: T, value: T) -> PartnerCustomerListCall<'a, C>
5551    where
5552        T: AsRef<str>,
5553    {
5554        self._additional_params
5555            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5556        self
5557    }
5558}
5559
5560/// Claims a device for a customer and adds it to zero-touch enrollment. If the device is already claimed by another customer, the call returns an error.
5561///
5562/// A builder for the *devices.claim* method supported by a *partner* resource.
5563/// It is not used directly, but through a [`PartnerMethods`] instance.
5564///
5565/// # Example
5566///
5567/// Instantiate a resource method builder
5568///
5569/// ```test_harness,no_run
5570/// # extern crate hyper;
5571/// # extern crate hyper_rustls;
5572/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
5573/// use androiddeviceprovisioning1::api::ClaimDeviceRequest;
5574/// # async fn dox() {
5575/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5576///
5577/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5578/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5579/// #     secret,
5580/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5581/// # ).build().await.unwrap();
5582///
5583/// # let client = hyper_util::client::legacy::Client::builder(
5584/// #     hyper_util::rt::TokioExecutor::new()
5585/// # )
5586/// # .build(
5587/// #     hyper_rustls::HttpsConnectorBuilder::new()
5588/// #         .with_native_roots()
5589/// #         .unwrap()
5590/// #         .https_or_http()
5591/// #         .enable_http1()
5592/// #         .build()
5593/// # );
5594/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
5595/// // As the method needs a request, you would usually fill it with the desired information
5596/// // into the respective structure. Some of the parts shown here might not be applicable !
5597/// // Values shown here are possibly random and not representative !
5598/// let mut req = ClaimDeviceRequest::default();
5599///
5600/// // You can configure optional parameters by calling the respective setters at will, and
5601/// // execute the final call using `doit()`.
5602/// // Values shown here are possibly random and not representative !
5603/// let result = hub.partners().devices_claim(req, -50)
5604///              .doit().await;
5605/// # }
5606/// ```
5607pub struct PartnerDeviceClaimCall<'a, C>
5608where
5609    C: 'a,
5610{
5611    hub: &'a AndroidProvisioningPartner<C>,
5612    _request: ClaimDeviceRequest,
5613    _partner_id: i64,
5614    _delegate: Option<&'a mut dyn common::Delegate>,
5615    _additional_params: HashMap<String, String>,
5616}
5617
5618impl<'a, C> common::CallBuilder for PartnerDeviceClaimCall<'a, C> {}
5619
5620impl<'a, C> PartnerDeviceClaimCall<'a, C>
5621where
5622    C: common::Connector,
5623{
5624    /// Perform the operation you have build so far.
5625    pub async fn doit(mut self) -> common::Result<(common::Response, ClaimDeviceResponse)> {
5626        use std::borrow::Cow;
5627        use std::io::{Read, Seek};
5628
5629        use common::{url::Params, ToParts};
5630        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5631
5632        let mut dd = common::DefaultDelegate;
5633        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5634        dlg.begin(common::MethodInfo {
5635            id: "androiddeviceprovisioning.partners.devices.claim",
5636            http_method: hyper::Method::POST,
5637        });
5638
5639        for &field in ["alt", "partnerId"].iter() {
5640            if self._additional_params.contains_key(field) {
5641                dlg.finished(false);
5642                return Err(common::Error::FieldClash(field));
5643            }
5644        }
5645
5646        let mut params = Params::with_capacity(4 + self._additional_params.len());
5647        params.push("partnerId", self._partner_id.to_string());
5648
5649        params.extend(self._additional_params.iter());
5650
5651        params.push("alt", "json");
5652        let mut url = self.hub._base_url.clone() + "v1/partners/{+partnerId}/devices:claim";
5653
5654        match dlg.api_key() {
5655            Some(value) => params.push("key", value),
5656            None => {
5657                dlg.finished(false);
5658                return Err(common::Error::MissingAPIKey);
5659            }
5660        }
5661
5662        #[allow(clippy::single_element_loop)]
5663        for &(find_this, param_name) in [("{+partnerId}", "partnerId")].iter() {
5664            url = params.uri_replacement(url, param_name, find_this, true);
5665        }
5666        {
5667            let to_remove = ["partnerId"];
5668            params.remove_params(&to_remove);
5669        }
5670
5671        let url = params.parse_with_url(&url);
5672
5673        let mut json_mime_type = mime::APPLICATION_JSON;
5674        let mut request_value_reader = {
5675            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5676            common::remove_json_null_values(&mut value);
5677            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5678            serde_json::to_writer(&mut dst, &value).unwrap();
5679            dst
5680        };
5681        let request_size = request_value_reader
5682            .seek(std::io::SeekFrom::End(0))
5683            .unwrap();
5684        request_value_reader
5685            .seek(std::io::SeekFrom::Start(0))
5686            .unwrap();
5687
5688        loop {
5689            request_value_reader
5690                .seek(std::io::SeekFrom::Start(0))
5691                .unwrap();
5692            let mut req_result = {
5693                let client = &self.hub.client;
5694                dlg.pre_request();
5695                let mut req_builder = hyper::Request::builder()
5696                    .method(hyper::Method::POST)
5697                    .uri(url.as_str())
5698                    .header(USER_AGENT, self.hub._user_agent.clone());
5699
5700                let request = req_builder
5701                    .header(CONTENT_TYPE, json_mime_type.to_string())
5702                    .header(CONTENT_LENGTH, request_size as u64)
5703                    .body(common::to_body(
5704                        request_value_reader.get_ref().clone().into(),
5705                    ));
5706
5707                client.request(request.unwrap()).await
5708            };
5709
5710            match req_result {
5711                Err(err) => {
5712                    if let common::Retry::After(d) = dlg.http_error(&err) {
5713                        sleep(d).await;
5714                        continue;
5715                    }
5716                    dlg.finished(false);
5717                    return Err(common::Error::HttpError(err));
5718                }
5719                Ok(res) => {
5720                    let (mut parts, body) = res.into_parts();
5721                    let mut body = common::Body::new(body);
5722                    if !parts.status.is_success() {
5723                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5724                        let error = serde_json::from_str(&common::to_string(&bytes));
5725                        let response = common::to_response(parts, bytes.into());
5726
5727                        if let common::Retry::After(d) =
5728                            dlg.http_failure(&response, error.as_ref().ok())
5729                        {
5730                            sleep(d).await;
5731                            continue;
5732                        }
5733
5734                        dlg.finished(false);
5735
5736                        return Err(match error {
5737                            Ok(value) => common::Error::BadRequest(value),
5738                            _ => common::Error::Failure(response),
5739                        });
5740                    }
5741                    let response = {
5742                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5743                        let encoded = common::to_string(&bytes);
5744                        match serde_json::from_str(&encoded) {
5745                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5746                            Err(error) => {
5747                                dlg.response_json_decode_error(&encoded, &error);
5748                                return Err(common::Error::JsonDecodeError(
5749                                    encoded.to_string(),
5750                                    error,
5751                                ));
5752                            }
5753                        }
5754                    };
5755
5756                    dlg.finished(true);
5757                    return Ok(response);
5758                }
5759            }
5760        }
5761    }
5762
5763    ///
5764    /// Sets the *request* property to the given value.
5765    ///
5766    /// Even though the property as already been set when instantiating this call,
5767    /// we provide this method for API completeness.
5768    pub fn request(mut self, new_value: ClaimDeviceRequest) -> PartnerDeviceClaimCall<'a, C> {
5769        self._request = new_value;
5770        self
5771    }
5772    /// Required. The ID of the reseller partner.
5773    ///
5774    /// Sets the *partner id* path property to the given value.
5775    ///
5776    /// Even though the property as already been set when instantiating this call,
5777    /// we provide this method for API completeness.
5778    pub fn partner_id(mut self, new_value: i64) -> PartnerDeviceClaimCall<'a, C> {
5779        self._partner_id = new_value;
5780        self
5781    }
5782    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5783    /// while executing the actual API request.
5784    ///
5785    /// ````text
5786    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5787    /// ````
5788    ///
5789    /// Sets the *delegate* property to the given value.
5790    pub fn delegate(
5791        mut self,
5792        new_value: &'a mut dyn common::Delegate,
5793    ) -> PartnerDeviceClaimCall<'a, C> {
5794        self._delegate = Some(new_value);
5795        self
5796    }
5797
5798    /// Set any additional parameter of the query string used in the request.
5799    /// It should be used to set parameters which are not yet available through their own
5800    /// setters.
5801    ///
5802    /// Please note that this method must not be used to set any of the known parameters
5803    /// which have their own setter method. If done anyway, the request will fail.
5804    ///
5805    /// # Additional Parameters
5806    ///
5807    /// * *$.xgafv* (query-string) - V1 error format.
5808    /// * *access_token* (query-string) - OAuth access token.
5809    /// * *alt* (query-string) - Data format for response.
5810    /// * *callback* (query-string) - JSONP
5811    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5812    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5813    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5814    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5815    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5816    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5817    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5818    pub fn param<T>(mut self, name: T, value: T) -> PartnerDeviceClaimCall<'a, C>
5819    where
5820        T: AsRef<str>,
5821    {
5822        self._additional_params
5823            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5824        self
5825    }
5826}
5827
5828/// Claims a batch of devices for a customer asynchronously. Adds the devices to zero-touch enrollment. To learn more, read [Long‑running batch operations](https://developers.google.com/zero-touch/guides/how-it-works#operations).
5829///
5830/// A builder for the *devices.claimAsync* method supported by a *partner* resource.
5831/// It is not used directly, but through a [`PartnerMethods`] instance.
5832///
5833/// # Example
5834///
5835/// Instantiate a resource method builder
5836///
5837/// ```test_harness,no_run
5838/// # extern crate hyper;
5839/// # extern crate hyper_rustls;
5840/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
5841/// use androiddeviceprovisioning1::api::ClaimDevicesRequest;
5842/// # async fn dox() {
5843/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5844///
5845/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5846/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5847/// #     secret,
5848/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5849/// # ).build().await.unwrap();
5850///
5851/// # let client = hyper_util::client::legacy::Client::builder(
5852/// #     hyper_util::rt::TokioExecutor::new()
5853/// # )
5854/// # .build(
5855/// #     hyper_rustls::HttpsConnectorBuilder::new()
5856/// #         .with_native_roots()
5857/// #         .unwrap()
5858/// #         .https_or_http()
5859/// #         .enable_http1()
5860/// #         .build()
5861/// # );
5862/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
5863/// // As the method needs a request, you would usually fill it with the desired information
5864/// // into the respective structure. Some of the parts shown here might not be applicable !
5865/// // Values shown here are possibly random and not representative !
5866/// let mut req = ClaimDevicesRequest::default();
5867///
5868/// // You can configure optional parameters by calling the respective setters at will, and
5869/// // execute the final call using `doit()`.
5870/// // Values shown here are possibly random and not representative !
5871/// let result = hub.partners().devices_claim_async(req, -93)
5872///              .doit().await;
5873/// # }
5874/// ```
5875pub struct PartnerDeviceClaimAsyncCall<'a, C>
5876where
5877    C: 'a,
5878{
5879    hub: &'a AndroidProvisioningPartner<C>,
5880    _request: ClaimDevicesRequest,
5881    _partner_id: i64,
5882    _delegate: Option<&'a mut dyn common::Delegate>,
5883    _additional_params: HashMap<String, String>,
5884}
5885
5886impl<'a, C> common::CallBuilder for PartnerDeviceClaimAsyncCall<'a, C> {}
5887
5888impl<'a, C> PartnerDeviceClaimAsyncCall<'a, C>
5889where
5890    C: common::Connector,
5891{
5892    /// Perform the operation you have build so far.
5893    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5894        use std::borrow::Cow;
5895        use std::io::{Read, Seek};
5896
5897        use common::{url::Params, ToParts};
5898        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5899
5900        let mut dd = common::DefaultDelegate;
5901        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5902        dlg.begin(common::MethodInfo {
5903            id: "androiddeviceprovisioning.partners.devices.claimAsync",
5904            http_method: hyper::Method::POST,
5905        });
5906
5907        for &field in ["alt", "partnerId"].iter() {
5908            if self._additional_params.contains_key(field) {
5909                dlg.finished(false);
5910                return Err(common::Error::FieldClash(field));
5911            }
5912        }
5913
5914        let mut params = Params::with_capacity(4 + self._additional_params.len());
5915        params.push("partnerId", self._partner_id.to_string());
5916
5917        params.extend(self._additional_params.iter());
5918
5919        params.push("alt", "json");
5920        let mut url = self.hub._base_url.clone() + "v1/partners/{+partnerId}/devices:claimAsync";
5921
5922        match dlg.api_key() {
5923            Some(value) => params.push("key", value),
5924            None => {
5925                dlg.finished(false);
5926                return Err(common::Error::MissingAPIKey);
5927            }
5928        }
5929
5930        #[allow(clippy::single_element_loop)]
5931        for &(find_this, param_name) in [("{+partnerId}", "partnerId")].iter() {
5932            url = params.uri_replacement(url, param_name, find_this, true);
5933        }
5934        {
5935            let to_remove = ["partnerId"];
5936            params.remove_params(&to_remove);
5937        }
5938
5939        let url = params.parse_with_url(&url);
5940
5941        let mut json_mime_type = mime::APPLICATION_JSON;
5942        let mut request_value_reader = {
5943            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5944            common::remove_json_null_values(&mut value);
5945            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5946            serde_json::to_writer(&mut dst, &value).unwrap();
5947            dst
5948        };
5949        let request_size = request_value_reader
5950            .seek(std::io::SeekFrom::End(0))
5951            .unwrap();
5952        request_value_reader
5953            .seek(std::io::SeekFrom::Start(0))
5954            .unwrap();
5955
5956        loop {
5957            request_value_reader
5958                .seek(std::io::SeekFrom::Start(0))
5959                .unwrap();
5960            let mut req_result = {
5961                let client = &self.hub.client;
5962                dlg.pre_request();
5963                let mut req_builder = hyper::Request::builder()
5964                    .method(hyper::Method::POST)
5965                    .uri(url.as_str())
5966                    .header(USER_AGENT, self.hub._user_agent.clone());
5967
5968                let request = req_builder
5969                    .header(CONTENT_TYPE, json_mime_type.to_string())
5970                    .header(CONTENT_LENGTH, request_size as u64)
5971                    .body(common::to_body(
5972                        request_value_reader.get_ref().clone().into(),
5973                    ));
5974
5975                client.request(request.unwrap()).await
5976            };
5977
5978            match req_result {
5979                Err(err) => {
5980                    if let common::Retry::After(d) = dlg.http_error(&err) {
5981                        sleep(d).await;
5982                        continue;
5983                    }
5984                    dlg.finished(false);
5985                    return Err(common::Error::HttpError(err));
5986                }
5987                Ok(res) => {
5988                    let (mut parts, body) = res.into_parts();
5989                    let mut body = common::Body::new(body);
5990                    if !parts.status.is_success() {
5991                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5992                        let error = serde_json::from_str(&common::to_string(&bytes));
5993                        let response = common::to_response(parts, bytes.into());
5994
5995                        if let common::Retry::After(d) =
5996                            dlg.http_failure(&response, error.as_ref().ok())
5997                        {
5998                            sleep(d).await;
5999                            continue;
6000                        }
6001
6002                        dlg.finished(false);
6003
6004                        return Err(match error {
6005                            Ok(value) => common::Error::BadRequest(value),
6006                            _ => common::Error::Failure(response),
6007                        });
6008                    }
6009                    let response = {
6010                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6011                        let encoded = common::to_string(&bytes);
6012                        match serde_json::from_str(&encoded) {
6013                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6014                            Err(error) => {
6015                                dlg.response_json_decode_error(&encoded, &error);
6016                                return Err(common::Error::JsonDecodeError(
6017                                    encoded.to_string(),
6018                                    error,
6019                                ));
6020                            }
6021                        }
6022                    };
6023
6024                    dlg.finished(true);
6025                    return Ok(response);
6026                }
6027            }
6028        }
6029    }
6030
6031    ///
6032    /// Sets the *request* property to the given value.
6033    ///
6034    /// Even though the property as already been set when instantiating this call,
6035    /// we provide this method for API completeness.
6036    pub fn request(mut self, new_value: ClaimDevicesRequest) -> PartnerDeviceClaimAsyncCall<'a, C> {
6037        self._request = new_value;
6038        self
6039    }
6040    /// Required. The ID of the reseller partner.
6041    ///
6042    /// Sets the *partner id* path property to the given value.
6043    ///
6044    /// Even though the property as already been set when instantiating this call,
6045    /// we provide this method for API completeness.
6046    pub fn partner_id(mut self, new_value: i64) -> PartnerDeviceClaimAsyncCall<'a, C> {
6047        self._partner_id = new_value;
6048        self
6049    }
6050    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6051    /// while executing the actual API request.
6052    ///
6053    /// ````text
6054    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6055    /// ````
6056    ///
6057    /// Sets the *delegate* property to the given value.
6058    pub fn delegate(
6059        mut self,
6060        new_value: &'a mut dyn common::Delegate,
6061    ) -> PartnerDeviceClaimAsyncCall<'a, C> {
6062        self._delegate = Some(new_value);
6063        self
6064    }
6065
6066    /// Set any additional parameter of the query string used in the request.
6067    /// It should be used to set parameters which are not yet available through their own
6068    /// setters.
6069    ///
6070    /// Please note that this method must not be used to set any of the known parameters
6071    /// which have their own setter method. If done anyway, the request will fail.
6072    ///
6073    /// # Additional Parameters
6074    ///
6075    /// * *$.xgafv* (query-string) - V1 error format.
6076    /// * *access_token* (query-string) - OAuth access token.
6077    /// * *alt* (query-string) - Data format for response.
6078    /// * *callback* (query-string) - JSONP
6079    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6080    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6081    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6082    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6083    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6084    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6085    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6086    pub fn param<T>(mut self, name: T, value: T) -> PartnerDeviceClaimAsyncCall<'a, C>
6087    where
6088        T: AsRef<str>,
6089    {
6090        self._additional_params
6091            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6092        self
6093    }
6094}
6095
6096/// Finds devices by hardware identifiers, such as IMEI.
6097///
6098/// A builder for the *devices.findByIdentifier* method supported by a *partner* resource.
6099/// It is not used directly, but through a [`PartnerMethods`] instance.
6100///
6101/// # Example
6102///
6103/// Instantiate a resource method builder
6104///
6105/// ```test_harness,no_run
6106/// # extern crate hyper;
6107/// # extern crate hyper_rustls;
6108/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
6109/// use androiddeviceprovisioning1::api::FindDevicesByDeviceIdentifierRequest;
6110/// # async fn dox() {
6111/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6112///
6113/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6114/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6115/// #     secret,
6116/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6117/// # ).build().await.unwrap();
6118///
6119/// # let client = hyper_util::client::legacy::Client::builder(
6120/// #     hyper_util::rt::TokioExecutor::new()
6121/// # )
6122/// # .build(
6123/// #     hyper_rustls::HttpsConnectorBuilder::new()
6124/// #         .with_native_roots()
6125/// #         .unwrap()
6126/// #         .https_or_http()
6127/// #         .enable_http1()
6128/// #         .build()
6129/// # );
6130/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
6131/// // As the method needs a request, you would usually fill it with the desired information
6132/// // into the respective structure. Some of the parts shown here might not be applicable !
6133/// // Values shown here are possibly random and not representative !
6134/// let mut req = FindDevicesByDeviceIdentifierRequest::default();
6135///
6136/// // You can configure optional parameters by calling the respective setters at will, and
6137/// // execute the final call using `doit()`.
6138/// // Values shown here are possibly random and not representative !
6139/// let result = hub.partners().devices_find_by_identifier(req, -37)
6140///              .doit().await;
6141/// # }
6142/// ```
6143pub struct PartnerDeviceFindByIdentifierCall<'a, C>
6144where
6145    C: 'a,
6146{
6147    hub: &'a AndroidProvisioningPartner<C>,
6148    _request: FindDevicesByDeviceIdentifierRequest,
6149    _partner_id: i64,
6150    _delegate: Option<&'a mut dyn common::Delegate>,
6151    _additional_params: HashMap<String, String>,
6152}
6153
6154impl<'a, C> common::CallBuilder for PartnerDeviceFindByIdentifierCall<'a, C> {}
6155
6156impl<'a, C> PartnerDeviceFindByIdentifierCall<'a, C>
6157where
6158    C: common::Connector,
6159{
6160    /// Perform the operation you have build so far.
6161    pub async fn doit(
6162        mut self,
6163    ) -> common::Result<(common::Response, FindDevicesByDeviceIdentifierResponse)> {
6164        use std::borrow::Cow;
6165        use std::io::{Read, Seek};
6166
6167        use common::{url::Params, ToParts};
6168        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6169
6170        let mut dd = common::DefaultDelegate;
6171        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6172        dlg.begin(common::MethodInfo {
6173            id: "androiddeviceprovisioning.partners.devices.findByIdentifier",
6174            http_method: hyper::Method::POST,
6175        });
6176
6177        for &field in ["alt", "partnerId"].iter() {
6178            if self._additional_params.contains_key(field) {
6179                dlg.finished(false);
6180                return Err(common::Error::FieldClash(field));
6181            }
6182        }
6183
6184        let mut params = Params::with_capacity(4 + self._additional_params.len());
6185        params.push("partnerId", self._partner_id.to_string());
6186
6187        params.extend(self._additional_params.iter());
6188
6189        params.push("alt", "json");
6190        let mut url =
6191            self.hub._base_url.clone() + "v1/partners/{+partnerId}/devices:findByIdentifier";
6192
6193        match dlg.api_key() {
6194            Some(value) => params.push("key", value),
6195            None => {
6196                dlg.finished(false);
6197                return Err(common::Error::MissingAPIKey);
6198            }
6199        }
6200
6201        #[allow(clippy::single_element_loop)]
6202        for &(find_this, param_name) in [("{+partnerId}", "partnerId")].iter() {
6203            url = params.uri_replacement(url, param_name, find_this, true);
6204        }
6205        {
6206            let to_remove = ["partnerId"];
6207            params.remove_params(&to_remove);
6208        }
6209
6210        let url = params.parse_with_url(&url);
6211
6212        let mut json_mime_type = mime::APPLICATION_JSON;
6213        let mut request_value_reader = {
6214            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6215            common::remove_json_null_values(&mut value);
6216            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6217            serde_json::to_writer(&mut dst, &value).unwrap();
6218            dst
6219        };
6220        let request_size = request_value_reader
6221            .seek(std::io::SeekFrom::End(0))
6222            .unwrap();
6223        request_value_reader
6224            .seek(std::io::SeekFrom::Start(0))
6225            .unwrap();
6226
6227        loop {
6228            request_value_reader
6229                .seek(std::io::SeekFrom::Start(0))
6230                .unwrap();
6231            let mut req_result = {
6232                let client = &self.hub.client;
6233                dlg.pre_request();
6234                let mut req_builder = hyper::Request::builder()
6235                    .method(hyper::Method::POST)
6236                    .uri(url.as_str())
6237                    .header(USER_AGENT, self.hub._user_agent.clone());
6238
6239                let request = req_builder
6240                    .header(CONTENT_TYPE, json_mime_type.to_string())
6241                    .header(CONTENT_LENGTH, request_size as u64)
6242                    .body(common::to_body(
6243                        request_value_reader.get_ref().clone().into(),
6244                    ));
6245
6246                client.request(request.unwrap()).await
6247            };
6248
6249            match req_result {
6250                Err(err) => {
6251                    if let common::Retry::After(d) = dlg.http_error(&err) {
6252                        sleep(d).await;
6253                        continue;
6254                    }
6255                    dlg.finished(false);
6256                    return Err(common::Error::HttpError(err));
6257                }
6258                Ok(res) => {
6259                    let (mut parts, body) = res.into_parts();
6260                    let mut body = common::Body::new(body);
6261                    if !parts.status.is_success() {
6262                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6263                        let error = serde_json::from_str(&common::to_string(&bytes));
6264                        let response = common::to_response(parts, bytes.into());
6265
6266                        if let common::Retry::After(d) =
6267                            dlg.http_failure(&response, error.as_ref().ok())
6268                        {
6269                            sleep(d).await;
6270                            continue;
6271                        }
6272
6273                        dlg.finished(false);
6274
6275                        return Err(match error {
6276                            Ok(value) => common::Error::BadRequest(value),
6277                            _ => common::Error::Failure(response),
6278                        });
6279                    }
6280                    let response = {
6281                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6282                        let encoded = common::to_string(&bytes);
6283                        match serde_json::from_str(&encoded) {
6284                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6285                            Err(error) => {
6286                                dlg.response_json_decode_error(&encoded, &error);
6287                                return Err(common::Error::JsonDecodeError(
6288                                    encoded.to_string(),
6289                                    error,
6290                                ));
6291                            }
6292                        }
6293                    };
6294
6295                    dlg.finished(true);
6296                    return Ok(response);
6297                }
6298            }
6299        }
6300    }
6301
6302    ///
6303    /// Sets the *request* property to the given value.
6304    ///
6305    /// Even though the property as already been set when instantiating this call,
6306    /// we provide this method for API completeness.
6307    pub fn request(
6308        mut self,
6309        new_value: FindDevicesByDeviceIdentifierRequest,
6310    ) -> PartnerDeviceFindByIdentifierCall<'a, C> {
6311        self._request = new_value;
6312        self
6313    }
6314    /// Required. The ID of the reseller partner.
6315    ///
6316    /// Sets the *partner id* path property to the given value.
6317    ///
6318    /// Even though the property as already been set when instantiating this call,
6319    /// we provide this method for API completeness.
6320    pub fn partner_id(mut self, new_value: i64) -> PartnerDeviceFindByIdentifierCall<'a, C> {
6321        self._partner_id = new_value;
6322        self
6323    }
6324    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6325    /// while executing the actual API request.
6326    ///
6327    /// ````text
6328    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6329    /// ````
6330    ///
6331    /// Sets the *delegate* property to the given value.
6332    pub fn delegate(
6333        mut self,
6334        new_value: &'a mut dyn common::Delegate,
6335    ) -> PartnerDeviceFindByIdentifierCall<'a, C> {
6336        self._delegate = Some(new_value);
6337        self
6338    }
6339
6340    /// Set any additional parameter of the query string used in the request.
6341    /// It should be used to set parameters which are not yet available through their own
6342    /// setters.
6343    ///
6344    /// Please note that this method must not be used to set any of the known parameters
6345    /// which have their own setter method. If done anyway, the request will fail.
6346    ///
6347    /// # Additional Parameters
6348    ///
6349    /// * *$.xgafv* (query-string) - V1 error format.
6350    /// * *access_token* (query-string) - OAuth access token.
6351    /// * *alt* (query-string) - Data format for response.
6352    /// * *callback* (query-string) - JSONP
6353    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6354    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6355    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6356    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6357    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6358    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6359    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6360    pub fn param<T>(mut self, name: T, value: T) -> PartnerDeviceFindByIdentifierCall<'a, C>
6361    where
6362        T: AsRef<str>,
6363    {
6364        self._additional_params
6365            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6366        self
6367    }
6368}
6369
6370/// Finds devices claimed for customers. The results only contain devices registered to the reseller that's identified by the `partnerId` argument. The customer's devices purchased from other resellers don't appear in the results.
6371///
6372/// A builder for the *devices.findByOwner* method supported by a *partner* resource.
6373/// It is not used directly, but through a [`PartnerMethods`] instance.
6374///
6375/// # Example
6376///
6377/// Instantiate a resource method builder
6378///
6379/// ```test_harness,no_run
6380/// # extern crate hyper;
6381/// # extern crate hyper_rustls;
6382/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
6383/// use androiddeviceprovisioning1::api::FindDevicesByOwnerRequest;
6384/// # async fn dox() {
6385/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6386///
6387/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6388/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6389/// #     secret,
6390/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6391/// # ).build().await.unwrap();
6392///
6393/// # let client = hyper_util::client::legacy::Client::builder(
6394/// #     hyper_util::rt::TokioExecutor::new()
6395/// # )
6396/// # .build(
6397/// #     hyper_rustls::HttpsConnectorBuilder::new()
6398/// #         .with_native_roots()
6399/// #         .unwrap()
6400/// #         .https_or_http()
6401/// #         .enable_http1()
6402/// #         .build()
6403/// # );
6404/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
6405/// // As the method needs a request, you would usually fill it with the desired information
6406/// // into the respective structure. Some of the parts shown here might not be applicable !
6407/// // Values shown here are possibly random and not representative !
6408/// let mut req = FindDevicesByOwnerRequest::default();
6409///
6410/// // You can configure optional parameters by calling the respective setters at will, and
6411/// // execute the final call using `doit()`.
6412/// // Values shown here are possibly random and not representative !
6413/// let result = hub.partners().devices_find_by_owner(req, -12)
6414///              .doit().await;
6415/// # }
6416/// ```
6417pub struct PartnerDeviceFindByOwnerCall<'a, C>
6418where
6419    C: 'a,
6420{
6421    hub: &'a AndroidProvisioningPartner<C>,
6422    _request: FindDevicesByOwnerRequest,
6423    _partner_id: i64,
6424    _delegate: Option<&'a mut dyn common::Delegate>,
6425    _additional_params: HashMap<String, String>,
6426}
6427
6428impl<'a, C> common::CallBuilder for PartnerDeviceFindByOwnerCall<'a, C> {}
6429
6430impl<'a, C> PartnerDeviceFindByOwnerCall<'a, C>
6431where
6432    C: common::Connector,
6433{
6434    /// Perform the operation you have build so far.
6435    pub async fn doit(mut self) -> common::Result<(common::Response, FindDevicesByOwnerResponse)> {
6436        use std::borrow::Cow;
6437        use std::io::{Read, Seek};
6438
6439        use common::{url::Params, ToParts};
6440        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6441
6442        let mut dd = common::DefaultDelegate;
6443        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6444        dlg.begin(common::MethodInfo {
6445            id: "androiddeviceprovisioning.partners.devices.findByOwner",
6446            http_method: hyper::Method::POST,
6447        });
6448
6449        for &field in ["alt", "partnerId"].iter() {
6450            if self._additional_params.contains_key(field) {
6451                dlg.finished(false);
6452                return Err(common::Error::FieldClash(field));
6453            }
6454        }
6455
6456        let mut params = Params::with_capacity(4 + self._additional_params.len());
6457        params.push("partnerId", self._partner_id.to_string());
6458
6459        params.extend(self._additional_params.iter());
6460
6461        params.push("alt", "json");
6462        let mut url = self.hub._base_url.clone() + "v1/partners/{+partnerId}/devices:findByOwner";
6463
6464        match dlg.api_key() {
6465            Some(value) => params.push("key", value),
6466            None => {
6467                dlg.finished(false);
6468                return Err(common::Error::MissingAPIKey);
6469            }
6470        }
6471
6472        #[allow(clippy::single_element_loop)]
6473        for &(find_this, param_name) in [("{+partnerId}", "partnerId")].iter() {
6474            url = params.uri_replacement(url, param_name, find_this, true);
6475        }
6476        {
6477            let to_remove = ["partnerId"];
6478            params.remove_params(&to_remove);
6479        }
6480
6481        let url = params.parse_with_url(&url);
6482
6483        let mut json_mime_type = mime::APPLICATION_JSON;
6484        let mut request_value_reader = {
6485            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6486            common::remove_json_null_values(&mut value);
6487            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6488            serde_json::to_writer(&mut dst, &value).unwrap();
6489            dst
6490        };
6491        let request_size = request_value_reader
6492            .seek(std::io::SeekFrom::End(0))
6493            .unwrap();
6494        request_value_reader
6495            .seek(std::io::SeekFrom::Start(0))
6496            .unwrap();
6497
6498        loop {
6499            request_value_reader
6500                .seek(std::io::SeekFrom::Start(0))
6501                .unwrap();
6502            let mut req_result = {
6503                let client = &self.hub.client;
6504                dlg.pre_request();
6505                let mut req_builder = hyper::Request::builder()
6506                    .method(hyper::Method::POST)
6507                    .uri(url.as_str())
6508                    .header(USER_AGENT, self.hub._user_agent.clone());
6509
6510                let request = req_builder
6511                    .header(CONTENT_TYPE, json_mime_type.to_string())
6512                    .header(CONTENT_LENGTH, request_size as u64)
6513                    .body(common::to_body(
6514                        request_value_reader.get_ref().clone().into(),
6515                    ));
6516
6517                client.request(request.unwrap()).await
6518            };
6519
6520            match req_result {
6521                Err(err) => {
6522                    if let common::Retry::After(d) = dlg.http_error(&err) {
6523                        sleep(d).await;
6524                        continue;
6525                    }
6526                    dlg.finished(false);
6527                    return Err(common::Error::HttpError(err));
6528                }
6529                Ok(res) => {
6530                    let (mut parts, body) = res.into_parts();
6531                    let mut body = common::Body::new(body);
6532                    if !parts.status.is_success() {
6533                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6534                        let error = serde_json::from_str(&common::to_string(&bytes));
6535                        let response = common::to_response(parts, bytes.into());
6536
6537                        if let common::Retry::After(d) =
6538                            dlg.http_failure(&response, error.as_ref().ok())
6539                        {
6540                            sleep(d).await;
6541                            continue;
6542                        }
6543
6544                        dlg.finished(false);
6545
6546                        return Err(match error {
6547                            Ok(value) => common::Error::BadRequest(value),
6548                            _ => common::Error::Failure(response),
6549                        });
6550                    }
6551                    let response = {
6552                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6553                        let encoded = common::to_string(&bytes);
6554                        match serde_json::from_str(&encoded) {
6555                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6556                            Err(error) => {
6557                                dlg.response_json_decode_error(&encoded, &error);
6558                                return Err(common::Error::JsonDecodeError(
6559                                    encoded.to_string(),
6560                                    error,
6561                                ));
6562                            }
6563                        }
6564                    };
6565
6566                    dlg.finished(true);
6567                    return Ok(response);
6568                }
6569            }
6570        }
6571    }
6572
6573    ///
6574    /// Sets the *request* property to the given value.
6575    ///
6576    /// Even though the property as already been set when instantiating this call,
6577    /// we provide this method for API completeness.
6578    pub fn request(
6579        mut self,
6580        new_value: FindDevicesByOwnerRequest,
6581    ) -> PartnerDeviceFindByOwnerCall<'a, C> {
6582        self._request = new_value;
6583        self
6584    }
6585    /// Required. The ID of the reseller partner.
6586    ///
6587    /// Sets the *partner id* path property to the given value.
6588    ///
6589    /// Even though the property as already been set when instantiating this call,
6590    /// we provide this method for API completeness.
6591    pub fn partner_id(mut self, new_value: i64) -> PartnerDeviceFindByOwnerCall<'a, C> {
6592        self._partner_id = new_value;
6593        self
6594    }
6595    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6596    /// while executing the actual API request.
6597    ///
6598    /// ````text
6599    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6600    /// ````
6601    ///
6602    /// Sets the *delegate* property to the given value.
6603    pub fn delegate(
6604        mut self,
6605        new_value: &'a mut dyn common::Delegate,
6606    ) -> PartnerDeviceFindByOwnerCall<'a, C> {
6607        self._delegate = Some(new_value);
6608        self
6609    }
6610
6611    /// Set any additional parameter of the query string used in the request.
6612    /// It should be used to set parameters which are not yet available through their own
6613    /// setters.
6614    ///
6615    /// Please note that this method must not be used to set any of the known parameters
6616    /// which have their own setter method. If done anyway, the request will fail.
6617    ///
6618    /// # Additional Parameters
6619    ///
6620    /// * *$.xgafv* (query-string) - V1 error format.
6621    /// * *access_token* (query-string) - OAuth access token.
6622    /// * *alt* (query-string) - Data format for response.
6623    /// * *callback* (query-string) - JSONP
6624    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6625    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6626    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6627    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6628    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6629    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6630    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6631    pub fn param<T>(mut self, name: T, value: T) -> PartnerDeviceFindByOwnerCall<'a, C>
6632    where
6633        T: AsRef<str>,
6634    {
6635        self._additional_params
6636            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6637        self
6638    }
6639}
6640
6641/// Gets a device.
6642///
6643/// A builder for the *devices.get* method supported by a *partner* resource.
6644/// It is not used directly, but through a [`PartnerMethods`] instance.
6645///
6646/// # Example
6647///
6648/// Instantiate a resource method builder
6649///
6650/// ```test_harness,no_run
6651/// # extern crate hyper;
6652/// # extern crate hyper_rustls;
6653/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
6654/// # async fn dox() {
6655/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6656///
6657/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6658/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6659/// #     secret,
6660/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6661/// # ).build().await.unwrap();
6662///
6663/// # let client = hyper_util::client::legacy::Client::builder(
6664/// #     hyper_util::rt::TokioExecutor::new()
6665/// # )
6666/// # .build(
6667/// #     hyper_rustls::HttpsConnectorBuilder::new()
6668/// #         .with_native_roots()
6669/// #         .unwrap()
6670/// #         .https_or_http()
6671/// #         .enable_http1()
6672/// #         .build()
6673/// # );
6674/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
6675/// // You can configure optional parameters by calling the respective setters at will, and
6676/// // execute the final call using `doit()`.
6677/// // Values shown here are possibly random and not representative !
6678/// let result = hub.partners().devices_get("name")
6679///              .doit().await;
6680/// # }
6681/// ```
6682pub struct PartnerDeviceGetCall<'a, C>
6683where
6684    C: 'a,
6685{
6686    hub: &'a AndroidProvisioningPartner<C>,
6687    _name: String,
6688    _delegate: Option<&'a mut dyn common::Delegate>,
6689    _additional_params: HashMap<String, String>,
6690}
6691
6692impl<'a, C> common::CallBuilder for PartnerDeviceGetCall<'a, C> {}
6693
6694impl<'a, C> PartnerDeviceGetCall<'a, C>
6695where
6696    C: common::Connector,
6697{
6698    /// Perform the operation you have build so far.
6699    pub async fn doit(mut self) -> common::Result<(common::Response, Device)> {
6700        use std::borrow::Cow;
6701        use std::io::{Read, Seek};
6702
6703        use common::{url::Params, ToParts};
6704        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6705
6706        let mut dd = common::DefaultDelegate;
6707        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6708        dlg.begin(common::MethodInfo {
6709            id: "androiddeviceprovisioning.partners.devices.get",
6710            http_method: hyper::Method::GET,
6711        });
6712
6713        for &field in ["alt", "name"].iter() {
6714            if self._additional_params.contains_key(field) {
6715                dlg.finished(false);
6716                return Err(common::Error::FieldClash(field));
6717            }
6718        }
6719
6720        let mut params = Params::with_capacity(3 + self._additional_params.len());
6721        params.push("name", self._name);
6722
6723        params.extend(self._additional_params.iter());
6724
6725        params.push("alt", "json");
6726        let mut url = self.hub._base_url.clone() + "v1/{+name}";
6727
6728        match dlg.api_key() {
6729            Some(value) => params.push("key", value),
6730            None => {
6731                dlg.finished(false);
6732                return Err(common::Error::MissingAPIKey);
6733            }
6734        }
6735
6736        #[allow(clippy::single_element_loop)]
6737        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6738            url = params.uri_replacement(url, param_name, find_this, true);
6739        }
6740        {
6741            let to_remove = ["name"];
6742            params.remove_params(&to_remove);
6743        }
6744
6745        let url = params.parse_with_url(&url);
6746
6747        loop {
6748            let mut req_result = {
6749                let client = &self.hub.client;
6750                dlg.pre_request();
6751                let mut req_builder = hyper::Request::builder()
6752                    .method(hyper::Method::GET)
6753                    .uri(url.as_str())
6754                    .header(USER_AGENT, self.hub._user_agent.clone());
6755
6756                let request = req_builder
6757                    .header(CONTENT_LENGTH, 0_u64)
6758                    .body(common::to_body::<String>(None));
6759
6760                client.request(request.unwrap()).await
6761            };
6762
6763            match req_result {
6764                Err(err) => {
6765                    if let common::Retry::After(d) = dlg.http_error(&err) {
6766                        sleep(d).await;
6767                        continue;
6768                    }
6769                    dlg.finished(false);
6770                    return Err(common::Error::HttpError(err));
6771                }
6772                Ok(res) => {
6773                    let (mut parts, body) = res.into_parts();
6774                    let mut body = common::Body::new(body);
6775                    if !parts.status.is_success() {
6776                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6777                        let error = serde_json::from_str(&common::to_string(&bytes));
6778                        let response = common::to_response(parts, bytes.into());
6779
6780                        if let common::Retry::After(d) =
6781                            dlg.http_failure(&response, error.as_ref().ok())
6782                        {
6783                            sleep(d).await;
6784                            continue;
6785                        }
6786
6787                        dlg.finished(false);
6788
6789                        return Err(match error {
6790                            Ok(value) => common::Error::BadRequest(value),
6791                            _ => common::Error::Failure(response),
6792                        });
6793                    }
6794                    let response = {
6795                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6796                        let encoded = common::to_string(&bytes);
6797                        match serde_json::from_str(&encoded) {
6798                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6799                            Err(error) => {
6800                                dlg.response_json_decode_error(&encoded, &error);
6801                                return Err(common::Error::JsonDecodeError(
6802                                    encoded.to_string(),
6803                                    error,
6804                                ));
6805                            }
6806                        }
6807                    };
6808
6809                    dlg.finished(true);
6810                    return Ok(response);
6811                }
6812            }
6813        }
6814    }
6815
6816    /// Required. The device API resource name in the format `partners/[PARTNER_ID]/devices/[DEVICE_ID]`.
6817    ///
6818    /// Sets the *name* path property to the given value.
6819    ///
6820    /// Even though the property as already been set when instantiating this call,
6821    /// we provide this method for API completeness.
6822    pub fn name(mut self, new_value: &str) -> PartnerDeviceGetCall<'a, C> {
6823        self._name = new_value.to_string();
6824        self
6825    }
6826    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6827    /// while executing the actual API request.
6828    ///
6829    /// ````text
6830    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6831    /// ````
6832    ///
6833    /// Sets the *delegate* property to the given value.
6834    pub fn delegate(
6835        mut self,
6836        new_value: &'a mut dyn common::Delegate,
6837    ) -> PartnerDeviceGetCall<'a, C> {
6838        self._delegate = Some(new_value);
6839        self
6840    }
6841
6842    /// Set any additional parameter of the query string used in the request.
6843    /// It should be used to set parameters which are not yet available through their own
6844    /// setters.
6845    ///
6846    /// Please note that this method must not be used to set any of the known parameters
6847    /// which have their own setter method. If done anyway, the request will fail.
6848    ///
6849    /// # Additional Parameters
6850    ///
6851    /// * *$.xgafv* (query-string) - V1 error format.
6852    /// * *access_token* (query-string) - OAuth access token.
6853    /// * *alt* (query-string) - Data format for response.
6854    /// * *callback* (query-string) - JSONP
6855    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6856    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6857    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6858    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6859    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6860    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6861    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6862    pub fn param<T>(mut self, name: T, value: T) -> PartnerDeviceGetCall<'a, C>
6863    where
6864        T: AsRef<str>,
6865    {
6866        self._additional_params
6867            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6868        self
6869    }
6870}
6871
6872/// Gets a device's SIM lock state.
6873///
6874/// A builder for the *devices.getSimLockState* method supported by a *partner* resource.
6875/// It is not used directly, but through a [`PartnerMethods`] instance.
6876///
6877/// # Example
6878///
6879/// Instantiate a resource method builder
6880///
6881/// ```test_harness,no_run
6882/// # extern crate hyper;
6883/// # extern crate hyper_rustls;
6884/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
6885/// use androiddeviceprovisioning1::api::GetDeviceSimLockStateRequest;
6886/// # async fn dox() {
6887/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6888///
6889/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6890/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6891/// #     secret,
6892/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6893/// # ).build().await.unwrap();
6894///
6895/// # let client = hyper_util::client::legacy::Client::builder(
6896/// #     hyper_util::rt::TokioExecutor::new()
6897/// # )
6898/// # .build(
6899/// #     hyper_rustls::HttpsConnectorBuilder::new()
6900/// #         .with_native_roots()
6901/// #         .unwrap()
6902/// #         .https_or_http()
6903/// #         .enable_http1()
6904/// #         .build()
6905/// # );
6906/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
6907/// // As the method needs a request, you would usually fill it with the desired information
6908/// // into the respective structure. Some of the parts shown here might not be applicable !
6909/// // Values shown here are possibly random and not representative !
6910/// let mut req = GetDeviceSimLockStateRequest::default();
6911///
6912/// // You can configure optional parameters by calling the respective setters at will, and
6913/// // execute the final call using `doit()`.
6914/// // Values shown here are possibly random and not representative !
6915/// let result = hub.partners().devices_get_sim_lock_state(req, -57)
6916///              .doit().await;
6917/// # }
6918/// ```
6919pub struct PartnerDeviceGetSimLockStateCall<'a, C>
6920where
6921    C: 'a,
6922{
6923    hub: &'a AndroidProvisioningPartner<C>,
6924    _request: GetDeviceSimLockStateRequest,
6925    _partner_id: i64,
6926    _delegate: Option<&'a mut dyn common::Delegate>,
6927    _additional_params: HashMap<String, String>,
6928}
6929
6930impl<'a, C> common::CallBuilder for PartnerDeviceGetSimLockStateCall<'a, C> {}
6931
6932impl<'a, C> PartnerDeviceGetSimLockStateCall<'a, C>
6933where
6934    C: common::Connector,
6935{
6936    /// Perform the operation you have build so far.
6937    pub async fn doit(
6938        mut self,
6939    ) -> common::Result<(common::Response, GetDeviceSimLockStateResponse)> {
6940        use std::borrow::Cow;
6941        use std::io::{Read, Seek};
6942
6943        use common::{url::Params, ToParts};
6944        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6945
6946        let mut dd = common::DefaultDelegate;
6947        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6948        dlg.begin(common::MethodInfo {
6949            id: "androiddeviceprovisioning.partners.devices.getSimLockState",
6950            http_method: hyper::Method::POST,
6951        });
6952
6953        for &field in ["alt", "partnerId"].iter() {
6954            if self._additional_params.contains_key(field) {
6955                dlg.finished(false);
6956                return Err(common::Error::FieldClash(field));
6957            }
6958        }
6959
6960        let mut params = Params::with_capacity(4 + self._additional_params.len());
6961        params.push("partnerId", self._partner_id.to_string());
6962
6963        params.extend(self._additional_params.iter());
6964
6965        params.push("alt", "json");
6966        let mut url =
6967            self.hub._base_url.clone() + "v1/partners/{+partnerId}/devices:getSimLockState";
6968
6969        match dlg.api_key() {
6970            Some(value) => params.push("key", value),
6971            None => {
6972                dlg.finished(false);
6973                return Err(common::Error::MissingAPIKey);
6974            }
6975        }
6976
6977        #[allow(clippy::single_element_loop)]
6978        for &(find_this, param_name) in [("{+partnerId}", "partnerId")].iter() {
6979            url = params.uri_replacement(url, param_name, find_this, true);
6980        }
6981        {
6982            let to_remove = ["partnerId"];
6983            params.remove_params(&to_remove);
6984        }
6985
6986        let url = params.parse_with_url(&url);
6987
6988        let mut json_mime_type = mime::APPLICATION_JSON;
6989        let mut request_value_reader = {
6990            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6991            common::remove_json_null_values(&mut value);
6992            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6993            serde_json::to_writer(&mut dst, &value).unwrap();
6994            dst
6995        };
6996        let request_size = request_value_reader
6997            .seek(std::io::SeekFrom::End(0))
6998            .unwrap();
6999        request_value_reader
7000            .seek(std::io::SeekFrom::Start(0))
7001            .unwrap();
7002
7003        loop {
7004            request_value_reader
7005                .seek(std::io::SeekFrom::Start(0))
7006                .unwrap();
7007            let mut req_result = {
7008                let client = &self.hub.client;
7009                dlg.pre_request();
7010                let mut req_builder = hyper::Request::builder()
7011                    .method(hyper::Method::POST)
7012                    .uri(url.as_str())
7013                    .header(USER_AGENT, self.hub._user_agent.clone());
7014
7015                let request = req_builder
7016                    .header(CONTENT_TYPE, json_mime_type.to_string())
7017                    .header(CONTENT_LENGTH, request_size as u64)
7018                    .body(common::to_body(
7019                        request_value_reader.get_ref().clone().into(),
7020                    ));
7021
7022                client.request(request.unwrap()).await
7023            };
7024
7025            match req_result {
7026                Err(err) => {
7027                    if let common::Retry::After(d) = dlg.http_error(&err) {
7028                        sleep(d).await;
7029                        continue;
7030                    }
7031                    dlg.finished(false);
7032                    return Err(common::Error::HttpError(err));
7033                }
7034                Ok(res) => {
7035                    let (mut parts, body) = res.into_parts();
7036                    let mut body = common::Body::new(body);
7037                    if !parts.status.is_success() {
7038                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7039                        let error = serde_json::from_str(&common::to_string(&bytes));
7040                        let response = common::to_response(parts, bytes.into());
7041
7042                        if let common::Retry::After(d) =
7043                            dlg.http_failure(&response, error.as_ref().ok())
7044                        {
7045                            sleep(d).await;
7046                            continue;
7047                        }
7048
7049                        dlg.finished(false);
7050
7051                        return Err(match error {
7052                            Ok(value) => common::Error::BadRequest(value),
7053                            _ => common::Error::Failure(response),
7054                        });
7055                    }
7056                    let response = {
7057                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7058                        let encoded = common::to_string(&bytes);
7059                        match serde_json::from_str(&encoded) {
7060                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7061                            Err(error) => {
7062                                dlg.response_json_decode_error(&encoded, &error);
7063                                return Err(common::Error::JsonDecodeError(
7064                                    encoded.to_string(),
7065                                    error,
7066                                ));
7067                            }
7068                        }
7069                    };
7070
7071                    dlg.finished(true);
7072                    return Ok(response);
7073                }
7074            }
7075        }
7076    }
7077
7078    ///
7079    /// Sets the *request* property to the given value.
7080    ///
7081    /// Even though the property as already been set when instantiating this call,
7082    /// we provide this method for API completeness.
7083    pub fn request(
7084        mut self,
7085        new_value: GetDeviceSimLockStateRequest,
7086    ) -> PartnerDeviceGetSimLockStateCall<'a, C> {
7087        self._request = new_value;
7088        self
7089    }
7090    /// Required. The ID of the partner.
7091    ///
7092    /// Sets the *partner id* path property to the given value.
7093    ///
7094    /// Even though the property as already been set when instantiating this call,
7095    /// we provide this method for API completeness.
7096    pub fn partner_id(mut self, new_value: i64) -> PartnerDeviceGetSimLockStateCall<'a, C> {
7097        self._partner_id = new_value;
7098        self
7099    }
7100    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7101    /// while executing the actual API request.
7102    ///
7103    /// ````text
7104    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7105    /// ````
7106    ///
7107    /// Sets the *delegate* property to the given value.
7108    pub fn delegate(
7109        mut self,
7110        new_value: &'a mut dyn common::Delegate,
7111    ) -> PartnerDeviceGetSimLockStateCall<'a, C> {
7112        self._delegate = Some(new_value);
7113        self
7114    }
7115
7116    /// Set any additional parameter of the query string used in the request.
7117    /// It should be used to set parameters which are not yet available through their own
7118    /// setters.
7119    ///
7120    /// Please note that this method must not be used to set any of the known parameters
7121    /// which have their own setter method. If done anyway, the request will fail.
7122    ///
7123    /// # Additional Parameters
7124    ///
7125    /// * *$.xgafv* (query-string) - V1 error format.
7126    /// * *access_token* (query-string) - OAuth access token.
7127    /// * *alt* (query-string) - Data format for response.
7128    /// * *callback* (query-string) - JSONP
7129    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7130    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7131    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7132    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7133    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7134    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7135    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7136    pub fn param<T>(mut self, name: T, value: T) -> PartnerDeviceGetSimLockStateCall<'a, C>
7137    where
7138        T: AsRef<str>,
7139    {
7140        self._additional_params
7141            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7142        self
7143    }
7144}
7145
7146/// Updates reseller metadata associated with the device. Android devices only.
7147///
7148/// A builder for the *devices.metadata* method supported by a *partner* resource.
7149/// It is not used directly, but through a [`PartnerMethods`] instance.
7150///
7151/// # Example
7152///
7153/// Instantiate a resource method builder
7154///
7155/// ```test_harness,no_run
7156/// # extern crate hyper;
7157/// # extern crate hyper_rustls;
7158/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
7159/// use androiddeviceprovisioning1::api::UpdateDeviceMetadataRequest;
7160/// # async fn dox() {
7161/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7162///
7163/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7164/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7165/// #     secret,
7166/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7167/// # ).build().await.unwrap();
7168///
7169/// # let client = hyper_util::client::legacy::Client::builder(
7170/// #     hyper_util::rt::TokioExecutor::new()
7171/// # )
7172/// # .build(
7173/// #     hyper_rustls::HttpsConnectorBuilder::new()
7174/// #         .with_native_roots()
7175/// #         .unwrap()
7176/// #         .https_or_http()
7177/// #         .enable_http1()
7178/// #         .build()
7179/// # );
7180/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
7181/// // As the method needs a request, you would usually fill it with the desired information
7182/// // into the respective structure. Some of the parts shown here might not be applicable !
7183/// // Values shown here are possibly random and not representative !
7184/// let mut req = UpdateDeviceMetadataRequest::default();
7185///
7186/// // You can configure optional parameters by calling the respective setters at will, and
7187/// // execute the final call using `doit()`.
7188/// // Values shown here are possibly random and not representative !
7189/// let result = hub.partners().devices_metadata(req, -50, -50)
7190///              .doit().await;
7191/// # }
7192/// ```
7193pub struct PartnerDeviceMetadataCall<'a, C>
7194where
7195    C: 'a,
7196{
7197    hub: &'a AndroidProvisioningPartner<C>,
7198    _request: UpdateDeviceMetadataRequest,
7199    _metadata_owner_id: i64,
7200    _device_id: i64,
7201    _delegate: Option<&'a mut dyn common::Delegate>,
7202    _additional_params: HashMap<String, String>,
7203}
7204
7205impl<'a, C> common::CallBuilder for PartnerDeviceMetadataCall<'a, C> {}
7206
7207impl<'a, C> PartnerDeviceMetadataCall<'a, C>
7208where
7209    C: common::Connector,
7210{
7211    /// Perform the operation you have build so far.
7212    pub async fn doit(mut self) -> common::Result<(common::Response, DeviceMetadata)> {
7213        use std::borrow::Cow;
7214        use std::io::{Read, Seek};
7215
7216        use common::{url::Params, ToParts};
7217        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7218
7219        let mut dd = common::DefaultDelegate;
7220        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7221        dlg.begin(common::MethodInfo {
7222            id: "androiddeviceprovisioning.partners.devices.metadata",
7223            http_method: hyper::Method::POST,
7224        });
7225
7226        for &field in ["alt", "metadataOwnerId", "deviceId"].iter() {
7227            if self._additional_params.contains_key(field) {
7228                dlg.finished(false);
7229                return Err(common::Error::FieldClash(field));
7230            }
7231        }
7232
7233        let mut params = Params::with_capacity(5 + self._additional_params.len());
7234        params.push("metadataOwnerId", self._metadata_owner_id.to_string());
7235        params.push("deviceId", self._device_id.to_string());
7236
7237        params.extend(self._additional_params.iter());
7238
7239        params.push("alt", "json");
7240        let mut url = self.hub._base_url.clone()
7241            + "v1/partners/{+metadataOwnerId}/devices/{+deviceId}/metadata";
7242
7243        match dlg.api_key() {
7244            Some(value) => params.push("key", value),
7245            None => {
7246                dlg.finished(false);
7247                return Err(common::Error::MissingAPIKey);
7248            }
7249        }
7250
7251        #[allow(clippy::single_element_loop)]
7252        for &(find_this, param_name) in [
7253            ("{+metadataOwnerId}", "metadataOwnerId"),
7254            ("{+deviceId}", "deviceId"),
7255        ]
7256        .iter()
7257        {
7258            url = params.uri_replacement(url, param_name, find_this, true);
7259        }
7260        {
7261            let to_remove = ["deviceId", "metadataOwnerId"];
7262            params.remove_params(&to_remove);
7263        }
7264
7265        let url = params.parse_with_url(&url);
7266
7267        let mut json_mime_type = mime::APPLICATION_JSON;
7268        let mut request_value_reader = {
7269            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7270            common::remove_json_null_values(&mut value);
7271            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7272            serde_json::to_writer(&mut dst, &value).unwrap();
7273            dst
7274        };
7275        let request_size = request_value_reader
7276            .seek(std::io::SeekFrom::End(0))
7277            .unwrap();
7278        request_value_reader
7279            .seek(std::io::SeekFrom::Start(0))
7280            .unwrap();
7281
7282        loop {
7283            request_value_reader
7284                .seek(std::io::SeekFrom::Start(0))
7285                .unwrap();
7286            let mut req_result = {
7287                let client = &self.hub.client;
7288                dlg.pre_request();
7289                let mut req_builder = hyper::Request::builder()
7290                    .method(hyper::Method::POST)
7291                    .uri(url.as_str())
7292                    .header(USER_AGENT, self.hub._user_agent.clone());
7293
7294                let request = req_builder
7295                    .header(CONTENT_TYPE, json_mime_type.to_string())
7296                    .header(CONTENT_LENGTH, request_size as u64)
7297                    .body(common::to_body(
7298                        request_value_reader.get_ref().clone().into(),
7299                    ));
7300
7301                client.request(request.unwrap()).await
7302            };
7303
7304            match req_result {
7305                Err(err) => {
7306                    if let common::Retry::After(d) = dlg.http_error(&err) {
7307                        sleep(d).await;
7308                        continue;
7309                    }
7310                    dlg.finished(false);
7311                    return Err(common::Error::HttpError(err));
7312                }
7313                Ok(res) => {
7314                    let (mut parts, body) = res.into_parts();
7315                    let mut body = common::Body::new(body);
7316                    if !parts.status.is_success() {
7317                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7318                        let error = serde_json::from_str(&common::to_string(&bytes));
7319                        let response = common::to_response(parts, bytes.into());
7320
7321                        if let common::Retry::After(d) =
7322                            dlg.http_failure(&response, error.as_ref().ok())
7323                        {
7324                            sleep(d).await;
7325                            continue;
7326                        }
7327
7328                        dlg.finished(false);
7329
7330                        return Err(match error {
7331                            Ok(value) => common::Error::BadRequest(value),
7332                            _ => common::Error::Failure(response),
7333                        });
7334                    }
7335                    let response = {
7336                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7337                        let encoded = common::to_string(&bytes);
7338                        match serde_json::from_str(&encoded) {
7339                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7340                            Err(error) => {
7341                                dlg.response_json_decode_error(&encoded, &error);
7342                                return Err(common::Error::JsonDecodeError(
7343                                    encoded.to_string(),
7344                                    error,
7345                                ));
7346                            }
7347                        }
7348                    };
7349
7350                    dlg.finished(true);
7351                    return Ok(response);
7352                }
7353            }
7354        }
7355    }
7356
7357    ///
7358    /// Sets the *request* property to the given value.
7359    ///
7360    /// Even though the property as already been set when instantiating this call,
7361    /// we provide this method for API completeness.
7362    pub fn request(
7363        mut self,
7364        new_value: UpdateDeviceMetadataRequest,
7365    ) -> PartnerDeviceMetadataCall<'a, C> {
7366        self._request = new_value;
7367        self
7368    }
7369    /// Required. The owner of the newly set metadata. Set this to the partner ID.
7370    ///
7371    /// Sets the *metadata owner id* path property to the given value.
7372    ///
7373    /// Even though the property as already been set when instantiating this call,
7374    /// we provide this method for API completeness.
7375    pub fn metadata_owner_id(mut self, new_value: i64) -> PartnerDeviceMetadataCall<'a, C> {
7376        self._metadata_owner_id = new_value;
7377        self
7378    }
7379    /// Required. The ID of the device.
7380    ///
7381    /// Sets the *device id* path property to the given value.
7382    ///
7383    /// Even though the property as already been set when instantiating this call,
7384    /// we provide this method for API completeness.
7385    pub fn device_id(mut self, new_value: i64) -> PartnerDeviceMetadataCall<'a, C> {
7386        self._device_id = new_value;
7387        self
7388    }
7389    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7390    /// while executing the actual API request.
7391    ///
7392    /// ````text
7393    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7394    /// ````
7395    ///
7396    /// Sets the *delegate* property to the given value.
7397    pub fn delegate(
7398        mut self,
7399        new_value: &'a mut dyn common::Delegate,
7400    ) -> PartnerDeviceMetadataCall<'a, C> {
7401        self._delegate = Some(new_value);
7402        self
7403    }
7404
7405    /// Set any additional parameter of the query string used in the request.
7406    /// It should be used to set parameters which are not yet available through their own
7407    /// setters.
7408    ///
7409    /// Please note that this method must not be used to set any of the known parameters
7410    /// which have their own setter method. If done anyway, the request will fail.
7411    ///
7412    /// # Additional Parameters
7413    ///
7414    /// * *$.xgafv* (query-string) - V1 error format.
7415    /// * *access_token* (query-string) - OAuth access token.
7416    /// * *alt* (query-string) - Data format for response.
7417    /// * *callback* (query-string) - JSONP
7418    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7419    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7420    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7421    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7422    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7423    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7424    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7425    pub fn param<T>(mut self, name: T, value: T) -> PartnerDeviceMetadataCall<'a, C>
7426    where
7427        T: AsRef<str>,
7428    {
7429        self._additional_params
7430            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7431        self
7432    }
7433}
7434
7435/// Unclaims a device from a customer and removes it from zero-touch enrollment.
7436///
7437/// A builder for the *devices.unclaim* method supported by a *partner* resource.
7438/// It is not used directly, but through a [`PartnerMethods`] instance.
7439///
7440/// # Example
7441///
7442/// Instantiate a resource method builder
7443///
7444/// ```test_harness,no_run
7445/// # extern crate hyper;
7446/// # extern crate hyper_rustls;
7447/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
7448/// use androiddeviceprovisioning1::api::UnclaimDeviceRequest;
7449/// # async fn dox() {
7450/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7451///
7452/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7453/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7454/// #     secret,
7455/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7456/// # ).build().await.unwrap();
7457///
7458/// # let client = hyper_util::client::legacy::Client::builder(
7459/// #     hyper_util::rt::TokioExecutor::new()
7460/// # )
7461/// # .build(
7462/// #     hyper_rustls::HttpsConnectorBuilder::new()
7463/// #         .with_native_roots()
7464/// #         .unwrap()
7465/// #         .https_or_http()
7466/// #         .enable_http1()
7467/// #         .build()
7468/// # );
7469/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
7470/// // As the method needs a request, you would usually fill it with the desired information
7471/// // into the respective structure. Some of the parts shown here might not be applicable !
7472/// // Values shown here are possibly random and not representative !
7473/// let mut req = UnclaimDeviceRequest::default();
7474///
7475/// // You can configure optional parameters by calling the respective setters at will, and
7476/// // execute the final call using `doit()`.
7477/// // Values shown here are possibly random and not representative !
7478/// let result = hub.partners().devices_unclaim(req, -7)
7479///              .doit().await;
7480/// # }
7481/// ```
7482pub struct PartnerDeviceUnclaimCall<'a, C>
7483where
7484    C: 'a,
7485{
7486    hub: &'a AndroidProvisioningPartner<C>,
7487    _request: UnclaimDeviceRequest,
7488    _partner_id: i64,
7489    _delegate: Option<&'a mut dyn common::Delegate>,
7490    _additional_params: HashMap<String, String>,
7491}
7492
7493impl<'a, C> common::CallBuilder for PartnerDeviceUnclaimCall<'a, C> {}
7494
7495impl<'a, C> PartnerDeviceUnclaimCall<'a, C>
7496where
7497    C: common::Connector,
7498{
7499    /// Perform the operation you have build so far.
7500    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
7501        use std::borrow::Cow;
7502        use std::io::{Read, Seek};
7503
7504        use common::{url::Params, ToParts};
7505        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7506
7507        let mut dd = common::DefaultDelegate;
7508        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7509        dlg.begin(common::MethodInfo {
7510            id: "androiddeviceprovisioning.partners.devices.unclaim",
7511            http_method: hyper::Method::POST,
7512        });
7513
7514        for &field in ["alt", "partnerId"].iter() {
7515            if self._additional_params.contains_key(field) {
7516                dlg.finished(false);
7517                return Err(common::Error::FieldClash(field));
7518            }
7519        }
7520
7521        let mut params = Params::with_capacity(4 + self._additional_params.len());
7522        params.push("partnerId", self._partner_id.to_string());
7523
7524        params.extend(self._additional_params.iter());
7525
7526        params.push("alt", "json");
7527        let mut url = self.hub._base_url.clone() + "v1/partners/{+partnerId}/devices:unclaim";
7528
7529        match dlg.api_key() {
7530            Some(value) => params.push("key", value),
7531            None => {
7532                dlg.finished(false);
7533                return Err(common::Error::MissingAPIKey);
7534            }
7535        }
7536
7537        #[allow(clippy::single_element_loop)]
7538        for &(find_this, param_name) in [("{+partnerId}", "partnerId")].iter() {
7539            url = params.uri_replacement(url, param_name, find_this, true);
7540        }
7541        {
7542            let to_remove = ["partnerId"];
7543            params.remove_params(&to_remove);
7544        }
7545
7546        let url = params.parse_with_url(&url);
7547
7548        let mut json_mime_type = mime::APPLICATION_JSON;
7549        let mut request_value_reader = {
7550            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7551            common::remove_json_null_values(&mut value);
7552            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7553            serde_json::to_writer(&mut dst, &value).unwrap();
7554            dst
7555        };
7556        let request_size = request_value_reader
7557            .seek(std::io::SeekFrom::End(0))
7558            .unwrap();
7559        request_value_reader
7560            .seek(std::io::SeekFrom::Start(0))
7561            .unwrap();
7562
7563        loop {
7564            request_value_reader
7565                .seek(std::io::SeekFrom::Start(0))
7566                .unwrap();
7567            let mut req_result = {
7568                let client = &self.hub.client;
7569                dlg.pre_request();
7570                let mut req_builder = hyper::Request::builder()
7571                    .method(hyper::Method::POST)
7572                    .uri(url.as_str())
7573                    .header(USER_AGENT, self.hub._user_agent.clone());
7574
7575                let request = req_builder
7576                    .header(CONTENT_TYPE, json_mime_type.to_string())
7577                    .header(CONTENT_LENGTH, request_size as u64)
7578                    .body(common::to_body(
7579                        request_value_reader.get_ref().clone().into(),
7580                    ));
7581
7582                client.request(request.unwrap()).await
7583            };
7584
7585            match req_result {
7586                Err(err) => {
7587                    if let common::Retry::After(d) = dlg.http_error(&err) {
7588                        sleep(d).await;
7589                        continue;
7590                    }
7591                    dlg.finished(false);
7592                    return Err(common::Error::HttpError(err));
7593                }
7594                Ok(res) => {
7595                    let (mut parts, body) = res.into_parts();
7596                    let mut body = common::Body::new(body);
7597                    if !parts.status.is_success() {
7598                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7599                        let error = serde_json::from_str(&common::to_string(&bytes));
7600                        let response = common::to_response(parts, bytes.into());
7601
7602                        if let common::Retry::After(d) =
7603                            dlg.http_failure(&response, error.as_ref().ok())
7604                        {
7605                            sleep(d).await;
7606                            continue;
7607                        }
7608
7609                        dlg.finished(false);
7610
7611                        return Err(match error {
7612                            Ok(value) => common::Error::BadRequest(value),
7613                            _ => common::Error::Failure(response),
7614                        });
7615                    }
7616                    let response = {
7617                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7618                        let encoded = common::to_string(&bytes);
7619                        match serde_json::from_str(&encoded) {
7620                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7621                            Err(error) => {
7622                                dlg.response_json_decode_error(&encoded, &error);
7623                                return Err(common::Error::JsonDecodeError(
7624                                    encoded.to_string(),
7625                                    error,
7626                                ));
7627                            }
7628                        }
7629                    };
7630
7631                    dlg.finished(true);
7632                    return Ok(response);
7633                }
7634            }
7635        }
7636    }
7637
7638    ///
7639    /// Sets the *request* property to the given value.
7640    ///
7641    /// Even though the property as already been set when instantiating this call,
7642    /// we provide this method for API completeness.
7643    pub fn request(mut self, new_value: UnclaimDeviceRequest) -> PartnerDeviceUnclaimCall<'a, C> {
7644        self._request = new_value;
7645        self
7646    }
7647    /// Required. The ID of the reseller partner.
7648    ///
7649    /// Sets the *partner id* path property to the given value.
7650    ///
7651    /// Even though the property as already been set when instantiating this call,
7652    /// we provide this method for API completeness.
7653    pub fn partner_id(mut self, new_value: i64) -> PartnerDeviceUnclaimCall<'a, C> {
7654        self._partner_id = new_value;
7655        self
7656    }
7657    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7658    /// while executing the actual API request.
7659    ///
7660    /// ````text
7661    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7662    /// ````
7663    ///
7664    /// Sets the *delegate* property to the given value.
7665    pub fn delegate(
7666        mut self,
7667        new_value: &'a mut dyn common::Delegate,
7668    ) -> PartnerDeviceUnclaimCall<'a, C> {
7669        self._delegate = Some(new_value);
7670        self
7671    }
7672
7673    /// Set any additional parameter of the query string used in the request.
7674    /// It should be used to set parameters which are not yet available through their own
7675    /// setters.
7676    ///
7677    /// Please note that this method must not be used to set any of the known parameters
7678    /// which have their own setter method. If done anyway, the request will fail.
7679    ///
7680    /// # Additional Parameters
7681    ///
7682    /// * *$.xgafv* (query-string) - V1 error format.
7683    /// * *access_token* (query-string) - OAuth access token.
7684    /// * *alt* (query-string) - Data format for response.
7685    /// * *callback* (query-string) - JSONP
7686    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7687    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7688    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7689    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7690    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7691    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7692    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7693    pub fn param<T>(mut self, name: T, value: T) -> PartnerDeviceUnclaimCall<'a, C>
7694    where
7695        T: AsRef<str>,
7696    {
7697        self._additional_params
7698            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7699        self
7700    }
7701}
7702
7703/// Unclaims a batch of devices for a customer asynchronously. Removes the devices from zero-touch enrollment. To learn more, read [Long‑running batch operations](https://developers.google.com/zero-touch/guides/how-it-works#operations).
7704///
7705/// A builder for the *devices.unclaimAsync* method supported by a *partner* resource.
7706/// It is not used directly, but through a [`PartnerMethods`] instance.
7707///
7708/// # Example
7709///
7710/// Instantiate a resource method builder
7711///
7712/// ```test_harness,no_run
7713/// # extern crate hyper;
7714/// # extern crate hyper_rustls;
7715/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
7716/// use androiddeviceprovisioning1::api::UnclaimDevicesRequest;
7717/// # async fn dox() {
7718/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7719///
7720/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7721/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7722/// #     secret,
7723/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7724/// # ).build().await.unwrap();
7725///
7726/// # let client = hyper_util::client::legacy::Client::builder(
7727/// #     hyper_util::rt::TokioExecutor::new()
7728/// # )
7729/// # .build(
7730/// #     hyper_rustls::HttpsConnectorBuilder::new()
7731/// #         .with_native_roots()
7732/// #         .unwrap()
7733/// #         .https_or_http()
7734/// #         .enable_http1()
7735/// #         .build()
7736/// # );
7737/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
7738/// // As the method needs a request, you would usually fill it with the desired information
7739/// // into the respective structure. Some of the parts shown here might not be applicable !
7740/// // Values shown here are possibly random and not representative !
7741/// let mut req = UnclaimDevicesRequest::default();
7742///
7743/// // You can configure optional parameters by calling the respective setters at will, and
7744/// // execute the final call using `doit()`.
7745/// // Values shown here are possibly random and not representative !
7746/// let result = hub.partners().devices_unclaim_async(req, -62)
7747///              .doit().await;
7748/// # }
7749/// ```
7750pub struct PartnerDeviceUnclaimAsyncCall<'a, C>
7751where
7752    C: 'a,
7753{
7754    hub: &'a AndroidProvisioningPartner<C>,
7755    _request: UnclaimDevicesRequest,
7756    _partner_id: i64,
7757    _delegate: Option<&'a mut dyn common::Delegate>,
7758    _additional_params: HashMap<String, String>,
7759}
7760
7761impl<'a, C> common::CallBuilder for PartnerDeviceUnclaimAsyncCall<'a, C> {}
7762
7763impl<'a, C> PartnerDeviceUnclaimAsyncCall<'a, C>
7764where
7765    C: common::Connector,
7766{
7767    /// Perform the operation you have build so far.
7768    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7769        use std::borrow::Cow;
7770        use std::io::{Read, Seek};
7771
7772        use common::{url::Params, ToParts};
7773        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7774
7775        let mut dd = common::DefaultDelegate;
7776        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7777        dlg.begin(common::MethodInfo {
7778            id: "androiddeviceprovisioning.partners.devices.unclaimAsync",
7779            http_method: hyper::Method::POST,
7780        });
7781
7782        for &field in ["alt", "partnerId"].iter() {
7783            if self._additional_params.contains_key(field) {
7784                dlg.finished(false);
7785                return Err(common::Error::FieldClash(field));
7786            }
7787        }
7788
7789        let mut params = Params::with_capacity(4 + self._additional_params.len());
7790        params.push("partnerId", self._partner_id.to_string());
7791
7792        params.extend(self._additional_params.iter());
7793
7794        params.push("alt", "json");
7795        let mut url = self.hub._base_url.clone() + "v1/partners/{+partnerId}/devices:unclaimAsync";
7796
7797        match dlg.api_key() {
7798            Some(value) => params.push("key", value),
7799            None => {
7800                dlg.finished(false);
7801                return Err(common::Error::MissingAPIKey);
7802            }
7803        }
7804
7805        #[allow(clippy::single_element_loop)]
7806        for &(find_this, param_name) in [("{+partnerId}", "partnerId")].iter() {
7807            url = params.uri_replacement(url, param_name, find_this, true);
7808        }
7809        {
7810            let to_remove = ["partnerId"];
7811            params.remove_params(&to_remove);
7812        }
7813
7814        let url = params.parse_with_url(&url);
7815
7816        let mut json_mime_type = mime::APPLICATION_JSON;
7817        let mut request_value_reader = {
7818            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7819            common::remove_json_null_values(&mut value);
7820            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7821            serde_json::to_writer(&mut dst, &value).unwrap();
7822            dst
7823        };
7824        let request_size = request_value_reader
7825            .seek(std::io::SeekFrom::End(0))
7826            .unwrap();
7827        request_value_reader
7828            .seek(std::io::SeekFrom::Start(0))
7829            .unwrap();
7830
7831        loop {
7832            request_value_reader
7833                .seek(std::io::SeekFrom::Start(0))
7834                .unwrap();
7835            let mut req_result = {
7836                let client = &self.hub.client;
7837                dlg.pre_request();
7838                let mut req_builder = hyper::Request::builder()
7839                    .method(hyper::Method::POST)
7840                    .uri(url.as_str())
7841                    .header(USER_AGENT, self.hub._user_agent.clone());
7842
7843                let request = req_builder
7844                    .header(CONTENT_TYPE, json_mime_type.to_string())
7845                    .header(CONTENT_LENGTH, request_size as u64)
7846                    .body(common::to_body(
7847                        request_value_reader.get_ref().clone().into(),
7848                    ));
7849
7850                client.request(request.unwrap()).await
7851            };
7852
7853            match req_result {
7854                Err(err) => {
7855                    if let common::Retry::After(d) = dlg.http_error(&err) {
7856                        sleep(d).await;
7857                        continue;
7858                    }
7859                    dlg.finished(false);
7860                    return Err(common::Error::HttpError(err));
7861                }
7862                Ok(res) => {
7863                    let (mut parts, body) = res.into_parts();
7864                    let mut body = common::Body::new(body);
7865                    if !parts.status.is_success() {
7866                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7867                        let error = serde_json::from_str(&common::to_string(&bytes));
7868                        let response = common::to_response(parts, bytes.into());
7869
7870                        if let common::Retry::After(d) =
7871                            dlg.http_failure(&response, error.as_ref().ok())
7872                        {
7873                            sleep(d).await;
7874                            continue;
7875                        }
7876
7877                        dlg.finished(false);
7878
7879                        return Err(match error {
7880                            Ok(value) => common::Error::BadRequest(value),
7881                            _ => common::Error::Failure(response),
7882                        });
7883                    }
7884                    let response = {
7885                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7886                        let encoded = common::to_string(&bytes);
7887                        match serde_json::from_str(&encoded) {
7888                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7889                            Err(error) => {
7890                                dlg.response_json_decode_error(&encoded, &error);
7891                                return Err(common::Error::JsonDecodeError(
7892                                    encoded.to_string(),
7893                                    error,
7894                                ));
7895                            }
7896                        }
7897                    };
7898
7899                    dlg.finished(true);
7900                    return Ok(response);
7901                }
7902            }
7903        }
7904    }
7905
7906    ///
7907    /// Sets the *request* property to the given value.
7908    ///
7909    /// Even though the property as already been set when instantiating this call,
7910    /// we provide this method for API completeness.
7911    pub fn request(
7912        mut self,
7913        new_value: UnclaimDevicesRequest,
7914    ) -> PartnerDeviceUnclaimAsyncCall<'a, C> {
7915        self._request = new_value;
7916        self
7917    }
7918    /// Required. The reseller partner ID.
7919    ///
7920    /// Sets the *partner id* path property to the given value.
7921    ///
7922    /// Even though the property as already been set when instantiating this call,
7923    /// we provide this method for API completeness.
7924    pub fn partner_id(mut self, new_value: i64) -> PartnerDeviceUnclaimAsyncCall<'a, C> {
7925        self._partner_id = new_value;
7926        self
7927    }
7928    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7929    /// while executing the actual API request.
7930    ///
7931    /// ````text
7932    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7933    /// ````
7934    ///
7935    /// Sets the *delegate* property to the given value.
7936    pub fn delegate(
7937        mut self,
7938        new_value: &'a mut dyn common::Delegate,
7939    ) -> PartnerDeviceUnclaimAsyncCall<'a, C> {
7940        self._delegate = Some(new_value);
7941        self
7942    }
7943
7944    /// Set any additional parameter of the query string used in the request.
7945    /// It should be used to set parameters which are not yet available through their own
7946    /// setters.
7947    ///
7948    /// Please note that this method must not be used to set any of the known parameters
7949    /// which have their own setter method. If done anyway, the request will fail.
7950    ///
7951    /// # Additional Parameters
7952    ///
7953    /// * *$.xgafv* (query-string) - V1 error format.
7954    /// * *access_token* (query-string) - OAuth access token.
7955    /// * *alt* (query-string) - Data format for response.
7956    /// * *callback* (query-string) - JSONP
7957    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7958    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7959    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7960    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7961    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7962    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7963    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7964    pub fn param<T>(mut self, name: T, value: T) -> PartnerDeviceUnclaimAsyncCall<'a, C>
7965    where
7966        T: AsRef<str>,
7967    {
7968        self._additional_params
7969            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7970        self
7971    }
7972}
7973
7974/// Updates the reseller metadata attached to a batch of devices. This method updates devices asynchronously and returns an `Operation` that can be used to track progress. Read [Long‑running batch operations](https://developers.google.com/zero-touch/guides/how-it-works#operations). Android Devices only.
7975///
7976/// A builder for the *devices.updateMetadataAsync* method supported by a *partner* resource.
7977/// It is not used directly, but through a [`PartnerMethods`] instance.
7978///
7979/// # Example
7980///
7981/// Instantiate a resource method builder
7982///
7983/// ```test_harness,no_run
7984/// # extern crate hyper;
7985/// # extern crate hyper_rustls;
7986/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
7987/// use androiddeviceprovisioning1::api::UpdateDeviceMetadataInBatchRequest;
7988/// # async fn dox() {
7989/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7990///
7991/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7992/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7993/// #     secret,
7994/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7995/// # ).build().await.unwrap();
7996///
7997/// # let client = hyper_util::client::legacy::Client::builder(
7998/// #     hyper_util::rt::TokioExecutor::new()
7999/// # )
8000/// # .build(
8001/// #     hyper_rustls::HttpsConnectorBuilder::new()
8002/// #         .with_native_roots()
8003/// #         .unwrap()
8004/// #         .https_or_http()
8005/// #         .enable_http1()
8006/// #         .build()
8007/// # );
8008/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
8009/// // As the method needs a request, you would usually fill it with the desired information
8010/// // into the respective structure. Some of the parts shown here might not be applicable !
8011/// // Values shown here are possibly random and not representative !
8012/// let mut req = UpdateDeviceMetadataInBatchRequest::default();
8013///
8014/// // You can configure optional parameters by calling the respective setters at will, and
8015/// // execute the final call using `doit()`.
8016/// // Values shown here are possibly random and not representative !
8017/// let result = hub.partners().devices_update_metadata_async(req, -17)
8018///              .doit().await;
8019/// # }
8020/// ```
8021pub struct PartnerDeviceUpdateMetadataAsyncCall<'a, C>
8022where
8023    C: 'a,
8024{
8025    hub: &'a AndroidProvisioningPartner<C>,
8026    _request: UpdateDeviceMetadataInBatchRequest,
8027    _partner_id: i64,
8028    _delegate: Option<&'a mut dyn common::Delegate>,
8029    _additional_params: HashMap<String, String>,
8030}
8031
8032impl<'a, C> common::CallBuilder for PartnerDeviceUpdateMetadataAsyncCall<'a, C> {}
8033
8034impl<'a, C> PartnerDeviceUpdateMetadataAsyncCall<'a, C>
8035where
8036    C: common::Connector,
8037{
8038    /// Perform the operation you have build so far.
8039    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8040        use std::borrow::Cow;
8041        use std::io::{Read, Seek};
8042
8043        use common::{url::Params, ToParts};
8044        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8045
8046        let mut dd = common::DefaultDelegate;
8047        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8048        dlg.begin(common::MethodInfo {
8049            id: "androiddeviceprovisioning.partners.devices.updateMetadataAsync",
8050            http_method: hyper::Method::POST,
8051        });
8052
8053        for &field in ["alt", "partnerId"].iter() {
8054            if self._additional_params.contains_key(field) {
8055                dlg.finished(false);
8056                return Err(common::Error::FieldClash(field));
8057            }
8058        }
8059
8060        let mut params = Params::with_capacity(4 + self._additional_params.len());
8061        params.push("partnerId", self._partner_id.to_string());
8062
8063        params.extend(self._additional_params.iter());
8064
8065        params.push("alt", "json");
8066        let mut url =
8067            self.hub._base_url.clone() + "v1/partners/{+partnerId}/devices:updateMetadataAsync";
8068
8069        match dlg.api_key() {
8070            Some(value) => params.push("key", value),
8071            None => {
8072                dlg.finished(false);
8073                return Err(common::Error::MissingAPIKey);
8074            }
8075        }
8076
8077        #[allow(clippy::single_element_loop)]
8078        for &(find_this, param_name) in [("{+partnerId}", "partnerId")].iter() {
8079            url = params.uri_replacement(url, param_name, find_this, true);
8080        }
8081        {
8082            let to_remove = ["partnerId"];
8083            params.remove_params(&to_remove);
8084        }
8085
8086        let url = params.parse_with_url(&url);
8087
8088        let mut json_mime_type = mime::APPLICATION_JSON;
8089        let mut request_value_reader = {
8090            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8091            common::remove_json_null_values(&mut value);
8092            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8093            serde_json::to_writer(&mut dst, &value).unwrap();
8094            dst
8095        };
8096        let request_size = request_value_reader
8097            .seek(std::io::SeekFrom::End(0))
8098            .unwrap();
8099        request_value_reader
8100            .seek(std::io::SeekFrom::Start(0))
8101            .unwrap();
8102
8103        loop {
8104            request_value_reader
8105                .seek(std::io::SeekFrom::Start(0))
8106                .unwrap();
8107            let mut req_result = {
8108                let client = &self.hub.client;
8109                dlg.pre_request();
8110                let mut req_builder = hyper::Request::builder()
8111                    .method(hyper::Method::POST)
8112                    .uri(url.as_str())
8113                    .header(USER_AGENT, self.hub._user_agent.clone());
8114
8115                let request = req_builder
8116                    .header(CONTENT_TYPE, json_mime_type.to_string())
8117                    .header(CONTENT_LENGTH, request_size as u64)
8118                    .body(common::to_body(
8119                        request_value_reader.get_ref().clone().into(),
8120                    ));
8121
8122                client.request(request.unwrap()).await
8123            };
8124
8125            match req_result {
8126                Err(err) => {
8127                    if let common::Retry::After(d) = dlg.http_error(&err) {
8128                        sleep(d).await;
8129                        continue;
8130                    }
8131                    dlg.finished(false);
8132                    return Err(common::Error::HttpError(err));
8133                }
8134                Ok(res) => {
8135                    let (mut parts, body) = res.into_parts();
8136                    let mut body = common::Body::new(body);
8137                    if !parts.status.is_success() {
8138                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8139                        let error = serde_json::from_str(&common::to_string(&bytes));
8140                        let response = common::to_response(parts, bytes.into());
8141
8142                        if let common::Retry::After(d) =
8143                            dlg.http_failure(&response, error.as_ref().ok())
8144                        {
8145                            sleep(d).await;
8146                            continue;
8147                        }
8148
8149                        dlg.finished(false);
8150
8151                        return Err(match error {
8152                            Ok(value) => common::Error::BadRequest(value),
8153                            _ => common::Error::Failure(response),
8154                        });
8155                    }
8156                    let response = {
8157                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8158                        let encoded = common::to_string(&bytes);
8159                        match serde_json::from_str(&encoded) {
8160                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8161                            Err(error) => {
8162                                dlg.response_json_decode_error(&encoded, &error);
8163                                return Err(common::Error::JsonDecodeError(
8164                                    encoded.to_string(),
8165                                    error,
8166                                ));
8167                            }
8168                        }
8169                    };
8170
8171                    dlg.finished(true);
8172                    return Ok(response);
8173                }
8174            }
8175        }
8176    }
8177
8178    ///
8179    /// Sets the *request* property to the given value.
8180    ///
8181    /// Even though the property as already been set when instantiating this call,
8182    /// we provide this method for API completeness.
8183    pub fn request(
8184        mut self,
8185        new_value: UpdateDeviceMetadataInBatchRequest,
8186    ) -> PartnerDeviceUpdateMetadataAsyncCall<'a, C> {
8187        self._request = new_value;
8188        self
8189    }
8190    /// Required. The reseller partner ID.
8191    ///
8192    /// Sets the *partner id* path property to the given value.
8193    ///
8194    /// Even though the property as already been set when instantiating this call,
8195    /// we provide this method for API completeness.
8196    pub fn partner_id(mut self, new_value: i64) -> PartnerDeviceUpdateMetadataAsyncCall<'a, C> {
8197        self._partner_id = new_value;
8198        self
8199    }
8200    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8201    /// while executing the actual API request.
8202    ///
8203    /// ````text
8204    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8205    /// ````
8206    ///
8207    /// Sets the *delegate* property to the given value.
8208    pub fn delegate(
8209        mut self,
8210        new_value: &'a mut dyn common::Delegate,
8211    ) -> PartnerDeviceUpdateMetadataAsyncCall<'a, C> {
8212        self._delegate = Some(new_value);
8213        self
8214    }
8215
8216    /// Set any additional parameter of the query string used in the request.
8217    /// It should be used to set parameters which are not yet available through their own
8218    /// setters.
8219    ///
8220    /// Please note that this method must not be used to set any of the known parameters
8221    /// which have their own setter method. If done anyway, the request will fail.
8222    ///
8223    /// # Additional Parameters
8224    ///
8225    /// * *$.xgafv* (query-string) - V1 error format.
8226    /// * *access_token* (query-string) - OAuth access token.
8227    /// * *alt* (query-string) - Data format for response.
8228    /// * *callback* (query-string) - JSONP
8229    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8230    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8231    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8232    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8233    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8234    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8235    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8236    pub fn param<T>(mut self, name: T, value: T) -> PartnerDeviceUpdateMetadataAsyncCall<'a, C>
8237    where
8238        T: AsRef<str>,
8239    {
8240        self._additional_params
8241            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8242        self
8243    }
8244}
8245
8246/// Lists the customers of the vendor.
8247///
8248/// A builder for the *vendors.customers.list* method supported by a *partner* resource.
8249/// It is not used directly, but through a [`PartnerMethods`] instance.
8250///
8251/// # Example
8252///
8253/// Instantiate a resource method builder
8254///
8255/// ```test_harness,no_run
8256/// # extern crate hyper;
8257/// # extern crate hyper_rustls;
8258/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
8259/// # async fn dox() {
8260/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8261///
8262/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8263/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8264/// #     secret,
8265/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8266/// # ).build().await.unwrap();
8267///
8268/// # let client = hyper_util::client::legacy::Client::builder(
8269/// #     hyper_util::rt::TokioExecutor::new()
8270/// # )
8271/// # .build(
8272/// #     hyper_rustls::HttpsConnectorBuilder::new()
8273/// #         .with_native_roots()
8274/// #         .unwrap()
8275/// #         .https_or_http()
8276/// #         .enable_http1()
8277/// #         .build()
8278/// # );
8279/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
8280/// // You can configure optional parameters by calling the respective setters at will, and
8281/// // execute the final call using `doit()`.
8282/// // Values shown here are possibly random and not representative !
8283/// let result = hub.partners().vendors_customers_list("parent")
8284///              .page_token("Lorem")
8285///              .page_size(-25)
8286///              .doit().await;
8287/// # }
8288/// ```
8289pub struct PartnerVendorCustomerListCall<'a, C>
8290where
8291    C: 'a,
8292{
8293    hub: &'a AndroidProvisioningPartner<C>,
8294    _parent: String,
8295    _page_token: Option<String>,
8296    _page_size: Option<i32>,
8297    _delegate: Option<&'a mut dyn common::Delegate>,
8298    _additional_params: HashMap<String, String>,
8299}
8300
8301impl<'a, C> common::CallBuilder for PartnerVendorCustomerListCall<'a, C> {}
8302
8303impl<'a, C> PartnerVendorCustomerListCall<'a, C>
8304where
8305    C: common::Connector,
8306{
8307    /// Perform the operation you have build so far.
8308    pub async fn doit(mut self) -> common::Result<(common::Response, ListVendorCustomersResponse)> {
8309        use std::borrow::Cow;
8310        use std::io::{Read, Seek};
8311
8312        use common::{url::Params, ToParts};
8313        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8314
8315        let mut dd = common::DefaultDelegate;
8316        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8317        dlg.begin(common::MethodInfo {
8318            id: "androiddeviceprovisioning.partners.vendors.customers.list",
8319            http_method: hyper::Method::GET,
8320        });
8321
8322        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
8323            if self._additional_params.contains_key(field) {
8324                dlg.finished(false);
8325                return Err(common::Error::FieldClash(field));
8326            }
8327        }
8328
8329        let mut params = Params::with_capacity(5 + self._additional_params.len());
8330        params.push("parent", self._parent);
8331        if let Some(value) = self._page_token.as_ref() {
8332            params.push("pageToken", value);
8333        }
8334        if let Some(value) = self._page_size.as_ref() {
8335            params.push("pageSize", value.to_string());
8336        }
8337
8338        params.extend(self._additional_params.iter());
8339
8340        params.push("alt", "json");
8341        let mut url = self.hub._base_url.clone() + "v1/{+parent}/customers";
8342
8343        match dlg.api_key() {
8344            Some(value) => params.push("key", value),
8345            None => {
8346                dlg.finished(false);
8347                return Err(common::Error::MissingAPIKey);
8348            }
8349        }
8350
8351        #[allow(clippy::single_element_loop)]
8352        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8353            url = params.uri_replacement(url, param_name, find_this, true);
8354        }
8355        {
8356            let to_remove = ["parent"];
8357            params.remove_params(&to_remove);
8358        }
8359
8360        let url = params.parse_with_url(&url);
8361
8362        loop {
8363            let mut req_result = {
8364                let client = &self.hub.client;
8365                dlg.pre_request();
8366                let mut req_builder = hyper::Request::builder()
8367                    .method(hyper::Method::GET)
8368                    .uri(url.as_str())
8369                    .header(USER_AGENT, self.hub._user_agent.clone());
8370
8371                let request = req_builder
8372                    .header(CONTENT_LENGTH, 0_u64)
8373                    .body(common::to_body::<String>(None));
8374
8375                client.request(request.unwrap()).await
8376            };
8377
8378            match req_result {
8379                Err(err) => {
8380                    if let common::Retry::After(d) = dlg.http_error(&err) {
8381                        sleep(d).await;
8382                        continue;
8383                    }
8384                    dlg.finished(false);
8385                    return Err(common::Error::HttpError(err));
8386                }
8387                Ok(res) => {
8388                    let (mut parts, body) = res.into_parts();
8389                    let mut body = common::Body::new(body);
8390                    if !parts.status.is_success() {
8391                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8392                        let error = serde_json::from_str(&common::to_string(&bytes));
8393                        let response = common::to_response(parts, bytes.into());
8394
8395                        if let common::Retry::After(d) =
8396                            dlg.http_failure(&response, error.as_ref().ok())
8397                        {
8398                            sleep(d).await;
8399                            continue;
8400                        }
8401
8402                        dlg.finished(false);
8403
8404                        return Err(match error {
8405                            Ok(value) => common::Error::BadRequest(value),
8406                            _ => common::Error::Failure(response),
8407                        });
8408                    }
8409                    let response = {
8410                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8411                        let encoded = common::to_string(&bytes);
8412                        match serde_json::from_str(&encoded) {
8413                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8414                            Err(error) => {
8415                                dlg.response_json_decode_error(&encoded, &error);
8416                                return Err(common::Error::JsonDecodeError(
8417                                    encoded.to_string(),
8418                                    error,
8419                                ));
8420                            }
8421                        }
8422                    };
8423
8424                    dlg.finished(true);
8425                    return Ok(response);
8426                }
8427            }
8428        }
8429    }
8430
8431    /// Required. The resource name in the format `partners/[PARTNER_ID]/vendors/[VENDOR_ID]`.
8432    ///
8433    /// Sets the *parent* path property to the given value.
8434    ///
8435    /// Even though the property as already been set when instantiating this call,
8436    /// we provide this method for API completeness.
8437    pub fn parent(mut self, new_value: &str) -> PartnerVendorCustomerListCall<'a, C> {
8438        self._parent = new_value.to_string();
8439        self
8440    }
8441    /// A token identifying a page of results returned by the server.
8442    ///
8443    /// Sets the *page token* query property to the given value.
8444    pub fn page_token(mut self, new_value: &str) -> PartnerVendorCustomerListCall<'a, C> {
8445        self._page_token = Some(new_value.to_string());
8446        self
8447    }
8448    /// The maximum number of results to be returned.
8449    ///
8450    /// Sets the *page size* query property to the given value.
8451    pub fn page_size(mut self, new_value: i32) -> PartnerVendorCustomerListCall<'a, C> {
8452        self._page_size = Some(new_value);
8453        self
8454    }
8455    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8456    /// while executing the actual API request.
8457    ///
8458    /// ````text
8459    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8460    /// ````
8461    ///
8462    /// Sets the *delegate* property to the given value.
8463    pub fn delegate(
8464        mut self,
8465        new_value: &'a mut dyn common::Delegate,
8466    ) -> PartnerVendorCustomerListCall<'a, C> {
8467        self._delegate = Some(new_value);
8468        self
8469    }
8470
8471    /// Set any additional parameter of the query string used in the request.
8472    /// It should be used to set parameters which are not yet available through their own
8473    /// setters.
8474    ///
8475    /// Please note that this method must not be used to set any of the known parameters
8476    /// which have their own setter method. If done anyway, the request will fail.
8477    ///
8478    /// # Additional Parameters
8479    ///
8480    /// * *$.xgafv* (query-string) - V1 error format.
8481    /// * *access_token* (query-string) - OAuth access token.
8482    /// * *alt* (query-string) - Data format for response.
8483    /// * *callback* (query-string) - JSONP
8484    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8485    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8486    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8487    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8488    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8489    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8490    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8491    pub fn param<T>(mut self, name: T, value: T) -> PartnerVendorCustomerListCall<'a, C>
8492    where
8493        T: AsRef<str>,
8494    {
8495        self._additional_params
8496            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8497        self
8498    }
8499}
8500
8501/// Lists the vendors of the partner.
8502///
8503/// A builder for the *vendors.list* method supported by a *partner* resource.
8504/// It is not used directly, but through a [`PartnerMethods`] instance.
8505///
8506/// # Example
8507///
8508/// Instantiate a resource method builder
8509///
8510/// ```test_harness,no_run
8511/// # extern crate hyper;
8512/// # extern crate hyper_rustls;
8513/// # extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1;
8514/// # async fn dox() {
8515/// # use androiddeviceprovisioning1::{AndroidProvisioningPartner, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8516///
8517/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8518/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8519/// #     secret,
8520/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8521/// # ).build().await.unwrap();
8522///
8523/// # let client = hyper_util::client::legacy::Client::builder(
8524/// #     hyper_util::rt::TokioExecutor::new()
8525/// # )
8526/// # .build(
8527/// #     hyper_rustls::HttpsConnectorBuilder::new()
8528/// #         .with_native_roots()
8529/// #         .unwrap()
8530/// #         .https_or_http()
8531/// #         .enable_http1()
8532/// #         .build()
8533/// # );
8534/// # let mut hub = AndroidProvisioningPartner::new(client, auth);
8535/// // You can configure optional parameters by calling the respective setters at will, and
8536/// // execute the final call using `doit()`.
8537/// // Values shown here are possibly random and not representative !
8538/// let result = hub.partners().vendors_list("parent")
8539///              .page_token("sed")
8540///              .page_size(-70)
8541///              .doit().await;
8542/// # }
8543/// ```
8544pub struct PartnerVendorListCall<'a, C>
8545where
8546    C: 'a,
8547{
8548    hub: &'a AndroidProvisioningPartner<C>,
8549    _parent: String,
8550    _page_token: Option<String>,
8551    _page_size: Option<i32>,
8552    _delegate: Option<&'a mut dyn common::Delegate>,
8553    _additional_params: HashMap<String, String>,
8554}
8555
8556impl<'a, C> common::CallBuilder for PartnerVendorListCall<'a, C> {}
8557
8558impl<'a, C> PartnerVendorListCall<'a, C>
8559where
8560    C: common::Connector,
8561{
8562    /// Perform the operation you have build so far.
8563    pub async fn doit(mut self) -> common::Result<(common::Response, ListVendorsResponse)> {
8564        use std::borrow::Cow;
8565        use std::io::{Read, Seek};
8566
8567        use common::{url::Params, ToParts};
8568        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8569
8570        let mut dd = common::DefaultDelegate;
8571        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8572        dlg.begin(common::MethodInfo {
8573            id: "androiddeviceprovisioning.partners.vendors.list",
8574            http_method: hyper::Method::GET,
8575        });
8576
8577        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
8578            if self._additional_params.contains_key(field) {
8579                dlg.finished(false);
8580                return Err(common::Error::FieldClash(field));
8581            }
8582        }
8583
8584        let mut params = Params::with_capacity(5 + self._additional_params.len());
8585        params.push("parent", self._parent);
8586        if let Some(value) = self._page_token.as_ref() {
8587            params.push("pageToken", value);
8588        }
8589        if let Some(value) = self._page_size.as_ref() {
8590            params.push("pageSize", value.to_string());
8591        }
8592
8593        params.extend(self._additional_params.iter());
8594
8595        params.push("alt", "json");
8596        let mut url = self.hub._base_url.clone() + "v1/{+parent}/vendors";
8597
8598        match dlg.api_key() {
8599            Some(value) => params.push("key", value),
8600            None => {
8601                dlg.finished(false);
8602                return Err(common::Error::MissingAPIKey);
8603            }
8604        }
8605
8606        #[allow(clippy::single_element_loop)]
8607        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8608            url = params.uri_replacement(url, param_name, find_this, true);
8609        }
8610        {
8611            let to_remove = ["parent"];
8612            params.remove_params(&to_remove);
8613        }
8614
8615        let url = params.parse_with_url(&url);
8616
8617        loop {
8618            let mut req_result = {
8619                let client = &self.hub.client;
8620                dlg.pre_request();
8621                let mut req_builder = hyper::Request::builder()
8622                    .method(hyper::Method::GET)
8623                    .uri(url.as_str())
8624                    .header(USER_AGENT, self.hub._user_agent.clone());
8625
8626                let request = req_builder
8627                    .header(CONTENT_LENGTH, 0_u64)
8628                    .body(common::to_body::<String>(None));
8629
8630                client.request(request.unwrap()).await
8631            };
8632
8633            match req_result {
8634                Err(err) => {
8635                    if let common::Retry::After(d) = dlg.http_error(&err) {
8636                        sleep(d).await;
8637                        continue;
8638                    }
8639                    dlg.finished(false);
8640                    return Err(common::Error::HttpError(err));
8641                }
8642                Ok(res) => {
8643                    let (mut parts, body) = res.into_parts();
8644                    let mut body = common::Body::new(body);
8645                    if !parts.status.is_success() {
8646                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8647                        let error = serde_json::from_str(&common::to_string(&bytes));
8648                        let response = common::to_response(parts, bytes.into());
8649
8650                        if let common::Retry::After(d) =
8651                            dlg.http_failure(&response, error.as_ref().ok())
8652                        {
8653                            sleep(d).await;
8654                            continue;
8655                        }
8656
8657                        dlg.finished(false);
8658
8659                        return Err(match error {
8660                            Ok(value) => common::Error::BadRequest(value),
8661                            _ => common::Error::Failure(response),
8662                        });
8663                    }
8664                    let response = {
8665                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8666                        let encoded = common::to_string(&bytes);
8667                        match serde_json::from_str(&encoded) {
8668                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8669                            Err(error) => {
8670                                dlg.response_json_decode_error(&encoded, &error);
8671                                return Err(common::Error::JsonDecodeError(
8672                                    encoded.to_string(),
8673                                    error,
8674                                ));
8675                            }
8676                        }
8677                    };
8678
8679                    dlg.finished(true);
8680                    return Ok(response);
8681                }
8682            }
8683        }
8684    }
8685
8686    /// Required. The resource name in the format `partners/[PARTNER_ID]`.
8687    ///
8688    /// Sets the *parent* path property to the given value.
8689    ///
8690    /// Even though the property as already been set when instantiating this call,
8691    /// we provide this method for API completeness.
8692    pub fn parent(mut self, new_value: &str) -> PartnerVendorListCall<'a, C> {
8693        self._parent = new_value.to_string();
8694        self
8695    }
8696    /// A token identifying a page of results returned by the server.
8697    ///
8698    /// Sets the *page token* query property to the given value.
8699    pub fn page_token(mut self, new_value: &str) -> PartnerVendorListCall<'a, C> {
8700        self._page_token = Some(new_value.to_string());
8701        self
8702    }
8703    /// The maximum number of results to be returned.
8704    ///
8705    /// Sets the *page size* query property to the given value.
8706    pub fn page_size(mut self, new_value: i32) -> PartnerVendorListCall<'a, C> {
8707        self._page_size = Some(new_value);
8708        self
8709    }
8710    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8711    /// while executing the actual API request.
8712    ///
8713    /// ````text
8714    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8715    /// ````
8716    ///
8717    /// Sets the *delegate* property to the given value.
8718    pub fn delegate(
8719        mut self,
8720        new_value: &'a mut dyn common::Delegate,
8721    ) -> PartnerVendorListCall<'a, C> {
8722        self._delegate = Some(new_value);
8723        self
8724    }
8725
8726    /// Set any additional parameter of the query string used in the request.
8727    /// It should be used to set parameters which are not yet available through their own
8728    /// setters.
8729    ///
8730    /// Please note that this method must not be used to set any of the known parameters
8731    /// which have their own setter method. If done anyway, the request will fail.
8732    ///
8733    /// # Additional Parameters
8734    ///
8735    /// * *$.xgafv* (query-string) - V1 error format.
8736    /// * *access_token* (query-string) - OAuth access token.
8737    /// * *alt* (query-string) - Data format for response.
8738    /// * *callback* (query-string) - JSONP
8739    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8740    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8741    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8742    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8743    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8744    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8745    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8746    pub fn param<T>(mut self, name: T, value: T) -> PartnerVendorListCall<'a, C>
8747    where
8748        T: AsRef<str>,
8749    {
8750        self._additional_params
8751            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8752        self
8753    }
8754}