google_androidenterprise1/api.rs
1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16 /// Manage corporate Android devices
17 Full,
18}
19
20impl AsRef<str> for Scope {
21 fn as_ref(&self) -> &str {
22 match *self {
23 Scope::Full => "https://www.googleapis.com/auth/androidenterprise",
24 }
25 }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30 fn default() -> Scope {
31 Scope::Full
32 }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all AndroidEnterprise related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_androidenterprise1 as androidenterprise1;
49/// use androidenterprise1::{Result, Error};
50/// # async fn dox() {
51/// use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
52///
53/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
54/// // `client_secret`, among other things.
55/// let secret: yup_oauth2::ApplicationSecret = Default::default();
56/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
57/// // unless you replace `None` with the desired Flow.
58/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
59/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
60/// // retrieve them from storage.
61/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
62/// .with_native_roots()
63/// .unwrap()
64/// .https_only()
65/// .enable_http2()
66/// .build();
67///
68/// let executor = hyper_util::rt::TokioExecutor::new();
69/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
70/// secret,
71/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
72/// yup_oauth2::client::CustomHyperClientBuilder::from(
73/// hyper_util::client::legacy::Client::builder(executor).build(connector),
74/// ),
75/// ).build().await.unwrap();
76///
77/// let client = hyper_util::client::legacy::Client::builder(
78/// hyper_util::rt::TokioExecutor::new()
79/// )
80/// .build(
81/// hyper_rustls::HttpsConnectorBuilder::new()
82/// .with_native_roots()
83/// .unwrap()
84/// .https_or_http()
85/// .enable_http2()
86/// .build()
87/// );
88/// let mut hub = AndroidEnterprise::new(client, auth);
89/// // You can configure optional parameters by calling the respective setters at will, and
90/// // execute the final call using `doit()`.
91/// // Values shown here are possibly random and not representative !
92/// let result = hub.enterprises().generate_enterprise_upgrade_url("enterpriseId")
93/// .add_allowed_domains("sed")
94/// .admin_email("amet.")
95/// .doit().await;
96///
97/// match result {
98/// Err(e) => match e {
99/// // The Error enum provides details about what exactly happened.
100/// // You can also just use its `Debug`, `Display` or `Error` traits
101/// Error::HttpError(_)
102/// |Error::Io(_)
103/// |Error::MissingAPIKey
104/// |Error::MissingToken(_)
105/// |Error::Cancelled
106/// |Error::UploadSizeLimitExceeded(_, _)
107/// |Error::Failure(_)
108/// |Error::BadRequest(_)
109/// |Error::FieldClash(_)
110/// |Error::JsonDecodeError(_, _) => println!("{}", e),
111/// },
112/// Ok(res) => println!("Success: {:?}", res),
113/// }
114/// # }
115/// ```
116#[derive(Clone)]
117pub struct AndroidEnterprise<C> {
118 pub client: common::Client<C>,
119 pub auth: Box<dyn common::GetToken>,
120 _user_agent: String,
121 _base_url: String,
122 _root_url: String,
123}
124
125impl<C> common::Hub for AndroidEnterprise<C> {}
126
127impl<'a, C> AndroidEnterprise<C> {
128 pub fn new<A: 'static + common::GetToken>(
129 client: common::Client<C>,
130 auth: A,
131 ) -> AndroidEnterprise<C> {
132 AndroidEnterprise {
133 client,
134 auth: Box::new(auth),
135 _user_agent: "google-api-rust-client/7.0.0".to_string(),
136 _base_url: "https://androidenterprise.googleapis.com/".to_string(),
137 _root_url: "https://androidenterprise.googleapis.com/".to_string(),
138 }
139 }
140
141 pub fn devices(&'a self) -> DeviceMethods<'a, C> {
142 DeviceMethods { hub: self }
143 }
144 pub fn enrollment_tokens(&'a self) -> EnrollmentTokenMethods<'a, C> {
145 EnrollmentTokenMethods { hub: self }
146 }
147 pub fn enterprises(&'a self) -> EnterpriseMethods<'a, C> {
148 EnterpriseMethods { hub: self }
149 }
150 pub fn entitlements(&'a self) -> EntitlementMethods<'a, C> {
151 EntitlementMethods { hub: self }
152 }
153 pub fn grouplicenses(&'a self) -> GrouplicenseMethods<'a, C> {
154 GrouplicenseMethods { hub: self }
155 }
156 pub fn grouplicenseusers(&'a self) -> GrouplicenseuserMethods<'a, C> {
157 GrouplicenseuserMethods { hub: self }
158 }
159 pub fn installs(&'a self) -> InstallMethods<'a, C> {
160 InstallMethods { hub: self }
161 }
162 pub fn managedconfigurationsfordevice(
163 &'a self,
164 ) -> ManagedconfigurationsfordeviceMethods<'a, C> {
165 ManagedconfigurationsfordeviceMethods { hub: self }
166 }
167 pub fn managedconfigurationsforuser(&'a self) -> ManagedconfigurationsforuserMethods<'a, C> {
168 ManagedconfigurationsforuserMethods { hub: self }
169 }
170 pub fn managedconfigurationssettings(&'a self) -> ManagedconfigurationssettingMethods<'a, C> {
171 ManagedconfigurationssettingMethods { hub: self }
172 }
173 pub fn permissions(&'a self) -> PermissionMethods<'a, C> {
174 PermissionMethods { hub: self }
175 }
176 pub fn products(&'a self) -> ProductMethods<'a, C> {
177 ProductMethods { hub: self }
178 }
179 pub fn serviceaccountkeys(&'a self) -> ServiceaccountkeyMethods<'a, C> {
180 ServiceaccountkeyMethods { hub: self }
181 }
182 pub fn storelayoutclusters(&'a self) -> StorelayoutclusterMethods<'a, C> {
183 StorelayoutclusterMethods { hub: self }
184 }
185 pub fn storelayoutpages(&'a self) -> StorelayoutpageMethods<'a, C> {
186 StorelayoutpageMethods { hub: self }
187 }
188 pub fn users(&'a self) -> UserMethods<'a, C> {
189 UserMethods { hub: self }
190 }
191 pub fn webapps(&'a self) -> WebappMethods<'a, C> {
192 WebappMethods { hub: self }
193 }
194
195 /// Set the user-agent header field to use in all requests to the server.
196 /// It defaults to `google-api-rust-client/7.0.0`.
197 ///
198 /// Returns the previously set user-agent.
199 pub fn user_agent(&mut self, agent_name: String) -> String {
200 std::mem::replace(&mut self._user_agent, agent_name)
201 }
202
203 /// Set the base url to use in all requests to the server.
204 /// It defaults to `https://androidenterprise.googleapis.com/`.
205 ///
206 /// Returns the previously set base url.
207 pub fn base_url(&mut self, new_base_url: String) -> String {
208 std::mem::replace(&mut self._base_url, new_base_url)
209 }
210
211 /// Set the root url to use in all requests to the server.
212 /// It defaults to `https://androidenterprise.googleapis.com/`.
213 ///
214 /// Returns the previously set root url.
215 pub fn root_url(&mut self, new_root_url: String) -> String {
216 std::mem::replace(&mut self._root_url, new_root_url)
217 }
218}
219
220// ############
221// SCHEMAS ###
222// ##########
223/// This represents an enterprise admin who can manage the enterprise in the managed Google Play store.
224///
225/// This type is not used in any activity, and only used as *part* of another schema.
226///
227#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
228#[serde_with::serde_as]
229#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
230pub struct Administrator {
231 /// The admin's email address.
232 pub email: Option<String>,
233}
234
235impl common::Part for Administrator {}
236
237/// A token authorizing an admin to access an iframe.
238///
239/// # Activities
240///
241/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
242/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
243///
244/// * [create web token enterprises](EnterpriseCreateWebTokenCall) (response)
245#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
246#[serde_with::serde_as]
247#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
248pub struct AdministratorWebToken {
249 /// An opaque token to be passed to the Play front-end to generate an iframe.
250 pub token: Option<String>,
251}
252
253impl common::ResponseResult for AdministratorWebToken {}
254
255/// Specification for a token used to generate iframes. The token specifies what data the admin is allowed to modify and the URI the iframe is allowed to communiate with.
256///
257/// # Activities
258///
259/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
260/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
261///
262/// * [create web token enterprises](EnterpriseCreateWebTokenCall) (request)
263#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
264#[serde_with::serde_as]
265#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
266pub struct AdministratorWebTokenSpec {
267 /// Options for displaying the Managed Configuration page.
268 #[serde(rename = "managedConfigurations")]
269 pub managed_configurations: Option<AdministratorWebTokenSpecManagedConfigurations>,
270 /// The URI of the parent frame hosting the iframe. To prevent XSS, the iframe may not be hosted at other URIs. This URI must be https. Use whitespaces to separate multiple parent URIs.
271 pub parent: Option<String>,
272 /// Deprecated. Use PlaySearch.approveApps.
273 pub permission: Option<Vec<String>>,
274 /// Options for displaying the managed Play Search apps page.
275 #[serde(rename = "playSearch")]
276 pub play_search: Option<AdministratorWebTokenSpecPlaySearch>,
277 /// Options for displaying the Private Apps page.
278 #[serde(rename = "privateApps")]
279 pub private_apps: Option<AdministratorWebTokenSpecPrivateApps>,
280 /// Options for displaying the Organize apps page.
281 #[serde(rename = "storeBuilder")]
282 pub store_builder: Option<AdministratorWebTokenSpecStoreBuilder>,
283 /// Options for displaying the Web Apps page.
284 #[serde(rename = "webApps")]
285 pub web_apps: Option<AdministratorWebTokenSpecWebApps>,
286 /// Options for displaying the Zero Touch page.
287 #[serde(rename = "zeroTouch")]
288 pub zero_touch: Option<AdministratorWebTokenSpecZeroTouch>,
289}
290
291impl common::RequestValue for AdministratorWebTokenSpec {}
292
293/// There is no detailed description.
294///
295/// This type is not used in any activity, and only used as *part* of another schema.
296///
297#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
298#[serde_with::serde_as]
299#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
300pub struct AdministratorWebTokenSpecManagedConfigurations {
301 /// Whether the Managed Configuration page is displayed. Default is true.
302 pub enabled: Option<bool>,
303}
304
305impl common::Part for AdministratorWebTokenSpecManagedConfigurations {}
306
307/// There is no detailed description.
308///
309/// This type is not used in any activity, and only used as *part* of another schema.
310///
311#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
312#[serde_with::serde_as]
313#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
314pub struct AdministratorWebTokenSpecPlaySearch {
315 /// Allow access to the iframe in approve mode. Default is false.
316 #[serde(rename = "approveApps")]
317 pub approve_apps: Option<bool>,
318 /// Whether the managed Play Search apps page is displayed. Default is true.
319 pub enabled: Option<bool>,
320}
321
322impl common::Part for AdministratorWebTokenSpecPlaySearch {}
323
324/// There is no detailed description.
325///
326/// This type is not used in any activity, and only used as *part* of another schema.
327///
328#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
329#[serde_with::serde_as]
330#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
331pub struct AdministratorWebTokenSpecPrivateApps {
332 /// Whether the Private Apps page is displayed. Default is true.
333 pub enabled: Option<bool>,
334}
335
336impl common::Part for AdministratorWebTokenSpecPrivateApps {}
337
338/// There is no detailed description.
339///
340/// This type is not used in any activity, and only used as *part* of another schema.
341///
342#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
343#[serde_with::serde_as]
344#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
345pub struct AdministratorWebTokenSpecStoreBuilder {
346 /// Whether the Organize apps page is displayed. Default is true.
347 pub enabled: Option<bool>,
348}
349
350impl common::Part for AdministratorWebTokenSpecStoreBuilder {}
351
352/// There is no detailed description.
353///
354/// This type is not used in any activity, and only used as *part* of another schema.
355///
356#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
357#[serde_with::serde_as]
358#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
359pub struct AdministratorWebTokenSpecWebApps {
360 /// Whether the Web Apps page is displayed. Default is true.
361 pub enabled: Option<bool>,
362}
363
364impl common::Part for AdministratorWebTokenSpecWebApps {}
365
366/// There is no detailed description.
367///
368/// This type is not used in any activity, and only used as *part* of another schema.
369///
370#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
371#[serde_with::serde_as]
372#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
373pub struct AdministratorWebTokenSpecZeroTouch {
374 /// Whether zero-touch embedded UI is usable with this token. If enabled, the admin can link zero-touch customers to this enterprise.
375 pub enabled: Option<bool>,
376}
377
378impl common::Part for AdministratorWebTokenSpecZeroTouch {}
379
380/// Represents the list of app restrictions available to be pre-configured for the product.
381///
382/// # Activities
383///
384/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
385/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
386///
387/// * [get app restrictions schema products](ProductGetAppRestrictionsSchemaCall) (response)
388#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
389#[serde_with::serde_as]
390#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
391pub struct AppRestrictionsSchema {
392 /// Deprecated.
393 pub kind: Option<String>,
394 /// The set of restrictions that make up this schema.
395 pub restrictions: Option<Vec<AppRestrictionsSchemaRestriction>>,
396}
397
398impl common::ResponseResult for AppRestrictionsSchema {}
399
400/// An event generated when a new app version is uploaded to Google Play and its app restrictions schema changed. To fetch the app restrictions schema for an app, use Products.getAppRestrictionsSchema on the EMM API.
401///
402/// This type is not used in any activity, and only used as *part* of another schema.
403///
404#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
405#[serde_with::serde_as]
406#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
407pub struct AppRestrictionsSchemaChangeEvent {
408 /// The id of the product (e.g. "app:com.google.android.gm") for which the app restriction schema changed. This field will always be present.
409 #[serde(rename = "productId")]
410 pub product_id: Option<String>,
411}
412
413impl common::Part for AppRestrictionsSchemaChangeEvent {}
414
415/// A restriction in the App Restriction Schema represents a piece of configuration that may be pre-applied.
416///
417/// This type is not used in any activity, and only used as *part* of another schema.
418///
419#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
420#[serde_with::serde_as]
421#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
422pub struct AppRestrictionsSchemaRestriction {
423 /// The default value of the restriction. bundle and bundleArray restrictions never have a default value.
424 #[serde(rename = "defaultValue")]
425 pub default_value: Option<AppRestrictionsSchemaRestrictionRestrictionValue>,
426 /// A longer description of the restriction, giving more detail of what it affects.
427 pub description: Option<String>,
428 /// For choice or multiselect restrictions, the list of possible entries' human-readable names.
429 pub entry: Option<Vec<String>>,
430 /// For choice or multiselect restrictions, the list of possible entries' machine-readable values. These values should be used in the configuration, either as a single string value for a choice restriction or in a stringArray for a multiselect restriction.
431 #[serde(rename = "entryValue")]
432 pub entry_value: Option<Vec<String>>,
433 /// The unique key that the product uses to identify the restriction, e.g. "com.google.android.gm.fieldname".
434 pub key: Option<String>,
435 /// For bundle or bundleArray restrictions, the list of nested restrictions. A bundle restriction is always nested within a bundleArray restriction, and a bundleArray restriction is at most two levels deep.
436 #[serde(rename = "nestedRestriction")]
437 pub nested_restriction: Option<Vec<AppRestrictionsSchemaRestriction>>,
438 /// The type of the restriction.
439 #[serde(rename = "restrictionType")]
440 pub restriction_type: Option<String>,
441 /// The name of the restriction.
442 pub title: Option<String>,
443}
444
445impl common::Part for AppRestrictionsSchemaRestriction {}
446
447/// A typed value for the restriction.
448///
449/// This type is not used in any activity, and only used as *part* of another schema.
450///
451#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
452#[serde_with::serde_as]
453#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
454pub struct AppRestrictionsSchemaRestrictionRestrictionValue {
455 /// The type of the value being provided.
456 #[serde(rename = "type")]
457 pub type_: Option<String>,
458 /// The boolean value - this will only be present if type is bool.
459 #[serde(rename = "valueBool")]
460 pub value_bool: Option<bool>,
461 /// The integer value - this will only be present if type is integer.
462 #[serde(rename = "valueInteger")]
463 pub value_integer: Option<i32>,
464 /// The list of string values - this will only be present if type is multiselect.
465 #[serde(rename = "valueMultiselect")]
466 pub value_multiselect: Option<Vec<String>>,
467 /// The string value - this will be present for types string, choice and hidden.
468 #[serde(rename = "valueString")]
469 pub value_string: Option<String>,
470}
471
472impl common::Part for AppRestrictionsSchemaRestrictionRestrictionValue {}
473
474/// List of states set by the app.
475///
476/// This type is not used in any activity, and only used as *part* of another schema.
477///
478#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
479#[serde_with::serde_as]
480#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
481pub struct AppState {
482 /// List of keyed app states. This field will always be present.
483 #[serde(rename = "keyedAppState")]
484 pub keyed_app_state: Option<Vec<KeyedAppState>>,
485 /// The package name of the app. This field will always be present.
486 #[serde(rename = "packageName")]
487 pub package_name: Option<String>,
488}
489
490impl common::Part for AppState {}
491
492/// An event generated when a new version of an app is uploaded to Google Play. Notifications are sent for new public versions only: alpha, beta, or canary versions do not generate this event. To fetch up-to-date version history for an app, use Products.Get on the EMM API.
493///
494/// This type is not used in any activity, and only used as *part* of another schema.
495///
496#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
497#[serde_with::serde_as]
498#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
499pub struct AppUpdateEvent {
500 /// The id of the product (e.g. "app:com.google.android.gm") that was updated. This field will always be present.
501 #[serde(rename = "productId")]
502 pub product_id: Option<String>,
503}
504
505impl common::Part for AppUpdateEvent {}
506
507/// This represents a single version of the app.
508///
509/// This type is not used in any activity, and only used as *part* of another schema.
510///
511#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
512#[serde_with::serde_as]
513#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
514pub struct AppVersion {
515 /// True if this version is a production APK.
516 #[serde(rename = "isProduction")]
517 pub is_production: Option<bool>,
518 /// The SDK version this app targets, as specified in the manifest of the APK. See http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
519 #[serde(rename = "targetSdkVersion")]
520 pub target_sdk_version: Option<i32>,
521 /// Deprecated, use trackId instead.
522 pub track: Option<String>,
523 /// Track ids that the app version is published in. Replaces the track field (deprecated), but doesn't include the production track (see isProduction instead).
524 #[serde(rename = "trackId")]
525 pub track_id: Option<Vec<String>>,
526 /// Unique increasing identifier for the app version.
527 #[serde(rename = "versionCode")]
528 pub version_code: Option<i32>,
529 /// The string used in the Play store by the app developer to identify the version. The string is not necessarily unique or localized (for example, the string could be "1.4").
530 #[serde(rename = "versionString")]
531 pub version_string: Option<String>,
532}
533
534impl common::Part for AppVersion {}
535
536/// Information on an approval URL.
537///
538/// This type is not used in any activity, and only used as *part* of another schema.
539///
540#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
541#[serde_with::serde_as]
542#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
543pub struct ApprovalUrlInfo {
544 /// A URL that displays a product's permissions and that can also be used to approve the product with the Products.approve call.
545 #[serde(rename = "approvalUrl")]
546 pub approval_url: Option<String>,
547}
548
549impl common::Part for ApprovalUrlInfo {}
550
551/// An AuthenticationToken is used by the EMM’s device policy client on a device to provision the given EMM-managed user on that device.
552///
553/// # Activities
554///
555/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
556/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
557///
558/// * [generate authentication token users](UserGenerateAuthenticationTokenCall) (response)
559#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
560#[serde_with::serde_as]
561#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
562pub struct AuthenticationToken {
563 /// The authentication token to be passed to the device policy client on the device where it can be used to provision the account for which this token was generated.
564 pub token: Option<String>,
565}
566
567impl common::ResponseResult for AuthenticationToken {}
568
569/// The auto-install constraint. Defines a set of restrictions for installation. At least one of the fields must be set.
570///
571/// This type is not used in any activity, and only used as *part* of another schema.
572///
573#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
574#[serde_with::serde_as]
575#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
576pub struct AutoInstallConstraint {
577 /// Charging state constraint.
578 #[serde(rename = "chargingStateConstraint")]
579 pub charging_state_constraint: Option<String>,
580 /// Device idle state constraint.
581 #[serde(rename = "deviceIdleStateConstraint")]
582 pub device_idle_state_constraint: Option<String>,
583 /// Network type constraint.
584 #[serde(rename = "networkTypeConstraint")]
585 pub network_type_constraint: Option<String>,
586}
587
588impl common::Part for AutoInstallConstraint {}
589
590/// There is no detailed description.
591///
592/// This type is not used in any activity, and only used as *part* of another schema.
593///
594#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
595#[serde_with::serde_as]
596#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
597pub struct AutoInstallPolicy {
598 /// The constraints for auto-installing the app. You can specify a maximum of one constraint.
599 #[serde(rename = "autoInstallConstraint")]
600 pub auto_install_constraint: Option<Vec<AutoInstallConstraint>>,
601 /// The auto-install mode. If unset, defaults to "doNotAutoInstall". An app is automatically installed regardless of a set maintenance window.
602 #[serde(rename = "autoInstallMode")]
603 pub auto_install_mode: Option<String>,
604 /// The priority of the install, as an unsigned integer. A lower number means higher priority.
605 #[serde(rename = "autoInstallPriority")]
606 pub auto_install_priority: Option<i32>,
607 /// The minimum version of the app. If a lower version of the app is installed, then the app will be auto-updated according to the auto-install constraints, instead of waiting for the regular auto-update. You can set a minimum version code for at most 20 apps per device.
608 #[serde(rename = "minimumVersionCode")]
609 pub minimum_version_code: Option<i32>,
610}
611
612impl common::Part for AutoInstallPolicy {}
613
614/// A configuration variables resource contains the managed configuration settings ID to be applied to a single user, as well as the variable set that is attributed to the user. The variable set will be used to replace placeholders in the managed configuration settings.
615///
616/// This type is not used in any activity, and only used as *part* of another schema.
617///
618#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
619#[serde_with::serde_as]
620#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
621pub struct ConfigurationVariables {
622 /// The ID of the managed configurations settings.
623 #[serde(rename = "mcmId")]
624 pub mcm_id: Option<String>,
625 /// The variable set that is attributed to the user.
626 #[serde(rename = "variableSet")]
627 pub variable_set: Option<Vec<VariableSet>>,
628}
629
630impl common::Part for ConfigurationVariables {}
631
632/// A Devices resource represents a mobile device managed by the EMM and belonging to a specific enterprise user.
633///
634/// # Activities
635///
636/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
637/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
638///
639/// * [force report upload devices](DeviceForceReportUploadCall) (none)
640/// * [get devices](DeviceGetCall) (response)
641/// * [get state devices](DeviceGetStateCall) (none)
642/// * [list devices](DeviceListCall) (none)
643/// * [set state devices](DeviceSetStateCall) (none)
644/// * [update devices](DeviceUpdateCall) (request|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 Device {
649 /// The Google Play Services Android ID for the device encoded as a lowercase hex string. For example, "123456789abcdef0".
650 #[serde(rename = "androidId")]
651 pub android_id: Option<String>,
652 /// The internal hardware codename of the device. This comes from android.os.Build.DEVICE. (field named "device" per logs/wireless/android/android_checkin.proto)
653 pub device: Option<String>,
654 /// The build fingerprint of the device if known.
655 #[serde(rename = "latestBuildFingerprint")]
656 pub latest_build_fingerprint: Option<String>,
657 /// The manufacturer of the device. This comes from android.os.Build.MANUFACTURER.
658 pub maker: Option<String>,
659 /// Identifies the extent to which the device is controlled by a managed Google Play EMM in various deployment configurations. Possible values include: - "managedDevice", a device that has the EMM's device policy controller (DPC) as the device owner. - "managedProfile", a device that has a profile managed by the DPC (DPC is profile owner) in addition to a separate, personal profile that is unavailable to the DPC. - "containerApp", no longer used (deprecated). - "unmanagedProfile", a device that has been allowed (by the domain's admin, using the Admin Console to enable the privilege) to use managed Google Play, but the profile is itself not owned by a DPC.
660 #[serde(rename = "managementType")]
661 pub management_type: Option<String>,
662 /// The model name of the device. This comes from android.os.Build.MODEL.
663 pub model: Option<String>,
664 /// The policy enforced on the device.
665 pub policy: Option<Policy>,
666 /// The product name of the device. This comes from android.os.Build.PRODUCT.
667 pub product: Option<String>,
668 /// The device report updated with the latest app states.
669 pub report: Option<DeviceReport>,
670 /// Retail brand for the device, if set. See android.os.Build.BRAND
671 #[serde(rename = "retailBrand")]
672 pub retail_brand: Option<String>,
673 /// API compatibility version.
674 #[serde(rename = "sdkVersion")]
675 pub sdk_version: Option<i32>,
676}
677
678impl common::RequestValue for Device {}
679impl common::Resource for Device {}
680impl common::ResponseResult for Device {}
681
682/// Device report updated with the latest app states for managed apps on the device.
683///
684/// This type is not used in any activity, and only used as *part* of another schema.
685///
686#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
687#[serde_with::serde_as]
688#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
689pub struct DeviceReport {
690 /// List of app states set by managed apps on the device. App states are defined by the app's developers. This field will always be present.
691 #[serde(rename = "appState")]
692 pub app_state: Option<Vec<AppState>>,
693 /// The timestamp of the last report update in milliseconds since epoch. This field will always be present.
694 #[serde(rename = "lastUpdatedTimestampMillis")]
695 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
696 pub last_updated_timestamp_millis: Option<i64>,
697}
698
699impl common::Part for DeviceReport {}
700
701/// An event generated when an updated device report is available.
702///
703/// This type is not used in any activity, and only used as *part* of another schema.
704///
705#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
706#[serde_with::serde_as]
707#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
708pub struct DeviceReportUpdateEvent {
709 /// The Android ID of the device. This field will always be present.
710 #[serde(rename = "deviceId")]
711 pub device_id: Option<String>,
712 /// The device report updated with the latest app states. This field will always be present.
713 pub report: Option<DeviceReport>,
714 /// The ID of the user. This field will always be present.
715 #[serde(rename = "userId")]
716 pub user_id: Option<String>,
717}
718
719impl common::Part for DeviceReportUpdateEvent {}
720
721/// The state of a user’s device, as accessed by the getState and setState methods on device resources.
722///
723/// # Activities
724///
725/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
726/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
727///
728/// * [get state devices](DeviceGetStateCall) (response)
729/// * [set state devices](DeviceSetStateCall) (request|response)
730#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
731#[serde_with::serde_as]
732#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
733pub struct DeviceState {
734 /// The state of the Google account on the device. "enabled" indicates that the Google account on the device can be used to access Google services (including Google Play), while "disabled" means that it cannot. A new device is initially in the "disabled" state.
735 #[serde(rename = "accountState")]
736 pub account_state: Option<String>,
737}
738
739impl common::RequestValue for DeviceState {}
740impl common::ResponseResult for DeviceState {}
741
742/// There is no detailed description.
743///
744/// # Activities
745///
746/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
747/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
748///
749/// * [list devices](DeviceListCall) (response)
750#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
751#[serde_with::serde_as]
752#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
753pub struct DevicesListResponse {
754 /// A managed device.
755 pub device: Option<Vec<Device>>,
756}
757
758impl common::ResponseResult for DevicesListResponse {}
759
760/// A token used to enroll a device.
761///
762/// # Activities
763///
764/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
765/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
766///
767/// * [create enrollment tokens](EnrollmentTokenCreateCall) (request|response)
768#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
769#[serde_with::serde_as]
770#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
771pub struct EnrollmentToken {
772 /// [Optional] The length of time the enrollment token is valid, ranging from 1 minute to [`Durations.MAX_VALUE`](https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/util/Durations.html#MAX_VALUE), approximately 10,000 years. If not specified, the default duration is 1 hour.
773 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
774 pub duration: Option<chrono::Duration>,
775 /// [Required] The type of the enrollment token.
776 #[serde(rename = "enrollmentTokenType")]
777 pub enrollment_token_type: Option<String>,
778 /// [Optional] Provides options related to Google authentication during the enrollment.
779 #[serde(rename = "googleAuthenticationOptions")]
780 pub google_authentication_options: Option<EnrollmentTokenGoogleAuthenticationOptions>,
781 /// The token value that's passed to the device and authorizes the device to enroll. This is a read-only field generated by the server.
782 pub token: Option<String>,
783}
784
785impl common::RequestValue for EnrollmentToken {}
786impl common::Resource for EnrollmentToken {}
787impl common::ResponseResult for EnrollmentToken {}
788
789/// Options for Google authentication during the enrollment.
790///
791/// This type is not used in any activity, and only used as *part* of another schema.
792///
793#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
794#[serde_with::serde_as]
795#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
796pub struct EnrollmentTokenGoogleAuthenticationOptions {
797 /// [Optional] Specifies whether user should authenticate with Google during enrollment. This setting, if specified,`GoogleAuthenticationSettings` specified for the enterprise resource is ignored for devices enrolled with this token.
798 #[serde(rename = "authenticationRequirement")]
799 pub authentication_requirement: Option<String>,
800 /// [Optional] Specifies the managed Google account that the user must use during enrollment.`AuthenticationRequirement` must be set to`REQUIRED` if this field is set.
801 #[serde(rename = "requiredAccountEmail")]
802 pub required_account_email: Option<String>,
803}
804
805impl common::Part for EnrollmentTokenGoogleAuthenticationOptions {}
806
807/// An Enterprises resource represents the binding between an EMM and a specific organization. That binding can be instantiated in one of two different ways using this API as follows: - For Google managed domain customers, the process involves using Enterprises.enroll and Enterprises.setAccount (in conjunction with artifacts obtained from the Admin console and the Google API Console) and submitted to the EMM through a more-or-less manual process. - For managed Google Play Accounts customers, the process involves using Enterprises.generateSignupUrl and Enterprises.completeSignup in conjunction with the managed Google Play sign-up UI (Google-provided mechanism) to create the binding without manual steps. As an EMM, you can support either or both approaches in your EMM console. See Create an Enterprise for details.
808///
809/// # Activities
810///
811/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
812/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
813///
814/// * [acknowledge notification set enterprises](EnterpriseAcknowledgeNotificationSetCall) (none)
815/// * [complete signup enterprises](EnterpriseCompleteSignupCall) (response)
816/// * [create web token enterprises](EnterpriseCreateWebTokenCall) (none)
817/// * [enroll enterprises](EnterpriseEnrollCall) (request|response)
818/// * [generate enterprise upgrade url enterprises](EnterpriseGenerateEnterpriseUpgradeUrlCall) (none)
819/// * [generate signup url enterprises](EnterpriseGenerateSignupUrlCall) (none)
820/// * [get enterprises](EnterpriseGetCall) (response)
821/// * [get service account enterprises](EnterpriseGetServiceAccountCall) (none)
822/// * [get store layout enterprises](EnterpriseGetStoreLayoutCall) (none)
823/// * [list enterprises](EnterpriseListCall) (none)
824/// * [pull notification set enterprises](EnterprisePullNotificationSetCall) (none)
825/// * [send test push notification enterprises](EnterpriseSendTestPushNotificationCall) (none)
826/// * [set account enterprises](EnterpriseSetAccountCall) (none)
827/// * [set store layout enterprises](EnterpriseSetStoreLayoutCall) (none)
828/// * [unenroll enterprises](EnterpriseUnenrollCall) (none)
829#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
830#[serde_with::serde_as]
831#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
832pub struct Enterprise {
833 /// Admins of the enterprise. This is only supported for enterprises created via the EMM-initiated flow.
834 pub administrator: Option<Vec<Administrator>>,
835 /// The type of the enterprise.
836 #[serde(rename = "enterpriseType")]
837 pub enterprise_type: Option<String>,
838 /// Output only. Settings for Google-provided user authentication.
839 #[serde(rename = "googleAuthenticationSettings")]
840 pub google_authentication_settings: Option<GoogleAuthenticationSettings>,
841 /// The unique ID for the enterprise.
842 pub id: Option<String>,
843 /// The type of managed Google domain
844 #[serde(rename = "managedGoogleDomainType")]
845 pub managed_google_domain_type: Option<String>,
846 /// The name of the enterprise, for example, "Example, Inc".
847 pub name: Option<String>,
848 /// The enterprise's primary domain, such as "example.com".
849 #[serde(rename = "primaryDomain")]
850 pub primary_domain: Option<String>,
851}
852
853impl common::RequestValue for Enterprise {}
854impl common::Resource for Enterprise {}
855impl common::ResponseResult for Enterprise {}
856
857/// A service account that can be used to authenticate as the enterprise to API calls that require such authentication.
858///
859/// # Activities
860///
861/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
862/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
863///
864/// * [set account enterprises](EnterpriseSetAccountCall) (request|response)
865#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
866#[serde_with::serde_as]
867#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
868pub struct EnterpriseAccount {
869 /// The email address of the service account.
870 #[serde(rename = "accountEmail")]
871 pub account_email: Option<String>,
872}
873
874impl common::RequestValue for EnterpriseAccount {}
875impl common::ResponseResult for EnterpriseAccount {}
876
877/// An authentication URL configuration for the authenticator app of an identity provider.
878///
879/// This type is not used in any activity, and only used as *part* of another schema.
880///
881#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
882#[serde_with::serde_as]
883#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
884pub struct EnterpriseAuthenticationAppLinkConfig {
885 /// An authentication url.
886 pub uri: Option<String>,
887}
888
889impl common::Part for EnterpriseAuthenticationAppLinkConfig {}
890
891/// An event generated when an enterprise is upgraded.
892///
893/// This type is not used in any activity, and only used as *part* of another schema.
894///
895#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
896#[serde_with::serde_as]
897#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
898pub struct EnterpriseUpgradeEvent {
899 /// The upgrade state.
900 #[serde(rename = "upgradeState")]
901 pub upgrade_state: Option<String>,
902}
903
904impl common::Part for EnterpriseUpgradeEvent {}
905
906/// There is no detailed description.
907///
908/// # Activities
909///
910/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
911/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
912///
913/// * [list enterprises](EnterpriseListCall) (response)
914#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
915#[serde_with::serde_as]
916#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
917pub struct EnterprisesListResponse {
918 /// An enterprise.
919 pub enterprise: Option<Vec<Enterprise>>,
920}
921
922impl common::ResponseResult for EnterprisesListResponse {}
923
924/// There is no detailed description.
925///
926/// # Activities
927///
928/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
929/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
930///
931/// * [send test push notification enterprises](EnterpriseSendTestPushNotificationCall) (response)
932#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
933#[serde_with::serde_as]
934#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
935pub struct EnterprisesSendTestPushNotificationResponse {
936 /// The message ID of the test push notification that was sent.
937 #[serde(rename = "messageId")]
938 pub message_id: Option<String>,
939 /// The name of the Cloud Pub/Sub topic to which notifications for this enterprise's enrolled account will be sent.
940 #[serde(rename = "topicName")]
941 pub topic_name: Option<String>,
942}
943
944impl common::ResponseResult for EnterprisesSendTestPushNotificationResponse {}
945
946/// *Deprecated:* New integrations cannot use this method and can refer to our new recommendations.
947///
948/// # Activities
949///
950/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
951/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
952///
953/// * [delete entitlements](EntitlementDeleteCall) (none)
954/// * [get entitlements](EntitlementGetCall) (response)
955/// * [list entitlements](EntitlementListCall) (none)
956/// * [update entitlements](EntitlementUpdateCall) (request|response)
957#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
958#[serde_with::serde_as]
959#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
960pub struct Entitlement {
961 /// The ID of the product that the entitlement is for. For example, "app:com.google.android.gm".
962 #[serde(rename = "productId")]
963 pub product_id: Option<String>,
964 /// The reason for the entitlement. For example, "free" for free apps. This property is temporary: it will be replaced by the acquisition kind field of group licenses.
965 pub reason: Option<String>,
966}
967
968impl common::RequestValue for Entitlement {}
969impl common::Resource for Entitlement {}
970impl common::ResponseResult for Entitlement {}
971
972/// There is no detailed description.
973///
974/// # Activities
975///
976/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
977/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
978///
979/// * [list entitlements](EntitlementListCall) (response)
980#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
981#[serde_with::serde_as]
982#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
983pub struct EntitlementsListResponse {
984 /// An entitlement of a user to a product (e.g. an app). For example, a free app that they have installed, or a paid app that they have been allocated a license to.
985 pub entitlement: Option<Vec<Entitlement>>,
986}
987
988impl common::ResponseResult for EntitlementsListResponse {}
989
990/// Response message for generating a URL to upgrade an existing managed Google Play Accounts enterprise to a managed Google domain.
991///
992/// # Activities
993///
994/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
995/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
996///
997/// * [generate enterprise upgrade url enterprises](EnterpriseGenerateEnterpriseUpgradeUrlCall) (response)
998#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
999#[serde_with::serde_as]
1000#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1001pub struct GenerateEnterpriseUpgradeUrlResponse {
1002 /// A URL for an enterprise admin to upgrade their enterprise. The page can't be rendered in an iframe.
1003 pub url: Option<String>,
1004}
1005
1006impl common::ResponseResult for GenerateEnterpriseUpgradeUrlResponse {}
1007
1008/// Contains settings for Google-provided user authentication.
1009///
1010/// This type is not used in any activity, and only used as *part* of another schema.
1011///
1012#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1013#[serde_with::serde_as]
1014#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1015pub struct GoogleAuthenticationSettings {
1016 /// Whether dedicated devices are allowed.
1017 #[serde(rename = "dedicatedDevicesAllowed")]
1018 pub dedicated_devices_allowed: Option<String>,
1019 /// Whether Google authentication is required.
1020 #[serde(rename = "googleAuthenticationRequired")]
1021 pub google_authentication_required: Option<String>,
1022}
1023
1024impl common::Part for GoogleAuthenticationSettings {}
1025
1026/// *Deprecated:* New integrations cannot use this method and can refer to our new recommendations
1027///
1028/// # Activities
1029///
1030/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1031/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1032///
1033/// * [get grouplicenses](GrouplicenseGetCall) (response)
1034#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1035#[serde_with::serde_as]
1036#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1037pub struct GroupLicense {
1038 /// How this group license was acquired. "bulkPurchase" means that this Grouplicenses resource was created because the enterprise purchased licenses for this product; otherwise, the value is "free" (for free products).
1039 #[serde(rename = "acquisitionKind")]
1040 pub acquisition_kind: Option<String>,
1041 /// Whether the product to which this group license relates is currently approved by the enterprise. Products are approved when a group license is first created, but this approval may be revoked by an enterprise admin via Google Play. Unapproved products will not be visible to end users in collections, and new entitlements to them should not normally be created.
1042 pub approval: Option<String>,
1043 /// The total number of provisioned licenses for this product. Returned by read operations, but ignored in write operations.
1044 #[serde(rename = "numProvisioned")]
1045 pub num_provisioned: Option<i32>,
1046 /// The number of purchased licenses (possibly in multiple purchases). If this field is omitted, then there is no limit on the number of licenses that can be provisioned (for example, if the acquisition kind is "free").
1047 #[serde(rename = "numPurchased")]
1048 pub num_purchased: Option<i32>,
1049 /// The permission approval status of the product. This field is only set if the product is approved. Possible states are: - "currentApproved", the current set of permissions is approved, but additional permissions will require the administrator to reapprove the product (If the product was approved without specifying the approved permissions setting, then this is the default behavior.), - "needsReapproval", the product has unapproved permissions. No additional product licenses can be assigned until the product is reapproved, - "allCurrentAndFutureApproved", the current permissions are approved and any future permission updates will be automatically approved without administrator review.
1050 pub permissions: Option<String>,
1051 /// The ID of the product that the license is for. For example, "app:com.google.android.gm".
1052 #[serde(rename = "productId")]
1053 pub product_id: Option<String>,
1054}
1055
1056impl common::Resource for GroupLicense {}
1057impl common::ResponseResult for GroupLicense {}
1058
1059/// There is no detailed description.
1060///
1061/// # Activities
1062///
1063/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1064/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1065///
1066/// * [list grouplicenseusers](GrouplicenseuserListCall) (response)
1067#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1068#[serde_with::serde_as]
1069#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1070pub struct GroupLicenseUsersListResponse {
1071 /// A user of an enterprise.
1072 pub user: Option<Vec<User>>,
1073}
1074
1075impl common::ResponseResult for GroupLicenseUsersListResponse {}
1076
1077/// There is no detailed description.
1078///
1079/// # Activities
1080///
1081/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1082/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1083///
1084/// * [list grouplicenses](GrouplicenseListCall) (response)
1085#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1086#[serde_with::serde_as]
1087#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1088pub struct GroupLicensesListResponse {
1089 /// A group license for a product approved for use in the enterprise.
1090 #[serde(rename = "groupLicense")]
1091 pub group_license: Option<Vec<GroupLicense>>,
1092}
1093
1094impl common::ResponseResult for GroupLicensesListResponse {}
1095
1096/// The existence of an Installs resource indicates that an app is installed on a particular device (or that an install is pending). The API can be used to create an install resource using the update method. This triggers the actual install of the app on the device. If the user does not already have an entitlement for the app, then an attempt is made to create one. If this fails (for example, because the app is not free and there is no available license), then the creation of the install fails. The API can also be used to update an installed app. If the update method is used on an existing install, then the app will be updated to the latest available version. Note that it is not possible to force the installation of a specific version of an app: the version code is read-only. If a user installs an app themselves (as permitted by the enterprise), then again an install resource and possibly an entitlement resource are automatically created. The API can also be used to delete an install resource, which triggers the removal of the app from the device. Note that deleting an install does not automatically remove the corresponding entitlement, even if there are no remaining installs. The install resource will also be deleted if the user uninstalls the app themselves.
1097///
1098/// # Activities
1099///
1100/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1101/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1102///
1103/// * [delete installs](InstallDeleteCall) (none)
1104/// * [get installs](InstallGetCall) (response)
1105/// * [list installs](InstallListCall) (none)
1106/// * [update installs](InstallUpdateCall) (request|response)
1107#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1108#[serde_with::serde_as]
1109#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1110pub struct Install {
1111 /// Install state. The state "installPending" means that an install request has recently been made and download to the device is in progress. The state "installed" means that the app has been installed. This field is read-only.
1112 #[serde(rename = "installState")]
1113 pub install_state: Option<String>,
1114 /// The ID of the product that the install is for. For example, "app:com.google.android.gm".
1115 #[serde(rename = "productId")]
1116 pub product_id: Option<String>,
1117 /// The version of the installed product. Guaranteed to be set only if the install state is "installed".
1118 #[serde(rename = "versionCode")]
1119 pub version_code: Option<i32>,
1120}
1121
1122impl common::RequestValue for Install {}
1123impl common::Resource for Install {}
1124impl common::ResponseResult for Install {}
1125
1126/// An event generated when an app installation failed on a device
1127///
1128/// This type is not used in any activity, and only used as *part* of another schema.
1129///
1130#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1131#[serde_with::serde_as]
1132#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1133pub struct InstallFailureEvent {
1134 /// The Android ID of the device. This field will always be present.
1135 #[serde(rename = "deviceId")]
1136 pub device_id: Option<String>,
1137 /// Additional details on the failure if applicable.
1138 #[serde(rename = "failureDetails")]
1139 pub failure_details: Option<String>,
1140 /// The reason for the installation failure. This field will always be present.
1141 #[serde(rename = "failureReason")]
1142 pub failure_reason: Option<String>,
1143 /// The id of the product (e.g. "app:com.google.android.gm") for which the install failure event occured. This field will always be present.
1144 #[serde(rename = "productId")]
1145 pub product_id: Option<String>,
1146 /// The ID of the user. This field will always be present.
1147 #[serde(rename = "userId")]
1148 pub user_id: Option<String>,
1149}
1150
1151impl common::Part for InstallFailureEvent {}
1152
1153/// There is no detailed description.
1154///
1155/// # Activities
1156///
1157/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1158/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1159///
1160/// * [list installs](InstallListCall) (response)
1161#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1162#[serde_with::serde_as]
1163#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1164pub struct InstallsListResponse {
1165 /// An installation of an app for a user on a specific device. The existence of an install implies that the user must have an entitlement to the app.
1166 pub install: Option<Vec<Install>>,
1167}
1168
1169impl common::ResponseResult for InstallsListResponse {}
1170
1171/// Represents a keyed app state containing a key, timestamp, severity level, optional description, and optional data.
1172///
1173/// This type is not used in any activity, and only used as *part* of another schema.
1174///
1175#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1176#[serde_with::serde_as]
1177#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1178pub struct KeyedAppState {
1179 /// Additional field intended for machine-readable data. For example, a number or JSON object. To prevent XSS, we recommend removing any HTML from the data before displaying it.
1180 pub data: Option<String>,
1181 /// Key indicating what the app is providing a state for. The content of the key is set by the app's developer. To prevent XSS, we recommend removing any HTML from the key before displaying it. This field will always be present.
1182 pub key: Option<String>,
1183 /// Free-form, human-readable message describing the app state. For example, an error message. To prevent XSS, we recommend removing any HTML from the message before displaying it.
1184 pub message: Option<String>,
1185 /// Severity of the app state. This field will always be present.
1186 pub severity: Option<String>,
1187 /// Timestamp of when the app set the state in milliseconds since epoch. This field will always be present.
1188 #[serde(rename = "stateTimestampMillis")]
1189 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1190 pub state_timestamp_millis: Option<i64>,
1191}
1192
1193impl common::Part for KeyedAppState {}
1194
1195/// A localized string with its locale.
1196///
1197/// This type is not used in any activity, and only used as *part* of another schema.
1198///
1199#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1200#[serde_with::serde_as]
1201#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1202pub struct LocalizedText {
1203 /// The BCP47 tag for a locale. (e.g. "en-US", "de").
1204 pub locale: Option<String>,
1205 /// The text localized in the associated locale.
1206 pub text: Option<String>,
1207}
1208
1209impl common::Part for LocalizedText {}
1210
1211/// Maintenance window for managed Google Play Accounts. This allows Play store to update the apps on the foreground in the designated window.
1212///
1213/// This type is not used in any activity, and only used as *part* of another schema.
1214///
1215#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1216#[serde_with::serde_as]
1217#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1218pub struct MaintenanceWindow {
1219 /// Duration of the maintenance window, in milliseconds. The duration must be between 30 minutes and 24 hours (inclusive).
1220 #[serde(rename = "durationMs")]
1221 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1222 pub duration_ms: Option<i64>,
1223 /// Start time of the maintenance window, in milliseconds after midnight on the device. Windows can span midnight.
1224 #[serde(rename = "startTimeAfterMidnightMs")]
1225 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1226 pub start_time_after_midnight_ms: Option<i64>,
1227}
1228
1229impl common::Part for MaintenanceWindow {}
1230
1231/// *Deprecated:* New integrations cannot use this method and can refer to our new recommendations
1232///
1233/// # Activities
1234///
1235/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1236/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1237///
1238/// * [get managedconfigurationsfordevice](ManagedconfigurationsfordeviceGetCall) (response)
1239/// * [update managedconfigurationsfordevice](ManagedconfigurationsfordeviceUpdateCall) (request|response)
1240/// * [get managedconfigurationsforuser](ManagedconfigurationsforuserGetCall) (response)
1241/// * [update managedconfigurationsforuser](ManagedconfigurationsforuserUpdateCall) (request|response)
1242#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1243#[serde_with::serde_as]
1244#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1245pub struct ManagedConfiguration {
1246 /// Contains the ID of the managed configuration profile and the set of configuration variables (if any) defined for the user.
1247 #[serde(rename = "configurationVariables")]
1248 pub configuration_variables: Option<ConfigurationVariables>,
1249 /// Deprecated.
1250 pub kind: Option<String>,
1251 /// The set of managed properties for this configuration.
1252 #[serde(rename = "managedProperty")]
1253 pub managed_property: Option<Vec<ManagedProperty>>,
1254 /// The ID of the product that the managed configuration is for, e.g. "app:com.google.android.gm".
1255 #[serde(rename = "productId")]
1256 pub product_id: Option<String>,
1257}
1258
1259impl common::RequestValue for ManagedConfiguration {}
1260impl common::ResponseResult for ManagedConfiguration {}
1261
1262/// There is no detailed description.
1263///
1264/// # Activities
1265///
1266/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1267/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1268///
1269/// * [list managedconfigurationsfordevice](ManagedconfigurationsfordeviceListCall) (response)
1270#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1271#[serde_with::serde_as]
1272#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1273pub struct ManagedConfigurationsForDeviceListResponse {
1274 /// A managed configuration for an app on a specific device.
1275 #[serde(rename = "managedConfigurationForDevice")]
1276 pub managed_configuration_for_device: Option<Vec<ManagedConfiguration>>,
1277}
1278
1279impl common::ResponseResult for ManagedConfigurationsForDeviceListResponse {}
1280
1281/// There is no detailed description.
1282///
1283/// # Activities
1284///
1285/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1286/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1287///
1288/// * [list managedconfigurationsforuser](ManagedconfigurationsforuserListCall) (response)
1289#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1290#[serde_with::serde_as]
1291#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1292pub struct ManagedConfigurationsForUserListResponse {
1293 /// A managed configuration for an app for a specific user.
1294 #[serde(rename = "managedConfigurationForUser")]
1295 pub managed_configuration_for_user: Option<Vec<ManagedConfiguration>>,
1296}
1297
1298impl common::ResponseResult for ManagedConfigurationsForUserListResponse {}
1299
1300/// A managed configurations settings resource contains the set of managed properties that have been configured for an Android app to be applied to a set of users. The app's developer would have defined configurable properties in the managed configurations schema.
1301///
1302/// This type is not used in any activity, and only used as *part* of another schema.
1303///
1304#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1305#[serde_with::serde_as]
1306#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1307pub struct ManagedConfigurationsSettings {
1308 /// The last updated time of the managed configuration settings in milliseconds since 1970-01-01T00:00:00Z.
1309 #[serde(rename = "lastUpdatedTimestampMillis")]
1310 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1311 pub last_updated_timestamp_millis: Option<i64>,
1312 /// The ID of the managed configurations settings.
1313 #[serde(rename = "mcmId")]
1314 pub mcm_id: Option<String>,
1315 /// The name of the managed configurations settings.
1316 pub name: Option<String>,
1317}
1318
1319impl common::Part for ManagedConfigurationsSettings {}
1320
1321/// There is no detailed description.
1322///
1323/// # Activities
1324///
1325/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1326/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1327///
1328/// * [list managedconfigurationssettings](ManagedconfigurationssettingListCall) (response)
1329#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1330#[serde_with::serde_as]
1331#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1332pub struct ManagedConfigurationsSettingsListResponse {
1333 /// A managed configurations settings for an app that may be assigned to a group of users in an enterprise.
1334 #[serde(rename = "managedConfigurationsSettings")]
1335 pub managed_configurations_settings: Option<Vec<ManagedConfigurationsSettings>>,
1336}
1337
1338impl common::ResponseResult for ManagedConfigurationsSettingsListResponse {}
1339
1340/// A managed property of a managed configuration. The property must match one of the properties in the app restrictions schema of the product. Exactly one of the value fields must be populated, and it must match the property's type in the app restrictions schema.
1341///
1342/// This type is not used in any activity, and only used as *part* of another schema.
1343///
1344#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1345#[serde_with::serde_as]
1346#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1347pub struct ManagedProperty {
1348 /// The unique key that identifies the property.
1349 pub key: Option<String>,
1350 /// The boolean value - this will only be present if type of the property is bool.
1351 #[serde(rename = "valueBool")]
1352 pub value_bool: Option<bool>,
1353 /// The bundle of managed properties - this will only be present if type of the property is bundle.
1354 #[serde(rename = "valueBundle")]
1355 pub value_bundle: Option<ManagedPropertyBundle>,
1356 /// The list of bundles of properties - this will only be present if type of the property is bundle_array.
1357 #[serde(rename = "valueBundleArray")]
1358 pub value_bundle_array: Option<Vec<ManagedPropertyBundle>>,
1359 /// The integer value - this will only be present if type of the property is integer.
1360 #[serde(rename = "valueInteger")]
1361 pub value_integer: Option<i32>,
1362 /// The string value - this will only be present if type of the property is string, choice or hidden.
1363 #[serde(rename = "valueString")]
1364 pub value_string: Option<String>,
1365 /// The list of string values - this will only be present if type of the property is multiselect.
1366 #[serde(rename = "valueStringArray")]
1367 pub value_string_array: Option<Vec<String>>,
1368}
1369
1370impl common::Part for ManagedProperty {}
1371
1372/// A bundle of managed properties.
1373///
1374/// This type is not used in any activity, and only used as *part* of another schema.
1375///
1376#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1377#[serde_with::serde_as]
1378#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1379pub struct ManagedPropertyBundle {
1380 /// The list of managed properties.
1381 #[serde(rename = "managedProperty")]
1382 pub managed_property: Option<Vec<ManagedProperty>>,
1383}
1384
1385impl common::Part for ManagedPropertyBundle {}
1386
1387/// An event generated when a new device is ready to be managed.
1388///
1389/// This type is not used in any activity, and only used as *part* of another schema.
1390///
1391#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1392#[serde_with::serde_as]
1393#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1394pub struct NewDeviceEvent {
1395 /// The Android ID of the device. This field will always be present.
1396 #[serde(rename = "deviceId")]
1397 pub device_id: Option<String>,
1398 /// Policy app on the device.
1399 #[serde(rename = "dpcPackageName")]
1400 pub dpc_package_name: Option<String>,
1401 /// Identifies the extent to which the device is controlled by an Android EMM in various deployment configurations. Possible values include: - "managedDevice", a device where the DPC is set as device owner, - "managedProfile", a device where the DPC is set as profile owner.
1402 #[serde(rename = "managementType")]
1403 pub management_type: Option<String>,
1404 /// The ID of the user. This field will always be present.
1405 #[serde(rename = "userId")]
1406 pub user_id: Option<String>,
1407}
1408
1409impl common::Part for NewDeviceEvent {}
1410
1411/// An event generated when new permissions are added to an app.
1412///
1413/// This type is not used in any activity, and only used as *part* of another schema.
1414///
1415#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1416#[serde_with::serde_as]
1417#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1418pub struct NewPermissionsEvent {
1419 /// The set of permissions that the enterprise admin has already approved for this application. Use Permissions.Get on the EMM API to retrieve details about these permissions.
1420 #[serde(rename = "approvedPermissions")]
1421 pub approved_permissions: Option<Vec<String>>,
1422 /// The id of the product (e.g. "app:com.google.android.gm") for which new permissions were added. This field will always be present.
1423 #[serde(rename = "productId")]
1424 pub product_id: Option<String>,
1425 /// The set of permissions that the app is currently requesting. Use Permissions.Get on the EMM API to retrieve details about these permissions.
1426 #[serde(rename = "requestedPermissions")]
1427 pub requested_permissions: Option<Vec<String>>,
1428}
1429
1430impl common::Part for NewPermissionsEvent {}
1431
1432/// A notification of one event relating to an enterprise.
1433///
1434/// This type is not used in any activity, and only used as *part* of another schema.
1435///
1436#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1437#[serde_with::serde_as]
1438#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1439pub struct Notification {
1440 /// Notifications about new app restrictions schema changes.
1441 #[serde(rename = "appRestrictionsSchemaChangeEvent")]
1442 pub app_restrictions_schema_change_event: Option<AppRestrictionsSchemaChangeEvent>,
1443 /// Notifications about app updates.
1444 #[serde(rename = "appUpdateEvent")]
1445 pub app_update_event: Option<AppUpdateEvent>,
1446 /// Notifications about device report updates.
1447 #[serde(rename = "deviceReportUpdateEvent")]
1448 pub device_report_update_event: Option<DeviceReportUpdateEvent>,
1449 /// The ID of the enterprise for which the notification is sent. This will always be present.
1450 #[serde(rename = "enterpriseId")]
1451 pub enterprise_id: Option<String>,
1452 /// Notifications about enterprise upgrade.
1453 #[serde(rename = "enterpriseUpgradeEvent")]
1454 pub enterprise_upgrade_event: Option<EnterpriseUpgradeEvent>,
1455 /// Notifications about an app installation failure.
1456 #[serde(rename = "installFailureEvent")]
1457 pub install_failure_event: Option<InstallFailureEvent>,
1458 /// Notifications about new devices.
1459 #[serde(rename = "newDeviceEvent")]
1460 pub new_device_event: Option<NewDeviceEvent>,
1461 /// Notifications about new app permissions.
1462 #[serde(rename = "newPermissionsEvent")]
1463 pub new_permissions_event: Option<NewPermissionsEvent>,
1464 /// Type of the notification.
1465 #[serde(rename = "notificationType")]
1466 pub notification_type: Option<String>,
1467 /// Notifications about changes to a product's approval status.
1468 #[serde(rename = "productApprovalEvent")]
1469 pub product_approval_event: Option<ProductApprovalEvent>,
1470 /// Notifications about product availability changes.
1471 #[serde(rename = "productAvailabilityChangeEvent")]
1472 pub product_availability_change_event: Option<ProductAvailabilityChangeEvent>,
1473 /// The time when the notification was published in milliseconds since 1970-01-01T00:00:00Z. This will always be present.
1474 #[serde(rename = "timestampMillis")]
1475 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1476 pub timestamp_millis: Option<i64>,
1477}
1478
1479impl common::Part for Notification {}
1480
1481/// A resource returned by the PullNotificationSet API, which contains a collection of notifications for enterprises associated with the service account authenticated for the request.
1482///
1483/// # Activities
1484///
1485/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1486/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1487///
1488/// * [pull notification set enterprises](EnterprisePullNotificationSetCall) (response)
1489#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1490#[serde_with::serde_as]
1491#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1492pub struct NotificationSet {
1493 /// The notifications received, or empty if no notifications are present.
1494 pub notification: Option<Vec<Notification>>,
1495 /// The notification set ID, required to mark the notification as received with the Enterprises.AcknowledgeNotification API. This will be omitted if no notifications are present.
1496 #[serde(rename = "notificationSetId")]
1497 pub notification_set_id: Option<String>,
1498}
1499
1500impl common::ResponseResult for NotificationSet {}
1501
1502/// Information about the current page. List operations that supports paging return only one "page" of results. This protocol buffer message describes the page that has been returned.
1503///
1504/// This type is not used in any activity, and only used as *part* of another schema.
1505///
1506#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1507#[serde_with::serde_as]
1508#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1509pub struct PageInfo {
1510 /// Maximum number of results returned in one page. ! The number of results included in the API response.
1511 #[serde(rename = "resultPerPage")]
1512 pub result_per_page: Option<i32>,
1513 /// Index of the first result returned in the current page.
1514 #[serde(rename = "startIndex")]
1515 pub start_index: Option<i32>,
1516 /// Total number of results available on the backend ! The total number of results in the result set.
1517 #[serde(rename = "totalResults")]
1518 pub total_results: Option<i32>,
1519}
1520
1521impl common::Part for PageInfo {}
1522
1523/// A Permissions resource represents some extra capability, to be granted to an Android app, which requires explicit consent. An enterprise admin must consent to these permissions on behalf of their users before an entitlement for the app can be created. The permissions collection is read-only. The information provided for each permission (localized name and description) is intended to be used in the MDM user interface when obtaining consent from the enterprise.
1524///
1525/// # Activities
1526///
1527/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1528/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1529///
1530/// * [get permissions](PermissionGetCall) (response)
1531#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1532#[serde_with::serde_as]
1533#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1534pub struct Permission {
1535 /// A longer description of the Permissions resource, giving more details of what it affects.
1536 pub description: Option<String>,
1537 /// The name of the permission.
1538 pub name: Option<String>,
1539 /// An opaque string uniquely identifying the permission.
1540 #[serde(rename = "permissionId")]
1541 pub permission_id: Option<String>,
1542}
1543
1544impl common::Resource for Permission {}
1545impl common::ResponseResult for Permission {}
1546
1547/// The device policy for a given managed device.
1548///
1549/// This type is not used in any activity, and only used as *part* of another schema.
1550///
1551#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1552#[serde_with::serde_as]
1553#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1554pub struct Policy {
1555 /// Controls when automatic app updates on the device can be applied. Recommended alternative: autoUpdateMode which is set per app, provides greater flexibility around update frequency. When autoUpdateMode is set to AUTO_UPDATE_POSTPONED or AUTO_UPDATE_HIGH_PRIORITY, autoUpdatePolicy has no effect. - choiceToTheUser allows the device's user to configure the app update policy. - always enables auto updates. - never disables auto updates. - wifiOnly enables auto updates only when the device is connected to wifi. *Important:* Changes to app update policies don't affect updates that are in progress. Any policy changes will apply to subsequent app updates.
1556 #[serde(rename = "autoUpdatePolicy")]
1557 pub auto_update_policy: Option<String>,
1558 /// Whether the device reports app states to the EMM. The default value is "deviceReportDisabled".
1559 #[serde(rename = "deviceReportPolicy")]
1560 pub device_report_policy: Option<String>,
1561 /// The maintenance window defining when apps running in the foreground should be updated.
1562 #[serde(rename = "maintenanceWindow")]
1563 pub maintenance_window: Option<MaintenanceWindow>,
1564 /// An identifier for the policy that will be passed with the app install feedback sent from the Play Store.
1565 #[serde(rename = "policyId")]
1566 pub policy_id: Option<String>,
1567 /// The availability granted to the device for the specified products. "all" gives the device access to all products, regardless of approval status. "all" does not enable automatic visibility of "alpha" or "beta" tracks. "whitelist" grants the device access the products specified in productPolicy[]. Only products that are approved or products that were previously approved (products with revoked approval) by the enterprise can be whitelisted. If no value is provided, the availability set at the user level is applied by default.
1568 #[serde(rename = "productAvailabilityPolicy")]
1569 pub product_availability_policy: Option<String>,
1570 /// The list of product policies. The productAvailabilityPolicy needs to be set to WHITELIST or ALL for the product policies to be applied.
1571 #[serde(rename = "productPolicy")]
1572 pub product_policy: Option<Vec<ProductPolicy>>,
1573}
1574
1575impl common::Part for Policy {}
1576
1577/// A Products resource represents an app in the Google Play store that is available to at least some users in the enterprise. (Some apps are restricted to a single enterprise, and no information about them is made available outside that enterprise.) The information provided for each product (localized name, icon, link to the full Google Play details page) is intended to allow a basic representation of the product within an EMM user interface.
1578///
1579/// # Activities
1580///
1581/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1582/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1583///
1584/// * [approve products](ProductApproveCall) (none)
1585/// * [generate approval url products](ProductGenerateApprovalUrlCall) (none)
1586/// * [get products](ProductGetCall) (response)
1587/// * [get app restrictions schema products](ProductGetAppRestrictionsSchemaCall) (none)
1588/// * [get permissions products](ProductGetPermissionCall) (none)
1589/// * [list products](ProductListCall) (none)
1590/// * [unapprove products](ProductUnapproveCall) (none)
1591#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1592#[serde_with::serde_as]
1593#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1594pub struct Product {
1595 /// The app restriction schema
1596 #[serde(rename = "appRestrictionsSchema")]
1597 pub app_restrictions_schema: Option<AppRestrictionsSchema>,
1598 /// The tracks visible to the enterprise.
1599 #[serde(rename = "appTracks")]
1600 pub app_tracks: Option<Vec<TrackInfo>>,
1601 /// App versions currently available for this product.
1602 #[serde(rename = "appVersion")]
1603 pub app_version: Option<Vec<AppVersion>>,
1604 /// The name of the author of the product (for example, the app developer).
1605 #[serde(rename = "authorName")]
1606 pub author_name: Option<String>,
1607 /// The countries which this app is available in.
1608 #[serde(rename = "availableCountries")]
1609 pub available_countries: Option<Vec<String>>,
1610 /// Deprecated, use appTracks instead.
1611 #[serde(rename = "availableTracks")]
1612 pub available_tracks: Option<Vec<String>>,
1613 /// The app category (e.g. RACING, SOCIAL, etc.)
1614 pub category: Option<String>,
1615 /// The content rating for this app.
1616 #[serde(rename = "contentRating")]
1617 pub content_rating: Option<String>,
1618 /// The localized promotional description, if available.
1619 pub description: Option<String>,
1620 /// A link to the (consumer) Google Play details page for the product.
1621 #[serde(rename = "detailsUrl")]
1622 pub details_url: Option<String>,
1623 /// How and to whom the package is made available. The value publicGoogleHosted means that the package is available through the Play store and not restricted to a specific enterprise. The value privateGoogleHosted means that the package is a private app (restricted to an enterprise) but hosted by Google. The value privateSelfHosted means that the package is a private app (restricted to an enterprise) and is privately hosted.
1624 #[serde(rename = "distributionChannel")]
1625 pub distribution_channel: Option<String>,
1626 /// Noteworthy features (if any) of this product.
1627 pub features: Option<Vec<String>>,
1628 /// The localized full app store description, if available.
1629 #[serde(rename = "fullDescription")]
1630 pub full_description: Option<String>,
1631 /// A link to an image that can be used as an icon for the product. This image is suitable for use at up to 512px x 512px.
1632 #[serde(rename = "iconUrl")]
1633 pub icon_url: Option<String>,
1634 /// The approximate time (within 7 days) the app was last published, expressed in milliseconds since epoch.
1635 #[serde(rename = "lastUpdatedTimestampMillis")]
1636 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1637 pub last_updated_timestamp_millis: Option<i64>,
1638 /// The minimum Android SDK necessary to run the app.
1639 #[serde(rename = "minAndroidSdkVersion")]
1640 pub min_android_sdk_version: Option<i32>,
1641 /// A list of permissions required by the app.
1642 pub permissions: Option<Vec<ProductPermission>>,
1643 /// A string of the form *app:<package name>*. For example, app:com.google.android.gm represents the Gmail app.
1644 #[serde(rename = "productId")]
1645 pub product_id: Option<String>,
1646 /// Whether this product is free, free with in-app purchases, or paid. If the pricing is unknown, this means the product is not generally available anymore (even though it might still be available to people who own it).
1647 #[serde(rename = "productPricing")]
1648 pub product_pricing: Option<String>,
1649 /// A description of the recent changes made to the app.
1650 #[serde(rename = "recentChanges")]
1651 pub recent_changes: Option<String>,
1652 /// Deprecated.
1653 #[serde(rename = "requiresContainerApp")]
1654 pub requires_container_app: Option<bool>,
1655 /// A list of screenshot links representing the app.
1656 #[serde(rename = "screenshotUrls")]
1657 pub screenshot_urls: Option<Vec<String>>,
1658 /// The certificate used to sign this product.
1659 #[serde(rename = "signingCertificate")]
1660 pub signing_certificate: Option<ProductSigningCertificate>,
1661 /// A link to a smaller image that can be used as an icon for the product. This image is suitable for use at up to 128px x 128px.
1662 #[serde(rename = "smallIconUrl")]
1663 pub small_icon_url: Option<String>,
1664 /// The name of the product.
1665 pub title: Option<String>,
1666 /// A link to the managed Google Play details page for the product, for use by an Enterprise admin.
1667 #[serde(rename = "workDetailsUrl")]
1668 pub work_details_url: Option<String>,
1669}
1670
1671impl common::Resource for Product {}
1672impl common::ResponseResult for Product {}
1673
1674/// An event generated when a product's approval status is changed.
1675///
1676/// This type is not used in any activity, and only used as *part* of another schema.
1677///
1678#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1679#[serde_with::serde_as]
1680#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1681pub struct ProductApprovalEvent {
1682 /// Whether the product was approved or unapproved. This field will always be present.
1683 pub approved: Option<String>,
1684 /// The id of the product (e.g. "app:com.google.android.gm") for which the approval status has changed. This field will always be present.
1685 #[serde(rename = "productId")]
1686 pub product_id: Option<String>,
1687}
1688
1689impl common::Part for ProductApprovalEvent {}
1690
1691/// An event generated whenever a product's availability changes.
1692///
1693/// This type is not used in any activity, and only used as *part* of another schema.
1694///
1695#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1696#[serde_with::serde_as]
1697#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1698pub struct ProductAvailabilityChangeEvent {
1699 /// The new state of the product. This field will always be present.
1700 #[serde(rename = "availabilityStatus")]
1701 pub availability_status: Option<String>,
1702 /// The id of the product (e.g. "app:com.google.android.gm") for which the product availability changed. This field will always be present.
1703 #[serde(rename = "productId")]
1704 pub product_id: Option<String>,
1705}
1706
1707impl common::Part for ProductAvailabilityChangeEvent {}
1708
1709/// A product permissions resource represents the set of permissions required by a specific app and whether or not they have been accepted by an enterprise admin. The API can be used to read the set of permissions, and also to update the set to indicate that permissions have been accepted.
1710///
1711/// This type is not used in any activity, and only used as *part* of another schema.
1712///
1713#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1714#[serde_with::serde_as]
1715#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1716pub struct ProductPermission {
1717 /// An opaque string uniquely identifying the permission.
1718 #[serde(rename = "permissionId")]
1719 pub permission_id: Option<String>,
1720 /// Whether the permission has been accepted or not.
1721 pub state: Option<String>,
1722}
1723
1724impl common::Part for ProductPermission {}
1725
1726/// Information about the permissions required by a specific app and whether they have been accepted by the enterprise.
1727///
1728/// # Activities
1729///
1730/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1731/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1732///
1733/// * [get permissions products](ProductGetPermissionCall) (response)
1734#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1735#[serde_with::serde_as]
1736#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1737pub struct ProductPermissions {
1738 /// The permissions required by the app.
1739 pub permission: Option<Vec<ProductPermission>>,
1740 /// The ID of the app that the permissions relate to, e.g. "app:com.google.android.gm".
1741 #[serde(rename = "productId")]
1742 pub product_id: Option<String>,
1743}
1744
1745impl common::ResponseResult for ProductPermissions {}
1746
1747/// The policy for a product.
1748///
1749/// This type is not used in any activity, and only used as *part* of another schema.
1750///
1751#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1752#[serde_with::serde_as]
1753#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1754pub struct ProductPolicy {
1755 /// The auto-install policy for the product.
1756 #[serde(rename = "autoInstallPolicy")]
1757 pub auto_install_policy: Option<AutoInstallPolicy>,
1758 /// The auto-update mode for the product. When autoUpdateMode is used, it always takes precedence over the user's choice. So when a user makes changes to the device settings manually, these changes are ignored.
1759 #[serde(rename = "autoUpdateMode")]
1760 pub auto_update_mode: Option<String>,
1761 /// An authentication URL configuration for the authenticator app of an identity provider. This helps to launch the identity provider's authenticator app during the authentication happening in a private app using Android WebView. Authenticator app should already be the default handler for the authentication url on the device.
1762 #[serde(rename = "enterpriseAuthenticationAppLinkConfigs")]
1763 pub enterprise_authentication_app_link_configs:
1764 Option<Vec<EnterpriseAuthenticationAppLinkConfig>>,
1765 /// The managed configuration for the product.
1766 #[serde(rename = "managedConfiguration")]
1767 pub managed_configuration: Option<ManagedConfiguration>,
1768 /// The ID of the product. For example, "app:com.google.android.gm".
1769 #[serde(rename = "productId")]
1770 pub product_id: Option<String>,
1771 /// Grants the device visibility to the specified product release track(s), identified by trackIds. The list of release tracks of a product can be obtained by calling Products.Get.
1772 #[serde(rename = "trackIds")]
1773 pub track_ids: Option<Vec<String>>,
1774 /// Deprecated. Use trackIds instead.
1775 pub tracks: Option<Vec<String>>,
1776}
1777
1778impl common::Part for ProductPolicy {}
1779
1780/// A set of products.
1781///
1782/// # Activities
1783///
1784/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1785/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1786///
1787/// * [get available product set users](UserGetAvailableProductSetCall) (response)
1788/// * [set available product set users](UserSetAvailableProductSetCall) (request|response)
1789#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1790#[serde_with::serde_as]
1791#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1792pub struct ProductSet {
1793 /// The list of product IDs making up the set of products.
1794 #[serde(rename = "productId")]
1795 pub product_id: Option<Vec<String>>,
1796 /// The interpretation of this product set. "unknown" should never be sent and is ignored if received. "whitelist" means that the user is entitled to access the product set. "includeAll" means that all products are accessible, including products that are approved, products with revoked approval, and products that have never been approved. "allApproved" means that the user is entitled to access all products that are approved for the enterprise. If the value is "allApproved" or "includeAll", the productId field is ignored. If no value is provided, it is interpreted as "whitelist" for backwards compatibility. Further "allApproved" or "includeAll" does not enable automatic visibility of "alpha" or "beta" tracks for Android app. Use ProductVisibility to enable "alpha" or "beta" tracks per user.
1797 #[serde(rename = "productSetBehavior")]
1798 pub product_set_behavior: Option<String>,
1799 /// Additional list of product IDs making up the product set. Unlike the productID array, in this list It's possible to specify which tracks (alpha, beta, production) of a product are visible to the user. See ProductVisibility and its fields for more information. Specifying the same product ID both here and in the productId array is not allowed and it will result in an error.
1800 #[serde(rename = "productVisibility")]
1801 pub product_visibility: Option<Vec<ProductVisibility>>,
1802}
1803
1804impl common::RequestValue for ProductSet {}
1805impl common::ResponseResult for ProductSet {}
1806
1807/// There is no detailed description.
1808///
1809/// This type is not used in any activity, and only used as *part* of another schema.
1810///
1811#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1812#[serde_with::serde_as]
1813#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1814pub struct ProductSigningCertificate {
1815 /// The base64 urlsafe encoded SHA1 hash of the certificate. (This field is deprecated in favor of SHA2-256. It should not be used and may be removed at any time.)
1816 #[serde(rename = "certificateHashSha1")]
1817 pub certificate_hash_sha1: Option<String>,
1818 /// The base64 urlsafe encoded SHA2-256 hash of the certificate.
1819 #[serde(rename = "certificateHashSha256")]
1820 pub certificate_hash_sha256: Option<String>,
1821}
1822
1823impl common::Part for ProductSigningCertificate {}
1824
1825/// A product to be made visible to a user.
1826///
1827/// This type is not used in any activity, and only used as *part* of another schema.
1828///
1829#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1830#[serde_with::serde_as]
1831#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1832pub struct ProductVisibility {
1833 /// The product ID to make visible to the user. Required for each item in the productVisibility list.
1834 #[serde(rename = "productId")]
1835 pub product_id: Option<String>,
1836 /// Grants the user visibility to the specified product track(s), identified by trackIds.
1837 #[serde(rename = "trackIds")]
1838 pub track_ids: Option<Vec<String>>,
1839 /// Deprecated. Use trackIds instead.
1840 pub tracks: Option<Vec<String>>,
1841}
1842
1843impl common::Part for ProductVisibility {}
1844
1845/// There is no detailed description.
1846///
1847/// # Activities
1848///
1849/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1850/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1851///
1852/// * [approve products](ProductApproveCall) (request)
1853#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1854#[serde_with::serde_as]
1855#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1856pub struct ProductsApproveRequest {
1857 /// The approval URL that was shown to the user. Only the permissions shown to the user with that URL will be accepted, which may not be the product's entire set of permissions. For example, the URL may only display new permissions from an update after the product was approved, or not include new permissions if the product was updated since the URL was generated.
1858 #[serde(rename = "approvalUrlInfo")]
1859 pub approval_url_info: Option<ApprovalUrlInfo>,
1860 /// Sets how new permission requests for the product are handled. "allPermissions" automatically approves all current and future permissions for the product. "currentPermissionsOnly" approves the current set of permissions for the product, but any future permissions added through updates will require manual reapproval. If not specified, only the current set of permissions will be approved.
1861 #[serde(rename = "approvedPermissions")]
1862 pub approved_permissions: Option<String>,
1863}
1864
1865impl common::RequestValue for ProductsApproveRequest {}
1866
1867/// There is no detailed description.
1868///
1869/// # Activities
1870///
1871/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1872/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1873///
1874/// * [generate approval url products](ProductGenerateApprovalUrlCall) (response)
1875#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1876#[serde_with::serde_as]
1877#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1878pub struct ProductsGenerateApprovalUrlResponse {
1879 /// A URL that can be rendered in an iframe to display the permissions (if any) of a product. This URL can be used to approve the product only once and only within 24 hours of being generated, using the Products.approve call. If the product is currently unapproved and has no permissions, this URL will point to an empty page. If the product is currently approved, a URL will only be generated if that product has added permissions since it was last approved, and the URL will only display those new permissions that have not yet been accepted.
1880 pub url: Option<String>,
1881}
1882
1883impl common::ResponseResult for ProductsGenerateApprovalUrlResponse {}
1884
1885/// There is no detailed description.
1886///
1887/// # Activities
1888///
1889/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1890/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1891///
1892/// * [list products](ProductListCall) (response)
1893#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1894#[serde_with::serde_as]
1895#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1896pub struct ProductsListResponse {
1897 /// General pagination information.
1898 #[serde(rename = "pageInfo")]
1899 pub page_info: Option<PageInfo>,
1900 /// Information about a product (e.g. an app) in the Google Play store, for display to an enterprise admin.
1901 pub product: Option<Vec<Product>>,
1902 /// Pagination information for token pagination.
1903 #[serde(rename = "tokenPagination")]
1904 pub token_pagination: Option<TokenPagination>,
1905}
1906
1907impl common::ResponseResult for ProductsListResponse {}
1908
1909/// A service account identity, including the name and credentials that can be used to authenticate as the service account.
1910///
1911/// # Activities
1912///
1913/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1914/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1915///
1916/// * [get service account enterprises](EnterpriseGetServiceAccountCall) (response)
1917#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1918#[serde_with::serde_as]
1919#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1920pub struct ServiceAccount {
1921 /// Credentials that can be used to authenticate as this ServiceAccount.
1922 pub key: Option<ServiceAccountKey>,
1923 /// The account name of the service account, in the form of an email address. Assigned by the server.
1924 pub name: Option<String>,
1925}
1926
1927impl common::ResponseResult for ServiceAccount {}
1928
1929/// *Deprecated:* New integrations cannot use this method and can refer to our new recommendations
1930///
1931/// # Activities
1932///
1933/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1934/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1935///
1936/// * [insert serviceaccountkeys](ServiceaccountkeyInsertCall) (request|response)
1937#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1938#[serde_with::serde_as]
1939#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1940pub struct ServiceAccountKey {
1941 /// The body of the private key credentials file, in string format. This is only populated when the ServiceAccountKey is created, and is not stored by Google.
1942 pub data: Option<String>,
1943 /// An opaque, unique identifier for this ServiceAccountKey. Assigned by the server.
1944 pub id: Option<String>,
1945 /// Public key data for the credentials file. This is an X.509 cert. If you are using the googleCredentials key type, this is identical to the cert that can be retrieved by using the X.509 cert url inside of the credentials file.
1946 #[serde(rename = "publicData")]
1947 pub public_data: Option<String>,
1948 /// The file format of the generated key data.
1949 #[serde(rename = "type")]
1950 pub type_: Option<String>,
1951}
1952
1953impl common::RequestValue for ServiceAccountKey {}
1954impl common::Resource for ServiceAccountKey {}
1955impl common::ResponseResult for ServiceAccountKey {}
1956
1957/// There is no detailed description.
1958///
1959/// # Activities
1960///
1961/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1962/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1963///
1964/// * [list serviceaccountkeys](ServiceaccountkeyListCall) (response)
1965#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1966#[serde_with::serde_as]
1967#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1968pub struct ServiceAccountKeysListResponse {
1969 /// The service account credentials.
1970 #[serde(rename = "serviceAccountKey")]
1971 pub service_account_key: Option<Vec<ServiceAccountKey>>,
1972}
1973
1974impl common::ResponseResult for ServiceAccountKeysListResponse {}
1975
1976/// A resource returned by the GenerateSignupUrl API, which contains the Signup URL and Completion Token.
1977///
1978/// # Activities
1979///
1980/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1981/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1982///
1983/// * [generate signup url enterprises](EnterpriseGenerateSignupUrlCall) (response)
1984#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1985#[serde_with::serde_as]
1986#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1987pub struct SignupInfo {
1988 /// An opaque token that will be required, along with the Enterprise Token, for obtaining the enterprise resource from CompleteSignup.
1989 #[serde(rename = "completionToken")]
1990 pub completion_token: Option<String>,
1991 /// Deprecated.
1992 pub kind: Option<String>,
1993 /// A URL under which the Admin can sign up for an enterprise. The page pointed to cannot be rendered in an iframe.
1994 pub url: Option<String>,
1995}
1996
1997impl common::ResponseResult for SignupInfo {}
1998
1999/// Definition of a managed Google Play store cluster, a list of products displayed as part of a store page.
2000///
2001/// # Activities
2002///
2003/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2004/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2005///
2006/// * [get storelayoutclusters](StorelayoutclusterGetCall) (response)
2007/// * [insert storelayoutclusters](StorelayoutclusterInsertCall) (request|response)
2008/// * [update storelayoutclusters](StorelayoutclusterUpdateCall) (request|response)
2009#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2010#[serde_with::serde_as]
2011#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2012pub struct StoreCluster {
2013 /// Unique ID of this cluster. Assigned by the server. Immutable once assigned.
2014 pub id: Option<String>,
2015 /// Ordered list of localized strings giving the name of this page. The text displayed is the one that best matches the user locale, or the first entry if there is no good match. There needs to be at least one entry.
2016 pub name: Option<Vec<LocalizedText>>,
2017 /// String (US-ASCII only) used to determine order of this cluster within the parent page's elements. Page elements are sorted in lexicographic order of this field. Duplicated values are allowed, but ordering between elements with duplicate order is undefined. The value of this field is never visible to a user, it is used solely for the purpose of defining an ordering. Maximum length is 256 characters.
2018 #[serde(rename = "orderInPage")]
2019 pub order_in_page: Option<String>,
2020 /// List of products in the order they are displayed in the cluster. There should not be duplicates within a cluster.
2021 #[serde(rename = "productId")]
2022 pub product_id: Option<Vec<String>>,
2023}
2024
2025impl common::RequestValue for StoreCluster {}
2026impl common::ResponseResult for StoreCluster {}
2027
2028/// General setting for the managed Google Play store layout, currently only specifying the page to display the first time the store is opened.
2029///
2030/// # Activities
2031///
2032/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2033/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2034///
2035/// * [get store layout enterprises](EnterpriseGetStoreLayoutCall) (response)
2036/// * [set store layout enterprises](EnterpriseSetStoreLayoutCall) (request|response)
2037#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2038#[serde_with::serde_as]
2039#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2040pub struct StoreLayout {
2041 /// The ID of the store page to be used as the homepage. The homepage is the first page shown in the managed Google Play Store. Not specifying a homepage is equivalent to setting the store layout type to "basic".
2042 #[serde(rename = "homepageId")]
2043 pub homepage_id: Option<String>,
2044 /// The store layout type. By default, this value is set to "basic" if the homepageId field is not set, and to "custom" otherwise. If set to "basic", the layout will consist of all approved apps that have been whitelisted for the user.
2045 #[serde(rename = "storeLayoutType")]
2046 pub store_layout_type: Option<String>,
2047}
2048
2049impl common::RequestValue for StoreLayout {}
2050impl common::ResponseResult for StoreLayout {}
2051
2052/// There is no detailed description.
2053///
2054/// # Activities
2055///
2056/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2057/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2058///
2059/// * [list storelayoutclusters](StorelayoutclusterListCall) (response)
2060#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2061#[serde_with::serde_as]
2062#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2063pub struct StoreLayoutClustersListResponse {
2064 /// A store cluster of an enterprise.
2065 pub cluster: Option<Vec<StoreCluster>>,
2066}
2067
2068impl common::ResponseResult for StoreLayoutClustersListResponse {}
2069
2070/// There is no detailed description.
2071///
2072/// # Activities
2073///
2074/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2075/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2076///
2077/// * [list storelayoutpages](StorelayoutpageListCall) (response)
2078#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2079#[serde_with::serde_as]
2080#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2081pub struct StoreLayoutPagesListResponse {
2082 /// A store page of an enterprise.
2083 pub page: Option<Vec<StorePage>>,
2084}
2085
2086impl common::ResponseResult for StoreLayoutPagesListResponse {}
2087
2088/// Definition of a managed Google Play store page, made of a localized name and links to other pages. A page also contains clusters defined as a subcollection.
2089///
2090/// # Activities
2091///
2092/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2093/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2094///
2095/// * [get storelayoutpages](StorelayoutpageGetCall) (response)
2096/// * [insert storelayoutpages](StorelayoutpageInsertCall) (request|response)
2097/// * [update storelayoutpages](StorelayoutpageUpdateCall) (request|response)
2098#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2099#[serde_with::serde_as]
2100#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2101pub struct StorePage {
2102 /// Unique ID of this page. Assigned by the server. Immutable once assigned.
2103 pub id: Option<String>,
2104 /// Ordered list of pages a user should be able to reach from this page. The list can't include this page. It is recommended that the basic pages are created first, before adding the links between pages. The API doesn't verify that the pages exist or the pages are reachable.
2105 pub link: Option<Vec<String>>,
2106 /// Ordered list of localized strings giving the name of this page. The text displayed is the one that best matches the user locale, or the first entry if there is no good match. There needs to be at least one entry.
2107 pub name: Option<Vec<LocalizedText>>,
2108}
2109
2110impl common::RequestValue for StorePage {}
2111impl common::ResponseResult for StorePage {}
2112
2113/// Pagination information returned by a List operation when token pagination is enabled. List operations that supports paging return only one "page" of results. This protocol buffer message describes the page that has been returned. When using token pagination, clients should use the next/previous token to get another page of the result. The presence or absence of next/previous token indicates whether a next/previous page is available and provides a mean of accessing this page. ListRequest.page_token should be set to either next_page_token or previous_page_token to access another page.
2114///
2115/// This type is not used in any activity, and only used as *part* of another schema.
2116///
2117#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2118#[serde_with::serde_as]
2119#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2120pub struct TokenPagination {
2121 /// Tokens to pass to the standard list field 'page_token'. Whenever available, tokens are preferred over manipulating start_index.
2122 #[serde(rename = "nextPageToken")]
2123 pub next_page_token: Option<String>,
2124 /// no description provided
2125 #[serde(rename = "previousPageToken")]
2126 pub previous_page_token: Option<String>,
2127}
2128
2129impl common::Part for TokenPagination {}
2130
2131/// Id to name association of a track.
2132///
2133/// This type is not used in any activity, and only used as *part* of another schema.
2134///
2135#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2136#[serde_with::serde_as]
2137#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2138pub struct TrackInfo {
2139 /// A modifiable name for a track. This is the visible name in the play developer console.
2140 #[serde(rename = "trackAlias")]
2141 pub track_alias: Option<String>,
2142 /// Unmodifiable, unique track identifier. This identifier is the releaseTrackId in the url of the play developer console page that displays the track information.
2143 #[serde(rename = "trackId")]
2144 pub track_id: Option<String>,
2145}
2146
2147impl common::Part for TrackInfo {}
2148
2149/// A Users resource represents an account associated with an enterprise. The account may be specific to a device or to an individual user (who can then use the account across multiple devices). The account may provide access to managed Google Play only, or to other Google services, depending on the identity model: - The Google managed domain identity model requires synchronization to Google account sources (via primaryEmail). - The managed Google Play Accounts identity model provides a dynamic means for enterprises to create user or device accounts as needed. These accounts provide access to managed Google Play.
2150///
2151/// # Activities
2152///
2153/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2154/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2155///
2156/// * [delete users](UserDeleteCall) (none)
2157/// * [generate authentication token users](UserGenerateAuthenticationTokenCall) (none)
2158/// * [get users](UserGetCall) (response)
2159/// * [get available product set users](UserGetAvailableProductSetCall) (none)
2160/// * [insert users](UserInsertCall) (request|response)
2161/// * [list users](UserListCall) (none)
2162/// * [revoke device access users](UserRevokeDeviceAccesCall) (none)
2163/// * [set available product set users](UserSetAvailableProductSetCall) (none)
2164/// * [update users](UserUpdateCall) (request|response)
2165#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2166#[serde_with::serde_as]
2167#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2168pub struct User {
2169 /// A unique identifier you create for this user, such as "user342" or "asset#44418". Do not use personally identifiable information (PII) for this property. Must always be set for EMM-managed users. Not set for Google-managed users.
2170 #[serde(rename = "accountIdentifier")]
2171 pub account_identifier: Option<String>,
2172 /// The type of account that this user represents. A userAccount can be installed on multiple devices, but a deviceAccount is specific to a single device. An EMM-managed user (emmManaged) can be either type (userAccount, deviceAccount), but a Google-managed user (googleManaged) is always a userAccount.
2173 #[serde(rename = "accountType")]
2174 pub account_type: Option<String>,
2175 /// The name that will appear in user interfaces. Setting this property is optional when creating EMM-managed users. If you do set this property, use something generic about the organization (such as "Example, Inc.") or your name (as EMM). Not used for Google-managed user accounts. @mutable androidenterprise.users.update
2176 #[serde(rename = "displayName")]
2177 pub display_name: Option<String>,
2178 /// The unique ID for the user.
2179 pub id: Option<String>,
2180 /// The entity that manages the user. With googleManaged users, the source of truth is Google so EMMs have to make sure a Google Account exists for the user. With emmManaged users, the EMM is in charge.
2181 #[serde(rename = "managementType")]
2182 pub management_type: Option<String>,
2183 /// The user's primary email address, for example, "jsmith@example.com". Will always be set for Google managed users and not set for EMM managed users.
2184 #[serde(rename = "primaryEmail")]
2185 pub primary_email: Option<String>,
2186}
2187
2188impl common::RequestValue for User {}
2189impl common::Resource for User {}
2190impl common::ResponseResult for User {}
2191
2192/// There is no detailed description.
2193///
2194/// # Activities
2195///
2196/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2197/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2198///
2199/// * [list users](UserListCall) (response)
2200#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2201#[serde_with::serde_as]
2202#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2203pub struct UsersListResponse {
2204 /// A user of an enterprise.
2205 pub user: Option<Vec<User>>,
2206}
2207
2208impl common::ResponseResult for UsersListResponse {}
2209
2210/// A variable set is a key-value pair of EMM-provided placeholders and its corresponding value, which is attributed to a user. For example, $FIRSTNAME could be a placeholder, and its value could be Alice. Placeholders should start with a '$' sign and should be alphanumeric only.
2211///
2212/// This type is not used in any activity, and only used as *part* of another schema.
2213///
2214#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2215#[serde_with::serde_as]
2216#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2217pub struct VariableSet {
2218 /// The placeholder string; defined by EMM.
2219 pub placeholder: Option<String>,
2220 /// The value of the placeholder, specific to the user.
2221 #[serde(rename = "userValue")]
2222 pub user_value: Option<String>,
2223}
2224
2225impl common::Part for VariableSet {}
2226
2227/// A WebApps resource represents a web app created for an enterprise. Web apps are published to managed Google Play and can be distributed like other Android apps. On a user’s device, a web app opens its specified URL.
2228///
2229/// # Activities
2230///
2231/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2232/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2233///
2234/// * [get webapps](WebappGetCall) (response)
2235/// * [insert webapps](WebappInsertCall) (request|response)
2236/// * [update webapps](WebappUpdateCall) (request|response)
2237#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2238#[serde_with::serde_as]
2239#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2240pub struct WebApp {
2241 /// The display mode of the web app. Possible values include: - "minimalUi", the device's status bar, navigation bar, the app's URL, and a refresh button are visible when the app is open. For HTTP URLs, you can only select this option. - "standalone", the device's status bar and navigation bar are visible when the app is open. - "fullScreen", the app opens in full screen mode, hiding the device's status and navigation bars. All browser UI elements, page URL, system status bar and back button are not visible, and the web app takes up the entirety of the available display area.
2242 #[serde(rename = "displayMode")]
2243 pub display_mode: Option<String>,
2244 /// A list of icons representing this website. If absent, a default icon (for create) or the current icon (for update) will be used.
2245 pub icons: Option<Vec<WebAppIcon>>,
2246 /// A flag whether the app has been published to the Play store yet.
2247 #[serde(rename = "isPublished")]
2248 pub is_published: Option<bool>,
2249 /// The start URL, i.e. the URL that should load when the user opens the application.
2250 #[serde(rename = "startUrl")]
2251 pub start_url: Option<String>,
2252 /// The title of the web app as displayed to the user (e.g., amongst a list of other applications, or as a label for an icon).
2253 pub title: Option<String>,
2254 /// The current version of the app. Note that the version can automatically increase during the lifetime of the web app, while Google does internal housekeeping to keep the web app up-to-date.
2255 #[serde(rename = "versionCode")]
2256 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2257 pub version_code: Option<i64>,
2258 /// The ID of the application. A string of the form "app:<package name>" where the package name always starts with the prefix "com.google.enterprise.webapp." followed by a random id.
2259 #[serde(rename = "webAppId")]
2260 pub web_app_id: Option<String>,
2261}
2262
2263impl common::RequestValue for WebApp {}
2264impl common::Resource for WebApp {}
2265impl common::ResponseResult for WebApp {}
2266
2267/// Icon for a web app.
2268///
2269/// This type is not used in any activity, and only used as *part* of another schema.
2270///
2271#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2272#[serde_with::serde_as]
2273#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2274pub struct WebAppIcon {
2275 /// The actual bytes of the image in a base64url encoded string (c.f. RFC4648, section 5 "Base 64 Encoding with URL and Filename Safe Alphabet"). - The image type can be png or jpg. - The image should ideally be square. - The image should ideally have a size of 512x512.
2276 #[serde(rename = "imageData")]
2277 pub image_data: Option<String>,
2278}
2279
2280impl common::Part for WebAppIcon {}
2281
2282/// There is no detailed description.
2283///
2284/// # Activities
2285///
2286/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2287/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2288///
2289/// * [list webapps](WebappListCall) (response)
2290#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2291#[serde_with::serde_as]
2292#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2293pub struct WebAppsListResponse {
2294 /// The manifest describing a web app.
2295 #[serde(rename = "webApp")]
2296 pub web_app: Option<Vec<WebApp>>,
2297}
2298
2299impl common::ResponseResult for WebAppsListResponse {}
2300
2301// ###################
2302// MethodBuilders ###
2303// #################
2304
2305/// A builder providing access to all methods supported on *device* resources.
2306/// It is not used directly, but through the [`AndroidEnterprise`] hub.
2307///
2308/// # Example
2309///
2310/// Instantiate a resource builder
2311///
2312/// ```test_harness,no_run
2313/// extern crate hyper;
2314/// extern crate hyper_rustls;
2315/// extern crate google_androidenterprise1 as androidenterprise1;
2316///
2317/// # async fn dox() {
2318/// use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2319///
2320/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2321/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2322/// .with_native_roots()
2323/// .unwrap()
2324/// .https_only()
2325/// .enable_http2()
2326/// .build();
2327///
2328/// let executor = hyper_util::rt::TokioExecutor::new();
2329/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2330/// secret,
2331/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2332/// yup_oauth2::client::CustomHyperClientBuilder::from(
2333/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2334/// ),
2335/// ).build().await.unwrap();
2336///
2337/// let client = hyper_util::client::legacy::Client::builder(
2338/// hyper_util::rt::TokioExecutor::new()
2339/// )
2340/// .build(
2341/// hyper_rustls::HttpsConnectorBuilder::new()
2342/// .with_native_roots()
2343/// .unwrap()
2344/// .https_or_http()
2345/// .enable_http2()
2346/// .build()
2347/// );
2348/// let mut hub = AndroidEnterprise::new(client, auth);
2349/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2350/// // like `force_report_upload(...)`, `get(...)`, `get_state(...)`, `list(...)`, `set_state(...)` and `update(...)`
2351/// // to build up your call.
2352/// let rb = hub.devices();
2353/// # }
2354/// ```
2355pub struct DeviceMethods<'a, C>
2356where
2357 C: 'a,
2358{
2359 hub: &'a AndroidEnterprise<C>,
2360}
2361
2362impl<'a, C> common::MethodsBuilder for DeviceMethods<'a, C> {}
2363
2364impl<'a, C> DeviceMethods<'a, C> {
2365 /// Create a builder to help you perform the following task:
2366 ///
2367 /// Uploads a report containing any changes in app states on the device since the last report was generated. You can call this method up to 3 times every 24 hours for a given device. If you exceed the quota, then the Google Play EMM API returns HTTP 429 Too Many Requests.
2368 ///
2369 /// # Arguments
2370 ///
2371 /// * `enterpriseId` - The ID of the enterprise.
2372 /// * `userId` - The ID of the user.
2373 /// * `deviceId` - The ID of the device.
2374 pub fn force_report_upload(
2375 &self,
2376 enterprise_id: &str,
2377 user_id: &str,
2378 device_id: &str,
2379 ) -> DeviceForceReportUploadCall<'a, C> {
2380 DeviceForceReportUploadCall {
2381 hub: self.hub,
2382 _enterprise_id: enterprise_id.to_string(),
2383 _user_id: user_id.to_string(),
2384 _device_id: device_id.to_string(),
2385 _delegate: Default::default(),
2386 _additional_params: Default::default(),
2387 _scopes: Default::default(),
2388 }
2389 }
2390
2391 /// Create a builder to help you perform the following task:
2392 ///
2393 /// Retrieves the details of a device.
2394 ///
2395 /// # Arguments
2396 ///
2397 /// * `enterpriseId` - The ID of the enterprise.
2398 /// * `userId` - The ID of the user.
2399 /// * `deviceId` - The ID of the device.
2400 pub fn get(&self, enterprise_id: &str, user_id: &str, device_id: &str) -> DeviceGetCall<'a, C> {
2401 DeviceGetCall {
2402 hub: self.hub,
2403 _enterprise_id: enterprise_id.to_string(),
2404 _user_id: user_id.to_string(),
2405 _device_id: device_id.to_string(),
2406 _delegate: Default::default(),
2407 _additional_params: Default::default(),
2408 _scopes: Default::default(),
2409 }
2410 }
2411
2412 /// Create a builder to help you perform the following task:
2413 ///
2414 /// Retrieves whether a device's access to Google services is enabled or disabled. The device state takes effect only if enforcing EMM policies on Android devices is enabled in the Google Admin Console. Otherwise, the device state is ignored and all devices are allowed access to Google services. This is only supported for Google-managed users.
2415 ///
2416 /// # Arguments
2417 ///
2418 /// * `enterpriseId` - The ID of the enterprise.
2419 /// * `userId` - The ID of the user.
2420 /// * `deviceId` - The ID of the device.
2421 pub fn get_state(
2422 &self,
2423 enterprise_id: &str,
2424 user_id: &str,
2425 device_id: &str,
2426 ) -> DeviceGetStateCall<'a, C> {
2427 DeviceGetStateCall {
2428 hub: self.hub,
2429 _enterprise_id: enterprise_id.to_string(),
2430 _user_id: user_id.to_string(),
2431 _device_id: device_id.to_string(),
2432 _delegate: Default::default(),
2433 _additional_params: Default::default(),
2434 _scopes: Default::default(),
2435 }
2436 }
2437
2438 /// Create a builder to help you perform the following task:
2439 ///
2440 /// Retrieves the IDs of all of a user's devices.
2441 ///
2442 /// # Arguments
2443 ///
2444 /// * `enterpriseId` - The ID of the enterprise.
2445 /// * `userId` - The ID of the user.
2446 pub fn list(&self, enterprise_id: &str, user_id: &str) -> DeviceListCall<'a, C> {
2447 DeviceListCall {
2448 hub: self.hub,
2449 _enterprise_id: enterprise_id.to_string(),
2450 _user_id: user_id.to_string(),
2451 _delegate: Default::default(),
2452 _additional_params: Default::default(),
2453 _scopes: Default::default(),
2454 }
2455 }
2456
2457 /// Create a builder to help you perform the following task:
2458 ///
2459 /// Sets whether a device's access to Google services is enabled or disabled. The device state takes effect only if enforcing EMM policies on Android devices is enabled in the Google Admin Console. Otherwise, the device state is ignored and all devices are allowed access to Google services. This is only supported for Google-managed users.
2460 ///
2461 /// # Arguments
2462 ///
2463 /// * `request` - No description provided.
2464 /// * `enterpriseId` - The ID of the enterprise.
2465 /// * `userId` - The ID of the user.
2466 /// * `deviceId` - The ID of the device.
2467 pub fn set_state(
2468 &self,
2469 request: DeviceState,
2470 enterprise_id: &str,
2471 user_id: &str,
2472 device_id: &str,
2473 ) -> DeviceSetStateCall<'a, C> {
2474 DeviceSetStateCall {
2475 hub: self.hub,
2476 _request: request,
2477 _enterprise_id: enterprise_id.to_string(),
2478 _user_id: user_id.to_string(),
2479 _device_id: device_id.to_string(),
2480 _delegate: Default::default(),
2481 _additional_params: Default::default(),
2482 _scopes: Default::default(),
2483 }
2484 }
2485
2486 /// Create a builder to help you perform the following task:
2487 ///
2488 /// Updates the device policy. To ensure the policy is properly enforced, you need to prevent unmanaged accounts from accessing Google Play by setting the allowed_accounts in the managed configuration for the Google Play package. See restrict accounts in Google Play. When provisioning a new device, you should set the device policy using this method before adding the managed Google Play Account to the device, otherwise the policy will not be applied for a short period of time after adding the account to the device.
2489 ///
2490 /// # Arguments
2491 ///
2492 /// * `request` - No description provided.
2493 /// * `enterpriseId` - The ID of the enterprise.
2494 /// * `userId` - The ID of the user.
2495 /// * `deviceId` - The ID of the device.
2496 pub fn update(
2497 &self,
2498 request: Device,
2499 enterprise_id: &str,
2500 user_id: &str,
2501 device_id: &str,
2502 ) -> DeviceUpdateCall<'a, C> {
2503 DeviceUpdateCall {
2504 hub: self.hub,
2505 _request: request,
2506 _enterprise_id: enterprise_id.to_string(),
2507 _user_id: user_id.to_string(),
2508 _device_id: device_id.to_string(),
2509 _update_mask: Default::default(),
2510 _delegate: Default::default(),
2511 _additional_params: Default::default(),
2512 _scopes: Default::default(),
2513 }
2514 }
2515}
2516
2517/// A builder providing access to all methods supported on *enrollmentToken* resources.
2518/// It is not used directly, but through the [`AndroidEnterprise`] hub.
2519///
2520/// # Example
2521///
2522/// Instantiate a resource builder
2523///
2524/// ```test_harness,no_run
2525/// extern crate hyper;
2526/// extern crate hyper_rustls;
2527/// extern crate google_androidenterprise1 as androidenterprise1;
2528///
2529/// # async fn dox() {
2530/// use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2531///
2532/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2533/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2534/// .with_native_roots()
2535/// .unwrap()
2536/// .https_only()
2537/// .enable_http2()
2538/// .build();
2539///
2540/// let executor = hyper_util::rt::TokioExecutor::new();
2541/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2542/// secret,
2543/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2544/// yup_oauth2::client::CustomHyperClientBuilder::from(
2545/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2546/// ),
2547/// ).build().await.unwrap();
2548///
2549/// let client = hyper_util::client::legacy::Client::builder(
2550/// hyper_util::rt::TokioExecutor::new()
2551/// )
2552/// .build(
2553/// hyper_rustls::HttpsConnectorBuilder::new()
2554/// .with_native_roots()
2555/// .unwrap()
2556/// .https_or_http()
2557/// .enable_http2()
2558/// .build()
2559/// );
2560/// let mut hub = AndroidEnterprise::new(client, auth);
2561/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2562/// // like `create(...)`
2563/// // to build up your call.
2564/// let rb = hub.enrollment_tokens();
2565/// # }
2566/// ```
2567pub struct EnrollmentTokenMethods<'a, C>
2568where
2569 C: 'a,
2570{
2571 hub: &'a AndroidEnterprise<C>,
2572}
2573
2574impl<'a, C> common::MethodsBuilder for EnrollmentTokenMethods<'a, C> {}
2575
2576impl<'a, C> EnrollmentTokenMethods<'a, C> {
2577 /// Create a builder to help you perform the following task:
2578 ///
2579 /// Returns a token for device enrollment. The DPC can encode this token within the QR/NFC/zero-touch enrollment payload or fetch it before calling the on-device API to authenticate the user. The token can be generated for each device or reused across multiple devices.
2580 ///
2581 /// # Arguments
2582 ///
2583 /// * `request` - No description provided.
2584 /// * `enterpriseId` - Required. The ID of the enterprise.
2585 pub fn create(
2586 &self,
2587 request: EnrollmentToken,
2588 enterprise_id: &str,
2589 ) -> EnrollmentTokenCreateCall<'a, C> {
2590 EnrollmentTokenCreateCall {
2591 hub: self.hub,
2592 _request: request,
2593 _enterprise_id: enterprise_id.to_string(),
2594 _delegate: Default::default(),
2595 _additional_params: Default::default(),
2596 _scopes: Default::default(),
2597 }
2598 }
2599}
2600
2601/// A builder providing access to all methods supported on *enterprise* resources.
2602/// It is not used directly, but through the [`AndroidEnterprise`] hub.
2603///
2604/// # Example
2605///
2606/// Instantiate a resource builder
2607///
2608/// ```test_harness,no_run
2609/// extern crate hyper;
2610/// extern crate hyper_rustls;
2611/// extern crate google_androidenterprise1 as androidenterprise1;
2612///
2613/// # async fn dox() {
2614/// use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2615///
2616/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2617/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2618/// .with_native_roots()
2619/// .unwrap()
2620/// .https_only()
2621/// .enable_http2()
2622/// .build();
2623///
2624/// let executor = hyper_util::rt::TokioExecutor::new();
2625/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2626/// secret,
2627/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2628/// yup_oauth2::client::CustomHyperClientBuilder::from(
2629/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2630/// ),
2631/// ).build().await.unwrap();
2632///
2633/// let client = hyper_util::client::legacy::Client::builder(
2634/// hyper_util::rt::TokioExecutor::new()
2635/// )
2636/// .build(
2637/// hyper_rustls::HttpsConnectorBuilder::new()
2638/// .with_native_roots()
2639/// .unwrap()
2640/// .https_or_http()
2641/// .enable_http2()
2642/// .build()
2643/// );
2644/// let mut hub = AndroidEnterprise::new(client, auth);
2645/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2646/// // like `acknowledge_notification_set(...)`, `complete_signup(...)`, `create_web_token(...)`, `enroll(...)`, `generate_enterprise_upgrade_url(...)`, `generate_signup_url(...)`, `get(...)`, `get_service_account(...)`, `get_store_layout(...)`, `list(...)`, `pull_notification_set(...)`, `send_test_push_notification(...)`, `set_account(...)`, `set_store_layout(...)` and `unenroll(...)`
2647/// // to build up your call.
2648/// let rb = hub.enterprises();
2649/// # }
2650/// ```
2651pub struct EnterpriseMethods<'a, C>
2652where
2653 C: 'a,
2654{
2655 hub: &'a AndroidEnterprise<C>,
2656}
2657
2658impl<'a, C> common::MethodsBuilder for EnterpriseMethods<'a, C> {}
2659
2660impl<'a, C> EnterpriseMethods<'a, C> {
2661 /// Create a builder to help you perform the following task:
2662 ///
2663 /// Acknowledges notifications that were received from Enterprises.PullNotificationSet to prevent subsequent calls from returning the same notifications.
2664 pub fn acknowledge_notification_set(&self) -> EnterpriseAcknowledgeNotificationSetCall<'a, C> {
2665 EnterpriseAcknowledgeNotificationSetCall {
2666 hub: self.hub,
2667 _notification_set_id: Default::default(),
2668 _delegate: Default::default(),
2669 _additional_params: Default::default(),
2670 _scopes: Default::default(),
2671 }
2672 }
2673
2674 /// Create a builder to help you perform the following task:
2675 ///
2676 /// Completes the signup flow, by specifying the Completion token and Enterprise token. This request must not be called multiple times for a given Enterprise Token.
2677 pub fn complete_signup(&self) -> EnterpriseCompleteSignupCall<'a, C> {
2678 EnterpriseCompleteSignupCall {
2679 hub: self.hub,
2680 _enterprise_token: Default::default(),
2681 _completion_token: Default::default(),
2682 _delegate: Default::default(),
2683 _additional_params: Default::default(),
2684 _scopes: Default::default(),
2685 }
2686 }
2687
2688 /// Create a builder to help you perform the following task:
2689 ///
2690 /// Returns a unique token to access an embeddable UI. To generate a web UI, pass the generated token into the managed Google Play javascript API. Each token may only be used to start one UI session. See the JavaScript API documentation for further information.
2691 ///
2692 /// # Arguments
2693 ///
2694 /// * `request` - No description provided.
2695 /// * `enterpriseId` - The ID of the enterprise.
2696 pub fn create_web_token(
2697 &self,
2698 request: AdministratorWebTokenSpec,
2699 enterprise_id: &str,
2700 ) -> EnterpriseCreateWebTokenCall<'a, C> {
2701 EnterpriseCreateWebTokenCall {
2702 hub: self.hub,
2703 _request: request,
2704 _enterprise_id: enterprise_id.to_string(),
2705 _delegate: Default::default(),
2706 _additional_params: Default::default(),
2707 _scopes: Default::default(),
2708 }
2709 }
2710
2711 /// Create a builder to help you perform the following task:
2712 ///
2713 /// Enrolls an enterprise with the calling EMM.
2714 ///
2715 /// # Arguments
2716 ///
2717 /// * `request` - No description provided.
2718 /// * `token` - Required. The token provided by the enterprise to register the EMM.
2719 pub fn enroll(&self, request: Enterprise, token: &str) -> EnterpriseEnrollCall<'a, C> {
2720 EnterpriseEnrollCall {
2721 hub: self.hub,
2722 _request: request,
2723 _token: token.to_string(),
2724 _delegate: Default::default(),
2725 _additional_params: Default::default(),
2726 _scopes: Default::default(),
2727 }
2728 }
2729
2730 /// Create a builder to help you perform the following task:
2731 ///
2732 /// Generates an enterprise upgrade URL to upgrade an existing managed Google Play Accounts enterprise to a managed Google domain. See the guide to upgrading an enterprise for more details.
2733 ///
2734 /// # Arguments
2735 ///
2736 /// * `enterpriseId` - Required. The ID of the enterprise.
2737 pub fn generate_enterprise_upgrade_url(
2738 &self,
2739 enterprise_id: &str,
2740 ) -> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C> {
2741 EnterpriseGenerateEnterpriseUpgradeUrlCall {
2742 hub: self.hub,
2743 _enterprise_id: enterprise_id.to_string(),
2744 _allowed_domains: Default::default(),
2745 _admin_email: Default::default(),
2746 _delegate: Default::default(),
2747 _additional_params: Default::default(),
2748 _scopes: Default::default(),
2749 }
2750 }
2751
2752 /// Create a builder to help you perform the following task:
2753 ///
2754 /// Generates a sign-up URL.
2755 pub fn generate_signup_url(&self) -> EnterpriseGenerateSignupUrlCall<'a, C> {
2756 EnterpriseGenerateSignupUrlCall {
2757 hub: self.hub,
2758 _callback_url: Default::default(),
2759 _allowed_domains: Default::default(),
2760 _admin_email: Default::default(),
2761 _delegate: Default::default(),
2762 _additional_params: Default::default(),
2763 _scopes: Default::default(),
2764 }
2765 }
2766
2767 /// Create a builder to help you perform the following task:
2768 ///
2769 /// Retrieves the name and domain of an enterprise.
2770 ///
2771 /// # Arguments
2772 ///
2773 /// * `enterpriseId` - The ID of the enterprise.
2774 pub fn get(&self, enterprise_id: &str) -> EnterpriseGetCall<'a, C> {
2775 EnterpriseGetCall {
2776 hub: self.hub,
2777 _enterprise_id: enterprise_id.to_string(),
2778 _delegate: Default::default(),
2779 _additional_params: Default::default(),
2780 _scopes: Default::default(),
2781 }
2782 }
2783
2784 /// Create a builder to help you perform the following task:
2785 ///
2786 /// Returns a service account and credentials. The service account can be bound to the enterprise by calling setAccount. The service account is unique to this enterprise and EMM, and will be deleted if the enterprise is unbound. The credentials contain private key data and are not stored server-side. This method can only be called after calling Enterprises.Enroll or Enterprises.CompleteSignup, and before Enterprises.SetAccount; at other times it will return an error. Subsequent calls after the first will generate a new, unique set of credentials, and invalidate the previously generated credentials. Once the service account is bound to the enterprise, it can be managed using the serviceAccountKeys resource. *Note:* After you create a key, you might need to wait for 60 seconds or more before you perform another operation with the key. If you try to perform an operation with the key immediately after you create the key, and you receive an error, you can retry the request with exponential backoff .
2787 ///
2788 /// # Arguments
2789 ///
2790 /// * `enterpriseId` - The ID of the enterprise.
2791 pub fn get_service_account(
2792 &self,
2793 enterprise_id: &str,
2794 ) -> EnterpriseGetServiceAccountCall<'a, C> {
2795 EnterpriseGetServiceAccountCall {
2796 hub: self.hub,
2797 _enterprise_id: enterprise_id.to_string(),
2798 _key_type: Default::default(),
2799 _delegate: Default::default(),
2800 _additional_params: Default::default(),
2801 _scopes: Default::default(),
2802 }
2803 }
2804
2805 /// Create a builder to help you perform the following task:
2806 ///
2807 /// Returns the store layout for the enterprise. If the store layout has not been set, returns "basic" as the store layout type and no homepage.
2808 ///
2809 /// # Arguments
2810 ///
2811 /// * `enterpriseId` - The ID of the enterprise.
2812 pub fn get_store_layout(&self, enterprise_id: &str) -> EnterpriseGetStoreLayoutCall<'a, C> {
2813 EnterpriseGetStoreLayoutCall {
2814 hub: self.hub,
2815 _enterprise_id: enterprise_id.to_string(),
2816 _delegate: Default::default(),
2817 _additional_params: Default::default(),
2818 _scopes: Default::default(),
2819 }
2820 }
2821
2822 /// Create a builder to help you perform the following task:
2823 ///
2824 /// Looks up an enterprise by domain name. This is only supported for enterprises created via the Google-initiated creation flow. Lookup of the id is not needed for enterprises created via the EMM-initiated flow since the EMM learns the enterprise ID in the callback specified in the Enterprises.generateSignupUrl call.
2825 ///
2826 /// # Arguments
2827 ///
2828 /// * `domain` - Required. The exact primary domain name of the enterprise to look up.
2829 pub fn list(&self, domain: &str) -> EnterpriseListCall<'a, C> {
2830 EnterpriseListCall {
2831 hub: self.hub,
2832 _domain: domain.to_string(),
2833 _delegate: Default::default(),
2834 _additional_params: Default::default(),
2835 _scopes: Default::default(),
2836 }
2837 }
2838
2839 /// Create a builder to help you perform the following task:
2840 ///
2841 /// Pulls and returns a notification set for the enterprises associated with the service account authenticated for the request. The notification set may be empty if no notification are pending. A notification set returned needs to be acknowledged within 20 seconds by calling Enterprises.AcknowledgeNotificationSet, unless the notification set is empty. Notifications that are not acknowledged within the 20 seconds will eventually be included again in the response to another PullNotificationSet request, and those that are never acknowledged will ultimately be deleted according to the Google Cloud Platform Pub/Sub system policy. Multiple requests might be performed concurrently to retrieve notifications, in which case the pending notifications (if any) will be split among each caller, if any are pending. If no notifications are present, an empty notification list is returned. Subsequent requests may return more notifications once they become available.
2842 pub fn pull_notification_set(&self) -> EnterprisePullNotificationSetCall<'a, C> {
2843 EnterprisePullNotificationSetCall {
2844 hub: self.hub,
2845 _request_mode: Default::default(),
2846 _delegate: Default::default(),
2847 _additional_params: Default::default(),
2848 _scopes: Default::default(),
2849 }
2850 }
2851
2852 /// Create a builder to help you perform the following task:
2853 ///
2854 /// Sends a test notification to validate the EMM integration with the Google Cloud Pub/Sub service for this enterprise.
2855 ///
2856 /// # Arguments
2857 ///
2858 /// * `enterpriseId` - The ID of the enterprise.
2859 pub fn send_test_push_notification(
2860 &self,
2861 enterprise_id: &str,
2862 ) -> EnterpriseSendTestPushNotificationCall<'a, C> {
2863 EnterpriseSendTestPushNotificationCall {
2864 hub: self.hub,
2865 _enterprise_id: enterprise_id.to_string(),
2866 _delegate: Default::default(),
2867 _additional_params: Default::default(),
2868 _scopes: Default::default(),
2869 }
2870 }
2871
2872 /// Create a builder to help you perform the following task:
2873 ///
2874 /// Sets the account that will be used to authenticate to the API as the enterprise.
2875 ///
2876 /// # Arguments
2877 ///
2878 /// * `request` - No description provided.
2879 /// * `enterpriseId` - The ID of the enterprise.
2880 pub fn set_account(
2881 &self,
2882 request: EnterpriseAccount,
2883 enterprise_id: &str,
2884 ) -> EnterpriseSetAccountCall<'a, C> {
2885 EnterpriseSetAccountCall {
2886 hub: self.hub,
2887 _request: request,
2888 _enterprise_id: enterprise_id.to_string(),
2889 _delegate: Default::default(),
2890 _additional_params: Default::default(),
2891 _scopes: Default::default(),
2892 }
2893 }
2894
2895 /// Create a builder to help you perform the following task:
2896 ///
2897 /// Sets the store layout for the enterprise. By default, storeLayoutType is set to "basic" and the basic store layout is enabled. The basic layout only contains apps approved by the admin, and that have been added to the available product set for a user (using the setAvailableProductSet call). Apps on the page are sorted in order of their product ID value. If you create a custom store layout (by setting storeLayoutType = "custom" and setting a homepage), the basic store layout is disabled.
2898 ///
2899 /// # Arguments
2900 ///
2901 /// * `request` - No description provided.
2902 /// * `enterpriseId` - The ID of the enterprise.
2903 pub fn set_store_layout(
2904 &self,
2905 request: StoreLayout,
2906 enterprise_id: &str,
2907 ) -> EnterpriseSetStoreLayoutCall<'a, C> {
2908 EnterpriseSetStoreLayoutCall {
2909 hub: self.hub,
2910 _request: request,
2911 _enterprise_id: enterprise_id.to_string(),
2912 _delegate: Default::default(),
2913 _additional_params: Default::default(),
2914 _scopes: Default::default(),
2915 }
2916 }
2917
2918 /// Create a builder to help you perform the following task:
2919 ///
2920 /// Unenrolls an enterprise from the calling EMM.
2921 ///
2922 /// # Arguments
2923 ///
2924 /// * `enterpriseId` - The ID of the enterprise.
2925 pub fn unenroll(&self, enterprise_id: &str) -> EnterpriseUnenrollCall<'a, C> {
2926 EnterpriseUnenrollCall {
2927 hub: self.hub,
2928 _enterprise_id: enterprise_id.to_string(),
2929 _delegate: Default::default(),
2930 _additional_params: Default::default(),
2931 _scopes: Default::default(),
2932 }
2933 }
2934}
2935
2936/// A builder providing access to all methods supported on *entitlement* resources.
2937/// It is not used directly, but through the [`AndroidEnterprise`] hub.
2938///
2939/// # Example
2940///
2941/// Instantiate a resource builder
2942///
2943/// ```test_harness,no_run
2944/// extern crate hyper;
2945/// extern crate hyper_rustls;
2946/// extern crate google_androidenterprise1 as androidenterprise1;
2947///
2948/// # async fn dox() {
2949/// use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2950///
2951/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2952/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2953/// .with_native_roots()
2954/// .unwrap()
2955/// .https_only()
2956/// .enable_http2()
2957/// .build();
2958///
2959/// let executor = hyper_util::rt::TokioExecutor::new();
2960/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2961/// secret,
2962/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2963/// yup_oauth2::client::CustomHyperClientBuilder::from(
2964/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2965/// ),
2966/// ).build().await.unwrap();
2967///
2968/// let client = hyper_util::client::legacy::Client::builder(
2969/// hyper_util::rt::TokioExecutor::new()
2970/// )
2971/// .build(
2972/// hyper_rustls::HttpsConnectorBuilder::new()
2973/// .with_native_roots()
2974/// .unwrap()
2975/// .https_or_http()
2976/// .enable_http2()
2977/// .build()
2978/// );
2979/// let mut hub = AndroidEnterprise::new(client, auth);
2980/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2981/// // like `delete(...)`, `get(...)`, `list(...)` and `update(...)`
2982/// // to build up your call.
2983/// let rb = hub.entitlements();
2984/// # }
2985/// ```
2986pub struct EntitlementMethods<'a, C>
2987where
2988 C: 'a,
2989{
2990 hub: &'a AndroidEnterprise<C>,
2991}
2992
2993impl<'a, C> common::MethodsBuilder for EntitlementMethods<'a, C> {}
2994
2995impl<'a, C> EntitlementMethods<'a, C> {
2996 /// Create a builder to help you perform the following task:
2997 ///
2998 /// Removes an entitlement to an app for a user. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
2999 ///
3000 /// # Arguments
3001 ///
3002 /// * `enterpriseId` - The ID of the enterprise.
3003 /// * `userId` - The ID of the user.
3004 /// * `entitlementId` - The ID of the entitlement (a product ID), e.g. "app:com.google.android.gm".
3005 pub fn delete(
3006 &self,
3007 enterprise_id: &str,
3008 user_id: &str,
3009 entitlement_id: &str,
3010 ) -> EntitlementDeleteCall<'a, C> {
3011 EntitlementDeleteCall {
3012 hub: self.hub,
3013 _enterprise_id: enterprise_id.to_string(),
3014 _user_id: user_id.to_string(),
3015 _entitlement_id: entitlement_id.to_string(),
3016 _delegate: Default::default(),
3017 _additional_params: Default::default(),
3018 _scopes: Default::default(),
3019 }
3020 }
3021
3022 /// Create a builder to help you perform the following task:
3023 ///
3024 /// Retrieves details of an entitlement. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
3025 ///
3026 /// # Arguments
3027 ///
3028 /// * `enterpriseId` - The ID of the enterprise.
3029 /// * `userId` - The ID of the user.
3030 /// * `entitlementId` - The ID of the entitlement (a product ID), e.g. "app:com.google.android.gm".
3031 pub fn get(
3032 &self,
3033 enterprise_id: &str,
3034 user_id: &str,
3035 entitlement_id: &str,
3036 ) -> EntitlementGetCall<'a, C> {
3037 EntitlementGetCall {
3038 hub: self.hub,
3039 _enterprise_id: enterprise_id.to_string(),
3040 _user_id: user_id.to_string(),
3041 _entitlement_id: entitlement_id.to_string(),
3042 _delegate: Default::default(),
3043 _additional_params: Default::default(),
3044 _scopes: Default::default(),
3045 }
3046 }
3047
3048 /// Create a builder to help you perform the following task:
3049 ///
3050 /// Lists all entitlements for the specified user. Only the ID is set. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
3051 ///
3052 /// # Arguments
3053 ///
3054 /// * `enterpriseId` - The ID of the enterprise.
3055 /// * `userId` - The ID of the user.
3056 pub fn list(&self, enterprise_id: &str, user_id: &str) -> EntitlementListCall<'a, C> {
3057 EntitlementListCall {
3058 hub: self.hub,
3059 _enterprise_id: enterprise_id.to_string(),
3060 _user_id: user_id.to_string(),
3061 _delegate: Default::default(),
3062 _additional_params: Default::default(),
3063 _scopes: Default::default(),
3064 }
3065 }
3066
3067 /// Create a builder to help you perform the following task:
3068 ///
3069 /// Adds or updates an entitlement to an app for a user. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
3070 ///
3071 /// # Arguments
3072 ///
3073 /// * `request` - No description provided.
3074 /// * `enterpriseId` - The ID of the enterprise.
3075 /// * `userId` - The ID of the user.
3076 /// * `entitlementId` - The ID of the entitlement (a product ID), e.g. "app:com.google.android.gm".
3077 pub fn update(
3078 &self,
3079 request: Entitlement,
3080 enterprise_id: &str,
3081 user_id: &str,
3082 entitlement_id: &str,
3083 ) -> EntitlementUpdateCall<'a, C> {
3084 EntitlementUpdateCall {
3085 hub: self.hub,
3086 _request: request,
3087 _enterprise_id: enterprise_id.to_string(),
3088 _user_id: user_id.to_string(),
3089 _entitlement_id: entitlement_id.to_string(),
3090 _install: Default::default(),
3091 _delegate: Default::default(),
3092 _additional_params: Default::default(),
3093 _scopes: Default::default(),
3094 }
3095 }
3096}
3097
3098/// A builder providing access to all methods supported on *grouplicense* resources.
3099/// It is not used directly, but through the [`AndroidEnterprise`] hub.
3100///
3101/// # Example
3102///
3103/// Instantiate a resource builder
3104///
3105/// ```test_harness,no_run
3106/// extern crate hyper;
3107/// extern crate hyper_rustls;
3108/// extern crate google_androidenterprise1 as androidenterprise1;
3109///
3110/// # async fn dox() {
3111/// use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3112///
3113/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3114/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3115/// .with_native_roots()
3116/// .unwrap()
3117/// .https_only()
3118/// .enable_http2()
3119/// .build();
3120///
3121/// let executor = hyper_util::rt::TokioExecutor::new();
3122/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3123/// secret,
3124/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3125/// yup_oauth2::client::CustomHyperClientBuilder::from(
3126/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3127/// ),
3128/// ).build().await.unwrap();
3129///
3130/// let client = hyper_util::client::legacy::Client::builder(
3131/// hyper_util::rt::TokioExecutor::new()
3132/// )
3133/// .build(
3134/// hyper_rustls::HttpsConnectorBuilder::new()
3135/// .with_native_roots()
3136/// .unwrap()
3137/// .https_or_http()
3138/// .enable_http2()
3139/// .build()
3140/// );
3141/// let mut hub = AndroidEnterprise::new(client, auth);
3142/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3143/// // like `get(...)` and `list(...)`
3144/// // to build up your call.
3145/// let rb = hub.grouplicenses();
3146/// # }
3147/// ```
3148pub struct GrouplicenseMethods<'a, C>
3149where
3150 C: 'a,
3151{
3152 hub: &'a AndroidEnterprise<C>,
3153}
3154
3155impl<'a, C> common::MethodsBuilder for GrouplicenseMethods<'a, C> {}
3156
3157impl<'a, C> GrouplicenseMethods<'a, C> {
3158 /// Create a builder to help you perform the following task:
3159 ///
3160 /// Retrieves details of an enterprise's group license for a product. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
3161 ///
3162 /// # Arguments
3163 ///
3164 /// * `enterpriseId` - The ID of the enterprise.
3165 /// * `groupLicenseId` - The ID of the product the group license is for, e.g. "app:com.google.android.gm".
3166 pub fn get(&self, enterprise_id: &str, group_license_id: &str) -> GrouplicenseGetCall<'a, C> {
3167 GrouplicenseGetCall {
3168 hub: self.hub,
3169 _enterprise_id: enterprise_id.to_string(),
3170 _group_license_id: group_license_id.to_string(),
3171 _delegate: Default::default(),
3172 _additional_params: Default::default(),
3173 _scopes: Default::default(),
3174 }
3175 }
3176
3177 /// Create a builder to help you perform the following task:
3178 ///
3179 /// Retrieves IDs of all products for which the enterprise has a group license. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
3180 ///
3181 /// # Arguments
3182 ///
3183 /// * `enterpriseId` - The ID of the enterprise.
3184 pub fn list(&self, enterprise_id: &str) -> GrouplicenseListCall<'a, C> {
3185 GrouplicenseListCall {
3186 hub: self.hub,
3187 _enterprise_id: enterprise_id.to_string(),
3188 _delegate: Default::default(),
3189 _additional_params: Default::default(),
3190 _scopes: Default::default(),
3191 }
3192 }
3193}
3194
3195/// A builder providing access to all methods supported on *grouplicenseuser* resources.
3196/// It is not used directly, but through the [`AndroidEnterprise`] hub.
3197///
3198/// # Example
3199///
3200/// Instantiate a resource builder
3201///
3202/// ```test_harness,no_run
3203/// extern crate hyper;
3204/// extern crate hyper_rustls;
3205/// extern crate google_androidenterprise1 as androidenterprise1;
3206///
3207/// # async fn dox() {
3208/// use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3209///
3210/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3211/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3212/// .with_native_roots()
3213/// .unwrap()
3214/// .https_only()
3215/// .enable_http2()
3216/// .build();
3217///
3218/// let executor = hyper_util::rt::TokioExecutor::new();
3219/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3220/// secret,
3221/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3222/// yup_oauth2::client::CustomHyperClientBuilder::from(
3223/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3224/// ),
3225/// ).build().await.unwrap();
3226///
3227/// let client = hyper_util::client::legacy::Client::builder(
3228/// hyper_util::rt::TokioExecutor::new()
3229/// )
3230/// .build(
3231/// hyper_rustls::HttpsConnectorBuilder::new()
3232/// .with_native_roots()
3233/// .unwrap()
3234/// .https_or_http()
3235/// .enable_http2()
3236/// .build()
3237/// );
3238/// let mut hub = AndroidEnterprise::new(client, auth);
3239/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3240/// // like `list(...)`
3241/// // to build up your call.
3242/// let rb = hub.grouplicenseusers();
3243/// # }
3244/// ```
3245pub struct GrouplicenseuserMethods<'a, C>
3246where
3247 C: 'a,
3248{
3249 hub: &'a AndroidEnterprise<C>,
3250}
3251
3252impl<'a, C> common::MethodsBuilder for GrouplicenseuserMethods<'a, C> {}
3253
3254impl<'a, C> GrouplicenseuserMethods<'a, C> {
3255 /// Create a builder to help you perform the following task:
3256 ///
3257 /// Retrieves the IDs of the users who have been granted entitlements under the license. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
3258 ///
3259 /// # Arguments
3260 ///
3261 /// * `enterpriseId` - The ID of the enterprise.
3262 /// * `groupLicenseId` - The ID of the product the group license is for, e.g. "app:com.google.android.gm".
3263 pub fn list(
3264 &self,
3265 enterprise_id: &str,
3266 group_license_id: &str,
3267 ) -> GrouplicenseuserListCall<'a, C> {
3268 GrouplicenseuserListCall {
3269 hub: self.hub,
3270 _enterprise_id: enterprise_id.to_string(),
3271 _group_license_id: group_license_id.to_string(),
3272 _delegate: Default::default(),
3273 _additional_params: Default::default(),
3274 _scopes: Default::default(),
3275 }
3276 }
3277}
3278
3279/// A builder providing access to all methods supported on *install* resources.
3280/// It is not used directly, but through the [`AndroidEnterprise`] hub.
3281///
3282/// # Example
3283///
3284/// Instantiate a resource builder
3285///
3286/// ```test_harness,no_run
3287/// extern crate hyper;
3288/// extern crate hyper_rustls;
3289/// extern crate google_androidenterprise1 as androidenterprise1;
3290///
3291/// # async fn dox() {
3292/// use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3293///
3294/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3295/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3296/// .with_native_roots()
3297/// .unwrap()
3298/// .https_only()
3299/// .enable_http2()
3300/// .build();
3301///
3302/// let executor = hyper_util::rt::TokioExecutor::new();
3303/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3304/// secret,
3305/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3306/// yup_oauth2::client::CustomHyperClientBuilder::from(
3307/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3308/// ),
3309/// ).build().await.unwrap();
3310///
3311/// let client = hyper_util::client::legacy::Client::builder(
3312/// hyper_util::rt::TokioExecutor::new()
3313/// )
3314/// .build(
3315/// hyper_rustls::HttpsConnectorBuilder::new()
3316/// .with_native_roots()
3317/// .unwrap()
3318/// .https_or_http()
3319/// .enable_http2()
3320/// .build()
3321/// );
3322/// let mut hub = AndroidEnterprise::new(client, auth);
3323/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3324/// // like `delete(...)`, `get(...)`, `list(...)` and `update(...)`
3325/// // to build up your call.
3326/// let rb = hub.installs();
3327/// # }
3328/// ```
3329pub struct InstallMethods<'a, C>
3330where
3331 C: 'a,
3332{
3333 hub: &'a AndroidEnterprise<C>,
3334}
3335
3336impl<'a, C> common::MethodsBuilder for InstallMethods<'a, C> {}
3337
3338impl<'a, C> InstallMethods<'a, C> {
3339 /// Create a builder to help you perform the following task:
3340 ///
3341 /// Requests to remove an app from a device. A call to get or list will still show the app as installed on the device until it is actually removed. A successful response indicates that a removal request has been sent to the device. The call will be considered successful even if the app is not present on the device (e.g. it was never installed, or was removed by the user).
3342 ///
3343 /// # Arguments
3344 ///
3345 /// * `enterpriseId` - The ID of the enterprise.
3346 /// * `userId` - The ID of the user.
3347 /// * `deviceId` - The Android ID of the device.
3348 /// * `installId` - The ID of the product represented by the install, e.g. "app:com.google.android.gm".
3349 pub fn delete(
3350 &self,
3351 enterprise_id: &str,
3352 user_id: &str,
3353 device_id: &str,
3354 install_id: &str,
3355 ) -> InstallDeleteCall<'a, C> {
3356 InstallDeleteCall {
3357 hub: self.hub,
3358 _enterprise_id: enterprise_id.to_string(),
3359 _user_id: user_id.to_string(),
3360 _device_id: device_id.to_string(),
3361 _install_id: install_id.to_string(),
3362 _delegate: Default::default(),
3363 _additional_params: Default::default(),
3364 _scopes: Default::default(),
3365 }
3366 }
3367
3368 /// Create a builder to help you perform the following task:
3369 ///
3370 /// Retrieves details of an installation of an app on a device.
3371 ///
3372 /// # Arguments
3373 ///
3374 /// * `enterpriseId` - The ID of the enterprise.
3375 /// * `userId` - The ID of the user.
3376 /// * `deviceId` - The Android ID of the device.
3377 /// * `installId` - The ID of the product represented by the install, e.g. "app:com.google.android.gm".
3378 pub fn get(
3379 &self,
3380 enterprise_id: &str,
3381 user_id: &str,
3382 device_id: &str,
3383 install_id: &str,
3384 ) -> InstallGetCall<'a, C> {
3385 InstallGetCall {
3386 hub: self.hub,
3387 _enterprise_id: enterprise_id.to_string(),
3388 _user_id: user_id.to_string(),
3389 _device_id: device_id.to_string(),
3390 _install_id: install_id.to_string(),
3391 _delegate: Default::default(),
3392 _additional_params: Default::default(),
3393 _scopes: Default::default(),
3394 }
3395 }
3396
3397 /// Create a builder to help you perform the following task:
3398 ///
3399 /// Retrieves the details of all apps installed on the specified device.
3400 ///
3401 /// # Arguments
3402 ///
3403 /// * `enterpriseId` - The ID of the enterprise.
3404 /// * `userId` - The ID of the user.
3405 /// * `deviceId` - The Android ID of the device.
3406 pub fn list(
3407 &self,
3408 enterprise_id: &str,
3409 user_id: &str,
3410 device_id: &str,
3411 ) -> InstallListCall<'a, C> {
3412 InstallListCall {
3413 hub: self.hub,
3414 _enterprise_id: enterprise_id.to_string(),
3415 _user_id: user_id.to_string(),
3416 _device_id: device_id.to_string(),
3417 _delegate: Default::default(),
3418 _additional_params: Default::default(),
3419 _scopes: Default::default(),
3420 }
3421 }
3422
3423 /// Create a builder to help you perform the following task:
3424 ///
3425 /// Requests to install the latest version of an app to a device. If the app is already installed, then it is updated to the latest version if necessary.
3426 ///
3427 /// # Arguments
3428 ///
3429 /// * `request` - No description provided.
3430 /// * `enterpriseId` - The ID of the enterprise.
3431 /// * `userId` - The ID of the user.
3432 /// * `deviceId` - The Android ID of the device.
3433 /// * `installId` - The ID of the product represented by the install, e.g. "app:com.google.android.gm".
3434 pub fn update(
3435 &self,
3436 request: Install,
3437 enterprise_id: &str,
3438 user_id: &str,
3439 device_id: &str,
3440 install_id: &str,
3441 ) -> InstallUpdateCall<'a, C> {
3442 InstallUpdateCall {
3443 hub: self.hub,
3444 _request: request,
3445 _enterprise_id: enterprise_id.to_string(),
3446 _user_id: user_id.to_string(),
3447 _device_id: device_id.to_string(),
3448 _install_id: install_id.to_string(),
3449 _delegate: Default::default(),
3450 _additional_params: Default::default(),
3451 _scopes: Default::default(),
3452 }
3453 }
3454}
3455
3456/// A builder providing access to all methods supported on *managedconfigurationsfordevice* resources.
3457/// It is not used directly, but through the [`AndroidEnterprise`] hub.
3458///
3459/// # Example
3460///
3461/// Instantiate a resource builder
3462///
3463/// ```test_harness,no_run
3464/// extern crate hyper;
3465/// extern crate hyper_rustls;
3466/// extern crate google_androidenterprise1 as androidenterprise1;
3467///
3468/// # async fn dox() {
3469/// use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3470///
3471/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3472/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3473/// .with_native_roots()
3474/// .unwrap()
3475/// .https_only()
3476/// .enable_http2()
3477/// .build();
3478///
3479/// let executor = hyper_util::rt::TokioExecutor::new();
3480/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3481/// secret,
3482/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3483/// yup_oauth2::client::CustomHyperClientBuilder::from(
3484/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3485/// ),
3486/// ).build().await.unwrap();
3487///
3488/// let client = hyper_util::client::legacy::Client::builder(
3489/// hyper_util::rt::TokioExecutor::new()
3490/// )
3491/// .build(
3492/// hyper_rustls::HttpsConnectorBuilder::new()
3493/// .with_native_roots()
3494/// .unwrap()
3495/// .https_or_http()
3496/// .enable_http2()
3497/// .build()
3498/// );
3499/// let mut hub = AndroidEnterprise::new(client, auth);
3500/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3501/// // like `delete(...)`, `get(...)`, `list(...)` and `update(...)`
3502/// // to build up your call.
3503/// let rb = hub.managedconfigurationsfordevice();
3504/// # }
3505/// ```
3506pub struct ManagedconfigurationsfordeviceMethods<'a, C>
3507where
3508 C: 'a,
3509{
3510 hub: &'a AndroidEnterprise<C>,
3511}
3512
3513impl<'a, C> common::MethodsBuilder for ManagedconfigurationsfordeviceMethods<'a, C> {}
3514
3515impl<'a, C> ManagedconfigurationsfordeviceMethods<'a, C> {
3516 /// Create a builder to help you perform the following task:
3517 ///
3518 /// Removes a per-device managed configuration for an app for the specified device.
3519 ///
3520 /// # Arguments
3521 ///
3522 /// * `enterpriseId` - The ID of the enterprise.
3523 /// * `userId` - The ID of the user.
3524 /// * `deviceId` - The Android ID of the device.
3525 /// * `managedConfigurationForDeviceId` - The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
3526 pub fn delete(
3527 &self,
3528 enterprise_id: &str,
3529 user_id: &str,
3530 device_id: &str,
3531 managed_configuration_for_device_id: &str,
3532 ) -> ManagedconfigurationsfordeviceDeleteCall<'a, C> {
3533 ManagedconfigurationsfordeviceDeleteCall {
3534 hub: self.hub,
3535 _enterprise_id: enterprise_id.to_string(),
3536 _user_id: user_id.to_string(),
3537 _device_id: device_id.to_string(),
3538 _managed_configuration_for_device_id: managed_configuration_for_device_id.to_string(),
3539 _delegate: Default::default(),
3540 _additional_params: Default::default(),
3541 _scopes: Default::default(),
3542 }
3543 }
3544
3545 /// Create a builder to help you perform the following task:
3546 ///
3547 /// Retrieves details of a per-device managed configuration.
3548 ///
3549 /// # Arguments
3550 ///
3551 /// * `enterpriseId` - The ID of the enterprise.
3552 /// * `userId` - The ID of the user.
3553 /// * `deviceId` - The Android ID of the device.
3554 /// * `managedConfigurationForDeviceId` - The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
3555 pub fn get(
3556 &self,
3557 enterprise_id: &str,
3558 user_id: &str,
3559 device_id: &str,
3560 managed_configuration_for_device_id: &str,
3561 ) -> ManagedconfigurationsfordeviceGetCall<'a, C> {
3562 ManagedconfigurationsfordeviceGetCall {
3563 hub: self.hub,
3564 _enterprise_id: enterprise_id.to_string(),
3565 _user_id: user_id.to_string(),
3566 _device_id: device_id.to_string(),
3567 _managed_configuration_for_device_id: managed_configuration_for_device_id.to_string(),
3568 _delegate: Default::default(),
3569 _additional_params: Default::default(),
3570 _scopes: Default::default(),
3571 }
3572 }
3573
3574 /// Create a builder to help you perform the following task:
3575 ///
3576 /// Lists all the per-device managed configurations for the specified device. Only the ID is set.
3577 ///
3578 /// # Arguments
3579 ///
3580 /// * `enterpriseId` - The ID of the enterprise.
3581 /// * `userId` - The ID of the user.
3582 /// * `deviceId` - The Android ID of the device.
3583 pub fn list(
3584 &self,
3585 enterprise_id: &str,
3586 user_id: &str,
3587 device_id: &str,
3588 ) -> ManagedconfigurationsfordeviceListCall<'a, C> {
3589 ManagedconfigurationsfordeviceListCall {
3590 hub: self.hub,
3591 _enterprise_id: enterprise_id.to_string(),
3592 _user_id: user_id.to_string(),
3593 _device_id: device_id.to_string(),
3594 _delegate: Default::default(),
3595 _additional_params: Default::default(),
3596 _scopes: Default::default(),
3597 }
3598 }
3599
3600 /// Create a builder to help you perform the following task:
3601 ///
3602 /// Adds or updates a per-device managed configuration for an app for the specified device.
3603 ///
3604 /// # Arguments
3605 ///
3606 /// * `request` - No description provided.
3607 /// * `enterpriseId` - The ID of the enterprise.
3608 /// * `userId` - The ID of the user.
3609 /// * `deviceId` - The Android ID of the device.
3610 /// * `managedConfigurationForDeviceId` - The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
3611 pub fn update(
3612 &self,
3613 request: ManagedConfiguration,
3614 enterprise_id: &str,
3615 user_id: &str,
3616 device_id: &str,
3617 managed_configuration_for_device_id: &str,
3618 ) -> ManagedconfigurationsfordeviceUpdateCall<'a, C> {
3619 ManagedconfigurationsfordeviceUpdateCall {
3620 hub: self.hub,
3621 _request: request,
3622 _enterprise_id: enterprise_id.to_string(),
3623 _user_id: user_id.to_string(),
3624 _device_id: device_id.to_string(),
3625 _managed_configuration_for_device_id: managed_configuration_for_device_id.to_string(),
3626 _delegate: Default::default(),
3627 _additional_params: Default::default(),
3628 _scopes: Default::default(),
3629 }
3630 }
3631}
3632
3633/// A builder providing access to all methods supported on *managedconfigurationsforuser* resources.
3634/// It is not used directly, but through the [`AndroidEnterprise`] hub.
3635///
3636/// # Example
3637///
3638/// Instantiate a resource builder
3639///
3640/// ```test_harness,no_run
3641/// extern crate hyper;
3642/// extern crate hyper_rustls;
3643/// extern crate google_androidenterprise1 as androidenterprise1;
3644///
3645/// # async fn dox() {
3646/// use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3647///
3648/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3649/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3650/// .with_native_roots()
3651/// .unwrap()
3652/// .https_only()
3653/// .enable_http2()
3654/// .build();
3655///
3656/// let executor = hyper_util::rt::TokioExecutor::new();
3657/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3658/// secret,
3659/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3660/// yup_oauth2::client::CustomHyperClientBuilder::from(
3661/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3662/// ),
3663/// ).build().await.unwrap();
3664///
3665/// let client = hyper_util::client::legacy::Client::builder(
3666/// hyper_util::rt::TokioExecutor::new()
3667/// )
3668/// .build(
3669/// hyper_rustls::HttpsConnectorBuilder::new()
3670/// .with_native_roots()
3671/// .unwrap()
3672/// .https_or_http()
3673/// .enable_http2()
3674/// .build()
3675/// );
3676/// let mut hub = AndroidEnterprise::new(client, auth);
3677/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3678/// // like `delete(...)`, `get(...)`, `list(...)` and `update(...)`
3679/// // to build up your call.
3680/// let rb = hub.managedconfigurationsforuser();
3681/// # }
3682/// ```
3683pub struct ManagedconfigurationsforuserMethods<'a, C>
3684where
3685 C: 'a,
3686{
3687 hub: &'a AndroidEnterprise<C>,
3688}
3689
3690impl<'a, C> common::MethodsBuilder for ManagedconfigurationsforuserMethods<'a, C> {}
3691
3692impl<'a, C> ManagedconfigurationsforuserMethods<'a, C> {
3693 /// Create a builder to help you perform the following task:
3694 ///
3695 /// Removes a per-user managed configuration for an app for the specified user.
3696 ///
3697 /// # Arguments
3698 ///
3699 /// * `enterpriseId` - The ID of the enterprise.
3700 /// * `userId` - The ID of the user.
3701 /// * `managedConfigurationForUserId` - The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
3702 pub fn delete(
3703 &self,
3704 enterprise_id: &str,
3705 user_id: &str,
3706 managed_configuration_for_user_id: &str,
3707 ) -> ManagedconfigurationsforuserDeleteCall<'a, C> {
3708 ManagedconfigurationsforuserDeleteCall {
3709 hub: self.hub,
3710 _enterprise_id: enterprise_id.to_string(),
3711 _user_id: user_id.to_string(),
3712 _managed_configuration_for_user_id: managed_configuration_for_user_id.to_string(),
3713 _delegate: Default::default(),
3714 _additional_params: Default::default(),
3715 _scopes: Default::default(),
3716 }
3717 }
3718
3719 /// Create a builder to help you perform the following task:
3720 ///
3721 /// Retrieves details of a per-user managed configuration for an app for the specified user.
3722 ///
3723 /// # Arguments
3724 ///
3725 /// * `enterpriseId` - The ID of the enterprise.
3726 /// * `userId` - The ID of the user.
3727 /// * `managedConfigurationForUserId` - The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
3728 pub fn get(
3729 &self,
3730 enterprise_id: &str,
3731 user_id: &str,
3732 managed_configuration_for_user_id: &str,
3733 ) -> ManagedconfigurationsforuserGetCall<'a, C> {
3734 ManagedconfigurationsforuserGetCall {
3735 hub: self.hub,
3736 _enterprise_id: enterprise_id.to_string(),
3737 _user_id: user_id.to_string(),
3738 _managed_configuration_for_user_id: managed_configuration_for_user_id.to_string(),
3739 _delegate: Default::default(),
3740 _additional_params: Default::default(),
3741 _scopes: Default::default(),
3742 }
3743 }
3744
3745 /// Create a builder to help you perform the following task:
3746 ///
3747 /// Lists all the per-user managed configurations for the specified user. Only the ID is set.
3748 ///
3749 /// # Arguments
3750 ///
3751 /// * `enterpriseId` - The ID of the enterprise.
3752 /// * `userId` - The ID of the user.
3753 pub fn list(
3754 &self,
3755 enterprise_id: &str,
3756 user_id: &str,
3757 ) -> ManagedconfigurationsforuserListCall<'a, C> {
3758 ManagedconfigurationsforuserListCall {
3759 hub: self.hub,
3760 _enterprise_id: enterprise_id.to_string(),
3761 _user_id: user_id.to_string(),
3762 _delegate: Default::default(),
3763 _additional_params: Default::default(),
3764 _scopes: Default::default(),
3765 }
3766 }
3767
3768 /// Create a builder to help you perform the following task:
3769 ///
3770 /// Adds or updates the managed configuration settings for an app for the specified user. If you support the Managed configurations iframe, you can apply managed configurations to a user by specifying an mcmId and its associated configuration variables (if any) in the request. Alternatively, all EMMs can apply managed configurations by passing a list of managed properties.
3771 ///
3772 /// # Arguments
3773 ///
3774 /// * `request` - No description provided.
3775 /// * `enterpriseId` - The ID of the enterprise.
3776 /// * `userId` - The ID of the user.
3777 /// * `managedConfigurationForUserId` - The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
3778 pub fn update(
3779 &self,
3780 request: ManagedConfiguration,
3781 enterprise_id: &str,
3782 user_id: &str,
3783 managed_configuration_for_user_id: &str,
3784 ) -> ManagedconfigurationsforuserUpdateCall<'a, C> {
3785 ManagedconfigurationsforuserUpdateCall {
3786 hub: self.hub,
3787 _request: request,
3788 _enterprise_id: enterprise_id.to_string(),
3789 _user_id: user_id.to_string(),
3790 _managed_configuration_for_user_id: managed_configuration_for_user_id.to_string(),
3791 _delegate: Default::default(),
3792 _additional_params: Default::default(),
3793 _scopes: Default::default(),
3794 }
3795 }
3796}
3797
3798/// A builder providing access to all methods supported on *managedconfigurationssetting* resources.
3799/// It is not used directly, but through the [`AndroidEnterprise`] hub.
3800///
3801/// # Example
3802///
3803/// Instantiate a resource builder
3804///
3805/// ```test_harness,no_run
3806/// extern crate hyper;
3807/// extern crate hyper_rustls;
3808/// extern crate google_androidenterprise1 as androidenterprise1;
3809///
3810/// # async fn dox() {
3811/// use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3812///
3813/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3814/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3815/// .with_native_roots()
3816/// .unwrap()
3817/// .https_only()
3818/// .enable_http2()
3819/// .build();
3820///
3821/// let executor = hyper_util::rt::TokioExecutor::new();
3822/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3823/// secret,
3824/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3825/// yup_oauth2::client::CustomHyperClientBuilder::from(
3826/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3827/// ),
3828/// ).build().await.unwrap();
3829///
3830/// let client = hyper_util::client::legacy::Client::builder(
3831/// hyper_util::rt::TokioExecutor::new()
3832/// )
3833/// .build(
3834/// hyper_rustls::HttpsConnectorBuilder::new()
3835/// .with_native_roots()
3836/// .unwrap()
3837/// .https_or_http()
3838/// .enable_http2()
3839/// .build()
3840/// );
3841/// let mut hub = AndroidEnterprise::new(client, auth);
3842/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3843/// // like `list(...)`
3844/// // to build up your call.
3845/// let rb = hub.managedconfigurationssettings();
3846/// # }
3847/// ```
3848pub struct ManagedconfigurationssettingMethods<'a, C>
3849where
3850 C: 'a,
3851{
3852 hub: &'a AndroidEnterprise<C>,
3853}
3854
3855impl<'a, C> common::MethodsBuilder for ManagedconfigurationssettingMethods<'a, C> {}
3856
3857impl<'a, C> ManagedconfigurationssettingMethods<'a, C> {
3858 /// Create a builder to help you perform the following task:
3859 ///
3860 /// Lists all the managed configurations settings for the specified app.
3861 ///
3862 /// # Arguments
3863 ///
3864 /// * `enterpriseId` - The ID of the enterprise.
3865 /// * `productId` - The ID of the product for which the managed configurations settings applies to.
3866 pub fn list(
3867 &self,
3868 enterprise_id: &str,
3869 product_id: &str,
3870 ) -> ManagedconfigurationssettingListCall<'a, C> {
3871 ManagedconfigurationssettingListCall {
3872 hub: self.hub,
3873 _enterprise_id: enterprise_id.to_string(),
3874 _product_id: product_id.to_string(),
3875 _delegate: Default::default(),
3876 _additional_params: Default::default(),
3877 _scopes: Default::default(),
3878 }
3879 }
3880}
3881
3882/// A builder providing access to all methods supported on *permission* resources.
3883/// It is not used directly, but through the [`AndroidEnterprise`] hub.
3884///
3885/// # Example
3886///
3887/// Instantiate a resource builder
3888///
3889/// ```test_harness,no_run
3890/// extern crate hyper;
3891/// extern crate hyper_rustls;
3892/// extern crate google_androidenterprise1 as androidenterprise1;
3893///
3894/// # async fn dox() {
3895/// use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3896///
3897/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3898/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3899/// .with_native_roots()
3900/// .unwrap()
3901/// .https_only()
3902/// .enable_http2()
3903/// .build();
3904///
3905/// let executor = hyper_util::rt::TokioExecutor::new();
3906/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3907/// secret,
3908/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3909/// yup_oauth2::client::CustomHyperClientBuilder::from(
3910/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3911/// ),
3912/// ).build().await.unwrap();
3913///
3914/// let client = hyper_util::client::legacy::Client::builder(
3915/// hyper_util::rt::TokioExecutor::new()
3916/// )
3917/// .build(
3918/// hyper_rustls::HttpsConnectorBuilder::new()
3919/// .with_native_roots()
3920/// .unwrap()
3921/// .https_or_http()
3922/// .enable_http2()
3923/// .build()
3924/// );
3925/// let mut hub = AndroidEnterprise::new(client, auth);
3926/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3927/// // like `get(...)`
3928/// // to build up your call.
3929/// let rb = hub.permissions();
3930/// # }
3931/// ```
3932pub struct PermissionMethods<'a, C>
3933where
3934 C: 'a,
3935{
3936 hub: &'a AndroidEnterprise<C>,
3937}
3938
3939impl<'a, C> common::MethodsBuilder for PermissionMethods<'a, C> {}
3940
3941impl<'a, C> PermissionMethods<'a, C> {
3942 /// Create a builder to help you perform the following task:
3943 ///
3944 /// Retrieves details of an Android app permission for display to an enterprise admin.
3945 ///
3946 /// # Arguments
3947 ///
3948 /// * `permissionId` - The ID of the permission.
3949 pub fn get(&self, permission_id: &str) -> PermissionGetCall<'a, C> {
3950 PermissionGetCall {
3951 hub: self.hub,
3952 _permission_id: permission_id.to_string(),
3953 _language: Default::default(),
3954 _delegate: Default::default(),
3955 _additional_params: Default::default(),
3956 _scopes: Default::default(),
3957 }
3958 }
3959}
3960
3961/// A builder providing access to all methods supported on *product* resources.
3962/// It is not used directly, but through the [`AndroidEnterprise`] hub.
3963///
3964/// # Example
3965///
3966/// Instantiate a resource builder
3967///
3968/// ```test_harness,no_run
3969/// extern crate hyper;
3970/// extern crate hyper_rustls;
3971/// extern crate google_androidenterprise1 as androidenterprise1;
3972///
3973/// # async fn dox() {
3974/// use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3975///
3976/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3977/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3978/// .with_native_roots()
3979/// .unwrap()
3980/// .https_only()
3981/// .enable_http2()
3982/// .build();
3983///
3984/// let executor = hyper_util::rt::TokioExecutor::new();
3985/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3986/// secret,
3987/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3988/// yup_oauth2::client::CustomHyperClientBuilder::from(
3989/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3990/// ),
3991/// ).build().await.unwrap();
3992///
3993/// let client = hyper_util::client::legacy::Client::builder(
3994/// hyper_util::rt::TokioExecutor::new()
3995/// )
3996/// .build(
3997/// hyper_rustls::HttpsConnectorBuilder::new()
3998/// .with_native_roots()
3999/// .unwrap()
4000/// .https_or_http()
4001/// .enable_http2()
4002/// .build()
4003/// );
4004/// let mut hub = AndroidEnterprise::new(client, auth);
4005/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
4006/// // like `approve(...)`, `generate_approval_url(...)`, `get(...)`, `get_app_restrictions_schema(...)`, `get_permissions(...)`, `list(...)` and `unapprove(...)`
4007/// // to build up your call.
4008/// let rb = hub.products();
4009/// # }
4010/// ```
4011pub struct ProductMethods<'a, C>
4012where
4013 C: 'a,
4014{
4015 hub: &'a AndroidEnterprise<C>,
4016}
4017
4018impl<'a, C> common::MethodsBuilder for ProductMethods<'a, C> {}
4019
4020impl<'a, C> ProductMethods<'a, C> {
4021 /// Create a builder to help you perform the following task:
4022 ///
4023 /// Approves the specified product and the relevant app permissions, if any. The maximum number of products that you can approve per enterprise customer is 1,000. To learn how to use managed Google Play to design and create a store layout to display approved products to your users, see Store Layout Design. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
4024 ///
4025 /// # Arguments
4026 ///
4027 /// * `request` - No description provided.
4028 /// * `enterpriseId` - The ID of the enterprise.
4029 /// * `productId` - The ID of the product.
4030 pub fn approve(
4031 &self,
4032 request: ProductsApproveRequest,
4033 enterprise_id: &str,
4034 product_id: &str,
4035 ) -> ProductApproveCall<'a, C> {
4036 ProductApproveCall {
4037 hub: self.hub,
4038 _request: request,
4039 _enterprise_id: enterprise_id.to_string(),
4040 _product_id: product_id.to_string(),
4041 _delegate: Default::default(),
4042 _additional_params: Default::default(),
4043 _scopes: Default::default(),
4044 }
4045 }
4046
4047 /// Create a builder to help you perform the following task:
4048 ///
4049 /// Generates a URL that can be rendered in an iframe to display the permissions (if any) of a product. An enterprise admin must view these permissions and accept them on behalf of their organization in order to approve that product. Admins should accept the displayed permissions by interacting with a separate UI element in the EMM console, which in turn should trigger the use of this URL as the approvalUrlInfo.approvalUrl property in a Products.approve call to approve the product. This URL can only be used to display permissions for up to 1 day. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
4050 ///
4051 /// # Arguments
4052 ///
4053 /// * `enterpriseId` - The ID of the enterprise.
4054 /// * `productId` - The ID of the product.
4055 pub fn generate_approval_url(
4056 &self,
4057 enterprise_id: &str,
4058 product_id: &str,
4059 ) -> ProductGenerateApprovalUrlCall<'a, C> {
4060 ProductGenerateApprovalUrlCall {
4061 hub: self.hub,
4062 _enterprise_id: enterprise_id.to_string(),
4063 _product_id: product_id.to_string(),
4064 _language_code: Default::default(),
4065 _delegate: Default::default(),
4066 _additional_params: Default::default(),
4067 _scopes: Default::default(),
4068 }
4069 }
4070
4071 /// Create a builder to help you perform the following task:
4072 ///
4073 /// Retrieves details of a product for display to an enterprise admin.
4074 ///
4075 /// # Arguments
4076 ///
4077 /// * `enterpriseId` - The ID of the enterprise.
4078 /// * `productId` - The ID of the product, e.g. "app:com.google.android.gm".
4079 pub fn get(&self, enterprise_id: &str, product_id: &str) -> ProductGetCall<'a, C> {
4080 ProductGetCall {
4081 hub: self.hub,
4082 _enterprise_id: enterprise_id.to_string(),
4083 _product_id: product_id.to_string(),
4084 _language: Default::default(),
4085 _delegate: Default::default(),
4086 _additional_params: Default::default(),
4087 _scopes: Default::default(),
4088 }
4089 }
4090
4091 /// Create a builder to help you perform the following task:
4092 ///
4093 /// Retrieves the schema that defines the configurable properties for this product. All products have a schema, but this schema may be empty if no managed configurations have been defined. This schema can be used to populate a UI that allows an admin to configure the product. To apply a managed configuration based on the schema obtained using this API, see Managed Configurations through Play.
4094 ///
4095 /// # Arguments
4096 ///
4097 /// * `enterpriseId` - The ID of the enterprise.
4098 /// * `productId` - The ID of the product.
4099 pub fn get_app_restrictions_schema(
4100 &self,
4101 enterprise_id: &str,
4102 product_id: &str,
4103 ) -> ProductGetAppRestrictionsSchemaCall<'a, C> {
4104 ProductGetAppRestrictionsSchemaCall {
4105 hub: self.hub,
4106 _enterprise_id: enterprise_id.to_string(),
4107 _product_id: product_id.to_string(),
4108 _language: Default::default(),
4109 _delegate: Default::default(),
4110 _additional_params: Default::default(),
4111 _scopes: Default::default(),
4112 }
4113 }
4114
4115 /// Create a builder to help you perform the following task:
4116 ///
4117 /// Retrieves the Android app permissions required by this app.
4118 ///
4119 /// # Arguments
4120 ///
4121 /// * `enterpriseId` - The ID of the enterprise.
4122 /// * `productId` - The ID of the product.
4123 pub fn get_permissions(
4124 &self,
4125 enterprise_id: &str,
4126 product_id: &str,
4127 ) -> ProductGetPermissionCall<'a, C> {
4128 ProductGetPermissionCall {
4129 hub: self.hub,
4130 _enterprise_id: enterprise_id.to_string(),
4131 _product_id: product_id.to_string(),
4132 _delegate: Default::default(),
4133 _additional_params: Default::default(),
4134 _scopes: Default::default(),
4135 }
4136 }
4137
4138 /// Create a builder to help you perform the following task:
4139 ///
4140 /// Finds approved products that match a query, or all approved products if there is no query. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
4141 ///
4142 /// # Arguments
4143 ///
4144 /// * `enterpriseId` - The ID of the enterprise.
4145 pub fn list(&self, enterprise_id: &str) -> ProductListCall<'a, C> {
4146 ProductListCall {
4147 hub: self.hub,
4148 _enterprise_id: enterprise_id.to_string(),
4149 _token: Default::default(),
4150 _query: Default::default(),
4151 _max_results: Default::default(),
4152 _language: Default::default(),
4153 _approved: Default::default(),
4154 _delegate: Default::default(),
4155 _additional_params: Default::default(),
4156 _scopes: Default::default(),
4157 }
4158 }
4159
4160 /// Create a builder to help you perform the following task:
4161 ///
4162 /// Unapproves the specified product (and the relevant app permissions, if any) **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
4163 ///
4164 /// # Arguments
4165 ///
4166 /// * `enterpriseId` - The ID of the enterprise.
4167 /// * `productId` - The ID of the product.
4168 pub fn unapprove(&self, enterprise_id: &str, product_id: &str) -> ProductUnapproveCall<'a, C> {
4169 ProductUnapproveCall {
4170 hub: self.hub,
4171 _enterprise_id: enterprise_id.to_string(),
4172 _product_id: product_id.to_string(),
4173 _delegate: Default::default(),
4174 _additional_params: Default::default(),
4175 _scopes: Default::default(),
4176 }
4177 }
4178}
4179
4180/// A builder providing access to all methods supported on *serviceaccountkey* resources.
4181/// It is not used directly, but through the [`AndroidEnterprise`] hub.
4182///
4183/// # Example
4184///
4185/// Instantiate a resource builder
4186///
4187/// ```test_harness,no_run
4188/// extern crate hyper;
4189/// extern crate hyper_rustls;
4190/// extern crate google_androidenterprise1 as androidenterprise1;
4191///
4192/// # async fn dox() {
4193/// use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4194///
4195/// let secret: yup_oauth2::ApplicationSecret = Default::default();
4196/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
4197/// .with_native_roots()
4198/// .unwrap()
4199/// .https_only()
4200/// .enable_http2()
4201/// .build();
4202///
4203/// let executor = hyper_util::rt::TokioExecutor::new();
4204/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4205/// secret,
4206/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4207/// yup_oauth2::client::CustomHyperClientBuilder::from(
4208/// hyper_util::client::legacy::Client::builder(executor).build(connector),
4209/// ),
4210/// ).build().await.unwrap();
4211///
4212/// let client = hyper_util::client::legacy::Client::builder(
4213/// hyper_util::rt::TokioExecutor::new()
4214/// )
4215/// .build(
4216/// hyper_rustls::HttpsConnectorBuilder::new()
4217/// .with_native_roots()
4218/// .unwrap()
4219/// .https_or_http()
4220/// .enable_http2()
4221/// .build()
4222/// );
4223/// let mut hub = AndroidEnterprise::new(client, auth);
4224/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
4225/// // like `delete(...)`, `insert(...)` and `list(...)`
4226/// // to build up your call.
4227/// let rb = hub.serviceaccountkeys();
4228/// # }
4229/// ```
4230pub struct ServiceaccountkeyMethods<'a, C>
4231where
4232 C: 'a,
4233{
4234 hub: &'a AndroidEnterprise<C>,
4235}
4236
4237impl<'a, C> common::MethodsBuilder for ServiceaccountkeyMethods<'a, C> {}
4238
4239impl<'a, C> ServiceaccountkeyMethods<'a, C> {
4240 /// Create a builder to help you perform the following task:
4241 ///
4242 /// Removes and invalidates the specified credentials for the service account associated with this enterprise. The calling service account must have been retrieved by calling Enterprises.GetServiceAccount and must have been set as the enterprise service account by calling Enterprises.SetAccount.
4243 ///
4244 /// # Arguments
4245 ///
4246 /// * `enterpriseId` - The ID of the enterprise.
4247 /// * `keyId` - The ID of the key.
4248 pub fn delete(&self, enterprise_id: &str, key_id: &str) -> ServiceaccountkeyDeleteCall<'a, C> {
4249 ServiceaccountkeyDeleteCall {
4250 hub: self.hub,
4251 _enterprise_id: enterprise_id.to_string(),
4252 _key_id: key_id.to_string(),
4253 _delegate: Default::default(),
4254 _additional_params: Default::default(),
4255 _scopes: Default::default(),
4256 }
4257 }
4258
4259 /// Create a builder to help you perform the following task:
4260 ///
4261 /// Generates new credentials for the service account associated with this enterprise. The calling service account must have been retrieved by calling Enterprises.GetServiceAccount and must have been set as the enterprise service account by calling Enterprises.SetAccount. Only the type of the key should be populated in the resource to be inserted.
4262 ///
4263 /// # Arguments
4264 ///
4265 /// * `request` - No description provided.
4266 /// * `enterpriseId` - The ID of the enterprise.
4267 pub fn insert(
4268 &self,
4269 request: ServiceAccountKey,
4270 enterprise_id: &str,
4271 ) -> ServiceaccountkeyInsertCall<'a, C> {
4272 ServiceaccountkeyInsertCall {
4273 hub: self.hub,
4274 _request: request,
4275 _enterprise_id: enterprise_id.to_string(),
4276 _delegate: Default::default(),
4277 _additional_params: Default::default(),
4278 _scopes: Default::default(),
4279 }
4280 }
4281
4282 /// Create a builder to help you perform the following task:
4283 ///
4284 /// Lists all active credentials for the service account associated with this enterprise. Only the ID and key type are returned. The calling service account must have been retrieved by calling Enterprises.GetServiceAccount and must have been set as the enterprise service account by calling Enterprises.SetAccount.
4285 ///
4286 /// # Arguments
4287 ///
4288 /// * `enterpriseId` - The ID of the enterprise.
4289 pub fn list(&self, enterprise_id: &str) -> ServiceaccountkeyListCall<'a, C> {
4290 ServiceaccountkeyListCall {
4291 hub: self.hub,
4292 _enterprise_id: enterprise_id.to_string(),
4293 _delegate: Default::default(),
4294 _additional_params: Default::default(),
4295 _scopes: Default::default(),
4296 }
4297 }
4298}
4299
4300/// A builder providing access to all methods supported on *storelayoutcluster* resources.
4301/// It is not used directly, but through the [`AndroidEnterprise`] hub.
4302///
4303/// # Example
4304///
4305/// Instantiate a resource builder
4306///
4307/// ```test_harness,no_run
4308/// extern crate hyper;
4309/// extern crate hyper_rustls;
4310/// extern crate google_androidenterprise1 as androidenterprise1;
4311///
4312/// # async fn dox() {
4313/// use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4314///
4315/// let secret: yup_oauth2::ApplicationSecret = Default::default();
4316/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
4317/// .with_native_roots()
4318/// .unwrap()
4319/// .https_only()
4320/// .enable_http2()
4321/// .build();
4322///
4323/// let executor = hyper_util::rt::TokioExecutor::new();
4324/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4325/// secret,
4326/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4327/// yup_oauth2::client::CustomHyperClientBuilder::from(
4328/// hyper_util::client::legacy::Client::builder(executor).build(connector),
4329/// ),
4330/// ).build().await.unwrap();
4331///
4332/// let client = hyper_util::client::legacy::Client::builder(
4333/// hyper_util::rt::TokioExecutor::new()
4334/// )
4335/// .build(
4336/// hyper_rustls::HttpsConnectorBuilder::new()
4337/// .with_native_roots()
4338/// .unwrap()
4339/// .https_or_http()
4340/// .enable_http2()
4341/// .build()
4342/// );
4343/// let mut hub = AndroidEnterprise::new(client, auth);
4344/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
4345/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)` and `update(...)`
4346/// // to build up your call.
4347/// let rb = hub.storelayoutclusters();
4348/// # }
4349/// ```
4350pub struct StorelayoutclusterMethods<'a, C>
4351where
4352 C: 'a,
4353{
4354 hub: &'a AndroidEnterprise<C>,
4355}
4356
4357impl<'a, C> common::MethodsBuilder for StorelayoutclusterMethods<'a, C> {}
4358
4359impl<'a, C> StorelayoutclusterMethods<'a, C> {
4360 /// Create a builder to help you perform the following task:
4361 ///
4362 /// Deletes a cluster.
4363 ///
4364 /// # Arguments
4365 ///
4366 /// * `enterpriseId` - The ID of the enterprise.
4367 /// * `pageId` - The ID of the page.
4368 /// * `clusterId` - The ID of the cluster.
4369 pub fn delete(
4370 &self,
4371 enterprise_id: &str,
4372 page_id: &str,
4373 cluster_id: &str,
4374 ) -> StorelayoutclusterDeleteCall<'a, C> {
4375 StorelayoutclusterDeleteCall {
4376 hub: self.hub,
4377 _enterprise_id: enterprise_id.to_string(),
4378 _page_id: page_id.to_string(),
4379 _cluster_id: cluster_id.to_string(),
4380 _delegate: Default::default(),
4381 _additional_params: Default::default(),
4382 _scopes: Default::default(),
4383 }
4384 }
4385
4386 /// Create a builder to help you perform the following task:
4387 ///
4388 /// Retrieves details of a cluster.
4389 ///
4390 /// # Arguments
4391 ///
4392 /// * `enterpriseId` - The ID of the enterprise.
4393 /// * `pageId` - The ID of the page.
4394 /// * `clusterId` - The ID of the cluster.
4395 pub fn get(
4396 &self,
4397 enterprise_id: &str,
4398 page_id: &str,
4399 cluster_id: &str,
4400 ) -> StorelayoutclusterGetCall<'a, C> {
4401 StorelayoutclusterGetCall {
4402 hub: self.hub,
4403 _enterprise_id: enterprise_id.to_string(),
4404 _page_id: page_id.to_string(),
4405 _cluster_id: cluster_id.to_string(),
4406 _delegate: Default::default(),
4407 _additional_params: Default::default(),
4408 _scopes: Default::default(),
4409 }
4410 }
4411
4412 /// Create a builder to help you perform the following task:
4413 ///
4414 /// Inserts a new cluster in a page.
4415 ///
4416 /// # Arguments
4417 ///
4418 /// * `request` - No description provided.
4419 /// * `enterpriseId` - The ID of the enterprise.
4420 /// * `pageId` - The ID of the page.
4421 pub fn insert(
4422 &self,
4423 request: StoreCluster,
4424 enterprise_id: &str,
4425 page_id: &str,
4426 ) -> StorelayoutclusterInsertCall<'a, C> {
4427 StorelayoutclusterInsertCall {
4428 hub: self.hub,
4429 _request: request,
4430 _enterprise_id: enterprise_id.to_string(),
4431 _page_id: page_id.to_string(),
4432 _delegate: Default::default(),
4433 _additional_params: Default::default(),
4434 _scopes: Default::default(),
4435 }
4436 }
4437
4438 /// Create a builder to help you perform the following task:
4439 ///
4440 /// Retrieves the details of all clusters on the specified page.
4441 ///
4442 /// # Arguments
4443 ///
4444 /// * `enterpriseId` - The ID of the enterprise.
4445 /// * `pageId` - The ID of the page.
4446 pub fn list(&self, enterprise_id: &str, page_id: &str) -> StorelayoutclusterListCall<'a, C> {
4447 StorelayoutclusterListCall {
4448 hub: self.hub,
4449 _enterprise_id: enterprise_id.to_string(),
4450 _page_id: page_id.to_string(),
4451 _delegate: Default::default(),
4452 _additional_params: Default::default(),
4453 _scopes: Default::default(),
4454 }
4455 }
4456
4457 /// Create a builder to help you perform the following task:
4458 ///
4459 /// Updates a cluster.
4460 ///
4461 /// # Arguments
4462 ///
4463 /// * `request` - No description provided.
4464 /// * `enterpriseId` - The ID of the enterprise.
4465 /// * `pageId` - The ID of the page.
4466 /// * `clusterId` - The ID of the cluster.
4467 pub fn update(
4468 &self,
4469 request: StoreCluster,
4470 enterprise_id: &str,
4471 page_id: &str,
4472 cluster_id: &str,
4473 ) -> StorelayoutclusterUpdateCall<'a, C> {
4474 StorelayoutclusterUpdateCall {
4475 hub: self.hub,
4476 _request: request,
4477 _enterprise_id: enterprise_id.to_string(),
4478 _page_id: page_id.to_string(),
4479 _cluster_id: cluster_id.to_string(),
4480 _delegate: Default::default(),
4481 _additional_params: Default::default(),
4482 _scopes: Default::default(),
4483 }
4484 }
4485}
4486
4487/// A builder providing access to all methods supported on *storelayoutpage* resources.
4488/// It is not used directly, but through the [`AndroidEnterprise`] hub.
4489///
4490/// # Example
4491///
4492/// Instantiate a resource builder
4493///
4494/// ```test_harness,no_run
4495/// extern crate hyper;
4496/// extern crate hyper_rustls;
4497/// extern crate google_androidenterprise1 as androidenterprise1;
4498///
4499/// # async fn dox() {
4500/// use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4501///
4502/// let secret: yup_oauth2::ApplicationSecret = Default::default();
4503/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
4504/// .with_native_roots()
4505/// .unwrap()
4506/// .https_only()
4507/// .enable_http2()
4508/// .build();
4509///
4510/// let executor = hyper_util::rt::TokioExecutor::new();
4511/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4512/// secret,
4513/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4514/// yup_oauth2::client::CustomHyperClientBuilder::from(
4515/// hyper_util::client::legacy::Client::builder(executor).build(connector),
4516/// ),
4517/// ).build().await.unwrap();
4518///
4519/// let client = hyper_util::client::legacy::Client::builder(
4520/// hyper_util::rt::TokioExecutor::new()
4521/// )
4522/// .build(
4523/// hyper_rustls::HttpsConnectorBuilder::new()
4524/// .with_native_roots()
4525/// .unwrap()
4526/// .https_or_http()
4527/// .enable_http2()
4528/// .build()
4529/// );
4530/// let mut hub = AndroidEnterprise::new(client, auth);
4531/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
4532/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)` and `update(...)`
4533/// // to build up your call.
4534/// let rb = hub.storelayoutpages();
4535/// # }
4536/// ```
4537pub struct StorelayoutpageMethods<'a, C>
4538where
4539 C: 'a,
4540{
4541 hub: &'a AndroidEnterprise<C>,
4542}
4543
4544impl<'a, C> common::MethodsBuilder for StorelayoutpageMethods<'a, C> {}
4545
4546impl<'a, C> StorelayoutpageMethods<'a, C> {
4547 /// Create a builder to help you perform the following task:
4548 ///
4549 /// Deletes a store page.
4550 ///
4551 /// # Arguments
4552 ///
4553 /// * `enterpriseId` - The ID of the enterprise.
4554 /// * `pageId` - The ID of the page.
4555 pub fn delete(&self, enterprise_id: &str, page_id: &str) -> StorelayoutpageDeleteCall<'a, C> {
4556 StorelayoutpageDeleteCall {
4557 hub: self.hub,
4558 _enterprise_id: enterprise_id.to_string(),
4559 _page_id: page_id.to_string(),
4560 _delegate: Default::default(),
4561 _additional_params: Default::default(),
4562 _scopes: Default::default(),
4563 }
4564 }
4565
4566 /// Create a builder to help you perform the following task:
4567 ///
4568 /// Retrieves details of a store page.
4569 ///
4570 /// # Arguments
4571 ///
4572 /// * `enterpriseId` - The ID of the enterprise.
4573 /// * `pageId` - The ID of the page.
4574 pub fn get(&self, enterprise_id: &str, page_id: &str) -> StorelayoutpageGetCall<'a, C> {
4575 StorelayoutpageGetCall {
4576 hub: self.hub,
4577 _enterprise_id: enterprise_id.to_string(),
4578 _page_id: page_id.to_string(),
4579 _delegate: Default::default(),
4580 _additional_params: Default::default(),
4581 _scopes: Default::default(),
4582 }
4583 }
4584
4585 /// Create a builder to help you perform the following task:
4586 ///
4587 /// Inserts a new store page.
4588 ///
4589 /// # Arguments
4590 ///
4591 /// * `request` - No description provided.
4592 /// * `enterpriseId` - The ID of the enterprise.
4593 pub fn insert(
4594 &self,
4595 request: StorePage,
4596 enterprise_id: &str,
4597 ) -> StorelayoutpageInsertCall<'a, C> {
4598 StorelayoutpageInsertCall {
4599 hub: self.hub,
4600 _request: request,
4601 _enterprise_id: enterprise_id.to_string(),
4602 _delegate: Default::default(),
4603 _additional_params: Default::default(),
4604 _scopes: Default::default(),
4605 }
4606 }
4607
4608 /// Create a builder to help you perform the following task:
4609 ///
4610 /// Retrieves the details of all pages in the store.
4611 ///
4612 /// # Arguments
4613 ///
4614 /// * `enterpriseId` - The ID of the enterprise.
4615 pub fn list(&self, enterprise_id: &str) -> StorelayoutpageListCall<'a, C> {
4616 StorelayoutpageListCall {
4617 hub: self.hub,
4618 _enterprise_id: enterprise_id.to_string(),
4619 _delegate: Default::default(),
4620 _additional_params: Default::default(),
4621 _scopes: Default::default(),
4622 }
4623 }
4624
4625 /// Create a builder to help you perform the following task:
4626 ///
4627 /// Updates the content of a store page.
4628 ///
4629 /// # Arguments
4630 ///
4631 /// * `request` - No description provided.
4632 /// * `enterpriseId` - The ID of the enterprise.
4633 /// * `pageId` - The ID of the page.
4634 pub fn update(
4635 &self,
4636 request: StorePage,
4637 enterprise_id: &str,
4638 page_id: &str,
4639 ) -> StorelayoutpageUpdateCall<'a, C> {
4640 StorelayoutpageUpdateCall {
4641 hub: self.hub,
4642 _request: request,
4643 _enterprise_id: enterprise_id.to_string(),
4644 _page_id: page_id.to_string(),
4645 _delegate: Default::default(),
4646 _additional_params: Default::default(),
4647 _scopes: Default::default(),
4648 }
4649 }
4650}
4651
4652/// A builder providing access to all methods supported on *user* resources.
4653/// It is not used directly, but through the [`AndroidEnterprise`] hub.
4654///
4655/// # Example
4656///
4657/// Instantiate a resource builder
4658///
4659/// ```test_harness,no_run
4660/// extern crate hyper;
4661/// extern crate hyper_rustls;
4662/// extern crate google_androidenterprise1 as androidenterprise1;
4663///
4664/// # async fn dox() {
4665/// use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4666///
4667/// let secret: yup_oauth2::ApplicationSecret = Default::default();
4668/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
4669/// .with_native_roots()
4670/// .unwrap()
4671/// .https_only()
4672/// .enable_http2()
4673/// .build();
4674///
4675/// let executor = hyper_util::rt::TokioExecutor::new();
4676/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4677/// secret,
4678/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4679/// yup_oauth2::client::CustomHyperClientBuilder::from(
4680/// hyper_util::client::legacy::Client::builder(executor).build(connector),
4681/// ),
4682/// ).build().await.unwrap();
4683///
4684/// let client = hyper_util::client::legacy::Client::builder(
4685/// hyper_util::rt::TokioExecutor::new()
4686/// )
4687/// .build(
4688/// hyper_rustls::HttpsConnectorBuilder::new()
4689/// .with_native_roots()
4690/// .unwrap()
4691/// .https_or_http()
4692/// .enable_http2()
4693/// .build()
4694/// );
4695/// let mut hub = AndroidEnterprise::new(client, auth);
4696/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
4697/// // like `delete(...)`, `generate_authentication_token(...)`, `get(...)`, `get_available_product_set(...)`, `insert(...)`, `list(...)`, `revoke_device_access(...)`, `set_available_product_set(...)` and `update(...)`
4698/// // to build up your call.
4699/// let rb = hub.users();
4700/// # }
4701/// ```
4702pub struct UserMethods<'a, C>
4703where
4704 C: 'a,
4705{
4706 hub: &'a AndroidEnterprise<C>,
4707}
4708
4709impl<'a, C> common::MethodsBuilder for UserMethods<'a, C> {}
4710
4711impl<'a, C> UserMethods<'a, C> {
4712 /// Create a builder to help you perform the following task:
4713 ///
4714 /// Deleted an EMM-managed user.
4715 ///
4716 /// # Arguments
4717 ///
4718 /// * `enterpriseId` - The ID of the enterprise.
4719 /// * `userId` - The ID of the user.
4720 pub fn delete(&self, enterprise_id: &str, user_id: &str) -> UserDeleteCall<'a, C> {
4721 UserDeleteCall {
4722 hub: self.hub,
4723 _enterprise_id: enterprise_id.to_string(),
4724 _user_id: user_id.to_string(),
4725 _delegate: Default::default(),
4726 _additional_params: Default::default(),
4727 _scopes: Default::default(),
4728 }
4729 }
4730
4731 /// Create a builder to help you perform the following task:
4732 ///
4733 /// Generates an authentication token which the device policy client can use to provision the given EMM-managed user account on a device. The generated token is single-use and expires after a few minutes. You can provision a maximum of 10 devices per user. This call only works with EMM-managed accounts.
4734 ///
4735 /// # Arguments
4736 ///
4737 /// * `enterpriseId` - The ID of the enterprise.
4738 /// * `userId` - The ID of the user.
4739 pub fn generate_authentication_token(
4740 &self,
4741 enterprise_id: &str,
4742 user_id: &str,
4743 ) -> UserGenerateAuthenticationTokenCall<'a, C> {
4744 UserGenerateAuthenticationTokenCall {
4745 hub: self.hub,
4746 _enterprise_id: enterprise_id.to_string(),
4747 _user_id: user_id.to_string(),
4748 _delegate: Default::default(),
4749 _additional_params: Default::default(),
4750 _scopes: Default::default(),
4751 }
4752 }
4753
4754 /// Create a builder to help you perform the following task:
4755 ///
4756 /// Retrieves a user's details.
4757 ///
4758 /// # Arguments
4759 ///
4760 /// * `enterpriseId` - The ID of the enterprise.
4761 /// * `userId` - The ID of the user.
4762 pub fn get(&self, enterprise_id: &str, user_id: &str) -> UserGetCall<'a, C> {
4763 UserGetCall {
4764 hub: self.hub,
4765 _enterprise_id: enterprise_id.to_string(),
4766 _user_id: user_id.to_string(),
4767 _delegate: Default::default(),
4768 _additional_params: Default::default(),
4769 _scopes: Default::default(),
4770 }
4771 }
4772
4773 /// Create a builder to help you perform the following task:
4774 ///
4775 /// Retrieves the set of products a user is entitled to access. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
4776 ///
4777 /// # Arguments
4778 ///
4779 /// * `enterpriseId` - The ID of the enterprise.
4780 /// * `userId` - The ID of the user.
4781 pub fn get_available_product_set(
4782 &self,
4783 enterprise_id: &str,
4784 user_id: &str,
4785 ) -> UserGetAvailableProductSetCall<'a, C> {
4786 UserGetAvailableProductSetCall {
4787 hub: self.hub,
4788 _enterprise_id: enterprise_id.to_string(),
4789 _user_id: user_id.to_string(),
4790 _delegate: Default::default(),
4791 _additional_params: Default::default(),
4792 _scopes: Default::default(),
4793 }
4794 }
4795
4796 /// Create a builder to help you perform the following task:
4797 ///
4798 /// Creates a new EMM-managed user. The Users resource passed in the body of the request should include an accountIdentifier and an accountType. If a corresponding user already exists with the same account identifier, the user will be updated with the resource. In this case only the displayName field can be changed.
4799 ///
4800 /// # Arguments
4801 ///
4802 /// * `request` - No description provided.
4803 /// * `enterpriseId` - The ID of the enterprise.
4804 pub fn insert(&self, request: User, enterprise_id: &str) -> UserInsertCall<'a, C> {
4805 UserInsertCall {
4806 hub: self.hub,
4807 _request: request,
4808 _enterprise_id: enterprise_id.to_string(),
4809 _delegate: Default::default(),
4810 _additional_params: Default::default(),
4811 _scopes: Default::default(),
4812 }
4813 }
4814
4815 /// Create a builder to help you perform the following task:
4816 ///
4817 /// Looks up a user by primary email address. This is only supported for Google-managed users. Lookup of the id is not needed for EMM-managed users because the id is already returned in the result of the Users.insert call.
4818 ///
4819 /// # Arguments
4820 ///
4821 /// * `enterpriseId` - The ID of the enterprise.
4822 /// * `email` - Required. The exact primary email address of the user to look up.
4823 pub fn list(&self, enterprise_id: &str, email: &str) -> UserListCall<'a, C> {
4824 UserListCall {
4825 hub: self.hub,
4826 _enterprise_id: enterprise_id.to_string(),
4827 _email: email.to_string(),
4828 _delegate: Default::default(),
4829 _additional_params: Default::default(),
4830 _scopes: Default::default(),
4831 }
4832 }
4833
4834 /// Create a builder to help you perform the following task:
4835 ///
4836 /// Revokes access to all devices currently provisioned to the user. The user will no longer be able to use the managed Play store on any of their managed devices. This call only works with EMM-managed accounts.
4837 ///
4838 /// # Arguments
4839 ///
4840 /// * `enterpriseId` - The ID of the enterprise.
4841 /// * `userId` - The ID of the user.
4842 pub fn revoke_device_access(
4843 &self,
4844 enterprise_id: &str,
4845 user_id: &str,
4846 ) -> UserRevokeDeviceAccesCall<'a, C> {
4847 UserRevokeDeviceAccesCall {
4848 hub: self.hub,
4849 _enterprise_id: enterprise_id.to_string(),
4850 _user_id: user_id.to_string(),
4851 _delegate: Default::default(),
4852 _additional_params: Default::default(),
4853 _scopes: Default::default(),
4854 }
4855 }
4856
4857 /// Create a builder to help you perform the following task:
4858 ///
4859 /// Modifies the set of products that a user is entitled to access (referred to as *whitelisted* products). Only products that are approved or products that were previously approved (products with revoked approval) can be whitelisted. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
4860 ///
4861 /// # Arguments
4862 ///
4863 /// * `request` - No description provided.
4864 /// * `enterpriseId` - The ID of the enterprise.
4865 /// * `userId` - The ID of the user.
4866 pub fn set_available_product_set(
4867 &self,
4868 request: ProductSet,
4869 enterprise_id: &str,
4870 user_id: &str,
4871 ) -> UserSetAvailableProductSetCall<'a, C> {
4872 UserSetAvailableProductSetCall {
4873 hub: self.hub,
4874 _request: request,
4875 _enterprise_id: enterprise_id.to_string(),
4876 _user_id: user_id.to_string(),
4877 _delegate: Default::default(),
4878 _additional_params: Default::default(),
4879 _scopes: Default::default(),
4880 }
4881 }
4882
4883 /// Create a builder to help you perform the following task:
4884 ///
4885 /// Updates the details of an EMM-managed user. Can be used with EMM-managed users only (not Google managed users). Pass the new details in the Users resource in the request body. Only the displayName field can be changed. Other fields must either be unset or have the currently active value.
4886 ///
4887 /// # Arguments
4888 ///
4889 /// * `request` - No description provided.
4890 /// * `enterpriseId` - The ID of the enterprise.
4891 /// * `userId` - The ID of the user.
4892 pub fn update(
4893 &self,
4894 request: User,
4895 enterprise_id: &str,
4896 user_id: &str,
4897 ) -> UserUpdateCall<'a, C> {
4898 UserUpdateCall {
4899 hub: self.hub,
4900 _request: request,
4901 _enterprise_id: enterprise_id.to_string(),
4902 _user_id: user_id.to_string(),
4903 _delegate: Default::default(),
4904 _additional_params: Default::default(),
4905 _scopes: Default::default(),
4906 }
4907 }
4908}
4909
4910/// A builder providing access to all methods supported on *webapp* resources.
4911/// It is not used directly, but through the [`AndroidEnterprise`] hub.
4912///
4913/// # Example
4914///
4915/// Instantiate a resource builder
4916///
4917/// ```test_harness,no_run
4918/// extern crate hyper;
4919/// extern crate hyper_rustls;
4920/// extern crate google_androidenterprise1 as androidenterprise1;
4921///
4922/// # async fn dox() {
4923/// use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4924///
4925/// let secret: yup_oauth2::ApplicationSecret = Default::default();
4926/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
4927/// .with_native_roots()
4928/// .unwrap()
4929/// .https_only()
4930/// .enable_http2()
4931/// .build();
4932///
4933/// let executor = hyper_util::rt::TokioExecutor::new();
4934/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4935/// secret,
4936/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4937/// yup_oauth2::client::CustomHyperClientBuilder::from(
4938/// hyper_util::client::legacy::Client::builder(executor).build(connector),
4939/// ),
4940/// ).build().await.unwrap();
4941///
4942/// let client = hyper_util::client::legacy::Client::builder(
4943/// hyper_util::rt::TokioExecutor::new()
4944/// )
4945/// .build(
4946/// hyper_rustls::HttpsConnectorBuilder::new()
4947/// .with_native_roots()
4948/// .unwrap()
4949/// .https_or_http()
4950/// .enable_http2()
4951/// .build()
4952/// );
4953/// let mut hub = AndroidEnterprise::new(client, auth);
4954/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
4955/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)` and `update(...)`
4956/// // to build up your call.
4957/// let rb = hub.webapps();
4958/// # }
4959/// ```
4960pub struct WebappMethods<'a, C>
4961where
4962 C: 'a,
4963{
4964 hub: &'a AndroidEnterprise<C>,
4965}
4966
4967impl<'a, C> common::MethodsBuilder for WebappMethods<'a, C> {}
4968
4969impl<'a, C> WebappMethods<'a, C> {
4970 /// Create a builder to help you perform the following task:
4971 ///
4972 /// Deletes an existing web app.
4973 ///
4974 /// # Arguments
4975 ///
4976 /// * `enterpriseId` - The ID of the enterprise.
4977 /// * `webAppId` - The ID of the web app.
4978 pub fn delete(&self, enterprise_id: &str, web_app_id: &str) -> WebappDeleteCall<'a, C> {
4979 WebappDeleteCall {
4980 hub: self.hub,
4981 _enterprise_id: enterprise_id.to_string(),
4982 _web_app_id: web_app_id.to_string(),
4983 _delegate: Default::default(),
4984 _additional_params: Default::default(),
4985 _scopes: Default::default(),
4986 }
4987 }
4988
4989 /// Create a builder to help you perform the following task:
4990 ///
4991 /// Gets an existing web app.
4992 ///
4993 /// # Arguments
4994 ///
4995 /// * `enterpriseId` - The ID of the enterprise.
4996 /// * `webAppId` - The ID of the web app.
4997 pub fn get(&self, enterprise_id: &str, web_app_id: &str) -> WebappGetCall<'a, C> {
4998 WebappGetCall {
4999 hub: self.hub,
5000 _enterprise_id: enterprise_id.to_string(),
5001 _web_app_id: web_app_id.to_string(),
5002 _delegate: Default::default(),
5003 _additional_params: Default::default(),
5004 _scopes: Default::default(),
5005 }
5006 }
5007
5008 /// Create a builder to help you perform the following task:
5009 ///
5010 /// Creates a new web app for the enterprise.
5011 ///
5012 /// # Arguments
5013 ///
5014 /// * `request` - No description provided.
5015 /// * `enterpriseId` - The ID of the enterprise.
5016 pub fn insert(&self, request: WebApp, enterprise_id: &str) -> WebappInsertCall<'a, C> {
5017 WebappInsertCall {
5018 hub: self.hub,
5019 _request: request,
5020 _enterprise_id: enterprise_id.to_string(),
5021 _delegate: Default::default(),
5022 _additional_params: Default::default(),
5023 _scopes: Default::default(),
5024 }
5025 }
5026
5027 /// Create a builder to help you perform the following task:
5028 ///
5029 /// Retrieves the details of all web apps for a given enterprise.
5030 ///
5031 /// # Arguments
5032 ///
5033 /// * `enterpriseId` - The ID of the enterprise.
5034 pub fn list(&self, enterprise_id: &str) -> WebappListCall<'a, C> {
5035 WebappListCall {
5036 hub: self.hub,
5037 _enterprise_id: enterprise_id.to_string(),
5038 _delegate: Default::default(),
5039 _additional_params: Default::default(),
5040 _scopes: Default::default(),
5041 }
5042 }
5043
5044 /// Create a builder to help you perform the following task:
5045 ///
5046 /// Updates an existing web app.
5047 ///
5048 /// # Arguments
5049 ///
5050 /// * `request` - No description provided.
5051 /// * `enterpriseId` - The ID of the enterprise.
5052 /// * `webAppId` - The ID of the web app.
5053 pub fn update(
5054 &self,
5055 request: WebApp,
5056 enterprise_id: &str,
5057 web_app_id: &str,
5058 ) -> WebappUpdateCall<'a, C> {
5059 WebappUpdateCall {
5060 hub: self.hub,
5061 _request: request,
5062 _enterprise_id: enterprise_id.to_string(),
5063 _web_app_id: web_app_id.to_string(),
5064 _delegate: Default::default(),
5065 _additional_params: Default::default(),
5066 _scopes: Default::default(),
5067 }
5068 }
5069}
5070
5071// ###################
5072// CallBuilders ###
5073// #################
5074
5075/// Uploads a report containing any changes in app states on the device since the last report was generated. You can call this method up to 3 times every 24 hours for a given device. If you exceed the quota, then the Google Play EMM API returns HTTP 429 Too Many Requests.
5076///
5077/// A builder for the *forceReportUpload* method supported by a *device* resource.
5078/// It is not used directly, but through a [`DeviceMethods`] instance.
5079///
5080/// # Example
5081///
5082/// Instantiate a resource method builder
5083///
5084/// ```test_harness,no_run
5085/// # extern crate hyper;
5086/// # extern crate hyper_rustls;
5087/// # extern crate google_androidenterprise1 as androidenterprise1;
5088/// # async fn dox() {
5089/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5090///
5091/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5092/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5093/// # .with_native_roots()
5094/// # .unwrap()
5095/// # .https_only()
5096/// # .enable_http2()
5097/// # .build();
5098///
5099/// # let executor = hyper_util::rt::TokioExecutor::new();
5100/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5101/// # secret,
5102/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5103/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5104/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5105/// # ),
5106/// # ).build().await.unwrap();
5107///
5108/// # let client = hyper_util::client::legacy::Client::builder(
5109/// # hyper_util::rt::TokioExecutor::new()
5110/// # )
5111/// # .build(
5112/// # hyper_rustls::HttpsConnectorBuilder::new()
5113/// # .with_native_roots()
5114/// # .unwrap()
5115/// # .https_or_http()
5116/// # .enable_http2()
5117/// # .build()
5118/// # );
5119/// # let mut hub = AndroidEnterprise::new(client, auth);
5120/// // You can configure optional parameters by calling the respective setters at will, and
5121/// // execute the final call using `doit()`.
5122/// // Values shown here are possibly random and not representative !
5123/// let result = hub.devices().force_report_upload("enterpriseId", "userId", "deviceId")
5124/// .doit().await;
5125/// # }
5126/// ```
5127pub struct DeviceForceReportUploadCall<'a, C>
5128where
5129 C: 'a,
5130{
5131 hub: &'a AndroidEnterprise<C>,
5132 _enterprise_id: String,
5133 _user_id: String,
5134 _device_id: String,
5135 _delegate: Option<&'a mut dyn common::Delegate>,
5136 _additional_params: HashMap<String, String>,
5137 _scopes: BTreeSet<String>,
5138}
5139
5140impl<'a, C> common::CallBuilder for DeviceForceReportUploadCall<'a, C> {}
5141
5142impl<'a, C> DeviceForceReportUploadCall<'a, C>
5143where
5144 C: common::Connector,
5145{
5146 /// Perform the operation you have build so far.
5147 pub async fn doit(mut self) -> common::Result<common::Response> {
5148 use std::borrow::Cow;
5149 use std::io::{Read, Seek};
5150
5151 use common::{url::Params, ToParts};
5152 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5153
5154 let mut dd = common::DefaultDelegate;
5155 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5156 dlg.begin(common::MethodInfo {
5157 id: "androidenterprise.devices.forceReportUpload",
5158 http_method: hyper::Method::POST,
5159 });
5160
5161 for &field in ["enterpriseId", "userId", "deviceId"].iter() {
5162 if self._additional_params.contains_key(field) {
5163 dlg.finished(false);
5164 return Err(common::Error::FieldClash(field));
5165 }
5166 }
5167
5168 let mut params = Params::with_capacity(4 + self._additional_params.len());
5169 params.push("enterpriseId", self._enterprise_id);
5170 params.push("userId", self._user_id);
5171 params.push("deviceId", self._device_id);
5172
5173 params.extend(self._additional_params.iter());
5174
5175 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/forceReportUpload";
5176 if self._scopes.is_empty() {
5177 self._scopes.insert(Scope::Full.as_ref().to_string());
5178 }
5179
5180 #[allow(clippy::single_element_loop)]
5181 for &(find_this, param_name) in [
5182 ("{enterpriseId}", "enterpriseId"),
5183 ("{userId}", "userId"),
5184 ("{deviceId}", "deviceId"),
5185 ]
5186 .iter()
5187 {
5188 url = params.uri_replacement(url, param_name, find_this, false);
5189 }
5190 {
5191 let to_remove = ["deviceId", "userId", "enterpriseId"];
5192 params.remove_params(&to_remove);
5193 }
5194
5195 let url = params.parse_with_url(&url);
5196
5197 loop {
5198 let token = match self
5199 .hub
5200 .auth
5201 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5202 .await
5203 {
5204 Ok(token) => token,
5205 Err(e) => match dlg.token(e) {
5206 Ok(token) => token,
5207 Err(e) => {
5208 dlg.finished(false);
5209 return Err(common::Error::MissingToken(e));
5210 }
5211 },
5212 };
5213 let mut req_result = {
5214 let client = &self.hub.client;
5215 dlg.pre_request();
5216 let mut req_builder = hyper::Request::builder()
5217 .method(hyper::Method::POST)
5218 .uri(url.as_str())
5219 .header(USER_AGENT, self.hub._user_agent.clone());
5220
5221 if let Some(token) = token.as_ref() {
5222 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5223 }
5224
5225 let request = req_builder
5226 .header(CONTENT_LENGTH, 0_u64)
5227 .body(common::to_body::<String>(None));
5228
5229 client.request(request.unwrap()).await
5230 };
5231
5232 match req_result {
5233 Err(err) => {
5234 if let common::Retry::After(d) = dlg.http_error(&err) {
5235 sleep(d).await;
5236 continue;
5237 }
5238 dlg.finished(false);
5239 return Err(common::Error::HttpError(err));
5240 }
5241 Ok(res) => {
5242 let (mut parts, body) = res.into_parts();
5243 let mut body = common::Body::new(body);
5244 if !parts.status.is_success() {
5245 let bytes = common::to_bytes(body).await.unwrap_or_default();
5246 let error = serde_json::from_str(&common::to_string(&bytes));
5247 let response = common::to_response(parts, bytes.into());
5248
5249 if let common::Retry::After(d) =
5250 dlg.http_failure(&response, error.as_ref().ok())
5251 {
5252 sleep(d).await;
5253 continue;
5254 }
5255
5256 dlg.finished(false);
5257
5258 return Err(match error {
5259 Ok(value) => common::Error::BadRequest(value),
5260 _ => common::Error::Failure(response),
5261 });
5262 }
5263 let response = common::Response::from_parts(parts, body);
5264
5265 dlg.finished(true);
5266 return Ok(response);
5267 }
5268 }
5269 }
5270 }
5271
5272 /// The ID of the enterprise.
5273 ///
5274 /// Sets the *enterprise id* path property to the given value.
5275 ///
5276 /// Even though the property as already been set when instantiating this call,
5277 /// we provide this method for API completeness.
5278 pub fn enterprise_id(mut self, new_value: &str) -> DeviceForceReportUploadCall<'a, C> {
5279 self._enterprise_id = new_value.to_string();
5280 self
5281 }
5282 /// The ID of the user.
5283 ///
5284 /// Sets the *user id* path property to the given value.
5285 ///
5286 /// Even though the property as already been set when instantiating this call,
5287 /// we provide this method for API completeness.
5288 pub fn user_id(mut self, new_value: &str) -> DeviceForceReportUploadCall<'a, C> {
5289 self._user_id = new_value.to_string();
5290 self
5291 }
5292 /// The ID of the device.
5293 ///
5294 /// Sets the *device id* path property to the given value.
5295 ///
5296 /// Even though the property as already been set when instantiating this call,
5297 /// we provide this method for API completeness.
5298 pub fn device_id(mut self, new_value: &str) -> DeviceForceReportUploadCall<'a, C> {
5299 self._device_id = new_value.to_string();
5300 self
5301 }
5302 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5303 /// while executing the actual API request.
5304 ///
5305 /// ````text
5306 /// It should be used to handle progress information, and to implement a certain level of resilience.
5307 /// ````
5308 ///
5309 /// Sets the *delegate* property to the given value.
5310 pub fn delegate(
5311 mut self,
5312 new_value: &'a mut dyn common::Delegate,
5313 ) -> DeviceForceReportUploadCall<'a, C> {
5314 self._delegate = Some(new_value);
5315 self
5316 }
5317
5318 /// Set any additional parameter of the query string used in the request.
5319 /// It should be used to set parameters which are not yet available through their own
5320 /// setters.
5321 ///
5322 /// Please note that this method must not be used to set any of the known parameters
5323 /// which have their own setter method. If done anyway, the request will fail.
5324 ///
5325 /// # Additional Parameters
5326 ///
5327 /// * *$.xgafv* (query-string) - V1 error format.
5328 /// * *access_token* (query-string) - OAuth access token.
5329 /// * *alt* (query-string) - Data format for response.
5330 /// * *callback* (query-string) - JSONP
5331 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5332 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5333 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5334 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5335 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5336 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5337 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5338 pub fn param<T>(mut self, name: T, value: T) -> DeviceForceReportUploadCall<'a, C>
5339 where
5340 T: AsRef<str>,
5341 {
5342 self._additional_params
5343 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5344 self
5345 }
5346
5347 /// Identifies the authorization scope for the method you are building.
5348 ///
5349 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5350 /// [`Scope::Full`].
5351 ///
5352 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5353 /// tokens for more than one scope.
5354 ///
5355 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5356 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5357 /// sufficient, a read-write scope will do as well.
5358 pub fn add_scope<St>(mut self, scope: St) -> DeviceForceReportUploadCall<'a, C>
5359 where
5360 St: AsRef<str>,
5361 {
5362 self._scopes.insert(String::from(scope.as_ref()));
5363 self
5364 }
5365 /// Identifies the authorization scope(s) for the method you are building.
5366 ///
5367 /// See [`Self::add_scope()`] for details.
5368 pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceForceReportUploadCall<'a, C>
5369 where
5370 I: IntoIterator<Item = St>,
5371 St: AsRef<str>,
5372 {
5373 self._scopes
5374 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5375 self
5376 }
5377
5378 /// Removes all scopes, and no default scope will be used either.
5379 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5380 /// for details).
5381 pub fn clear_scopes(mut self) -> DeviceForceReportUploadCall<'a, C> {
5382 self._scopes.clear();
5383 self
5384 }
5385}
5386
5387/// Retrieves the details of a device.
5388///
5389/// A builder for the *get* method supported by a *device* resource.
5390/// It is not used directly, but through a [`DeviceMethods`] instance.
5391///
5392/// # Example
5393///
5394/// Instantiate a resource method builder
5395///
5396/// ```test_harness,no_run
5397/// # extern crate hyper;
5398/// # extern crate hyper_rustls;
5399/// # extern crate google_androidenterprise1 as androidenterprise1;
5400/// # async fn dox() {
5401/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5402///
5403/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5404/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5405/// # .with_native_roots()
5406/// # .unwrap()
5407/// # .https_only()
5408/// # .enable_http2()
5409/// # .build();
5410///
5411/// # let executor = hyper_util::rt::TokioExecutor::new();
5412/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5413/// # secret,
5414/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5415/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5416/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5417/// # ),
5418/// # ).build().await.unwrap();
5419///
5420/// # let client = hyper_util::client::legacy::Client::builder(
5421/// # hyper_util::rt::TokioExecutor::new()
5422/// # )
5423/// # .build(
5424/// # hyper_rustls::HttpsConnectorBuilder::new()
5425/// # .with_native_roots()
5426/// # .unwrap()
5427/// # .https_or_http()
5428/// # .enable_http2()
5429/// # .build()
5430/// # );
5431/// # let mut hub = AndroidEnterprise::new(client, auth);
5432/// // You can configure optional parameters by calling the respective setters at will, and
5433/// // execute the final call using `doit()`.
5434/// // Values shown here are possibly random and not representative !
5435/// let result = hub.devices().get("enterpriseId", "userId", "deviceId")
5436/// .doit().await;
5437/// # }
5438/// ```
5439pub struct DeviceGetCall<'a, C>
5440where
5441 C: 'a,
5442{
5443 hub: &'a AndroidEnterprise<C>,
5444 _enterprise_id: String,
5445 _user_id: String,
5446 _device_id: String,
5447 _delegate: Option<&'a mut dyn common::Delegate>,
5448 _additional_params: HashMap<String, String>,
5449 _scopes: BTreeSet<String>,
5450}
5451
5452impl<'a, C> common::CallBuilder for DeviceGetCall<'a, C> {}
5453
5454impl<'a, C> DeviceGetCall<'a, C>
5455where
5456 C: common::Connector,
5457{
5458 /// Perform the operation you have build so far.
5459 pub async fn doit(mut self) -> common::Result<(common::Response, Device)> {
5460 use std::borrow::Cow;
5461 use std::io::{Read, Seek};
5462
5463 use common::{url::Params, ToParts};
5464 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5465
5466 let mut dd = common::DefaultDelegate;
5467 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5468 dlg.begin(common::MethodInfo {
5469 id: "androidenterprise.devices.get",
5470 http_method: hyper::Method::GET,
5471 });
5472
5473 for &field in ["alt", "enterpriseId", "userId", "deviceId"].iter() {
5474 if self._additional_params.contains_key(field) {
5475 dlg.finished(false);
5476 return Err(common::Error::FieldClash(field));
5477 }
5478 }
5479
5480 let mut params = Params::with_capacity(5 + self._additional_params.len());
5481 params.push("enterpriseId", self._enterprise_id);
5482 params.push("userId", self._user_id);
5483 params.push("deviceId", self._device_id);
5484
5485 params.extend(self._additional_params.iter());
5486
5487 params.push("alt", "json");
5488 let mut url = self.hub._base_url.clone()
5489 + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}";
5490 if self._scopes.is_empty() {
5491 self._scopes.insert(Scope::Full.as_ref().to_string());
5492 }
5493
5494 #[allow(clippy::single_element_loop)]
5495 for &(find_this, param_name) in [
5496 ("{enterpriseId}", "enterpriseId"),
5497 ("{userId}", "userId"),
5498 ("{deviceId}", "deviceId"),
5499 ]
5500 .iter()
5501 {
5502 url = params.uri_replacement(url, param_name, find_this, false);
5503 }
5504 {
5505 let to_remove = ["deviceId", "userId", "enterpriseId"];
5506 params.remove_params(&to_remove);
5507 }
5508
5509 let url = params.parse_with_url(&url);
5510
5511 loop {
5512 let token = match self
5513 .hub
5514 .auth
5515 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5516 .await
5517 {
5518 Ok(token) => token,
5519 Err(e) => match dlg.token(e) {
5520 Ok(token) => token,
5521 Err(e) => {
5522 dlg.finished(false);
5523 return Err(common::Error::MissingToken(e));
5524 }
5525 },
5526 };
5527 let mut req_result = {
5528 let client = &self.hub.client;
5529 dlg.pre_request();
5530 let mut req_builder = hyper::Request::builder()
5531 .method(hyper::Method::GET)
5532 .uri(url.as_str())
5533 .header(USER_AGENT, self.hub._user_agent.clone());
5534
5535 if let Some(token) = token.as_ref() {
5536 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5537 }
5538
5539 let request = req_builder
5540 .header(CONTENT_LENGTH, 0_u64)
5541 .body(common::to_body::<String>(None));
5542
5543 client.request(request.unwrap()).await
5544 };
5545
5546 match req_result {
5547 Err(err) => {
5548 if let common::Retry::After(d) = dlg.http_error(&err) {
5549 sleep(d).await;
5550 continue;
5551 }
5552 dlg.finished(false);
5553 return Err(common::Error::HttpError(err));
5554 }
5555 Ok(res) => {
5556 let (mut parts, body) = res.into_parts();
5557 let mut body = common::Body::new(body);
5558 if !parts.status.is_success() {
5559 let bytes = common::to_bytes(body).await.unwrap_or_default();
5560 let error = serde_json::from_str(&common::to_string(&bytes));
5561 let response = common::to_response(parts, bytes.into());
5562
5563 if let common::Retry::After(d) =
5564 dlg.http_failure(&response, error.as_ref().ok())
5565 {
5566 sleep(d).await;
5567 continue;
5568 }
5569
5570 dlg.finished(false);
5571
5572 return Err(match error {
5573 Ok(value) => common::Error::BadRequest(value),
5574 _ => common::Error::Failure(response),
5575 });
5576 }
5577 let response = {
5578 let bytes = common::to_bytes(body).await.unwrap_or_default();
5579 let encoded = common::to_string(&bytes);
5580 match serde_json::from_str(&encoded) {
5581 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5582 Err(error) => {
5583 dlg.response_json_decode_error(&encoded, &error);
5584 return Err(common::Error::JsonDecodeError(
5585 encoded.to_string(),
5586 error,
5587 ));
5588 }
5589 }
5590 };
5591
5592 dlg.finished(true);
5593 return Ok(response);
5594 }
5595 }
5596 }
5597 }
5598
5599 /// The ID of the enterprise.
5600 ///
5601 /// Sets the *enterprise id* path property to the given value.
5602 ///
5603 /// Even though the property as already been set when instantiating this call,
5604 /// we provide this method for API completeness.
5605 pub fn enterprise_id(mut self, new_value: &str) -> DeviceGetCall<'a, C> {
5606 self._enterprise_id = new_value.to_string();
5607 self
5608 }
5609 /// The ID of the user.
5610 ///
5611 /// Sets the *user id* path property to the given value.
5612 ///
5613 /// Even though the property as already been set when instantiating this call,
5614 /// we provide this method for API completeness.
5615 pub fn user_id(mut self, new_value: &str) -> DeviceGetCall<'a, C> {
5616 self._user_id = new_value.to_string();
5617 self
5618 }
5619 /// The ID of the device.
5620 ///
5621 /// Sets the *device id* path property to the given value.
5622 ///
5623 /// Even though the property as already been set when instantiating this call,
5624 /// we provide this method for API completeness.
5625 pub fn device_id(mut self, new_value: &str) -> DeviceGetCall<'a, C> {
5626 self._device_id = new_value.to_string();
5627 self
5628 }
5629 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5630 /// while executing the actual API request.
5631 ///
5632 /// ````text
5633 /// It should be used to handle progress information, and to implement a certain level of resilience.
5634 /// ````
5635 ///
5636 /// Sets the *delegate* property to the given value.
5637 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DeviceGetCall<'a, C> {
5638 self._delegate = Some(new_value);
5639 self
5640 }
5641
5642 /// Set any additional parameter of the query string used in the request.
5643 /// It should be used to set parameters which are not yet available through their own
5644 /// setters.
5645 ///
5646 /// Please note that this method must not be used to set any of the known parameters
5647 /// which have their own setter method. If done anyway, the request will fail.
5648 ///
5649 /// # Additional Parameters
5650 ///
5651 /// * *$.xgafv* (query-string) - V1 error format.
5652 /// * *access_token* (query-string) - OAuth access token.
5653 /// * *alt* (query-string) - Data format for response.
5654 /// * *callback* (query-string) - JSONP
5655 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5656 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5657 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5658 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5659 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5660 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5661 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5662 pub fn param<T>(mut self, name: T, value: T) -> DeviceGetCall<'a, C>
5663 where
5664 T: AsRef<str>,
5665 {
5666 self._additional_params
5667 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5668 self
5669 }
5670
5671 /// Identifies the authorization scope for the method you are building.
5672 ///
5673 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5674 /// [`Scope::Full`].
5675 ///
5676 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5677 /// tokens for more than one scope.
5678 ///
5679 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5680 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5681 /// sufficient, a read-write scope will do as well.
5682 pub fn add_scope<St>(mut self, scope: St) -> DeviceGetCall<'a, C>
5683 where
5684 St: AsRef<str>,
5685 {
5686 self._scopes.insert(String::from(scope.as_ref()));
5687 self
5688 }
5689 /// Identifies the authorization scope(s) for the method you are building.
5690 ///
5691 /// See [`Self::add_scope()`] for details.
5692 pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceGetCall<'a, C>
5693 where
5694 I: IntoIterator<Item = St>,
5695 St: AsRef<str>,
5696 {
5697 self._scopes
5698 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5699 self
5700 }
5701
5702 /// Removes all scopes, and no default scope will be used either.
5703 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5704 /// for details).
5705 pub fn clear_scopes(mut self) -> DeviceGetCall<'a, C> {
5706 self._scopes.clear();
5707 self
5708 }
5709}
5710
5711/// Retrieves whether a device's access to Google services is enabled or disabled. The device state takes effect only if enforcing EMM policies on Android devices is enabled in the Google Admin Console. Otherwise, the device state is ignored and all devices are allowed access to Google services. This is only supported for Google-managed users.
5712///
5713/// A builder for the *getState* method supported by a *device* resource.
5714/// It is not used directly, but through a [`DeviceMethods`] instance.
5715///
5716/// # Example
5717///
5718/// Instantiate a resource method builder
5719///
5720/// ```test_harness,no_run
5721/// # extern crate hyper;
5722/// # extern crate hyper_rustls;
5723/// # extern crate google_androidenterprise1 as androidenterprise1;
5724/// # async fn dox() {
5725/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5726///
5727/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5728/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5729/// # .with_native_roots()
5730/// # .unwrap()
5731/// # .https_only()
5732/// # .enable_http2()
5733/// # .build();
5734///
5735/// # let executor = hyper_util::rt::TokioExecutor::new();
5736/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5737/// # secret,
5738/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5739/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5740/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5741/// # ),
5742/// # ).build().await.unwrap();
5743///
5744/// # let client = hyper_util::client::legacy::Client::builder(
5745/// # hyper_util::rt::TokioExecutor::new()
5746/// # )
5747/// # .build(
5748/// # hyper_rustls::HttpsConnectorBuilder::new()
5749/// # .with_native_roots()
5750/// # .unwrap()
5751/// # .https_or_http()
5752/// # .enable_http2()
5753/// # .build()
5754/// # );
5755/// # let mut hub = AndroidEnterprise::new(client, auth);
5756/// // You can configure optional parameters by calling the respective setters at will, and
5757/// // execute the final call using `doit()`.
5758/// // Values shown here are possibly random and not representative !
5759/// let result = hub.devices().get_state("enterpriseId", "userId", "deviceId")
5760/// .doit().await;
5761/// # }
5762/// ```
5763pub struct DeviceGetStateCall<'a, C>
5764where
5765 C: 'a,
5766{
5767 hub: &'a AndroidEnterprise<C>,
5768 _enterprise_id: String,
5769 _user_id: String,
5770 _device_id: String,
5771 _delegate: Option<&'a mut dyn common::Delegate>,
5772 _additional_params: HashMap<String, String>,
5773 _scopes: BTreeSet<String>,
5774}
5775
5776impl<'a, C> common::CallBuilder for DeviceGetStateCall<'a, C> {}
5777
5778impl<'a, C> DeviceGetStateCall<'a, C>
5779where
5780 C: common::Connector,
5781{
5782 /// Perform the operation you have build so far.
5783 pub async fn doit(mut self) -> common::Result<(common::Response, DeviceState)> {
5784 use std::borrow::Cow;
5785 use std::io::{Read, Seek};
5786
5787 use common::{url::Params, ToParts};
5788 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5789
5790 let mut dd = common::DefaultDelegate;
5791 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5792 dlg.begin(common::MethodInfo {
5793 id: "androidenterprise.devices.getState",
5794 http_method: hyper::Method::GET,
5795 });
5796
5797 for &field in ["alt", "enterpriseId", "userId", "deviceId"].iter() {
5798 if self._additional_params.contains_key(field) {
5799 dlg.finished(false);
5800 return Err(common::Error::FieldClash(field));
5801 }
5802 }
5803
5804 let mut params = Params::with_capacity(5 + self._additional_params.len());
5805 params.push("enterpriseId", self._enterprise_id);
5806 params.push("userId", self._user_id);
5807 params.push("deviceId", self._device_id);
5808
5809 params.extend(self._additional_params.iter());
5810
5811 params.push("alt", "json");
5812 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/state";
5813 if self._scopes.is_empty() {
5814 self._scopes.insert(Scope::Full.as_ref().to_string());
5815 }
5816
5817 #[allow(clippy::single_element_loop)]
5818 for &(find_this, param_name) in [
5819 ("{enterpriseId}", "enterpriseId"),
5820 ("{userId}", "userId"),
5821 ("{deviceId}", "deviceId"),
5822 ]
5823 .iter()
5824 {
5825 url = params.uri_replacement(url, param_name, find_this, false);
5826 }
5827 {
5828 let to_remove = ["deviceId", "userId", "enterpriseId"];
5829 params.remove_params(&to_remove);
5830 }
5831
5832 let url = params.parse_with_url(&url);
5833
5834 loop {
5835 let token = match self
5836 .hub
5837 .auth
5838 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5839 .await
5840 {
5841 Ok(token) => token,
5842 Err(e) => match dlg.token(e) {
5843 Ok(token) => token,
5844 Err(e) => {
5845 dlg.finished(false);
5846 return Err(common::Error::MissingToken(e));
5847 }
5848 },
5849 };
5850 let mut req_result = {
5851 let client = &self.hub.client;
5852 dlg.pre_request();
5853 let mut req_builder = hyper::Request::builder()
5854 .method(hyper::Method::GET)
5855 .uri(url.as_str())
5856 .header(USER_AGENT, self.hub._user_agent.clone());
5857
5858 if let Some(token) = token.as_ref() {
5859 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5860 }
5861
5862 let request = req_builder
5863 .header(CONTENT_LENGTH, 0_u64)
5864 .body(common::to_body::<String>(None));
5865
5866 client.request(request.unwrap()).await
5867 };
5868
5869 match req_result {
5870 Err(err) => {
5871 if let common::Retry::After(d) = dlg.http_error(&err) {
5872 sleep(d).await;
5873 continue;
5874 }
5875 dlg.finished(false);
5876 return Err(common::Error::HttpError(err));
5877 }
5878 Ok(res) => {
5879 let (mut parts, body) = res.into_parts();
5880 let mut body = common::Body::new(body);
5881 if !parts.status.is_success() {
5882 let bytes = common::to_bytes(body).await.unwrap_or_default();
5883 let error = serde_json::from_str(&common::to_string(&bytes));
5884 let response = common::to_response(parts, bytes.into());
5885
5886 if let common::Retry::After(d) =
5887 dlg.http_failure(&response, error.as_ref().ok())
5888 {
5889 sleep(d).await;
5890 continue;
5891 }
5892
5893 dlg.finished(false);
5894
5895 return Err(match error {
5896 Ok(value) => common::Error::BadRequest(value),
5897 _ => common::Error::Failure(response),
5898 });
5899 }
5900 let response = {
5901 let bytes = common::to_bytes(body).await.unwrap_or_default();
5902 let encoded = common::to_string(&bytes);
5903 match serde_json::from_str(&encoded) {
5904 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5905 Err(error) => {
5906 dlg.response_json_decode_error(&encoded, &error);
5907 return Err(common::Error::JsonDecodeError(
5908 encoded.to_string(),
5909 error,
5910 ));
5911 }
5912 }
5913 };
5914
5915 dlg.finished(true);
5916 return Ok(response);
5917 }
5918 }
5919 }
5920 }
5921
5922 /// The ID of the enterprise.
5923 ///
5924 /// Sets the *enterprise id* path property to the given value.
5925 ///
5926 /// Even though the property as already been set when instantiating this call,
5927 /// we provide this method for API completeness.
5928 pub fn enterprise_id(mut self, new_value: &str) -> DeviceGetStateCall<'a, C> {
5929 self._enterprise_id = new_value.to_string();
5930 self
5931 }
5932 /// The ID of the user.
5933 ///
5934 /// Sets the *user id* path property to the given value.
5935 ///
5936 /// Even though the property as already been set when instantiating this call,
5937 /// we provide this method for API completeness.
5938 pub fn user_id(mut self, new_value: &str) -> DeviceGetStateCall<'a, C> {
5939 self._user_id = new_value.to_string();
5940 self
5941 }
5942 /// The ID of the device.
5943 ///
5944 /// Sets the *device id* path property to the given value.
5945 ///
5946 /// Even though the property as already been set when instantiating this call,
5947 /// we provide this method for API completeness.
5948 pub fn device_id(mut self, new_value: &str) -> DeviceGetStateCall<'a, C> {
5949 self._device_id = new_value.to_string();
5950 self
5951 }
5952 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5953 /// while executing the actual API request.
5954 ///
5955 /// ````text
5956 /// It should be used to handle progress information, and to implement a certain level of resilience.
5957 /// ````
5958 ///
5959 /// Sets the *delegate* property to the given value.
5960 pub fn delegate(
5961 mut self,
5962 new_value: &'a mut dyn common::Delegate,
5963 ) -> DeviceGetStateCall<'a, C> {
5964 self._delegate = Some(new_value);
5965 self
5966 }
5967
5968 /// Set any additional parameter of the query string used in the request.
5969 /// It should be used to set parameters which are not yet available through their own
5970 /// setters.
5971 ///
5972 /// Please note that this method must not be used to set any of the known parameters
5973 /// which have their own setter method. If done anyway, the request will fail.
5974 ///
5975 /// # Additional Parameters
5976 ///
5977 /// * *$.xgafv* (query-string) - V1 error format.
5978 /// * *access_token* (query-string) - OAuth access token.
5979 /// * *alt* (query-string) - Data format for response.
5980 /// * *callback* (query-string) - JSONP
5981 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5982 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5983 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5984 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5985 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5986 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5987 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5988 pub fn param<T>(mut self, name: T, value: T) -> DeviceGetStateCall<'a, C>
5989 where
5990 T: AsRef<str>,
5991 {
5992 self._additional_params
5993 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5994 self
5995 }
5996
5997 /// Identifies the authorization scope for the method you are building.
5998 ///
5999 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6000 /// [`Scope::Full`].
6001 ///
6002 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6003 /// tokens for more than one scope.
6004 ///
6005 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6006 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6007 /// sufficient, a read-write scope will do as well.
6008 pub fn add_scope<St>(mut self, scope: St) -> DeviceGetStateCall<'a, C>
6009 where
6010 St: AsRef<str>,
6011 {
6012 self._scopes.insert(String::from(scope.as_ref()));
6013 self
6014 }
6015 /// Identifies the authorization scope(s) for the method you are building.
6016 ///
6017 /// See [`Self::add_scope()`] for details.
6018 pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceGetStateCall<'a, C>
6019 where
6020 I: IntoIterator<Item = St>,
6021 St: AsRef<str>,
6022 {
6023 self._scopes
6024 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6025 self
6026 }
6027
6028 /// Removes all scopes, and no default scope will be used either.
6029 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6030 /// for details).
6031 pub fn clear_scopes(mut self) -> DeviceGetStateCall<'a, C> {
6032 self._scopes.clear();
6033 self
6034 }
6035}
6036
6037/// Retrieves the IDs of all of a user's devices.
6038///
6039/// A builder for the *list* method supported by a *device* resource.
6040/// It is not used directly, but through a [`DeviceMethods`] instance.
6041///
6042/// # Example
6043///
6044/// Instantiate a resource method builder
6045///
6046/// ```test_harness,no_run
6047/// # extern crate hyper;
6048/// # extern crate hyper_rustls;
6049/// # extern crate google_androidenterprise1 as androidenterprise1;
6050/// # async fn dox() {
6051/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6052///
6053/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6054/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6055/// # .with_native_roots()
6056/// # .unwrap()
6057/// # .https_only()
6058/// # .enable_http2()
6059/// # .build();
6060///
6061/// # let executor = hyper_util::rt::TokioExecutor::new();
6062/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6063/// # secret,
6064/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6065/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6066/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6067/// # ),
6068/// # ).build().await.unwrap();
6069///
6070/// # let client = hyper_util::client::legacy::Client::builder(
6071/// # hyper_util::rt::TokioExecutor::new()
6072/// # )
6073/// # .build(
6074/// # hyper_rustls::HttpsConnectorBuilder::new()
6075/// # .with_native_roots()
6076/// # .unwrap()
6077/// # .https_or_http()
6078/// # .enable_http2()
6079/// # .build()
6080/// # );
6081/// # let mut hub = AndroidEnterprise::new(client, auth);
6082/// // You can configure optional parameters by calling the respective setters at will, and
6083/// // execute the final call using `doit()`.
6084/// // Values shown here are possibly random and not representative !
6085/// let result = hub.devices().list("enterpriseId", "userId")
6086/// .doit().await;
6087/// # }
6088/// ```
6089pub struct DeviceListCall<'a, C>
6090where
6091 C: 'a,
6092{
6093 hub: &'a AndroidEnterprise<C>,
6094 _enterprise_id: String,
6095 _user_id: String,
6096 _delegate: Option<&'a mut dyn common::Delegate>,
6097 _additional_params: HashMap<String, String>,
6098 _scopes: BTreeSet<String>,
6099}
6100
6101impl<'a, C> common::CallBuilder for DeviceListCall<'a, C> {}
6102
6103impl<'a, C> DeviceListCall<'a, C>
6104where
6105 C: common::Connector,
6106{
6107 /// Perform the operation you have build so far.
6108 pub async fn doit(mut self) -> common::Result<(common::Response, DevicesListResponse)> {
6109 use std::borrow::Cow;
6110 use std::io::{Read, Seek};
6111
6112 use common::{url::Params, ToParts};
6113 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6114
6115 let mut dd = common::DefaultDelegate;
6116 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6117 dlg.begin(common::MethodInfo {
6118 id: "androidenterprise.devices.list",
6119 http_method: hyper::Method::GET,
6120 });
6121
6122 for &field in ["alt", "enterpriseId", "userId"].iter() {
6123 if self._additional_params.contains_key(field) {
6124 dlg.finished(false);
6125 return Err(common::Error::FieldClash(field));
6126 }
6127 }
6128
6129 let mut params = Params::with_capacity(4 + self._additional_params.len());
6130 params.push("enterpriseId", self._enterprise_id);
6131 params.push("userId", self._user_id);
6132
6133 params.extend(self._additional_params.iter());
6134
6135 params.push("alt", "json");
6136 let mut url = self.hub._base_url.clone()
6137 + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices";
6138 if self._scopes.is_empty() {
6139 self._scopes.insert(Scope::Full.as_ref().to_string());
6140 }
6141
6142 #[allow(clippy::single_element_loop)]
6143 for &(find_this, param_name) in
6144 [("{enterpriseId}", "enterpriseId"), ("{userId}", "userId")].iter()
6145 {
6146 url = params.uri_replacement(url, param_name, find_this, false);
6147 }
6148 {
6149 let to_remove = ["userId", "enterpriseId"];
6150 params.remove_params(&to_remove);
6151 }
6152
6153 let url = params.parse_with_url(&url);
6154
6155 loop {
6156 let token = match self
6157 .hub
6158 .auth
6159 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6160 .await
6161 {
6162 Ok(token) => token,
6163 Err(e) => match dlg.token(e) {
6164 Ok(token) => token,
6165 Err(e) => {
6166 dlg.finished(false);
6167 return Err(common::Error::MissingToken(e));
6168 }
6169 },
6170 };
6171 let mut req_result = {
6172 let client = &self.hub.client;
6173 dlg.pre_request();
6174 let mut req_builder = hyper::Request::builder()
6175 .method(hyper::Method::GET)
6176 .uri(url.as_str())
6177 .header(USER_AGENT, self.hub._user_agent.clone());
6178
6179 if let Some(token) = token.as_ref() {
6180 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6181 }
6182
6183 let request = req_builder
6184 .header(CONTENT_LENGTH, 0_u64)
6185 .body(common::to_body::<String>(None));
6186
6187 client.request(request.unwrap()).await
6188 };
6189
6190 match req_result {
6191 Err(err) => {
6192 if let common::Retry::After(d) = dlg.http_error(&err) {
6193 sleep(d).await;
6194 continue;
6195 }
6196 dlg.finished(false);
6197 return Err(common::Error::HttpError(err));
6198 }
6199 Ok(res) => {
6200 let (mut parts, body) = res.into_parts();
6201 let mut body = common::Body::new(body);
6202 if !parts.status.is_success() {
6203 let bytes = common::to_bytes(body).await.unwrap_or_default();
6204 let error = serde_json::from_str(&common::to_string(&bytes));
6205 let response = common::to_response(parts, bytes.into());
6206
6207 if let common::Retry::After(d) =
6208 dlg.http_failure(&response, error.as_ref().ok())
6209 {
6210 sleep(d).await;
6211 continue;
6212 }
6213
6214 dlg.finished(false);
6215
6216 return Err(match error {
6217 Ok(value) => common::Error::BadRequest(value),
6218 _ => common::Error::Failure(response),
6219 });
6220 }
6221 let response = {
6222 let bytes = common::to_bytes(body).await.unwrap_or_default();
6223 let encoded = common::to_string(&bytes);
6224 match serde_json::from_str(&encoded) {
6225 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6226 Err(error) => {
6227 dlg.response_json_decode_error(&encoded, &error);
6228 return Err(common::Error::JsonDecodeError(
6229 encoded.to_string(),
6230 error,
6231 ));
6232 }
6233 }
6234 };
6235
6236 dlg.finished(true);
6237 return Ok(response);
6238 }
6239 }
6240 }
6241 }
6242
6243 /// The ID of the enterprise.
6244 ///
6245 /// Sets the *enterprise id* path property to the given value.
6246 ///
6247 /// Even though the property as already been set when instantiating this call,
6248 /// we provide this method for API completeness.
6249 pub fn enterprise_id(mut self, new_value: &str) -> DeviceListCall<'a, C> {
6250 self._enterprise_id = new_value.to_string();
6251 self
6252 }
6253 /// The ID of the user.
6254 ///
6255 /// Sets the *user id* path property to the given value.
6256 ///
6257 /// Even though the property as already been set when instantiating this call,
6258 /// we provide this method for API completeness.
6259 pub fn user_id(mut self, new_value: &str) -> DeviceListCall<'a, C> {
6260 self._user_id = new_value.to_string();
6261 self
6262 }
6263 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6264 /// while executing the actual API request.
6265 ///
6266 /// ````text
6267 /// It should be used to handle progress information, and to implement a certain level of resilience.
6268 /// ````
6269 ///
6270 /// Sets the *delegate* property to the given value.
6271 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DeviceListCall<'a, C> {
6272 self._delegate = Some(new_value);
6273 self
6274 }
6275
6276 /// Set any additional parameter of the query string used in the request.
6277 /// It should be used to set parameters which are not yet available through their own
6278 /// setters.
6279 ///
6280 /// Please note that this method must not be used to set any of the known parameters
6281 /// which have their own setter method. If done anyway, the request will fail.
6282 ///
6283 /// # Additional Parameters
6284 ///
6285 /// * *$.xgafv* (query-string) - V1 error format.
6286 /// * *access_token* (query-string) - OAuth access token.
6287 /// * *alt* (query-string) - Data format for response.
6288 /// * *callback* (query-string) - JSONP
6289 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6290 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6291 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6292 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6293 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6294 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6295 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6296 pub fn param<T>(mut self, name: T, value: T) -> DeviceListCall<'a, C>
6297 where
6298 T: AsRef<str>,
6299 {
6300 self._additional_params
6301 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6302 self
6303 }
6304
6305 /// Identifies the authorization scope for the method you are building.
6306 ///
6307 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6308 /// [`Scope::Full`].
6309 ///
6310 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6311 /// tokens for more than one scope.
6312 ///
6313 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6314 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6315 /// sufficient, a read-write scope will do as well.
6316 pub fn add_scope<St>(mut self, scope: St) -> DeviceListCall<'a, C>
6317 where
6318 St: AsRef<str>,
6319 {
6320 self._scopes.insert(String::from(scope.as_ref()));
6321 self
6322 }
6323 /// Identifies the authorization scope(s) for the method you are building.
6324 ///
6325 /// See [`Self::add_scope()`] for details.
6326 pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceListCall<'a, C>
6327 where
6328 I: IntoIterator<Item = St>,
6329 St: AsRef<str>,
6330 {
6331 self._scopes
6332 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6333 self
6334 }
6335
6336 /// Removes all scopes, and no default scope will be used either.
6337 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6338 /// for details).
6339 pub fn clear_scopes(mut self) -> DeviceListCall<'a, C> {
6340 self._scopes.clear();
6341 self
6342 }
6343}
6344
6345/// Sets whether a device's access to Google services is enabled or disabled. The device state takes effect only if enforcing EMM policies on Android devices is enabled in the Google Admin Console. Otherwise, the device state is ignored and all devices are allowed access to Google services. This is only supported for Google-managed users.
6346///
6347/// A builder for the *setState* method supported by a *device* resource.
6348/// It is not used directly, but through a [`DeviceMethods`] instance.
6349///
6350/// # Example
6351///
6352/// Instantiate a resource method builder
6353///
6354/// ```test_harness,no_run
6355/// # extern crate hyper;
6356/// # extern crate hyper_rustls;
6357/// # extern crate google_androidenterprise1 as androidenterprise1;
6358/// use androidenterprise1::api::DeviceState;
6359/// # async fn dox() {
6360/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6361///
6362/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6363/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6364/// # .with_native_roots()
6365/// # .unwrap()
6366/// # .https_only()
6367/// # .enable_http2()
6368/// # .build();
6369///
6370/// # let executor = hyper_util::rt::TokioExecutor::new();
6371/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6372/// # secret,
6373/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6374/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6375/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6376/// # ),
6377/// # ).build().await.unwrap();
6378///
6379/// # let client = hyper_util::client::legacy::Client::builder(
6380/// # hyper_util::rt::TokioExecutor::new()
6381/// # )
6382/// # .build(
6383/// # hyper_rustls::HttpsConnectorBuilder::new()
6384/// # .with_native_roots()
6385/// # .unwrap()
6386/// # .https_or_http()
6387/// # .enable_http2()
6388/// # .build()
6389/// # );
6390/// # let mut hub = AndroidEnterprise::new(client, auth);
6391/// // As the method needs a request, you would usually fill it with the desired information
6392/// // into the respective structure. Some of the parts shown here might not be applicable !
6393/// // Values shown here are possibly random and not representative !
6394/// let mut req = DeviceState::default();
6395///
6396/// // You can configure optional parameters by calling the respective setters at will, and
6397/// // execute the final call using `doit()`.
6398/// // Values shown here are possibly random and not representative !
6399/// let result = hub.devices().set_state(req, "enterpriseId", "userId", "deviceId")
6400/// .doit().await;
6401/// # }
6402/// ```
6403pub struct DeviceSetStateCall<'a, C>
6404where
6405 C: 'a,
6406{
6407 hub: &'a AndroidEnterprise<C>,
6408 _request: DeviceState,
6409 _enterprise_id: String,
6410 _user_id: String,
6411 _device_id: String,
6412 _delegate: Option<&'a mut dyn common::Delegate>,
6413 _additional_params: HashMap<String, String>,
6414 _scopes: BTreeSet<String>,
6415}
6416
6417impl<'a, C> common::CallBuilder for DeviceSetStateCall<'a, C> {}
6418
6419impl<'a, C> DeviceSetStateCall<'a, C>
6420where
6421 C: common::Connector,
6422{
6423 /// Perform the operation you have build so far.
6424 pub async fn doit(mut self) -> common::Result<(common::Response, DeviceState)> {
6425 use std::borrow::Cow;
6426 use std::io::{Read, Seek};
6427
6428 use common::{url::Params, ToParts};
6429 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6430
6431 let mut dd = common::DefaultDelegate;
6432 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6433 dlg.begin(common::MethodInfo {
6434 id: "androidenterprise.devices.setState",
6435 http_method: hyper::Method::PUT,
6436 });
6437
6438 for &field in ["alt", "enterpriseId", "userId", "deviceId"].iter() {
6439 if self._additional_params.contains_key(field) {
6440 dlg.finished(false);
6441 return Err(common::Error::FieldClash(field));
6442 }
6443 }
6444
6445 let mut params = Params::with_capacity(6 + self._additional_params.len());
6446 params.push("enterpriseId", self._enterprise_id);
6447 params.push("userId", self._user_id);
6448 params.push("deviceId", self._device_id);
6449
6450 params.extend(self._additional_params.iter());
6451
6452 params.push("alt", "json");
6453 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/state";
6454 if self._scopes.is_empty() {
6455 self._scopes.insert(Scope::Full.as_ref().to_string());
6456 }
6457
6458 #[allow(clippy::single_element_loop)]
6459 for &(find_this, param_name) in [
6460 ("{enterpriseId}", "enterpriseId"),
6461 ("{userId}", "userId"),
6462 ("{deviceId}", "deviceId"),
6463 ]
6464 .iter()
6465 {
6466 url = params.uri_replacement(url, param_name, find_this, false);
6467 }
6468 {
6469 let to_remove = ["deviceId", "userId", "enterpriseId"];
6470 params.remove_params(&to_remove);
6471 }
6472
6473 let url = params.parse_with_url(&url);
6474
6475 let mut json_mime_type = mime::APPLICATION_JSON;
6476 let mut request_value_reader = {
6477 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6478 common::remove_json_null_values(&mut value);
6479 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6480 serde_json::to_writer(&mut dst, &value).unwrap();
6481 dst
6482 };
6483 let request_size = request_value_reader
6484 .seek(std::io::SeekFrom::End(0))
6485 .unwrap();
6486 request_value_reader
6487 .seek(std::io::SeekFrom::Start(0))
6488 .unwrap();
6489
6490 loop {
6491 let token = match self
6492 .hub
6493 .auth
6494 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6495 .await
6496 {
6497 Ok(token) => token,
6498 Err(e) => match dlg.token(e) {
6499 Ok(token) => token,
6500 Err(e) => {
6501 dlg.finished(false);
6502 return Err(common::Error::MissingToken(e));
6503 }
6504 },
6505 };
6506 request_value_reader
6507 .seek(std::io::SeekFrom::Start(0))
6508 .unwrap();
6509 let mut req_result = {
6510 let client = &self.hub.client;
6511 dlg.pre_request();
6512 let mut req_builder = hyper::Request::builder()
6513 .method(hyper::Method::PUT)
6514 .uri(url.as_str())
6515 .header(USER_AGENT, self.hub._user_agent.clone());
6516
6517 if let Some(token) = token.as_ref() {
6518 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6519 }
6520
6521 let request = req_builder
6522 .header(CONTENT_TYPE, json_mime_type.to_string())
6523 .header(CONTENT_LENGTH, request_size as u64)
6524 .body(common::to_body(
6525 request_value_reader.get_ref().clone().into(),
6526 ));
6527
6528 client.request(request.unwrap()).await
6529 };
6530
6531 match req_result {
6532 Err(err) => {
6533 if let common::Retry::After(d) = dlg.http_error(&err) {
6534 sleep(d).await;
6535 continue;
6536 }
6537 dlg.finished(false);
6538 return Err(common::Error::HttpError(err));
6539 }
6540 Ok(res) => {
6541 let (mut parts, body) = res.into_parts();
6542 let mut body = common::Body::new(body);
6543 if !parts.status.is_success() {
6544 let bytes = common::to_bytes(body).await.unwrap_or_default();
6545 let error = serde_json::from_str(&common::to_string(&bytes));
6546 let response = common::to_response(parts, bytes.into());
6547
6548 if let common::Retry::After(d) =
6549 dlg.http_failure(&response, error.as_ref().ok())
6550 {
6551 sleep(d).await;
6552 continue;
6553 }
6554
6555 dlg.finished(false);
6556
6557 return Err(match error {
6558 Ok(value) => common::Error::BadRequest(value),
6559 _ => common::Error::Failure(response),
6560 });
6561 }
6562 let response = {
6563 let bytes = common::to_bytes(body).await.unwrap_or_default();
6564 let encoded = common::to_string(&bytes);
6565 match serde_json::from_str(&encoded) {
6566 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6567 Err(error) => {
6568 dlg.response_json_decode_error(&encoded, &error);
6569 return Err(common::Error::JsonDecodeError(
6570 encoded.to_string(),
6571 error,
6572 ));
6573 }
6574 }
6575 };
6576
6577 dlg.finished(true);
6578 return Ok(response);
6579 }
6580 }
6581 }
6582 }
6583
6584 ///
6585 /// Sets the *request* property to the given value.
6586 ///
6587 /// Even though the property as already been set when instantiating this call,
6588 /// we provide this method for API completeness.
6589 pub fn request(mut self, new_value: DeviceState) -> DeviceSetStateCall<'a, C> {
6590 self._request = new_value;
6591 self
6592 }
6593 /// The ID of the enterprise.
6594 ///
6595 /// Sets the *enterprise id* path property to the given value.
6596 ///
6597 /// Even though the property as already been set when instantiating this call,
6598 /// we provide this method for API completeness.
6599 pub fn enterprise_id(mut self, new_value: &str) -> DeviceSetStateCall<'a, C> {
6600 self._enterprise_id = new_value.to_string();
6601 self
6602 }
6603 /// The ID of the user.
6604 ///
6605 /// Sets the *user id* path property to the given value.
6606 ///
6607 /// Even though the property as already been set when instantiating this call,
6608 /// we provide this method for API completeness.
6609 pub fn user_id(mut self, new_value: &str) -> DeviceSetStateCall<'a, C> {
6610 self._user_id = new_value.to_string();
6611 self
6612 }
6613 /// The ID of the device.
6614 ///
6615 /// Sets the *device id* path property to the given value.
6616 ///
6617 /// Even though the property as already been set when instantiating this call,
6618 /// we provide this method for API completeness.
6619 pub fn device_id(mut self, new_value: &str) -> DeviceSetStateCall<'a, C> {
6620 self._device_id = new_value.to_string();
6621 self
6622 }
6623 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6624 /// while executing the actual API request.
6625 ///
6626 /// ````text
6627 /// It should be used to handle progress information, and to implement a certain level of resilience.
6628 /// ````
6629 ///
6630 /// Sets the *delegate* property to the given value.
6631 pub fn delegate(
6632 mut self,
6633 new_value: &'a mut dyn common::Delegate,
6634 ) -> DeviceSetStateCall<'a, C> {
6635 self._delegate = Some(new_value);
6636 self
6637 }
6638
6639 /// Set any additional parameter of the query string used in the request.
6640 /// It should be used to set parameters which are not yet available through their own
6641 /// setters.
6642 ///
6643 /// Please note that this method must not be used to set any of the known parameters
6644 /// which have their own setter method. If done anyway, the request will fail.
6645 ///
6646 /// # Additional Parameters
6647 ///
6648 /// * *$.xgafv* (query-string) - V1 error format.
6649 /// * *access_token* (query-string) - OAuth access token.
6650 /// * *alt* (query-string) - Data format for response.
6651 /// * *callback* (query-string) - JSONP
6652 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6653 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6654 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6655 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6656 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6657 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6658 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6659 pub fn param<T>(mut self, name: T, value: T) -> DeviceSetStateCall<'a, C>
6660 where
6661 T: AsRef<str>,
6662 {
6663 self._additional_params
6664 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6665 self
6666 }
6667
6668 /// Identifies the authorization scope for the method you are building.
6669 ///
6670 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6671 /// [`Scope::Full`].
6672 ///
6673 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6674 /// tokens for more than one scope.
6675 ///
6676 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6677 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6678 /// sufficient, a read-write scope will do as well.
6679 pub fn add_scope<St>(mut self, scope: St) -> DeviceSetStateCall<'a, C>
6680 where
6681 St: AsRef<str>,
6682 {
6683 self._scopes.insert(String::from(scope.as_ref()));
6684 self
6685 }
6686 /// Identifies the authorization scope(s) for the method you are building.
6687 ///
6688 /// See [`Self::add_scope()`] for details.
6689 pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceSetStateCall<'a, C>
6690 where
6691 I: IntoIterator<Item = St>,
6692 St: AsRef<str>,
6693 {
6694 self._scopes
6695 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6696 self
6697 }
6698
6699 /// Removes all scopes, and no default scope will be used either.
6700 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6701 /// for details).
6702 pub fn clear_scopes(mut self) -> DeviceSetStateCall<'a, C> {
6703 self._scopes.clear();
6704 self
6705 }
6706}
6707
6708/// Updates the device policy. To ensure the policy is properly enforced, you need to prevent unmanaged accounts from accessing Google Play by setting the allowed_accounts in the managed configuration for the Google Play package. See restrict accounts in Google Play. When provisioning a new device, you should set the device policy using this method before adding the managed Google Play Account to the device, otherwise the policy will not be applied for a short period of time after adding the account to the device.
6709///
6710/// A builder for the *update* method supported by a *device* resource.
6711/// It is not used directly, but through a [`DeviceMethods`] instance.
6712///
6713/// # Example
6714///
6715/// Instantiate a resource method builder
6716///
6717/// ```test_harness,no_run
6718/// # extern crate hyper;
6719/// # extern crate hyper_rustls;
6720/// # extern crate google_androidenterprise1 as androidenterprise1;
6721/// use androidenterprise1::api::Device;
6722/// # async fn dox() {
6723/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6724///
6725/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6726/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6727/// # .with_native_roots()
6728/// # .unwrap()
6729/// # .https_only()
6730/// # .enable_http2()
6731/// # .build();
6732///
6733/// # let executor = hyper_util::rt::TokioExecutor::new();
6734/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6735/// # secret,
6736/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6737/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6738/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6739/// # ),
6740/// # ).build().await.unwrap();
6741///
6742/// # let client = hyper_util::client::legacy::Client::builder(
6743/// # hyper_util::rt::TokioExecutor::new()
6744/// # )
6745/// # .build(
6746/// # hyper_rustls::HttpsConnectorBuilder::new()
6747/// # .with_native_roots()
6748/// # .unwrap()
6749/// # .https_or_http()
6750/// # .enable_http2()
6751/// # .build()
6752/// # );
6753/// # let mut hub = AndroidEnterprise::new(client, auth);
6754/// // As the method needs a request, you would usually fill it with the desired information
6755/// // into the respective structure. Some of the parts shown here might not be applicable !
6756/// // Values shown here are possibly random and not representative !
6757/// let mut req = Device::default();
6758///
6759/// // You can configure optional parameters by calling the respective setters at will, and
6760/// // execute the final call using `doit()`.
6761/// // Values shown here are possibly random and not representative !
6762/// let result = hub.devices().update(req, "enterpriseId", "userId", "deviceId")
6763/// .update_mask("gubergren")
6764/// .doit().await;
6765/// # }
6766/// ```
6767pub struct DeviceUpdateCall<'a, C>
6768where
6769 C: 'a,
6770{
6771 hub: &'a AndroidEnterprise<C>,
6772 _request: Device,
6773 _enterprise_id: String,
6774 _user_id: String,
6775 _device_id: String,
6776 _update_mask: Option<String>,
6777 _delegate: Option<&'a mut dyn common::Delegate>,
6778 _additional_params: HashMap<String, String>,
6779 _scopes: BTreeSet<String>,
6780}
6781
6782impl<'a, C> common::CallBuilder for DeviceUpdateCall<'a, C> {}
6783
6784impl<'a, C> DeviceUpdateCall<'a, C>
6785where
6786 C: common::Connector,
6787{
6788 /// Perform the operation you have build so far.
6789 pub async fn doit(mut self) -> common::Result<(common::Response, Device)> {
6790 use std::borrow::Cow;
6791 use std::io::{Read, Seek};
6792
6793 use common::{url::Params, ToParts};
6794 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6795
6796 let mut dd = common::DefaultDelegate;
6797 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6798 dlg.begin(common::MethodInfo {
6799 id: "androidenterprise.devices.update",
6800 http_method: hyper::Method::PUT,
6801 });
6802
6803 for &field in ["alt", "enterpriseId", "userId", "deviceId", "updateMask"].iter() {
6804 if self._additional_params.contains_key(field) {
6805 dlg.finished(false);
6806 return Err(common::Error::FieldClash(field));
6807 }
6808 }
6809
6810 let mut params = Params::with_capacity(7 + self._additional_params.len());
6811 params.push("enterpriseId", self._enterprise_id);
6812 params.push("userId", self._user_id);
6813 params.push("deviceId", self._device_id);
6814 if let Some(value) = self._update_mask.as_ref() {
6815 params.push("updateMask", value);
6816 }
6817
6818 params.extend(self._additional_params.iter());
6819
6820 params.push("alt", "json");
6821 let mut url = self.hub._base_url.clone()
6822 + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}";
6823 if self._scopes.is_empty() {
6824 self._scopes.insert(Scope::Full.as_ref().to_string());
6825 }
6826
6827 #[allow(clippy::single_element_loop)]
6828 for &(find_this, param_name) in [
6829 ("{enterpriseId}", "enterpriseId"),
6830 ("{userId}", "userId"),
6831 ("{deviceId}", "deviceId"),
6832 ]
6833 .iter()
6834 {
6835 url = params.uri_replacement(url, param_name, find_this, false);
6836 }
6837 {
6838 let to_remove = ["deviceId", "userId", "enterpriseId"];
6839 params.remove_params(&to_remove);
6840 }
6841
6842 let url = params.parse_with_url(&url);
6843
6844 let mut json_mime_type = mime::APPLICATION_JSON;
6845 let mut request_value_reader = {
6846 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6847 common::remove_json_null_values(&mut value);
6848 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6849 serde_json::to_writer(&mut dst, &value).unwrap();
6850 dst
6851 };
6852 let request_size = request_value_reader
6853 .seek(std::io::SeekFrom::End(0))
6854 .unwrap();
6855 request_value_reader
6856 .seek(std::io::SeekFrom::Start(0))
6857 .unwrap();
6858
6859 loop {
6860 let token = match self
6861 .hub
6862 .auth
6863 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6864 .await
6865 {
6866 Ok(token) => token,
6867 Err(e) => match dlg.token(e) {
6868 Ok(token) => token,
6869 Err(e) => {
6870 dlg.finished(false);
6871 return Err(common::Error::MissingToken(e));
6872 }
6873 },
6874 };
6875 request_value_reader
6876 .seek(std::io::SeekFrom::Start(0))
6877 .unwrap();
6878 let mut req_result = {
6879 let client = &self.hub.client;
6880 dlg.pre_request();
6881 let mut req_builder = hyper::Request::builder()
6882 .method(hyper::Method::PUT)
6883 .uri(url.as_str())
6884 .header(USER_AGENT, self.hub._user_agent.clone());
6885
6886 if let Some(token) = token.as_ref() {
6887 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6888 }
6889
6890 let request = req_builder
6891 .header(CONTENT_TYPE, json_mime_type.to_string())
6892 .header(CONTENT_LENGTH, request_size as u64)
6893 .body(common::to_body(
6894 request_value_reader.get_ref().clone().into(),
6895 ));
6896
6897 client.request(request.unwrap()).await
6898 };
6899
6900 match req_result {
6901 Err(err) => {
6902 if let common::Retry::After(d) = dlg.http_error(&err) {
6903 sleep(d).await;
6904 continue;
6905 }
6906 dlg.finished(false);
6907 return Err(common::Error::HttpError(err));
6908 }
6909 Ok(res) => {
6910 let (mut parts, body) = res.into_parts();
6911 let mut body = common::Body::new(body);
6912 if !parts.status.is_success() {
6913 let bytes = common::to_bytes(body).await.unwrap_or_default();
6914 let error = serde_json::from_str(&common::to_string(&bytes));
6915 let response = common::to_response(parts, bytes.into());
6916
6917 if let common::Retry::After(d) =
6918 dlg.http_failure(&response, error.as_ref().ok())
6919 {
6920 sleep(d).await;
6921 continue;
6922 }
6923
6924 dlg.finished(false);
6925
6926 return Err(match error {
6927 Ok(value) => common::Error::BadRequest(value),
6928 _ => common::Error::Failure(response),
6929 });
6930 }
6931 let response = {
6932 let bytes = common::to_bytes(body).await.unwrap_or_default();
6933 let encoded = common::to_string(&bytes);
6934 match serde_json::from_str(&encoded) {
6935 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6936 Err(error) => {
6937 dlg.response_json_decode_error(&encoded, &error);
6938 return Err(common::Error::JsonDecodeError(
6939 encoded.to_string(),
6940 error,
6941 ));
6942 }
6943 }
6944 };
6945
6946 dlg.finished(true);
6947 return Ok(response);
6948 }
6949 }
6950 }
6951 }
6952
6953 ///
6954 /// Sets the *request* property to the given value.
6955 ///
6956 /// Even though the property as already been set when instantiating this call,
6957 /// we provide this method for API completeness.
6958 pub fn request(mut self, new_value: Device) -> DeviceUpdateCall<'a, C> {
6959 self._request = new_value;
6960 self
6961 }
6962 /// The ID of the enterprise.
6963 ///
6964 /// Sets the *enterprise id* path property to the given value.
6965 ///
6966 /// Even though the property as already been set when instantiating this call,
6967 /// we provide this method for API completeness.
6968 pub fn enterprise_id(mut self, new_value: &str) -> DeviceUpdateCall<'a, C> {
6969 self._enterprise_id = new_value.to_string();
6970 self
6971 }
6972 /// The ID of the user.
6973 ///
6974 /// Sets the *user id* path property to the given value.
6975 ///
6976 /// Even though the property as already been set when instantiating this call,
6977 /// we provide this method for API completeness.
6978 pub fn user_id(mut self, new_value: &str) -> DeviceUpdateCall<'a, C> {
6979 self._user_id = new_value.to_string();
6980 self
6981 }
6982 /// The ID of the device.
6983 ///
6984 /// Sets the *device id* path property to the given value.
6985 ///
6986 /// Even though the property as already been set when instantiating this call,
6987 /// we provide this method for API completeness.
6988 pub fn device_id(mut self, new_value: &str) -> DeviceUpdateCall<'a, C> {
6989 self._device_id = new_value.to_string();
6990 self
6991 }
6992 /// Mask that identifies which fields to update. If not set, all modifiable fields will be modified. When set in a query parameter, this field should be specified as updateMask=<field1>,<field2>,...
6993 ///
6994 /// Sets the *update mask* query property to the given value.
6995 pub fn update_mask(mut self, new_value: &str) -> DeviceUpdateCall<'a, C> {
6996 self._update_mask = Some(new_value.to_string());
6997 self
6998 }
6999 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7000 /// while executing the actual API request.
7001 ///
7002 /// ````text
7003 /// It should be used to handle progress information, and to implement a certain level of resilience.
7004 /// ````
7005 ///
7006 /// Sets the *delegate* property to the given value.
7007 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DeviceUpdateCall<'a, C> {
7008 self._delegate = Some(new_value);
7009 self
7010 }
7011
7012 /// Set any additional parameter of the query string used in the request.
7013 /// It should be used to set parameters which are not yet available through their own
7014 /// setters.
7015 ///
7016 /// Please note that this method must not be used to set any of the known parameters
7017 /// which have their own setter method. If done anyway, the request will fail.
7018 ///
7019 /// # Additional Parameters
7020 ///
7021 /// * *$.xgafv* (query-string) - V1 error format.
7022 /// * *access_token* (query-string) - OAuth access token.
7023 /// * *alt* (query-string) - Data format for response.
7024 /// * *callback* (query-string) - JSONP
7025 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7026 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7027 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7028 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7029 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7030 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7031 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7032 pub fn param<T>(mut self, name: T, value: T) -> DeviceUpdateCall<'a, C>
7033 where
7034 T: AsRef<str>,
7035 {
7036 self._additional_params
7037 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7038 self
7039 }
7040
7041 /// Identifies the authorization scope for the method you are building.
7042 ///
7043 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7044 /// [`Scope::Full`].
7045 ///
7046 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7047 /// tokens for more than one scope.
7048 ///
7049 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7050 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7051 /// sufficient, a read-write scope will do as well.
7052 pub fn add_scope<St>(mut self, scope: St) -> DeviceUpdateCall<'a, C>
7053 where
7054 St: AsRef<str>,
7055 {
7056 self._scopes.insert(String::from(scope.as_ref()));
7057 self
7058 }
7059 /// Identifies the authorization scope(s) for the method you are building.
7060 ///
7061 /// See [`Self::add_scope()`] for details.
7062 pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceUpdateCall<'a, C>
7063 where
7064 I: IntoIterator<Item = St>,
7065 St: AsRef<str>,
7066 {
7067 self._scopes
7068 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7069 self
7070 }
7071
7072 /// Removes all scopes, and no default scope will be used either.
7073 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7074 /// for details).
7075 pub fn clear_scopes(mut self) -> DeviceUpdateCall<'a, C> {
7076 self._scopes.clear();
7077 self
7078 }
7079}
7080
7081/// Returns a token for device enrollment. The DPC can encode this token within the QR/NFC/zero-touch enrollment payload or fetch it before calling the on-device API to authenticate the user. The token can be generated for each device or reused across multiple devices.
7082///
7083/// A builder for the *create* method supported by a *enrollmentToken* resource.
7084/// It is not used directly, but through a [`EnrollmentTokenMethods`] instance.
7085///
7086/// # Example
7087///
7088/// Instantiate a resource method builder
7089///
7090/// ```test_harness,no_run
7091/// # extern crate hyper;
7092/// # extern crate hyper_rustls;
7093/// # extern crate google_androidenterprise1 as androidenterprise1;
7094/// use androidenterprise1::api::EnrollmentToken;
7095/// # async fn dox() {
7096/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7097///
7098/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7099/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7100/// # .with_native_roots()
7101/// # .unwrap()
7102/// # .https_only()
7103/// # .enable_http2()
7104/// # .build();
7105///
7106/// # let executor = hyper_util::rt::TokioExecutor::new();
7107/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7108/// # secret,
7109/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7110/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7111/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7112/// # ),
7113/// # ).build().await.unwrap();
7114///
7115/// # let client = hyper_util::client::legacy::Client::builder(
7116/// # hyper_util::rt::TokioExecutor::new()
7117/// # )
7118/// # .build(
7119/// # hyper_rustls::HttpsConnectorBuilder::new()
7120/// # .with_native_roots()
7121/// # .unwrap()
7122/// # .https_or_http()
7123/// # .enable_http2()
7124/// # .build()
7125/// # );
7126/// # let mut hub = AndroidEnterprise::new(client, auth);
7127/// // As the method needs a request, you would usually fill it with the desired information
7128/// // into the respective structure. Some of the parts shown here might not be applicable !
7129/// // Values shown here are possibly random and not representative !
7130/// let mut req = EnrollmentToken::default();
7131///
7132/// // You can configure optional parameters by calling the respective setters at will, and
7133/// // execute the final call using `doit()`.
7134/// // Values shown here are possibly random and not representative !
7135/// let result = hub.enrollment_tokens().create(req, "enterpriseId")
7136/// .doit().await;
7137/// # }
7138/// ```
7139pub struct EnrollmentTokenCreateCall<'a, C>
7140where
7141 C: 'a,
7142{
7143 hub: &'a AndroidEnterprise<C>,
7144 _request: EnrollmentToken,
7145 _enterprise_id: String,
7146 _delegate: Option<&'a mut dyn common::Delegate>,
7147 _additional_params: HashMap<String, String>,
7148 _scopes: BTreeSet<String>,
7149}
7150
7151impl<'a, C> common::CallBuilder for EnrollmentTokenCreateCall<'a, C> {}
7152
7153impl<'a, C> EnrollmentTokenCreateCall<'a, C>
7154where
7155 C: common::Connector,
7156{
7157 /// Perform the operation you have build so far.
7158 pub async fn doit(mut self) -> common::Result<(common::Response, EnrollmentToken)> {
7159 use std::borrow::Cow;
7160 use std::io::{Read, Seek};
7161
7162 use common::{url::Params, ToParts};
7163 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7164
7165 let mut dd = common::DefaultDelegate;
7166 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7167 dlg.begin(common::MethodInfo {
7168 id: "androidenterprise.enrollmentTokens.create",
7169 http_method: hyper::Method::POST,
7170 });
7171
7172 for &field in ["alt", "enterpriseId"].iter() {
7173 if self._additional_params.contains_key(field) {
7174 dlg.finished(false);
7175 return Err(common::Error::FieldClash(field));
7176 }
7177 }
7178
7179 let mut params = Params::with_capacity(4 + self._additional_params.len());
7180 params.push("enterpriseId", self._enterprise_id);
7181
7182 params.extend(self._additional_params.iter());
7183
7184 params.push("alt", "json");
7185 let mut url = self.hub._base_url.clone()
7186 + "androidenterprise/v1/enterprises/{enterpriseId}/enrollmentTokens";
7187 if self._scopes.is_empty() {
7188 self._scopes.insert(Scope::Full.as_ref().to_string());
7189 }
7190
7191 #[allow(clippy::single_element_loop)]
7192 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
7193 url = params.uri_replacement(url, param_name, find_this, false);
7194 }
7195 {
7196 let to_remove = ["enterpriseId"];
7197 params.remove_params(&to_remove);
7198 }
7199
7200 let url = params.parse_with_url(&url);
7201
7202 let mut json_mime_type = mime::APPLICATION_JSON;
7203 let mut request_value_reader = {
7204 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7205 common::remove_json_null_values(&mut value);
7206 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7207 serde_json::to_writer(&mut dst, &value).unwrap();
7208 dst
7209 };
7210 let request_size = request_value_reader
7211 .seek(std::io::SeekFrom::End(0))
7212 .unwrap();
7213 request_value_reader
7214 .seek(std::io::SeekFrom::Start(0))
7215 .unwrap();
7216
7217 loop {
7218 let token = match self
7219 .hub
7220 .auth
7221 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7222 .await
7223 {
7224 Ok(token) => token,
7225 Err(e) => match dlg.token(e) {
7226 Ok(token) => token,
7227 Err(e) => {
7228 dlg.finished(false);
7229 return Err(common::Error::MissingToken(e));
7230 }
7231 },
7232 };
7233 request_value_reader
7234 .seek(std::io::SeekFrom::Start(0))
7235 .unwrap();
7236 let mut req_result = {
7237 let client = &self.hub.client;
7238 dlg.pre_request();
7239 let mut req_builder = hyper::Request::builder()
7240 .method(hyper::Method::POST)
7241 .uri(url.as_str())
7242 .header(USER_AGENT, self.hub._user_agent.clone());
7243
7244 if let Some(token) = token.as_ref() {
7245 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7246 }
7247
7248 let request = req_builder
7249 .header(CONTENT_TYPE, json_mime_type.to_string())
7250 .header(CONTENT_LENGTH, request_size as u64)
7251 .body(common::to_body(
7252 request_value_reader.get_ref().clone().into(),
7253 ));
7254
7255 client.request(request.unwrap()).await
7256 };
7257
7258 match req_result {
7259 Err(err) => {
7260 if let common::Retry::After(d) = dlg.http_error(&err) {
7261 sleep(d).await;
7262 continue;
7263 }
7264 dlg.finished(false);
7265 return Err(common::Error::HttpError(err));
7266 }
7267 Ok(res) => {
7268 let (mut parts, body) = res.into_parts();
7269 let mut body = common::Body::new(body);
7270 if !parts.status.is_success() {
7271 let bytes = common::to_bytes(body).await.unwrap_or_default();
7272 let error = serde_json::from_str(&common::to_string(&bytes));
7273 let response = common::to_response(parts, bytes.into());
7274
7275 if let common::Retry::After(d) =
7276 dlg.http_failure(&response, error.as_ref().ok())
7277 {
7278 sleep(d).await;
7279 continue;
7280 }
7281
7282 dlg.finished(false);
7283
7284 return Err(match error {
7285 Ok(value) => common::Error::BadRequest(value),
7286 _ => common::Error::Failure(response),
7287 });
7288 }
7289 let response = {
7290 let bytes = common::to_bytes(body).await.unwrap_or_default();
7291 let encoded = common::to_string(&bytes);
7292 match serde_json::from_str(&encoded) {
7293 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7294 Err(error) => {
7295 dlg.response_json_decode_error(&encoded, &error);
7296 return Err(common::Error::JsonDecodeError(
7297 encoded.to_string(),
7298 error,
7299 ));
7300 }
7301 }
7302 };
7303
7304 dlg.finished(true);
7305 return Ok(response);
7306 }
7307 }
7308 }
7309 }
7310
7311 ///
7312 /// Sets the *request* property to the given value.
7313 ///
7314 /// Even though the property as already been set when instantiating this call,
7315 /// we provide this method for API completeness.
7316 pub fn request(mut self, new_value: EnrollmentToken) -> EnrollmentTokenCreateCall<'a, C> {
7317 self._request = new_value;
7318 self
7319 }
7320 /// Required. The ID of the enterprise.
7321 ///
7322 /// Sets the *enterprise id* path property to the given value.
7323 ///
7324 /// Even though the property as already been set when instantiating this call,
7325 /// we provide this method for API completeness.
7326 pub fn enterprise_id(mut self, new_value: &str) -> EnrollmentTokenCreateCall<'a, C> {
7327 self._enterprise_id = new_value.to_string();
7328 self
7329 }
7330 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7331 /// while executing the actual API request.
7332 ///
7333 /// ````text
7334 /// It should be used to handle progress information, and to implement a certain level of resilience.
7335 /// ````
7336 ///
7337 /// Sets the *delegate* property to the given value.
7338 pub fn delegate(
7339 mut self,
7340 new_value: &'a mut dyn common::Delegate,
7341 ) -> EnrollmentTokenCreateCall<'a, C> {
7342 self._delegate = Some(new_value);
7343 self
7344 }
7345
7346 /// Set any additional parameter of the query string used in the request.
7347 /// It should be used to set parameters which are not yet available through their own
7348 /// setters.
7349 ///
7350 /// Please note that this method must not be used to set any of the known parameters
7351 /// which have their own setter method. If done anyway, the request will fail.
7352 ///
7353 /// # Additional Parameters
7354 ///
7355 /// * *$.xgafv* (query-string) - V1 error format.
7356 /// * *access_token* (query-string) - OAuth access token.
7357 /// * *alt* (query-string) - Data format for response.
7358 /// * *callback* (query-string) - JSONP
7359 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7360 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7361 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7362 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7363 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7364 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7365 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7366 pub fn param<T>(mut self, name: T, value: T) -> EnrollmentTokenCreateCall<'a, C>
7367 where
7368 T: AsRef<str>,
7369 {
7370 self._additional_params
7371 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7372 self
7373 }
7374
7375 /// Identifies the authorization scope for the method you are building.
7376 ///
7377 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7378 /// [`Scope::Full`].
7379 ///
7380 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7381 /// tokens for more than one scope.
7382 ///
7383 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7384 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7385 /// sufficient, a read-write scope will do as well.
7386 pub fn add_scope<St>(mut self, scope: St) -> EnrollmentTokenCreateCall<'a, C>
7387 where
7388 St: AsRef<str>,
7389 {
7390 self._scopes.insert(String::from(scope.as_ref()));
7391 self
7392 }
7393 /// Identifies the authorization scope(s) for the method you are building.
7394 ///
7395 /// See [`Self::add_scope()`] for details.
7396 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnrollmentTokenCreateCall<'a, C>
7397 where
7398 I: IntoIterator<Item = St>,
7399 St: AsRef<str>,
7400 {
7401 self._scopes
7402 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7403 self
7404 }
7405
7406 /// Removes all scopes, and no default scope will be used either.
7407 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7408 /// for details).
7409 pub fn clear_scopes(mut self) -> EnrollmentTokenCreateCall<'a, C> {
7410 self._scopes.clear();
7411 self
7412 }
7413}
7414
7415/// Acknowledges notifications that were received from Enterprises.PullNotificationSet to prevent subsequent calls from returning the same notifications.
7416///
7417/// A builder for the *acknowledgeNotificationSet* method supported by a *enterprise* resource.
7418/// It is not used directly, but through a [`EnterpriseMethods`] instance.
7419///
7420/// # Example
7421///
7422/// Instantiate a resource method builder
7423///
7424/// ```test_harness,no_run
7425/// # extern crate hyper;
7426/// # extern crate hyper_rustls;
7427/// # extern crate google_androidenterprise1 as androidenterprise1;
7428/// # async fn dox() {
7429/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7430///
7431/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7432/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7433/// # .with_native_roots()
7434/// # .unwrap()
7435/// # .https_only()
7436/// # .enable_http2()
7437/// # .build();
7438///
7439/// # let executor = hyper_util::rt::TokioExecutor::new();
7440/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7441/// # secret,
7442/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7443/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7444/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7445/// # ),
7446/// # ).build().await.unwrap();
7447///
7448/// # let client = hyper_util::client::legacy::Client::builder(
7449/// # hyper_util::rt::TokioExecutor::new()
7450/// # )
7451/// # .build(
7452/// # hyper_rustls::HttpsConnectorBuilder::new()
7453/// # .with_native_roots()
7454/// # .unwrap()
7455/// # .https_or_http()
7456/// # .enable_http2()
7457/// # .build()
7458/// # );
7459/// # let mut hub = AndroidEnterprise::new(client, auth);
7460/// // You can configure optional parameters by calling the respective setters at will, and
7461/// // execute the final call using `doit()`.
7462/// // Values shown here are possibly random and not representative !
7463/// let result = hub.enterprises().acknowledge_notification_set()
7464/// .notification_set_id("est")
7465/// .doit().await;
7466/// # }
7467/// ```
7468pub struct EnterpriseAcknowledgeNotificationSetCall<'a, C>
7469where
7470 C: 'a,
7471{
7472 hub: &'a AndroidEnterprise<C>,
7473 _notification_set_id: Option<String>,
7474 _delegate: Option<&'a mut dyn common::Delegate>,
7475 _additional_params: HashMap<String, String>,
7476 _scopes: BTreeSet<String>,
7477}
7478
7479impl<'a, C> common::CallBuilder for EnterpriseAcknowledgeNotificationSetCall<'a, C> {}
7480
7481impl<'a, C> EnterpriseAcknowledgeNotificationSetCall<'a, C>
7482where
7483 C: common::Connector,
7484{
7485 /// Perform the operation you have build so far.
7486 pub async fn doit(mut self) -> common::Result<common::Response> {
7487 use std::borrow::Cow;
7488 use std::io::{Read, Seek};
7489
7490 use common::{url::Params, ToParts};
7491 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7492
7493 let mut dd = common::DefaultDelegate;
7494 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7495 dlg.begin(common::MethodInfo {
7496 id: "androidenterprise.enterprises.acknowledgeNotificationSet",
7497 http_method: hyper::Method::POST,
7498 });
7499
7500 for &field in ["notificationSetId"].iter() {
7501 if self._additional_params.contains_key(field) {
7502 dlg.finished(false);
7503 return Err(common::Error::FieldClash(field));
7504 }
7505 }
7506
7507 let mut params = Params::with_capacity(2 + self._additional_params.len());
7508 if let Some(value) = self._notification_set_id.as_ref() {
7509 params.push("notificationSetId", value);
7510 }
7511
7512 params.extend(self._additional_params.iter());
7513
7514 let mut url = self.hub._base_url.clone()
7515 + "androidenterprise/v1/enterprises/acknowledgeNotificationSet";
7516 if self._scopes.is_empty() {
7517 self._scopes.insert(Scope::Full.as_ref().to_string());
7518 }
7519
7520 let url = params.parse_with_url(&url);
7521
7522 loop {
7523 let token = match self
7524 .hub
7525 .auth
7526 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7527 .await
7528 {
7529 Ok(token) => token,
7530 Err(e) => match dlg.token(e) {
7531 Ok(token) => token,
7532 Err(e) => {
7533 dlg.finished(false);
7534 return Err(common::Error::MissingToken(e));
7535 }
7536 },
7537 };
7538 let mut req_result = {
7539 let client = &self.hub.client;
7540 dlg.pre_request();
7541 let mut req_builder = hyper::Request::builder()
7542 .method(hyper::Method::POST)
7543 .uri(url.as_str())
7544 .header(USER_AGENT, self.hub._user_agent.clone());
7545
7546 if let Some(token) = token.as_ref() {
7547 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7548 }
7549
7550 let request = req_builder
7551 .header(CONTENT_LENGTH, 0_u64)
7552 .body(common::to_body::<String>(None));
7553
7554 client.request(request.unwrap()).await
7555 };
7556
7557 match req_result {
7558 Err(err) => {
7559 if let common::Retry::After(d) = dlg.http_error(&err) {
7560 sleep(d).await;
7561 continue;
7562 }
7563 dlg.finished(false);
7564 return Err(common::Error::HttpError(err));
7565 }
7566 Ok(res) => {
7567 let (mut parts, body) = res.into_parts();
7568 let mut body = common::Body::new(body);
7569 if !parts.status.is_success() {
7570 let bytes = common::to_bytes(body).await.unwrap_or_default();
7571 let error = serde_json::from_str(&common::to_string(&bytes));
7572 let response = common::to_response(parts, bytes.into());
7573
7574 if let common::Retry::After(d) =
7575 dlg.http_failure(&response, error.as_ref().ok())
7576 {
7577 sleep(d).await;
7578 continue;
7579 }
7580
7581 dlg.finished(false);
7582
7583 return Err(match error {
7584 Ok(value) => common::Error::BadRequest(value),
7585 _ => common::Error::Failure(response),
7586 });
7587 }
7588 let response = common::Response::from_parts(parts, body);
7589
7590 dlg.finished(true);
7591 return Ok(response);
7592 }
7593 }
7594 }
7595 }
7596
7597 /// The notification set ID as returned by Enterprises.PullNotificationSet. This must be provided.
7598 ///
7599 /// Sets the *notification set id* query property to the given value.
7600 pub fn notification_set_id(
7601 mut self,
7602 new_value: &str,
7603 ) -> EnterpriseAcknowledgeNotificationSetCall<'a, C> {
7604 self._notification_set_id = Some(new_value.to_string());
7605 self
7606 }
7607 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7608 /// while executing the actual API request.
7609 ///
7610 /// ````text
7611 /// It should be used to handle progress information, and to implement a certain level of resilience.
7612 /// ````
7613 ///
7614 /// Sets the *delegate* property to the given value.
7615 pub fn delegate(
7616 mut self,
7617 new_value: &'a mut dyn common::Delegate,
7618 ) -> EnterpriseAcknowledgeNotificationSetCall<'a, C> {
7619 self._delegate = Some(new_value);
7620 self
7621 }
7622
7623 /// Set any additional parameter of the query string used in the request.
7624 /// It should be used to set parameters which are not yet available through their own
7625 /// setters.
7626 ///
7627 /// Please note that this method must not be used to set any of the known parameters
7628 /// which have their own setter method. If done anyway, the request will fail.
7629 ///
7630 /// # Additional Parameters
7631 ///
7632 /// * *$.xgafv* (query-string) - V1 error format.
7633 /// * *access_token* (query-string) - OAuth access token.
7634 /// * *alt* (query-string) - Data format for response.
7635 /// * *callback* (query-string) - JSONP
7636 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7637 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7638 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7639 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7640 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7641 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7642 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7643 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseAcknowledgeNotificationSetCall<'a, C>
7644 where
7645 T: AsRef<str>,
7646 {
7647 self._additional_params
7648 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7649 self
7650 }
7651
7652 /// Identifies the authorization scope for the method you are building.
7653 ///
7654 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7655 /// [`Scope::Full`].
7656 ///
7657 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7658 /// tokens for more than one scope.
7659 ///
7660 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7661 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7662 /// sufficient, a read-write scope will do as well.
7663 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseAcknowledgeNotificationSetCall<'a, C>
7664 where
7665 St: AsRef<str>,
7666 {
7667 self._scopes.insert(String::from(scope.as_ref()));
7668 self
7669 }
7670 /// Identifies the authorization scope(s) for the method you are building.
7671 ///
7672 /// See [`Self::add_scope()`] for details.
7673 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseAcknowledgeNotificationSetCall<'a, C>
7674 where
7675 I: IntoIterator<Item = St>,
7676 St: AsRef<str>,
7677 {
7678 self._scopes
7679 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7680 self
7681 }
7682
7683 /// Removes all scopes, and no default scope will be used either.
7684 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7685 /// for details).
7686 pub fn clear_scopes(mut self) -> EnterpriseAcknowledgeNotificationSetCall<'a, C> {
7687 self._scopes.clear();
7688 self
7689 }
7690}
7691
7692/// Completes the signup flow, by specifying the Completion token and Enterprise token. This request must not be called multiple times for a given Enterprise Token.
7693///
7694/// A builder for the *completeSignup* method supported by a *enterprise* resource.
7695/// It is not used directly, but through a [`EnterpriseMethods`] instance.
7696///
7697/// # Example
7698///
7699/// Instantiate a resource method builder
7700///
7701/// ```test_harness,no_run
7702/// # extern crate hyper;
7703/// # extern crate hyper_rustls;
7704/// # extern crate google_androidenterprise1 as androidenterprise1;
7705/// # async fn dox() {
7706/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7707///
7708/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7709/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7710/// # .with_native_roots()
7711/// # .unwrap()
7712/// # .https_only()
7713/// # .enable_http2()
7714/// # .build();
7715///
7716/// # let executor = hyper_util::rt::TokioExecutor::new();
7717/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7718/// # secret,
7719/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7720/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7721/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7722/// # ),
7723/// # ).build().await.unwrap();
7724///
7725/// # let client = hyper_util::client::legacy::Client::builder(
7726/// # hyper_util::rt::TokioExecutor::new()
7727/// # )
7728/// # .build(
7729/// # hyper_rustls::HttpsConnectorBuilder::new()
7730/// # .with_native_roots()
7731/// # .unwrap()
7732/// # .https_or_http()
7733/// # .enable_http2()
7734/// # .build()
7735/// # );
7736/// # let mut hub = AndroidEnterprise::new(client, auth);
7737/// // You can configure optional parameters by calling the respective setters at will, and
7738/// // execute the final call using `doit()`.
7739/// // Values shown here are possibly random and not representative !
7740/// let result = hub.enterprises().complete_signup()
7741/// .enterprise_token("ipsum")
7742/// .completion_token("ipsum")
7743/// .doit().await;
7744/// # }
7745/// ```
7746pub struct EnterpriseCompleteSignupCall<'a, C>
7747where
7748 C: 'a,
7749{
7750 hub: &'a AndroidEnterprise<C>,
7751 _enterprise_token: Option<String>,
7752 _completion_token: Option<String>,
7753 _delegate: Option<&'a mut dyn common::Delegate>,
7754 _additional_params: HashMap<String, String>,
7755 _scopes: BTreeSet<String>,
7756}
7757
7758impl<'a, C> common::CallBuilder for EnterpriseCompleteSignupCall<'a, C> {}
7759
7760impl<'a, C> EnterpriseCompleteSignupCall<'a, C>
7761where
7762 C: common::Connector,
7763{
7764 /// Perform the operation you have build so far.
7765 pub async fn doit(mut self) -> common::Result<(common::Response, Enterprise)> {
7766 use std::borrow::Cow;
7767 use std::io::{Read, Seek};
7768
7769 use common::{url::Params, ToParts};
7770 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7771
7772 let mut dd = common::DefaultDelegate;
7773 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7774 dlg.begin(common::MethodInfo {
7775 id: "androidenterprise.enterprises.completeSignup",
7776 http_method: hyper::Method::POST,
7777 });
7778
7779 for &field in ["alt", "enterpriseToken", "completionToken"].iter() {
7780 if self._additional_params.contains_key(field) {
7781 dlg.finished(false);
7782 return Err(common::Error::FieldClash(field));
7783 }
7784 }
7785
7786 let mut params = Params::with_capacity(4 + self._additional_params.len());
7787 if let Some(value) = self._enterprise_token.as_ref() {
7788 params.push("enterpriseToken", value);
7789 }
7790 if let Some(value) = self._completion_token.as_ref() {
7791 params.push("completionToken", value);
7792 }
7793
7794 params.extend(self._additional_params.iter());
7795
7796 params.push("alt", "json");
7797 let mut url =
7798 self.hub._base_url.clone() + "androidenterprise/v1/enterprises/completeSignup";
7799 if self._scopes.is_empty() {
7800 self._scopes.insert(Scope::Full.as_ref().to_string());
7801 }
7802
7803 let url = params.parse_with_url(&url);
7804
7805 loop {
7806 let token = match self
7807 .hub
7808 .auth
7809 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7810 .await
7811 {
7812 Ok(token) => token,
7813 Err(e) => match dlg.token(e) {
7814 Ok(token) => token,
7815 Err(e) => {
7816 dlg.finished(false);
7817 return Err(common::Error::MissingToken(e));
7818 }
7819 },
7820 };
7821 let mut req_result = {
7822 let client = &self.hub.client;
7823 dlg.pre_request();
7824 let mut req_builder = hyper::Request::builder()
7825 .method(hyper::Method::POST)
7826 .uri(url.as_str())
7827 .header(USER_AGENT, self.hub._user_agent.clone());
7828
7829 if let Some(token) = token.as_ref() {
7830 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7831 }
7832
7833 let request = req_builder
7834 .header(CONTENT_LENGTH, 0_u64)
7835 .body(common::to_body::<String>(None));
7836
7837 client.request(request.unwrap()).await
7838 };
7839
7840 match req_result {
7841 Err(err) => {
7842 if let common::Retry::After(d) = dlg.http_error(&err) {
7843 sleep(d).await;
7844 continue;
7845 }
7846 dlg.finished(false);
7847 return Err(common::Error::HttpError(err));
7848 }
7849 Ok(res) => {
7850 let (mut parts, body) = res.into_parts();
7851 let mut body = common::Body::new(body);
7852 if !parts.status.is_success() {
7853 let bytes = common::to_bytes(body).await.unwrap_or_default();
7854 let error = serde_json::from_str(&common::to_string(&bytes));
7855 let response = common::to_response(parts, bytes.into());
7856
7857 if let common::Retry::After(d) =
7858 dlg.http_failure(&response, error.as_ref().ok())
7859 {
7860 sleep(d).await;
7861 continue;
7862 }
7863
7864 dlg.finished(false);
7865
7866 return Err(match error {
7867 Ok(value) => common::Error::BadRequest(value),
7868 _ => common::Error::Failure(response),
7869 });
7870 }
7871 let response = {
7872 let bytes = common::to_bytes(body).await.unwrap_or_default();
7873 let encoded = common::to_string(&bytes);
7874 match serde_json::from_str(&encoded) {
7875 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7876 Err(error) => {
7877 dlg.response_json_decode_error(&encoded, &error);
7878 return Err(common::Error::JsonDecodeError(
7879 encoded.to_string(),
7880 error,
7881 ));
7882 }
7883 }
7884 };
7885
7886 dlg.finished(true);
7887 return Ok(response);
7888 }
7889 }
7890 }
7891 }
7892
7893 /// The Enterprise token appended to the Callback URL.
7894 ///
7895 /// Sets the *enterprise token* query property to the given value.
7896 pub fn enterprise_token(mut self, new_value: &str) -> EnterpriseCompleteSignupCall<'a, C> {
7897 self._enterprise_token = Some(new_value.to_string());
7898 self
7899 }
7900 /// The Completion token initially returned by GenerateSignupUrl.
7901 ///
7902 /// Sets the *completion token* query property to the given value.
7903 pub fn completion_token(mut self, new_value: &str) -> EnterpriseCompleteSignupCall<'a, C> {
7904 self._completion_token = Some(new_value.to_string());
7905 self
7906 }
7907 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7908 /// while executing the actual API request.
7909 ///
7910 /// ````text
7911 /// It should be used to handle progress information, and to implement a certain level of resilience.
7912 /// ````
7913 ///
7914 /// Sets the *delegate* property to the given value.
7915 pub fn delegate(
7916 mut self,
7917 new_value: &'a mut dyn common::Delegate,
7918 ) -> EnterpriseCompleteSignupCall<'a, C> {
7919 self._delegate = Some(new_value);
7920 self
7921 }
7922
7923 /// Set any additional parameter of the query string used in the request.
7924 /// It should be used to set parameters which are not yet available through their own
7925 /// setters.
7926 ///
7927 /// Please note that this method must not be used to set any of the known parameters
7928 /// which have their own setter method. If done anyway, the request will fail.
7929 ///
7930 /// # Additional Parameters
7931 ///
7932 /// * *$.xgafv* (query-string) - V1 error format.
7933 /// * *access_token* (query-string) - OAuth access token.
7934 /// * *alt* (query-string) - Data format for response.
7935 /// * *callback* (query-string) - JSONP
7936 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7937 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7938 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7939 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7940 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7941 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7942 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7943 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseCompleteSignupCall<'a, C>
7944 where
7945 T: AsRef<str>,
7946 {
7947 self._additional_params
7948 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7949 self
7950 }
7951
7952 /// Identifies the authorization scope for the method you are building.
7953 ///
7954 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7955 /// [`Scope::Full`].
7956 ///
7957 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7958 /// tokens for more than one scope.
7959 ///
7960 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7961 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7962 /// sufficient, a read-write scope will do as well.
7963 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseCompleteSignupCall<'a, C>
7964 where
7965 St: AsRef<str>,
7966 {
7967 self._scopes.insert(String::from(scope.as_ref()));
7968 self
7969 }
7970 /// Identifies the authorization scope(s) for the method you are building.
7971 ///
7972 /// See [`Self::add_scope()`] for details.
7973 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseCompleteSignupCall<'a, C>
7974 where
7975 I: IntoIterator<Item = St>,
7976 St: AsRef<str>,
7977 {
7978 self._scopes
7979 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7980 self
7981 }
7982
7983 /// Removes all scopes, and no default scope will be used either.
7984 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7985 /// for details).
7986 pub fn clear_scopes(mut self) -> EnterpriseCompleteSignupCall<'a, C> {
7987 self._scopes.clear();
7988 self
7989 }
7990}
7991
7992/// Returns a unique token to access an embeddable UI. To generate a web UI, pass the generated token into the managed Google Play javascript API. Each token may only be used to start one UI session. See the JavaScript API documentation for further information.
7993///
7994/// A builder for the *createWebToken* method supported by a *enterprise* resource.
7995/// It is not used directly, but through a [`EnterpriseMethods`] instance.
7996///
7997/// # Example
7998///
7999/// Instantiate a resource method builder
8000///
8001/// ```test_harness,no_run
8002/// # extern crate hyper;
8003/// # extern crate hyper_rustls;
8004/// # extern crate google_androidenterprise1 as androidenterprise1;
8005/// use androidenterprise1::api::AdministratorWebTokenSpec;
8006/// # async fn dox() {
8007/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8008///
8009/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8010/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8011/// # .with_native_roots()
8012/// # .unwrap()
8013/// # .https_only()
8014/// # .enable_http2()
8015/// # .build();
8016///
8017/// # let executor = hyper_util::rt::TokioExecutor::new();
8018/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8019/// # secret,
8020/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8021/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8022/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8023/// # ),
8024/// # ).build().await.unwrap();
8025///
8026/// # let client = hyper_util::client::legacy::Client::builder(
8027/// # hyper_util::rt::TokioExecutor::new()
8028/// # )
8029/// # .build(
8030/// # hyper_rustls::HttpsConnectorBuilder::new()
8031/// # .with_native_roots()
8032/// # .unwrap()
8033/// # .https_or_http()
8034/// # .enable_http2()
8035/// # .build()
8036/// # );
8037/// # let mut hub = AndroidEnterprise::new(client, auth);
8038/// // As the method needs a request, you would usually fill it with the desired information
8039/// // into the respective structure. Some of the parts shown here might not be applicable !
8040/// // Values shown here are possibly random and not representative !
8041/// let mut req = AdministratorWebTokenSpec::default();
8042///
8043/// // You can configure optional parameters by calling the respective setters at will, and
8044/// // execute the final call using `doit()`.
8045/// // Values shown here are possibly random and not representative !
8046/// let result = hub.enterprises().create_web_token(req, "enterpriseId")
8047/// .doit().await;
8048/// # }
8049/// ```
8050pub struct EnterpriseCreateWebTokenCall<'a, C>
8051where
8052 C: 'a,
8053{
8054 hub: &'a AndroidEnterprise<C>,
8055 _request: AdministratorWebTokenSpec,
8056 _enterprise_id: String,
8057 _delegate: Option<&'a mut dyn common::Delegate>,
8058 _additional_params: HashMap<String, String>,
8059 _scopes: BTreeSet<String>,
8060}
8061
8062impl<'a, C> common::CallBuilder for EnterpriseCreateWebTokenCall<'a, C> {}
8063
8064impl<'a, C> EnterpriseCreateWebTokenCall<'a, C>
8065where
8066 C: common::Connector,
8067{
8068 /// Perform the operation you have build so far.
8069 pub async fn doit(mut self) -> common::Result<(common::Response, AdministratorWebToken)> {
8070 use std::borrow::Cow;
8071 use std::io::{Read, Seek};
8072
8073 use common::{url::Params, ToParts};
8074 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8075
8076 let mut dd = common::DefaultDelegate;
8077 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8078 dlg.begin(common::MethodInfo {
8079 id: "androidenterprise.enterprises.createWebToken",
8080 http_method: hyper::Method::POST,
8081 });
8082
8083 for &field in ["alt", "enterpriseId"].iter() {
8084 if self._additional_params.contains_key(field) {
8085 dlg.finished(false);
8086 return Err(common::Error::FieldClash(field));
8087 }
8088 }
8089
8090 let mut params = Params::with_capacity(4 + self._additional_params.len());
8091 params.push("enterpriseId", self._enterprise_id);
8092
8093 params.extend(self._additional_params.iter());
8094
8095 params.push("alt", "json");
8096 let mut url = self.hub._base_url.clone()
8097 + "androidenterprise/v1/enterprises/{enterpriseId}/createWebToken";
8098 if self._scopes.is_empty() {
8099 self._scopes.insert(Scope::Full.as_ref().to_string());
8100 }
8101
8102 #[allow(clippy::single_element_loop)]
8103 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
8104 url = params.uri_replacement(url, param_name, find_this, false);
8105 }
8106 {
8107 let to_remove = ["enterpriseId"];
8108 params.remove_params(&to_remove);
8109 }
8110
8111 let url = params.parse_with_url(&url);
8112
8113 let mut json_mime_type = mime::APPLICATION_JSON;
8114 let mut request_value_reader = {
8115 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8116 common::remove_json_null_values(&mut value);
8117 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8118 serde_json::to_writer(&mut dst, &value).unwrap();
8119 dst
8120 };
8121 let request_size = request_value_reader
8122 .seek(std::io::SeekFrom::End(0))
8123 .unwrap();
8124 request_value_reader
8125 .seek(std::io::SeekFrom::Start(0))
8126 .unwrap();
8127
8128 loop {
8129 let token = match self
8130 .hub
8131 .auth
8132 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8133 .await
8134 {
8135 Ok(token) => token,
8136 Err(e) => match dlg.token(e) {
8137 Ok(token) => token,
8138 Err(e) => {
8139 dlg.finished(false);
8140 return Err(common::Error::MissingToken(e));
8141 }
8142 },
8143 };
8144 request_value_reader
8145 .seek(std::io::SeekFrom::Start(0))
8146 .unwrap();
8147 let mut req_result = {
8148 let client = &self.hub.client;
8149 dlg.pre_request();
8150 let mut req_builder = hyper::Request::builder()
8151 .method(hyper::Method::POST)
8152 .uri(url.as_str())
8153 .header(USER_AGENT, self.hub._user_agent.clone());
8154
8155 if let Some(token) = token.as_ref() {
8156 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8157 }
8158
8159 let request = req_builder
8160 .header(CONTENT_TYPE, json_mime_type.to_string())
8161 .header(CONTENT_LENGTH, request_size as u64)
8162 .body(common::to_body(
8163 request_value_reader.get_ref().clone().into(),
8164 ));
8165
8166 client.request(request.unwrap()).await
8167 };
8168
8169 match req_result {
8170 Err(err) => {
8171 if let common::Retry::After(d) = dlg.http_error(&err) {
8172 sleep(d).await;
8173 continue;
8174 }
8175 dlg.finished(false);
8176 return Err(common::Error::HttpError(err));
8177 }
8178 Ok(res) => {
8179 let (mut parts, body) = res.into_parts();
8180 let mut body = common::Body::new(body);
8181 if !parts.status.is_success() {
8182 let bytes = common::to_bytes(body).await.unwrap_or_default();
8183 let error = serde_json::from_str(&common::to_string(&bytes));
8184 let response = common::to_response(parts, bytes.into());
8185
8186 if let common::Retry::After(d) =
8187 dlg.http_failure(&response, error.as_ref().ok())
8188 {
8189 sleep(d).await;
8190 continue;
8191 }
8192
8193 dlg.finished(false);
8194
8195 return Err(match error {
8196 Ok(value) => common::Error::BadRequest(value),
8197 _ => common::Error::Failure(response),
8198 });
8199 }
8200 let response = {
8201 let bytes = common::to_bytes(body).await.unwrap_or_default();
8202 let encoded = common::to_string(&bytes);
8203 match serde_json::from_str(&encoded) {
8204 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8205 Err(error) => {
8206 dlg.response_json_decode_error(&encoded, &error);
8207 return Err(common::Error::JsonDecodeError(
8208 encoded.to_string(),
8209 error,
8210 ));
8211 }
8212 }
8213 };
8214
8215 dlg.finished(true);
8216 return Ok(response);
8217 }
8218 }
8219 }
8220 }
8221
8222 ///
8223 /// Sets the *request* property to the given value.
8224 ///
8225 /// Even though the property as already been set when instantiating this call,
8226 /// we provide this method for API completeness.
8227 pub fn request(
8228 mut self,
8229 new_value: AdministratorWebTokenSpec,
8230 ) -> EnterpriseCreateWebTokenCall<'a, C> {
8231 self._request = new_value;
8232 self
8233 }
8234 /// The ID of the enterprise.
8235 ///
8236 /// Sets the *enterprise id* path property to the given value.
8237 ///
8238 /// Even though the property as already been set when instantiating this call,
8239 /// we provide this method for API completeness.
8240 pub fn enterprise_id(mut self, new_value: &str) -> EnterpriseCreateWebTokenCall<'a, C> {
8241 self._enterprise_id = new_value.to_string();
8242 self
8243 }
8244 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8245 /// while executing the actual API request.
8246 ///
8247 /// ````text
8248 /// It should be used to handle progress information, and to implement a certain level of resilience.
8249 /// ````
8250 ///
8251 /// Sets the *delegate* property to the given value.
8252 pub fn delegate(
8253 mut self,
8254 new_value: &'a mut dyn common::Delegate,
8255 ) -> EnterpriseCreateWebTokenCall<'a, C> {
8256 self._delegate = Some(new_value);
8257 self
8258 }
8259
8260 /// Set any additional parameter of the query string used in the request.
8261 /// It should be used to set parameters which are not yet available through their own
8262 /// setters.
8263 ///
8264 /// Please note that this method must not be used to set any of the known parameters
8265 /// which have their own setter method. If done anyway, the request will fail.
8266 ///
8267 /// # Additional Parameters
8268 ///
8269 /// * *$.xgafv* (query-string) - V1 error format.
8270 /// * *access_token* (query-string) - OAuth access token.
8271 /// * *alt* (query-string) - Data format for response.
8272 /// * *callback* (query-string) - JSONP
8273 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8274 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8275 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8276 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8277 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8278 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8279 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8280 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseCreateWebTokenCall<'a, C>
8281 where
8282 T: AsRef<str>,
8283 {
8284 self._additional_params
8285 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8286 self
8287 }
8288
8289 /// Identifies the authorization scope for the method you are building.
8290 ///
8291 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8292 /// [`Scope::Full`].
8293 ///
8294 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8295 /// tokens for more than one scope.
8296 ///
8297 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8298 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8299 /// sufficient, a read-write scope will do as well.
8300 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseCreateWebTokenCall<'a, C>
8301 where
8302 St: AsRef<str>,
8303 {
8304 self._scopes.insert(String::from(scope.as_ref()));
8305 self
8306 }
8307 /// Identifies the authorization scope(s) for the method you are building.
8308 ///
8309 /// See [`Self::add_scope()`] for details.
8310 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseCreateWebTokenCall<'a, C>
8311 where
8312 I: IntoIterator<Item = St>,
8313 St: AsRef<str>,
8314 {
8315 self._scopes
8316 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8317 self
8318 }
8319
8320 /// Removes all scopes, and no default scope will be used either.
8321 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8322 /// for details).
8323 pub fn clear_scopes(mut self) -> EnterpriseCreateWebTokenCall<'a, C> {
8324 self._scopes.clear();
8325 self
8326 }
8327}
8328
8329/// Enrolls an enterprise with the calling EMM.
8330///
8331/// A builder for the *enroll* method supported by a *enterprise* resource.
8332/// It is not used directly, but through a [`EnterpriseMethods`] instance.
8333///
8334/// # Example
8335///
8336/// Instantiate a resource method builder
8337///
8338/// ```test_harness,no_run
8339/// # extern crate hyper;
8340/// # extern crate hyper_rustls;
8341/// # extern crate google_androidenterprise1 as androidenterprise1;
8342/// use androidenterprise1::api::Enterprise;
8343/// # async fn dox() {
8344/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8345///
8346/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8347/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8348/// # .with_native_roots()
8349/// # .unwrap()
8350/// # .https_only()
8351/// # .enable_http2()
8352/// # .build();
8353///
8354/// # let executor = hyper_util::rt::TokioExecutor::new();
8355/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8356/// # secret,
8357/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8358/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8359/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8360/// # ),
8361/// # ).build().await.unwrap();
8362///
8363/// # let client = hyper_util::client::legacy::Client::builder(
8364/// # hyper_util::rt::TokioExecutor::new()
8365/// # )
8366/// # .build(
8367/// # hyper_rustls::HttpsConnectorBuilder::new()
8368/// # .with_native_roots()
8369/// # .unwrap()
8370/// # .https_or_http()
8371/// # .enable_http2()
8372/// # .build()
8373/// # );
8374/// # let mut hub = AndroidEnterprise::new(client, auth);
8375/// // As the method needs a request, you would usually fill it with the desired information
8376/// // into the respective structure. Some of the parts shown here might not be applicable !
8377/// // Values shown here are possibly random and not representative !
8378/// let mut req = Enterprise::default();
8379///
8380/// // You can configure optional parameters by calling the respective setters at will, and
8381/// // execute the final call using `doit()`.
8382/// // Values shown here are possibly random and not representative !
8383/// let result = hub.enterprises().enroll(req, "token")
8384/// .doit().await;
8385/// # }
8386/// ```
8387pub struct EnterpriseEnrollCall<'a, C>
8388where
8389 C: 'a,
8390{
8391 hub: &'a AndroidEnterprise<C>,
8392 _request: Enterprise,
8393 _token: String,
8394 _delegate: Option<&'a mut dyn common::Delegate>,
8395 _additional_params: HashMap<String, String>,
8396 _scopes: BTreeSet<String>,
8397}
8398
8399impl<'a, C> common::CallBuilder for EnterpriseEnrollCall<'a, C> {}
8400
8401impl<'a, C> EnterpriseEnrollCall<'a, C>
8402where
8403 C: common::Connector,
8404{
8405 /// Perform the operation you have build so far.
8406 pub async fn doit(mut self) -> common::Result<(common::Response, Enterprise)> {
8407 use std::borrow::Cow;
8408 use std::io::{Read, Seek};
8409
8410 use common::{url::Params, ToParts};
8411 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8412
8413 let mut dd = common::DefaultDelegate;
8414 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8415 dlg.begin(common::MethodInfo {
8416 id: "androidenterprise.enterprises.enroll",
8417 http_method: hyper::Method::POST,
8418 });
8419
8420 for &field in ["alt", "token"].iter() {
8421 if self._additional_params.contains_key(field) {
8422 dlg.finished(false);
8423 return Err(common::Error::FieldClash(field));
8424 }
8425 }
8426
8427 let mut params = Params::with_capacity(4 + self._additional_params.len());
8428 params.push("token", self._token);
8429
8430 params.extend(self._additional_params.iter());
8431
8432 params.push("alt", "json");
8433 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/enroll";
8434 if self._scopes.is_empty() {
8435 self._scopes.insert(Scope::Full.as_ref().to_string());
8436 }
8437
8438 let url = params.parse_with_url(&url);
8439
8440 let mut json_mime_type = mime::APPLICATION_JSON;
8441 let mut request_value_reader = {
8442 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8443 common::remove_json_null_values(&mut value);
8444 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8445 serde_json::to_writer(&mut dst, &value).unwrap();
8446 dst
8447 };
8448 let request_size = request_value_reader
8449 .seek(std::io::SeekFrom::End(0))
8450 .unwrap();
8451 request_value_reader
8452 .seek(std::io::SeekFrom::Start(0))
8453 .unwrap();
8454
8455 loop {
8456 let token = match self
8457 .hub
8458 .auth
8459 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8460 .await
8461 {
8462 Ok(token) => token,
8463 Err(e) => match dlg.token(e) {
8464 Ok(token) => token,
8465 Err(e) => {
8466 dlg.finished(false);
8467 return Err(common::Error::MissingToken(e));
8468 }
8469 },
8470 };
8471 request_value_reader
8472 .seek(std::io::SeekFrom::Start(0))
8473 .unwrap();
8474 let mut req_result = {
8475 let client = &self.hub.client;
8476 dlg.pre_request();
8477 let mut req_builder = hyper::Request::builder()
8478 .method(hyper::Method::POST)
8479 .uri(url.as_str())
8480 .header(USER_AGENT, self.hub._user_agent.clone());
8481
8482 if let Some(token) = token.as_ref() {
8483 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8484 }
8485
8486 let request = req_builder
8487 .header(CONTENT_TYPE, json_mime_type.to_string())
8488 .header(CONTENT_LENGTH, request_size as u64)
8489 .body(common::to_body(
8490 request_value_reader.get_ref().clone().into(),
8491 ));
8492
8493 client.request(request.unwrap()).await
8494 };
8495
8496 match req_result {
8497 Err(err) => {
8498 if let common::Retry::After(d) = dlg.http_error(&err) {
8499 sleep(d).await;
8500 continue;
8501 }
8502 dlg.finished(false);
8503 return Err(common::Error::HttpError(err));
8504 }
8505 Ok(res) => {
8506 let (mut parts, body) = res.into_parts();
8507 let mut body = common::Body::new(body);
8508 if !parts.status.is_success() {
8509 let bytes = common::to_bytes(body).await.unwrap_or_default();
8510 let error = serde_json::from_str(&common::to_string(&bytes));
8511 let response = common::to_response(parts, bytes.into());
8512
8513 if let common::Retry::After(d) =
8514 dlg.http_failure(&response, error.as_ref().ok())
8515 {
8516 sleep(d).await;
8517 continue;
8518 }
8519
8520 dlg.finished(false);
8521
8522 return Err(match error {
8523 Ok(value) => common::Error::BadRequest(value),
8524 _ => common::Error::Failure(response),
8525 });
8526 }
8527 let response = {
8528 let bytes = common::to_bytes(body).await.unwrap_or_default();
8529 let encoded = common::to_string(&bytes);
8530 match serde_json::from_str(&encoded) {
8531 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8532 Err(error) => {
8533 dlg.response_json_decode_error(&encoded, &error);
8534 return Err(common::Error::JsonDecodeError(
8535 encoded.to_string(),
8536 error,
8537 ));
8538 }
8539 }
8540 };
8541
8542 dlg.finished(true);
8543 return Ok(response);
8544 }
8545 }
8546 }
8547 }
8548
8549 ///
8550 /// Sets the *request* property to the given value.
8551 ///
8552 /// Even though the property as already been set when instantiating this call,
8553 /// we provide this method for API completeness.
8554 pub fn request(mut self, new_value: Enterprise) -> EnterpriseEnrollCall<'a, C> {
8555 self._request = new_value;
8556 self
8557 }
8558 /// Required. The token provided by the enterprise to register the EMM.
8559 ///
8560 /// Sets the *token* query property to the given value.
8561 ///
8562 /// Even though the property as already been set when instantiating this call,
8563 /// we provide this method for API completeness.
8564 pub fn token(mut self, new_value: &str) -> EnterpriseEnrollCall<'a, C> {
8565 self._token = new_value.to_string();
8566 self
8567 }
8568 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8569 /// while executing the actual API request.
8570 ///
8571 /// ````text
8572 /// It should be used to handle progress information, and to implement a certain level of resilience.
8573 /// ````
8574 ///
8575 /// Sets the *delegate* property to the given value.
8576 pub fn delegate(
8577 mut self,
8578 new_value: &'a mut dyn common::Delegate,
8579 ) -> EnterpriseEnrollCall<'a, C> {
8580 self._delegate = Some(new_value);
8581 self
8582 }
8583
8584 /// Set any additional parameter of the query string used in the request.
8585 /// It should be used to set parameters which are not yet available through their own
8586 /// setters.
8587 ///
8588 /// Please note that this method must not be used to set any of the known parameters
8589 /// which have their own setter method. If done anyway, the request will fail.
8590 ///
8591 /// # Additional Parameters
8592 ///
8593 /// * *$.xgafv* (query-string) - V1 error format.
8594 /// * *access_token* (query-string) - OAuth access token.
8595 /// * *alt* (query-string) - Data format for response.
8596 /// * *callback* (query-string) - JSONP
8597 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8598 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8599 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8600 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8601 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8602 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8603 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8604 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseEnrollCall<'a, C>
8605 where
8606 T: AsRef<str>,
8607 {
8608 self._additional_params
8609 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8610 self
8611 }
8612
8613 /// Identifies the authorization scope for the method you are building.
8614 ///
8615 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8616 /// [`Scope::Full`].
8617 ///
8618 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8619 /// tokens for more than one scope.
8620 ///
8621 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8622 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8623 /// sufficient, a read-write scope will do as well.
8624 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseEnrollCall<'a, C>
8625 where
8626 St: AsRef<str>,
8627 {
8628 self._scopes.insert(String::from(scope.as_ref()));
8629 self
8630 }
8631 /// Identifies the authorization scope(s) for the method you are building.
8632 ///
8633 /// See [`Self::add_scope()`] for details.
8634 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseEnrollCall<'a, C>
8635 where
8636 I: IntoIterator<Item = St>,
8637 St: AsRef<str>,
8638 {
8639 self._scopes
8640 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8641 self
8642 }
8643
8644 /// Removes all scopes, and no default scope will be used either.
8645 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8646 /// for details).
8647 pub fn clear_scopes(mut self) -> EnterpriseEnrollCall<'a, C> {
8648 self._scopes.clear();
8649 self
8650 }
8651}
8652
8653/// Generates an enterprise upgrade URL to upgrade an existing managed Google Play Accounts enterprise to a managed Google domain. See the guide to upgrading an enterprise for more details.
8654///
8655/// A builder for the *generateEnterpriseUpgradeUrl* method supported by a *enterprise* resource.
8656/// It is not used directly, but through a [`EnterpriseMethods`] instance.
8657///
8658/// # Example
8659///
8660/// Instantiate a resource method builder
8661///
8662/// ```test_harness,no_run
8663/// # extern crate hyper;
8664/// # extern crate hyper_rustls;
8665/// # extern crate google_androidenterprise1 as androidenterprise1;
8666/// # async fn dox() {
8667/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8668///
8669/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8670/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8671/// # .with_native_roots()
8672/// # .unwrap()
8673/// # .https_only()
8674/// # .enable_http2()
8675/// # .build();
8676///
8677/// # let executor = hyper_util::rt::TokioExecutor::new();
8678/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8679/// # secret,
8680/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8681/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8682/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8683/// # ),
8684/// # ).build().await.unwrap();
8685///
8686/// # let client = hyper_util::client::legacy::Client::builder(
8687/// # hyper_util::rt::TokioExecutor::new()
8688/// # )
8689/// # .build(
8690/// # hyper_rustls::HttpsConnectorBuilder::new()
8691/// # .with_native_roots()
8692/// # .unwrap()
8693/// # .https_or_http()
8694/// # .enable_http2()
8695/// # .build()
8696/// # );
8697/// # let mut hub = AndroidEnterprise::new(client, auth);
8698/// // You can configure optional parameters by calling the respective setters at will, and
8699/// // execute the final call using `doit()`.
8700/// // Values shown here are possibly random and not representative !
8701/// let result = hub.enterprises().generate_enterprise_upgrade_url("enterpriseId")
8702/// .add_allowed_domains("dolor")
8703/// .admin_email("Lorem")
8704/// .doit().await;
8705/// # }
8706/// ```
8707pub struct EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C>
8708where
8709 C: 'a,
8710{
8711 hub: &'a AndroidEnterprise<C>,
8712 _enterprise_id: String,
8713 _allowed_domains: Vec<String>,
8714 _admin_email: Option<String>,
8715 _delegate: Option<&'a mut dyn common::Delegate>,
8716 _additional_params: HashMap<String, String>,
8717 _scopes: BTreeSet<String>,
8718}
8719
8720impl<'a, C> common::CallBuilder for EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C> {}
8721
8722impl<'a, C> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C>
8723where
8724 C: common::Connector,
8725{
8726 /// Perform the operation you have build so far.
8727 pub async fn doit(
8728 mut self,
8729 ) -> common::Result<(common::Response, GenerateEnterpriseUpgradeUrlResponse)> {
8730 use std::borrow::Cow;
8731 use std::io::{Read, Seek};
8732
8733 use common::{url::Params, ToParts};
8734 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8735
8736 let mut dd = common::DefaultDelegate;
8737 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8738 dlg.begin(common::MethodInfo {
8739 id: "androidenterprise.enterprises.generateEnterpriseUpgradeUrl",
8740 http_method: hyper::Method::POST,
8741 });
8742
8743 for &field in ["alt", "enterpriseId", "allowedDomains", "adminEmail"].iter() {
8744 if self._additional_params.contains_key(field) {
8745 dlg.finished(false);
8746 return Err(common::Error::FieldClash(field));
8747 }
8748 }
8749
8750 let mut params = Params::with_capacity(5 + self._additional_params.len());
8751 params.push("enterpriseId", self._enterprise_id);
8752 if !self._allowed_domains.is_empty() {
8753 for f in self._allowed_domains.iter() {
8754 params.push("allowedDomains", f);
8755 }
8756 }
8757 if let Some(value) = self._admin_email.as_ref() {
8758 params.push("adminEmail", value);
8759 }
8760
8761 params.extend(self._additional_params.iter());
8762
8763 params.push("alt", "json");
8764 let mut url = self.hub._base_url.clone()
8765 + "androidenterprise/v1/enterprises/{enterpriseId}/generateEnterpriseUpgradeUrl";
8766 if self._scopes.is_empty() {
8767 self._scopes.insert(Scope::Full.as_ref().to_string());
8768 }
8769
8770 #[allow(clippy::single_element_loop)]
8771 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
8772 url = params.uri_replacement(url, param_name, find_this, false);
8773 }
8774 {
8775 let to_remove = ["enterpriseId"];
8776 params.remove_params(&to_remove);
8777 }
8778
8779 let url = params.parse_with_url(&url);
8780
8781 loop {
8782 let token = match self
8783 .hub
8784 .auth
8785 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8786 .await
8787 {
8788 Ok(token) => token,
8789 Err(e) => match dlg.token(e) {
8790 Ok(token) => token,
8791 Err(e) => {
8792 dlg.finished(false);
8793 return Err(common::Error::MissingToken(e));
8794 }
8795 },
8796 };
8797 let mut req_result = {
8798 let client = &self.hub.client;
8799 dlg.pre_request();
8800 let mut req_builder = hyper::Request::builder()
8801 .method(hyper::Method::POST)
8802 .uri(url.as_str())
8803 .header(USER_AGENT, self.hub._user_agent.clone());
8804
8805 if let Some(token) = token.as_ref() {
8806 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8807 }
8808
8809 let request = req_builder
8810 .header(CONTENT_LENGTH, 0_u64)
8811 .body(common::to_body::<String>(None));
8812
8813 client.request(request.unwrap()).await
8814 };
8815
8816 match req_result {
8817 Err(err) => {
8818 if let common::Retry::After(d) = dlg.http_error(&err) {
8819 sleep(d).await;
8820 continue;
8821 }
8822 dlg.finished(false);
8823 return Err(common::Error::HttpError(err));
8824 }
8825 Ok(res) => {
8826 let (mut parts, body) = res.into_parts();
8827 let mut body = common::Body::new(body);
8828 if !parts.status.is_success() {
8829 let bytes = common::to_bytes(body).await.unwrap_or_default();
8830 let error = serde_json::from_str(&common::to_string(&bytes));
8831 let response = common::to_response(parts, bytes.into());
8832
8833 if let common::Retry::After(d) =
8834 dlg.http_failure(&response, error.as_ref().ok())
8835 {
8836 sleep(d).await;
8837 continue;
8838 }
8839
8840 dlg.finished(false);
8841
8842 return Err(match error {
8843 Ok(value) => common::Error::BadRequest(value),
8844 _ => common::Error::Failure(response),
8845 });
8846 }
8847 let response = {
8848 let bytes = common::to_bytes(body).await.unwrap_or_default();
8849 let encoded = common::to_string(&bytes);
8850 match serde_json::from_str(&encoded) {
8851 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8852 Err(error) => {
8853 dlg.response_json_decode_error(&encoded, &error);
8854 return Err(common::Error::JsonDecodeError(
8855 encoded.to_string(),
8856 error,
8857 ));
8858 }
8859 }
8860 };
8861
8862 dlg.finished(true);
8863 return Ok(response);
8864 }
8865 }
8866 }
8867 }
8868
8869 /// Required. The ID of the enterprise.
8870 ///
8871 /// Sets the *enterprise id* path property to the given value.
8872 ///
8873 /// Even though the property as already been set when instantiating this call,
8874 /// we provide this method for API completeness.
8875 pub fn enterprise_id(
8876 mut self,
8877 new_value: &str,
8878 ) -> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C> {
8879 self._enterprise_id = new_value.to_string();
8880 self
8881 }
8882 /// Optional. A list of domains that are permitted for the admin email. The IT admin cannot enter an email address with a domain name that is not in this list. Subdomains of domains in this list are not allowed but can be allowed by adding a second entry which has `*.` prefixed to the domain name (e.g. *.example.com). If the field is not present or is an empty list then the IT admin is free to use any valid domain name. Personal email domains are not allowed.
8883 ///
8884 /// Append the given value to the *allowed domains* query property.
8885 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
8886 pub fn add_allowed_domains(
8887 mut self,
8888 new_value: &str,
8889 ) -> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C> {
8890 self._allowed_domains.push(new_value.to_string());
8891 self
8892 }
8893 /// Optional. Email address used to prefill the admin field of the enterprise signup form as part of the upgrade process. This value is a hint only and can be altered by the user. Personal email addresses are not allowed. If `allowedDomains` is non-empty then this must belong to one of the `allowedDomains`.
8894 ///
8895 /// Sets the *admin email* query property to the given value.
8896 pub fn admin_email(
8897 mut self,
8898 new_value: &str,
8899 ) -> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C> {
8900 self._admin_email = Some(new_value.to_string());
8901 self
8902 }
8903 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8904 /// while executing the actual API request.
8905 ///
8906 /// ````text
8907 /// It should be used to handle progress information, and to implement a certain level of resilience.
8908 /// ````
8909 ///
8910 /// Sets the *delegate* property to the given value.
8911 pub fn delegate(
8912 mut self,
8913 new_value: &'a mut dyn common::Delegate,
8914 ) -> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C> {
8915 self._delegate = Some(new_value);
8916 self
8917 }
8918
8919 /// Set any additional parameter of the query string used in the request.
8920 /// It should be used to set parameters which are not yet available through their own
8921 /// setters.
8922 ///
8923 /// Please note that this method must not be used to set any of the known parameters
8924 /// which have their own setter method. If done anyway, the request will fail.
8925 ///
8926 /// # Additional Parameters
8927 ///
8928 /// * *$.xgafv* (query-string) - V1 error format.
8929 /// * *access_token* (query-string) - OAuth access token.
8930 /// * *alt* (query-string) - Data format for response.
8931 /// * *callback* (query-string) - JSONP
8932 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8933 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8934 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8935 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8936 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8937 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8938 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8939 pub fn param<T>(
8940 mut self,
8941 name: T,
8942 value: T,
8943 ) -> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C>
8944 where
8945 T: AsRef<str>,
8946 {
8947 self._additional_params
8948 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8949 self
8950 }
8951
8952 /// Identifies the authorization scope for the method you are building.
8953 ///
8954 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8955 /// [`Scope::Full`].
8956 ///
8957 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8958 /// tokens for more than one scope.
8959 ///
8960 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8961 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8962 /// sufficient, a read-write scope will do as well.
8963 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C>
8964 where
8965 St: AsRef<str>,
8966 {
8967 self._scopes.insert(String::from(scope.as_ref()));
8968 self
8969 }
8970 /// Identifies the authorization scope(s) for the method you are building.
8971 ///
8972 /// See [`Self::add_scope()`] for details.
8973 pub fn add_scopes<I, St>(
8974 mut self,
8975 scopes: I,
8976 ) -> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C>
8977 where
8978 I: IntoIterator<Item = St>,
8979 St: AsRef<str>,
8980 {
8981 self._scopes
8982 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8983 self
8984 }
8985
8986 /// Removes all scopes, and no default scope will be used either.
8987 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8988 /// for details).
8989 pub fn clear_scopes(mut self) -> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C> {
8990 self._scopes.clear();
8991 self
8992 }
8993}
8994
8995/// Generates a sign-up URL.
8996///
8997/// A builder for the *generateSignupUrl* method supported by a *enterprise* resource.
8998/// It is not used directly, but through a [`EnterpriseMethods`] instance.
8999///
9000/// # Example
9001///
9002/// Instantiate a resource method builder
9003///
9004/// ```test_harness,no_run
9005/// # extern crate hyper;
9006/// # extern crate hyper_rustls;
9007/// # extern crate google_androidenterprise1 as androidenterprise1;
9008/// # async fn dox() {
9009/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9010///
9011/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9012/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9013/// # .with_native_roots()
9014/// # .unwrap()
9015/// # .https_only()
9016/// # .enable_http2()
9017/// # .build();
9018///
9019/// # let executor = hyper_util::rt::TokioExecutor::new();
9020/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9021/// # secret,
9022/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9023/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9024/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9025/// # ),
9026/// # ).build().await.unwrap();
9027///
9028/// # let client = hyper_util::client::legacy::Client::builder(
9029/// # hyper_util::rt::TokioExecutor::new()
9030/// # )
9031/// # .build(
9032/// # hyper_rustls::HttpsConnectorBuilder::new()
9033/// # .with_native_roots()
9034/// # .unwrap()
9035/// # .https_or_http()
9036/// # .enable_http2()
9037/// # .build()
9038/// # );
9039/// # let mut hub = AndroidEnterprise::new(client, auth);
9040/// // You can configure optional parameters by calling the respective setters at will, and
9041/// // execute the final call using `doit()`.
9042/// // Values shown here are possibly random and not representative !
9043/// let result = hub.enterprises().generate_signup_url()
9044/// .callback_url("eos")
9045/// .add_allowed_domains("labore")
9046/// .admin_email("sed")
9047/// .doit().await;
9048/// # }
9049/// ```
9050pub struct EnterpriseGenerateSignupUrlCall<'a, C>
9051where
9052 C: 'a,
9053{
9054 hub: &'a AndroidEnterprise<C>,
9055 _callback_url: Option<String>,
9056 _allowed_domains: Vec<String>,
9057 _admin_email: Option<String>,
9058 _delegate: Option<&'a mut dyn common::Delegate>,
9059 _additional_params: HashMap<String, String>,
9060 _scopes: BTreeSet<String>,
9061}
9062
9063impl<'a, C> common::CallBuilder for EnterpriseGenerateSignupUrlCall<'a, C> {}
9064
9065impl<'a, C> EnterpriseGenerateSignupUrlCall<'a, C>
9066where
9067 C: common::Connector,
9068{
9069 /// Perform the operation you have build so far.
9070 pub async fn doit(mut self) -> common::Result<(common::Response, SignupInfo)> {
9071 use std::borrow::Cow;
9072 use std::io::{Read, Seek};
9073
9074 use common::{url::Params, ToParts};
9075 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9076
9077 let mut dd = common::DefaultDelegate;
9078 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9079 dlg.begin(common::MethodInfo {
9080 id: "androidenterprise.enterprises.generateSignupUrl",
9081 http_method: hyper::Method::POST,
9082 });
9083
9084 for &field in ["alt", "callbackUrl", "allowedDomains", "adminEmail"].iter() {
9085 if self._additional_params.contains_key(field) {
9086 dlg.finished(false);
9087 return Err(common::Error::FieldClash(field));
9088 }
9089 }
9090
9091 let mut params = Params::with_capacity(5 + self._additional_params.len());
9092 if let Some(value) = self._callback_url.as_ref() {
9093 params.push("callbackUrl", value);
9094 }
9095 if !self._allowed_domains.is_empty() {
9096 for f in self._allowed_domains.iter() {
9097 params.push("allowedDomains", f);
9098 }
9099 }
9100 if let Some(value) = self._admin_email.as_ref() {
9101 params.push("adminEmail", value);
9102 }
9103
9104 params.extend(self._additional_params.iter());
9105
9106 params.push("alt", "json");
9107 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/signupUrl";
9108 if self._scopes.is_empty() {
9109 self._scopes.insert(Scope::Full.as_ref().to_string());
9110 }
9111
9112 let url = params.parse_with_url(&url);
9113
9114 loop {
9115 let token = match self
9116 .hub
9117 .auth
9118 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9119 .await
9120 {
9121 Ok(token) => token,
9122 Err(e) => match dlg.token(e) {
9123 Ok(token) => token,
9124 Err(e) => {
9125 dlg.finished(false);
9126 return Err(common::Error::MissingToken(e));
9127 }
9128 },
9129 };
9130 let mut req_result = {
9131 let client = &self.hub.client;
9132 dlg.pre_request();
9133 let mut req_builder = hyper::Request::builder()
9134 .method(hyper::Method::POST)
9135 .uri(url.as_str())
9136 .header(USER_AGENT, self.hub._user_agent.clone());
9137
9138 if let Some(token) = token.as_ref() {
9139 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9140 }
9141
9142 let request = req_builder
9143 .header(CONTENT_LENGTH, 0_u64)
9144 .body(common::to_body::<String>(None));
9145
9146 client.request(request.unwrap()).await
9147 };
9148
9149 match req_result {
9150 Err(err) => {
9151 if let common::Retry::After(d) = dlg.http_error(&err) {
9152 sleep(d).await;
9153 continue;
9154 }
9155 dlg.finished(false);
9156 return Err(common::Error::HttpError(err));
9157 }
9158 Ok(res) => {
9159 let (mut parts, body) = res.into_parts();
9160 let mut body = common::Body::new(body);
9161 if !parts.status.is_success() {
9162 let bytes = common::to_bytes(body).await.unwrap_or_default();
9163 let error = serde_json::from_str(&common::to_string(&bytes));
9164 let response = common::to_response(parts, bytes.into());
9165
9166 if let common::Retry::After(d) =
9167 dlg.http_failure(&response, error.as_ref().ok())
9168 {
9169 sleep(d).await;
9170 continue;
9171 }
9172
9173 dlg.finished(false);
9174
9175 return Err(match error {
9176 Ok(value) => common::Error::BadRequest(value),
9177 _ => common::Error::Failure(response),
9178 });
9179 }
9180 let response = {
9181 let bytes = common::to_bytes(body).await.unwrap_or_default();
9182 let encoded = common::to_string(&bytes);
9183 match serde_json::from_str(&encoded) {
9184 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9185 Err(error) => {
9186 dlg.response_json_decode_error(&encoded, &error);
9187 return Err(common::Error::JsonDecodeError(
9188 encoded.to_string(),
9189 error,
9190 ));
9191 }
9192 }
9193 };
9194
9195 dlg.finished(true);
9196 return Ok(response);
9197 }
9198 }
9199 }
9200 }
9201
9202 /// The callback URL to which the Admin will be redirected after successfully creating an enterprise. Before redirecting there the system will add a single query parameter to this URL named "enterpriseToken" which will contain an opaque token to be used for the CompleteSignup request. Beware that this means that the URL will be parsed, the parameter added and then a new URL formatted, i.e. there may be some minor formatting changes and, more importantly, the URL must be well-formed so that it can be parsed.
9203 ///
9204 /// Sets the *callback url* query property to the given value.
9205 pub fn callback_url(mut self, new_value: &str) -> EnterpriseGenerateSignupUrlCall<'a, C> {
9206 self._callback_url = Some(new_value.to_string());
9207 self
9208 }
9209 /// Optional. A list of domains that are permitted for the admin email. The IT admin cannot enter an email address with a domain name that is not in this list. Subdomains of domains in this list are not allowed but can be allowed by adding a second entry which has `*.` prefixed to the domain name (e.g. *.example.com). If the field is not present or is an empty list then the IT admin is free to use any valid domain name. Personal email domains are always allowed, but will result in the creation of a managed Google Play Accounts enterprise.
9210 ///
9211 /// Append the given value to the *allowed domains* query property.
9212 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
9213 pub fn add_allowed_domains(
9214 mut self,
9215 new_value: &str,
9216 ) -> EnterpriseGenerateSignupUrlCall<'a, C> {
9217 self._allowed_domains.push(new_value.to_string());
9218 self
9219 }
9220 /// Optional. Email address used to prefill the admin field of the enterprise signup form. This value is a hint only and can be altered by the user. If `allowedDomains` is non-empty then this must belong to one of the `allowedDomains`.
9221 ///
9222 /// Sets the *admin email* query property to the given value.
9223 pub fn admin_email(mut self, new_value: &str) -> EnterpriseGenerateSignupUrlCall<'a, C> {
9224 self._admin_email = Some(new_value.to_string());
9225 self
9226 }
9227 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9228 /// while executing the actual API request.
9229 ///
9230 /// ````text
9231 /// It should be used to handle progress information, and to implement a certain level of resilience.
9232 /// ````
9233 ///
9234 /// Sets the *delegate* property to the given value.
9235 pub fn delegate(
9236 mut self,
9237 new_value: &'a mut dyn common::Delegate,
9238 ) -> EnterpriseGenerateSignupUrlCall<'a, C> {
9239 self._delegate = Some(new_value);
9240 self
9241 }
9242
9243 /// Set any additional parameter of the query string used in the request.
9244 /// It should be used to set parameters which are not yet available through their own
9245 /// setters.
9246 ///
9247 /// Please note that this method must not be used to set any of the known parameters
9248 /// which have their own setter method. If done anyway, the request will fail.
9249 ///
9250 /// # Additional Parameters
9251 ///
9252 /// * *$.xgafv* (query-string) - V1 error format.
9253 /// * *access_token* (query-string) - OAuth access token.
9254 /// * *alt* (query-string) - Data format for response.
9255 /// * *callback* (query-string) - JSONP
9256 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9257 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9258 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9259 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9260 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9261 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9262 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9263 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseGenerateSignupUrlCall<'a, C>
9264 where
9265 T: AsRef<str>,
9266 {
9267 self._additional_params
9268 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9269 self
9270 }
9271
9272 /// Identifies the authorization scope for the method you are building.
9273 ///
9274 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9275 /// [`Scope::Full`].
9276 ///
9277 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9278 /// tokens for more than one scope.
9279 ///
9280 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9281 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9282 /// sufficient, a read-write scope will do as well.
9283 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseGenerateSignupUrlCall<'a, C>
9284 where
9285 St: AsRef<str>,
9286 {
9287 self._scopes.insert(String::from(scope.as_ref()));
9288 self
9289 }
9290 /// Identifies the authorization scope(s) for the method you are building.
9291 ///
9292 /// See [`Self::add_scope()`] for details.
9293 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseGenerateSignupUrlCall<'a, C>
9294 where
9295 I: IntoIterator<Item = St>,
9296 St: AsRef<str>,
9297 {
9298 self._scopes
9299 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9300 self
9301 }
9302
9303 /// Removes all scopes, and no default scope will be used either.
9304 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9305 /// for details).
9306 pub fn clear_scopes(mut self) -> EnterpriseGenerateSignupUrlCall<'a, C> {
9307 self._scopes.clear();
9308 self
9309 }
9310}
9311
9312/// Retrieves the name and domain of an enterprise.
9313///
9314/// A builder for the *get* method supported by a *enterprise* resource.
9315/// It is not used directly, but through a [`EnterpriseMethods`] instance.
9316///
9317/// # Example
9318///
9319/// Instantiate a resource method builder
9320///
9321/// ```test_harness,no_run
9322/// # extern crate hyper;
9323/// # extern crate hyper_rustls;
9324/// # extern crate google_androidenterprise1 as androidenterprise1;
9325/// # async fn dox() {
9326/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9327///
9328/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9329/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9330/// # .with_native_roots()
9331/// # .unwrap()
9332/// # .https_only()
9333/// # .enable_http2()
9334/// # .build();
9335///
9336/// # let executor = hyper_util::rt::TokioExecutor::new();
9337/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9338/// # secret,
9339/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9340/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9341/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9342/// # ),
9343/// # ).build().await.unwrap();
9344///
9345/// # let client = hyper_util::client::legacy::Client::builder(
9346/// # hyper_util::rt::TokioExecutor::new()
9347/// # )
9348/// # .build(
9349/// # hyper_rustls::HttpsConnectorBuilder::new()
9350/// # .with_native_roots()
9351/// # .unwrap()
9352/// # .https_or_http()
9353/// # .enable_http2()
9354/// # .build()
9355/// # );
9356/// # let mut hub = AndroidEnterprise::new(client, auth);
9357/// // You can configure optional parameters by calling the respective setters at will, and
9358/// // execute the final call using `doit()`.
9359/// // Values shown here are possibly random and not representative !
9360/// let result = hub.enterprises().get("enterpriseId")
9361/// .doit().await;
9362/// # }
9363/// ```
9364pub struct EnterpriseGetCall<'a, C>
9365where
9366 C: 'a,
9367{
9368 hub: &'a AndroidEnterprise<C>,
9369 _enterprise_id: String,
9370 _delegate: Option<&'a mut dyn common::Delegate>,
9371 _additional_params: HashMap<String, String>,
9372 _scopes: BTreeSet<String>,
9373}
9374
9375impl<'a, C> common::CallBuilder for EnterpriseGetCall<'a, C> {}
9376
9377impl<'a, C> EnterpriseGetCall<'a, C>
9378where
9379 C: common::Connector,
9380{
9381 /// Perform the operation you have build so far.
9382 pub async fn doit(mut self) -> common::Result<(common::Response, Enterprise)> {
9383 use std::borrow::Cow;
9384 use std::io::{Read, Seek};
9385
9386 use common::{url::Params, ToParts};
9387 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9388
9389 let mut dd = common::DefaultDelegate;
9390 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9391 dlg.begin(common::MethodInfo {
9392 id: "androidenterprise.enterprises.get",
9393 http_method: hyper::Method::GET,
9394 });
9395
9396 for &field in ["alt", "enterpriseId"].iter() {
9397 if self._additional_params.contains_key(field) {
9398 dlg.finished(false);
9399 return Err(common::Error::FieldClash(field));
9400 }
9401 }
9402
9403 let mut params = Params::with_capacity(3 + self._additional_params.len());
9404 params.push("enterpriseId", self._enterprise_id);
9405
9406 params.extend(self._additional_params.iter());
9407
9408 params.push("alt", "json");
9409 let mut url =
9410 self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}";
9411 if self._scopes.is_empty() {
9412 self._scopes.insert(Scope::Full.as_ref().to_string());
9413 }
9414
9415 #[allow(clippy::single_element_loop)]
9416 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
9417 url = params.uri_replacement(url, param_name, find_this, false);
9418 }
9419 {
9420 let to_remove = ["enterpriseId"];
9421 params.remove_params(&to_remove);
9422 }
9423
9424 let url = params.parse_with_url(&url);
9425
9426 loop {
9427 let token = match self
9428 .hub
9429 .auth
9430 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9431 .await
9432 {
9433 Ok(token) => token,
9434 Err(e) => match dlg.token(e) {
9435 Ok(token) => token,
9436 Err(e) => {
9437 dlg.finished(false);
9438 return Err(common::Error::MissingToken(e));
9439 }
9440 },
9441 };
9442 let mut req_result = {
9443 let client = &self.hub.client;
9444 dlg.pre_request();
9445 let mut req_builder = hyper::Request::builder()
9446 .method(hyper::Method::GET)
9447 .uri(url.as_str())
9448 .header(USER_AGENT, self.hub._user_agent.clone());
9449
9450 if let Some(token) = token.as_ref() {
9451 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9452 }
9453
9454 let request = req_builder
9455 .header(CONTENT_LENGTH, 0_u64)
9456 .body(common::to_body::<String>(None));
9457
9458 client.request(request.unwrap()).await
9459 };
9460
9461 match req_result {
9462 Err(err) => {
9463 if let common::Retry::After(d) = dlg.http_error(&err) {
9464 sleep(d).await;
9465 continue;
9466 }
9467 dlg.finished(false);
9468 return Err(common::Error::HttpError(err));
9469 }
9470 Ok(res) => {
9471 let (mut parts, body) = res.into_parts();
9472 let mut body = common::Body::new(body);
9473 if !parts.status.is_success() {
9474 let bytes = common::to_bytes(body).await.unwrap_or_default();
9475 let error = serde_json::from_str(&common::to_string(&bytes));
9476 let response = common::to_response(parts, bytes.into());
9477
9478 if let common::Retry::After(d) =
9479 dlg.http_failure(&response, error.as_ref().ok())
9480 {
9481 sleep(d).await;
9482 continue;
9483 }
9484
9485 dlg.finished(false);
9486
9487 return Err(match error {
9488 Ok(value) => common::Error::BadRequest(value),
9489 _ => common::Error::Failure(response),
9490 });
9491 }
9492 let response = {
9493 let bytes = common::to_bytes(body).await.unwrap_or_default();
9494 let encoded = common::to_string(&bytes);
9495 match serde_json::from_str(&encoded) {
9496 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9497 Err(error) => {
9498 dlg.response_json_decode_error(&encoded, &error);
9499 return Err(common::Error::JsonDecodeError(
9500 encoded.to_string(),
9501 error,
9502 ));
9503 }
9504 }
9505 };
9506
9507 dlg.finished(true);
9508 return Ok(response);
9509 }
9510 }
9511 }
9512 }
9513
9514 /// The ID of the enterprise.
9515 ///
9516 /// Sets the *enterprise id* path property to the given value.
9517 ///
9518 /// Even though the property as already been set when instantiating this call,
9519 /// we provide this method for API completeness.
9520 pub fn enterprise_id(mut self, new_value: &str) -> EnterpriseGetCall<'a, C> {
9521 self._enterprise_id = new_value.to_string();
9522 self
9523 }
9524 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9525 /// while executing the actual API request.
9526 ///
9527 /// ````text
9528 /// It should be used to handle progress information, and to implement a certain level of resilience.
9529 /// ````
9530 ///
9531 /// Sets the *delegate* property to the given value.
9532 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> EnterpriseGetCall<'a, C> {
9533 self._delegate = Some(new_value);
9534 self
9535 }
9536
9537 /// Set any additional parameter of the query string used in the request.
9538 /// It should be used to set parameters which are not yet available through their own
9539 /// setters.
9540 ///
9541 /// Please note that this method must not be used to set any of the known parameters
9542 /// which have their own setter method. If done anyway, the request will fail.
9543 ///
9544 /// # Additional Parameters
9545 ///
9546 /// * *$.xgafv* (query-string) - V1 error format.
9547 /// * *access_token* (query-string) - OAuth access token.
9548 /// * *alt* (query-string) - Data format for response.
9549 /// * *callback* (query-string) - JSONP
9550 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9551 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9552 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9553 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9554 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9555 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9556 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9557 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseGetCall<'a, C>
9558 where
9559 T: AsRef<str>,
9560 {
9561 self._additional_params
9562 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9563 self
9564 }
9565
9566 /// Identifies the authorization scope for the method you are building.
9567 ///
9568 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9569 /// [`Scope::Full`].
9570 ///
9571 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9572 /// tokens for more than one scope.
9573 ///
9574 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9575 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9576 /// sufficient, a read-write scope will do as well.
9577 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseGetCall<'a, C>
9578 where
9579 St: AsRef<str>,
9580 {
9581 self._scopes.insert(String::from(scope.as_ref()));
9582 self
9583 }
9584 /// Identifies the authorization scope(s) for the method you are building.
9585 ///
9586 /// See [`Self::add_scope()`] for details.
9587 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseGetCall<'a, C>
9588 where
9589 I: IntoIterator<Item = St>,
9590 St: AsRef<str>,
9591 {
9592 self._scopes
9593 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9594 self
9595 }
9596
9597 /// Removes all scopes, and no default scope will be used either.
9598 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9599 /// for details).
9600 pub fn clear_scopes(mut self) -> EnterpriseGetCall<'a, C> {
9601 self._scopes.clear();
9602 self
9603 }
9604}
9605
9606/// Returns a service account and credentials. The service account can be bound to the enterprise by calling setAccount. The service account is unique to this enterprise and EMM, and will be deleted if the enterprise is unbound. The credentials contain private key data and are not stored server-side. This method can only be called after calling Enterprises.Enroll or Enterprises.CompleteSignup, and before Enterprises.SetAccount; at other times it will return an error. Subsequent calls after the first will generate a new, unique set of credentials, and invalidate the previously generated credentials. Once the service account is bound to the enterprise, it can be managed using the serviceAccountKeys resource. *Note:* After you create a key, you might need to wait for 60 seconds or more before you perform another operation with the key. If you try to perform an operation with the key immediately after you create the key, and you receive an error, you can retry the request with exponential backoff .
9607///
9608/// A builder for the *getServiceAccount* method supported by a *enterprise* resource.
9609/// It is not used directly, but through a [`EnterpriseMethods`] instance.
9610///
9611/// # Example
9612///
9613/// Instantiate a resource method builder
9614///
9615/// ```test_harness,no_run
9616/// # extern crate hyper;
9617/// # extern crate hyper_rustls;
9618/// # extern crate google_androidenterprise1 as androidenterprise1;
9619/// # async fn dox() {
9620/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9621///
9622/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9623/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9624/// # .with_native_roots()
9625/// # .unwrap()
9626/// # .https_only()
9627/// # .enable_http2()
9628/// # .build();
9629///
9630/// # let executor = hyper_util::rt::TokioExecutor::new();
9631/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9632/// # secret,
9633/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9634/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9635/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9636/// # ),
9637/// # ).build().await.unwrap();
9638///
9639/// # let client = hyper_util::client::legacy::Client::builder(
9640/// # hyper_util::rt::TokioExecutor::new()
9641/// # )
9642/// # .build(
9643/// # hyper_rustls::HttpsConnectorBuilder::new()
9644/// # .with_native_roots()
9645/// # .unwrap()
9646/// # .https_or_http()
9647/// # .enable_http2()
9648/// # .build()
9649/// # );
9650/// # let mut hub = AndroidEnterprise::new(client, auth);
9651/// // You can configure optional parameters by calling the respective setters at will, and
9652/// // execute the final call using `doit()`.
9653/// // Values shown here are possibly random and not representative !
9654/// let result = hub.enterprises().get_service_account("enterpriseId")
9655/// .key_type("no")
9656/// .doit().await;
9657/// # }
9658/// ```
9659pub struct EnterpriseGetServiceAccountCall<'a, C>
9660where
9661 C: 'a,
9662{
9663 hub: &'a AndroidEnterprise<C>,
9664 _enterprise_id: String,
9665 _key_type: Option<String>,
9666 _delegate: Option<&'a mut dyn common::Delegate>,
9667 _additional_params: HashMap<String, String>,
9668 _scopes: BTreeSet<String>,
9669}
9670
9671impl<'a, C> common::CallBuilder for EnterpriseGetServiceAccountCall<'a, C> {}
9672
9673impl<'a, C> EnterpriseGetServiceAccountCall<'a, C>
9674where
9675 C: common::Connector,
9676{
9677 /// Perform the operation you have build so far.
9678 pub async fn doit(mut self) -> common::Result<(common::Response, ServiceAccount)> {
9679 use std::borrow::Cow;
9680 use std::io::{Read, Seek};
9681
9682 use common::{url::Params, ToParts};
9683 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9684
9685 let mut dd = common::DefaultDelegate;
9686 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9687 dlg.begin(common::MethodInfo {
9688 id: "androidenterprise.enterprises.getServiceAccount",
9689 http_method: hyper::Method::GET,
9690 });
9691
9692 for &field in ["alt", "enterpriseId", "keyType"].iter() {
9693 if self._additional_params.contains_key(field) {
9694 dlg.finished(false);
9695 return Err(common::Error::FieldClash(field));
9696 }
9697 }
9698
9699 let mut params = Params::with_capacity(4 + self._additional_params.len());
9700 params.push("enterpriseId", self._enterprise_id);
9701 if let Some(value) = self._key_type.as_ref() {
9702 params.push("keyType", value);
9703 }
9704
9705 params.extend(self._additional_params.iter());
9706
9707 params.push("alt", "json");
9708 let mut url = self.hub._base_url.clone()
9709 + "androidenterprise/v1/enterprises/{enterpriseId}/serviceAccount";
9710 if self._scopes.is_empty() {
9711 self._scopes.insert(Scope::Full.as_ref().to_string());
9712 }
9713
9714 #[allow(clippy::single_element_loop)]
9715 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
9716 url = params.uri_replacement(url, param_name, find_this, false);
9717 }
9718 {
9719 let to_remove = ["enterpriseId"];
9720 params.remove_params(&to_remove);
9721 }
9722
9723 let url = params.parse_with_url(&url);
9724
9725 loop {
9726 let token = match self
9727 .hub
9728 .auth
9729 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9730 .await
9731 {
9732 Ok(token) => token,
9733 Err(e) => match dlg.token(e) {
9734 Ok(token) => token,
9735 Err(e) => {
9736 dlg.finished(false);
9737 return Err(common::Error::MissingToken(e));
9738 }
9739 },
9740 };
9741 let mut req_result = {
9742 let client = &self.hub.client;
9743 dlg.pre_request();
9744 let mut req_builder = hyper::Request::builder()
9745 .method(hyper::Method::GET)
9746 .uri(url.as_str())
9747 .header(USER_AGENT, self.hub._user_agent.clone());
9748
9749 if let Some(token) = token.as_ref() {
9750 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9751 }
9752
9753 let request = req_builder
9754 .header(CONTENT_LENGTH, 0_u64)
9755 .body(common::to_body::<String>(None));
9756
9757 client.request(request.unwrap()).await
9758 };
9759
9760 match req_result {
9761 Err(err) => {
9762 if let common::Retry::After(d) = dlg.http_error(&err) {
9763 sleep(d).await;
9764 continue;
9765 }
9766 dlg.finished(false);
9767 return Err(common::Error::HttpError(err));
9768 }
9769 Ok(res) => {
9770 let (mut parts, body) = res.into_parts();
9771 let mut body = common::Body::new(body);
9772 if !parts.status.is_success() {
9773 let bytes = common::to_bytes(body).await.unwrap_or_default();
9774 let error = serde_json::from_str(&common::to_string(&bytes));
9775 let response = common::to_response(parts, bytes.into());
9776
9777 if let common::Retry::After(d) =
9778 dlg.http_failure(&response, error.as_ref().ok())
9779 {
9780 sleep(d).await;
9781 continue;
9782 }
9783
9784 dlg.finished(false);
9785
9786 return Err(match error {
9787 Ok(value) => common::Error::BadRequest(value),
9788 _ => common::Error::Failure(response),
9789 });
9790 }
9791 let response = {
9792 let bytes = common::to_bytes(body).await.unwrap_or_default();
9793 let encoded = common::to_string(&bytes);
9794 match serde_json::from_str(&encoded) {
9795 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9796 Err(error) => {
9797 dlg.response_json_decode_error(&encoded, &error);
9798 return Err(common::Error::JsonDecodeError(
9799 encoded.to_string(),
9800 error,
9801 ));
9802 }
9803 }
9804 };
9805
9806 dlg.finished(true);
9807 return Ok(response);
9808 }
9809 }
9810 }
9811 }
9812
9813 /// The ID of the enterprise.
9814 ///
9815 /// Sets the *enterprise id* path property to the given value.
9816 ///
9817 /// Even though the property as already been set when instantiating this call,
9818 /// we provide this method for API completeness.
9819 pub fn enterprise_id(mut self, new_value: &str) -> EnterpriseGetServiceAccountCall<'a, C> {
9820 self._enterprise_id = new_value.to_string();
9821 self
9822 }
9823 /// The type of credential to return with the service account. Required.
9824 ///
9825 /// Sets the *key type* query property to the given value.
9826 pub fn key_type(mut self, new_value: &str) -> EnterpriseGetServiceAccountCall<'a, C> {
9827 self._key_type = Some(new_value.to_string());
9828 self
9829 }
9830 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9831 /// while executing the actual API request.
9832 ///
9833 /// ````text
9834 /// It should be used to handle progress information, and to implement a certain level of resilience.
9835 /// ````
9836 ///
9837 /// Sets the *delegate* property to the given value.
9838 pub fn delegate(
9839 mut self,
9840 new_value: &'a mut dyn common::Delegate,
9841 ) -> EnterpriseGetServiceAccountCall<'a, C> {
9842 self._delegate = Some(new_value);
9843 self
9844 }
9845
9846 /// Set any additional parameter of the query string used in the request.
9847 /// It should be used to set parameters which are not yet available through their own
9848 /// setters.
9849 ///
9850 /// Please note that this method must not be used to set any of the known parameters
9851 /// which have their own setter method. If done anyway, the request will fail.
9852 ///
9853 /// # Additional Parameters
9854 ///
9855 /// * *$.xgafv* (query-string) - V1 error format.
9856 /// * *access_token* (query-string) - OAuth access token.
9857 /// * *alt* (query-string) - Data format for response.
9858 /// * *callback* (query-string) - JSONP
9859 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9860 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9861 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9862 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9863 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9864 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9865 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9866 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseGetServiceAccountCall<'a, C>
9867 where
9868 T: AsRef<str>,
9869 {
9870 self._additional_params
9871 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9872 self
9873 }
9874
9875 /// Identifies the authorization scope for the method you are building.
9876 ///
9877 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9878 /// [`Scope::Full`].
9879 ///
9880 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9881 /// tokens for more than one scope.
9882 ///
9883 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9884 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9885 /// sufficient, a read-write scope will do as well.
9886 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseGetServiceAccountCall<'a, C>
9887 where
9888 St: AsRef<str>,
9889 {
9890 self._scopes.insert(String::from(scope.as_ref()));
9891 self
9892 }
9893 /// Identifies the authorization scope(s) for the method you are building.
9894 ///
9895 /// See [`Self::add_scope()`] for details.
9896 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseGetServiceAccountCall<'a, C>
9897 where
9898 I: IntoIterator<Item = St>,
9899 St: AsRef<str>,
9900 {
9901 self._scopes
9902 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9903 self
9904 }
9905
9906 /// Removes all scopes, and no default scope will be used either.
9907 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9908 /// for details).
9909 pub fn clear_scopes(mut self) -> EnterpriseGetServiceAccountCall<'a, C> {
9910 self._scopes.clear();
9911 self
9912 }
9913}
9914
9915/// Returns the store layout for the enterprise. If the store layout has not been set, returns "basic" as the store layout type and no homepage.
9916///
9917/// A builder for the *getStoreLayout* method supported by a *enterprise* resource.
9918/// It is not used directly, but through a [`EnterpriseMethods`] instance.
9919///
9920/// # Example
9921///
9922/// Instantiate a resource method builder
9923///
9924/// ```test_harness,no_run
9925/// # extern crate hyper;
9926/// # extern crate hyper_rustls;
9927/// # extern crate google_androidenterprise1 as androidenterprise1;
9928/// # async fn dox() {
9929/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9930///
9931/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9932/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9933/// # .with_native_roots()
9934/// # .unwrap()
9935/// # .https_only()
9936/// # .enable_http2()
9937/// # .build();
9938///
9939/// # let executor = hyper_util::rt::TokioExecutor::new();
9940/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9941/// # secret,
9942/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9943/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9944/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9945/// # ),
9946/// # ).build().await.unwrap();
9947///
9948/// # let client = hyper_util::client::legacy::Client::builder(
9949/// # hyper_util::rt::TokioExecutor::new()
9950/// # )
9951/// # .build(
9952/// # hyper_rustls::HttpsConnectorBuilder::new()
9953/// # .with_native_roots()
9954/// # .unwrap()
9955/// # .https_or_http()
9956/// # .enable_http2()
9957/// # .build()
9958/// # );
9959/// # let mut hub = AndroidEnterprise::new(client, auth);
9960/// // You can configure optional parameters by calling the respective setters at will, and
9961/// // execute the final call using `doit()`.
9962/// // Values shown here are possibly random and not representative !
9963/// let result = hub.enterprises().get_store_layout("enterpriseId")
9964/// .doit().await;
9965/// # }
9966/// ```
9967pub struct EnterpriseGetStoreLayoutCall<'a, C>
9968where
9969 C: 'a,
9970{
9971 hub: &'a AndroidEnterprise<C>,
9972 _enterprise_id: String,
9973 _delegate: Option<&'a mut dyn common::Delegate>,
9974 _additional_params: HashMap<String, String>,
9975 _scopes: BTreeSet<String>,
9976}
9977
9978impl<'a, C> common::CallBuilder for EnterpriseGetStoreLayoutCall<'a, C> {}
9979
9980impl<'a, C> EnterpriseGetStoreLayoutCall<'a, C>
9981where
9982 C: common::Connector,
9983{
9984 /// Perform the operation you have build so far.
9985 pub async fn doit(mut self) -> common::Result<(common::Response, StoreLayout)> {
9986 use std::borrow::Cow;
9987 use std::io::{Read, Seek};
9988
9989 use common::{url::Params, ToParts};
9990 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9991
9992 let mut dd = common::DefaultDelegate;
9993 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9994 dlg.begin(common::MethodInfo {
9995 id: "androidenterprise.enterprises.getStoreLayout",
9996 http_method: hyper::Method::GET,
9997 });
9998
9999 for &field in ["alt", "enterpriseId"].iter() {
10000 if self._additional_params.contains_key(field) {
10001 dlg.finished(false);
10002 return Err(common::Error::FieldClash(field));
10003 }
10004 }
10005
10006 let mut params = Params::with_capacity(3 + self._additional_params.len());
10007 params.push("enterpriseId", self._enterprise_id);
10008
10009 params.extend(self._additional_params.iter());
10010
10011 params.push("alt", "json");
10012 let mut url = self.hub._base_url.clone()
10013 + "androidenterprise/v1/enterprises/{enterpriseId}/storeLayout";
10014 if self._scopes.is_empty() {
10015 self._scopes.insert(Scope::Full.as_ref().to_string());
10016 }
10017
10018 #[allow(clippy::single_element_loop)]
10019 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
10020 url = params.uri_replacement(url, param_name, find_this, false);
10021 }
10022 {
10023 let to_remove = ["enterpriseId"];
10024 params.remove_params(&to_remove);
10025 }
10026
10027 let url = params.parse_with_url(&url);
10028
10029 loop {
10030 let token = match self
10031 .hub
10032 .auth
10033 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10034 .await
10035 {
10036 Ok(token) => token,
10037 Err(e) => match dlg.token(e) {
10038 Ok(token) => token,
10039 Err(e) => {
10040 dlg.finished(false);
10041 return Err(common::Error::MissingToken(e));
10042 }
10043 },
10044 };
10045 let mut req_result = {
10046 let client = &self.hub.client;
10047 dlg.pre_request();
10048 let mut req_builder = hyper::Request::builder()
10049 .method(hyper::Method::GET)
10050 .uri(url.as_str())
10051 .header(USER_AGENT, self.hub._user_agent.clone());
10052
10053 if let Some(token) = token.as_ref() {
10054 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10055 }
10056
10057 let request = req_builder
10058 .header(CONTENT_LENGTH, 0_u64)
10059 .body(common::to_body::<String>(None));
10060
10061 client.request(request.unwrap()).await
10062 };
10063
10064 match req_result {
10065 Err(err) => {
10066 if let common::Retry::After(d) = dlg.http_error(&err) {
10067 sleep(d).await;
10068 continue;
10069 }
10070 dlg.finished(false);
10071 return Err(common::Error::HttpError(err));
10072 }
10073 Ok(res) => {
10074 let (mut parts, body) = res.into_parts();
10075 let mut body = common::Body::new(body);
10076 if !parts.status.is_success() {
10077 let bytes = common::to_bytes(body).await.unwrap_or_default();
10078 let error = serde_json::from_str(&common::to_string(&bytes));
10079 let response = common::to_response(parts, bytes.into());
10080
10081 if let common::Retry::After(d) =
10082 dlg.http_failure(&response, error.as_ref().ok())
10083 {
10084 sleep(d).await;
10085 continue;
10086 }
10087
10088 dlg.finished(false);
10089
10090 return Err(match error {
10091 Ok(value) => common::Error::BadRequest(value),
10092 _ => common::Error::Failure(response),
10093 });
10094 }
10095 let response = {
10096 let bytes = common::to_bytes(body).await.unwrap_or_default();
10097 let encoded = common::to_string(&bytes);
10098 match serde_json::from_str(&encoded) {
10099 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10100 Err(error) => {
10101 dlg.response_json_decode_error(&encoded, &error);
10102 return Err(common::Error::JsonDecodeError(
10103 encoded.to_string(),
10104 error,
10105 ));
10106 }
10107 }
10108 };
10109
10110 dlg.finished(true);
10111 return Ok(response);
10112 }
10113 }
10114 }
10115 }
10116
10117 /// The ID of the enterprise.
10118 ///
10119 /// Sets the *enterprise id* path property to the given value.
10120 ///
10121 /// Even though the property as already been set when instantiating this call,
10122 /// we provide this method for API completeness.
10123 pub fn enterprise_id(mut self, new_value: &str) -> EnterpriseGetStoreLayoutCall<'a, C> {
10124 self._enterprise_id = new_value.to_string();
10125 self
10126 }
10127 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10128 /// while executing the actual API request.
10129 ///
10130 /// ````text
10131 /// It should be used to handle progress information, and to implement a certain level of resilience.
10132 /// ````
10133 ///
10134 /// Sets the *delegate* property to the given value.
10135 pub fn delegate(
10136 mut self,
10137 new_value: &'a mut dyn common::Delegate,
10138 ) -> EnterpriseGetStoreLayoutCall<'a, C> {
10139 self._delegate = Some(new_value);
10140 self
10141 }
10142
10143 /// Set any additional parameter of the query string used in the request.
10144 /// It should be used to set parameters which are not yet available through their own
10145 /// setters.
10146 ///
10147 /// Please note that this method must not be used to set any of the known parameters
10148 /// which have their own setter method. If done anyway, the request will fail.
10149 ///
10150 /// # Additional Parameters
10151 ///
10152 /// * *$.xgafv* (query-string) - V1 error format.
10153 /// * *access_token* (query-string) - OAuth access token.
10154 /// * *alt* (query-string) - Data format for response.
10155 /// * *callback* (query-string) - JSONP
10156 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10157 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10158 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10159 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10160 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10161 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10162 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10163 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseGetStoreLayoutCall<'a, C>
10164 where
10165 T: AsRef<str>,
10166 {
10167 self._additional_params
10168 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10169 self
10170 }
10171
10172 /// Identifies the authorization scope for the method you are building.
10173 ///
10174 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10175 /// [`Scope::Full`].
10176 ///
10177 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10178 /// tokens for more than one scope.
10179 ///
10180 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10181 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10182 /// sufficient, a read-write scope will do as well.
10183 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseGetStoreLayoutCall<'a, C>
10184 where
10185 St: AsRef<str>,
10186 {
10187 self._scopes.insert(String::from(scope.as_ref()));
10188 self
10189 }
10190 /// Identifies the authorization scope(s) for the method you are building.
10191 ///
10192 /// See [`Self::add_scope()`] for details.
10193 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseGetStoreLayoutCall<'a, C>
10194 where
10195 I: IntoIterator<Item = St>,
10196 St: AsRef<str>,
10197 {
10198 self._scopes
10199 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10200 self
10201 }
10202
10203 /// Removes all scopes, and no default scope will be used either.
10204 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10205 /// for details).
10206 pub fn clear_scopes(mut self) -> EnterpriseGetStoreLayoutCall<'a, C> {
10207 self._scopes.clear();
10208 self
10209 }
10210}
10211
10212/// Looks up an enterprise by domain name. This is only supported for enterprises created via the Google-initiated creation flow. Lookup of the id is not needed for enterprises created via the EMM-initiated flow since the EMM learns the enterprise ID in the callback specified in the Enterprises.generateSignupUrl call.
10213///
10214/// A builder for the *list* method supported by a *enterprise* resource.
10215/// It is not used directly, but through a [`EnterpriseMethods`] instance.
10216///
10217/// # Example
10218///
10219/// Instantiate a resource method builder
10220///
10221/// ```test_harness,no_run
10222/// # extern crate hyper;
10223/// # extern crate hyper_rustls;
10224/// # extern crate google_androidenterprise1 as androidenterprise1;
10225/// # async fn dox() {
10226/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10227///
10228/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10229/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10230/// # .with_native_roots()
10231/// # .unwrap()
10232/// # .https_only()
10233/// # .enable_http2()
10234/// # .build();
10235///
10236/// # let executor = hyper_util::rt::TokioExecutor::new();
10237/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10238/// # secret,
10239/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10240/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10241/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10242/// # ),
10243/// # ).build().await.unwrap();
10244///
10245/// # let client = hyper_util::client::legacy::Client::builder(
10246/// # hyper_util::rt::TokioExecutor::new()
10247/// # )
10248/// # .build(
10249/// # hyper_rustls::HttpsConnectorBuilder::new()
10250/// # .with_native_roots()
10251/// # .unwrap()
10252/// # .https_or_http()
10253/// # .enable_http2()
10254/// # .build()
10255/// # );
10256/// # let mut hub = AndroidEnterprise::new(client, auth);
10257/// // You can configure optional parameters by calling the respective setters at will, and
10258/// // execute the final call using `doit()`.
10259/// // Values shown here are possibly random and not representative !
10260/// let result = hub.enterprises().list("domain")
10261/// .doit().await;
10262/// # }
10263/// ```
10264pub struct EnterpriseListCall<'a, C>
10265where
10266 C: 'a,
10267{
10268 hub: &'a AndroidEnterprise<C>,
10269 _domain: String,
10270 _delegate: Option<&'a mut dyn common::Delegate>,
10271 _additional_params: HashMap<String, String>,
10272 _scopes: BTreeSet<String>,
10273}
10274
10275impl<'a, C> common::CallBuilder for EnterpriseListCall<'a, C> {}
10276
10277impl<'a, C> EnterpriseListCall<'a, C>
10278where
10279 C: common::Connector,
10280{
10281 /// Perform the operation you have build so far.
10282 pub async fn doit(mut self) -> common::Result<(common::Response, EnterprisesListResponse)> {
10283 use std::borrow::Cow;
10284 use std::io::{Read, Seek};
10285
10286 use common::{url::Params, ToParts};
10287 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10288
10289 let mut dd = common::DefaultDelegate;
10290 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10291 dlg.begin(common::MethodInfo {
10292 id: "androidenterprise.enterprises.list",
10293 http_method: hyper::Method::GET,
10294 });
10295
10296 for &field in ["alt", "domain"].iter() {
10297 if self._additional_params.contains_key(field) {
10298 dlg.finished(false);
10299 return Err(common::Error::FieldClash(field));
10300 }
10301 }
10302
10303 let mut params = Params::with_capacity(3 + self._additional_params.len());
10304 params.push("domain", self._domain);
10305
10306 params.extend(self._additional_params.iter());
10307
10308 params.push("alt", "json");
10309 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises";
10310 if self._scopes.is_empty() {
10311 self._scopes.insert(Scope::Full.as_ref().to_string());
10312 }
10313
10314 let url = params.parse_with_url(&url);
10315
10316 loop {
10317 let token = match self
10318 .hub
10319 .auth
10320 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10321 .await
10322 {
10323 Ok(token) => token,
10324 Err(e) => match dlg.token(e) {
10325 Ok(token) => token,
10326 Err(e) => {
10327 dlg.finished(false);
10328 return Err(common::Error::MissingToken(e));
10329 }
10330 },
10331 };
10332 let mut req_result = {
10333 let client = &self.hub.client;
10334 dlg.pre_request();
10335 let mut req_builder = hyper::Request::builder()
10336 .method(hyper::Method::GET)
10337 .uri(url.as_str())
10338 .header(USER_AGENT, self.hub._user_agent.clone());
10339
10340 if let Some(token) = token.as_ref() {
10341 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10342 }
10343
10344 let request = req_builder
10345 .header(CONTENT_LENGTH, 0_u64)
10346 .body(common::to_body::<String>(None));
10347
10348 client.request(request.unwrap()).await
10349 };
10350
10351 match req_result {
10352 Err(err) => {
10353 if let common::Retry::After(d) = dlg.http_error(&err) {
10354 sleep(d).await;
10355 continue;
10356 }
10357 dlg.finished(false);
10358 return Err(common::Error::HttpError(err));
10359 }
10360 Ok(res) => {
10361 let (mut parts, body) = res.into_parts();
10362 let mut body = common::Body::new(body);
10363 if !parts.status.is_success() {
10364 let bytes = common::to_bytes(body).await.unwrap_or_default();
10365 let error = serde_json::from_str(&common::to_string(&bytes));
10366 let response = common::to_response(parts, bytes.into());
10367
10368 if let common::Retry::After(d) =
10369 dlg.http_failure(&response, error.as_ref().ok())
10370 {
10371 sleep(d).await;
10372 continue;
10373 }
10374
10375 dlg.finished(false);
10376
10377 return Err(match error {
10378 Ok(value) => common::Error::BadRequest(value),
10379 _ => common::Error::Failure(response),
10380 });
10381 }
10382 let response = {
10383 let bytes = common::to_bytes(body).await.unwrap_or_default();
10384 let encoded = common::to_string(&bytes);
10385 match serde_json::from_str(&encoded) {
10386 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10387 Err(error) => {
10388 dlg.response_json_decode_error(&encoded, &error);
10389 return Err(common::Error::JsonDecodeError(
10390 encoded.to_string(),
10391 error,
10392 ));
10393 }
10394 }
10395 };
10396
10397 dlg.finished(true);
10398 return Ok(response);
10399 }
10400 }
10401 }
10402 }
10403
10404 /// Required. The exact primary domain name of the enterprise to look up.
10405 ///
10406 /// Sets the *domain* query property to the given value.
10407 ///
10408 /// Even though the property as already been set when instantiating this call,
10409 /// we provide this method for API completeness.
10410 pub fn domain(mut self, new_value: &str) -> EnterpriseListCall<'a, C> {
10411 self._domain = new_value.to_string();
10412 self
10413 }
10414 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10415 /// while executing the actual API request.
10416 ///
10417 /// ````text
10418 /// It should be used to handle progress information, and to implement a certain level of resilience.
10419 /// ````
10420 ///
10421 /// Sets the *delegate* property to the given value.
10422 pub fn delegate(
10423 mut self,
10424 new_value: &'a mut dyn common::Delegate,
10425 ) -> EnterpriseListCall<'a, C> {
10426 self._delegate = Some(new_value);
10427 self
10428 }
10429
10430 /// Set any additional parameter of the query string used in the request.
10431 /// It should be used to set parameters which are not yet available through their own
10432 /// setters.
10433 ///
10434 /// Please note that this method must not be used to set any of the known parameters
10435 /// which have their own setter method. If done anyway, the request will fail.
10436 ///
10437 /// # Additional Parameters
10438 ///
10439 /// * *$.xgafv* (query-string) - V1 error format.
10440 /// * *access_token* (query-string) - OAuth access token.
10441 /// * *alt* (query-string) - Data format for response.
10442 /// * *callback* (query-string) - JSONP
10443 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10444 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10445 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10446 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10447 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10448 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10449 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10450 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseListCall<'a, C>
10451 where
10452 T: AsRef<str>,
10453 {
10454 self._additional_params
10455 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10456 self
10457 }
10458
10459 /// Identifies the authorization scope for the method you are building.
10460 ///
10461 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10462 /// [`Scope::Full`].
10463 ///
10464 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10465 /// tokens for more than one scope.
10466 ///
10467 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10468 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10469 /// sufficient, a read-write scope will do as well.
10470 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseListCall<'a, C>
10471 where
10472 St: AsRef<str>,
10473 {
10474 self._scopes.insert(String::from(scope.as_ref()));
10475 self
10476 }
10477 /// Identifies the authorization scope(s) for the method you are building.
10478 ///
10479 /// See [`Self::add_scope()`] for details.
10480 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseListCall<'a, C>
10481 where
10482 I: IntoIterator<Item = St>,
10483 St: AsRef<str>,
10484 {
10485 self._scopes
10486 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10487 self
10488 }
10489
10490 /// Removes all scopes, and no default scope will be used either.
10491 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10492 /// for details).
10493 pub fn clear_scopes(mut self) -> EnterpriseListCall<'a, C> {
10494 self._scopes.clear();
10495 self
10496 }
10497}
10498
10499/// Pulls and returns a notification set for the enterprises associated with the service account authenticated for the request. The notification set may be empty if no notification are pending. A notification set returned needs to be acknowledged within 20 seconds by calling Enterprises.AcknowledgeNotificationSet, unless the notification set is empty. Notifications that are not acknowledged within the 20 seconds will eventually be included again in the response to another PullNotificationSet request, and those that are never acknowledged will ultimately be deleted according to the Google Cloud Platform Pub/Sub system policy. Multiple requests might be performed concurrently to retrieve notifications, in which case the pending notifications (if any) will be split among each caller, if any are pending. If no notifications are present, an empty notification list is returned. Subsequent requests may return more notifications once they become available.
10500///
10501/// A builder for the *pullNotificationSet* method supported by a *enterprise* resource.
10502/// It is not used directly, but through a [`EnterpriseMethods`] instance.
10503///
10504/// # Example
10505///
10506/// Instantiate a resource method builder
10507///
10508/// ```test_harness,no_run
10509/// # extern crate hyper;
10510/// # extern crate hyper_rustls;
10511/// # extern crate google_androidenterprise1 as androidenterprise1;
10512/// # async fn dox() {
10513/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10514///
10515/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10516/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10517/// # .with_native_roots()
10518/// # .unwrap()
10519/// # .https_only()
10520/// # .enable_http2()
10521/// # .build();
10522///
10523/// # let executor = hyper_util::rt::TokioExecutor::new();
10524/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10525/// # secret,
10526/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10527/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10528/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10529/// # ),
10530/// # ).build().await.unwrap();
10531///
10532/// # let client = hyper_util::client::legacy::Client::builder(
10533/// # hyper_util::rt::TokioExecutor::new()
10534/// # )
10535/// # .build(
10536/// # hyper_rustls::HttpsConnectorBuilder::new()
10537/// # .with_native_roots()
10538/// # .unwrap()
10539/// # .https_or_http()
10540/// # .enable_http2()
10541/// # .build()
10542/// # );
10543/// # let mut hub = AndroidEnterprise::new(client, auth);
10544/// // You can configure optional parameters by calling the respective setters at will, and
10545/// // execute the final call using `doit()`.
10546/// // Values shown here are possibly random and not representative !
10547/// let result = hub.enterprises().pull_notification_set()
10548/// .request_mode("et")
10549/// .doit().await;
10550/// # }
10551/// ```
10552pub struct EnterprisePullNotificationSetCall<'a, C>
10553where
10554 C: 'a,
10555{
10556 hub: &'a AndroidEnterprise<C>,
10557 _request_mode: Option<String>,
10558 _delegate: Option<&'a mut dyn common::Delegate>,
10559 _additional_params: HashMap<String, String>,
10560 _scopes: BTreeSet<String>,
10561}
10562
10563impl<'a, C> common::CallBuilder for EnterprisePullNotificationSetCall<'a, C> {}
10564
10565impl<'a, C> EnterprisePullNotificationSetCall<'a, C>
10566where
10567 C: common::Connector,
10568{
10569 /// Perform the operation you have build so far.
10570 pub async fn doit(mut self) -> common::Result<(common::Response, NotificationSet)> {
10571 use std::borrow::Cow;
10572 use std::io::{Read, Seek};
10573
10574 use common::{url::Params, ToParts};
10575 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10576
10577 let mut dd = common::DefaultDelegate;
10578 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10579 dlg.begin(common::MethodInfo {
10580 id: "androidenterprise.enterprises.pullNotificationSet",
10581 http_method: hyper::Method::POST,
10582 });
10583
10584 for &field in ["alt", "requestMode"].iter() {
10585 if self._additional_params.contains_key(field) {
10586 dlg.finished(false);
10587 return Err(common::Error::FieldClash(field));
10588 }
10589 }
10590
10591 let mut params = Params::with_capacity(3 + self._additional_params.len());
10592 if let Some(value) = self._request_mode.as_ref() {
10593 params.push("requestMode", value);
10594 }
10595
10596 params.extend(self._additional_params.iter());
10597
10598 params.push("alt", "json");
10599 let mut url =
10600 self.hub._base_url.clone() + "androidenterprise/v1/enterprises/pullNotificationSet";
10601 if self._scopes.is_empty() {
10602 self._scopes.insert(Scope::Full.as_ref().to_string());
10603 }
10604
10605 let url = params.parse_with_url(&url);
10606
10607 loop {
10608 let token = match self
10609 .hub
10610 .auth
10611 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10612 .await
10613 {
10614 Ok(token) => token,
10615 Err(e) => match dlg.token(e) {
10616 Ok(token) => token,
10617 Err(e) => {
10618 dlg.finished(false);
10619 return Err(common::Error::MissingToken(e));
10620 }
10621 },
10622 };
10623 let mut req_result = {
10624 let client = &self.hub.client;
10625 dlg.pre_request();
10626 let mut req_builder = hyper::Request::builder()
10627 .method(hyper::Method::POST)
10628 .uri(url.as_str())
10629 .header(USER_AGENT, self.hub._user_agent.clone());
10630
10631 if let Some(token) = token.as_ref() {
10632 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10633 }
10634
10635 let request = req_builder
10636 .header(CONTENT_LENGTH, 0_u64)
10637 .body(common::to_body::<String>(None));
10638
10639 client.request(request.unwrap()).await
10640 };
10641
10642 match req_result {
10643 Err(err) => {
10644 if let common::Retry::After(d) = dlg.http_error(&err) {
10645 sleep(d).await;
10646 continue;
10647 }
10648 dlg.finished(false);
10649 return Err(common::Error::HttpError(err));
10650 }
10651 Ok(res) => {
10652 let (mut parts, body) = res.into_parts();
10653 let mut body = common::Body::new(body);
10654 if !parts.status.is_success() {
10655 let bytes = common::to_bytes(body).await.unwrap_or_default();
10656 let error = serde_json::from_str(&common::to_string(&bytes));
10657 let response = common::to_response(parts, bytes.into());
10658
10659 if let common::Retry::After(d) =
10660 dlg.http_failure(&response, error.as_ref().ok())
10661 {
10662 sleep(d).await;
10663 continue;
10664 }
10665
10666 dlg.finished(false);
10667
10668 return Err(match error {
10669 Ok(value) => common::Error::BadRequest(value),
10670 _ => common::Error::Failure(response),
10671 });
10672 }
10673 let response = {
10674 let bytes = common::to_bytes(body).await.unwrap_or_default();
10675 let encoded = common::to_string(&bytes);
10676 match serde_json::from_str(&encoded) {
10677 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10678 Err(error) => {
10679 dlg.response_json_decode_error(&encoded, &error);
10680 return Err(common::Error::JsonDecodeError(
10681 encoded.to_string(),
10682 error,
10683 ));
10684 }
10685 }
10686 };
10687
10688 dlg.finished(true);
10689 return Ok(response);
10690 }
10691 }
10692 }
10693 }
10694
10695 /// The request mode for pulling notifications. Specifying waitForNotifications will cause the request to block and wait until one or more notifications are present, or return an empty notification list if no notifications are present after some time. Specifying returnImmediately will cause the request to immediately return the pending notifications, or an empty list if no notifications are present. If omitted, defaults to waitForNotifications.
10696 ///
10697 /// Sets the *request mode* query property to the given value.
10698 pub fn request_mode(mut self, new_value: &str) -> EnterprisePullNotificationSetCall<'a, C> {
10699 self._request_mode = Some(new_value.to_string());
10700 self
10701 }
10702 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10703 /// while executing the actual API request.
10704 ///
10705 /// ````text
10706 /// It should be used to handle progress information, and to implement a certain level of resilience.
10707 /// ````
10708 ///
10709 /// Sets the *delegate* property to the given value.
10710 pub fn delegate(
10711 mut self,
10712 new_value: &'a mut dyn common::Delegate,
10713 ) -> EnterprisePullNotificationSetCall<'a, C> {
10714 self._delegate = Some(new_value);
10715 self
10716 }
10717
10718 /// Set any additional parameter of the query string used in the request.
10719 /// It should be used to set parameters which are not yet available through their own
10720 /// setters.
10721 ///
10722 /// Please note that this method must not be used to set any of the known parameters
10723 /// which have their own setter method. If done anyway, the request will fail.
10724 ///
10725 /// # Additional Parameters
10726 ///
10727 /// * *$.xgafv* (query-string) - V1 error format.
10728 /// * *access_token* (query-string) - OAuth access token.
10729 /// * *alt* (query-string) - Data format for response.
10730 /// * *callback* (query-string) - JSONP
10731 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10732 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10733 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10734 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10735 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10736 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10737 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10738 pub fn param<T>(mut self, name: T, value: T) -> EnterprisePullNotificationSetCall<'a, C>
10739 where
10740 T: AsRef<str>,
10741 {
10742 self._additional_params
10743 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10744 self
10745 }
10746
10747 /// Identifies the authorization scope for the method you are building.
10748 ///
10749 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10750 /// [`Scope::Full`].
10751 ///
10752 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10753 /// tokens for more than one scope.
10754 ///
10755 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10756 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10757 /// sufficient, a read-write scope will do as well.
10758 pub fn add_scope<St>(mut self, scope: St) -> EnterprisePullNotificationSetCall<'a, C>
10759 where
10760 St: AsRef<str>,
10761 {
10762 self._scopes.insert(String::from(scope.as_ref()));
10763 self
10764 }
10765 /// Identifies the authorization scope(s) for the method you are building.
10766 ///
10767 /// See [`Self::add_scope()`] for details.
10768 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterprisePullNotificationSetCall<'a, C>
10769 where
10770 I: IntoIterator<Item = St>,
10771 St: AsRef<str>,
10772 {
10773 self._scopes
10774 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10775 self
10776 }
10777
10778 /// Removes all scopes, and no default scope will be used either.
10779 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10780 /// for details).
10781 pub fn clear_scopes(mut self) -> EnterprisePullNotificationSetCall<'a, C> {
10782 self._scopes.clear();
10783 self
10784 }
10785}
10786
10787/// Sends a test notification to validate the EMM integration with the Google Cloud Pub/Sub service for this enterprise.
10788///
10789/// A builder for the *sendTestPushNotification* method supported by a *enterprise* resource.
10790/// It is not used directly, but through a [`EnterpriseMethods`] instance.
10791///
10792/// # Example
10793///
10794/// Instantiate a resource method builder
10795///
10796/// ```test_harness,no_run
10797/// # extern crate hyper;
10798/// # extern crate hyper_rustls;
10799/// # extern crate google_androidenterprise1 as androidenterprise1;
10800/// # async fn dox() {
10801/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10802///
10803/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10804/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10805/// # .with_native_roots()
10806/// # .unwrap()
10807/// # .https_only()
10808/// # .enable_http2()
10809/// # .build();
10810///
10811/// # let executor = hyper_util::rt::TokioExecutor::new();
10812/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10813/// # secret,
10814/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10815/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10816/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10817/// # ),
10818/// # ).build().await.unwrap();
10819///
10820/// # let client = hyper_util::client::legacy::Client::builder(
10821/// # hyper_util::rt::TokioExecutor::new()
10822/// # )
10823/// # .build(
10824/// # hyper_rustls::HttpsConnectorBuilder::new()
10825/// # .with_native_roots()
10826/// # .unwrap()
10827/// # .https_or_http()
10828/// # .enable_http2()
10829/// # .build()
10830/// # );
10831/// # let mut hub = AndroidEnterprise::new(client, auth);
10832/// // You can configure optional parameters by calling the respective setters at will, and
10833/// // execute the final call using `doit()`.
10834/// // Values shown here are possibly random and not representative !
10835/// let result = hub.enterprises().send_test_push_notification("enterpriseId")
10836/// .doit().await;
10837/// # }
10838/// ```
10839pub struct EnterpriseSendTestPushNotificationCall<'a, C>
10840where
10841 C: 'a,
10842{
10843 hub: &'a AndroidEnterprise<C>,
10844 _enterprise_id: String,
10845 _delegate: Option<&'a mut dyn common::Delegate>,
10846 _additional_params: HashMap<String, String>,
10847 _scopes: BTreeSet<String>,
10848}
10849
10850impl<'a, C> common::CallBuilder for EnterpriseSendTestPushNotificationCall<'a, C> {}
10851
10852impl<'a, C> EnterpriseSendTestPushNotificationCall<'a, C>
10853where
10854 C: common::Connector,
10855{
10856 /// Perform the operation you have build so far.
10857 pub async fn doit(
10858 mut self,
10859 ) -> common::Result<(
10860 common::Response,
10861 EnterprisesSendTestPushNotificationResponse,
10862 )> {
10863 use std::borrow::Cow;
10864 use std::io::{Read, Seek};
10865
10866 use common::{url::Params, ToParts};
10867 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10868
10869 let mut dd = common::DefaultDelegate;
10870 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10871 dlg.begin(common::MethodInfo {
10872 id: "androidenterprise.enterprises.sendTestPushNotification",
10873 http_method: hyper::Method::POST,
10874 });
10875
10876 for &field in ["alt", "enterpriseId"].iter() {
10877 if self._additional_params.contains_key(field) {
10878 dlg.finished(false);
10879 return Err(common::Error::FieldClash(field));
10880 }
10881 }
10882
10883 let mut params = Params::with_capacity(3 + self._additional_params.len());
10884 params.push("enterpriseId", self._enterprise_id);
10885
10886 params.extend(self._additional_params.iter());
10887
10888 params.push("alt", "json");
10889 let mut url = self.hub._base_url.clone()
10890 + "androidenterprise/v1/enterprises/{enterpriseId}/sendTestPushNotification";
10891 if self._scopes.is_empty() {
10892 self._scopes.insert(Scope::Full.as_ref().to_string());
10893 }
10894
10895 #[allow(clippy::single_element_loop)]
10896 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
10897 url = params.uri_replacement(url, param_name, find_this, false);
10898 }
10899 {
10900 let to_remove = ["enterpriseId"];
10901 params.remove_params(&to_remove);
10902 }
10903
10904 let url = params.parse_with_url(&url);
10905
10906 loop {
10907 let token = match self
10908 .hub
10909 .auth
10910 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10911 .await
10912 {
10913 Ok(token) => token,
10914 Err(e) => match dlg.token(e) {
10915 Ok(token) => token,
10916 Err(e) => {
10917 dlg.finished(false);
10918 return Err(common::Error::MissingToken(e));
10919 }
10920 },
10921 };
10922 let mut req_result = {
10923 let client = &self.hub.client;
10924 dlg.pre_request();
10925 let mut req_builder = hyper::Request::builder()
10926 .method(hyper::Method::POST)
10927 .uri(url.as_str())
10928 .header(USER_AGENT, self.hub._user_agent.clone());
10929
10930 if let Some(token) = token.as_ref() {
10931 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10932 }
10933
10934 let request = req_builder
10935 .header(CONTENT_LENGTH, 0_u64)
10936 .body(common::to_body::<String>(None));
10937
10938 client.request(request.unwrap()).await
10939 };
10940
10941 match req_result {
10942 Err(err) => {
10943 if let common::Retry::After(d) = dlg.http_error(&err) {
10944 sleep(d).await;
10945 continue;
10946 }
10947 dlg.finished(false);
10948 return Err(common::Error::HttpError(err));
10949 }
10950 Ok(res) => {
10951 let (mut parts, body) = res.into_parts();
10952 let mut body = common::Body::new(body);
10953 if !parts.status.is_success() {
10954 let bytes = common::to_bytes(body).await.unwrap_or_default();
10955 let error = serde_json::from_str(&common::to_string(&bytes));
10956 let response = common::to_response(parts, bytes.into());
10957
10958 if let common::Retry::After(d) =
10959 dlg.http_failure(&response, error.as_ref().ok())
10960 {
10961 sleep(d).await;
10962 continue;
10963 }
10964
10965 dlg.finished(false);
10966
10967 return Err(match error {
10968 Ok(value) => common::Error::BadRequest(value),
10969 _ => common::Error::Failure(response),
10970 });
10971 }
10972 let response = {
10973 let bytes = common::to_bytes(body).await.unwrap_or_default();
10974 let encoded = common::to_string(&bytes);
10975 match serde_json::from_str(&encoded) {
10976 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10977 Err(error) => {
10978 dlg.response_json_decode_error(&encoded, &error);
10979 return Err(common::Error::JsonDecodeError(
10980 encoded.to_string(),
10981 error,
10982 ));
10983 }
10984 }
10985 };
10986
10987 dlg.finished(true);
10988 return Ok(response);
10989 }
10990 }
10991 }
10992 }
10993
10994 /// The ID of the enterprise.
10995 ///
10996 /// Sets the *enterprise id* path property to the given value.
10997 ///
10998 /// Even though the property as already been set when instantiating this call,
10999 /// we provide this method for API completeness.
11000 pub fn enterprise_id(
11001 mut self,
11002 new_value: &str,
11003 ) -> EnterpriseSendTestPushNotificationCall<'a, C> {
11004 self._enterprise_id = new_value.to_string();
11005 self
11006 }
11007 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11008 /// while executing the actual API request.
11009 ///
11010 /// ````text
11011 /// It should be used to handle progress information, and to implement a certain level of resilience.
11012 /// ````
11013 ///
11014 /// Sets the *delegate* property to the given value.
11015 pub fn delegate(
11016 mut self,
11017 new_value: &'a mut dyn common::Delegate,
11018 ) -> EnterpriseSendTestPushNotificationCall<'a, C> {
11019 self._delegate = Some(new_value);
11020 self
11021 }
11022
11023 /// Set any additional parameter of the query string used in the request.
11024 /// It should be used to set parameters which are not yet available through their own
11025 /// setters.
11026 ///
11027 /// Please note that this method must not be used to set any of the known parameters
11028 /// which have their own setter method. If done anyway, the request will fail.
11029 ///
11030 /// # Additional Parameters
11031 ///
11032 /// * *$.xgafv* (query-string) - V1 error format.
11033 /// * *access_token* (query-string) - OAuth access token.
11034 /// * *alt* (query-string) - Data format for response.
11035 /// * *callback* (query-string) - JSONP
11036 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11037 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11038 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11039 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11040 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11041 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11042 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11043 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseSendTestPushNotificationCall<'a, C>
11044 where
11045 T: AsRef<str>,
11046 {
11047 self._additional_params
11048 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11049 self
11050 }
11051
11052 /// Identifies the authorization scope for the method you are building.
11053 ///
11054 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11055 /// [`Scope::Full`].
11056 ///
11057 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11058 /// tokens for more than one scope.
11059 ///
11060 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11061 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11062 /// sufficient, a read-write scope will do as well.
11063 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseSendTestPushNotificationCall<'a, C>
11064 where
11065 St: AsRef<str>,
11066 {
11067 self._scopes.insert(String::from(scope.as_ref()));
11068 self
11069 }
11070 /// Identifies the authorization scope(s) for the method you are building.
11071 ///
11072 /// See [`Self::add_scope()`] for details.
11073 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseSendTestPushNotificationCall<'a, C>
11074 where
11075 I: IntoIterator<Item = St>,
11076 St: AsRef<str>,
11077 {
11078 self._scopes
11079 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11080 self
11081 }
11082
11083 /// Removes all scopes, and no default scope will be used either.
11084 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11085 /// for details).
11086 pub fn clear_scopes(mut self) -> EnterpriseSendTestPushNotificationCall<'a, C> {
11087 self._scopes.clear();
11088 self
11089 }
11090}
11091
11092/// Sets the account that will be used to authenticate to the API as the enterprise.
11093///
11094/// A builder for the *setAccount* method supported by a *enterprise* resource.
11095/// It is not used directly, but through a [`EnterpriseMethods`] instance.
11096///
11097/// # Example
11098///
11099/// Instantiate a resource method builder
11100///
11101/// ```test_harness,no_run
11102/// # extern crate hyper;
11103/// # extern crate hyper_rustls;
11104/// # extern crate google_androidenterprise1 as androidenterprise1;
11105/// use androidenterprise1::api::EnterpriseAccount;
11106/// # async fn dox() {
11107/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11108///
11109/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11110/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11111/// # .with_native_roots()
11112/// # .unwrap()
11113/// # .https_only()
11114/// # .enable_http2()
11115/// # .build();
11116///
11117/// # let executor = hyper_util::rt::TokioExecutor::new();
11118/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11119/// # secret,
11120/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11121/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11122/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11123/// # ),
11124/// # ).build().await.unwrap();
11125///
11126/// # let client = hyper_util::client::legacy::Client::builder(
11127/// # hyper_util::rt::TokioExecutor::new()
11128/// # )
11129/// # .build(
11130/// # hyper_rustls::HttpsConnectorBuilder::new()
11131/// # .with_native_roots()
11132/// # .unwrap()
11133/// # .https_or_http()
11134/// # .enable_http2()
11135/// # .build()
11136/// # );
11137/// # let mut hub = AndroidEnterprise::new(client, auth);
11138/// // As the method needs a request, you would usually fill it with the desired information
11139/// // into the respective structure. Some of the parts shown here might not be applicable !
11140/// // Values shown here are possibly random and not representative !
11141/// let mut req = EnterpriseAccount::default();
11142///
11143/// // You can configure optional parameters by calling the respective setters at will, and
11144/// // execute the final call using `doit()`.
11145/// // Values shown here are possibly random and not representative !
11146/// let result = hub.enterprises().set_account(req, "enterpriseId")
11147/// .doit().await;
11148/// # }
11149/// ```
11150pub struct EnterpriseSetAccountCall<'a, C>
11151where
11152 C: 'a,
11153{
11154 hub: &'a AndroidEnterprise<C>,
11155 _request: EnterpriseAccount,
11156 _enterprise_id: String,
11157 _delegate: Option<&'a mut dyn common::Delegate>,
11158 _additional_params: HashMap<String, String>,
11159 _scopes: BTreeSet<String>,
11160}
11161
11162impl<'a, C> common::CallBuilder for EnterpriseSetAccountCall<'a, C> {}
11163
11164impl<'a, C> EnterpriseSetAccountCall<'a, C>
11165where
11166 C: common::Connector,
11167{
11168 /// Perform the operation you have build so far.
11169 pub async fn doit(mut self) -> common::Result<(common::Response, EnterpriseAccount)> {
11170 use std::borrow::Cow;
11171 use std::io::{Read, Seek};
11172
11173 use common::{url::Params, ToParts};
11174 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11175
11176 let mut dd = common::DefaultDelegate;
11177 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11178 dlg.begin(common::MethodInfo {
11179 id: "androidenterprise.enterprises.setAccount",
11180 http_method: hyper::Method::PUT,
11181 });
11182
11183 for &field in ["alt", "enterpriseId"].iter() {
11184 if self._additional_params.contains_key(field) {
11185 dlg.finished(false);
11186 return Err(common::Error::FieldClash(field));
11187 }
11188 }
11189
11190 let mut params = Params::with_capacity(4 + self._additional_params.len());
11191 params.push("enterpriseId", self._enterprise_id);
11192
11193 params.extend(self._additional_params.iter());
11194
11195 params.push("alt", "json");
11196 let mut url =
11197 self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/account";
11198 if self._scopes.is_empty() {
11199 self._scopes.insert(Scope::Full.as_ref().to_string());
11200 }
11201
11202 #[allow(clippy::single_element_loop)]
11203 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
11204 url = params.uri_replacement(url, param_name, find_this, false);
11205 }
11206 {
11207 let to_remove = ["enterpriseId"];
11208 params.remove_params(&to_remove);
11209 }
11210
11211 let url = params.parse_with_url(&url);
11212
11213 let mut json_mime_type = mime::APPLICATION_JSON;
11214 let mut request_value_reader = {
11215 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11216 common::remove_json_null_values(&mut value);
11217 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11218 serde_json::to_writer(&mut dst, &value).unwrap();
11219 dst
11220 };
11221 let request_size = request_value_reader
11222 .seek(std::io::SeekFrom::End(0))
11223 .unwrap();
11224 request_value_reader
11225 .seek(std::io::SeekFrom::Start(0))
11226 .unwrap();
11227
11228 loop {
11229 let token = match self
11230 .hub
11231 .auth
11232 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11233 .await
11234 {
11235 Ok(token) => token,
11236 Err(e) => match dlg.token(e) {
11237 Ok(token) => token,
11238 Err(e) => {
11239 dlg.finished(false);
11240 return Err(common::Error::MissingToken(e));
11241 }
11242 },
11243 };
11244 request_value_reader
11245 .seek(std::io::SeekFrom::Start(0))
11246 .unwrap();
11247 let mut req_result = {
11248 let client = &self.hub.client;
11249 dlg.pre_request();
11250 let mut req_builder = hyper::Request::builder()
11251 .method(hyper::Method::PUT)
11252 .uri(url.as_str())
11253 .header(USER_AGENT, self.hub._user_agent.clone());
11254
11255 if let Some(token) = token.as_ref() {
11256 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11257 }
11258
11259 let request = req_builder
11260 .header(CONTENT_TYPE, json_mime_type.to_string())
11261 .header(CONTENT_LENGTH, request_size as u64)
11262 .body(common::to_body(
11263 request_value_reader.get_ref().clone().into(),
11264 ));
11265
11266 client.request(request.unwrap()).await
11267 };
11268
11269 match req_result {
11270 Err(err) => {
11271 if let common::Retry::After(d) = dlg.http_error(&err) {
11272 sleep(d).await;
11273 continue;
11274 }
11275 dlg.finished(false);
11276 return Err(common::Error::HttpError(err));
11277 }
11278 Ok(res) => {
11279 let (mut parts, body) = res.into_parts();
11280 let mut body = common::Body::new(body);
11281 if !parts.status.is_success() {
11282 let bytes = common::to_bytes(body).await.unwrap_or_default();
11283 let error = serde_json::from_str(&common::to_string(&bytes));
11284 let response = common::to_response(parts, bytes.into());
11285
11286 if let common::Retry::After(d) =
11287 dlg.http_failure(&response, error.as_ref().ok())
11288 {
11289 sleep(d).await;
11290 continue;
11291 }
11292
11293 dlg.finished(false);
11294
11295 return Err(match error {
11296 Ok(value) => common::Error::BadRequest(value),
11297 _ => common::Error::Failure(response),
11298 });
11299 }
11300 let response = {
11301 let bytes = common::to_bytes(body).await.unwrap_or_default();
11302 let encoded = common::to_string(&bytes);
11303 match serde_json::from_str(&encoded) {
11304 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11305 Err(error) => {
11306 dlg.response_json_decode_error(&encoded, &error);
11307 return Err(common::Error::JsonDecodeError(
11308 encoded.to_string(),
11309 error,
11310 ));
11311 }
11312 }
11313 };
11314
11315 dlg.finished(true);
11316 return Ok(response);
11317 }
11318 }
11319 }
11320 }
11321
11322 ///
11323 /// Sets the *request* property to the given value.
11324 ///
11325 /// Even though the property as already been set when instantiating this call,
11326 /// we provide this method for API completeness.
11327 pub fn request(mut self, new_value: EnterpriseAccount) -> EnterpriseSetAccountCall<'a, C> {
11328 self._request = new_value;
11329 self
11330 }
11331 /// The ID of the enterprise.
11332 ///
11333 /// Sets the *enterprise id* path property to the given value.
11334 ///
11335 /// Even though the property as already been set when instantiating this call,
11336 /// we provide this method for API completeness.
11337 pub fn enterprise_id(mut self, new_value: &str) -> EnterpriseSetAccountCall<'a, C> {
11338 self._enterprise_id = new_value.to_string();
11339 self
11340 }
11341 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11342 /// while executing the actual API request.
11343 ///
11344 /// ````text
11345 /// It should be used to handle progress information, and to implement a certain level of resilience.
11346 /// ````
11347 ///
11348 /// Sets the *delegate* property to the given value.
11349 pub fn delegate(
11350 mut self,
11351 new_value: &'a mut dyn common::Delegate,
11352 ) -> EnterpriseSetAccountCall<'a, C> {
11353 self._delegate = Some(new_value);
11354 self
11355 }
11356
11357 /// Set any additional parameter of the query string used in the request.
11358 /// It should be used to set parameters which are not yet available through their own
11359 /// setters.
11360 ///
11361 /// Please note that this method must not be used to set any of the known parameters
11362 /// which have their own setter method. If done anyway, the request will fail.
11363 ///
11364 /// # Additional Parameters
11365 ///
11366 /// * *$.xgafv* (query-string) - V1 error format.
11367 /// * *access_token* (query-string) - OAuth access token.
11368 /// * *alt* (query-string) - Data format for response.
11369 /// * *callback* (query-string) - JSONP
11370 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11371 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11372 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11373 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11374 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11375 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11376 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11377 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseSetAccountCall<'a, C>
11378 where
11379 T: AsRef<str>,
11380 {
11381 self._additional_params
11382 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11383 self
11384 }
11385
11386 /// Identifies the authorization scope for the method you are building.
11387 ///
11388 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11389 /// [`Scope::Full`].
11390 ///
11391 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11392 /// tokens for more than one scope.
11393 ///
11394 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11395 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11396 /// sufficient, a read-write scope will do as well.
11397 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseSetAccountCall<'a, C>
11398 where
11399 St: AsRef<str>,
11400 {
11401 self._scopes.insert(String::from(scope.as_ref()));
11402 self
11403 }
11404 /// Identifies the authorization scope(s) for the method you are building.
11405 ///
11406 /// See [`Self::add_scope()`] for details.
11407 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseSetAccountCall<'a, C>
11408 where
11409 I: IntoIterator<Item = St>,
11410 St: AsRef<str>,
11411 {
11412 self._scopes
11413 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11414 self
11415 }
11416
11417 /// Removes all scopes, and no default scope will be used either.
11418 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11419 /// for details).
11420 pub fn clear_scopes(mut self) -> EnterpriseSetAccountCall<'a, C> {
11421 self._scopes.clear();
11422 self
11423 }
11424}
11425
11426/// Sets the store layout for the enterprise. By default, storeLayoutType is set to "basic" and the basic store layout is enabled. The basic layout only contains apps approved by the admin, and that have been added to the available product set for a user (using the setAvailableProductSet call). Apps on the page are sorted in order of their product ID value. If you create a custom store layout (by setting storeLayoutType = "custom" and setting a homepage), the basic store layout is disabled.
11427///
11428/// A builder for the *setStoreLayout* method supported by a *enterprise* resource.
11429/// It is not used directly, but through a [`EnterpriseMethods`] instance.
11430///
11431/// # Example
11432///
11433/// Instantiate a resource method builder
11434///
11435/// ```test_harness,no_run
11436/// # extern crate hyper;
11437/// # extern crate hyper_rustls;
11438/// # extern crate google_androidenterprise1 as androidenterprise1;
11439/// use androidenterprise1::api::StoreLayout;
11440/// # async fn dox() {
11441/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11442///
11443/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11444/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11445/// # .with_native_roots()
11446/// # .unwrap()
11447/// # .https_only()
11448/// # .enable_http2()
11449/// # .build();
11450///
11451/// # let executor = hyper_util::rt::TokioExecutor::new();
11452/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11453/// # secret,
11454/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11455/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11456/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11457/// # ),
11458/// # ).build().await.unwrap();
11459///
11460/// # let client = hyper_util::client::legacy::Client::builder(
11461/// # hyper_util::rt::TokioExecutor::new()
11462/// # )
11463/// # .build(
11464/// # hyper_rustls::HttpsConnectorBuilder::new()
11465/// # .with_native_roots()
11466/// # .unwrap()
11467/// # .https_or_http()
11468/// # .enable_http2()
11469/// # .build()
11470/// # );
11471/// # let mut hub = AndroidEnterprise::new(client, auth);
11472/// // As the method needs a request, you would usually fill it with the desired information
11473/// // into the respective structure. Some of the parts shown here might not be applicable !
11474/// // Values shown here are possibly random and not representative !
11475/// let mut req = StoreLayout::default();
11476///
11477/// // You can configure optional parameters by calling the respective setters at will, and
11478/// // execute the final call using `doit()`.
11479/// // Values shown here are possibly random and not representative !
11480/// let result = hub.enterprises().set_store_layout(req, "enterpriseId")
11481/// .doit().await;
11482/// # }
11483/// ```
11484pub struct EnterpriseSetStoreLayoutCall<'a, C>
11485where
11486 C: 'a,
11487{
11488 hub: &'a AndroidEnterprise<C>,
11489 _request: StoreLayout,
11490 _enterprise_id: String,
11491 _delegate: Option<&'a mut dyn common::Delegate>,
11492 _additional_params: HashMap<String, String>,
11493 _scopes: BTreeSet<String>,
11494}
11495
11496impl<'a, C> common::CallBuilder for EnterpriseSetStoreLayoutCall<'a, C> {}
11497
11498impl<'a, C> EnterpriseSetStoreLayoutCall<'a, C>
11499where
11500 C: common::Connector,
11501{
11502 /// Perform the operation you have build so far.
11503 pub async fn doit(mut self) -> common::Result<(common::Response, StoreLayout)> {
11504 use std::borrow::Cow;
11505 use std::io::{Read, Seek};
11506
11507 use common::{url::Params, ToParts};
11508 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11509
11510 let mut dd = common::DefaultDelegate;
11511 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11512 dlg.begin(common::MethodInfo {
11513 id: "androidenterprise.enterprises.setStoreLayout",
11514 http_method: hyper::Method::PUT,
11515 });
11516
11517 for &field in ["alt", "enterpriseId"].iter() {
11518 if self._additional_params.contains_key(field) {
11519 dlg.finished(false);
11520 return Err(common::Error::FieldClash(field));
11521 }
11522 }
11523
11524 let mut params = Params::with_capacity(4 + self._additional_params.len());
11525 params.push("enterpriseId", self._enterprise_id);
11526
11527 params.extend(self._additional_params.iter());
11528
11529 params.push("alt", "json");
11530 let mut url = self.hub._base_url.clone()
11531 + "androidenterprise/v1/enterprises/{enterpriseId}/storeLayout";
11532 if self._scopes.is_empty() {
11533 self._scopes.insert(Scope::Full.as_ref().to_string());
11534 }
11535
11536 #[allow(clippy::single_element_loop)]
11537 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
11538 url = params.uri_replacement(url, param_name, find_this, false);
11539 }
11540 {
11541 let to_remove = ["enterpriseId"];
11542 params.remove_params(&to_remove);
11543 }
11544
11545 let url = params.parse_with_url(&url);
11546
11547 let mut json_mime_type = mime::APPLICATION_JSON;
11548 let mut request_value_reader = {
11549 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11550 common::remove_json_null_values(&mut value);
11551 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11552 serde_json::to_writer(&mut dst, &value).unwrap();
11553 dst
11554 };
11555 let request_size = request_value_reader
11556 .seek(std::io::SeekFrom::End(0))
11557 .unwrap();
11558 request_value_reader
11559 .seek(std::io::SeekFrom::Start(0))
11560 .unwrap();
11561
11562 loop {
11563 let token = match self
11564 .hub
11565 .auth
11566 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11567 .await
11568 {
11569 Ok(token) => token,
11570 Err(e) => match dlg.token(e) {
11571 Ok(token) => token,
11572 Err(e) => {
11573 dlg.finished(false);
11574 return Err(common::Error::MissingToken(e));
11575 }
11576 },
11577 };
11578 request_value_reader
11579 .seek(std::io::SeekFrom::Start(0))
11580 .unwrap();
11581 let mut req_result = {
11582 let client = &self.hub.client;
11583 dlg.pre_request();
11584 let mut req_builder = hyper::Request::builder()
11585 .method(hyper::Method::PUT)
11586 .uri(url.as_str())
11587 .header(USER_AGENT, self.hub._user_agent.clone());
11588
11589 if let Some(token) = token.as_ref() {
11590 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11591 }
11592
11593 let request = req_builder
11594 .header(CONTENT_TYPE, json_mime_type.to_string())
11595 .header(CONTENT_LENGTH, request_size as u64)
11596 .body(common::to_body(
11597 request_value_reader.get_ref().clone().into(),
11598 ));
11599
11600 client.request(request.unwrap()).await
11601 };
11602
11603 match req_result {
11604 Err(err) => {
11605 if let common::Retry::After(d) = dlg.http_error(&err) {
11606 sleep(d).await;
11607 continue;
11608 }
11609 dlg.finished(false);
11610 return Err(common::Error::HttpError(err));
11611 }
11612 Ok(res) => {
11613 let (mut parts, body) = res.into_parts();
11614 let mut body = common::Body::new(body);
11615 if !parts.status.is_success() {
11616 let bytes = common::to_bytes(body).await.unwrap_or_default();
11617 let error = serde_json::from_str(&common::to_string(&bytes));
11618 let response = common::to_response(parts, bytes.into());
11619
11620 if let common::Retry::After(d) =
11621 dlg.http_failure(&response, error.as_ref().ok())
11622 {
11623 sleep(d).await;
11624 continue;
11625 }
11626
11627 dlg.finished(false);
11628
11629 return Err(match error {
11630 Ok(value) => common::Error::BadRequest(value),
11631 _ => common::Error::Failure(response),
11632 });
11633 }
11634 let response = {
11635 let bytes = common::to_bytes(body).await.unwrap_or_default();
11636 let encoded = common::to_string(&bytes);
11637 match serde_json::from_str(&encoded) {
11638 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11639 Err(error) => {
11640 dlg.response_json_decode_error(&encoded, &error);
11641 return Err(common::Error::JsonDecodeError(
11642 encoded.to_string(),
11643 error,
11644 ));
11645 }
11646 }
11647 };
11648
11649 dlg.finished(true);
11650 return Ok(response);
11651 }
11652 }
11653 }
11654 }
11655
11656 ///
11657 /// Sets the *request* property to the given value.
11658 ///
11659 /// Even though the property as already been set when instantiating this call,
11660 /// we provide this method for API completeness.
11661 pub fn request(mut self, new_value: StoreLayout) -> EnterpriseSetStoreLayoutCall<'a, C> {
11662 self._request = new_value;
11663 self
11664 }
11665 /// The ID of the enterprise.
11666 ///
11667 /// Sets the *enterprise id* path property to the given value.
11668 ///
11669 /// Even though the property as already been set when instantiating this call,
11670 /// we provide this method for API completeness.
11671 pub fn enterprise_id(mut self, new_value: &str) -> EnterpriseSetStoreLayoutCall<'a, C> {
11672 self._enterprise_id = new_value.to_string();
11673 self
11674 }
11675 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11676 /// while executing the actual API request.
11677 ///
11678 /// ````text
11679 /// It should be used to handle progress information, and to implement a certain level of resilience.
11680 /// ````
11681 ///
11682 /// Sets the *delegate* property to the given value.
11683 pub fn delegate(
11684 mut self,
11685 new_value: &'a mut dyn common::Delegate,
11686 ) -> EnterpriseSetStoreLayoutCall<'a, C> {
11687 self._delegate = Some(new_value);
11688 self
11689 }
11690
11691 /// Set any additional parameter of the query string used in the request.
11692 /// It should be used to set parameters which are not yet available through their own
11693 /// setters.
11694 ///
11695 /// Please note that this method must not be used to set any of the known parameters
11696 /// which have their own setter method. If done anyway, the request will fail.
11697 ///
11698 /// # Additional Parameters
11699 ///
11700 /// * *$.xgafv* (query-string) - V1 error format.
11701 /// * *access_token* (query-string) - OAuth access token.
11702 /// * *alt* (query-string) - Data format for response.
11703 /// * *callback* (query-string) - JSONP
11704 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11705 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11706 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11707 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11708 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11709 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11710 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11711 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseSetStoreLayoutCall<'a, C>
11712 where
11713 T: AsRef<str>,
11714 {
11715 self._additional_params
11716 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11717 self
11718 }
11719
11720 /// Identifies the authorization scope for the method you are building.
11721 ///
11722 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11723 /// [`Scope::Full`].
11724 ///
11725 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11726 /// tokens for more than one scope.
11727 ///
11728 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11729 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11730 /// sufficient, a read-write scope will do as well.
11731 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseSetStoreLayoutCall<'a, C>
11732 where
11733 St: AsRef<str>,
11734 {
11735 self._scopes.insert(String::from(scope.as_ref()));
11736 self
11737 }
11738 /// Identifies the authorization scope(s) for the method you are building.
11739 ///
11740 /// See [`Self::add_scope()`] for details.
11741 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseSetStoreLayoutCall<'a, C>
11742 where
11743 I: IntoIterator<Item = St>,
11744 St: AsRef<str>,
11745 {
11746 self._scopes
11747 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11748 self
11749 }
11750
11751 /// Removes all scopes, and no default scope will be used either.
11752 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11753 /// for details).
11754 pub fn clear_scopes(mut self) -> EnterpriseSetStoreLayoutCall<'a, C> {
11755 self._scopes.clear();
11756 self
11757 }
11758}
11759
11760/// Unenrolls an enterprise from the calling EMM.
11761///
11762/// A builder for the *unenroll* method supported by a *enterprise* resource.
11763/// It is not used directly, but through a [`EnterpriseMethods`] instance.
11764///
11765/// # Example
11766///
11767/// Instantiate a resource method builder
11768///
11769/// ```test_harness,no_run
11770/// # extern crate hyper;
11771/// # extern crate hyper_rustls;
11772/// # extern crate google_androidenterprise1 as androidenterprise1;
11773/// # async fn dox() {
11774/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11775///
11776/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11777/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11778/// # .with_native_roots()
11779/// # .unwrap()
11780/// # .https_only()
11781/// # .enable_http2()
11782/// # .build();
11783///
11784/// # let executor = hyper_util::rt::TokioExecutor::new();
11785/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11786/// # secret,
11787/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11788/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11789/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11790/// # ),
11791/// # ).build().await.unwrap();
11792///
11793/// # let client = hyper_util::client::legacy::Client::builder(
11794/// # hyper_util::rt::TokioExecutor::new()
11795/// # )
11796/// # .build(
11797/// # hyper_rustls::HttpsConnectorBuilder::new()
11798/// # .with_native_roots()
11799/// # .unwrap()
11800/// # .https_or_http()
11801/// # .enable_http2()
11802/// # .build()
11803/// # );
11804/// # let mut hub = AndroidEnterprise::new(client, auth);
11805/// // You can configure optional parameters by calling the respective setters at will, and
11806/// // execute the final call using `doit()`.
11807/// // Values shown here are possibly random and not representative !
11808/// let result = hub.enterprises().unenroll("enterpriseId")
11809/// .doit().await;
11810/// # }
11811/// ```
11812pub struct EnterpriseUnenrollCall<'a, C>
11813where
11814 C: 'a,
11815{
11816 hub: &'a AndroidEnterprise<C>,
11817 _enterprise_id: String,
11818 _delegate: Option<&'a mut dyn common::Delegate>,
11819 _additional_params: HashMap<String, String>,
11820 _scopes: BTreeSet<String>,
11821}
11822
11823impl<'a, C> common::CallBuilder for EnterpriseUnenrollCall<'a, C> {}
11824
11825impl<'a, C> EnterpriseUnenrollCall<'a, C>
11826where
11827 C: common::Connector,
11828{
11829 /// Perform the operation you have build so far.
11830 pub async fn doit(mut self) -> common::Result<common::Response> {
11831 use std::borrow::Cow;
11832 use std::io::{Read, Seek};
11833
11834 use common::{url::Params, ToParts};
11835 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11836
11837 let mut dd = common::DefaultDelegate;
11838 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11839 dlg.begin(common::MethodInfo {
11840 id: "androidenterprise.enterprises.unenroll",
11841 http_method: hyper::Method::POST,
11842 });
11843
11844 for &field in ["enterpriseId"].iter() {
11845 if self._additional_params.contains_key(field) {
11846 dlg.finished(false);
11847 return Err(common::Error::FieldClash(field));
11848 }
11849 }
11850
11851 let mut params = Params::with_capacity(2 + self._additional_params.len());
11852 params.push("enterpriseId", self._enterprise_id);
11853
11854 params.extend(self._additional_params.iter());
11855
11856 let mut url =
11857 self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/unenroll";
11858 if self._scopes.is_empty() {
11859 self._scopes.insert(Scope::Full.as_ref().to_string());
11860 }
11861
11862 #[allow(clippy::single_element_loop)]
11863 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
11864 url = params.uri_replacement(url, param_name, find_this, false);
11865 }
11866 {
11867 let to_remove = ["enterpriseId"];
11868 params.remove_params(&to_remove);
11869 }
11870
11871 let url = params.parse_with_url(&url);
11872
11873 loop {
11874 let token = match self
11875 .hub
11876 .auth
11877 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11878 .await
11879 {
11880 Ok(token) => token,
11881 Err(e) => match dlg.token(e) {
11882 Ok(token) => token,
11883 Err(e) => {
11884 dlg.finished(false);
11885 return Err(common::Error::MissingToken(e));
11886 }
11887 },
11888 };
11889 let mut req_result = {
11890 let client = &self.hub.client;
11891 dlg.pre_request();
11892 let mut req_builder = hyper::Request::builder()
11893 .method(hyper::Method::POST)
11894 .uri(url.as_str())
11895 .header(USER_AGENT, self.hub._user_agent.clone());
11896
11897 if let Some(token) = token.as_ref() {
11898 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11899 }
11900
11901 let request = req_builder
11902 .header(CONTENT_LENGTH, 0_u64)
11903 .body(common::to_body::<String>(None));
11904
11905 client.request(request.unwrap()).await
11906 };
11907
11908 match req_result {
11909 Err(err) => {
11910 if let common::Retry::After(d) = dlg.http_error(&err) {
11911 sleep(d).await;
11912 continue;
11913 }
11914 dlg.finished(false);
11915 return Err(common::Error::HttpError(err));
11916 }
11917 Ok(res) => {
11918 let (mut parts, body) = res.into_parts();
11919 let mut body = common::Body::new(body);
11920 if !parts.status.is_success() {
11921 let bytes = common::to_bytes(body).await.unwrap_or_default();
11922 let error = serde_json::from_str(&common::to_string(&bytes));
11923 let response = common::to_response(parts, bytes.into());
11924
11925 if let common::Retry::After(d) =
11926 dlg.http_failure(&response, error.as_ref().ok())
11927 {
11928 sleep(d).await;
11929 continue;
11930 }
11931
11932 dlg.finished(false);
11933
11934 return Err(match error {
11935 Ok(value) => common::Error::BadRequest(value),
11936 _ => common::Error::Failure(response),
11937 });
11938 }
11939 let response = common::Response::from_parts(parts, body);
11940
11941 dlg.finished(true);
11942 return Ok(response);
11943 }
11944 }
11945 }
11946 }
11947
11948 /// The ID of the enterprise.
11949 ///
11950 /// Sets the *enterprise id* path property to the given value.
11951 ///
11952 /// Even though the property as already been set when instantiating this call,
11953 /// we provide this method for API completeness.
11954 pub fn enterprise_id(mut self, new_value: &str) -> EnterpriseUnenrollCall<'a, C> {
11955 self._enterprise_id = new_value.to_string();
11956 self
11957 }
11958 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11959 /// while executing the actual API request.
11960 ///
11961 /// ````text
11962 /// It should be used to handle progress information, and to implement a certain level of resilience.
11963 /// ````
11964 ///
11965 /// Sets the *delegate* property to the given value.
11966 pub fn delegate(
11967 mut self,
11968 new_value: &'a mut dyn common::Delegate,
11969 ) -> EnterpriseUnenrollCall<'a, C> {
11970 self._delegate = Some(new_value);
11971 self
11972 }
11973
11974 /// Set any additional parameter of the query string used in the request.
11975 /// It should be used to set parameters which are not yet available through their own
11976 /// setters.
11977 ///
11978 /// Please note that this method must not be used to set any of the known parameters
11979 /// which have their own setter method. If done anyway, the request will fail.
11980 ///
11981 /// # Additional Parameters
11982 ///
11983 /// * *$.xgafv* (query-string) - V1 error format.
11984 /// * *access_token* (query-string) - OAuth access token.
11985 /// * *alt* (query-string) - Data format for response.
11986 /// * *callback* (query-string) - JSONP
11987 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11988 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11989 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11990 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11991 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11992 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11993 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11994 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseUnenrollCall<'a, C>
11995 where
11996 T: AsRef<str>,
11997 {
11998 self._additional_params
11999 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12000 self
12001 }
12002
12003 /// Identifies the authorization scope for the method you are building.
12004 ///
12005 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12006 /// [`Scope::Full`].
12007 ///
12008 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12009 /// tokens for more than one scope.
12010 ///
12011 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12012 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12013 /// sufficient, a read-write scope will do as well.
12014 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseUnenrollCall<'a, C>
12015 where
12016 St: AsRef<str>,
12017 {
12018 self._scopes.insert(String::from(scope.as_ref()));
12019 self
12020 }
12021 /// Identifies the authorization scope(s) for the method you are building.
12022 ///
12023 /// See [`Self::add_scope()`] for details.
12024 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseUnenrollCall<'a, C>
12025 where
12026 I: IntoIterator<Item = St>,
12027 St: AsRef<str>,
12028 {
12029 self._scopes
12030 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12031 self
12032 }
12033
12034 /// Removes all scopes, and no default scope will be used either.
12035 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12036 /// for details).
12037 pub fn clear_scopes(mut self) -> EnterpriseUnenrollCall<'a, C> {
12038 self._scopes.clear();
12039 self
12040 }
12041}
12042
12043/// Removes an entitlement to an app for a user. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
12044///
12045/// A builder for the *delete* method supported by a *entitlement* resource.
12046/// It is not used directly, but through a [`EntitlementMethods`] instance.
12047///
12048/// # Example
12049///
12050/// Instantiate a resource method builder
12051///
12052/// ```test_harness,no_run
12053/// # extern crate hyper;
12054/// # extern crate hyper_rustls;
12055/// # extern crate google_androidenterprise1 as androidenterprise1;
12056/// # async fn dox() {
12057/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12058///
12059/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12060/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12061/// # .with_native_roots()
12062/// # .unwrap()
12063/// # .https_only()
12064/// # .enable_http2()
12065/// # .build();
12066///
12067/// # let executor = hyper_util::rt::TokioExecutor::new();
12068/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12069/// # secret,
12070/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12071/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12072/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12073/// # ),
12074/// # ).build().await.unwrap();
12075///
12076/// # let client = hyper_util::client::legacy::Client::builder(
12077/// # hyper_util::rt::TokioExecutor::new()
12078/// # )
12079/// # .build(
12080/// # hyper_rustls::HttpsConnectorBuilder::new()
12081/// # .with_native_roots()
12082/// # .unwrap()
12083/// # .https_or_http()
12084/// # .enable_http2()
12085/// # .build()
12086/// # );
12087/// # let mut hub = AndroidEnterprise::new(client, auth);
12088/// // You can configure optional parameters by calling the respective setters at will, and
12089/// // execute the final call using `doit()`.
12090/// // Values shown here are possibly random and not representative !
12091/// let result = hub.entitlements().delete("enterpriseId", "userId", "entitlementId")
12092/// .doit().await;
12093/// # }
12094/// ```
12095pub struct EntitlementDeleteCall<'a, C>
12096where
12097 C: 'a,
12098{
12099 hub: &'a AndroidEnterprise<C>,
12100 _enterprise_id: String,
12101 _user_id: String,
12102 _entitlement_id: String,
12103 _delegate: Option<&'a mut dyn common::Delegate>,
12104 _additional_params: HashMap<String, String>,
12105 _scopes: BTreeSet<String>,
12106}
12107
12108impl<'a, C> common::CallBuilder for EntitlementDeleteCall<'a, C> {}
12109
12110impl<'a, C> EntitlementDeleteCall<'a, C>
12111where
12112 C: common::Connector,
12113{
12114 /// Perform the operation you have build so far.
12115 pub async fn doit(mut self) -> common::Result<common::Response> {
12116 use std::borrow::Cow;
12117 use std::io::{Read, Seek};
12118
12119 use common::{url::Params, ToParts};
12120 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12121
12122 let mut dd = common::DefaultDelegate;
12123 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12124 dlg.begin(common::MethodInfo {
12125 id: "androidenterprise.entitlements.delete",
12126 http_method: hyper::Method::DELETE,
12127 });
12128
12129 for &field in ["enterpriseId", "userId", "entitlementId"].iter() {
12130 if self._additional_params.contains_key(field) {
12131 dlg.finished(false);
12132 return Err(common::Error::FieldClash(field));
12133 }
12134 }
12135
12136 let mut params = Params::with_capacity(4 + self._additional_params.len());
12137 params.push("enterpriseId", self._enterprise_id);
12138 params.push("userId", self._user_id);
12139 params.push("entitlementId", self._entitlement_id);
12140
12141 params.extend(self._additional_params.iter());
12142
12143 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/entitlements/{entitlementId}";
12144 if self._scopes.is_empty() {
12145 self._scopes.insert(Scope::Full.as_ref().to_string());
12146 }
12147
12148 #[allow(clippy::single_element_loop)]
12149 for &(find_this, param_name) in [
12150 ("{enterpriseId}", "enterpriseId"),
12151 ("{userId}", "userId"),
12152 ("{entitlementId}", "entitlementId"),
12153 ]
12154 .iter()
12155 {
12156 url = params.uri_replacement(url, param_name, find_this, false);
12157 }
12158 {
12159 let to_remove = ["entitlementId", "userId", "enterpriseId"];
12160 params.remove_params(&to_remove);
12161 }
12162
12163 let url = params.parse_with_url(&url);
12164
12165 loop {
12166 let token = match self
12167 .hub
12168 .auth
12169 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12170 .await
12171 {
12172 Ok(token) => token,
12173 Err(e) => match dlg.token(e) {
12174 Ok(token) => token,
12175 Err(e) => {
12176 dlg.finished(false);
12177 return Err(common::Error::MissingToken(e));
12178 }
12179 },
12180 };
12181 let mut req_result = {
12182 let client = &self.hub.client;
12183 dlg.pre_request();
12184 let mut req_builder = hyper::Request::builder()
12185 .method(hyper::Method::DELETE)
12186 .uri(url.as_str())
12187 .header(USER_AGENT, self.hub._user_agent.clone());
12188
12189 if let Some(token) = token.as_ref() {
12190 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12191 }
12192
12193 let request = req_builder
12194 .header(CONTENT_LENGTH, 0_u64)
12195 .body(common::to_body::<String>(None));
12196
12197 client.request(request.unwrap()).await
12198 };
12199
12200 match req_result {
12201 Err(err) => {
12202 if let common::Retry::After(d) = dlg.http_error(&err) {
12203 sleep(d).await;
12204 continue;
12205 }
12206 dlg.finished(false);
12207 return Err(common::Error::HttpError(err));
12208 }
12209 Ok(res) => {
12210 let (mut parts, body) = res.into_parts();
12211 let mut body = common::Body::new(body);
12212 if !parts.status.is_success() {
12213 let bytes = common::to_bytes(body).await.unwrap_or_default();
12214 let error = serde_json::from_str(&common::to_string(&bytes));
12215 let response = common::to_response(parts, bytes.into());
12216
12217 if let common::Retry::After(d) =
12218 dlg.http_failure(&response, error.as_ref().ok())
12219 {
12220 sleep(d).await;
12221 continue;
12222 }
12223
12224 dlg.finished(false);
12225
12226 return Err(match error {
12227 Ok(value) => common::Error::BadRequest(value),
12228 _ => common::Error::Failure(response),
12229 });
12230 }
12231 let response = common::Response::from_parts(parts, body);
12232
12233 dlg.finished(true);
12234 return Ok(response);
12235 }
12236 }
12237 }
12238 }
12239
12240 /// The ID of the enterprise.
12241 ///
12242 /// Sets the *enterprise id* path property to the given value.
12243 ///
12244 /// Even though the property as already been set when instantiating this call,
12245 /// we provide this method for API completeness.
12246 pub fn enterprise_id(mut self, new_value: &str) -> EntitlementDeleteCall<'a, C> {
12247 self._enterprise_id = new_value.to_string();
12248 self
12249 }
12250 /// The ID of the user.
12251 ///
12252 /// Sets the *user id* path property to the given value.
12253 ///
12254 /// Even though the property as already been set when instantiating this call,
12255 /// we provide this method for API completeness.
12256 pub fn user_id(mut self, new_value: &str) -> EntitlementDeleteCall<'a, C> {
12257 self._user_id = new_value.to_string();
12258 self
12259 }
12260 /// The ID of the entitlement (a product ID), e.g. "app:com.google.android.gm".
12261 ///
12262 /// Sets the *entitlement id* path property to the given value.
12263 ///
12264 /// Even though the property as already been set when instantiating this call,
12265 /// we provide this method for API completeness.
12266 pub fn entitlement_id(mut self, new_value: &str) -> EntitlementDeleteCall<'a, C> {
12267 self._entitlement_id = new_value.to_string();
12268 self
12269 }
12270 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12271 /// while executing the actual API request.
12272 ///
12273 /// ````text
12274 /// It should be used to handle progress information, and to implement a certain level of resilience.
12275 /// ````
12276 ///
12277 /// Sets the *delegate* property to the given value.
12278 pub fn delegate(
12279 mut self,
12280 new_value: &'a mut dyn common::Delegate,
12281 ) -> EntitlementDeleteCall<'a, C> {
12282 self._delegate = Some(new_value);
12283 self
12284 }
12285
12286 /// Set any additional parameter of the query string used in the request.
12287 /// It should be used to set parameters which are not yet available through their own
12288 /// setters.
12289 ///
12290 /// Please note that this method must not be used to set any of the known parameters
12291 /// which have their own setter method. If done anyway, the request will fail.
12292 ///
12293 /// # Additional Parameters
12294 ///
12295 /// * *$.xgafv* (query-string) - V1 error format.
12296 /// * *access_token* (query-string) - OAuth access token.
12297 /// * *alt* (query-string) - Data format for response.
12298 /// * *callback* (query-string) - JSONP
12299 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12300 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12301 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12302 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12303 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12304 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12305 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12306 pub fn param<T>(mut self, name: T, value: T) -> EntitlementDeleteCall<'a, C>
12307 where
12308 T: AsRef<str>,
12309 {
12310 self._additional_params
12311 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12312 self
12313 }
12314
12315 /// Identifies the authorization scope for the method you are building.
12316 ///
12317 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12318 /// [`Scope::Full`].
12319 ///
12320 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12321 /// tokens for more than one scope.
12322 ///
12323 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12324 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12325 /// sufficient, a read-write scope will do as well.
12326 pub fn add_scope<St>(mut self, scope: St) -> EntitlementDeleteCall<'a, C>
12327 where
12328 St: AsRef<str>,
12329 {
12330 self._scopes.insert(String::from(scope.as_ref()));
12331 self
12332 }
12333 /// Identifies the authorization scope(s) for the method you are building.
12334 ///
12335 /// See [`Self::add_scope()`] for details.
12336 pub fn add_scopes<I, St>(mut self, scopes: I) -> EntitlementDeleteCall<'a, C>
12337 where
12338 I: IntoIterator<Item = St>,
12339 St: AsRef<str>,
12340 {
12341 self._scopes
12342 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12343 self
12344 }
12345
12346 /// Removes all scopes, and no default scope will be used either.
12347 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12348 /// for details).
12349 pub fn clear_scopes(mut self) -> EntitlementDeleteCall<'a, C> {
12350 self._scopes.clear();
12351 self
12352 }
12353}
12354
12355/// Retrieves details of an entitlement. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
12356///
12357/// A builder for the *get* method supported by a *entitlement* resource.
12358/// It is not used directly, but through a [`EntitlementMethods`] instance.
12359///
12360/// # Example
12361///
12362/// Instantiate a resource method builder
12363///
12364/// ```test_harness,no_run
12365/// # extern crate hyper;
12366/// # extern crate hyper_rustls;
12367/// # extern crate google_androidenterprise1 as androidenterprise1;
12368/// # async fn dox() {
12369/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12370///
12371/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12372/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12373/// # .with_native_roots()
12374/// # .unwrap()
12375/// # .https_only()
12376/// # .enable_http2()
12377/// # .build();
12378///
12379/// # let executor = hyper_util::rt::TokioExecutor::new();
12380/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12381/// # secret,
12382/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12383/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12384/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12385/// # ),
12386/// # ).build().await.unwrap();
12387///
12388/// # let client = hyper_util::client::legacy::Client::builder(
12389/// # hyper_util::rt::TokioExecutor::new()
12390/// # )
12391/// # .build(
12392/// # hyper_rustls::HttpsConnectorBuilder::new()
12393/// # .with_native_roots()
12394/// # .unwrap()
12395/// # .https_or_http()
12396/// # .enable_http2()
12397/// # .build()
12398/// # );
12399/// # let mut hub = AndroidEnterprise::new(client, auth);
12400/// // You can configure optional parameters by calling the respective setters at will, and
12401/// // execute the final call using `doit()`.
12402/// // Values shown here are possibly random and not representative !
12403/// let result = hub.entitlements().get("enterpriseId", "userId", "entitlementId")
12404/// .doit().await;
12405/// # }
12406/// ```
12407pub struct EntitlementGetCall<'a, C>
12408where
12409 C: 'a,
12410{
12411 hub: &'a AndroidEnterprise<C>,
12412 _enterprise_id: String,
12413 _user_id: String,
12414 _entitlement_id: String,
12415 _delegate: Option<&'a mut dyn common::Delegate>,
12416 _additional_params: HashMap<String, String>,
12417 _scopes: BTreeSet<String>,
12418}
12419
12420impl<'a, C> common::CallBuilder for EntitlementGetCall<'a, C> {}
12421
12422impl<'a, C> EntitlementGetCall<'a, C>
12423where
12424 C: common::Connector,
12425{
12426 /// Perform the operation you have build so far.
12427 pub async fn doit(mut self) -> common::Result<(common::Response, Entitlement)> {
12428 use std::borrow::Cow;
12429 use std::io::{Read, Seek};
12430
12431 use common::{url::Params, ToParts};
12432 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12433
12434 let mut dd = common::DefaultDelegate;
12435 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12436 dlg.begin(common::MethodInfo {
12437 id: "androidenterprise.entitlements.get",
12438 http_method: hyper::Method::GET,
12439 });
12440
12441 for &field in ["alt", "enterpriseId", "userId", "entitlementId"].iter() {
12442 if self._additional_params.contains_key(field) {
12443 dlg.finished(false);
12444 return Err(common::Error::FieldClash(field));
12445 }
12446 }
12447
12448 let mut params = Params::with_capacity(5 + self._additional_params.len());
12449 params.push("enterpriseId", self._enterprise_id);
12450 params.push("userId", self._user_id);
12451 params.push("entitlementId", self._entitlement_id);
12452
12453 params.extend(self._additional_params.iter());
12454
12455 params.push("alt", "json");
12456 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/entitlements/{entitlementId}";
12457 if self._scopes.is_empty() {
12458 self._scopes.insert(Scope::Full.as_ref().to_string());
12459 }
12460
12461 #[allow(clippy::single_element_loop)]
12462 for &(find_this, param_name) in [
12463 ("{enterpriseId}", "enterpriseId"),
12464 ("{userId}", "userId"),
12465 ("{entitlementId}", "entitlementId"),
12466 ]
12467 .iter()
12468 {
12469 url = params.uri_replacement(url, param_name, find_this, false);
12470 }
12471 {
12472 let to_remove = ["entitlementId", "userId", "enterpriseId"];
12473 params.remove_params(&to_remove);
12474 }
12475
12476 let url = params.parse_with_url(&url);
12477
12478 loop {
12479 let token = match self
12480 .hub
12481 .auth
12482 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12483 .await
12484 {
12485 Ok(token) => token,
12486 Err(e) => match dlg.token(e) {
12487 Ok(token) => token,
12488 Err(e) => {
12489 dlg.finished(false);
12490 return Err(common::Error::MissingToken(e));
12491 }
12492 },
12493 };
12494 let mut req_result = {
12495 let client = &self.hub.client;
12496 dlg.pre_request();
12497 let mut req_builder = hyper::Request::builder()
12498 .method(hyper::Method::GET)
12499 .uri(url.as_str())
12500 .header(USER_AGENT, self.hub._user_agent.clone());
12501
12502 if let Some(token) = token.as_ref() {
12503 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12504 }
12505
12506 let request = req_builder
12507 .header(CONTENT_LENGTH, 0_u64)
12508 .body(common::to_body::<String>(None));
12509
12510 client.request(request.unwrap()).await
12511 };
12512
12513 match req_result {
12514 Err(err) => {
12515 if let common::Retry::After(d) = dlg.http_error(&err) {
12516 sleep(d).await;
12517 continue;
12518 }
12519 dlg.finished(false);
12520 return Err(common::Error::HttpError(err));
12521 }
12522 Ok(res) => {
12523 let (mut parts, body) = res.into_parts();
12524 let mut body = common::Body::new(body);
12525 if !parts.status.is_success() {
12526 let bytes = common::to_bytes(body).await.unwrap_or_default();
12527 let error = serde_json::from_str(&common::to_string(&bytes));
12528 let response = common::to_response(parts, bytes.into());
12529
12530 if let common::Retry::After(d) =
12531 dlg.http_failure(&response, error.as_ref().ok())
12532 {
12533 sleep(d).await;
12534 continue;
12535 }
12536
12537 dlg.finished(false);
12538
12539 return Err(match error {
12540 Ok(value) => common::Error::BadRequest(value),
12541 _ => common::Error::Failure(response),
12542 });
12543 }
12544 let response = {
12545 let bytes = common::to_bytes(body).await.unwrap_or_default();
12546 let encoded = common::to_string(&bytes);
12547 match serde_json::from_str(&encoded) {
12548 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12549 Err(error) => {
12550 dlg.response_json_decode_error(&encoded, &error);
12551 return Err(common::Error::JsonDecodeError(
12552 encoded.to_string(),
12553 error,
12554 ));
12555 }
12556 }
12557 };
12558
12559 dlg.finished(true);
12560 return Ok(response);
12561 }
12562 }
12563 }
12564 }
12565
12566 /// The ID of the enterprise.
12567 ///
12568 /// Sets the *enterprise id* path property to the given value.
12569 ///
12570 /// Even though the property as already been set when instantiating this call,
12571 /// we provide this method for API completeness.
12572 pub fn enterprise_id(mut self, new_value: &str) -> EntitlementGetCall<'a, C> {
12573 self._enterprise_id = new_value.to_string();
12574 self
12575 }
12576 /// The ID of the user.
12577 ///
12578 /// Sets the *user id* path property to the given value.
12579 ///
12580 /// Even though the property as already been set when instantiating this call,
12581 /// we provide this method for API completeness.
12582 pub fn user_id(mut self, new_value: &str) -> EntitlementGetCall<'a, C> {
12583 self._user_id = new_value.to_string();
12584 self
12585 }
12586 /// The ID of the entitlement (a product ID), e.g. "app:com.google.android.gm".
12587 ///
12588 /// Sets the *entitlement id* path property to the given value.
12589 ///
12590 /// Even though the property as already been set when instantiating this call,
12591 /// we provide this method for API completeness.
12592 pub fn entitlement_id(mut self, new_value: &str) -> EntitlementGetCall<'a, C> {
12593 self._entitlement_id = new_value.to_string();
12594 self
12595 }
12596 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12597 /// while executing the actual API request.
12598 ///
12599 /// ````text
12600 /// It should be used to handle progress information, and to implement a certain level of resilience.
12601 /// ````
12602 ///
12603 /// Sets the *delegate* property to the given value.
12604 pub fn delegate(
12605 mut self,
12606 new_value: &'a mut dyn common::Delegate,
12607 ) -> EntitlementGetCall<'a, C> {
12608 self._delegate = Some(new_value);
12609 self
12610 }
12611
12612 /// Set any additional parameter of the query string used in the request.
12613 /// It should be used to set parameters which are not yet available through their own
12614 /// setters.
12615 ///
12616 /// Please note that this method must not be used to set any of the known parameters
12617 /// which have their own setter method. If done anyway, the request will fail.
12618 ///
12619 /// # Additional Parameters
12620 ///
12621 /// * *$.xgafv* (query-string) - V1 error format.
12622 /// * *access_token* (query-string) - OAuth access token.
12623 /// * *alt* (query-string) - Data format for response.
12624 /// * *callback* (query-string) - JSONP
12625 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12626 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12627 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12628 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12629 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12630 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12631 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12632 pub fn param<T>(mut self, name: T, value: T) -> EntitlementGetCall<'a, C>
12633 where
12634 T: AsRef<str>,
12635 {
12636 self._additional_params
12637 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12638 self
12639 }
12640
12641 /// Identifies the authorization scope for the method you are building.
12642 ///
12643 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12644 /// [`Scope::Full`].
12645 ///
12646 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12647 /// tokens for more than one scope.
12648 ///
12649 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12650 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12651 /// sufficient, a read-write scope will do as well.
12652 pub fn add_scope<St>(mut self, scope: St) -> EntitlementGetCall<'a, C>
12653 where
12654 St: AsRef<str>,
12655 {
12656 self._scopes.insert(String::from(scope.as_ref()));
12657 self
12658 }
12659 /// Identifies the authorization scope(s) for the method you are building.
12660 ///
12661 /// See [`Self::add_scope()`] for details.
12662 pub fn add_scopes<I, St>(mut self, scopes: I) -> EntitlementGetCall<'a, C>
12663 where
12664 I: IntoIterator<Item = St>,
12665 St: AsRef<str>,
12666 {
12667 self._scopes
12668 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12669 self
12670 }
12671
12672 /// Removes all scopes, and no default scope will be used either.
12673 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12674 /// for details).
12675 pub fn clear_scopes(mut self) -> EntitlementGetCall<'a, C> {
12676 self._scopes.clear();
12677 self
12678 }
12679}
12680
12681/// Lists all entitlements for the specified user. Only the ID is set. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
12682///
12683/// A builder for the *list* method supported by a *entitlement* resource.
12684/// It is not used directly, but through a [`EntitlementMethods`] instance.
12685///
12686/// # Example
12687///
12688/// Instantiate a resource method builder
12689///
12690/// ```test_harness,no_run
12691/// # extern crate hyper;
12692/// # extern crate hyper_rustls;
12693/// # extern crate google_androidenterprise1 as androidenterprise1;
12694/// # async fn dox() {
12695/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12696///
12697/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12698/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12699/// # .with_native_roots()
12700/// # .unwrap()
12701/// # .https_only()
12702/// # .enable_http2()
12703/// # .build();
12704///
12705/// # let executor = hyper_util::rt::TokioExecutor::new();
12706/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12707/// # secret,
12708/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12709/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12710/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12711/// # ),
12712/// # ).build().await.unwrap();
12713///
12714/// # let client = hyper_util::client::legacy::Client::builder(
12715/// # hyper_util::rt::TokioExecutor::new()
12716/// # )
12717/// # .build(
12718/// # hyper_rustls::HttpsConnectorBuilder::new()
12719/// # .with_native_roots()
12720/// # .unwrap()
12721/// # .https_or_http()
12722/// # .enable_http2()
12723/// # .build()
12724/// # );
12725/// # let mut hub = AndroidEnterprise::new(client, auth);
12726/// // You can configure optional parameters by calling the respective setters at will, and
12727/// // execute the final call using `doit()`.
12728/// // Values shown here are possibly random and not representative !
12729/// let result = hub.entitlements().list("enterpriseId", "userId")
12730/// .doit().await;
12731/// # }
12732/// ```
12733pub struct EntitlementListCall<'a, C>
12734where
12735 C: 'a,
12736{
12737 hub: &'a AndroidEnterprise<C>,
12738 _enterprise_id: String,
12739 _user_id: String,
12740 _delegate: Option<&'a mut dyn common::Delegate>,
12741 _additional_params: HashMap<String, String>,
12742 _scopes: BTreeSet<String>,
12743}
12744
12745impl<'a, C> common::CallBuilder for EntitlementListCall<'a, C> {}
12746
12747impl<'a, C> EntitlementListCall<'a, C>
12748where
12749 C: common::Connector,
12750{
12751 /// Perform the operation you have build so far.
12752 pub async fn doit(mut self) -> common::Result<(common::Response, EntitlementsListResponse)> {
12753 use std::borrow::Cow;
12754 use std::io::{Read, Seek};
12755
12756 use common::{url::Params, ToParts};
12757 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12758
12759 let mut dd = common::DefaultDelegate;
12760 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12761 dlg.begin(common::MethodInfo {
12762 id: "androidenterprise.entitlements.list",
12763 http_method: hyper::Method::GET,
12764 });
12765
12766 for &field in ["alt", "enterpriseId", "userId"].iter() {
12767 if self._additional_params.contains_key(field) {
12768 dlg.finished(false);
12769 return Err(common::Error::FieldClash(field));
12770 }
12771 }
12772
12773 let mut params = Params::with_capacity(4 + self._additional_params.len());
12774 params.push("enterpriseId", self._enterprise_id);
12775 params.push("userId", self._user_id);
12776
12777 params.extend(self._additional_params.iter());
12778
12779 params.push("alt", "json");
12780 let mut url = self.hub._base_url.clone()
12781 + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/entitlements";
12782 if self._scopes.is_empty() {
12783 self._scopes.insert(Scope::Full.as_ref().to_string());
12784 }
12785
12786 #[allow(clippy::single_element_loop)]
12787 for &(find_this, param_name) in
12788 [("{enterpriseId}", "enterpriseId"), ("{userId}", "userId")].iter()
12789 {
12790 url = params.uri_replacement(url, param_name, find_this, false);
12791 }
12792 {
12793 let to_remove = ["userId", "enterpriseId"];
12794 params.remove_params(&to_remove);
12795 }
12796
12797 let url = params.parse_with_url(&url);
12798
12799 loop {
12800 let token = match self
12801 .hub
12802 .auth
12803 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12804 .await
12805 {
12806 Ok(token) => token,
12807 Err(e) => match dlg.token(e) {
12808 Ok(token) => token,
12809 Err(e) => {
12810 dlg.finished(false);
12811 return Err(common::Error::MissingToken(e));
12812 }
12813 },
12814 };
12815 let mut req_result = {
12816 let client = &self.hub.client;
12817 dlg.pre_request();
12818 let mut req_builder = hyper::Request::builder()
12819 .method(hyper::Method::GET)
12820 .uri(url.as_str())
12821 .header(USER_AGENT, self.hub._user_agent.clone());
12822
12823 if let Some(token) = token.as_ref() {
12824 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12825 }
12826
12827 let request = req_builder
12828 .header(CONTENT_LENGTH, 0_u64)
12829 .body(common::to_body::<String>(None));
12830
12831 client.request(request.unwrap()).await
12832 };
12833
12834 match req_result {
12835 Err(err) => {
12836 if let common::Retry::After(d) = dlg.http_error(&err) {
12837 sleep(d).await;
12838 continue;
12839 }
12840 dlg.finished(false);
12841 return Err(common::Error::HttpError(err));
12842 }
12843 Ok(res) => {
12844 let (mut parts, body) = res.into_parts();
12845 let mut body = common::Body::new(body);
12846 if !parts.status.is_success() {
12847 let bytes = common::to_bytes(body).await.unwrap_or_default();
12848 let error = serde_json::from_str(&common::to_string(&bytes));
12849 let response = common::to_response(parts, bytes.into());
12850
12851 if let common::Retry::After(d) =
12852 dlg.http_failure(&response, error.as_ref().ok())
12853 {
12854 sleep(d).await;
12855 continue;
12856 }
12857
12858 dlg.finished(false);
12859
12860 return Err(match error {
12861 Ok(value) => common::Error::BadRequest(value),
12862 _ => common::Error::Failure(response),
12863 });
12864 }
12865 let response = {
12866 let bytes = common::to_bytes(body).await.unwrap_or_default();
12867 let encoded = common::to_string(&bytes);
12868 match serde_json::from_str(&encoded) {
12869 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12870 Err(error) => {
12871 dlg.response_json_decode_error(&encoded, &error);
12872 return Err(common::Error::JsonDecodeError(
12873 encoded.to_string(),
12874 error,
12875 ));
12876 }
12877 }
12878 };
12879
12880 dlg.finished(true);
12881 return Ok(response);
12882 }
12883 }
12884 }
12885 }
12886
12887 /// The ID of the enterprise.
12888 ///
12889 /// Sets the *enterprise id* path property to the given value.
12890 ///
12891 /// Even though the property as already been set when instantiating this call,
12892 /// we provide this method for API completeness.
12893 pub fn enterprise_id(mut self, new_value: &str) -> EntitlementListCall<'a, C> {
12894 self._enterprise_id = new_value.to_string();
12895 self
12896 }
12897 /// The ID of the user.
12898 ///
12899 /// Sets the *user id* path property to the given value.
12900 ///
12901 /// Even though the property as already been set when instantiating this call,
12902 /// we provide this method for API completeness.
12903 pub fn user_id(mut self, new_value: &str) -> EntitlementListCall<'a, C> {
12904 self._user_id = new_value.to_string();
12905 self
12906 }
12907 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12908 /// while executing the actual API request.
12909 ///
12910 /// ````text
12911 /// It should be used to handle progress information, and to implement a certain level of resilience.
12912 /// ````
12913 ///
12914 /// Sets the *delegate* property to the given value.
12915 pub fn delegate(
12916 mut self,
12917 new_value: &'a mut dyn common::Delegate,
12918 ) -> EntitlementListCall<'a, C> {
12919 self._delegate = Some(new_value);
12920 self
12921 }
12922
12923 /// Set any additional parameter of the query string used in the request.
12924 /// It should be used to set parameters which are not yet available through their own
12925 /// setters.
12926 ///
12927 /// Please note that this method must not be used to set any of the known parameters
12928 /// which have their own setter method. If done anyway, the request will fail.
12929 ///
12930 /// # Additional Parameters
12931 ///
12932 /// * *$.xgafv* (query-string) - V1 error format.
12933 /// * *access_token* (query-string) - OAuth access token.
12934 /// * *alt* (query-string) - Data format for response.
12935 /// * *callback* (query-string) - JSONP
12936 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12937 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12938 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12939 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12940 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12941 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12942 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12943 pub fn param<T>(mut self, name: T, value: T) -> EntitlementListCall<'a, C>
12944 where
12945 T: AsRef<str>,
12946 {
12947 self._additional_params
12948 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12949 self
12950 }
12951
12952 /// Identifies the authorization scope for the method you are building.
12953 ///
12954 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12955 /// [`Scope::Full`].
12956 ///
12957 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12958 /// tokens for more than one scope.
12959 ///
12960 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12961 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12962 /// sufficient, a read-write scope will do as well.
12963 pub fn add_scope<St>(mut self, scope: St) -> EntitlementListCall<'a, C>
12964 where
12965 St: AsRef<str>,
12966 {
12967 self._scopes.insert(String::from(scope.as_ref()));
12968 self
12969 }
12970 /// Identifies the authorization scope(s) for the method you are building.
12971 ///
12972 /// See [`Self::add_scope()`] for details.
12973 pub fn add_scopes<I, St>(mut self, scopes: I) -> EntitlementListCall<'a, C>
12974 where
12975 I: IntoIterator<Item = St>,
12976 St: AsRef<str>,
12977 {
12978 self._scopes
12979 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12980 self
12981 }
12982
12983 /// Removes all scopes, and no default scope will be used either.
12984 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12985 /// for details).
12986 pub fn clear_scopes(mut self) -> EntitlementListCall<'a, C> {
12987 self._scopes.clear();
12988 self
12989 }
12990}
12991
12992/// Adds or updates an entitlement to an app for a user. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
12993///
12994/// A builder for the *update* method supported by a *entitlement* resource.
12995/// It is not used directly, but through a [`EntitlementMethods`] instance.
12996///
12997/// # Example
12998///
12999/// Instantiate a resource method builder
13000///
13001/// ```test_harness,no_run
13002/// # extern crate hyper;
13003/// # extern crate hyper_rustls;
13004/// # extern crate google_androidenterprise1 as androidenterprise1;
13005/// use androidenterprise1::api::Entitlement;
13006/// # async fn dox() {
13007/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13008///
13009/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13010/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13011/// # .with_native_roots()
13012/// # .unwrap()
13013/// # .https_only()
13014/// # .enable_http2()
13015/// # .build();
13016///
13017/// # let executor = hyper_util::rt::TokioExecutor::new();
13018/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13019/// # secret,
13020/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13021/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13022/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13023/// # ),
13024/// # ).build().await.unwrap();
13025///
13026/// # let client = hyper_util::client::legacy::Client::builder(
13027/// # hyper_util::rt::TokioExecutor::new()
13028/// # )
13029/// # .build(
13030/// # hyper_rustls::HttpsConnectorBuilder::new()
13031/// # .with_native_roots()
13032/// # .unwrap()
13033/// # .https_or_http()
13034/// # .enable_http2()
13035/// # .build()
13036/// # );
13037/// # let mut hub = AndroidEnterprise::new(client, auth);
13038/// // As the method needs a request, you would usually fill it with the desired information
13039/// // into the respective structure. Some of the parts shown here might not be applicable !
13040/// // Values shown here are possibly random and not representative !
13041/// let mut req = Entitlement::default();
13042///
13043/// // You can configure optional parameters by calling the respective setters at will, and
13044/// // execute the final call using `doit()`.
13045/// // Values shown here are possibly random and not representative !
13046/// let result = hub.entitlements().update(req, "enterpriseId", "userId", "entitlementId")
13047/// .install(false)
13048/// .doit().await;
13049/// # }
13050/// ```
13051pub struct EntitlementUpdateCall<'a, C>
13052where
13053 C: 'a,
13054{
13055 hub: &'a AndroidEnterprise<C>,
13056 _request: Entitlement,
13057 _enterprise_id: String,
13058 _user_id: String,
13059 _entitlement_id: String,
13060 _install: Option<bool>,
13061 _delegate: Option<&'a mut dyn common::Delegate>,
13062 _additional_params: HashMap<String, String>,
13063 _scopes: BTreeSet<String>,
13064}
13065
13066impl<'a, C> common::CallBuilder for EntitlementUpdateCall<'a, C> {}
13067
13068impl<'a, C> EntitlementUpdateCall<'a, C>
13069where
13070 C: common::Connector,
13071{
13072 /// Perform the operation you have build so far.
13073 pub async fn doit(mut self) -> common::Result<(common::Response, Entitlement)> {
13074 use std::borrow::Cow;
13075 use std::io::{Read, Seek};
13076
13077 use common::{url::Params, ToParts};
13078 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13079
13080 let mut dd = common::DefaultDelegate;
13081 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13082 dlg.begin(common::MethodInfo {
13083 id: "androidenterprise.entitlements.update",
13084 http_method: hyper::Method::PUT,
13085 });
13086
13087 for &field in ["alt", "enterpriseId", "userId", "entitlementId", "install"].iter() {
13088 if self._additional_params.contains_key(field) {
13089 dlg.finished(false);
13090 return Err(common::Error::FieldClash(field));
13091 }
13092 }
13093
13094 let mut params = Params::with_capacity(7 + self._additional_params.len());
13095 params.push("enterpriseId", self._enterprise_id);
13096 params.push("userId", self._user_id);
13097 params.push("entitlementId", self._entitlement_id);
13098 if let Some(value) = self._install.as_ref() {
13099 params.push("install", value.to_string());
13100 }
13101
13102 params.extend(self._additional_params.iter());
13103
13104 params.push("alt", "json");
13105 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/entitlements/{entitlementId}";
13106 if self._scopes.is_empty() {
13107 self._scopes.insert(Scope::Full.as_ref().to_string());
13108 }
13109
13110 #[allow(clippy::single_element_loop)]
13111 for &(find_this, param_name) in [
13112 ("{enterpriseId}", "enterpriseId"),
13113 ("{userId}", "userId"),
13114 ("{entitlementId}", "entitlementId"),
13115 ]
13116 .iter()
13117 {
13118 url = params.uri_replacement(url, param_name, find_this, false);
13119 }
13120 {
13121 let to_remove = ["entitlementId", "userId", "enterpriseId"];
13122 params.remove_params(&to_remove);
13123 }
13124
13125 let url = params.parse_with_url(&url);
13126
13127 let mut json_mime_type = mime::APPLICATION_JSON;
13128 let mut request_value_reader = {
13129 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13130 common::remove_json_null_values(&mut value);
13131 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13132 serde_json::to_writer(&mut dst, &value).unwrap();
13133 dst
13134 };
13135 let request_size = request_value_reader
13136 .seek(std::io::SeekFrom::End(0))
13137 .unwrap();
13138 request_value_reader
13139 .seek(std::io::SeekFrom::Start(0))
13140 .unwrap();
13141
13142 loop {
13143 let token = match self
13144 .hub
13145 .auth
13146 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13147 .await
13148 {
13149 Ok(token) => token,
13150 Err(e) => match dlg.token(e) {
13151 Ok(token) => token,
13152 Err(e) => {
13153 dlg.finished(false);
13154 return Err(common::Error::MissingToken(e));
13155 }
13156 },
13157 };
13158 request_value_reader
13159 .seek(std::io::SeekFrom::Start(0))
13160 .unwrap();
13161 let mut req_result = {
13162 let client = &self.hub.client;
13163 dlg.pre_request();
13164 let mut req_builder = hyper::Request::builder()
13165 .method(hyper::Method::PUT)
13166 .uri(url.as_str())
13167 .header(USER_AGENT, self.hub._user_agent.clone());
13168
13169 if let Some(token) = token.as_ref() {
13170 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13171 }
13172
13173 let request = req_builder
13174 .header(CONTENT_TYPE, json_mime_type.to_string())
13175 .header(CONTENT_LENGTH, request_size as u64)
13176 .body(common::to_body(
13177 request_value_reader.get_ref().clone().into(),
13178 ));
13179
13180 client.request(request.unwrap()).await
13181 };
13182
13183 match req_result {
13184 Err(err) => {
13185 if let common::Retry::After(d) = dlg.http_error(&err) {
13186 sleep(d).await;
13187 continue;
13188 }
13189 dlg.finished(false);
13190 return Err(common::Error::HttpError(err));
13191 }
13192 Ok(res) => {
13193 let (mut parts, body) = res.into_parts();
13194 let mut body = common::Body::new(body);
13195 if !parts.status.is_success() {
13196 let bytes = common::to_bytes(body).await.unwrap_or_default();
13197 let error = serde_json::from_str(&common::to_string(&bytes));
13198 let response = common::to_response(parts, bytes.into());
13199
13200 if let common::Retry::After(d) =
13201 dlg.http_failure(&response, error.as_ref().ok())
13202 {
13203 sleep(d).await;
13204 continue;
13205 }
13206
13207 dlg.finished(false);
13208
13209 return Err(match error {
13210 Ok(value) => common::Error::BadRequest(value),
13211 _ => common::Error::Failure(response),
13212 });
13213 }
13214 let response = {
13215 let bytes = common::to_bytes(body).await.unwrap_or_default();
13216 let encoded = common::to_string(&bytes);
13217 match serde_json::from_str(&encoded) {
13218 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13219 Err(error) => {
13220 dlg.response_json_decode_error(&encoded, &error);
13221 return Err(common::Error::JsonDecodeError(
13222 encoded.to_string(),
13223 error,
13224 ));
13225 }
13226 }
13227 };
13228
13229 dlg.finished(true);
13230 return Ok(response);
13231 }
13232 }
13233 }
13234 }
13235
13236 ///
13237 /// Sets the *request* property to the given value.
13238 ///
13239 /// Even though the property as already been set when instantiating this call,
13240 /// we provide this method for API completeness.
13241 pub fn request(mut self, new_value: Entitlement) -> EntitlementUpdateCall<'a, C> {
13242 self._request = new_value;
13243 self
13244 }
13245 /// The ID of the enterprise.
13246 ///
13247 /// Sets the *enterprise id* path property to the given value.
13248 ///
13249 /// Even though the property as already been set when instantiating this call,
13250 /// we provide this method for API completeness.
13251 pub fn enterprise_id(mut self, new_value: &str) -> EntitlementUpdateCall<'a, C> {
13252 self._enterprise_id = new_value.to_string();
13253 self
13254 }
13255 /// The ID of the user.
13256 ///
13257 /// Sets the *user id* path property to the given value.
13258 ///
13259 /// Even though the property as already been set when instantiating this call,
13260 /// we provide this method for API completeness.
13261 pub fn user_id(mut self, new_value: &str) -> EntitlementUpdateCall<'a, C> {
13262 self._user_id = new_value.to_string();
13263 self
13264 }
13265 /// The ID of the entitlement (a product ID), e.g. "app:com.google.android.gm".
13266 ///
13267 /// Sets the *entitlement id* path property to the given value.
13268 ///
13269 /// Even though the property as already been set when instantiating this call,
13270 /// we provide this method for API completeness.
13271 pub fn entitlement_id(mut self, new_value: &str) -> EntitlementUpdateCall<'a, C> {
13272 self._entitlement_id = new_value.to_string();
13273 self
13274 }
13275 /// Set to true to also install the product on all the user's devices where possible. Failure to install on one or more devices will not prevent this operation from returning successfully, as long as the entitlement was successfully assigned to the user.
13276 ///
13277 /// Sets the *install* query property to the given value.
13278 pub fn install(mut self, new_value: bool) -> EntitlementUpdateCall<'a, C> {
13279 self._install = Some(new_value);
13280 self
13281 }
13282 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13283 /// while executing the actual API request.
13284 ///
13285 /// ````text
13286 /// It should be used to handle progress information, and to implement a certain level of resilience.
13287 /// ````
13288 ///
13289 /// Sets the *delegate* property to the given value.
13290 pub fn delegate(
13291 mut self,
13292 new_value: &'a mut dyn common::Delegate,
13293 ) -> EntitlementUpdateCall<'a, C> {
13294 self._delegate = Some(new_value);
13295 self
13296 }
13297
13298 /// Set any additional parameter of the query string used in the request.
13299 /// It should be used to set parameters which are not yet available through their own
13300 /// setters.
13301 ///
13302 /// Please note that this method must not be used to set any of the known parameters
13303 /// which have their own setter method. If done anyway, the request will fail.
13304 ///
13305 /// # Additional Parameters
13306 ///
13307 /// * *$.xgafv* (query-string) - V1 error format.
13308 /// * *access_token* (query-string) - OAuth access token.
13309 /// * *alt* (query-string) - Data format for response.
13310 /// * *callback* (query-string) - JSONP
13311 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13312 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13313 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13314 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13315 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13316 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13317 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13318 pub fn param<T>(mut self, name: T, value: T) -> EntitlementUpdateCall<'a, C>
13319 where
13320 T: AsRef<str>,
13321 {
13322 self._additional_params
13323 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13324 self
13325 }
13326
13327 /// Identifies the authorization scope for the method you are building.
13328 ///
13329 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13330 /// [`Scope::Full`].
13331 ///
13332 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13333 /// tokens for more than one scope.
13334 ///
13335 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13336 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13337 /// sufficient, a read-write scope will do as well.
13338 pub fn add_scope<St>(mut self, scope: St) -> EntitlementUpdateCall<'a, C>
13339 where
13340 St: AsRef<str>,
13341 {
13342 self._scopes.insert(String::from(scope.as_ref()));
13343 self
13344 }
13345 /// Identifies the authorization scope(s) for the method you are building.
13346 ///
13347 /// See [`Self::add_scope()`] for details.
13348 pub fn add_scopes<I, St>(mut self, scopes: I) -> EntitlementUpdateCall<'a, C>
13349 where
13350 I: IntoIterator<Item = St>,
13351 St: AsRef<str>,
13352 {
13353 self._scopes
13354 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13355 self
13356 }
13357
13358 /// Removes all scopes, and no default scope will be used either.
13359 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13360 /// for details).
13361 pub fn clear_scopes(mut self) -> EntitlementUpdateCall<'a, C> {
13362 self._scopes.clear();
13363 self
13364 }
13365}
13366
13367/// Retrieves details of an enterprise's group license for a product. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
13368///
13369/// A builder for the *get* method supported by a *grouplicense* resource.
13370/// It is not used directly, but through a [`GrouplicenseMethods`] instance.
13371///
13372/// # Example
13373///
13374/// Instantiate a resource method builder
13375///
13376/// ```test_harness,no_run
13377/// # extern crate hyper;
13378/// # extern crate hyper_rustls;
13379/// # extern crate google_androidenterprise1 as androidenterprise1;
13380/// # async fn dox() {
13381/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13382///
13383/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13384/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13385/// # .with_native_roots()
13386/// # .unwrap()
13387/// # .https_only()
13388/// # .enable_http2()
13389/// # .build();
13390///
13391/// # let executor = hyper_util::rt::TokioExecutor::new();
13392/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13393/// # secret,
13394/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13395/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13396/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13397/// # ),
13398/// # ).build().await.unwrap();
13399///
13400/// # let client = hyper_util::client::legacy::Client::builder(
13401/// # hyper_util::rt::TokioExecutor::new()
13402/// # )
13403/// # .build(
13404/// # hyper_rustls::HttpsConnectorBuilder::new()
13405/// # .with_native_roots()
13406/// # .unwrap()
13407/// # .https_or_http()
13408/// # .enable_http2()
13409/// # .build()
13410/// # );
13411/// # let mut hub = AndroidEnterprise::new(client, auth);
13412/// // You can configure optional parameters by calling the respective setters at will, and
13413/// // execute the final call using `doit()`.
13414/// // Values shown here are possibly random and not representative !
13415/// let result = hub.grouplicenses().get("enterpriseId", "groupLicenseId")
13416/// .doit().await;
13417/// # }
13418/// ```
13419pub struct GrouplicenseGetCall<'a, C>
13420where
13421 C: 'a,
13422{
13423 hub: &'a AndroidEnterprise<C>,
13424 _enterprise_id: String,
13425 _group_license_id: String,
13426 _delegate: Option<&'a mut dyn common::Delegate>,
13427 _additional_params: HashMap<String, String>,
13428 _scopes: BTreeSet<String>,
13429}
13430
13431impl<'a, C> common::CallBuilder for GrouplicenseGetCall<'a, C> {}
13432
13433impl<'a, C> GrouplicenseGetCall<'a, C>
13434where
13435 C: common::Connector,
13436{
13437 /// Perform the operation you have build so far.
13438 pub async fn doit(mut self) -> common::Result<(common::Response, GroupLicense)> {
13439 use std::borrow::Cow;
13440 use std::io::{Read, Seek};
13441
13442 use common::{url::Params, ToParts};
13443 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13444
13445 let mut dd = common::DefaultDelegate;
13446 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13447 dlg.begin(common::MethodInfo {
13448 id: "androidenterprise.grouplicenses.get",
13449 http_method: hyper::Method::GET,
13450 });
13451
13452 for &field in ["alt", "enterpriseId", "groupLicenseId"].iter() {
13453 if self._additional_params.contains_key(field) {
13454 dlg.finished(false);
13455 return Err(common::Error::FieldClash(field));
13456 }
13457 }
13458
13459 let mut params = Params::with_capacity(4 + self._additional_params.len());
13460 params.push("enterpriseId", self._enterprise_id);
13461 params.push("groupLicenseId", self._group_license_id);
13462
13463 params.extend(self._additional_params.iter());
13464
13465 params.push("alt", "json");
13466 let mut url = self.hub._base_url.clone()
13467 + "androidenterprise/v1/enterprises/{enterpriseId}/groupLicenses/{groupLicenseId}";
13468 if self._scopes.is_empty() {
13469 self._scopes.insert(Scope::Full.as_ref().to_string());
13470 }
13471
13472 #[allow(clippy::single_element_loop)]
13473 for &(find_this, param_name) in [
13474 ("{enterpriseId}", "enterpriseId"),
13475 ("{groupLicenseId}", "groupLicenseId"),
13476 ]
13477 .iter()
13478 {
13479 url = params.uri_replacement(url, param_name, find_this, false);
13480 }
13481 {
13482 let to_remove = ["groupLicenseId", "enterpriseId"];
13483 params.remove_params(&to_remove);
13484 }
13485
13486 let url = params.parse_with_url(&url);
13487
13488 loop {
13489 let token = match self
13490 .hub
13491 .auth
13492 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13493 .await
13494 {
13495 Ok(token) => token,
13496 Err(e) => match dlg.token(e) {
13497 Ok(token) => token,
13498 Err(e) => {
13499 dlg.finished(false);
13500 return Err(common::Error::MissingToken(e));
13501 }
13502 },
13503 };
13504 let mut req_result = {
13505 let client = &self.hub.client;
13506 dlg.pre_request();
13507 let mut req_builder = hyper::Request::builder()
13508 .method(hyper::Method::GET)
13509 .uri(url.as_str())
13510 .header(USER_AGENT, self.hub._user_agent.clone());
13511
13512 if let Some(token) = token.as_ref() {
13513 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13514 }
13515
13516 let request = req_builder
13517 .header(CONTENT_LENGTH, 0_u64)
13518 .body(common::to_body::<String>(None));
13519
13520 client.request(request.unwrap()).await
13521 };
13522
13523 match req_result {
13524 Err(err) => {
13525 if let common::Retry::After(d) = dlg.http_error(&err) {
13526 sleep(d).await;
13527 continue;
13528 }
13529 dlg.finished(false);
13530 return Err(common::Error::HttpError(err));
13531 }
13532 Ok(res) => {
13533 let (mut parts, body) = res.into_parts();
13534 let mut body = common::Body::new(body);
13535 if !parts.status.is_success() {
13536 let bytes = common::to_bytes(body).await.unwrap_or_default();
13537 let error = serde_json::from_str(&common::to_string(&bytes));
13538 let response = common::to_response(parts, bytes.into());
13539
13540 if let common::Retry::After(d) =
13541 dlg.http_failure(&response, error.as_ref().ok())
13542 {
13543 sleep(d).await;
13544 continue;
13545 }
13546
13547 dlg.finished(false);
13548
13549 return Err(match error {
13550 Ok(value) => common::Error::BadRequest(value),
13551 _ => common::Error::Failure(response),
13552 });
13553 }
13554 let response = {
13555 let bytes = common::to_bytes(body).await.unwrap_or_default();
13556 let encoded = common::to_string(&bytes);
13557 match serde_json::from_str(&encoded) {
13558 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13559 Err(error) => {
13560 dlg.response_json_decode_error(&encoded, &error);
13561 return Err(common::Error::JsonDecodeError(
13562 encoded.to_string(),
13563 error,
13564 ));
13565 }
13566 }
13567 };
13568
13569 dlg.finished(true);
13570 return Ok(response);
13571 }
13572 }
13573 }
13574 }
13575
13576 /// The ID of the enterprise.
13577 ///
13578 /// Sets the *enterprise id* path property to the given value.
13579 ///
13580 /// Even though the property as already been set when instantiating this call,
13581 /// we provide this method for API completeness.
13582 pub fn enterprise_id(mut self, new_value: &str) -> GrouplicenseGetCall<'a, C> {
13583 self._enterprise_id = new_value.to_string();
13584 self
13585 }
13586 /// The ID of the product the group license is for, e.g. "app:com.google.android.gm".
13587 ///
13588 /// Sets the *group license id* path property to the given value.
13589 ///
13590 /// Even though the property as already been set when instantiating this call,
13591 /// we provide this method for API completeness.
13592 pub fn group_license_id(mut self, new_value: &str) -> GrouplicenseGetCall<'a, C> {
13593 self._group_license_id = new_value.to_string();
13594 self
13595 }
13596 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13597 /// while executing the actual API request.
13598 ///
13599 /// ````text
13600 /// It should be used to handle progress information, and to implement a certain level of resilience.
13601 /// ````
13602 ///
13603 /// Sets the *delegate* property to the given value.
13604 pub fn delegate(
13605 mut self,
13606 new_value: &'a mut dyn common::Delegate,
13607 ) -> GrouplicenseGetCall<'a, C> {
13608 self._delegate = Some(new_value);
13609 self
13610 }
13611
13612 /// Set any additional parameter of the query string used in the request.
13613 /// It should be used to set parameters which are not yet available through their own
13614 /// setters.
13615 ///
13616 /// Please note that this method must not be used to set any of the known parameters
13617 /// which have their own setter method. If done anyway, the request will fail.
13618 ///
13619 /// # Additional Parameters
13620 ///
13621 /// * *$.xgafv* (query-string) - V1 error format.
13622 /// * *access_token* (query-string) - OAuth access token.
13623 /// * *alt* (query-string) - Data format for response.
13624 /// * *callback* (query-string) - JSONP
13625 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13626 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13627 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13628 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13629 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13630 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13631 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13632 pub fn param<T>(mut self, name: T, value: T) -> GrouplicenseGetCall<'a, C>
13633 where
13634 T: AsRef<str>,
13635 {
13636 self._additional_params
13637 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13638 self
13639 }
13640
13641 /// Identifies the authorization scope for the method you are building.
13642 ///
13643 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13644 /// [`Scope::Full`].
13645 ///
13646 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13647 /// tokens for more than one scope.
13648 ///
13649 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13650 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13651 /// sufficient, a read-write scope will do as well.
13652 pub fn add_scope<St>(mut self, scope: St) -> GrouplicenseGetCall<'a, C>
13653 where
13654 St: AsRef<str>,
13655 {
13656 self._scopes.insert(String::from(scope.as_ref()));
13657 self
13658 }
13659 /// Identifies the authorization scope(s) for the method you are building.
13660 ///
13661 /// See [`Self::add_scope()`] for details.
13662 pub fn add_scopes<I, St>(mut self, scopes: I) -> GrouplicenseGetCall<'a, C>
13663 where
13664 I: IntoIterator<Item = St>,
13665 St: AsRef<str>,
13666 {
13667 self._scopes
13668 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13669 self
13670 }
13671
13672 /// Removes all scopes, and no default scope will be used either.
13673 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13674 /// for details).
13675 pub fn clear_scopes(mut self) -> GrouplicenseGetCall<'a, C> {
13676 self._scopes.clear();
13677 self
13678 }
13679}
13680
13681/// Retrieves IDs of all products for which the enterprise has a group license. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
13682///
13683/// A builder for the *list* method supported by a *grouplicense* resource.
13684/// It is not used directly, but through a [`GrouplicenseMethods`] instance.
13685///
13686/// # Example
13687///
13688/// Instantiate a resource method builder
13689///
13690/// ```test_harness,no_run
13691/// # extern crate hyper;
13692/// # extern crate hyper_rustls;
13693/// # extern crate google_androidenterprise1 as androidenterprise1;
13694/// # async fn dox() {
13695/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13696///
13697/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13698/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13699/// # .with_native_roots()
13700/// # .unwrap()
13701/// # .https_only()
13702/// # .enable_http2()
13703/// # .build();
13704///
13705/// # let executor = hyper_util::rt::TokioExecutor::new();
13706/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13707/// # secret,
13708/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13709/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13710/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13711/// # ),
13712/// # ).build().await.unwrap();
13713///
13714/// # let client = hyper_util::client::legacy::Client::builder(
13715/// # hyper_util::rt::TokioExecutor::new()
13716/// # )
13717/// # .build(
13718/// # hyper_rustls::HttpsConnectorBuilder::new()
13719/// # .with_native_roots()
13720/// # .unwrap()
13721/// # .https_or_http()
13722/// # .enable_http2()
13723/// # .build()
13724/// # );
13725/// # let mut hub = AndroidEnterprise::new(client, auth);
13726/// // You can configure optional parameters by calling the respective setters at will, and
13727/// // execute the final call using `doit()`.
13728/// // Values shown here are possibly random and not representative !
13729/// let result = hub.grouplicenses().list("enterpriseId")
13730/// .doit().await;
13731/// # }
13732/// ```
13733pub struct GrouplicenseListCall<'a, C>
13734where
13735 C: 'a,
13736{
13737 hub: &'a AndroidEnterprise<C>,
13738 _enterprise_id: String,
13739 _delegate: Option<&'a mut dyn common::Delegate>,
13740 _additional_params: HashMap<String, String>,
13741 _scopes: BTreeSet<String>,
13742}
13743
13744impl<'a, C> common::CallBuilder for GrouplicenseListCall<'a, C> {}
13745
13746impl<'a, C> GrouplicenseListCall<'a, C>
13747where
13748 C: common::Connector,
13749{
13750 /// Perform the operation you have build so far.
13751 pub async fn doit(mut self) -> common::Result<(common::Response, GroupLicensesListResponse)> {
13752 use std::borrow::Cow;
13753 use std::io::{Read, Seek};
13754
13755 use common::{url::Params, ToParts};
13756 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13757
13758 let mut dd = common::DefaultDelegate;
13759 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13760 dlg.begin(common::MethodInfo {
13761 id: "androidenterprise.grouplicenses.list",
13762 http_method: hyper::Method::GET,
13763 });
13764
13765 for &field in ["alt", "enterpriseId"].iter() {
13766 if self._additional_params.contains_key(field) {
13767 dlg.finished(false);
13768 return Err(common::Error::FieldClash(field));
13769 }
13770 }
13771
13772 let mut params = Params::with_capacity(3 + self._additional_params.len());
13773 params.push("enterpriseId", self._enterprise_id);
13774
13775 params.extend(self._additional_params.iter());
13776
13777 params.push("alt", "json");
13778 let mut url = self.hub._base_url.clone()
13779 + "androidenterprise/v1/enterprises/{enterpriseId}/groupLicenses";
13780 if self._scopes.is_empty() {
13781 self._scopes.insert(Scope::Full.as_ref().to_string());
13782 }
13783
13784 #[allow(clippy::single_element_loop)]
13785 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
13786 url = params.uri_replacement(url, param_name, find_this, false);
13787 }
13788 {
13789 let to_remove = ["enterpriseId"];
13790 params.remove_params(&to_remove);
13791 }
13792
13793 let url = params.parse_with_url(&url);
13794
13795 loop {
13796 let token = match self
13797 .hub
13798 .auth
13799 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13800 .await
13801 {
13802 Ok(token) => token,
13803 Err(e) => match dlg.token(e) {
13804 Ok(token) => token,
13805 Err(e) => {
13806 dlg.finished(false);
13807 return Err(common::Error::MissingToken(e));
13808 }
13809 },
13810 };
13811 let mut req_result = {
13812 let client = &self.hub.client;
13813 dlg.pre_request();
13814 let mut req_builder = hyper::Request::builder()
13815 .method(hyper::Method::GET)
13816 .uri(url.as_str())
13817 .header(USER_AGENT, self.hub._user_agent.clone());
13818
13819 if let Some(token) = token.as_ref() {
13820 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13821 }
13822
13823 let request = req_builder
13824 .header(CONTENT_LENGTH, 0_u64)
13825 .body(common::to_body::<String>(None));
13826
13827 client.request(request.unwrap()).await
13828 };
13829
13830 match req_result {
13831 Err(err) => {
13832 if let common::Retry::After(d) = dlg.http_error(&err) {
13833 sleep(d).await;
13834 continue;
13835 }
13836 dlg.finished(false);
13837 return Err(common::Error::HttpError(err));
13838 }
13839 Ok(res) => {
13840 let (mut parts, body) = res.into_parts();
13841 let mut body = common::Body::new(body);
13842 if !parts.status.is_success() {
13843 let bytes = common::to_bytes(body).await.unwrap_or_default();
13844 let error = serde_json::from_str(&common::to_string(&bytes));
13845 let response = common::to_response(parts, bytes.into());
13846
13847 if let common::Retry::After(d) =
13848 dlg.http_failure(&response, error.as_ref().ok())
13849 {
13850 sleep(d).await;
13851 continue;
13852 }
13853
13854 dlg.finished(false);
13855
13856 return Err(match error {
13857 Ok(value) => common::Error::BadRequest(value),
13858 _ => common::Error::Failure(response),
13859 });
13860 }
13861 let response = {
13862 let bytes = common::to_bytes(body).await.unwrap_or_default();
13863 let encoded = common::to_string(&bytes);
13864 match serde_json::from_str(&encoded) {
13865 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13866 Err(error) => {
13867 dlg.response_json_decode_error(&encoded, &error);
13868 return Err(common::Error::JsonDecodeError(
13869 encoded.to_string(),
13870 error,
13871 ));
13872 }
13873 }
13874 };
13875
13876 dlg.finished(true);
13877 return Ok(response);
13878 }
13879 }
13880 }
13881 }
13882
13883 /// The ID of the enterprise.
13884 ///
13885 /// Sets the *enterprise id* path property to the given value.
13886 ///
13887 /// Even though the property as already been set when instantiating this call,
13888 /// we provide this method for API completeness.
13889 pub fn enterprise_id(mut self, new_value: &str) -> GrouplicenseListCall<'a, C> {
13890 self._enterprise_id = new_value.to_string();
13891 self
13892 }
13893 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13894 /// while executing the actual API request.
13895 ///
13896 /// ````text
13897 /// It should be used to handle progress information, and to implement a certain level of resilience.
13898 /// ````
13899 ///
13900 /// Sets the *delegate* property to the given value.
13901 pub fn delegate(
13902 mut self,
13903 new_value: &'a mut dyn common::Delegate,
13904 ) -> GrouplicenseListCall<'a, C> {
13905 self._delegate = Some(new_value);
13906 self
13907 }
13908
13909 /// Set any additional parameter of the query string used in the request.
13910 /// It should be used to set parameters which are not yet available through their own
13911 /// setters.
13912 ///
13913 /// Please note that this method must not be used to set any of the known parameters
13914 /// which have their own setter method. If done anyway, the request will fail.
13915 ///
13916 /// # Additional Parameters
13917 ///
13918 /// * *$.xgafv* (query-string) - V1 error format.
13919 /// * *access_token* (query-string) - OAuth access token.
13920 /// * *alt* (query-string) - Data format for response.
13921 /// * *callback* (query-string) - JSONP
13922 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13923 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13924 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13925 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13926 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13927 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13928 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13929 pub fn param<T>(mut self, name: T, value: T) -> GrouplicenseListCall<'a, C>
13930 where
13931 T: AsRef<str>,
13932 {
13933 self._additional_params
13934 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13935 self
13936 }
13937
13938 /// Identifies the authorization scope for the method you are building.
13939 ///
13940 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13941 /// [`Scope::Full`].
13942 ///
13943 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13944 /// tokens for more than one scope.
13945 ///
13946 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13947 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13948 /// sufficient, a read-write scope will do as well.
13949 pub fn add_scope<St>(mut self, scope: St) -> GrouplicenseListCall<'a, C>
13950 where
13951 St: AsRef<str>,
13952 {
13953 self._scopes.insert(String::from(scope.as_ref()));
13954 self
13955 }
13956 /// Identifies the authorization scope(s) for the method you are building.
13957 ///
13958 /// See [`Self::add_scope()`] for details.
13959 pub fn add_scopes<I, St>(mut self, scopes: I) -> GrouplicenseListCall<'a, C>
13960 where
13961 I: IntoIterator<Item = St>,
13962 St: AsRef<str>,
13963 {
13964 self._scopes
13965 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13966 self
13967 }
13968
13969 /// Removes all scopes, and no default scope will be used either.
13970 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13971 /// for details).
13972 pub fn clear_scopes(mut self) -> GrouplicenseListCall<'a, C> {
13973 self._scopes.clear();
13974 self
13975 }
13976}
13977
13978/// Retrieves the IDs of the users who have been granted entitlements under the license. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
13979///
13980/// A builder for the *list* method supported by a *grouplicenseuser* resource.
13981/// It is not used directly, but through a [`GrouplicenseuserMethods`] instance.
13982///
13983/// # Example
13984///
13985/// Instantiate a resource method builder
13986///
13987/// ```test_harness,no_run
13988/// # extern crate hyper;
13989/// # extern crate hyper_rustls;
13990/// # extern crate google_androidenterprise1 as androidenterprise1;
13991/// # async fn dox() {
13992/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13993///
13994/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13995/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13996/// # .with_native_roots()
13997/// # .unwrap()
13998/// # .https_only()
13999/// # .enable_http2()
14000/// # .build();
14001///
14002/// # let executor = hyper_util::rt::TokioExecutor::new();
14003/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14004/// # secret,
14005/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14006/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14007/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14008/// # ),
14009/// # ).build().await.unwrap();
14010///
14011/// # let client = hyper_util::client::legacy::Client::builder(
14012/// # hyper_util::rt::TokioExecutor::new()
14013/// # )
14014/// # .build(
14015/// # hyper_rustls::HttpsConnectorBuilder::new()
14016/// # .with_native_roots()
14017/// # .unwrap()
14018/// # .https_or_http()
14019/// # .enable_http2()
14020/// # .build()
14021/// # );
14022/// # let mut hub = AndroidEnterprise::new(client, auth);
14023/// // You can configure optional parameters by calling the respective setters at will, and
14024/// // execute the final call using `doit()`.
14025/// // Values shown here are possibly random and not representative !
14026/// let result = hub.grouplicenseusers().list("enterpriseId", "groupLicenseId")
14027/// .doit().await;
14028/// # }
14029/// ```
14030pub struct GrouplicenseuserListCall<'a, C>
14031where
14032 C: 'a,
14033{
14034 hub: &'a AndroidEnterprise<C>,
14035 _enterprise_id: String,
14036 _group_license_id: String,
14037 _delegate: Option<&'a mut dyn common::Delegate>,
14038 _additional_params: HashMap<String, String>,
14039 _scopes: BTreeSet<String>,
14040}
14041
14042impl<'a, C> common::CallBuilder for GrouplicenseuserListCall<'a, C> {}
14043
14044impl<'a, C> GrouplicenseuserListCall<'a, C>
14045where
14046 C: common::Connector,
14047{
14048 /// Perform the operation you have build so far.
14049 pub async fn doit(
14050 mut self,
14051 ) -> common::Result<(common::Response, GroupLicenseUsersListResponse)> {
14052 use std::borrow::Cow;
14053 use std::io::{Read, Seek};
14054
14055 use common::{url::Params, ToParts};
14056 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14057
14058 let mut dd = common::DefaultDelegate;
14059 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14060 dlg.begin(common::MethodInfo {
14061 id: "androidenterprise.grouplicenseusers.list",
14062 http_method: hyper::Method::GET,
14063 });
14064
14065 for &field in ["alt", "enterpriseId", "groupLicenseId"].iter() {
14066 if self._additional_params.contains_key(field) {
14067 dlg.finished(false);
14068 return Err(common::Error::FieldClash(field));
14069 }
14070 }
14071
14072 let mut params = Params::with_capacity(4 + self._additional_params.len());
14073 params.push("enterpriseId", self._enterprise_id);
14074 params.push("groupLicenseId", self._group_license_id);
14075
14076 params.extend(self._additional_params.iter());
14077
14078 params.push("alt", "json");
14079 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/groupLicenses/{groupLicenseId}/users";
14080 if self._scopes.is_empty() {
14081 self._scopes.insert(Scope::Full.as_ref().to_string());
14082 }
14083
14084 #[allow(clippy::single_element_loop)]
14085 for &(find_this, param_name) in [
14086 ("{enterpriseId}", "enterpriseId"),
14087 ("{groupLicenseId}", "groupLicenseId"),
14088 ]
14089 .iter()
14090 {
14091 url = params.uri_replacement(url, param_name, find_this, false);
14092 }
14093 {
14094 let to_remove = ["groupLicenseId", "enterpriseId"];
14095 params.remove_params(&to_remove);
14096 }
14097
14098 let url = params.parse_with_url(&url);
14099
14100 loop {
14101 let token = match self
14102 .hub
14103 .auth
14104 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14105 .await
14106 {
14107 Ok(token) => token,
14108 Err(e) => match dlg.token(e) {
14109 Ok(token) => token,
14110 Err(e) => {
14111 dlg.finished(false);
14112 return Err(common::Error::MissingToken(e));
14113 }
14114 },
14115 };
14116 let mut req_result = {
14117 let client = &self.hub.client;
14118 dlg.pre_request();
14119 let mut req_builder = hyper::Request::builder()
14120 .method(hyper::Method::GET)
14121 .uri(url.as_str())
14122 .header(USER_AGENT, self.hub._user_agent.clone());
14123
14124 if let Some(token) = token.as_ref() {
14125 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14126 }
14127
14128 let request = req_builder
14129 .header(CONTENT_LENGTH, 0_u64)
14130 .body(common::to_body::<String>(None));
14131
14132 client.request(request.unwrap()).await
14133 };
14134
14135 match req_result {
14136 Err(err) => {
14137 if let common::Retry::After(d) = dlg.http_error(&err) {
14138 sleep(d).await;
14139 continue;
14140 }
14141 dlg.finished(false);
14142 return Err(common::Error::HttpError(err));
14143 }
14144 Ok(res) => {
14145 let (mut parts, body) = res.into_parts();
14146 let mut body = common::Body::new(body);
14147 if !parts.status.is_success() {
14148 let bytes = common::to_bytes(body).await.unwrap_or_default();
14149 let error = serde_json::from_str(&common::to_string(&bytes));
14150 let response = common::to_response(parts, bytes.into());
14151
14152 if let common::Retry::After(d) =
14153 dlg.http_failure(&response, error.as_ref().ok())
14154 {
14155 sleep(d).await;
14156 continue;
14157 }
14158
14159 dlg.finished(false);
14160
14161 return Err(match error {
14162 Ok(value) => common::Error::BadRequest(value),
14163 _ => common::Error::Failure(response),
14164 });
14165 }
14166 let response = {
14167 let bytes = common::to_bytes(body).await.unwrap_or_default();
14168 let encoded = common::to_string(&bytes);
14169 match serde_json::from_str(&encoded) {
14170 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14171 Err(error) => {
14172 dlg.response_json_decode_error(&encoded, &error);
14173 return Err(common::Error::JsonDecodeError(
14174 encoded.to_string(),
14175 error,
14176 ));
14177 }
14178 }
14179 };
14180
14181 dlg.finished(true);
14182 return Ok(response);
14183 }
14184 }
14185 }
14186 }
14187
14188 /// The ID of the enterprise.
14189 ///
14190 /// Sets the *enterprise id* path property to the given value.
14191 ///
14192 /// Even though the property as already been set when instantiating this call,
14193 /// we provide this method for API completeness.
14194 pub fn enterprise_id(mut self, new_value: &str) -> GrouplicenseuserListCall<'a, C> {
14195 self._enterprise_id = new_value.to_string();
14196 self
14197 }
14198 /// The ID of the product the group license is for, e.g. "app:com.google.android.gm".
14199 ///
14200 /// Sets the *group license id* path property to the given value.
14201 ///
14202 /// Even though the property as already been set when instantiating this call,
14203 /// we provide this method for API completeness.
14204 pub fn group_license_id(mut self, new_value: &str) -> GrouplicenseuserListCall<'a, C> {
14205 self._group_license_id = new_value.to_string();
14206 self
14207 }
14208 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14209 /// while executing the actual API request.
14210 ///
14211 /// ````text
14212 /// It should be used to handle progress information, and to implement a certain level of resilience.
14213 /// ````
14214 ///
14215 /// Sets the *delegate* property to the given value.
14216 pub fn delegate(
14217 mut self,
14218 new_value: &'a mut dyn common::Delegate,
14219 ) -> GrouplicenseuserListCall<'a, C> {
14220 self._delegate = Some(new_value);
14221 self
14222 }
14223
14224 /// Set any additional parameter of the query string used in the request.
14225 /// It should be used to set parameters which are not yet available through their own
14226 /// setters.
14227 ///
14228 /// Please note that this method must not be used to set any of the known parameters
14229 /// which have their own setter method. If done anyway, the request will fail.
14230 ///
14231 /// # Additional Parameters
14232 ///
14233 /// * *$.xgafv* (query-string) - V1 error format.
14234 /// * *access_token* (query-string) - OAuth access token.
14235 /// * *alt* (query-string) - Data format for response.
14236 /// * *callback* (query-string) - JSONP
14237 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14238 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14239 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14240 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14241 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14242 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14243 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14244 pub fn param<T>(mut self, name: T, value: T) -> GrouplicenseuserListCall<'a, C>
14245 where
14246 T: AsRef<str>,
14247 {
14248 self._additional_params
14249 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14250 self
14251 }
14252
14253 /// Identifies the authorization scope for the method you are building.
14254 ///
14255 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14256 /// [`Scope::Full`].
14257 ///
14258 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14259 /// tokens for more than one scope.
14260 ///
14261 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14262 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14263 /// sufficient, a read-write scope will do as well.
14264 pub fn add_scope<St>(mut self, scope: St) -> GrouplicenseuserListCall<'a, C>
14265 where
14266 St: AsRef<str>,
14267 {
14268 self._scopes.insert(String::from(scope.as_ref()));
14269 self
14270 }
14271 /// Identifies the authorization scope(s) for the method you are building.
14272 ///
14273 /// See [`Self::add_scope()`] for details.
14274 pub fn add_scopes<I, St>(mut self, scopes: I) -> GrouplicenseuserListCall<'a, C>
14275 where
14276 I: IntoIterator<Item = St>,
14277 St: AsRef<str>,
14278 {
14279 self._scopes
14280 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14281 self
14282 }
14283
14284 /// Removes all scopes, and no default scope will be used either.
14285 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14286 /// for details).
14287 pub fn clear_scopes(mut self) -> GrouplicenseuserListCall<'a, C> {
14288 self._scopes.clear();
14289 self
14290 }
14291}
14292
14293/// Requests to remove an app from a device. A call to get or list will still show the app as installed on the device until it is actually removed. A successful response indicates that a removal request has been sent to the device. The call will be considered successful even if the app is not present on the device (e.g. it was never installed, or was removed by the user).
14294///
14295/// A builder for the *delete* method supported by a *install* resource.
14296/// It is not used directly, but through a [`InstallMethods`] instance.
14297///
14298/// # Example
14299///
14300/// Instantiate a resource method builder
14301///
14302/// ```test_harness,no_run
14303/// # extern crate hyper;
14304/// # extern crate hyper_rustls;
14305/// # extern crate google_androidenterprise1 as androidenterprise1;
14306/// # async fn dox() {
14307/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14308///
14309/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14310/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14311/// # .with_native_roots()
14312/// # .unwrap()
14313/// # .https_only()
14314/// # .enable_http2()
14315/// # .build();
14316///
14317/// # let executor = hyper_util::rt::TokioExecutor::new();
14318/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14319/// # secret,
14320/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14321/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14322/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14323/// # ),
14324/// # ).build().await.unwrap();
14325///
14326/// # let client = hyper_util::client::legacy::Client::builder(
14327/// # hyper_util::rt::TokioExecutor::new()
14328/// # )
14329/// # .build(
14330/// # hyper_rustls::HttpsConnectorBuilder::new()
14331/// # .with_native_roots()
14332/// # .unwrap()
14333/// # .https_or_http()
14334/// # .enable_http2()
14335/// # .build()
14336/// # );
14337/// # let mut hub = AndroidEnterprise::new(client, auth);
14338/// // You can configure optional parameters by calling the respective setters at will, and
14339/// // execute the final call using `doit()`.
14340/// // Values shown here are possibly random and not representative !
14341/// let result = hub.installs().delete("enterpriseId", "userId", "deviceId", "installId")
14342/// .doit().await;
14343/// # }
14344/// ```
14345pub struct InstallDeleteCall<'a, C>
14346where
14347 C: 'a,
14348{
14349 hub: &'a AndroidEnterprise<C>,
14350 _enterprise_id: String,
14351 _user_id: String,
14352 _device_id: String,
14353 _install_id: String,
14354 _delegate: Option<&'a mut dyn common::Delegate>,
14355 _additional_params: HashMap<String, String>,
14356 _scopes: BTreeSet<String>,
14357}
14358
14359impl<'a, C> common::CallBuilder for InstallDeleteCall<'a, C> {}
14360
14361impl<'a, C> InstallDeleteCall<'a, C>
14362where
14363 C: common::Connector,
14364{
14365 /// Perform the operation you have build so far.
14366 pub async fn doit(mut self) -> common::Result<common::Response> {
14367 use std::borrow::Cow;
14368 use std::io::{Read, Seek};
14369
14370 use common::{url::Params, ToParts};
14371 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14372
14373 let mut dd = common::DefaultDelegate;
14374 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14375 dlg.begin(common::MethodInfo {
14376 id: "androidenterprise.installs.delete",
14377 http_method: hyper::Method::DELETE,
14378 });
14379
14380 for &field in ["enterpriseId", "userId", "deviceId", "installId"].iter() {
14381 if self._additional_params.contains_key(field) {
14382 dlg.finished(false);
14383 return Err(common::Error::FieldClash(field));
14384 }
14385 }
14386
14387 let mut params = Params::with_capacity(5 + self._additional_params.len());
14388 params.push("enterpriseId", self._enterprise_id);
14389 params.push("userId", self._user_id);
14390 params.push("deviceId", self._device_id);
14391 params.push("installId", self._install_id);
14392
14393 params.extend(self._additional_params.iter());
14394
14395 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/installs/{installId}";
14396 if self._scopes.is_empty() {
14397 self._scopes.insert(Scope::Full.as_ref().to_string());
14398 }
14399
14400 #[allow(clippy::single_element_loop)]
14401 for &(find_this, param_name) in [
14402 ("{enterpriseId}", "enterpriseId"),
14403 ("{userId}", "userId"),
14404 ("{deviceId}", "deviceId"),
14405 ("{installId}", "installId"),
14406 ]
14407 .iter()
14408 {
14409 url = params.uri_replacement(url, param_name, find_this, false);
14410 }
14411 {
14412 let to_remove = ["installId", "deviceId", "userId", "enterpriseId"];
14413 params.remove_params(&to_remove);
14414 }
14415
14416 let url = params.parse_with_url(&url);
14417
14418 loop {
14419 let token = match self
14420 .hub
14421 .auth
14422 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14423 .await
14424 {
14425 Ok(token) => token,
14426 Err(e) => match dlg.token(e) {
14427 Ok(token) => token,
14428 Err(e) => {
14429 dlg.finished(false);
14430 return Err(common::Error::MissingToken(e));
14431 }
14432 },
14433 };
14434 let mut req_result = {
14435 let client = &self.hub.client;
14436 dlg.pre_request();
14437 let mut req_builder = hyper::Request::builder()
14438 .method(hyper::Method::DELETE)
14439 .uri(url.as_str())
14440 .header(USER_AGENT, self.hub._user_agent.clone());
14441
14442 if let Some(token) = token.as_ref() {
14443 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14444 }
14445
14446 let request = req_builder
14447 .header(CONTENT_LENGTH, 0_u64)
14448 .body(common::to_body::<String>(None));
14449
14450 client.request(request.unwrap()).await
14451 };
14452
14453 match req_result {
14454 Err(err) => {
14455 if let common::Retry::After(d) = dlg.http_error(&err) {
14456 sleep(d).await;
14457 continue;
14458 }
14459 dlg.finished(false);
14460 return Err(common::Error::HttpError(err));
14461 }
14462 Ok(res) => {
14463 let (mut parts, body) = res.into_parts();
14464 let mut body = common::Body::new(body);
14465 if !parts.status.is_success() {
14466 let bytes = common::to_bytes(body).await.unwrap_or_default();
14467 let error = serde_json::from_str(&common::to_string(&bytes));
14468 let response = common::to_response(parts, bytes.into());
14469
14470 if let common::Retry::After(d) =
14471 dlg.http_failure(&response, error.as_ref().ok())
14472 {
14473 sleep(d).await;
14474 continue;
14475 }
14476
14477 dlg.finished(false);
14478
14479 return Err(match error {
14480 Ok(value) => common::Error::BadRequest(value),
14481 _ => common::Error::Failure(response),
14482 });
14483 }
14484 let response = common::Response::from_parts(parts, body);
14485
14486 dlg.finished(true);
14487 return Ok(response);
14488 }
14489 }
14490 }
14491 }
14492
14493 /// The ID of the enterprise.
14494 ///
14495 /// Sets the *enterprise id* path property to the given value.
14496 ///
14497 /// Even though the property as already been set when instantiating this call,
14498 /// we provide this method for API completeness.
14499 pub fn enterprise_id(mut self, new_value: &str) -> InstallDeleteCall<'a, C> {
14500 self._enterprise_id = new_value.to_string();
14501 self
14502 }
14503 /// The ID of the user.
14504 ///
14505 /// Sets the *user id* path property to the given value.
14506 ///
14507 /// Even though the property as already been set when instantiating this call,
14508 /// we provide this method for API completeness.
14509 pub fn user_id(mut self, new_value: &str) -> InstallDeleteCall<'a, C> {
14510 self._user_id = new_value.to_string();
14511 self
14512 }
14513 /// The Android ID of the device.
14514 ///
14515 /// Sets the *device id* path property to the given value.
14516 ///
14517 /// Even though the property as already been set when instantiating this call,
14518 /// we provide this method for API completeness.
14519 pub fn device_id(mut self, new_value: &str) -> InstallDeleteCall<'a, C> {
14520 self._device_id = new_value.to_string();
14521 self
14522 }
14523 /// The ID of the product represented by the install, e.g. "app:com.google.android.gm".
14524 ///
14525 /// Sets the *install id* path property to the given value.
14526 ///
14527 /// Even though the property as already been set when instantiating this call,
14528 /// we provide this method for API completeness.
14529 pub fn install_id(mut self, new_value: &str) -> InstallDeleteCall<'a, C> {
14530 self._install_id = new_value.to_string();
14531 self
14532 }
14533 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14534 /// while executing the actual API request.
14535 ///
14536 /// ````text
14537 /// It should be used to handle progress information, and to implement a certain level of resilience.
14538 /// ````
14539 ///
14540 /// Sets the *delegate* property to the given value.
14541 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> InstallDeleteCall<'a, C> {
14542 self._delegate = Some(new_value);
14543 self
14544 }
14545
14546 /// Set any additional parameter of the query string used in the request.
14547 /// It should be used to set parameters which are not yet available through their own
14548 /// setters.
14549 ///
14550 /// Please note that this method must not be used to set any of the known parameters
14551 /// which have their own setter method. If done anyway, the request will fail.
14552 ///
14553 /// # Additional Parameters
14554 ///
14555 /// * *$.xgafv* (query-string) - V1 error format.
14556 /// * *access_token* (query-string) - OAuth access token.
14557 /// * *alt* (query-string) - Data format for response.
14558 /// * *callback* (query-string) - JSONP
14559 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14560 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14561 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14562 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14563 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14564 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14565 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14566 pub fn param<T>(mut self, name: T, value: T) -> InstallDeleteCall<'a, C>
14567 where
14568 T: AsRef<str>,
14569 {
14570 self._additional_params
14571 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14572 self
14573 }
14574
14575 /// Identifies the authorization scope for the method you are building.
14576 ///
14577 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14578 /// [`Scope::Full`].
14579 ///
14580 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14581 /// tokens for more than one scope.
14582 ///
14583 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14584 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14585 /// sufficient, a read-write scope will do as well.
14586 pub fn add_scope<St>(mut self, scope: St) -> InstallDeleteCall<'a, C>
14587 where
14588 St: AsRef<str>,
14589 {
14590 self._scopes.insert(String::from(scope.as_ref()));
14591 self
14592 }
14593 /// Identifies the authorization scope(s) for the method you are building.
14594 ///
14595 /// See [`Self::add_scope()`] for details.
14596 pub fn add_scopes<I, St>(mut self, scopes: I) -> InstallDeleteCall<'a, C>
14597 where
14598 I: IntoIterator<Item = St>,
14599 St: AsRef<str>,
14600 {
14601 self._scopes
14602 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14603 self
14604 }
14605
14606 /// Removes all scopes, and no default scope will be used either.
14607 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14608 /// for details).
14609 pub fn clear_scopes(mut self) -> InstallDeleteCall<'a, C> {
14610 self._scopes.clear();
14611 self
14612 }
14613}
14614
14615/// Retrieves details of an installation of an app on a device.
14616///
14617/// A builder for the *get* method supported by a *install* resource.
14618/// It is not used directly, but through a [`InstallMethods`] instance.
14619///
14620/// # Example
14621///
14622/// Instantiate a resource method builder
14623///
14624/// ```test_harness,no_run
14625/// # extern crate hyper;
14626/// # extern crate hyper_rustls;
14627/// # extern crate google_androidenterprise1 as androidenterprise1;
14628/// # async fn dox() {
14629/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14630///
14631/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14632/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14633/// # .with_native_roots()
14634/// # .unwrap()
14635/// # .https_only()
14636/// # .enable_http2()
14637/// # .build();
14638///
14639/// # let executor = hyper_util::rt::TokioExecutor::new();
14640/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14641/// # secret,
14642/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14643/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14644/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14645/// # ),
14646/// # ).build().await.unwrap();
14647///
14648/// # let client = hyper_util::client::legacy::Client::builder(
14649/// # hyper_util::rt::TokioExecutor::new()
14650/// # )
14651/// # .build(
14652/// # hyper_rustls::HttpsConnectorBuilder::new()
14653/// # .with_native_roots()
14654/// # .unwrap()
14655/// # .https_or_http()
14656/// # .enable_http2()
14657/// # .build()
14658/// # );
14659/// # let mut hub = AndroidEnterprise::new(client, auth);
14660/// // You can configure optional parameters by calling the respective setters at will, and
14661/// // execute the final call using `doit()`.
14662/// // Values shown here are possibly random and not representative !
14663/// let result = hub.installs().get("enterpriseId", "userId", "deviceId", "installId")
14664/// .doit().await;
14665/// # }
14666/// ```
14667pub struct InstallGetCall<'a, C>
14668where
14669 C: 'a,
14670{
14671 hub: &'a AndroidEnterprise<C>,
14672 _enterprise_id: String,
14673 _user_id: String,
14674 _device_id: String,
14675 _install_id: String,
14676 _delegate: Option<&'a mut dyn common::Delegate>,
14677 _additional_params: HashMap<String, String>,
14678 _scopes: BTreeSet<String>,
14679}
14680
14681impl<'a, C> common::CallBuilder for InstallGetCall<'a, C> {}
14682
14683impl<'a, C> InstallGetCall<'a, C>
14684where
14685 C: common::Connector,
14686{
14687 /// Perform the operation you have build so far.
14688 pub async fn doit(mut self) -> common::Result<(common::Response, Install)> {
14689 use std::borrow::Cow;
14690 use std::io::{Read, Seek};
14691
14692 use common::{url::Params, ToParts};
14693 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14694
14695 let mut dd = common::DefaultDelegate;
14696 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14697 dlg.begin(common::MethodInfo {
14698 id: "androidenterprise.installs.get",
14699 http_method: hyper::Method::GET,
14700 });
14701
14702 for &field in ["alt", "enterpriseId", "userId", "deviceId", "installId"].iter() {
14703 if self._additional_params.contains_key(field) {
14704 dlg.finished(false);
14705 return Err(common::Error::FieldClash(field));
14706 }
14707 }
14708
14709 let mut params = Params::with_capacity(6 + self._additional_params.len());
14710 params.push("enterpriseId", self._enterprise_id);
14711 params.push("userId", self._user_id);
14712 params.push("deviceId", self._device_id);
14713 params.push("installId", self._install_id);
14714
14715 params.extend(self._additional_params.iter());
14716
14717 params.push("alt", "json");
14718 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/installs/{installId}";
14719 if self._scopes.is_empty() {
14720 self._scopes.insert(Scope::Full.as_ref().to_string());
14721 }
14722
14723 #[allow(clippy::single_element_loop)]
14724 for &(find_this, param_name) in [
14725 ("{enterpriseId}", "enterpriseId"),
14726 ("{userId}", "userId"),
14727 ("{deviceId}", "deviceId"),
14728 ("{installId}", "installId"),
14729 ]
14730 .iter()
14731 {
14732 url = params.uri_replacement(url, param_name, find_this, false);
14733 }
14734 {
14735 let to_remove = ["installId", "deviceId", "userId", "enterpriseId"];
14736 params.remove_params(&to_remove);
14737 }
14738
14739 let url = params.parse_with_url(&url);
14740
14741 loop {
14742 let token = match self
14743 .hub
14744 .auth
14745 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14746 .await
14747 {
14748 Ok(token) => token,
14749 Err(e) => match dlg.token(e) {
14750 Ok(token) => token,
14751 Err(e) => {
14752 dlg.finished(false);
14753 return Err(common::Error::MissingToken(e));
14754 }
14755 },
14756 };
14757 let mut req_result = {
14758 let client = &self.hub.client;
14759 dlg.pre_request();
14760 let mut req_builder = hyper::Request::builder()
14761 .method(hyper::Method::GET)
14762 .uri(url.as_str())
14763 .header(USER_AGENT, self.hub._user_agent.clone());
14764
14765 if let Some(token) = token.as_ref() {
14766 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14767 }
14768
14769 let request = req_builder
14770 .header(CONTENT_LENGTH, 0_u64)
14771 .body(common::to_body::<String>(None));
14772
14773 client.request(request.unwrap()).await
14774 };
14775
14776 match req_result {
14777 Err(err) => {
14778 if let common::Retry::After(d) = dlg.http_error(&err) {
14779 sleep(d).await;
14780 continue;
14781 }
14782 dlg.finished(false);
14783 return Err(common::Error::HttpError(err));
14784 }
14785 Ok(res) => {
14786 let (mut parts, body) = res.into_parts();
14787 let mut body = common::Body::new(body);
14788 if !parts.status.is_success() {
14789 let bytes = common::to_bytes(body).await.unwrap_or_default();
14790 let error = serde_json::from_str(&common::to_string(&bytes));
14791 let response = common::to_response(parts, bytes.into());
14792
14793 if let common::Retry::After(d) =
14794 dlg.http_failure(&response, error.as_ref().ok())
14795 {
14796 sleep(d).await;
14797 continue;
14798 }
14799
14800 dlg.finished(false);
14801
14802 return Err(match error {
14803 Ok(value) => common::Error::BadRequest(value),
14804 _ => common::Error::Failure(response),
14805 });
14806 }
14807 let response = {
14808 let bytes = common::to_bytes(body).await.unwrap_or_default();
14809 let encoded = common::to_string(&bytes);
14810 match serde_json::from_str(&encoded) {
14811 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14812 Err(error) => {
14813 dlg.response_json_decode_error(&encoded, &error);
14814 return Err(common::Error::JsonDecodeError(
14815 encoded.to_string(),
14816 error,
14817 ));
14818 }
14819 }
14820 };
14821
14822 dlg.finished(true);
14823 return Ok(response);
14824 }
14825 }
14826 }
14827 }
14828
14829 /// The ID of the enterprise.
14830 ///
14831 /// Sets the *enterprise id* path property to the given value.
14832 ///
14833 /// Even though the property as already been set when instantiating this call,
14834 /// we provide this method for API completeness.
14835 pub fn enterprise_id(mut self, new_value: &str) -> InstallGetCall<'a, C> {
14836 self._enterprise_id = new_value.to_string();
14837 self
14838 }
14839 /// The ID of the user.
14840 ///
14841 /// Sets the *user id* path property to the given value.
14842 ///
14843 /// Even though the property as already been set when instantiating this call,
14844 /// we provide this method for API completeness.
14845 pub fn user_id(mut self, new_value: &str) -> InstallGetCall<'a, C> {
14846 self._user_id = new_value.to_string();
14847 self
14848 }
14849 /// The Android ID of the device.
14850 ///
14851 /// Sets the *device id* path property to the given value.
14852 ///
14853 /// Even though the property as already been set when instantiating this call,
14854 /// we provide this method for API completeness.
14855 pub fn device_id(mut self, new_value: &str) -> InstallGetCall<'a, C> {
14856 self._device_id = new_value.to_string();
14857 self
14858 }
14859 /// The ID of the product represented by the install, e.g. "app:com.google.android.gm".
14860 ///
14861 /// Sets the *install id* path property to the given value.
14862 ///
14863 /// Even though the property as already been set when instantiating this call,
14864 /// we provide this method for API completeness.
14865 pub fn install_id(mut self, new_value: &str) -> InstallGetCall<'a, C> {
14866 self._install_id = new_value.to_string();
14867 self
14868 }
14869 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14870 /// while executing the actual API request.
14871 ///
14872 /// ````text
14873 /// It should be used to handle progress information, and to implement a certain level of resilience.
14874 /// ````
14875 ///
14876 /// Sets the *delegate* property to the given value.
14877 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> InstallGetCall<'a, C> {
14878 self._delegate = Some(new_value);
14879 self
14880 }
14881
14882 /// Set any additional parameter of the query string used in the request.
14883 /// It should be used to set parameters which are not yet available through their own
14884 /// setters.
14885 ///
14886 /// Please note that this method must not be used to set any of the known parameters
14887 /// which have their own setter method. If done anyway, the request will fail.
14888 ///
14889 /// # Additional Parameters
14890 ///
14891 /// * *$.xgafv* (query-string) - V1 error format.
14892 /// * *access_token* (query-string) - OAuth access token.
14893 /// * *alt* (query-string) - Data format for response.
14894 /// * *callback* (query-string) - JSONP
14895 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14896 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14897 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14898 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14899 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14900 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14901 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14902 pub fn param<T>(mut self, name: T, value: T) -> InstallGetCall<'a, C>
14903 where
14904 T: AsRef<str>,
14905 {
14906 self._additional_params
14907 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14908 self
14909 }
14910
14911 /// Identifies the authorization scope for the method you are building.
14912 ///
14913 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14914 /// [`Scope::Full`].
14915 ///
14916 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14917 /// tokens for more than one scope.
14918 ///
14919 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14920 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14921 /// sufficient, a read-write scope will do as well.
14922 pub fn add_scope<St>(mut self, scope: St) -> InstallGetCall<'a, C>
14923 where
14924 St: AsRef<str>,
14925 {
14926 self._scopes.insert(String::from(scope.as_ref()));
14927 self
14928 }
14929 /// Identifies the authorization scope(s) for the method you are building.
14930 ///
14931 /// See [`Self::add_scope()`] for details.
14932 pub fn add_scopes<I, St>(mut self, scopes: I) -> InstallGetCall<'a, C>
14933 where
14934 I: IntoIterator<Item = St>,
14935 St: AsRef<str>,
14936 {
14937 self._scopes
14938 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14939 self
14940 }
14941
14942 /// Removes all scopes, and no default scope will be used either.
14943 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14944 /// for details).
14945 pub fn clear_scopes(mut self) -> InstallGetCall<'a, C> {
14946 self._scopes.clear();
14947 self
14948 }
14949}
14950
14951/// Retrieves the details of all apps installed on the specified device.
14952///
14953/// A builder for the *list* method supported by a *install* resource.
14954/// It is not used directly, but through a [`InstallMethods`] instance.
14955///
14956/// # Example
14957///
14958/// Instantiate a resource method builder
14959///
14960/// ```test_harness,no_run
14961/// # extern crate hyper;
14962/// # extern crate hyper_rustls;
14963/// # extern crate google_androidenterprise1 as androidenterprise1;
14964/// # async fn dox() {
14965/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14966///
14967/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14968/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14969/// # .with_native_roots()
14970/// # .unwrap()
14971/// # .https_only()
14972/// # .enable_http2()
14973/// # .build();
14974///
14975/// # let executor = hyper_util::rt::TokioExecutor::new();
14976/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14977/// # secret,
14978/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14979/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14980/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14981/// # ),
14982/// # ).build().await.unwrap();
14983///
14984/// # let client = hyper_util::client::legacy::Client::builder(
14985/// # hyper_util::rt::TokioExecutor::new()
14986/// # )
14987/// # .build(
14988/// # hyper_rustls::HttpsConnectorBuilder::new()
14989/// # .with_native_roots()
14990/// # .unwrap()
14991/// # .https_or_http()
14992/// # .enable_http2()
14993/// # .build()
14994/// # );
14995/// # let mut hub = AndroidEnterprise::new(client, auth);
14996/// // You can configure optional parameters by calling the respective setters at will, and
14997/// // execute the final call using `doit()`.
14998/// // Values shown here are possibly random and not representative !
14999/// let result = hub.installs().list("enterpriseId", "userId", "deviceId")
15000/// .doit().await;
15001/// # }
15002/// ```
15003pub struct InstallListCall<'a, C>
15004where
15005 C: 'a,
15006{
15007 hub: &'a AndroidEnterprise<C>,
15008 _enterprise_id: String,
15009 _user_id: String,
15010 _device_id: String,
15011 _delegate: Option<&'a mut dyn common::Delegate>,
15012 _additional_params: HashMap<String, String>,
15013 _scopes: BTreeSet<String>,
15014}
15015
15016impl<'a, C> common::CallBuilder for InstallListCall<'a, C> {}
15017
15018impl<'a, C> InstallListCall<'a, C>
15019where
15020 C: common::Connector,
15021{
15022 /// Perform the operation you have build so far.
15023 pub async fn doit(mut self) -> common::Result<(common::Response, InstallsListResponse)> {
15024 use std::borrow::Cow;
15025 use std::io::{Read, Seek};
15026
15027 use common::{url::Params, ToParts};
15028 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15029
15030 let mut dd = common::DefaultDelegate;
15031 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15032 dlg.begin(common::MethodInfo {
15033 id: "androidenterprise.installs.list",
15034 http_method: hyper::Method::GET,
15035 });
15036
15037 for &field in ["alt", "enterpriseId", "userId", "deviceId"].iter() {
15038 if self._additional_params.contains_key(field) {
15039 dlg.finished(false);
15040 return Err(common::Error::FieldClash(field));
15041 }
15042 }
15043
15044 let mut params = Params::with_capacity(5 + self._additional_params.len());
15045 params.push("enterpriseId", self._enterprise_id);
15046 params.push("userId", self._user_id);
15047 params.push("deviceId", self._device_id);
15048
15049 params.extend(self._additional_params.iter());
15050
15051 params.push("alt", "json");
15052 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/installs";
15053 if self._scopes.is_empty() {
15054 self._scopes.insert(Scope::Full.as_ref().to_string());
15055 }
15056
15057 #[allow(clippy::single_element_loop)]
15058 for &(find_this, param_name) in [
15059 ("{enterpriseId}", "enterpriseId"),
15060 ("{userId}", "userId"),
15061 ("{deviceId}", "deviceId"),
15062 ]
15063 .iter()
15064 {
15065 url = params.uri_replacement(url, param_name, find_this, false);
15066 }
15067 {
15068 let to_remove = ["deviceId", "userId", "enterpriseId"];
15069 params.remove_params(&to_remove);
15070 }
15071
15072 let url = params.parse_with_url(&url);
15073
15074 loop {
15075 let token = match self
15076 .hub
15077 .auth
15078 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15079 .await
15080 {
15081 Ok(token) => token,
15082 Err(e) => match dlg.token(e) {
15083 Ok(token) => token,
15084 Err(e) => {
15085 dlg.finished(false);
15086 return Err(common::Error::MissingToken(e));
15087 }
15088 },
15089 };
15090 let mut req_result = {
15091 let client = &self.hub.client;
15092 dlg.pre_request();
15093 let mut req_builder = hyper::Request::builder()
15094 .method(hyper::Method::GET)
15095 .uri(url.as_str())
15096 .header(USER_AGENT, self.hub._user_agent.clone());
15097
15098 if let Some(token) = token.as_ref() {
15099 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15100 }
15101
15102 let request = req_builder
15103 .header(CONTENT_LENGTH, 0_u64)
15104 .body(common::to_body::<String>(None));
15105
15106 client.request(request.unwrap()).await
15107 };
15108
15109 match req_result {
15110 Err(err) => {
15111 if let common::Retry::After(d) = dlg.http_error(&err) {
15112 sleep(d).await;
15113 continue;
15114 }
15115 dlg.finished(false);
15116 return Err(common::Error::HttpError(err));
15117 }
15118 Ok(res) => {
15119 let (mut parts, body) = res.into_parts();
15120 let mut body = common::Body::new(body);
15121 if !parts.status.is_success() {
15122 let bytes = common::to_bytes(body).await.unwrap_or_default();
15123 let error = serde_json::from_str(&common::to_string(&bytes));
15124 let response = common::to_response(parts, bytes.into());
15125
15126 if let common::Retry::After(d) =
15127 dlg.http_failure(&response, error.as_ref().ok())
15128 {
15129 sleep(d).await;
15130 continue;
15131 }
15132
15133 dlg.finished(false);
15134
15135 return Err(match error {
15136 Ok(value) => common::Error::BadRequest(value),
15137 _ => common::Error::Failure(response),
15138 });
15139 }
15140 let response = {
15141 let bytes = common::to_bytes(body).await.unwrap_or_default();
15142 let encoded = common::to_string(&bytes);
15143 match serde_json::from_str(&encoded) {
15144 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15145 Err(error) => {
15146 dlg.response_json_decode_error(&encoded, &error);
15147 return Err(common::Error::JsonDecodeError(
15148 encoded.to_string(),
15149 error,
15150 ));
15151 }
15152 }
15153 };
15154
15155 dlg.finished(true);
15156 return Ok(response);
15157 }
15158 }
15159 }
15160 }
15161
15162 /// The ID of the enterprise.
15163 ///
15164 /// Sets the *enterprise id* path property to the given value.
15165 ///
15166 /// Even though the property as already been set when instantiating this call,
15167 /// we provide this method for API completeness.
15168 pub fn enterprise_id(mut self, new_value: &str) -> InstallListCall<'a, C> {
15169 self._enterprise_id = new_value.to_string();
15170 self
15171 }
15172 /// The ID of the user.
15173 ///
15174 /// Sets the *user id* path property to the given value.
15175 ///
15176 /// Even though the property as already been set when instantiating this call,
15177 /// we provide this method for API completeness.
15178 pub fn user_id(mut self, new_value: &str) -> InstallListCall<'a, C> {
15179 self._user_id = new_value.to_string();
15180 self
15181 }
15182 /// The Android ID of the device.
15183 ///
15184 /// Sets the *device id* path property to the given value.
15185 ///
15186 /// Even though the property as already been set when instantiating this call,
15187 /// we provide this method for API completeness.
15188 pub fn device_id(mut self, new_value: &str) -> InstallListCall<'a, C> {
15189 self._device_id = new_value.to_string();
15190 self
15191 }
15192 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15193 /// while executing the actual API request.
15194 ///
15195 /// ````text
15196 /// It should be used to handle progress information, and to implement a certain level of resilience.
15197 /// ````
15198 ///
15199 /// Sets the *delegate* property to the given value.
15200 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> InstallListCall<'a, C> {
15201 self._delegate = Some(new_value);
15202 self
15203 }
15204
15205 /// Set any additional parameter of the query string used in the request.
15206 /// It should be used to set parameters which are not yet available through their own
15207 /// setters.
15208 ///
15209 /// Please note that this method must not be used to set any of the known parameters
15210 /// which have their own setter method. If done anyway, the request will fail.
15211 ///
15212 /// # Additional Parameters
15213 ///
15214 /// * *$.xgafv* (query-string) - V1 error format.
15215 /// * *access_token* (query-string) - OAuth access token.
15216 /// * *alt* (query-string) - Data format for response.
15217 /// * *callback* (query-string) - JSONP
15218 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15219 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15220 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15221 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15222 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15223 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15224 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15225 pub fn param<T>(mut self, name: T, value: T) -> InstallListCall<'a, C>
15226 where
15227 T: AsRef<str>,
15228 {
15229 self._additional_params
15230 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15231 self
15232 }
15233
15234 /// Identifies the authorization scope for the method you are building.
15235 ///
15236 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15237 /// [`Scope::Full`].
15238 ///
15239 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15240 /// tokens for more than one scope.
15241 ///
15242 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15243 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15244 /// sufficient, a read-write scope will do as well.
15245 pub fn add_scope<St>(mut self, scope: St) -> InstallListCall<'a, C>
15246 where
15247 St: AsRef<str>,
15248 {
15249 self._scopes.insert(String::from(scope.as_ref()));
15250 self
15251 }
15252 /// Identifies the authorization scope(s) for the method you are building.
15253 ///
15254 /// See [`Self::add_scope()`] for details.
15255 pub fn add_scopes<I, St>(mut self, scopes: I) -> InstallListCall<'a, C>
15256 where
15257 I: IntoIterator<Item = St>,
15258 St: AsRef<str>,
15259 {
15260 self._scopes
15261 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15262 self
15263 }
15264
15265 /// Removes all scopes, and no default scope will be used either.
15266 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15267 /// for details).
15268 pub fn clear_scopes(mut self) -> InstallListCall<'a, C> {
15269 self._scopes.clear();
15270 self
15271 }
15272}
15273
15274/// Requests to install the latest version of an app to a device. If the app is already installed, then it is updated to the latest version if necessary.
15275///
15276/// A builder for the *update* method supported by a *install* resource.
15277/// It is not used directly, but through a [`InstallMethods`] instance.
15278///
15279/// # Example
15280///
15281/// Instantiate a resource method builder
15282///
15283/// ```test_harness,no_run
15284/// # extern crate hyper;
15285/// # extern crate hyper_rustls;
15286/// # extern crate google_androidenterprise1 as androidenterprise1;
15287/// use androidenterprise1::api::Install;
15288/// # async fn dox() {
15289/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15290///
15291/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15292/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15293/// # .with_native_roots()
15294/// # .unwrap()
15295/// # .https_only()
15296/// # .enable_http2()
15297/// # .build();
15298///
15299/// # let executor = hyper_util::rt::TokioExecutor::new();
15300/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15301/// # secret,
15302/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15303/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15304/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15305/// # ),
15306/// # ).build().await.unwrap();
15307///
15308/// # let client = hyper_util::client::legacy::Client::builder(
15309/// # hyper_util::rt::TokioExecutor::new()
15310/// # )
15311/// # .build(
15312/// # hyper_rustls::HttpsConnectorBuilder::new()
15313/// # .with_native_roots()
15314/// # .unwrap()
15315/// # .https_or_http()
15316/// # .enable_http2()
15317/// # .build()
15318/// # );
15319/// # let mut hub = AndroidEnterprise::new(client, auth);
15320/// // As the method needs a request, you would usually fill it with the desired information
15321/// // into the respective structure. Some of the parts shown here might not be applicable !
15322/// // Values shown here are possibly random and not representative !
15323/// let mut req = Install::default();
15324///
15325/// // You can configure optional parameters by calling the respective setters at will, and
15326/// // execute the final call using `doit()`.
15327/// // Values shown here are possibly random and not representative !
15328/// let result = hub.installs().update(req, "enterpriseId", "userId", "deviceId", "installId")
15329/// .doit().await;
15330/// # }
15331/// ```
15332pub struct InstallUpdateCall<'a, C>
15333where
15334 C: 'a,
15335{
15336 hub: &'a AndroidEnterprise<C>,
15337 _request: Install,
15338 _enterprise_id: String,
15339 _user_id: String,
15340 _device_id: String,
15341 _install_id: String,
15342 _delegate: Option<&'a mut dyn common::Delegate>,
15343 _additional_params: HashMap<String, String>,
15344 _scopes: BTreeSet<String>,
15345}
15346
15347impl<'a, C> common::CallBuilder for InstallUpdateCall<'a, C> {}
15348
15349impl<'a, C> InstallUpdateCall<'a, C>
15350where
15351 C: common::Connector,
15352{
15353 /// Perform the operation you have build so far.
15354 pub async fn doit(mut self) -> common::Result<(common::Response, Install)> {
15355 use std::borrow::Cow;
15356 use std::io::{Read, Seek};
15357
15358 use common::{url::Params, ToParts};
15359 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15360
15361 let mut dd = common::DefaultDelegate;
15362 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15363 dlg.begin(common::MethodInfo {
15364 id: "androidenterprise.installs.update",
15365 http_method: hyper::Method::PUT,
15366 });
15367
15368 for &field in ["alt", "enterpriseId", "userId", "deviceId", "installId"].iter() {
15369 if self._additional_params.contains_key(field) {
15370 dlg.finished(false);
15371 return Err(common::Error::FieldClash(field));
15372 }
15373 }
15374
15375 let mut params = Params::with_capacity(7 + self._additional_params.len());
15376 params.push("enterpriseId", self._enterprise_id);
15377 params.push("userId", self._user_id);
15378 params.push("deviceId", self._device_id);
15379 params.push("installId", self._install_id);
15380
15381 params.extend(self._additional_params.iter());
15382
15383 params.push("alt", "json");
15384 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/installs/{installId}";
15385 if self._scopes.is_empty() {
15386 self._scopes.insert(Scope::Full.as_ref().to_string());
15387 }
15388
15389 #[allow(clippy::single_element_loop)]
15390 for &(find_this, param_name) in [
15391 ("{enterpriseId}", "enterpriseId"),
15392 ("{userId}", "userId"),
15393 ("{deviceId}", "deviceId"),
15394 ("{installId}", "installId"),
15395 ]
15396 .iter()
15397 {
15398 url = params.uri_replacement(url, param_name, find_this, false);
15399 }
15400 {
15401 let to_remove = ["installId", "deviceId", "userId", "enterpriseId"];
15402 params.remove_params(&to_remove);
15403 }
15404
15405 let url = params.parse_with_url(&url);
15406
15407 let mut json_mime_type = mime::APPLICATION_JSON;
15408 let mut request_value_reader = {
15409 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15410 common::remove_json_null_values(&mut value);
15411 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15412 serde_json::to_writer(&mut dst, &value).unwrap();
15413 dst
15414 };
15415 let request_size = request_value_reader
15416 .seek(std::io::SeekFrom::End(0))
15417 .unwrap();
15418 request_value_reader
15419 .seek(std::io::SeekFrom::Start(0))
15420 .unwrap();
15421
15422 loop {
15423 let token = match self
15424 .hub
15425 .auth
15426 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15427 .await
15428 {
15429 Ok(token) => token,
15430 Err(e) => match dlg.token(e) {
15431 Ok(token) => token,
15432 Err(e) => {
15433 dlg.finished(false);
15434 return Err(common::Error::MissingToken(e));
15435 }
15436 },
15437 };
15438 request_value_reader
15439 .seek(std::io::SeekFrom::Start(0))
15440 .unwrap();
15441 let mut req_result = {
15442 let client = &self.hub.client;
15443 dlg.pre_request();
15444 let mut req_builder = hyper::Request::builder()
15445 .method(hyper::Method::PUT)
15446 .uri(url.as_str())
15447 .header(USER_AGENT, self.hub._user_agent.clone());
15448
15449 if let Some(token) = token.as_ref() {
15450 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15451 }
15452
15453 let request = req_builder
15454 .header(CONTENT_TYPE, json_mime_type.to_string())
15455 .header(CONTENT_LENGTH, request_size as u64)
15456 .body(common::to_body(
15457 request_value_reader.get_ref().clone().into(),
15458 ));
15459
15460 client.request(request.unwrap()).await
15461 };
15462
15463 match req_result {
15464 Err(err) => {
15465 if let common::Retry::After(d) = dlg.http_error(&err) {
15466 sleep(d).await;
15467 continue;
15468 }
15469 dlg.finished(false);
15470 return Err(common::Error::HttpError(err));
15471 }
15472 Ok(res) => {
15473 let (mut parts, body) = res.into_parts();
15474 let mut body = common::Body::new(body);
15475 if !parts.status.is_success() {
15476 let bytes = common::to_bytes(body).await.unwrap_or_default();
15477 let error = serde_json::from_str(&common::to_string(&bytes));
15478 let response = common::to_response(parts, bytes.into());
15479
15480 if let common::Retry::After(d) =
15481 dlg.http_failure(&response, error.as_ref().ok())
15482 {
15483 sleep(d).await;
15484 continue;
15485 }
15486
15487 dlg.finished(false);
15488
15489 return Err(match error {
15490 Ok(value) => common::Error::BadRequest(value),
15491 _ => common::Error::Failure(response),
15492 });
15493 }
15494 let response = {
15495 let bytes = common::to_bytes(body).await.unwrap_or_default();
15496 let encoded = common::to_string(&bytes);
15497 match serde_json::from_str(&encoded) {
15498 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15499 Err(error) => {
15500 dlg.response_json_decode_error(&encoded, &error);
15501 return Err(common::Error::JsonDecodeError(
15502 encoded.to_string(),
15503 error,
15504 ));
15505 }
15506 }
15507 };
15508
15509 dlg.finished(true);
15510 return Ok(response);
15511 }
15512 }
15513 }
15514 }
15515
15516 ///
15517 /// Sets the *request* property to the given value.
15518 ///
15519 /// Even though the property as already been set when instantiating this call,
15520 /// we provide this method for API completeness.
15521 pub fn request(mut self, new_value: Install) -> InstallUpdateCall<'a, C> {
15522 self._request = new_value;
15523 self
15524 }
15525 /// The ID of the enterprise.
15526 ///
15527 /// Sets the *enterprise id* path property to the given value.
15528 ///
15529 /// Even though the property as already been set when instantiating this call,
15530 /// we provide this method for API completeness.
15531 pub fn enterprise_id(mut self, new_value: &str) -> InstallUpdateCall<'a, C> {
15532 self._enterprise_id = new_value.to_string();
15533 self
15534 }
15535 /// The ID of the user.
15536 ///
15537 /// Sets the *user id* path property to the given value.
15538 ///
15539 /// Even though the property as already been set when instantiating this call,
15540 /// we provide this method for API completeness.
15541 pub fn user_id(mut self, new_value: &str) -> InstallUpdateCall<'a, C> {
15542 self._user_id = new_value.to_string();
15543 self
15544 }
15545 /// The Android ID of the device.
15546 ///
15547 /// Sets the *device id* path property to the given value.
15548 ///
15549 /// Even though the property as already been set when instantiating this call,
15550 /// we provide this method for API completeness.
15551 pub fn device_id(mut self, new_value: &str) -> InstallUpdateCall<'a, C> {
15552 self._device_id = new_value.to_string();
15553 self
15554 }
15555 /// The ID of the product represented by the install, e.g. "app:com.google.android.gm".
15556 ///
15557 /// Sets the *install id* path property to the given value.
15558 ///
15559 /// Even though the property as already been set when instantiating this call,
15560 /// we provide this method for API completeness.
15561 pub fn install_id(mut self, new_value: &str) -> InstallUpdateCall<'a, C> {
15562 self._install_id = new_value.to_string();
15563 self
15564 }
15565 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15566 /// while executing the actual API request.
15567 ///
15568 /// ````text
15569 /// It should be used to handle progress information, and to implement a certain level of resilience.
15570 /// ````
15571 ///
15572 /// Sets the *delegate* property to the given value.
15573 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> InstallUpdateCall<'a, C> {
15574 self._delegate = Some(new_value);
15575 self
15576 }
15577
15578 /// Set any additional parameter of the query string used in the request.
15579 /// It should be used to set parameters which are not yet available through their own
15580 /// setters.
15581 ///
15582 /// Please note that this method must not be used to set any of the known parameters
15583 /// which have their own setter method. If done anyway, the request will fail.
15584 ///
15585 /// # Additional Parameters
15586 ///
15587 /// * *$.xgafv* (query-string) - V1 error format.
15588 /// * *access_token* (query-string) - OAuth access token.
15589 /// * *alt* (query-string) - Data format for response.
15590 /// * *callback* (query-string) - JSONP
15591 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15592 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15593 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15594 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15595 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15596 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15597 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15598 pub fn param<T>(mut self, name: T, value: T) -> InstallUpdateCall<'a, C>
15599 where
15600 T: AsRef<str>,
15601 {
15602 self._additional_params
15603 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15604 self
15605 }
15606
15607 /// Identifies the authorization scope for the method you are building.
15608 ///
15609 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15610 /// [`Scope::Full`].
15611 ///
15612 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15613 /// tokens for more than one scope.
15614 ///
15615 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15616 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15617 /// sufficient, a read-write scope will do as well.
15618 pub fn add_scope<St>(mut self, scope: St) -> InstallUpdateCall<'a, C>
15619 where
15620 St: AsRef<str>,
15621 {
15622 self._scopes.insert(String::from(scope.as_ref()));
15623 self
15624 }
15625 /// Identifies the authorization scope(s) for the method you are building.
15626 ///
15627 /// See [`Self::add_scope()`] for details.
15628 pub fn add_scopes<I, St>(mut self, scopes: I) -> InstallUpdateCall<'a, C>
15629 where
15630 I: IntoIterator<Item = St>,
15631 St: AsRef<str>,
15632 {
15633 self._scopes
15634 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15635 self
15636 }
15637
15638 /// Removes all scopes, and no default scope will be used either.
15639 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15640 /// for details).
15641 pub fn clear_scopes(mut self) -> InstallUpdateCall<'a, C> {
15642 self._scopes.clear();
15643 self
15644 }
15645}
15646
15647/// Removes a per-device managed configuration for an app for the specified device.
15648///
15649/// A builder for the *delete* method supported by a *managedconfigurationsfordevice* resource.
15650/// It is not used directly, but through a [`ManagedconfigurationsfordeviceMethods`] instance.
15651///
15652/// # Example
15653///
15654/// Instantiate a resource method builder
15655///
15656/// ```test_harness,no_run
15657/// # extern crate hyper;
15658/// # extern crate hyper_rustls;
15659/// # extern crate google_androidenterprise1 as androidenterprise1;
15660/// # async fn dox() {
15661/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15662///
15663/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15664/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15665/// # .with_native_roots()
15666/// # .unwrap()
15667/// # .https_only()
15668/// # .enable_http2()
15669/// # .build();
15670///
15671/// # let executor = hyper_util::rt::TokioExecutor::new();
15672/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15673/// # secret,
15674/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15675/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15676/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15677/// # ),
15678/// # ).build().await.unwrap();
15679///
15680/// # let client = hyper_util::client::legacy::Client::builder(
15681/// # hyper_util::rt::TokioExecutor::new()
15682/// # )
15683/// # .build(
15684/// # hyper_rustls::HttpsConnectorBuilder::new()
15685/// # .with_native_roots()
15686/// # .unwrap()
15687/// # .https_or_http()
15688/// # .enable_http2()
15689/// # .build()
15690/// # );
15691/// # let mut hub = AndroidEnterprise::new(client, auth);
15692/// // You can configure optional parameters by calling the respective setters at will, and
15693/// // execute the final call using `doit()`.
15694/// // Values shown here are possibly random and not representative !
15695/// let result = hub.managedconfigurationsfordevice().delete("enterpriseId", "userId", "deviceId", "managedConfigurationForDeviceId")
15696/// .doit().await;
15697/// # }
15698/// ```
15699pub struct ManagedconfigurationsfordeviceDeleteCall<'a, C>
15700where
15701 C: 'a,
15702{
15703 hub: &'a AndroidEnterprise<C>,
15704 _enterprise_id: String,
15705 _user_id: String,
15706 _device_id: String,
15707 _managed_configuration_for_device_id: String,
15708 _delegate: Option<&'a mut dyn common::Delegate>,
15709 _additional_params: HashMap<String, String>,
15710 _scopes: BTreeSet<String>,
15711}
15712
15713impl<'a, C> common::CallBuilder for ManagedconfigurationsfordeviceDeleteCall<'a, C> {}
15714
15715impl<'a, C> ManagedconfigurationsfordeviceDeleteCall<'a, C>
15716where
15717 C: common::Connector,
15718{
15719 /// Perform the operation you have build so far.
15720 pub async fn doit(mut self) -> common::Result<common::Response> {
15721 use std::borrow::Cow;
15722 use std::io::{Read, Seek};
15723
15724 use common::{url::Params, ToParts};
15725 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15726
15727 let mut dd = common::DefaultDelegate;
15728 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15729 dlg.begin(common::MethodInfo {
15730 id: "androidenterprise.managedconfigurationsfordevice.delete",
15731 http_method: hyper::Method::DELETE,
15732 });
15733
15734 for &field in [
15735 "enterpriseId",
15736 "userId",
15737 "deviceId",
15738 "managedConfigurationForDeviceId",
15739 ]
15740 .iter()
15741 {
15742 if self._additional_params.contains_key(field) {
15743 dlg.finished(false);
15744 return Err(common::Error::FieldClash(field));
15745 }
15746 }
15747
15748 let mut params = Params::with_capacity(5 + self._additional_params.len());
15749 params.push("enterpriseId", self._enterprise_id);
15750 params.push("userId", self._user_id);
15751 params.push("deviceId", self._device_id);
15752 params.push(
15753 "managedConfigurationForDeviceId",
15754 self._managed_configuration_for_device_id,
15755 );
15756
15757 params.extend(self._additional_params.iter());
15758
15759 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/managedConfigurationsForDevice/{managedConfigurationForDeviceId}";
15760 if self._scopes.is_empty() {
15761 self._scopes.insert(Scope::Full.as_ref().to_string());
15762 }
15763
15764 #[allow(clippy::single_element_loop)]
15765 for &(find_this, param_name) in [
15766 ("{enterpriseId}", "enterpriseId"),
15767 ("{userId}", "userId"),
15768 ("{deviceId}", "deviceId"),
15769 (
15770 "{managedConfigurationForDeviceId}",
15771 "managedConfigurationForDeviceId",
15772 ),
15773 ]
15774 .iter()
15775 {
15776 url = params.uri_replacement(url, param_name, find_this, false);
15777 }
15778 {
15779 let to_remove = [
15780 "managedConfigurationForDeviceId",
15781 "deviceId",
15782 "userId",
15783 "enterpriseId",
15784 ];
15785 params.remove_params(&to_remove);
15786 }
15787
15788 let url = params.parse_with_url(&url);
15789
15790 loop {
15791 let token = match self
15792 .hub
15793 .auth
15794 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15795 .await
15796 {
15797 Ok(token) => token,
15798 Err(e) => match dlg.token(e) {
15799 Ok(token) => token,
15800 Err(e) => {
15801 dlg.finished(false);
15802 return Err(common::Error::MissingToken(e));
15803 }
15804 },
15805 };
15806 let mut req_result = {
15807 let client = &self.hub.client;
15808 dlg.pre_request();
15809 let mut req_builder = hyper::Request::builder()
15810 .method(hyper::Method::DELETE)
15811 .uri(url.as_str())
15812 .header(USER_AGENT, self.hub._user_agent.clone());
15813
15814 if let Some(token) = token.as_ref() {
15815 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15816 }
15817
15818 let request = req_builder
15819 .header(CONTENT_LENGTH, 0_u64)
15820 .body(common::to_body::<String>(None));
15821
15822 client.request(request.unwrap()).await
15823 };
15824
15825 match req_result {
15826 Err(err) => {
15827 if let common::Retry::After(d) = dlg.http_error(&err) {
15828 sleep(d).await;
15829 continue;
15830 }
15831 dlg.finished(false);
15832 return Err(common::Error::HttpError(err));
15833 }
15834 Ok(res) => {
15835 let (mut parts, body) = res.into_parts();
15836 let mut body = common::Body::new(body);
15837 if !parts.status.is_success() {
15838 let bytes = common::to_bytes(body).await.unwrap_or_default();
15839 let error = serde_json::from_str(&common::to_string(&bytes));
15840 let response = common::to_response(parts, bytes.into());
15841
15842 if let common::Retry::After(d) =
15843 dlg.http_failure(&response, error.as_ref().ok())
15844 {
15845 sleep(d).await;
15846 continue;
15847 }
15848
15849 dlg.finished(false);
15850
15851 return Err(match error {
15852 Ok(value) => common::Error::BadRequest(value),
15853 _ => common::Error::Failure(response),
15854 });
15855 }
15856 let response = common::Response::from_parts(parts, body);
15857
15858 dlg.finished(true);
15859 return Ok(response);
15860 }
15861 }
15862 }
15863 }
15864
15865 /// The ID of the enterprise.
15866 ///
15867 /// Sets the *enterprise id* path property to the given value.
15868 ///
15869 /// Even though the property as already been set when instantiating this call,
15870 /// we provide this method for API completeness.
15871 pub fn enterprise_id(
15872 mut self,
15873 new_value: &str,
15874 ) -> ManagedconfigurationsfordeviceDeleteCall<'a, C> {
15875 self._enterprise_id = new_value.to_string();
15876 self
15877 }
15878 /// The ID of the user.
15879 ///
15880 /// Sets the *user id* path property to the given value.
15881 ///
15882 /// Even though the property as already been set when instantiating this call,
15883 /// we provide this method for API completeness.
15884 pub fn user_id(mut self, new_value: &str) -> ManagedconfigurationsfordeviceDeleteCall<'a, C> {
15885 self._user_id = new_value.to_string();
15886 self
15887 }
15888 /// The Android ID of the device.
15889 ///
15890 /// Sets the *device id* path property to the given value.
15891 ///
15892 /// Even though the property as already been set when instantiating this call,
15893 /// we provide this method for API completeness.
15894 pub fn device_id(mut self, new_value: &str) -> ManagedconfigurationsfordeviceDeleteCall<'a, C> {
15895 self._device_id = new_value.to_string();
15896 self
15897 }
15898 /// The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
15899 ///
15900 /// Sets the *managed configuration for device id* path property to the given value.
15901 ///
15902 /// Even though the property as already been set when instantiating this call,
15903 /// we provide this method for API completeness.
15904 pub fn managed_configuration_for_device_id(
15905 mut self,
15906 new_value: &str,
15907 ) -> ManagedconfigurationsfordeviceDeleteCall<'a, C> {
15908 self._managed_configuration_for_device_id = new_value.to_string();
15909 self
15910 }
15911 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15912 /// while executing the actual API request.
15913 ///
15914 /// ````text
15915 /// It should be used to handle progress information, and to implement a certain level of resilience.
15916 /// ````
15917 ///
15918 /// Sets the *delegate* property to the given value.
15919 pub fn delegate(
15920 mut self,
15921 new_value: &'a mut dyn common::Delegate,
15922 ) -> ManagedconfigurationsfordeviceDeleteCall<'a, C> {
15923 self._delegate = Some(new_value);
15924 self
15925 }
15926
15927 /// Set any additional parameter of the query string used in the request.
15928 /// It should be used to set parameters which are not yet available through their own
15929 /// setters.
15930 ///
15931 /// Please note that this method must not be used to set any of the known parameters
15932 /// which have their own setter method. If done anyway, the request will fail.
15933 ///
15934 /// # Additional Parameters
15935 ///
15936 /// * *$.xgafv* (query-string) - V1 error format.
15937 /// * *access_token* (query-string) - OAuth access token.
15938 /// * *alt* (query-string) - Data format for response.
15939 /// * *callback* (query-string) - JSONP
15940 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15941 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15942 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15943 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15944 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15945 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15946 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15947 pub fn param<T>(mut self, name: T, value: T) -> ManagedconfigurationsfordeviceDeleteCall<'a, C>
15948 where
15949 T: AsRef<str>,
15950 {
15951 self._additional_params
15952 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15953 self
15954 }
15955
15956 /// Identifies the authorization scope for the method you are building.
15957 ///
15958 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15959 /// [`Scope::Full`].
15960 ///
15961 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15962 /// tokens for more than one scope.
15963 ///
15964 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15965 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15966 /// sufficient, a read-write scope will do as well.
15967 pub fn add_scope<St>(mut self, scope: St) -> ManagedconfigurationsfordeviceDeleteCall<'a, C>
15968 where
15969 St: AsRef<str>,
15970 {
15971 self._scopes.insert(String::from(scope.as_ref()));
15972 self
15973 }
15974 /// Identifies the authorization scope(s) for the method you are building.
15975 ///
15976 /// See [`Self::add_scope()`] for details.
15977 pub fn add_scopes<I, St>(mut self, scopes: I) -> ManagedconfigurationsfordeviceDeleteCall<'a, C>
15978 where
15979 I: IntoIterator<Item = St>,
15980 St: AsRef<str>,
15981 {
15982 self._scopes
15983 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15984 self
15985 }
15986
15987 /// Removes all scopes, and no default scope will be used either.
15988 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15989 /// for details).
15990 pub fn clear_scopes(mut self) -> ManagedconfigurationsfordeviceDeleteCall<'a, C> {
15991 self._scopes.clear();
15992 self
15993 }
15994}
15995
15996/// Retrieves details of a per-device managed configuration.
15997///
15998/// A builder for the *get* method supported by a *managedconfigurationsfordevice* resource.
15999/// It is not used directly, but through a [`ManagedconfigurationsfordeviceMethods`] instance.
16000///
16001/// # Example
16002///
16003/// Instantiate a resource method builder
16004///
16005/// ```test_harness,no_run
16006/// # extern crate hyper;
16007/// # extern crate hyper_rustls;
16008/// # extern crate google_androidenterprise1 as androidenterprise1;
16009/// # async fn dox() {
16010/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16011///
16012/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16013/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16014/// # .with_native_roots()
16015/// # .unwrap()
16016/// # .https_only()
16017/// # .enable_http2()
16018/// # .build();
16019///
16020/// # let executor = hyper_util::rt::TokioExecutor::new();
16021/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16022/// # secret,
16023/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16024/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16025/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16026/// # ),
16027/// # ).build().await.unwrap();
16028///
16029/// # let client = hyper_util::client::legacy::Client::builder(
16030/// # hyper_util::rt::TokioExecutor::new()
16031/// # )
16032/// # .build(
16033/// # hyper_rustls::HttpsConnectorBuilder::new()
16034/// # .with_native_roots()
16035/// # .unwrap()
16036/// # .https_or_http()
16037/// # .enable_http2()
16038/// # .build()
16039/// # );
16040/// # let mut hub = AndroidEnterprise::new(client, auth);
16041/// // You can configure optional parameters by calling the respective setters at will, and
16042/// // execute the final call using `doit()`.
16043/// // Values shown here are possibly random and not representative !
16044/// let result = hub.managedconfigurationsfordevice().get("enterpriseId", "userId", "deviceId", "managedConfigurationForDeviceId")
16045/// .doit().await;
16046/// # }
16047/// ```
16048pub struct ManagedconfigurationsfordeviceGetCall<'a, C>
16049where
16050 C: 'a,
16051{
16052 hub: &'a AndroidEnterprise<C>,
16053 _enterprise_id: String,
16054 _user_id: String,
16055 _device_id: String,
16056 _managed_configuration_for_device_id: String,
16057 _delegate: Option<&'a mut dyn common::Delegate>,
16058 _additional_params: HashMap<String, String>,
16059 _scopes: BTreeSet<String>,
16060}
16061
16062impl<'a, C> common::CallBuilder for ManagedconfigurationsfordeviceGetCall<'a, C> {}
16063
16064impl<'a, C> ManagedconfigurationsfordeviceGetCall<'a, C>
16065where
16066 C: common::Connector,
16067{
16068 /// Perform the operation you have build so far.
16069 pub async fn doit(mut self) -> common::Result<(common::Response, ManagedConfiguration)> {
16070 use std::borrow::Cow;
16071 use std::io::{Read, Seek};
16072
16073 use common::{url::Params, ToParts};
16074 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16075
16076 let mut dd = common::DefaultDelegate;
16077 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16078 dlg.begin(common::MethodInfo {
16079 id: "androidenterprise.managedconfigurationsfordevice.get",
16080 http_method: hyper::Method::GET,
16081 });
16082
16083 for &field in [
16084 "alt",
16085 "enterpriseId",
16086 "userId",
16087 "deviceId",
16088 "managedConfigurationForDeviceId",
16089 ]
16090 .iter()
16091 {
16092 if self._additional_params.contains_key(field) {
16093 dlg.finished(false);
16094 return Err(common::Error::FieldClash(field));
16095 }
16096 }
16097
16098 let mut params = Params::with_capacity(6 + self._additional_params.len());
16099 params.push("enterpriseId", self._enterprise_id);
16100 params.push("userId", self._user_id);
16101 params.push("deviceId", self._device_id);
16102 params.push(
16103 "managedConfigurationForDeviceId",
16104 self._managed_configuration_for_device_id,
16105 );
16106
16107 params.extend(self._additional_params.iter());
16108
16109 params.push("alt", "json");
16110 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/managedConfigurationsForDevice/{managedConfigurationForDeviceId}";
16111 if self._scopes.is_empty() {
16112 self._scopes.insert(Scope::Full.as_ref().to_string());
16113 }
16114
16115 #[allow(clippy::single_element_loop)]
16116 for &(find_this, param_name) in [
16117 ("{enterpriseId}", "enterpriseId"),
16118 ("{userId}", "userId"),
16119 ("{deviceId}", "deviceId"),
16120 (
16121 "{managedConfigurationForDeviceId}",
16122 "managedConfigurationForDeviceId",
16123 ),
16124 ]
16125 .iter()
16126 {
16127 url = params.uri_replacement(url, param_name, find_this, false);
16128 }
16129 {
16130 let to_remove = [
16131 "managedConfigurationForDeviceId",
16132 "deviceId",
16133 "userId",
16134 "enterpriseId",
16135 ];
16136 params.remove_params(&to_remove);
16137 }
16138
16139 let url = params.parse_with_url(&url);
16140
16141 loop {
16142 let token = match self
16143 .hub
16144 .auth
16145 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16146 .await
16147 {
16148 Ok(token) => token,
16149 Err(e) => match dlg.token(e) {
16150 Ok(token) => token,
16151 Err(e) => {
16152 dlg.finished(false);
16153 return Err(common::Error::MissingToken(e));
16154 }
16155 },
16156 };
16157 let mut req_result = {
16158 let client = &self.hub.client;
16159 dlg.pre_request();
16160 let mut req_builder = hyper::Request::builder()
16161 .method(hyper::Method::GET)
16162 .uri(url.as_str())
16163 .header(USER_AGENT, self.hub._user_agent.clone());
16164
16165 if let Some(token) = token.as_ref() {
16166 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16167 }
16168
16169 let request = req_builder
16170 .header(CONTENT_LENGTH, 0_u64)
16171 .body(common::to_body::<String>(None));
16172
16173 client.request(request.unwrap()).await
16174 };
16175
16176 match req_result {
16177 Err(err) => {
16178 if let common::Retry::After(d) = dlg.http_error(&err) {
16179 sleep(d).await;
16180 continue;
16181 }
16182 dlg.finished(false);
16183 return Err(common::Error::HttpError(err));
16184 }
16185 Ok(res) => {
16186 let (mut parts, body) = res.into_parts();
16187 let mut body = common::Body::new(body);
16188 if !parts.status.is_success() {
16189 let bytes = common::to_bytes(body).await.unwrap_or_default();
16190 let error = serde_json::from_str(&common::to_string(&bytes));
16191 let response = common::to_response(parts, bytes.into());
16192
16193 if let common::Retry::After(d) =
16194 dlg.http_failure(&response, error.as_ref().ok())
16195 {
16196 sleep(d).await;
16197 continue;
16198 }
16199
16200 dlg.finished(false);
16201
16202 return Err(match error {
16203 Ok(value) => common::Error::BadRequest(value),
16204 _ => common::Error::Failure(response),
16205 });
16206 }
16207 let response = {
16208 let bytes = common::to_bytes(body).await.unwrap_or_default();
16209 let encoded = common::to_string(&bytes);
16210 match serde_json::from_str(&encoded) {
16211 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16212 Err(error) => {
16213 dlg.response_json_decode_error(&encoded, &error);
16214 return Err(common::Error::JsonDecodeError(
16215 encoded.to_string(),
16216 error,
16217 ));
16218 }
16219 }
16220 };
16221
16222 dlg.finished(true);
16223 return Ok(response);
16224 }
16225 }
16226 }
16227 }
16228
16229 /// The ID of the enterprise.
16230 ///
16231 /// Sets the *enterprise id* path property to the given value.
16232 ///
16233 /// Even though the property as already been set when instantiating this call,
16234 /// we provide this method for API completeness.
16235 pub fn enterprise_id(
16236 mut self,
16237 new_value: &str,
16238 ) -> ManagedconfigurationsfordeviceGetCall<'a, C> {
16239 self._enterprise_id = new_value.to_string();
16240 self
16241 }
16242 /// The ID of the user.
16243 ///
16244 /// Sets the *user id* path property to the given value.
16245 ///
16246 /// Even though the property as already been set when instantiating this call,
16247 /// we provide this method for API completeness.
16248 pub fn user_id(mut self, new_value: &str) -> ManagedconfigurationsfordeviceGetCall<'a, C> {
16249 self._user_id = new_value.to_string();
16250 self
16251 }
16252 /// The Android ID of the device.
16253 ///
16254 /// Sets the *device id* path property to the given value.
16255 ///
16256 /// Even though the property as already been set when instantiating this call,
16257 /// we provide this method for API completeness.
16258 pub fn device_id(mut self, new_value: &str) -> ManagedconfigurationsfordeviceGetCall<'a, C> {
16259 self._device_id = new_value.to_string();
16260 self
16261 }
16262 /// The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
16263 ///
16264 /// Sets the *managed configuration for device id* path property to the given value.
16265 ///
16266 /// Even though the property as already been set when instantiating this call,
16267 /// we provide this method for API completeness.
16268 pub fn managed_configuration_for_device_id(
16269 mut self,
16270 new_value: &str,
16271 ) -> ManagedconfigurationsfordeviceGetCall<'a, C> {
16272 self._managed_configuration_for_device_id = new_value.to_string();
16273 self
16274 }
16275 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16276 /// while executing the actual API request.
16277 ///
16278 /// ````text
16279 /// It should be used to handle progress information, and to implement a certain level of resilience.
16280 /// ````
16281 ///
16282 /// Sets the *delegate* property to the given value.
16283 pub fn delegate(
16284 mut self,
16285 new_value: &'a mut dyn common::Delegate,
16286 ) -> ManagedconfigurationsfordeviceGetCall<'a, C> {
16287 self._delegate = Some(new_value);
16288 self
16289 }
16290
16291 /// Set any additional parameter of the query string used in the request.
16292 /// It should be used to set parameters which are not yet available through their own
16293 /// setters.
16294 ///
16295 /// Please note that this method must not be used to set any of the known parameters
16296 /// which have their own setter method. If done anyway, the request will fail.
16297 ///
16298 /// # Additional Parameters
16299 ///
16300 /// * *$.xgafv* (query-string) - V1 error format.
16301 /// * *access_token* (query-string) - OAuth access token.
16302 /// * *alt* (query-string) - Data format for response.
16303 /// * *callback* (query-string) - JSONP
16304 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16305 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16306 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16307 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16308 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16309 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16310 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16311 pub fn param<T>(mut self, name: T, value: T) -> ManagedconfigurationsfordeviceGetCall<'a, C>
16312 where
16313 T: AsRef<str>,
16314 {
16315 self._additional_params
16316 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16317 self
16318 }
16319
16320 /// Identifies the authorization scope for the method you are building.
16321 ///
16322 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16323 /// [`Scope::Full`].
16324 ///
16325 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16326 /// tokens for more than one scope.
16327 ///
16328 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16329 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16330 /// sufficient, a read-write scope will do as well.
16331 pub fn add_scope<St>(mut self, scope: St) -> ManagedconfigurationsfordeviceGetCall<'a, C>
16332 where
16333 St: AsRef<str>,
16334 {
16335 self._scopes.insert(String::from(scope.as_ref()));
16336 self
16337 }
16338 /// Identifies the authorization scope(s) for the method you are building.
16339 ///
16340 /// See [`Self::add_scope()`] for details.
16341 pub fn add_scopes<I, St>(mut self, scopes: I) -> ManagedconfigurationsfordeviceGetCall<'a, C>
16342 where
16343 I: IntoIterator<Item = St>,
16344 St: AsRef<str>,
16345 {
16346 self._scopes
16347 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16348 self
16349 }
16350
16351 /// Removes all scopes, and no default scope will be used either.
16352 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16353 /// for details).
16354 pub fn clear_scopes(mut self) -> ManagedconfigurationsfordeviceGetCall<'a, C> {
16355 self._scopes.clear();
16356 self
16357 }
16358}
16359
16360/// Lists all the per-device managed configurations for the specified device. Only the ID is set.
16361///
16362/// A builder for the *list* method supported by a *managedconfigurationsfordevice* resource.
16363/// It is not used directly, but through a [`ManagedconfigurationsfordeviceMethods`] instance.
16364///
16365/// # Example
16366///
16367/// Instantiate a resource method builder
16368///
16369/// ```test_harness,no_run
16370/// # extern crate hyper;
16371/// # extern crate hyper_rustls;
16372/// # extern crate google_androidenterprise1 as androidenterprise1;
16373/// # async fn dox() {
16374/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16375///
16376/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16377/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16378/// # .with_native_roots()
16379/// # .unwrap()
16380/// # .https_only()
16381/// # .enable_http2()
16382/// # .build();
16383///
16384/// # let executor = hyper_util::rt::TokioExecutor::new();
16385/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16386/// # secret,
16387/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16388/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16389/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16390/// # ),
16391/// # ).build().await.unwrap();
16392///
16393/// # let client = hyper_util::client::legacy::Client::builder(
16394/// # hyper_util::rt::TokioExecutor::new()
16395/// # )
16396/// # .build(
16397/// # hyper_rustls::HttpsConnectorBuilder::new()
16398/// # .with_native_roots()
16399/// # .unwrap()
16400/// # .https_or_http()
16401/// # .enable_http2()
16402/// # .build()
16403/// # );
16404/// # let mut hub = AndroidEnterprise::new(client, auth);
16405/// // You can configure optional parameters by calling the respective setters at will, and
16406/// // execute the final call using `doit()`.
16407/// // Values shown here are possibly random and not representative !
16408/// let result = hub.managedconfigurationsfordevice().list("enterpriseId", "userId", "deviceId")
16409/// .doit().await;
16410/// # }
16411/// ```
16412pub struct ManagedconfigurationsfordeviceListCall<'a, C>
16413where
16414 C: 'a,
16415{
16416 hub: &'a AndroidEnterprise<C>,
16417 _enterprise_id: String,
16418 _user_id: String,
16419 _device_id: String,
16420 _delegate: Option<&'a mut dyn common::Delegate>,
16421 _additional_params: HashMap<String, String>,
16422 _scopes: BTreeSet<String>,
16423}
16424
16425impl<'a, C> common::CallBuilder for ManagedconfigurationsfordeviceListCall<'a, C> {}
16426
16427impl<'a, C> ManagedconfigurationsfordeviceListCall<'a, C>
16428where
16429 C: common::Connector,
16430{
16431 /// Perform the operation you have build so far.
16432 pub async fn doit(
16433 mut self,
16434 ) -> common::Result<(common::Response, ManagedConfigurationsForDeviceListResponse)> {
16435 use std::borrow::Cow;
16436 use std::io::{Read, Seek};
16437
16438 use common::{url::Params, ToParts};
16439 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16440
16441 let mut dd = common::DefaultDelegate;
16442 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16443 dlg.begin(common::MethodInfo {
16444 id: "androidenterprise.managedconfigurationsfordevice.list",
16445 http_method: hyper::Method::GET,
16446 });
16447
16448 for &field in ["alt", "enterpriseId", "userId", "deviceId"].iter() {
16449 if self._additional_params.contains_key(field) {
16450 dlg.finished(false);
16451 return Err(common::Error::FieldClash(field));
16452 }
16453 }
16454
16455 let mut params = Params::with_capacity(5 + self._additional_params.len());
16456 params.push("enterpriseId", self._enterprise_id);
16457 params.push("userId", self._user_id);
16458 params.push("deviceId", self._device_id);
16459
16460 params.extend(self._additional_params.iter());
16461
16462 params.push("alt", "json");
16463 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/managedConfigurationsForDevice";
16464 if self._scopes.is_empty() {
16465 self._scopes.insert(Scope::Full.as_ref().to_string());
16466 }
16467
16468 #[allow(clippy::single_element_loop)]
16469 for &(find_this, param_name) in [
16470 ("{enterpriseId}", "enterpriseId"),
16471 ("{userId}", "userId"),
16472 ("{deviceId}", "deviceId"),
16473 ]
16474 .iter()
16475 {
16476 url = params.uri_replacement(url, param_name, find_this, false);
16477 }
16478 {
16479 let to_remove = ["deviceId", "userId", "enterpriseId"];
16480 params.remove_params(&to_remove);
16481 }
16482
16483 let url = params.parse_with_url(&url);
16484
16485 loop {
16486 let token = match self
16487 .hub
16488 .auth
16489 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16490 .await
16491 {
16492 Ok(token) => token,
16493 Err(e) => match dlg.token(e) {
16494 Ok(token) => token,
16495 Err(e) => {
16496 dlg.finished(false);
16497 return Err(common::Error::MissingToken(e));
16498 }
16499 },
16500 };
16501 let mut req_result = {
16502 let client = &self.hub.client;
16503 dlg.pre_request();
16504 let mut req_builder = hyper::Request::builder()
16505 .method(hyper::Method::GET)
16506 .uri(url.as_str())
16507 .header(USER_AGENT, self.hub._user_agent.clone());
16508
16509 if let Some(token) = token.as_ref() {
16510 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16511 }
16512
16513 let request = req_builder
16514 .header(CONTENT_LENGTH, 0_u64)
16515 .body(common::to_body::<String>(None));
16516
16517 client.request(request.unwrap()).await
16518 };
16519
16520 match req_result {
16521 Err(err) => {
16522 if let common::Retry::After(d) = dlg.http_error(&err) {
16523 sleep(d).await;
16524 continue;
16525 }
16526 dlg.finished(false);
16527 return Err(common::Error::HttpError(err));
16528 }
16529 Ok(res) => {
16530 let (mut parts, body) = res.into_parts();
16531 let mut body = common::Body::new(body);
16532 if !parts.status.is_success() {
16533 let bytes = common::to_bytes(body).await.unwrap_or_default();
16534 let error = serde_json::from_str(&common::to_string(&bytes));
16535 let response = common::to_response(parts, bytes.into());
16536
16537 if let common::Retry::After(d) =
16538 dlg.http_failure(&response, error.as_ref().ok())
16539 {
16540 sleep(d).await;
16541 continue;
16542 }
16543
16544 dlg.finished(false);
16545
16546 return Err(match error {
16547 Ok(value) => common::Error::BadRequest(value),
16548 _ => common::Error::Failure(response),
16549 });
16550 }
16551 let response = {
16552 let bytes = common::to_bytes(body).await.unwrap_or_default();
16553 let encoded = common::to_string(&bytes);
16554 match serde_json::from_str(&encoded) {
16555 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16556 Err(error) => {
16557 dlg.response_json_decode_error(&encoded, &error);
16558 return Err(common::Error::JsonDecodeError(
16559 encoded.to_string(),
16560 error,
16561 ));
16562 }
16563 }
16564 };
16565
16566 dlg.finished(true);
16567 return Ok(response);
16568 }
16569 }
16570 }
16571 }
16572
16573 /// The ID of the enterprise.
16574 ///
16575 /// Sets the *enterprise id* path property to the given value.
16576 ///
16577 /// Even though the property as already been set when instantiating this call,
16578 /// we provide this method for API completeness.
16579 pub fn enterprise_id(
16580 mut self,
16581 new_value: &str,
16582 ) -> ManagedconfigurationsfordeviceListCall<'a, C> {
16583 self._enterprise_id = new_value.to_string();
16584 self
16585 }
16586 /// The ID of the user.
16587 ///
16588 /// Sets the *user id* path property to the given value.
16589 ///
16590 /// Even though the property as already been set when instantiating this call,
16591 /// we provide this method for API completeness.
16592 pub fn user_id(mut self, new_value: &str) -> ManagedconfigurationsfordeviceListCall<'a, C> {
16593 self._user_id = new_value.to_string();
16594 self
16595 }
16596 /// The Android ID of the device.
16597 ///
16598 /// Sets the *device id* path property to the given value.
16599 ///
16600 /// Even though the property as already been set when instantiating this call,
16601 /// we provide this method for API completeness.
16602 pub fn device_id(mut self, new_value: &str) -> ManagedconfigurationsfordeviceListCall<'a, C> {
16603 self._device_id = new_value.to_string();
16604 self
16605 }
16606 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16607 /// while executing the actual API request.
16608 ///
16609 /// ````text
16610 /// It should be used to handle progress information, and to implement a certain level of resilience.
16611 /// ````
16612 ///
16613 /// Sets the *delegate* property to the given value.
16614 pub fn delegate(
16615 mut self,
16616 new_value: &'a mut dyn common::Delegate,
16617 ) -> ManagedconfigurationsfordeviceListCall<'a, C> {
16618 self._delegate = Some(new_value);
16619 self
16620 }
16621
16622 /// Set any additional parameter of the query string used in the request.
16623 /// It should be used to set parameters which are not yet available through their own
16624 /// setters.
16625 ///
16626 /// Please note that this method must not be used to set any of the known parameters
16627 /// which have their own setter method. If done anyway, the request will fail.
16628 ///
16629 /// # Additional Parameters
16630 ///
16631 /// * *$.xgafv* (query-string) - V1 error format.
16632 /// * *access_token* (query-string) - OAuth access token.
16633 /// * *alt* (query-string) - Data format for response.
16634 /// * *callback* (query-string) - JSONP
16635 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16636 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16637 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16638 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16639 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16640 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16641 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16642 pub fn param<T>(mut self, name: T, value: T) -> ManagedconfigurationsfordeviceListCall<'a, C>
16643 where
16644 T: AsRef<str>,
16645 {
16646 self._additional_params
16647 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16648 self
16649 }
16650
16651 /// Identifies the authorization scope for the method you are building.
16652 ///
16653 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16654 /// [`Scope::Full`].
16655 ///
16656 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16657 /// tokens for more than one scope.
16658 ///
16659 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16660 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16661 /// sufficient, a read-write scope will do as well.
16662 pub fn add_scope<St>(mut self, scope: St) -> ManagedconfigurationsfordeviceListCall<'a, C>
16663 where
16664 St: AsRef<str>,
16665 {
16666 self._scopes.insert(String::from(scope.as_ref()));
16667 self
16668 }
16669 /// Identifies the authorization scope(s) for the method you are building.
16670 ///
16671 /// See [`Self::add_scope()`] for details.
16672 pub fn add_scopes<I, St>(mut self, scopes: I) -> ManagedconfigurationsfordeviceListCall<'a, C>
16673 where
16674 I: IntoIterator<Item = St>,
16675 St: AsRef<str>,
16676 {
16677 self._scopes
16678 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16679 self
16680 }
16681
16682 /// Removes all scopes, and no default scope will be used either.
16683 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16684 /// for details).
16685 pub fn clear_scopes(mut self) -> ManagedconfigurationsfordeviceListCall<'a, C> {
16686 self._scopes.clear();
16687 self
16688 }
16689}
16690
16691/// Adds or updates a per-device managed configuration for an app for the specified device.
16692///
16693/// A builder for the *update* method supported by a *managedconfigurationsfordevice* resource.
16694/// It is not used directly, but through a [`ManagedconfigurationsfordeviceMethods`] instance.
16695///
16696/// # Example
16697///
16698/// Instantiate a resource method builder
16699///
16700/// ```test_harness,no_run
16701/// # extern crate hyper;
16702/// # extern crate hyper_rustls;
16703/// # extern crate google_androidenterprise1 as androidenterprise1;
16704/// use androidenterprise1::api::ManagedConfiguration;
16705/// # async fn dox() {
16706/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16707///
16708/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16709/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16710/// # .with_native_roots()
16711/// # .unwrap()
16712/// # .https_only()
16713/// # .enable_http2()
16714/// # .build();
16715///
16716/// # let executor = hyper_util::rt::TokioExecutor::new();
16717/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16718/// # secret,
16719/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16720/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16721/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16722/// # ),
16723/// # ).build().await.unwrap();
16724///
16725/// # let client = hyper_util::client::legacy::Client::builder(
16726/// # hyper_util::rt::TokioExecutor::new()
16727/// # )
16728/// # .build(
16729/// # hyper_rustls::HttpsConnectorBuilder::new()
16730/// # .with_native_roots()
16731/// # .unwrap()
16732/// # .https_or_http()
16733/// # .enable_http2()
16734/// # .build()
16735/// # );
16736/// # let mut hub = AndroidEnterprise::new(client, auth);
16737/// // As the method needs a request, you would usually fill it with the desired information
16738/// // into the respective structure. Some of the parts shown here might not be applicable !
16739/// // Values shown here are possibly random and not representative !
16740/// let mut req = ManagedConfiguration::default();
16741///
16742/// // You can configure optional parameters by calling the respective setters at will, and
16743/// // execute the final call using `doit()`.
16744/// // Values shown here are possibly random and not representative !
16745/// let result = hub.managedconfigurationsfordevice().update(req, "enterpriseId", "userId", "deviceId", "managedConfigurationForDeviceId")
16746/// .doit().await;
16747/// # }
16748/// ```
16749pub struct ManagedconfigurationsfordeviceUpdateCall<'a, C>
16750where
16751 C: 'a,
16752{
16753 hub: &'a AndroidEnterprise<C>,
16754 _request: ManagedConfiguration,
16755 _enterprise_id: String,
16756 _user_id: String,
16757 _device_id: String,
16758 _managed_configuration_for_device_id: String,
16759 _delegate: Option<&'a mut dyn common::Delegate>,
16760 _additional_params: HashMap<String, String>,
16761 _scopes: BTreeSet<String>,
16762}
16763
16764impl<'a, C> common::CallBuilder for ManagedconfigurationsfordeviceUpdateCall<'a, C> {}
16765
16766impl<'a, C> ManagedconfigurationsfordeviceUpdateCall<'a, C>
16767where
16768 C: common::Connector,
16769{
16770 /// Perform the operation you have build so far.
16771 pub async fn doit(mut self) -> common::Result<(common::Response, ManagedConfiguration)> {
16772 use std::borrow::Cow;
16773 use std::io::{Read, Seek};
16774
16775 use common::{url::Params, ToParts};
16776 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16777
16778 let mut dd = common::DefaultDelegate;
16779 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16780 dlg.begin(common::MethodInfo {
16781 id: "androidenterprise.managedconfigurationsfordevice.update",
16782 http_method: hyper::Method::PUT,
16783 });
16784
16785 for &field in [
16786 "alt",
16787 "enterpriseId",
16788 "userId",
16789 "deviceId",
16790 "managedConfigurationForDeviceId",
16791 ]
16792 .iter()
16793 {
16794 if self._additional_params.contains_key(field) {
16795 dlg.finished(false);
16796 return Err(common::Error::FieldClash(field));
16797 }
16798 }
16799
16800 let mut params = Params::with_capacity(7 + self._additional_params.len());
16801 params.push("enterpriseId", self._enterprise_id);
16802 params.push("userId", self._user_id);
16803 params.push("deviceId", self._device_id);
16804 params.push(
16805 "managedConfigurationForDeviceId",
16806 self._managed_configuration_for_device_id,
16807 );
16808
16809 params.extend(self._additional_params.iter());
16810
16811 params.push("alt", "json");
16812 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/devices/{deviceId}/managedConfigurationsForDevice/{managedConfigurationForDeviceId}";
16813 if self._scopes.is_empty() {
16814 self._scopes.insert(Scope::Full.as_ref().to_string());
16815 }
16816
16817 #[allow(clippy::single_element_loop)]
16818 for &(find_this, param_name) in [
16819 ("{enterpriseId}", "enterpriseId"),
16820 ("{userId}", "userId"),
16821 ("{deviceId}", "deviceId"),
16822 (
16823 "{managedConfigurationForDeviceId}",
16824 "managedConfigurationForDeviceId",
16825 ),
16826 ]
16827 .iter()
16828 {
16829 url = params.uri_replacement(url, param_name, find_this, false);
16830 }
16831 {
16832 let to_remove = [
16833 "managedConfigurationForDeviceId",
16834 "deviceId",
16835 "userId",
16836 "enterpriseId",
16837 ];
16838 params.remove_params(&to_remove);
16839 }
16840
16841 let url = params.parse_with_url(&url);
16842
16843 let mut json_mime_type = mime::APPLICATION_JSON;
16844 let mut request_value_reader = {
16845 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16846 common::remove_json_null_values(&mut value);
16847 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16848 serde_json::to_writer(&mut dst, &value).unwrap();
16849 dst
16850 };
16851 let request_size = request_value_reader
16852 .seek(std::io::SeekFrom::End(0))
16853 .unwrap();
16854 request_value_reader
16855 .seek(std::io::SeekFrom::Start(0))
16856 .unwrap();
16857
16858 loop {
16859 let token = match self
16860 .hub
16861 .auth
16862 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16863 .await
16864 {
16865 Ok(token) => token,
16866 Err(e) => match dlg.token(e) {
16867 Ok(token) => token,
16868 Err(e) => {
16869 dlg.finished(false);
16870 return Err(common::Error::MissingToken(e));
16871 }
16872 },
16873 };
16874 request_value_reader
16875 .seek(std::io::SeekFrom::Start(0))
16876 .unwrap();
16877 let mut req_result = {
16878 let client = &self.hub.client;
16879 dlg.pre_request();
16880 let mut req_builder = hyper::Request::builder()
16881 .method(hyper::Method::PUT)
16882 .uri(url.as_str())
16883 .header(USER_AGENT, self.hub._user_agent.clone());
16884
16885 if let Some(token) = token.as_ref() {
16886 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16887 }
16888
16889 let request = req_builder
16890 .header(CONTENT_TYPE, json_mime_type.to_string())
16891 .header(CONTENT_LENGTH, request_size as u64)
16892 .body(common::to_body(
16893 request_value_reader.get_ref().clone().into(),
16894 ));
16895
16896 client.request(request.unwrap()).await
16897 };
16898
16899 match req_result {
16900 Err(err) => {
16901 if let common::Retry::After(d) = dlg.http_error(&err) {
16902 sleep(d).await;
16903 continue;
16904 }
16905 dlg.finished(false);
16906 return Err(common::Error::HttpError(err));
16907 }
16908 Ok(res) => {
16909 let (mut parts, body) = res.into_parts();
16910 let mut body = common::Body::new(body);
16911 if !parts.status.is_success() {
16912 let bytes = common::to_bytes(body).await.unwrap_or_default();
16913 let error = serde_json::from_str(&common::to_string(&bytes));
16914 let response = common::to_response(parts, bytes.into());
16915
16916 if let common::Retry::After(d) =
16917 dlg.http_failure(&response, error.as_ref().ok())
16918 {
16919 sleep(d).await;
16920 continue;
16921 }
16922
16923 dlg.finished(false);
16924
16925 return Err(match error {
16926 Ok(value) => common::Error::BadRequest(value),
16927 _ => common::Error::Failure(response),
16928 });
16929 }
16930 let response = {
16931 let bytes = common::to_bytes(body).await.unwrap_or_default();
16932 let encoded = common::to_string(&bytes);
16933 match serde_json::from_str(&encoded) {
16934 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16935 Err(error) => {
16936 dlg.response_json_decode_error(&encoded, &error);
16937 return Err(common::Error::JsonDecodeError(
16938 encoded.to_string(),
16939 error,
16940 ));
16941 }
16942 }
16943 };
16944
16945 dlg.finished(true);
16946 return Ok(response);
16947 }
16948 }
16949 }
16950 }
16951
16952 ///
16953 /// Sets the *request* property to the given value.
16954 ///
16955 /// Even though the property as already been set when instantiating this call,
16956 /// we provide this method for API completeness.
16957 pub fn request(
16958 mut self,
16959 new_value: ManagedConfiguration,
16960 ) -> ManagedconfigurationsfordeviceUpdateCall<'a, C> {
16961 self._request = new_value;
16962 self
16963 }
16964 /// The ID of the enterprise.
16965 ///
16966 /// Sets the *enterprise id* path property to the given value.
16967 ///
16968 /// Even though the property as already been set when instantiating this call,
16969 /// we provide this method for API completeness.
16970 pub fn enterprise_id(
16971 mut self,
16972 new_value: &str,
16973 ) -> ManagedconfigurationsfordeviceUpdateCall<'a, C> {
16974 self._enterprise_id = new_value.to_string();
16975 self
16976 }
16977 /// The ID of the user.
16978 ///
16979 /// Sets the *user id* path property to the given value.
16980 ///
16981 /// Even though the property as already been set when instantiating this call,
16982 /// we provide this method for API completeness.
16983 pub fn user_id(mut self, new_value: &str) -> ManagedconfigurationsfordeviceUpdateCall<'a, C> {
16984 self._user_id = new_value.to_string();
16985 self
16986 }
16987 /// The Android ID of the device.
16988 ///
16989 /// Sets the *device id* path property to the given value.
16990 ///
16991 /// Even though the property as already been set when instantiating this call,
16992 /// we provide this method for API completeness.
16993 pub fn device_id(mut self, new_value: &str) -> ManagedconfigurationsfordeviceUpdateCall<'a, C> {
16994 self._device_id = new_value.to_string();
16995 self
16996 }
16997 /// The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
16998 ///
16999 /// Sets the *managed configuration for device id* path property to the given value.
17000 ///
17001 /// Even though the property as already been set when instantiating this call,
17002 /// we provide this method for API completeness.
17003 pub fn managed_configuration_for_device_id(
17004 mut self,
17005 new_value: &str,
17006 ) -> ManagedconfigurationsfordeviceUpdateCall<'a, C> {
17007 self._managed_configuration_for_device_id = new_value.to_string();
17008 self
17009 }
17010 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17011 /// while executing the actual API request.
17012 ///
17013 /// ````text
17014 /// It should be used to handle progress information, and to implement a certain level of resilience.
17015 /// ````
17016 ///
17017 /// Sets the *delegate* property to the given value.
17018 pub fn delegate(
17019 mut self,
17020 new_value: &'a mut dyn common::Delegate,
17021 ) -> ManagedconfigurationsfordeviceUpdateCall<'a, C> {
17022 self._delegate = Some(new_value);
17023 self
17024 }
17025
17026 /// Set any additional parameter of the query string used in the request.
17027 /// It should be used to set parameters which are not yet available through their own
17028 /// setters.
17029 ///
17030 /// Please note that this method must not be used to set any of the known parameters
17031 /// which have their own setter method. If done anyway, the request will fail.
17032 ///
17033 /// # Additional Parameters
17034 ///
17035 /// * *$.xgafv* (query-string) - V1 error format.
17036 /// * *access_token* (query-string) - OAuth access token.
17037 /// * *alt* (query-string) - Data format for response.
17038 /// * *callback* (query-string) - JSONP
17039 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17040 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17041 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17042 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17043 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17044 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17045 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17046 pub fn param<T>(mut self, name: T, value: T) -> ManagedconfigurationsfordeviceUpdateCall<'a, C>
17047 where
17048 T: AsRef<str>,
17049 {
17050 self._additional_params
17051 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17052 self
17053 }
17054
17055 /// Identifies the authorization scope for the method you are building.
17056 ///
17057 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17058 /// [`Scope::Full`].
17059 ///
17060 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17061 /// tokens for more than one scope.
17062 ///
17063 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17064 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17065 /// sufficient, a read-write scope will do as well.
17066 pub fn add_scope<St>(mut self, scope: St) -> ManagedconfigurationsfordeviceUpdateCall<'a, C>
17067 where
17068 St: AsRef<str>,
17069 {
17070 self._scopes.insert(String::from(scope.as_ref()));
17071 self
17072 }
17073 /// Identifies the authorization scope(s) for the method you are building.
17074 ///
17075 /// See [`Self::add_scope()`] for details.
17076 pub fn add_scopes<I, St>(mut self, scopes: I) -> ManagedconfigurationsfordeviceUpdateCall<'a, C>
17077 where
17078 I: IntoIterator<Item = St>,
17079 St: AsRef<str>,
17080 {
17081 self._scopes
17082 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17083 self
17084 }
17085
17086 /// Removes all scopes, and no default scope will be used either.
17087 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17088 /// for details).
17089 pub fn clear_scopes(mut self) -> ManagedconfigurationsfordeviceUpdateCall<'a, C> {
17090 self._scopes.clear();
17091 self
17092 }
17093}
17094
17095/// Removes a per-user managed configuration for an app for the specified user.
17096///
17097/// A builder for the *delete* method supported by a *managedconfigurationsforuser* resource.
17098/// It is not used directly, but through a [`ManagedconfigurationsforuserMethods`] instance.
17099///
17100/// # Example
17101///
17102/// Instantiate a resource method builder
17103///
17104/// ```test_harness,no_run
17105/// # extern crate hyper;
17106/// # extern crate hyper_rustls;
17107/// # extern crate google_androidenterprise1 as androidenterprise1;
17108/// # async fn dox() {
17109/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17110///
17111/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17112/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17113/// # .with_native_roots()
17114/// # .unwrap()
17115/// # .https_only()
17116/// # .enable_http2()
17117/// # .build();
17118///
17119/// # let executor = hyper_util::rt::TokioExecutor::new();
17120/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17121/// # secret,
17122/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17123/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17124/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17125/// # ),
17126/// # ).build().await.unwrap();
17127///
17128/// # let client = hyper_util::client::legacy::Client::builder(
17129/// # hyper_util::rt::TokioExecutor::new()
17130/// # )
17131/// # .build(
17132/// # hyper_rustls::HttpsConnectorBuilder::new()
17133/// # .with_native_roots()
17134/// # .unwrap()
17135/// # .https_or_http()
17136/// # .enable_http2()
17137/// # .build()
17138/// # );
17139/// # let mut hub = AndroidEnterprise::new(client, auth);
17140/// // You can configure optional parameters by calling the respective setters at will, and
17141/// // execute the final call using `doit()`.
17142/// // Values shown here are possibly random and not representative !
17143/// let result = hub.managedconfigurationsforuser().delete("enterpriseId", "userId", "managedConfigurationForUserId")
17144/// .doit().await;
17145/// # }
17146/// ```
17147pub struct ManagedconfigurationsforuserDeleteCall<'a, C>
17148where
17149 C: 'a,
17150{
17151 hub: &'a AndroidEnterprise<C>,
17152 _enterprise_id: String,
17153 _user_id: String,
17154 _managed_configuration_for_user_id: String,
17155 _delegate: Option<&'a mut dyn common::Delegate>,
17156 _additional_params: HashMap<String, String>,
17157 _scopes: BTreeSet<String>,
17158}
17159
17160impl<'a, C> common::CallBuilder for ManagedconfigurationsforuserDeleteCall<'a, C> {}
17161
17162impl<'a, C> ManagedconfigurationsforuserDeleteCall<'a, C>
17163where
17164 C: common::Connector,
17165{
17166 /// Perform the operation you have build so far.
17167 pub async fn doit(mut self) -> common::Result<common::Response> {
17168 use std::borrow::Cow;
17169 use std::io::{Read, Seek};
17170
17171 use common::{url::Params, ToParts};
17172 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17173
17174 let mut dd = common::DefaultDelegate;
17175 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17176 dlg.begin(common::MethodInfo {
17177 id: "androidenterprise.managedconfigurationsforuser.delete",
17178 http_method: hyper::Method::DELETE,
17179 });
17180
17181 for &field in ["enterpriseId", "userId", "managedConfigurationForUserId"].iter() {
17182 if self._additional_params.contains_key(field) {
17183 dlg.finished(false);
17184 return Err(common::Error::FieldClash(field));
17185 }
17186 }
17187
17188 let mut params = Params::with_capacity(4 + self._additional_params.len());
17189 params.push("enterpriseId", self._enterprise_id);
17190 params.push("userId", self._user_id);
17191 params.push(
17192 "managedConfigurationForUserId",
17193 self._managed_configuration_for_user_id,
17194 );
17195
17196 params.extend(self._additional_params.iter());
17197
17198 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/managedConfigurationsForUser/{managedConfigurationForUserId}";
17199 if self._scopes.is_empty() {
17200 self._scopes.insert(Scope::Full.as_ref().to_string());
17201 }
17202
17203 #[allow(clippy::single_element_loop)]
17204 for &(find_this, param_name) in [
17205 ("{enterpriseId}", "enterpriseId"),
17206 ("{userId}", "userId"),
17207 (
17208 "{managedConfigurationForUserId}",
17209 "managedConfigurationForUserId",
17210 ),
17211 ]
17212 .iter()
17213 {
17214 url = params.uri_replacement(url, param_name, find_this, false);
17215 }
17216 {
17217 let to_remove = ["managedConfigurationForUserId", "userId", "enterpriseId"];
17218 params.remove_params(&to_remove);
17219 }
17220
17221 let url = params.parse_with_url(&url);
17222
17223 loop {
17224 let token = match self
17225 .hub
17226 .auth
17227 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17228 .await
17229 {
17230 Ok(token) => token,
17231 Err(e) => match dlg.token(e) {
17232 Ok(token) => token,
17233 Err(e) => {
17234 dlg.finished(false);
17235 return Err(common::Error::MissingToken(e));
17236 }
17237 },
17238 };
17239 let mut req_result = {
17240 let client = &self.hub.client;
17241 dlg.pre_request();
17242 let mut req_builder = hyper::Request::builder()
17243 .method(hyper::Method::DELETE)
17244 .uri(url.as_str())
17245 .header(USER_AGENT, self.hub._user_agent.clone());
17246
17247 if let Some(token) = token.as_ref() {
17248 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17249 }
17250
17251 let request = req_builder
17252 .header(CONTENT_LENGTH, 0_u64)
17253 .body(common::to_body::<String>(None));
17254
17255 client.request(request.unwrap()).await
17256 };
17257
17258 match req_result {
17259 Err(err) => {
17260 if let common::Retry::After(d) = dlg.http_error(&err) {
17261 sleep(d).await;
17262 continue;
17263 }
17264 dlg.finished(false);
17265 return Err(common::Error::HttpError(err));
17266 }
17267 Ok(res) => {
17268 let (mut parts, body) = res.into_parts();
17269 let mut body = common::Body::new(body);
17270 if !parts.status.is_success() {
17271 let bytes = common::to_bytes(body).await.unwrap_or_default();
17272 let error = serde_json::from_str(&common::to_string(&bytes));
17273 let response = common::to_response(parts, bytes.into());
17274
17275 if let common::Retry::After(d) =
17276 dlg.http_failure(&response, error.as_ref().ok())
17277 {
17278 sleep(d).await;
17279 continue;
17280 }
17281
17282 dlg.finished(false);
17283
17284 return Err(match error {
17285 Ok(value) => common::Error::BadRequest(value),
17286 _ => common::Error::Failure(response),
17287 });
17288 }
17289 let response = common::Response::from_parts(parts, body);
17290
17291 dlg.finished(true);
17292 return Ok(response);
17293 }
17294 }
17295 }
17296 }
17297
17298 /// The ID of the enterprise.
17299 ///
17300 /// Sets the *enterprise id* path property to the given value.
17301 ///
17302 /// Even though the property as already been set when instantiating this call,
17303 /// we provide this method for API completeness.
17304 pub fn enterprise_id(
17305 mut self,
17306 new_value: &str,
17307 ) -> ManagedconfigurationsforuserDeleteCall<'a, C> {
17308 self._enterprise_id = new_value.to_string();
17309 self
17310 }
17311 /// The ID of the user.
17312 ///
17313 /// Sets the *user id* path property to the given value.
17314 ///
17315 /// Even though the property as already been set when instantiating this call,
17316 /// we provide this method for API completeness.
17317 pub fn user_id(mut self, new_value: &str) -> ManagedconfigurationsforuserDeleteCall<'a, C> {
17318 self._user_id = new_value.to_string();
17319 self
17320 }
17321 /// The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
17322 ///
17323 /// Sets the *managed configuration for user id* path property to the given value.
17324 ///
17325 /// Even though the property as already been set when instantiating this call,
17326 /// we provide this method for API completeness.
17327 pub fn managed_configuration_for_user_id(
17328 mut self,
17329 new_value: &str,
17330 ) -> ManagedconfigurationsforuserDeleteCall<'a, C> {
17331 self._managed_configuration_for_user_id = new_value.to_string();
17332 self
17333 }
17334 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17335 /// while executing the actual API request.
17336 ///
17337 /// ````text
17338 /// It should be used to handle progress information, and to implement a certain level of resilience.
17339 /// ````
17340 ///
17341 /// Sets the *delegate* property to the given value.
17342 pub fn delegate(
17343 mut self,
17344 new_value: &'a mut dyn common::Delegate,
17345 ) -> ManagedconfigurationsforuserDeleteCall<'a, C> {
17346 self._delegate = Some(new_value);
17347 self
17348 }
17349
17350 /// Set any additional parameter of the query string used in the request.
17351 /// It should be used to set parameters which are not yet available through their own
17352 /// setters.
17353 ///
17354 /// Please note that this method must not be used to set any of the known parameters
17355 /// which have their own setter method. If done anyway, the request will fail.
17356 ///
17357 /// # Additional Parameters
17358 ///
17359 /// * *$.xgafv* (query-string) - V1 error format.
17360 /// * *access_token* (query-string) - OAuth access token.
17361 /// * *alt* (query-string) - Data format for response.
17362 /// * *callback* (query-string) - JSONP
17363 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17364 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17365 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17366 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17367 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17368 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17369 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17370 pub fn param<T>(mut self, name: T, value: T) -> ManagedconfigurationsforuserDeleteCall<'a, C>
17371 where
17372 T: AsRef<str>,
17373 {
17374 self._additional_params
17375 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17376 self
17377 }
17378
17379 /// Identifies the authorization scope for the method you are building.
17380 ///
17381 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17382 /// [`Scope::Full`].
17383 ///
17384 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17385 /// tokens for more than one scope.
17386 ///
17387 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17388 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17389 /// sufficient, a read-write scope will do as well.
17390 pub fn add_scope<St>(mut self, scope: St) -> ManagedconfigurationsforuserDeleteCall<'a, C>
17391 where
17392 St: AsRef<str>,
17393 {
17394 self._scopes.insert(String::from(scope.as_ref()));
17395 self
17396 }
17397 /// Identifies the authorization scope(s) for the method you are building.
17398 ///
17399 /// See [`Self::add_scope()`] for details.
17400 pub fn add_scopes<I, St>(mut self, scopes: I) -> ManagedconfigurationsforuserDeleteCall<'a, C>
17401 where
17402 I: IntoIterator<Item = St>,
17403 St: AsRef<str>,
17404 {
17405 self._scopes
17406 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17407 self
17408 }
17409
17410 /// Removes all scopes, and no default scope will be used either.
17411 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17412 /// for details).
17413 pub fn clear_scopes(mut self) -> ManagedconfigurationsforuserDeleteCall<'a, C> {
17414 self._scopes.clear();
17415 self
17416 }
17417}
17418
17419/// Retrieves details of a per-user managed configuration for an app for the specified user.
17420///
17421/// A builder for the *get* method supported by a *managedconfigurationsforuser* resource.
17422/// It is not used directly, but through a [`ManagedconfigurationsforuserMethods`] instance.
17423///
17424/// # Example
17425///
17426/// Instantiate a resource method builder
17427///
17428/// ```test_harness,no_run
17429/// # extern crate hyper;
17430/// # extern crate hyper_rustls;
17431/// # extern crate google_androidenterprise1 as androidenterprise1;
17432/// # async fn dox() {
17433/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17434///
17435/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17436/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17437/// # .with_native_roots()
17438/// # .unwrap()
17439/// # .https_only()
17440/// # .enable_http2()
17441/// # .build();
17442///
17443/// # let executor = hyper_util::rt::TokioExecutor::new();
17444/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17445/// # secret,
17446/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17447/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17448/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17449/// # ),
17450/// # ).build().await.unwrap();
17451///
17452/// # let client = hyper_util::client::legacy::Client::builder(
17453/// # hyper_util::rt::TokioExecutor::new()
17454/// # )
17455/// # .build(
17456/// # hyper_rustls::HttpsConnectorBuilder::new()
17457/// # .with_native_roots()
17458/// # .unwrap()
17459/// # .https_or_http()
17460/// # .enable_http2()
17461/// # .build()
17462/// # );
17463/// # let mut hub = AndroidEnterprise::new(client, auth);
17464/// // You can configure optional parameters by calling the respective setters at will, and
17465/// // execute the final call using `doit()`.
17466/// // Values shown here are possibly random and not representative !
17467/// let result = hub.managedconfigurationsforuser().get("enterpriseId", "userId", "managedConfigurationForUserId")
17468/// .doit().await;
17469/// # }
17470/// ```
17471pub struct ManagedconfigurationsforuserGetCall<'a, C>
17472where
17473 C: 'a,
17474{
17475 hub: &'a AndroidEnterprise<C>,
17476 _enterprise_id: String,
17477 _user_id: String,
17478 _managed_configuration_for_user_id: String,
17479 _delegate: Option<&'a mut dyn common::Delegate>,
17480 _additional_params: HashMap<String, String>,
17481 _scopes: BTreeSet<String>,
17482}
17483
17484impl<'a, C> common::CallBuilder for ManagedconfigurationsforuserGetCall<'a, C> {}
17485
17486impl<'a, C> ManagedconfigurationsforuserGetCall<'a, C>
17487where
17488 C: common::Connector,
17489{
17490 /// Perform the operation you have build so far.
17491 pub async fn doit(mut self) -> common::Result<(common::Response, ManagedConfiguration)> {
17492 use std::borrow::Cow;
17493 use std::io::{Read, Seek};
17494
17495 use common::{url::Params, ToParts};
17496 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17497
17498 let mut dd = common::DefaultDelegate;
17499 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17500 dlg.begin(common::MethodInfo {
17501 id: "androidenterprise.managedconfigurationsforuser.get",
17502 http_method: hyper::Method::GET,
17503 });
17504
17505 for &field in [
17506 "alt",
17507 "enterpriseId",
17508 "userId",
17509 "managedConfigurationForUserId",
17510 ]
17511 .iter()
17512 {
17513 if self._additional_params.contains_key(field) {
17514 dlg.finished(false);
17515 return Err(common::Error::FieldClash(field));
17516 }
17517 }
17518
17519 let mut params = Params::with_capacity(5 + self._additional_params.len());
17520 params.push("enterpriseId", self._enterprise_id);
17521 params.push("userId", self._user_id);
17522 params.push(
17523 "managedConfigurationForUserId",
17524 self._managed_configuration_for_user_id,
17525 );
17526
17527 params.extend(self._additional_params.iter());
17528
17529 params.push("alt", "json");
17530 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/managedConfigurationsForUser/{managedConfigurationForUserId}";
17531 if self._scopes.is_empty() {
17532 self._scopes.insert(Scope::Full.as_ref().to_string());
17533 }
17534
17535 #[allow(clippy::single_element_loop)]
17536 for &(find_this, param_name) in [
17537 ("{enterpriseId}", "enterpriseId"),
17538 ("{userId}", "userId"),
17539 (
17540 "{managedConfigurationForUserId}",
17541 "managedConfigurationForUserId",
17542 ),
17543 ]
17544 .iter()
17545 {
17546 url = params.uri_replacement(url, param_name, find_this, false);
17547 }
17548 {
17549 let to_remove = ["managedConfigurationForUserId", "userId", "enterpriseId"];
17550 params.remove_params(&to_remove);
17551 }
17552
17553 let url = params.parse_with_url(&url);
17554
17555 loop {
17556 let token = match self
17557 .hub
17558 .auth
17559 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17560 .await
17561 {
17562 Ok(token) => token,
17563 Err(e) => match dlg.token(e) {
17564 Ok(token) => token,
17565 Err(e) => {
17566 dlg.finished(false);
17567 return Err(common::Error::MissingToken(e));
17568 }
17569 },
17570 };
17571 let mut req_result = {
17572 let client = &self.hub.client;
17573 dlg.pre_request();
17574 let mut req_builder = hyper::Request::builder()
17575 .method(hyper::Method::GET)
17576 .uri(url.as_str())
17577 .header(USER_AGENT, self.hub._user_agent.clone());
17578
17579 if let Some(token) = token.as_ref() {
17580 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17581 }
17582
17583 let request = req_builder
17584 .header(CONTENT_LENGTH, 0_u64)
17585 .body(common::to_body::<String>(None));
17586
17587 client.request(request.unwrap()).await
17588 };
17589
17590 match req_result {
17591 Err(err) => {
17592 if let common::Retry::After(d) = dlg.http_error(&err) {
17593 sleep(d).await;
17594 continue;
17595 }
17596 dlg.finished(false);
17597 return Err(common::Error::HttpError(err));
17598 }
17599 Ok(res) => {
17600 let (mut parts, body) = res.into_parts();
17601 let mut body = common::Body::new(body);
17602 if !parts.status.is_success() {
17603 let bytes = common::to_bytes(body).await.unwrap_or_default();
17604 let error = serde_json::from_str(&common::to_string(&bytes));
17605 let response = common::to_response(parts, bytes.into());
17606
17607 if let common::Retry::After(d) =
17608 dlg.http_failure(&response, error.as_ref().ok())
17609 {
17610 sleep(d).await;
17611 continue;
17612 }
17613
17614 dlg.finished(false);
17615
17616 return Err(match error {
17617 Ok(value) => common::Error::BadRequest(value),
17618 _ => common::Error::Failure(response),
17619 });
17620 }
17621 let response = {
17622 let bytes = common::to_bytes(body).await.unwrap_or_default();
17623 let encoded = common::to_string(&bytes);
17624 match serde_json::from_str(&encoded) {
17625 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17626 Err(error) => {
17627 dlg.response_json_decode_error(&encoded, &error);
17628 return Err(common::Error::JsonDecodeError(
17629 encoded.to_string(),
17630 error,
17631 ));
17632 }
17633 }
17634 };
17635
17636 dlg.finished(true);
17637 return Ok(response);
17638 }
17639 }
17640 }
17641 }
17642
17643 /// The ID of the enterprise.
17644 ///
17645 /// Sets the *enterprise id* path property to the given value.
17646 ///
17647 /// Even though the property as already been set when instantiating this call,
17648 /// we provide this method for API completeness.
17649 pub fn enterprise_id(mut self, new_value: &str) -> ManagedconfigurationsforuserGetCall<'a, C> {
17650 self._enterprise_id = new_value.to_string();
17651 self
17652 }
17653 /// The ID of the user.
17654 ///
17655 /// Sets the *user id* path property to the given value.
17656 ///
17657 /// Even though the property as already been set when instantiating this call,
17658 /// we provide this method for API completeness.
17659 pub fn user_id(mut self, new_value: &str) -> ManagedconfigurationsforuserGetCall<'a, C> {
17660 self._user_id = new_value.to_string();
17661 self
17662 }
17663 /// The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
17664 ///
17665 /// Sets the *managed configuration for user id* path property to the given value.
17666 ///
17667 /// Even though the property as already been set when instantiating this call,
17668 /// we provide this method for API completeness.
17669 pub fn managed_configuration_for_user_id(
17670 mut self,
17671 new_value: &str,
17672 ) -> ManagedconfigurationsforuserGetCall<'a, C> {
17673 self._managed_configuration_for_user_id = new_value.to_string();
17674 self
17675 }
17676 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17677 /// while executing the actual API request.
17678 ///
17679 /// ````text
17680 /// It should be used to handle progress information, and to implement a certain level of resilience.
17681 /// ````
17682 ///
17683 /// Sets the *delegate* property to the given value.
17684 pub fn delegate(
17685 mut self,
17686 new_value: &'a mut dyn common::Delegate,
17687 ) -> ManagedconfigurationsforuserGetCall<'a, C> {
17688 self._delegate = Some(new_value);
17689 self
17690 }
17691
17692 /// Set any additional parameter of the query string used in the request.
17693 /// It should be used to set parameters which are not yet available through their own
17694 /// setters.
17695 ///
17696 /// Please note that this method must not be used to set any of the known parameters
17697 /// which have their own setter method. If done anyway, the request will fail.
17698 ///
17699 /// # Additional Parameters
17700 ///
17701 /// * *$.xgafv* (query-string) - V1 error format.
17702 /// * *access_token* (query-string) - OAuth access token.
17703 /// * *alt* (query-string) - Data format for response.
17704 /// * *callback* (query-string) - JSONP
17705 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17706 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17707 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17708 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17709 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17710 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17711 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17712 pub fn param<T>(mut self, name: T, value: T) -> ManagedconfigurationsforuserGetCall<'a, C>
17713 where
17714 T: AsRef<str>,
17715 {
17716 self._additional_params
17717 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17718 self
17719 }
17720
17721 /// Identifies the authorization scope for the method you are building.
17722 ///
17723 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17724 /// [`Scope::Full`].
17725 ///
17726 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17727 /// tokens for more than one scope.
17728 ///
17729 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17730 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17731 /// sufficient, a read-write scope will do as well.
17732 pub fn add_scope<St>(mut self, scope: St) -> ManagedconfigurationsforuserGetCall<'a, C>
17733 where
17734 St: AsRef<str>,
17735 {
17736 self._scopes.insert(String::from(scope.as_ref()));
17737 self
17738 }
17739 /// Identifies the authorization scope(s) for the method you are building.
17740 ///
17741 /// See [`Self::add_scope()`] for details.
17742 pub fn add_scopes<I, St>(mut self, scopes: I) -> ManagedconfigurationsforuserGetCall<'a, C>
17743 where
17744 I: IntoIterator<Item = St>,
17745 St: AsRef<str>,
17746 {
17747 self._scopes
17748 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17749 self
17750 }
17751
17752 /// Removes all scopes, and no default scope will be used either.
17753 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17754 /// for details).
17755 pub fn clear_scopes(mut self) -> ManagedconfigurationsforuserGetCall<'a, C> {
17756 self._scopes.clear();
17757 self
17758 }
17759}
17760
17761/// Lists all the per-user managed configurations for the specified user. Only the ID is set.
17762///
17763/// A builder for the *list* method supported by a *managedconfigurationsforuser* resource.
17764/// It is not used directly, but through a [`ManagedconfigurationsforuserMethods`] instance.
17765///
17766/// # Example
17767///
17768/// Instantiate a resource method builder
17769///
17770/// ```test_harness,no_run
17771/// # extern crate hyper;
17772/// # extern crate hyper_rustls;
17773/// # extern crate google_androidenterprise1 as androidenterprise1;
17774/// # async fn dox() {
17775/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17776///
17777/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17778/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17779/// # .with_native_roots()
17780/// # .unwrap()
17781/// # .https_only()
17782/// # .enable_http2()
17783/// # .build();
17784///
17785/// # let executor = hyper_util::rt::TokioExecutor::new();
17786/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17787/// # secret,
17788/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17789/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17790/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17791/// # ),
17792/// # ).build().await.unwrap();
17793///
17794/// # let client = hyper_util::client::legacy::Client::builder(
17795/// # hyper_util::rt::TokioExecutor::new()
17796/// # )
17797/// # .build(
17798/// # hyper_rustls::HttpsConnectorBuilder::new()
17799/// # .with_native_roots()
17800/// # .unwrap()
17801/// # .https_or_http()
17802/// # .enable_http2()
17803/// # .build()
17804/// # );
17805/// # let mut hub = AndroidEnterprise::new(client, auth);
17806/// // You can configure optional parameters by calling the respective setters at will, and
17807/// // execute the final call using `doit()`.
17808/// // Values shown here are possibly random and not representative !
17809/// let result = hub.managedconfigurationsforuser().list("enterpriseId", "userId")
17810/// .doit().await;
17811/// # }
17812/// ```
17813pub struct ManagedconfigurationsforuserListCall<'a, C>
17814where
17815 C: 'a,
17816{
17817 hub: &'a AndroidEnterprise<C>,
17818 _enterprise_id: String,
17819 _user_id: String,
17820 _delegate: Option<&'a mut dyn common::Delegate>,
17821 _additional_params: HashMap<String, String>,
17822 _scopes: BTreeSet<String>,
17823}
17824
17825impl<'a, C> common::CallBuilder for ManagedconfigurationsforuserListCall<'a, C> {}
17826
17827impl<'a, C> ManagedconfigurationsforuserListCall<'a, C>
17828where
17829 C: common::Connector,
17830{
17831 /// Perform the operation you have build so far.
17832 pub async fn doit(
17833 mut self,
17834 ) -> common::Result<(common::Response, ManagedConfigurationsForUserListResponse)> {
17835 use std::borrow::Cow;
17836 use std::io::{Read, Seek};
17837
17838 use common::{url::Params, ToParts};
17839 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17840
17841 let mut dd = common::DefaultDelegate;
17842 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17843 dlg.begin(common::MethodInfo {
17844 id: "androidenterprise.managedconfigurationsforuser.list",
17845 http_method: hyper::Method::GET,
17846 });
17847
17848 for &field in ["alt", "enterpriseId", "userId"].iter() {
17849 if self._additional_params.contains_key(field) {
17850 dlg.finished(false);
17851 return Err(common::Error::FieldClash(field));
17852 }
17853 }
17854
17855 let mut params = Params::with_capacity(4 + self._additional_params.len());
17856 params.push("enterpriseId", self._enterprise_id);
17857 params.push("userId", self._user_id);
17858
17859 params.extend(self._additional_params.iter());
17860
17861 params.push("alt", "json");
17862 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/managedConfigurationsForUser";
17863 if self._scopes.is_empty() {
17864 self._scopes.insert(Scope::Full.as_ref().to_string());
17865 }
17866
17867 #[allow(clippy::single_element_loop)]
17868 for &(find_this, param_name) in
17869 [("{enterpriseId}", "enterpriseId"), ("{userId}", "userId")].iter()
17870 {
17871 url = params.uri_replacement(url, param_name, find_this, false);
17872 }
17873 {
17874 let to_remove = ["userId", "enterpriseId"];
17875 params.remove_params(&to_remove);
17876 }
17877
17878 let url = params.parse_with_url(&url);
17879
17880 loop {
17881 let token = match self
17882 .hub
17883 .auth
17884 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17885 .await
17886 {
17887 Ok(token) => token,
17888 Err(e) => match dlg.token(e) {
17889 Ok(token) => token,
17890 Err(e) => {
17891 dlg.finished(false);
17892 return Err(common::Error::MissingToken(e));
17893 }
17894 },
17895 };
17896 let mut req_result = {
17897 let client = &self.hub.client;
17898 dlg.pre_request();
17899 let mut req_builder = hyper::Request::builder()
17900 .method(hyper::Method::GET)
17901 .uri(url.as_str())
17902 .header(USER_AGENT, self.hub._user_agent.clone());
17903
17904 if let Some(token) = token.as_ref() {
17905 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17906 }
17907
17908 let request = req_builder
17909 .header(CONTENT_LENGTH, 0_u64)
17910 .body(common::to_body::<String>(None));
17911
17912 client.request(request.unwrap()).await
17913 };
17914
17915 match req_result {
17916 Err(err) => {
17917 if let common::Retry::After(d) = dlg.http_error(&err) {
17918 sleep(d).await;
17919 continue;
17920 }
17921 dlg.finished(false);
17922 return Err(common::Error::HttpError(err));
17923 }
17924 Ok(res) => {
17925 let (mut parts, body) = res.into_parts();
17926 let mut body = common::Body::new(body);
17927 if !parts.status.is_success() {
17928 let bytes = common::to_bytes(body).await.unwrap_or_default();
17929 let error = serde_json::from_str(&common::to_string(&bytes));
17930 let response = common::to_response(parts, bytes.into());
17931
17932 if let common::Retry::After(d) =
17933 dlg.http_failure(&response, error.as_ref().ok())
17934 {
17935 sleep(d).await;
17936 continue;
17937 }
17938
17939 dlg.finished(false);
17940
17941 return Err(match error {
17942 Ok(value) => common::Error::BadRequest(value),
17943 _ => common::Error::Failure(response),
17944 });
17945 }
17946 let response = {
17947 let bytes = common::to_bytes(body).await.unwrap_or_default();
17948 let encoded = common::to_string(&bytes);
17949 match serde_json::from_str(&encoded) {
17950 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17951 Err(error) => {
17952 dlg.response_json_decode_error(&encoded, &error);
17953 return Err(common::Error::JsonDecodeError(
17954 encoded.to_string(),
17955 error,
17956 ));
17957 }
17958 }
17959 };
17960
17961 dlg.finished(true);
17962 return Ok(response);
17963 }
17964 }
17965 }
17966 }
17967
17968 /// The ID of the enterprise.
17969 ///
17970 /// Sets the *enterprise id* path property to the given value.
17971 ///
17972 /// Even though the property as already been set when instantiating this call,
17973 /// we provide this method for API completeness.
17974 pub fn enterprise_id(mut self, new_value: &str) -> ManagedconfigurationsforuserListCall<'a, C> {
17975 self._enterprise_id = new_value.to_string();
17976 self
17977 }
17978 /// The ID of the user.
17979 ///
17980 /// Sets the *user id* path property to the given value.
17981 ///
17982 /// Even though the property as already been set when instantiating this call,
17983 /// we provide this method for API completeness.
17984 pub fn user_id(mut self, new_value: &str) -> ManagedconfigurationsforuserListCall<'a, C> {
17985 self._user_id = new_value.to_string();
17986 self
17987 }
17988 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17989 /// while executing the actual API request.
17990 ///
17991 /// ````text
17992 /// It should be used to handle progress information, and to implement a certain level of resilience.
17993 /// ````
17994 ///
17995 /// Sets the *delegate* property to the given value.
17996 pub fn delegate(
17997 mut self,
17998 new_value: &'a mut dyn common::Delegate,
17999 ) -> ManagedconfigurationsforuserListCall<'a, C> {
18000 self._delegate = Some(new_value);
18001 self
18002 }
18003
18004 /// Set any additional parameter of the query string used in the request.
18005 /// It should be used to set parameters which are not yet available through their own
18006 /// setters.
18007 ///
18008 /// Please note that this method must not be used to set any of the known parameters
18009 /// which have their own setter method. If done anyway, the request will fail.
18010 ///
18011 /// # Additional Parameters
18012 ///
18013 /// * *$.xgafv* (query-string) - V1 error format.
18014 /// * *access_token* (query-string) - OAuth access token.
18015 /// * *alt* (query-string) - Data format for response.
18016 /// * *callback* (query-string) - JSONP
18017 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18018 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18019 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18020 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18021 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18022 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18023 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18024 pub fn param<T>(mut self, name: T, value: T) -> ManagedconfigurationsforuserListCall<'a, C>
18025 where
18026 T: AsRef<str>,
18027 {
18028 self._additional_params
18029 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18030 self
18031 }
18032
18033 /// Identifies the authorization scope for the method you are building.
18034 ///
18035 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18036 /// [`Scope::Full`].
18037 ///
18038 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18039 /// tokens for more than one scope.
18040 ///
18041 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18042 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18043 /// sufficient, a read-write scope will do as well.
18044 pub fn add_scope<St>(mut self, scope: St) -> ManagedconfigurationsforuserListCall<'a, C>
18045 where
18046 St: AsRef<str>,
18047 {
18048 self._scopes.insert(String::from(scope.as_ref()));
18049 self
18050 }
18051 /// Identifies the authorization scope(s) for the method you are building.
18052 ///
18053 /// See [`Self::add_scope()`] for details.
18054 pub fn add_scopes<I, St>(mut self, scopes: I) -> ManagedconfigurationsforuserListCall<'a, C>
18055 where
18056 I: IntoIterator<Item = St>,
18057 St: AsRef<str>,
18058 {
18059 self._scopes
18060 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18061 self
18062 }
18063
18064 /// Removes all scopes, and no default scope will be used either.
18065 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18066 /// for details).
18067 pub fn clear_scopes(mut self) -> ManagedconfigurationsforuserListCall<'a, C> {
18068 self._scopes.clear();
18069 self
18070 }
18071}
18072
18073/// Adds or updates the managed configuration settings for an app for the specified user. If you support the Managed configurations iframe, you can apply managed configurations to a user by specifying an mcmId and its associated configuration variables (if any) in the request. Alternatively, all EMMs can apply managed configurations by passing a list of managed properties.
18074///
18075/// A builder for the *update* method supported by a *managedconfigurationsforuser* resource.
18076/// It is not used directly, but through a [`ManagedconfigurationsforuserMethods`] instance.
18077///
18078/// # Example
18079///
18080/// Instantiate a resource method builder
18081///
18082/// ```test_harness,no_run
18083/// # extern crate hyper;
18084/// # extern crate hyper_rustls;
18085/// # extern crate google_androidenterprise1 as androidenterprise1;
18086/// use androidenterprise1::api::ManagedConfiguration;
18087/// # async fn dox() {
18088/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18089///
18090/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18091/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18092/// # .with_native_roots()
18093/// # .unwrap()
18094/// # .https_only()
18095/// # .enable_http2()
18096/// # .build();
18097///
18098/// # let executor = hyper_util::rt::TokioExecutor::new();
18099/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18100/// # secret,
18101/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18102/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18103/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18104/// # ),
18105/// # ).build().await.unwrap();
18106///
18107/// # let client = hyper_util::client::legacy::Client::builder(
18108/// # hyper_util::rt::TokioExecutor::new()
18109/// # )
18110/// # .build(
18111/// # hyper_rustls::HttpsConnectorBuilder::new()
18112/// # .with_native_roots()
18113/// # .unwrap()
18114/// # .https_or_http()
18115/// # .enable_http2()
18116/// # .build()
18117/// # );
18118/// # let mut hub = AndroidEnterprise::new(client, auth);
18119/// // As the method needs a request, you would usually fill it with the desired information
18120/// // into the respective structure. Some of the parts shown here might not be applicable !
18121/// // Values shown here are possibly random and not representative !
18122/// let mut req = ManagedConfiguration::default();
18123///
18124/// // You can configure optional parameters by calling the respective setters at will, and
18125/// // execute the final call using `doit()`.
18126/// // Values shown here are possibly random and not representative !
18127/// let result = hub.managedconfigurationsforuser().update(req, "enterpriseId", "userId", "managedConfigurationForUserId")
18128/// .doit().await;
18129/// # }
18130/// ```
18131pub struct ManagedconfigurationsforuserUpdateCall<'a, C>
18132where
18133 C: 'a,
18134{
18135 hub: &'a AndroidEnterprise<C>,
18136 _request: ManagedConfiguration,
18137 _enterprise_id: String,
18138 _user_id: String,
18139 _managed_configuration_for_user_id: String,
18140 _delegate: Option<&'a mut dyn common::Delegate>,
18141 _additional_params: HashMap<String, String>,
18142 _scopes: BTreeSet<String>,
18143}
18144
18145impl<'a, C> common::CallBuilder for ManagedconfigurationsforuserUpdateCall<'a, C> {}
18146
18147impl<'a, C> ManagedconfigurationsforuserUpdateCall<'a, C>
18148where
18149 C: common::Connector,
18150{
18151 /// Perform the operation you have build so far.
18152 pub async fn doit(mut self) -> common::Result<(common::Response, ManagedConfiguration)> {
18153 use std::borrow::Cow;
18154 use std::io::{Read, Seek};
18155
18156 use common::{url::Params, ToParts};
18157 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18158
18159 let mut dd = common::DefaultDelegate;
18160 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18161 dlg.begin(common::MethodInfo {
18162 id: "androidenterprise.managedconfigurationsforuser.update",
18163 http_method: hyper::Method::PUT,
18164 });
18165
18166 for &field in [
18167 "alt",
18168 "enterpriseId",
18169 "userId",
18170 "managedConfigurationForUserId",
18171 ]
18172 .iter()
18173 {
18174 if self._additional_params.contains_key(field) {
18175 dlg.finished(false);
18176 return Err(common::Error::FieldClash(field));
18177 }
18178 }
18179
18180 let mut params = Params::with_capacity(6 + self._additional_params.len());
18181 params.push("enterpriseId", self._enterprise_id);
18182 params.push("userId", self._user_id);
18183 params.push(
18184 "managedConfigurationForUserId",
18185 self._managed_configuration_for_user_id,
18186 );
18187
18188 params.extend(self._additional_params.iter());
18189
18190 params.push("alt", "json");
18191 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/managedConfigurationsForUser/{managedConfigurationForUserId}";
18192 if self._scopes.is_empty() {
18193 self._scopes.insert(Scope::Full.as_ref().to_string());
18194 }
18195
18196 #[allow(clippy::single_element_loop)]
18197 for &(find_this, param_name) in [
18198 ("{enterpriseId}", "enterpriseId"),
18199 ("{userId}", "userId"),
18200 (
18201 "{managedConfigurationForUserId}",
18202 "managedConfigurationForUserId",
18203 ),
18204 ]
18205 .iter()
18206 {
18207 url = params.uri_replacement(url, param_name, find_this, false);
18208 }
18209 {
18210 let to_remove = ["managedConfigurationForUserId", "userId", "enterpriseId"];
18211 params.remove_params(&to_remove);
18212 }
18213
18214 let url = params.parse_with_url(&url);
18215
18216 let mut json_mime_type = mime::APPLICATION_JSON;
18217 let mut request_value_reader = {
18218 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18219 common::remove_json_null_values(&mut value);
18220 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18221 serde_json::to_writer(&mut dst, &value).unwrap();
18222 dst
18223 };
18224 let request_size = request_value_reader
18225 .seek(std::io::SeekFrom::End(0))
18226 .unwrap();
18227 request_value_reader
18228 .seek(std::io::SeekFrom::Start(0))
18229 .unwrap();
18230
18231 loop {
18232 let token = match self
18233 .hub
18234 .auth
18235 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18236 .await
18237 {
18238 Ok(token) => token,
18239 Err(e) => match dlg.token(e) {
18240 Ok(token) => token,
18241 Err(e) => {
18242 dlg.finished(false);
18243 return Err(common::Error::MissingToken(e));
18244 }
18245 },
18246 };
18247 request_value_reader
18248 .seek(std::io::SeekFrom::Start(0))
18249 .unwrap();
18250 let mut req_result = {
18251 let client = &self.hub.client;
18252 dlg.pre_request();
18253 let mut req_builder = hyper::Request::builder()
18254 .method(hyper::Method::PUT)
18255 .uri(url.as_str())
18256 .header(USER_AGENT, self.hub._user_agent.clone());
18257
18258 if let Some(token) = token.as_ref() {
18259 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18260 }
18261
18262 let request = req_builder
18263 .header(CONTENT_TYPE, json_mime_type.to_string())
18264 .header(CONTENT_LENGTH, request_size as u64)
18265 .body(common::to_body(
18266 request_value_reader.get_ref().clone().into(),
18267 ));
18268
18269 client.request(request.unwrap()).await
18270 };
18271
18272 match req_result {
18273 Err(err) => {
18274 if let common::Retry::After(d) = dlg.http_error(&err) {
18275 sleep(d).await;
18276 continue;
18277 }
18278 dlg.finished(false);
18279 return Err(common::Error::HttpError(err));
18280 }
18281 Ok(res) => {
18282 let (mut parts, body) = res.into_parts();
18283 let mut body = common::Body::new(body);
18284 if !parts.status.is_success() {
18285 let bytes = common::to_bytes(body).await.unwrap_or_default();
18286 let error = serde_json::from_str(&common::to_string(&bytes));
18287 let response = common::to_response(parts, bytes.into());
18288
18289 if let common::Retry::After(d) =
18290 dlg.http_failure(&response, error.as_ref().ok())
18291 {
18292 sleep(d).await;
18293 continue;
18294 }
18295
18296 dlg.finished(false);
18297
18298 return Err(match error {
18299 Ok(value) => common::Error::BadRequest(value),
18300 _ => common::Error::Failure(response),
18301 });
18302 }
18303 let response = {
18304 let bytes = common::to_bytes(body).await.unwrap_or_default();
18305 let encoded = common::to_string(&bytes);
18306 match serde_json::from_str(&encoded) {
18307 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18308 Err(error) => {
18309 dlg.response_json_decode_error(&encoded, &error);
18310 return Err(common::Error::JsonDecodeError(
18311 encoded.to_string(),
18312 error,
18313 ));
18314 }
18315 }
18316 };
18317
18318 dlg.finished(true);
18319 return Ok(response);
18320 }
18321 }
18322 }
18323 }
18324
18325 ///
18326 /// Sets the *request* property to the given value.
18327 ///
18328 /// Even though the property as already been set when instantiating this call,
18329 /// we provide this method for API completeness.
18330 pub fn request(
18331 mut self,
18332 new_value: ManagedConfiguration,
18333 ) -> ManagedconfigurationsforuserUpdateCall<'a, C> {
18334 self._request = new_value;
18335 self
18336 }
18337 /// The ID of the enterprise.
18338 ///
18339 /// Sets the *enterprise id* path property to the given value.
18340 ///
18341 /// Even though the property as already been set when instantiating this call,
18342 /// we provide this method for API completeness.
18343 pub fn enterprise_id(
18344 mut self,
18345 new_value: &str,
18346 ) -> ManagedconfigurationsforuserUpdateCall<'a, C> {
18347 self._enterprise_id = new_value.to_string();
18348 self
18349 }
18350 /// The ID of the user.
18351 ///
18352 /// Sets the *user id* path property to the given value.
18353 ///
18354 /// Even though the property as already been set when instantiating this call,
18355 /// we provide this method for API completeness.
18356 pub fn user_id(mut self, new_value: &str) -> ManagedconfigurationsforuserUpdateCall<'a, C> {
18357 self._user_id = new_value.to_string();
18358 self
18359 }
18360 /// The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".
18361 ///
18362 /// Sets the *managed configuration for user id* path property to the given value.
18363 ///
18364 /// Even though the property as already been set when instantiating this call,
18365 /// we provide this method for API completeness.
18366 pub fn managed_configuration_for_user_id(
18367 mut self,
18368 new_value: &str,
18369 ) -> ManagedconfigurationsforuserUpdateCall<'a, C> {
18370 self._managed_configuration_for_user_id = new_value.to_string();
18371 self
18372 }
18373 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18374 /// while executing the actual API request.
18375 ///
18376 /// ````text
18377 /// It should be used to handle progress information, and to implement a certain level of resilience.
18378 /// ````
18379 ///
18380 /// Sets the *delegate* property to the given value.
18381 pub fn delegate(
18382 mut self,
18383 new_value: &'a mut dyn common::Delegate,
18384 ) -> ManagedconfigurationsforuserUpdateCall<'a, C> {
18385 self._delegate = Some(new_value);
18386 self
18387 }
18388
18389 /// Set any additional parameter of the query string used in the request.
18390 /// It should be used to set parameters which are not yet available through their own
18391 /// setters.
18392 ///
18393 /// Please note that this method must not be used to set any of the known parameters
18394 /// which have their own setter method. If done anyway, the request will fail.
18395 ///
18396 /// # Additional Parameters
18397 ///
18398 /// * *$.xgafv* (query-string) - V1 error format.
18399 /// * *access_token* (query-string) - OAuth access token.
18400 /// * *alt* (query-string) - Data format for response.
18401 /// * *callback* (query-string) - JSONP
18402 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18403 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18404 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18405 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18406 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18407 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18408 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18409 pub fn param<T>(mut self, name: T, value: T) -> ManagedconfigurationsforuserUpdateCall<'a, C>
18410 where
18411 T: AsRef<str>,
18412 {
18413 self._additional_params
18414 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18415 self
18416 }
18417
18418 /// Identifies the authorization scope for the method you are building.
18419 ///
18420 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18421 /// [`Scope::Full`].
18422 ///
18423 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18424 /// tokens for more than one scope.
18425 ///
18426 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18427 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18428 /// sufficient, a read-write scope will do as well.
18429 pub fn add_scope<St>(mut self, scope: St) -> ManagedconfigurationsforuserUpdateCall<'a, C>
18430 where
18431 St: AsRef<str>,
18432 {
18433 self._scopes.insert(String::from(scope.as_ref()));
18434 self
18435 }
18436 /// Identifies the authorization scope(s) for the method you are building.
18437 ///
18438 /// See [`Self::add_scope()`] for details.
18439 pub fn add_scopes<I, St>(mut self, scopes: I) -> ManagedconfigurationsforuserUpdateCall<'a, C>
18440 where
18441 I: IntoIterator<Item = St>,
18442 St: AsRef<str>,
18443 {
18444 self._scopes
18445 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18446 self
18447 }
18448
18449 /// Removes all scopes, and no default scope will be used either.
18450 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18451 /// for details).
18452 pub fn clear_scopes(mut self) -> ManagedconfigurationsforuserUpdateCall<'a, C> {
18453 self._scopes.clear();
18454 self
18455 }
18456}
18457
18458/// Lists all the managed configurations settings for the specified app.
18459///
18460/// A builder for the *list* method supported by a *managedconfigurationssetting* resource.
18461/// It is not used directly, but through a [`ManagedconfigurationssettingMethods`] instance.
18462///
18463/// # Example
18464///
18465/// Instantiate a resource method builder
18466///
18467/// ```test_harness,no_run
18468/// # extern crate hyper;
18469/// # extern crate hyper_rustls;
18470/// # extern crate google_androidenterprise1 as androidenterprise1;
18471/// # async fn dox() {
18472/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18473///
18474/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18475/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18476/// # .with_native_roots()
18477/// # .unwrap()
18478/// # .https_only()
18479/// # .enable_http2()
18480/// # .build();
18481///
18482/// # let executor = hyper_util::rt::TokioExecutor::new();
18483/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18484/// # secret,
18485/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18486/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18487/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18488/// # ),
18489/// # ).build().await.unwrap();
18490///
18491/// # let client = hyper_util::client::legacy::Client::builder(
18492/// # hyper_util::rt::TokioExecutor::new()
18493/// # )
18494/// # .build(
18495/// # hyper_rustls::HttpsConnectorBuilder::new()
18496/// # .with_native_roots()
18497/// # .unwrap()
18498/// # .https_or_http()
18499/// # .enable_http2()
18500/// # .build()
18501/// # );
18502/// # let mut hub = AndroidEnterprise::new(client, auth);
18503/// // You can configure optional parameters by calling the respective setters at will, and
18504/// // execute the final call using `doit()`.
18505/// // Values shown here are possibly random and not representative !
18506/// let result = hub.managedconfigurationssettings().list("enterpriseId", "productId")
18507/// .doit().await;
18508/// # }
18509/// ```
18510pub struct ManagedconfigurationssettingListCall<'a, C>
18511where
18512 C: 'a,
18513{
18514 hub: &'a AndroidEnterprise<C>,
18515 _enterprise_id: String,
18516 _product_id: String,
18517 _delegate: Option<&'a mut dyn common::Delegate>,
18518 _additional_params: HashMap<String, String>,
18519 _scopes: BTreeSet<String>,
18520}
18521
18522impl<'a, C> common::CallBuilder for ManagedconfigurationssettingListCall<'a, C> {}
18523
18524impl<'a, C> ManagedconfigurationssettingListCall<'a, C>
18525where
18526 C: common::Connector,
18527{
18528 /// Perform the operation you have build so far.
18529 pub async fn doit(
18530 mut self,
18531 ) -> common::Result<(common::Response, ManagedConfigurationsSettingsListResponse)> {
18532 use std::borrow::Cow;
18533 use std::io::{Read, Seek};
18534
18535 use common::{url::Params, ToParts};
18536 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18537
18538 let mut dd = common::DefaultDelegate;
18539 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18540 dlg.begin(common::MethodInfo {
18541 id: "androidenterprise.managedconfigurationssettings.list",
18542 http_method: hyper::Method::GET,
18543 });
18544
18545 for &field in ["alt", "enterpriseId", "productId"].iter() {
18546 if self._additional_params.contains_key(field) {
18547 dlg.finished(false);
18548 return Err(common::Error::FieldClash(field));
18549 }
18550 }
18551
18552 let mut params = Params::with_capacity(4 + self._additional_params.len());
18553 params.push("enterpriseId", self._enterprise_id);
18554 params.push("productId", self._product_id);
18555
18556 params.extend(self._additional_params.iter());
18557
18558 params.push("alt", "json");
18559 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/products/{productId}/managedConfigurationsSettings";
18560 if self._scopes.is_empty() {
18561 self._scopes.insert(Scope::Full.as_ref().to_string());
18562 }
18563
18564 #[allow(clippy::single_element_loop)]
18565 for &(find_this, param_name) in [
18566 ("{enterpriseId}", "enterpriseId"),
18567 ("{productId}", "productId"),
18568 ]
18569 .iter()
18570 {
18571 url = params.uri_replacement(url, param_name, find_this, false);
18572 }
18573 {
18574 let to_remove = ["productId", "enterpriseId"];
18575 params.remove_params(&to_remove);
18576 }
18577
18578 let url = params.parse_with_url(&url);
18579
18580 loop {
18581 let token = match self
18582 .hub
18583 .auth
18584 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18585 .await
18586 {
18587 Ok(token) => token,
18588 Err(e) => match dlg.token(e) {
18589 Ok(token) => token,
18590 Err(e) => {
18591 dlg.finished(false);
18592 return Err(common::Error::MissingToken(e));
18593 }
18594 },
18595 };
18596 let mut req_result = {
18597 let client = &self.hub.client;
18598 dlg.pre_request();
18599 let mut req_builder = hyper::Request::builder()
18600 .method(hyper::Method::GET)
18601 .uri(url.as_str())
18602 .header(USER_AGENT, self.hub._user_agent.clone());
18603
18604 if let Some(token) = token.as_ref() {
18605 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18606 }
18607
18608 let request = req_builder
18609 .header(CONTENT_LENGTH, 0_u64)
18610 .body(common::to_body::<String>(None));
18611
18612 client.request(request.unwrap()).await
18613 };
18614
18615 match req_result {
18616 Err(err) => {
18617 if let common::Retry::After(d) = dlg.http_error(&err) {
18618 sleep(d).await;
18619 continue;
18620 }
18621 dlg.finished(false);
18622 return Err(common::Error::HttpError(err));
18623 }
18624 Ok(res) => {
18625 let (mut parts, body) = res.into_parts();
18626 let mut body = common::Body::new(body);
18627 if !parts.status.is_success() {
18628 let bytes = common::to_bytes(body).await.unwrap_or_default();
18629 let error = serde_json::from_str(&common::to_string(&bytes));
18630 let response = common::to_response(parts, bytes.into());
18631
18632 if let common::Retry::After(d) =
18633 dlg.http_failure(&response, error.as_ref().ok())
18634 {
18635 sleep(d).await;
18636 continue;
18637 }
18638
18639 dlg.finished(false);
18640
18641 return Err(match error {
18642 Ok(value) => common::Error::BadRequest(value),
18643 _ => common::Error::Failure(response),
18644 });
18645 }
18646 let response = {
18647 let bytes = common::to_bytes(body).await.unwrap_or_default();
18648 let encoded = common::to_string(&bytes);
18649 match serde_json::from_str(&encoded) {
18650 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18651 Err(error) => {
18652 dlg.response_json_decode_error(&encoded, &error);
18653 return Err(common::Error::JsonDecodeError(
18654 encoded.to_string(),
18655 error,
18656 ));
18657 }
18658 }
18659 };
18660
18661 dlg.finished(true);
18662 return Ok(response);
18663 }
18664 }
18665 }
18666 }
18667
18668 /// The ID of the enterprise.
18669 ///
18670 /// Sets the *enterprise id* path property to the given value.
18671 ///
18672 /// Even though the property as already been set when instantiating this call,
18673 /// we provide this method for API completeness.
18674 pub fn enterprise_id(mut self, new_value: &str) -> ManagedconfigurationssettingListCall<'a, C> {
18675 self._enterprise_id = new_value.to_string();
18676 self
18677 }
18678 /// The ID of the product for which the managed configurations settings applies to.
18679 ///
18680 /// Sets the *product id* path property to the given value.
18681 ///
18682 /// Even though the property as already been set when instantiating this call,
18683 /// we provide this method for API completeness.
18684 pub fn product_id(mut self, new_value: &str) -> ManagedconfigurationssettingListCall<'a, C> {
18685 self._product_id = new_value.to_string();
18686 self
18687 }
18688 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18689 /// while executing the actual API request.
18690 ///
18691 /// ````text
18692 /// It should be used to handle progress information, and to implement a certain level of resilience.
18693 /// ````
18694 ///
18695 /// Sets the *delegate* property to the given value.
18696 pub fn delegate(
18697 mut self,
18698 new_value: &'a mut dyn common::Delegate,
18699 ) -> ManagedconfigurationssettingListCall<'a, C> {
18700 self._delegate = Some(new_value);
18701 self
18702 }
18703
18704 /// Set any additional parameter of the query string used in the request.
18705 /// It should be used to set parameters which are not yet available through their own
18706 /// setters.
18707 ///
18708 /// Please note that this method must not be used to set any of the known parameters
18709 /// which have their own setter method. If done anyway, the request will fail.
18710 ///
18711 /// # Additional Parameters
18712 ///
18713 /// * *$.xgafv* (query-string) - V1 error format.
18714 /// * *access_token* (query-string) - OAuth access token.
18715 /// * *alt* (query-string) - Data format for response.
18716 /// * *callback* (query-string) - JSONP
18717 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18718 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18719 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18720 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18721 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18722 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18723 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18724 pub fn param<T>(mut self, name: T, value: T) -> ManagedconfigurationssettingListCall<'a, C>
18725 where
18726 T: AsRef<str>,
18727 {
18728 self._additional_params
18729 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18730 self
18731 }
18732
18733 /// Identifies the authorization scope for the method you are building.
18734 ///
18735 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18736 /// [`Scope::Full`].
18737 ///
18738 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18739 /// tokens for more than one scope.
18740 ///
18741 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18742 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18743 /// sufficient, a read-write scope will do as well.
18744 pub fn add_scope<St>(mut self, scope: St) -> ManagedconfigurationssettingListCall<'a, C>
18745 where
18746 St: AsRef<str>,
18747 {
18748 self._scopes.insert(String::from(scope.as_ref()));
18749 self
18750 }
18751 /// Identifies the authorization scope(s) for the method you are building.
18752 ///
18753 /// See [`Self::add_scope()`] for details.
18754 pub fn add_scopes<I, St>(mut self, scopes: I) -> ManagedconfigurationssettingListCall<'a, C>
18755 where
18756 I: IntoIterator<Item = St>,
18757 St: AsRef<str>,
18758 {
18759 self._scopes
18760 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18761 self
18762 }
18763
18764 /// Removes all scopes, and no default scope will be used either.
18765 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18766 /// for details).
18767 pub fn clear_scopes(mut self) -> ManagedconfigurationssettingListCall<'a, C> {
18768 self._scopes.clear();
18769 self
18770 }
18771}
18772
18773/// Retrieves details of an Android app permission for display to an enterprise admin.
18774///
18775/// A builder for the *get* method supported by a *permission* resource.
18776/// It is not used directly, but through a [`PermissionMethods`] instance.
18777///
18778/// # Example
18779///
18780/// Instantiate a resource method builder
18781///
18782/// ```test_harness,no_run
18783/// # extern crate hyper;
18784/// # extern crate hyper_rustls;
18785/// # extern crate google_androidenterprise1 as androidenterprise1;
18786/// # async fn dox() {
18787/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18788///
18789/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18790/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18791/// # .with_native_roots()
18792/// # .unwrap()
18793/// # .https_only()
18794/// # .enable_http2()
18795/// # .build();
18796///
18797/// # let executor = hyper_util::rt::TokioExecutor::new();
18798/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18799/// # secret,
18800/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18801/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18802/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18803/// # ),
18804/// # ).build().await.unwrap();
18805///
18806/// # let client = hyper_util::client::legacy::Client::builder(
18807/// # hyper_util::rt::TokioExecutor::new()
18808/// # )
18809/// # .build(
18810/// # hyper_rustls::HttpsConnectorBuilder::new()
18811/// # .with_native_roots()
18812/// # .unwrap()
18813/// # .https_or_http()
18814/// # .enable_http2()
18815/// # .build()
18816/// # );
18817/// # let mut hub = AndroidEnterprise::new(client, auth);
18818/// // You can configure optional parameters by calling the respective setters at will, and
18819/// // execute the final call using `doit()`.
18820/// // Values shown here are possibly random and not representative !
18821/// let result = hub.permissions().get("permissionId")
18822/// .language("est")
18823/// .doit().await;
18824/// # }
18825/// ```
18826pub struct PermissionGetCall<'a, C>
18827where
18828 C: 'a,
18829{
18830 hub: &'a AndroidEnterprise<C>,
18831 _permission_id: String,
18832 _language: Option<String>,
18833 _delegate: Option<&'a mut dyn common::Delegate>,
18834 _additional_params: HashMap<String, String>,
18835 _scopes: BTreeSet<String>,
18836}
18837
18838impl<'a, C> common::CallBuilder for PermissionGetCall<'a, C> {}
18839
18840impl<'a, C> PermissionGetCall<'a, C>
18841where
18842 C: common::Connector,
18843{
18844 /// Perform the operation you have build so far.
18845 pub async fn doit(mut self) -> common::Result<(common::Response, Permission)> {
18846 use std::borrow::Cow;
18847 use std::io::{Read, Seek};
18848
18849 use common::{url::Params, ToParts};
18850 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18851
18852 let mut dd = common::DefaultDelegate;
18853 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18854 dlg.begin(common::MethodInfo {
18855 id: "androidenterprise.permissions.get",
18856 http_method: hyper::Method::GET,
18857 });
18858
18859 for &field in ["alt", "permissionId", "language"].iter() {
18860 if self._additional_params.contains_key(field) {
18861 dlg.finished(false);
18862 return Err(common::Error::FieldClash(field));
18863 }
18864 }
18865
18866 let mut params = Params::with_capacity(4 + self._additional_params.len());
18867 params.push("permissionId", self._permission_id);
18868 if let Some(value) = self._language.as_ref() {
18869 params.push("language", value);
18870 }
18871
18872 params.extend(self._additional_params.iter());
18873
18874 params.push("alt", "json");
18875 let mut url =
18876 self.hub._base_url.clone() + "androidenterprise/v1/permissions/{permissionId}";
18877 if self._scopes.is_empty() {
18878 self._scopes.insert(Scope::Full.as_ref().to_string());
18879 }
18880
18881 #[allow(clippy::single_element_loop)]
18882 for &(find_this, param_name) in [("{permissionId}", "permissionId")].iter() {
18883 url = params.uri_replacement(url, param_name, find_this, false);
18884 }
18885 {
18886 let to_remove = ["permissionId"];
18887 params.remove_params(&to_remove);
18888 }
18889
18890 let url = params.parse_with_url(&url);
18891
18892 loop {
18893 let token = match self
18894 .hub
18895 .auth
18896 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18897 .await
18898 {
18899 Ok(token) => token,
18900 Err(e) => match dlg.token(e) {
18901 Ok(token) => token,
18902 Err(e) => {
18903 dlg.finished(false);
18904 return Err(common::Error::MissingToken(e));
18905 }
18906 },
18907 };
18908 let mut req_result = {
18909 let client = &self.hub.client;
18910 dlg.pre_request();
18911 let mut req_builder = hyper::Request::builder()
18912 .method(hyper::Method::GET)
18913 .uri(url.as_str())
18914 .header(USER_AGENT, self.hub._user_agent.clone());
18915
18916 if let Some(token) = token.as_ref() {
18917 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18918 }
18919
18920 let request = req_builder
18921 .header(CONTENT_LENGTH, 0_u64)
18922 .body(common::to_body::<String>(None));
18923
18924 client.request(request.unwrap()).await
18925 };
18926
18927 match req_result {
18928 Err(err) => {
18929 if let common::Retry::After(d) = dlg.http_error(&err) {
18930 sleep(d).await;
18931 continue;
18932 }
18933 dlg.finished(false);
18934 return Err(common::Error::HttpError(err));
18935 }
18936 Ok(res) => {
18937 let (mut parts, body) = res.into_parts();
18938 let mut body = common::Body::new(body);
18939 if !parts.status.is_success() {
18940 let bytes = common::to_bytes(body).await.unwrap_or_default();
18941 let error = serde_json::from_str(&common::to_string(&bytes));
18942 let response = common::to_response(parts, bytes.into());
18943
18944 if let common::Retry::After(d) =
18945 dlg.http_failure(&response, error.as_ref().ok())
18946 {
18947 sleep(d).await;
18948 continue;
18949 }
18950
18951 dlg.finished(false);
18952
18953 return Err(match error {
18954 Ok(value) => common::Error::BadRequest(value),
18955 _ => common::Error::Failure(response),
18956 });
18957 }
18958 let response = {
18959 let bytes = common::to_bytes(body).await.unwrap_or_default();
18960 let encoded = common::to_string(&bytes);
18961 match serde_json::from_str(&encoded) {
18962 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18963 Err(error) => {
18964 dlg.response_json_decode_error(&encoded, &error);
18965 return Err(common::Error::JsonDecodeError(
18966 encoded.to_string(),
18967 error,
18968 ));
18969 }
18970 }
18971 };
18972
18973 dlg.finished(true);
18974 return Ok(response);
18975 }
18976 }
18977 }
18978 }
18979
18980 /// The ID of the permission.
18981 ///
18982 /// Sets the *permission id* path property to the given value.
18983 ///
18984 /// Even though the property as already been set when instantiating this call,
18985 /// we provide this method for API completeness.
18986 pub fn permission_id(mut self, new_value: &str) -> PermissionGetCall<'a, C> {
18987 self._permission_id = new_value.to_string();
18988 self
18989 }
18990 /// The BCP47 tag for the user's preferred language (e.g. "en-US", "de")
18991 ///
18992 /// Sets the *language* query property to the given value.
18993 pub fn language(mut self, new_value: &str) -> PermissionGetCall<'a, C> {
18994 self._language = Some(new_value.to_string());
18995 self
18996 }
18997 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18998 /// while executing the actual API request.
18999 ///
19000 /// ````text
19001 /// It should be used to handle progress information, and to implement a certain level of resilience.
19002 /// ````
19003 ///
19004 /// Sets the *delegate* property to the given value.
19005 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PermissionGetCall<'a, C> {
19006 self._delegate = Some(new_value);
19007 self
19008 }
19009
19010 /// Set any additional parameter of the query string used in the request.
19011 /// It should be used to set parameters which are not yet available through their own
19012 /// setters.
19013 ///
19014 /// Please note that this method must not be used to set any of the known parameters
19015 /// which have their own setter method. If done anyway, the request will fail.
19016 ///
19017 /// # Additional Parameters
19018 ///
19019 /// * *$.xgafv* (query-string) - V1 error format.
19020 /// * *access_token* (query-string) - OAuth access token.
19021 /// * *alt* (query-string) - Data format for response.
19022 /// * *callback* (query-string) - JSONP
19023 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19024 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19025 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19026 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19027 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19028 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19029 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19030 pub fn param<T>(mut self, name: T, value: T) -> PermissionGetCall<'a, C>
19031 where
19032 T: AsRef<str>,
19033 {
19034 self._additional_params
19035 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19036 self
19037 }
19038
19039 /// Identifies the authorization scope for the method you are building.
19040 ///
19041 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19042 /// [`Scope::Full`].
19043 ///
19044 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19045 /// tokens for more than one scope.
19046 ///
19047 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19048 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19049 /// sufficient, a read-write scope will do as well.
19050 pub fn add_scope<St>(mut self, scope: St) -> PermissionGetCall<'a, C>
19051 where
19052 St: AsRef<str>,
19053 {
19054 self._scopes.insert(String::from(scope.as_ref()));
19055 self
19056 }
19057 /// Identifies the authorization scope(s) for the method you are building.
19058 ///
19059 /// See [`Self::add_scope()`] for details.
19060 pub fn add_scopes<I, St>(mut self, scopes: I) -> PermissionGetCall<'a, C>
19061 where
19062 I: IntoIterator<Item = St>,
19063 St: AsRef<str>,
19064 {
19065 self._scopes
19066 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19067 self
19068 }
19069
19070 /// Removes all scopes, and no default scope will be used either.
19071 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19072 /// for details).
19073 pub fn clear_scopes(mut self) -> PermissionGetCall<'a, C> {
19074 self._scopes.clear();
19075 self
19076 }
19077}
19078
19079/// Approves the specified product and the relevant app permissions, if any. The maximum number of products that you can approve per enterprise customer is 1,000. To learn how to use managed Google Play to design and create a store layout to display approved products to your users, see Store Layout Design. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
19080///
19081/// A builder for the *approve* method supported by a *product* resource.
19082/// It is not used directly, but through a [`ProductMethods`] instance.
19083///
19084/// # Example
19085///
19086/// Instantiate a resource method builder
19087///
19088/// ```test_harness,no_run
19089/// # extern crate hyper;
19090/// # extern crate hyper_rustls;
19091/// # extern crate google_androidenterprise1 as androidenterprise1;
19092/// use androidenterprise1::api::ProductsApproveRequest;
19093/// # async fn dox() {
19094/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19095///
19096/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19097/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19098/// # .with_native_roots()
19099/// # .unwrap()
19100/// # .https_only()
19101/// # .enable_http2()
19102/// # .build();
19103///
19104/// # let executor = hyper_util::rt::TokioExecutor::new();
19105/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19106/// # secret,
19107/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19108/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19109/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19110/// # ),
19111/// # ).build().await.unwrap();
19112///
19113/// # let client = hyper_util::client::legacy::Client::builder(
19114/// # hyper_util::rt::TokioExecutor::new()
19115/// # )
19116/// # .build(
19117/// # hyper_rustls::HttpsConnectorBuilder::new()
19118/// # .with_native_roots()
19119/// # .unwrap()
19120/// # .https_or_http()
19121/// # .enable_http2()
19122/// # .build()
19123/// # );
19124/// # let mut hub = AndroidEnterprise::new(client, auth);
19125/// // As the method needs a request, you would usually fill it with the desired information
19126/// // into the respective structure. Some of the parts shown here might not be applicable !
19127/// // Values shown here are possibly random and not representative !
19128/// let mut req = ProductsApproveRequest::default();
19129///
19130/// // You can configure optional parameters by calling the respective setters at will, and
19131/// // execute the final call using `doit()`.
19132/// // Values shown here are possibly random and not representative !
19133/// let result = hub.products().approve(req, "enterpriseId", "productId")
19134/// .doit().await;
19135/// # }
19136/// ```
19137pub struct ProductApproveCall<'a, C>
19138where
19139 C: 'a,
19140{
19141 hub: &'a AndroidEnterprise<C>,
19142 _request: ProductsApproveRequest,
19143 _enterprise_id: String,
19144 _product_id: String,
19145 _delegate: Option<&'a mut dyn common::Delegate>,
19146 _additional_params: HashMap<String, String>,
19147 _scopes: BTreeSet<String>,
19148}
19149
19150impl<'a, C> common::CallBuilder for ProductApproveCall<'a, C> {}
19151
19152impl<'a, C> ProductApproveCall<'a, C>
19153where
19154 C: common::Connector,
19155{
19156 /// Perform the operation you have build so far.
19157 pub async fn doit(mut self) -> common::Result<common::Response> {
19158 use std::borrow::Cow;
19159 use std::io::{Read, Seek};
19160
19161 use common::{url::Params, ToParts};
19162 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19163
19164 let mut dd = common::DefaultDelegate;
19165 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19166 dlg.begin(common::MethodInfo {
19167 id: "androidenterprise.products.approve",
19168 http_method: hyper::Method::POST,
19169 });
19170
19171 for &field in ["enterpriseId", "productId"].iter() {
19172 if self._additional_params.contains_key(field) {
19173 dlg.finished(false);
19174 return Err(common::Error::FieldClash(field));
19175 }
19176 }
19177
19178 let mut params = Params::with_capacity(4 + self._additional_params.len());
19179 params.push("enterpriseId", self._enterprise_id);
19180 params.push("productId", self._product_id);
19181
19182 params.extend(self._additional_params.iter());
19183
19184 let mut url = self.hub._base_url.clone()
19185 + "androidenterprise/v1/enterprises/{enterpriseId}/products/{productId}/approve";
19186 if self._scopes.is_empty() {
19187 self._scopes.insert(Scope::Full.as_ref().to_string());
19188 }
19189
19190 #[allow(clippy::single_element_loop)]
19191 for &(find_this, param_name) in [
19192 ("{enterpriseId}", "enterpriseId"),
19193 ("{productId}", "productId"),
19194 ]
19195 .iter()
19196 {
19197 url = params.uri_replacement(url, param_name, find_this, false);
19198 }
19199 {
19200 let to_remove = ["productId", "enterpriseId"];
19201 params.remove_params(&to_remove);
19202 }
19203
19204 let url = params.parse_with_url(&url);
19205
19206 let mut json_mime_type = mime::APPLICATION_JSON;
19207 let mut request_value_reader = {
19208 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19209 common::remove_json_null_values(&mut value);
19210 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19211 serde_json::to_writer(&mut dst, &value).unwrap();
19212 dst
19213 };
19214 let request_size = request_value_reader
19215 .seek(std::io::SeekFrom::End(0))
19216 .unwrap();
19217 request_value_reader
19218 .seek(std::io::SeekFrom::Start(0))
19219 .unwrap();
19220
19221 loop {
19222 let token = match self
19223 .hub
19224 .auth
19225 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19226 .await
19227 {
19228 Ok(token) => token,
19229 Err(e) => match dlg.token(e) {
19230 Ok(token) => token,
19231 Err(e) => {
19232 dlg.finished(false);
19233 return Err(common::Error::MissingToken(e));
19234 }
19235 },
19236 };
19237 request_value_reader
19238 .seek(std::io::SeekFrom::Start(0))
19239 .unwrap();
19240 let mut req_result = {
19241 let client = &self.hub.client;
19242 dlg.pre_request();
19243 let mut req_builder = hyper::Request::builder()
19244 .method(hyper::Method::POST)
19245 .uri(url.as_str())
19246 .header(USER_AGENT, self.hub._user_agent.clone());
19247
19248 if let Some(token) = token.as_ref() {
19249 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19250 }
19251
19252 let request = req_builder
19253 .header(CONTENT_TYPE, json_mime_type.to_string())
19254 .header(CONTENT_LENGTH, request_size as u64)
19255 .body(common::to_body(
19256 request_value_reader.get_ref().clone().into(),
19257 ));
19258
19259 client.request(request.unwrap()).await
19260 };
19261
19262 match req_result {
19263 Err(err) => {
19264 if let common::Retry::After(d) = dlg.http_error(&err) {
19265 sleep(d).await;
19266 continue;
19267 }
19268 dlg.finished(false);
19269 return Err(common::Error::HttpError(err));
19270 }
19271 Ok(res) => {
19272 let (mut parts, body) = res.into_parts();
19273 let mut body = common::Body::new(body);
19274 if !parts.status.is_success() {
19275 let bytes = common::to_bytes(body).await.unwrap_or_default();
19276 let error = serde_json::from_str(&common::to_string(&bytes));
19277 let response = common::to_response(parts, bytes.into());
19278
19279 if let common::Retry::After(d) =
19280 dlg.http_failure(&response, error.as_ref().ok())
19281 {
19282 sleep(d).await;
19283 continue;
19284 }
19285
19286 dlg.finished(false);
19287
19288 return Err(match error {
19289 Ok(value) => common::Error::BadRequest(value),
19290 _ => common::Error::Failure(response),
19291 });
19292 }
19293 let response = common::Response::from_parts(parts, body);
19294
19295 dlg.finished(true);
19296 return Ok(response);
19297 }
19298 }
19299 }
19300 }
19301
19302 ///
19303 /// Sets the *request* property to the given value.
19304 ///
19305 /// Even though the property as already been set when instantiating this call,
19306 /// we provide this method for API completeness.
19307 pub fn request(mut self, new_value: ProductsApproveRequest) -> ProductApproveCall<'a, C> {
19308 self._request = new_value;
19309 self
19310 }
19311 /// The ID of the enterprise.
19312 ///
19313 /// Sets the *enterprise id* path property to the given value.
19314 ///
19315 /// Even though the property as already been set when instantiating this call,
19316 /// we provide this method for API completeness.
19317 pub fn enterprise_id(mut self, new_value: &str) -> ProductApproveCall<'a, C> {
19318 self._enterprise_id = new_value.to_string();
19319 self
19320 }
19321 /// The ID of the product.
19322 ///
19323 /// Sets the *product id* path property to the given value.
19324 ///
19325 /// Even though the property as already been set when instantiating this call,
19326 /// we provide this method for API completeness.
19327 pub fn product_id(mut self, new_value: &str) -> ProductApproveCall<'a, C> {
19328 self._product_id = new_value.to_string();
19329 self
19330 }
19331 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19332 /// while executing the actual API request.
19333 ///
19334 /// ````text
19335 /// It should be used to handle progress information, and to implement a certain level of resilience.
19336 /// ````
19337 ///
19338 /// Sets the *delegate* property to the given value.
19339 pub fn delegate(
19340 mut self,
19341 new_value: &'a mut dyn common::Delegate,
19342 ) -> ProductApproveCall<'a, C> {
19343 self._delegate = Some(new_value);
19344 self
19345 }
19346
19347 /// Set any additional parameter of the query string used in the request.
19348 /// It should be used to set parameters which are not yet available through their own
19349 /// setters.
19350 ///
19351 /// Please note that this method must not be used to set any of the known parameters
19352 /// which have their own setter method. If done anyway, the request will fail.
19353 ///
19354 /// # Additional Parameters
19355 ///
19356 /// * *$.xgafv* (query-string) - V1 error format.
19357 /// * *access_token* (query-string) - OAuth access token.
19358 /// * *alt* (query-string) - Data format for response.
19359 /// * *callback* (query-string) - JSONP
19360 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19361 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19362 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19363 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19364 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19365 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19366 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19367 pub fn param<T>(mut self, name: T, value: T) -> ProductApproveCall<'a, C>
19368 where
19369 T: AsRef<str>,
19370 {
19371 self._additional_params
19372 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19373 self
19374 }
19375
19376 /// Identifies the authorization scope for the method you are building.
19377 ///
19378 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19379 /// [`Scope::Full`].
19380 ///
19381 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19382 /// tokens for more than one scope.
19383 ///
19384 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19385 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19386 /// sufficient, a read-write scope will do as well.
19387 pub fn add_scope<St>(mut self, scope: St) -> ProductApproveCall<'a, C>
19388 where
19389 St: AsRef<str>,
19390 {
19391 self._scopes.insert(String::from(scope.as_ref()));
19392 self
19393 }
19394 /// Identifies the authorization scope(s) for the method you are building.
19395 ///
19396 /// See [`Self::add_scope()`] for details.
19397 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProductApproveCall<'a, C>
19398 where
19399 I: IntoIterator<Item = St>,
19400 St: AsRef<str>,
19401 {
19402 self._scopes
19403 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19404 self
19405 }
19406
19407 /// Removes all scopes, and no default scope will be used either.
19408 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19409 /// for details).
19410 pub fn clear_scopes(mut self) -> ProductApproveCall<'a, C> {
19411 self._scopes.clear();
19412 self
19413 }
19414}
19415
19416/// Generates a URL that can be rendered in an iframe to display the permissions (if any) of a product. An enterprise admin must view these permissions and accept them on behalf of their organization in order to approve that product. Admins should accept the displayed permissions by interacting with a separate UI element in the EMM console, which in turn should trigger the use of this URL as the approvalUrlInfo.approvalUrl property in a Products.approve call to approve the product. This URL can only be used to display permissions for up to 1 day. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
19417///
19418/// A builder for the *generateApprovalUrl* method supported by a *product* resource.
19419/// It is not used directly, but through a [`ProductMethods`] instance.
19420///
19421/// # Example
19422///
19423/// Instantiate a resource method builder
19424///
19425/// ```test_harness,no_run
19426/// # extern crate hyper;
19427/// # extern crate hyper_rustls;
19428/// # extern crate google_androidenterprise1 as androidenterprise1;
19429/// # async fn dox() {
19430/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19431///
19432/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19433/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19434/// # .with_native_roots()
19435/// # .unwrap()
19436/// # .https_only()
19437/// # .enable_http2()
19438/// # .build();
19439///
19440/// # let executor = hyper_util::rt::TokioExecutor::new();
19441/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19442/// # secret,
19443/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19444/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19445/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19446/// # ),
19447/// # ).build().await.unwrap();
19448///
19449/// # let client = hyper_util::client::legacy::Client::builder(
19450/// # hyper_util::rt::TokioExecutor::new()
19451/// # )
19452/// # .build(
19453/// # hyper_rustls::HttpsConnectorBuilder::new()
19454/// # .with_native_roots()
19455/// # .unwrap()
19456/// # .https_or_http()
19457/// # .enable_http2()
19458/// # .build()
19459/// # );
19460/// # let mut hub = AndroidEnterprise::new(client, auth);
19461/// // You can configure optional parameters by calling the respective setters at will, and
19462/// // execute the final call using `doit()`.
19463/// // Values shown here are possibly random and not representative !
19464/// let result = hub.products().generate_approval_url("enterpriseId", "productId")
19465/// .language_code("et")
19466/// .doit().await;
19467/// # }
19468/// ```
19469pub struct ProductGenerateApprovalUrlCall<'a, C>
19470where
19471 C: 'a,
19472{
19473 hub: &'a AndroidEnterprise<C>,
19474 _enterprise_id: String,
19475 _product_id: String,
19476 _language_code: Option<String>,
19477 _delegate: Option<&'a mut dyn common::Delegate>,
19478 _additional_params: HashMap<String, String>,
19479 _scopes: BTreeSet<String>,
19480}
19481
19482impl<'a, C> common::CallBuilder for ProductGenerateApprovalUrlCall<'a, C> {}
19483
19484impl<'a, C> ProductGenerateApprovalUrlCall<'a, C>
19485where
19486 C: common::Connector,
19487{
19488 /// Perform the operation you have build so far.
19489 pub async fn doit(
19490 mut self,
19491 ) -> common::Result<(common::Response, ProductsGenerateApprovalUrlResponse)> {
19492 use std::borrow::Cow;
19493 use std::io::{Read, Seek};
19494
19495 use common::{url::Params, ToParts};
19496 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19497
19498 let mut dd = common::DefaultDelegate;
19499 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19500 dlg.begin(common::MethodInfo {
19501 id: "androidenterprise.products.generateApprovalUrl",
19502 http_method: hyper::Method::POST,
19503 });
19504
19505 for &field in ["alt", "enterpriseId", "productId", "languageCode"].iter() {
19506 if self._additional_params.contains_key(field) {
19507 dlg.finished(false);
19508 return Err(common::Error::FieldClash(field));
19509 }
19510 }
19511
19512 let mut params = Params::with_capacity(5 + self._additional_params.len());
19513 params.push("enterpriseId", self._enterprise_id);
19514 params.push("productId", self._product_id);
19515 if let Some(value) = self._language_code.as_ref() {
19516 params.push("languageCode", value);
19517 }
19518
19519 params.extend(self._additional_params.iter());
19520
19521 params.push("alt", "json");
19522 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/products/{productId}/generateApprovalUrl";
19523 if self._scopes.is_empty() {
19524 self._scopes.insert(Scope::Full.as_ref().to_string());
19525 }
19526
19527 #[allow(clippy::single_element_loop)]
19528 for &(find_this, param_name) in [
19529 ("{enterpriseId}", "enterpriseId"),
19530 ("{productId}", "productId"),
19531 ]
19532 .iter()
19533 {
19534 url = params.uri_replacement(url, param_name, find_this, false);
19535 }
19536 {
19537 let to_remove = ["productId", "enterpriseId"];
19538 params.remove_params(&to_remove);
19539 }
19540
19541 let url = params.parse_with_url(&url);
19542
19543 loop {
19544 let token = match self
19545 .hub
19546 .auth
19547 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19548 .await
19549 {
19550 Ok(token) => token,
19551 Err(e) => match dlg.token(e) {
19552 Ok(token) => token,
19553 Err(e) => {
19554 dlg.finished(false);
19555 return Err(common::Error::MissingToken(e));
19556 }
19557 },
19558 };
19559 let mut req_result = {
19560 let client = &self.hub.client;
19561 dlg.pre_request();
19562 let mut req_builder = hyper::Request::builder()
19563 .method(hyper::Method::POST)
19564 .uri(url.as_str())
19565 .header(USER_AGENT, self.hub._user_agent.clone());
19566
19567 if let Some(token) = token.as_ref() {
19568 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19569 }
19570
19571 let request = req_builder
19572 .header(CONTENT_LENGTH, 0_u64)
19573 .body(common::to_body::<String>(None));
19574
19575 client.request(request.unwrap()).await
19576 };
19577
19578 match req_result {
19579 Err(err) => {
19580 if let common::Retry::After(d) = dlg.http_error(&err) {
19581 sleep(d).await;
19582 continue;
19583 }
19584 dlg.finished(false);
19585 return Err(common::Error::HttpError(err));
19586 }
19587 Ok(res) => {
19588 let (mut parts, body) = res.into_parts();
19589 let mut body = common::Body::new(body);
19590 if !parts.status.is_success() {
19591 let bytes = common::to_bytes(body).await.unwrap_or_default();
19592 let error = serde_json::from_str(&common::to_string(&bytes));
19593 let response = common::to_response(parts, bytes.into());
19594
19595 if let common::Retry::After(d) =
19596 dlg.http_failure(&response, error.as_ref().ok())
19597 {
19598 sleep(d).await;
19599 continue;
19600 }
19601
19602 dlg.finished(false);
19603
19604 return Err(match error {
19605 Ok(value) => common::Error::BadRequest(value),
19606 _ => common::Error::Failure(response),
19607 });
19608 }
19609 let response = {
19610 let bytes = common::to_bytes(body).await.unwrap_or_default();
19611 let encoded = common::to_string(&bytes);
19612 match serde_json::from_str(&encoded) {
19613 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19614 Err(error) => {
19615 dlg.response_json_decode_error(&encoded, &error);
19616 return Err(common::Error::JsonDecodeError(
19617 encoded.to_string(),
19618 error,
19619 ));
19620 }
19621 }
19622 };
19623
19624 dlg.finished(true);
19625 return Ok(response);
19626 }
19627 }
19628 }
19629 }
19630
19631 /// The ID of the enterprise.
19632 ///
19633 /// Sets the *enterprise id* path property to the given value.
19634 ///
19635 /// Even though the property as already been set when instantiating this call,
19636 /// we provide this method for API completeness.
19637 pub fn enterprise_id(mut self, new_value: &str) -> ProductGenerateApprovalUrlCall<'a, C> {
19638 self._enterprise_id = new_value.to_string();
19639 self
19640 }
19641 /// The ID of the product.
19642 ///
19643 /// Sets the *product id* path property to the given value.
19644 ///
19645 /// Even though the property as already been set when instantiating this call,
19646 /// we provide this method for API completeness.
19647 pub fn product_id(mut self, new_value: &str) -> ProductGenerateApprovalUrlCall<'a, C> {
19648 self._product_id = new_value.to_string();
19649 self
19650 }
19651 /// The BCP 47 language code used for permission names and descriptions in the returned iframe, for instance "en-US".
19652 ///
19653 /// Sets the *language code* query property to the given value.
19654 pub fn language_code(mut self, new_value: &str) -> ProductGenerateApprovalUrlCall<'a, C> {
19655 self._language_code = Some(new_value.to_string());
19656 self
19657 }
19658 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19659 /// while executing the actual API request.
19660 ///
19661 /// ````text
19662 /// It should be used to handle progress information, and to implement a certain level of resilience.
19663 /// ````
19664 ///
19665 /// Sets the *delegate* property to the given value.
19666 pub fn delegate(
19667 mut self,
19668 new_value: &'a mut dyn common::Delegate,
19669 ) -> ProductGenerateApprovalUrlCall<'a, C> {
19670 self._delegate = Some(new_value);
19671 self
19672 }
19673
19674 /// Set any additional parameter of the query string used in the request.
19675 /// It should be used to set parameters which are not yet available through their own
19676 /// setters.
19677 ///
19678 /// Please note that this method must not be used to set any of the known parameters
19679 /// which have their own setter method. If done anyway, the request will fail.
19680 ///
19681 /// # Additional Parameters
19682 ///
19683 /// * *$.xgafv* (query-string) - V1 error format.
19684 /// * *access_token* (query-string) - OAuth access token.
19685 /// * *alt* (query-string) - Data format for response.
19686 /// * *callback* (query-string) - JSONP
19687 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19688 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19689 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19690 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19691 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19692 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19693 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19694 pub fn param<T>(mut self, name: T, value: T) -> ProductGenerateApprovalUrlCall<'a, C>
19695 where
19696 T: AsRef<str>,
19697 {
19698 self._additional_params
19699 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19700 self
19701 }
19702
19703 /// Identifies the authorization scope for the method you are building.
19704 ///
19705 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19706 /// [`Scope::Full`].
19707 ///
19708 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19709 /// tokens for more than one scope.
19710 ///
19711 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19712 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19713 /// sufficient, a read-write scope will do as well.
19714 pub fn add_scope<St>(mut self, scope: St) -> ProductGenerateApprovalUrlCall<'a, C>
19715 where
19716 St: AsRef<str>,
19717 {
19718 self._scopes.insert(String::from(scope.as_ref()));
19719 self
19720 }
19721 /// Identifies the authorization scope(s) for the method you are building.
19722 ///
19723 /// See [`Self::add_scope()`] for details.
19724 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProductGenerateApprovalUrlCall<'a, C>
19725 where
19726 I: IntoIterator<Item = St>,
19727 St: AsRef<str>,
19728 {
19729 self._scopes
19730 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19731 self
19732 }
19733
19734 /// Removes all scopes, and no default scope will be used either.
19735 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19736 /// for details).
19737 pub fn clear_scopes(mut self) -> ProductGenerateApprovalUrlCall<'a, C> {
19738 self._scopes.clear();
19739 self
19740 }
19741}
19742
19743/// Retrieves details of a product for display to an enterprise admin.
19744///
19745/// A builder for the *get* method supported by a *product* resource.
19746/// It is not used directly, but through a [`ProductMethods`] instance.
19747///
19748/// # Example
19749///
19750/// Instantiate a resource method builder
19751///
19752/// ```test_harness,no_run
19753/// # extern crate hyper;
19754/// # extern crate hyper_rustls;
19755/// # extern crate google_androidenterprise1 as androidenterprise1;
19756/// # async fn dox() {
19757/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19758///
19759/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19760/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19761/// # .with_native_roots()
19762/// # .unwrap()
19763/// # .https_only()
19764/// # .enable_http2()
19765/// # .build();
19766///
19767/// # let executor = hyper_util::rt::TokioExecutor::new();
19768/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19769/// # secret,
19770/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19771/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19772/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19773/// # ),
19774/// # ).build().await.unwrap();
19775///
19776/// # let client = hyper_util::client::legacy::Client::builder(
19777/// # hyper_util::rt::TokioExecutor::new()
19778/// # )
19779/// # .build(
19780/// # hyper_rustls::HttpsConnectorBuilder::new()
19781/// # .with_native_roots()
19782/// # .unwrap()
19783/// # .https_or_http()
19784/// # .enable_http2()
19785/// # .build()
19786/// # );
19787/// # let mut hub = AndroidEnterprise::new(client, auth);
19788/// // You can configure optional parameters by calling the respective setters at will, and
19789/// // execute the final call using `doit()`.
19790/// // Values shown here are possibly random and not representative !
19791/// let result = hub.products().get("enterpriseId", "productId")
19792/// .language("et")
19793/// .doit().await;
19794/// # }
19795/// ```
19796pub struct ProductGetCall<'a, C>
19797where
19798 C: 'a,
19799{
19800 hub: &'a AndroidEnterprise<C>,
19801 _enterprise_id: String,
19802 _product_id: String,
19803 _language: Option<String>,
19804 _delegate: Option<&'a mut dyn common::Delegate>,
19805 _additional_params: HashMap<String, String>,
19806 _scopes: BTreeSet<String>,
19807}
19808
19809impl<'a, C> common::CallBuilder for ProductGetCall<'a, C> {}
19810
19811impl<'a, C> ProductGetCall<'a, C>
19812where
19813 C: common::Connector,
19814{
19815 /// Perform the operation you have build so far.
19816 pub async fn doit(mut self) -> common::Result<(common::Response, Product)> {
19817 use std::borrow::Cow;
19818 use std::io::{Read, Seek};
19819
19820 use common::{url::Params, ToParts};
19821 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19822
19823 let mut dd = common::DefaultDelegate;
19824 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19825 dlg.begin(common::MethodInfo {
19826 id: "androidenterprise.products.get",
19827 http_method: hyper::Method::GET,
19828 });
19829
19830 for &field in ["alt", "enterpriseId", "productId", "language"].iter() {
19831 if self._additional_params.contains_key(field) {
19832 dlg.finished(false);
19833 return Err(common::Error::FieldClash(field));
19834 }
19835 }
19836
19837 let mut params = Params::with_capacity(5 + self._additional_params.len());
19838 params.push("enterpriseId", self._enterprise_id);
19839 params.push("productId", self._product_id);
19840 if let Some(value) = self._language.as_ref() {
19841 params.push("language", value);
19842 }
19843
19844 params.extend(self._additional_params.iter());
19845
19846 params.push("alt", "json");
19847 let mut url = self.hub._base_url.clone()
19848 + "androidenterprise/v1/enterprises/{enterpriseId}/products/{productId}";
19849 if self._scopes.is_empty() {
19850 self._scopes.insert(Scope::Full.as_ref().to_string());
19851 }
19852
19853 #[allow(clippy::single_element_loop)]
19854 for &(find_this, param_name) in [
19855 ("{enterpriseId}", "enterpriseId"),
19856 ("{productId}", "productId"),
19857 ]
19858 .iter()
19859 {
19860 url = params.uri_replacement(url, param_name, find_this, false);
19861 }
19862 {
19863 let to_remove = ["productId", "enterpriseId"];
19864 params.remove_params(&to_remove);
19865 }
19866
19867 let url = params.parse_with_url(&url);
19868
19869 loop {
19870 let token = match self
19871 .hub
19872 .auth
19873 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19874 .await
19875 {
19876 Ok(token) => token,
19877 Err(e) => match dlg.token(e) {
19878 Ok(token) => token,
19879 Err(e) => {
19880 dlg.finished(false);
19881 return Err(common::Error::MissingToken(e));
19882 }
19883 },
19884 };
19885 let mut req_result = {
19886 let client = &self.hub.client;
19887 dlg.pre_request();
19888 let mut req_builder = hyper::Request::builder()
19889 .method(hyper::Method::GET)
19890 .uri(url.as_str())
19891 .header(USER_AGENT, self.hub._user_agent.clone());
19892
19893 if let Some(token) = token.as_ref() {
19894 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19895 }
19896
19897 let request = req_builder
19898 .header(CONTENT_LENGTH, 0_u64)
19899 .body(common::to_body::<String>(None));
19900
19901 client.request(request.unwrap()).await
19902 };
19903
19904 match req_result {
19905 Err(err) => {
19906 if let common::Retry::After(d) = dlg.http_error(&err) {
19907 sleep(d).await;
19908 continue;
19909 }
19910 dlg.finished(false);
19911 return Err(common::Error::HttpError(err));
19912 }
19913 Ok(res) => {
19914 let (mut parts, body) = res.into_parts();
19915 let mut body = common::Body::new(body);
19916 if !parts.status.is_success() {
19917 let bytes = common::to_bytes(body).await.unwrap_or_default();
19918 let error = serde_json::from_str(&common::to_string(&bytes));
19919 let response = common::to_response(parts, bytes.into());
19920
19921 if let common::Retry::After(d) =
19922 dlg.http_failure(&response, error.as_ref().ok())
19923 {
19924 sleep(d).await;
19925 continue;
19926 }
19927
19928 dlg.finished(false);
19929
19930 return Err(match error {
19931 Ok(value) => common::Error::BadRequest(value),
19932 _ => common::Error::Failure(response),
19933 });
19934 }
19935 let response = {
19936 let bytes = common::to_bytes(body).await.unwrap_or_default();
19937 let encoded = common::to_string(&bytes);
19938 match serde_json::from_str(&encoded) {
19939 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19940 Err(error) => {
19941 dlg.response_json_decode_error(&encoded, &error);
19942 return Err(common::Error::JsonDecodeError(
19943 encoded.to_string(),
19944 error,
19945 ));
19946 }
19947 }
19948 };
19949
19950 dlg.finished(true);
19951 return Ok(response);
19952 }
19953 }
19954 }
19955 }
19956
19957 /// The ID of the enterprise.
19958 ///
19959 /// Sets the *enterprise id* path property to the given value.
19960 ///
19961 /// Even though the property as already been set when instantiating this call,
19962 /// we provide this method for API completeness.
19963 pub fn enterprise_id(mut self, new_value: &str) -> ProductGetCall<'a, C> {
19964 self._enterprise_id = new_value.to_string();
19965 self
19966 }
19967 /// The ID of the product, e.g. "app:com.google.android.gm".
19968 ///
19969 /// Sets the *product id* path property to the given value.
19970 ///
19971 /// Even though the property as already been set when instantiating this call,
19972 /// we provide this method for API completeness.
19973 pub fn product_id(mut self, new_value: &str) -> ProductGetCall<'a, C> {
19974 self._product_id = new_value.to_string();
19975 self
19976 }
19977 /// The BCP47 tag for the user's preferred language (e.g. "en-US", "de").
19978 ///
19979 /// Sets the *language* query property to the given value.
19980 pub fn language(mut self, new_value: &str) -> ProductGetCall<'a, C> {
19981 self._language = Some(new_value.to_string());
19982 self
19983 }
19984 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19985 /// while executing the actual API request.
19986 ///
19987 /// ````text
19988 /// It should be used to handle progress information, and to implement a certain level of resilience.
19989 /// ````
19990 ///
19991 /// Sets the *delegate* property to the given value.
19992 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProductGetCall<'a, C> {
19993 self._delegate = Some(new_value);
19994 self
19995 }
19996
19997 /// Set any additional parameter of the query string used in the request.
19998 /// It should be used to set parameters which are not yet available through their own
19999 /// setters.
20000 ///
20001 /// Please note that this method must not be used to set any of the known parameters
20002 /// which have their own setter method. If done anyway, the request will fail.
20003 ///
20004 /// # Additional Parameters
20005 ///
20006 /// * *$.xgafv* (query-string) - V1 error format.
20007 /// * *access_token* (query-string) - OAuth access token.
20008 /// * *alt* (query-string) - Data format for response.
20009 /// * *callback* (query-string) - JSONP
20010 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20011 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20012 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20013 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20014 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20015 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20016 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20017 pub fn param<T>(mut self, name: T, value: T) -> ProductGetCall<'a, C>
20018 where
20019 T: AsRef<str>,
20020 {
20021 self._additional_params
20022 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20023 self
20024 }
20025
20026 /// Identifies the authorization scope for the method you are building.
20027 ///
20028 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20029 /// [`Scope::Full`].
20030 ///
20031 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20032 /// tokens for more than one scope.
20033 ///
20034 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20035 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20036 /// sufficient, a read-write scope will do as well.
20037 pub fn add_scope<St>(mut self, scope: St) -> ProductGetCall<'a, C>
20038 where
20039 St: AsRef<str>,
20040 {
20041 self._scopes.insert(String::from(scope.as_ref()));
20042 self
20043 }
20044 /// Identifies the authorization scope(s) for the method you are building.
20045 ///
20046 /// See [`Self::add_scope()`] for details.
20047 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProductGetCall<'a, C>
20048 where
20049 I: IntoIterator<Item = St>,
20050 St: AsRef<str>,
20051 {
20052 self._scopes
20053 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20054 self
20055 }
20056
20057 /// Removes all scopes, and no default scope will be used either.
20058 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20059 /// for details).
20060 pub fn clear_scopes(mut self) -> ProductGetCall<'a, C> {
20061 self._scopes.clear();
20062 self
20063 }
20064}
20065
20066/// Retrieves the schema that defines the configurable properties for this product. All products have a schema, but this schema may be empty if no managed configurations have been defined. This schema can be used to populate a UI that allows an admin to configure the product. To apply a managed configuration based on the schema obtained using this API, see Managed Configurations through Play.
20067///
20068/// A builder for the *getAppRestrictionsSchema* method supported by a *product* resource.
20069/// It is not used directly, but through a [`ProductMethods`] instance.
20070///
20071/// # Example
20072///
20073/// Instantiate a resource method builder
20074///
20075/// ```test_harness,no_run
20076/// # extern crate hyper;
20077/// # extern crate hyper_rustls;
20078/// # extern crate google_androidenterprise1 as androidenterprise1;
20079/// # async fn dox() {
20080/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20081///
20082/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20083/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20084/// # .with_native_roots()
20085/// # .unwrap()
20086/// # .https_only()
20087/// # .enable_http2()
20088/// # .build();
20089///
20090/// # let executor = hyper_util::rt::TokioExecutor::new();
20091/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20092/// # secret,
20093/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20094/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20095/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20096/// # ),
20097/// # ).build().await.unwrap();
20098///
20099/// # let client = hyper_util::client::legacy::Client::builder(
20100/// # hyper_util::rt::TokioExecutor::new()
20101/// # )
20102/// # .build(
20103/// # hyper_rustls::HttpsConnectorBuilder::new()
20104/// # .with_native_roots()
20105/// # .unwrap()
20106/// # .https_or_http()
20107/// # .enable_http2()
20108/// # .build()
20109/// # );
20110/// # let mut hub = AndroidEnterprise::new(client, auth);
20111/// // You can configure optional parameters by calling the respective setters at will, and
20112/// // execute the final call using `doit()`.
20113/// // Values shown here are possibly random and not representative !
20114/// let result = hub.products().get_app_restrictions_schema("enterpriseId", "productId")
20115/// .language("no")
20116/// .doit().await;
20117/// # }
20118/// ```
20119pub struct ProductGetAppRestrictionsSchemaCall<'a, C>
20120where
20121 C: 'a,
20122{
20123 hub: &'a AndroidEnterprise<C>,
20124 _enterprise_id: String,
20125 _product_id: String,
20126 _language: Option<String>,
20127 _delegate: Option<&'a mut dyn common::Delegate>,
20128 _additional_params: HashMap<String, String>,
20129 _scopes: BTreeSet<String>,
20130}
20131
20132impl<'a, C> common::CallBuilder for ProductGetAppRestrictionsSchemaCall<'a, C> {}
20133
20134impl<'a, C> ProductGetAppRestrictionsSchemaCall<'a, C>
20135where
20136 C: common::Connector,
20137{
20138 /// Perform the operation you have build so far.
20139 pub async fn doit(mut self) -> common::Result<(common::Response, AppRestrictionsSchema)> {
20140 use std::borrow::Cow;
20141 use std::io::{Read, Seek};
20142
20143 use common::{url::Params, ToParts};
20144 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20145
20146 let mut dd = common::DefaultDelegate;
20147 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20148 dlg.begin(common::MethodInfo {
20149 id: "androidenterprise.products.getAppRestrictionsSchema",
20150 http_method: hyper::Method::GET,
20151 });
20152
20153 for &field in ["alt", "enterpriseId", "productId", "language"].iter() {
20154 if self._additional_params.contains_key(field) {
20155 dlg.finished(false);
20156 return Err(common::Error::FieldClash(field));
20157 }
20158 }
20159
20160 let mut params = Params::with_capacity(5 + self._additional_params.len());
20161 params.push("enterpriseId", self._enterprise_id);
20162 params.push("productId", self._product_id);
20163 if let Some(value) = self._language.as_ref() {
20164 params.push("language", value);
20165 }
20166
20167 params.extend(self._additional_params.iter());
20168
20169 params.push("alt", "json");
20170 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/products/{productId}/appRestrictionsSchema";
20171 if self._scopes.is_empty() {
20172 self._scopes.insert(Scope::Full.as_ref().to_string());
20173 }
20174
20175 #[allow(clippy::single_element_loop)]
20176 for &(find_this, param_name) in [
20177 ("{enterpriseId}", "enterpriseId"),
20178 ("{productId}", "productId"),
20179 ]
20180 .iter()
20181 {
20182 url = params.uri_replacement(url, param_name, find_this, false);
20183 }
20184 {
20185 let to_remove = ["productId", "enterpriseId"];
20186 params.remove_params(&to_remove);
20187 }
20188
20189 let url = params.parse_with_url(&url);
20190
20191 loop {
20192 let token = match self
20193 .hub
20194 .auth
20195 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20196 .await
20197 {
20198 Ok(token) => token,
20199 Err(e) => match dlg.token(e) {
20200 Ok(token) => token,
20201 Err(e) => {
20202 dlg.finished(false);
20203 return Err(common::Error::MissingToken(e));
20204 }
20205 },
20206 };
20207 let mut req_result = {
20208 let client = &self.hub.client;
20209 dlg.pre_request();
20210 let mut req_builder = hyper::Request::builder()
20211 .method(hyper::Method::GET)
20212 .uri(url.as_str())
20213 .header(USER_AGENT, self.hub._user_agent.clone());
20214
20215 if let Some(token) = token.as_ref() {
20216 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20217 }
20218
20219 let request = req_builder
20220 .header(CONTENT_LENGTH, 0_u64)
20221 .body(common::to_body::<String>(None));
20222
20223 client.request(request.unwrap()).await
20224 };
20225
20226 match req_result {
20227 Err(err) => {
20228 if let common::Retry::After(d) = dlg.http_error(&err) {
20229 sleep(d).await;
20230 continue;
20231 }
20232 dlg.finished(false);
20233 return Err(common::Error::HttpError(err));
20234 }
20235 Ok(res) => {
20236 let (mut parts, body) = res.into_parts();
20237 let mut body = common::Body::new(body);
20238 if !parts.status.is_success() {
20239 let bytes = common::to_bytes(body).await.unwrap_or_default();
20240 let error = serde_json::from_str(&common::to_string(&bytes));
20241 let response = common::to_response(parts, bytes.into());
20242
20243 if let common::Retry::After(d) =
20244 dlg.http_failure(&response, error.as_ref().ok())
20245 {
20246 sleep(d).await;
20247 continue;
20248 }
20249
20250 dlg.finished(false);
20251
20252 return Err(match error {
20253 Ok(value) => common::Error::BadRequest(value),
20254 _ => common::Error::Failure(response),
20255 });
20256 }
20257 let response = {
20258 let bytes = common::to_bytes(body).await.unwrap_or_default();
20259 let encoded = common::to_string(&bytes);
20260 match serde_json::from_str(&encoded) {
20261 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20262 Err(error) => {
20263 dlg.response_json_decode_error(&encoded, &error);
20264 return Err(common::Error::JsonDecodeError(
20265 encoded.to_string(),
20266 error,
20267 ));
20268 }
20269 }
20270 };
20271
20272 dlg.finished(true);
20273 return Ok(response);
20274 }
20275 }
20276 }
20277 }
20278
20279 /// The ID of the enterprise.
20280 ///
20281 /// Sets the *enterprise id* path property to the given value.
20282 ///
20283 /// Even though the property as already been set when instantiating this call,
20284 /// we provide this method for API completeness.
20285 pub fn enterprise_id(mut self, new_value: &str) -> ProductGetAppRestrictionsSchemaCall<'a, C> {
20286 self._enterprise_id = new_value.to_string();
20287 self
20288 }
20289 /// The ID of the product.
20290 ///
20291 /// Sets the *product id* path property to the given value.
20292 ///
20293 /// Even though the property as already been set when instantiating this call,
20294 /// we provide this method for API completeness.
20295 pub fn product_id(mut self, new_value: &str) -> ProductGetAppRestrictionsSchemaCall<'a, C> {
20296 self._product_id = new_value.to_string();
20297 self
20298 }
20299 /// The BCP47 tag for the user's preferred language (e.g. "en-US", "de").
20300 ///
20301 /// Sets the *language* query property to the given value.
20302 pub fn language(mut self, new_value: &str) -> ProductGetAppRestrictionsSchemaCall<'a, C> {
20303 self._language = Some(new_value.to_string());
20304 self
20305 }
20306 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20307 /// while executing the actual API request.
20308 ///
20309 /// ````text
20310 /// It should be used to handle progress information, and to implement a certain level of resilience.
20311 /// ````
20312 ///
20313 /// Sets the *delegate* property to the given value.
20314 pub fn delegate(
20315 mut self,
20316 new_value: &'a mut dyn common::Delegate,
20317 ) -> ProductGetAppRestrictionsSchemaCall<'a, C> {
20318 self._delegate = Some(new_value);
20319 self
20320 }
20321
20322 /// Set any additional parameter of the query string used in the request.
20323 /// It should be used to set parameters which are not yet available through their own
20324 /// setters.
20325 ///
20326 /// Please note that this method must not be used to set any of the known parameters
20327 /// which have their own setter method. If done anyway, the request will fail.
20328 ///
20329 /// # Additional Parameters
20330 ///
20331 /// * *$.xgafv* (query-string) - V1 error format.
20332 /// * *access_token* (query-string) - OAuth access token.
20333 /// * *alt* (query-string) - Data format for response.
20334 /// * *callback* (query-string) - JSONP
20335 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20336 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20337 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20338 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20339 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20340 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20341 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20342 pub fn param<T>(mut self, name: T, value: T) -> ProductGetAppRestrictionsSchemaCall<'a, C>
20343 where
20344 T: AsRef<str>,
20345 {
20346 self._additional_params
20347 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20348 self
20349 }
20350
20351 /// Identifies the authorization scope for the method you are building.
20352 ///
20353 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20354 /// [`Scope::Full`].
20355 ///
20356 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20357 /// tokens for more than one scope.
20358 ///
20359 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20360 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20361 /// sufficient, a read-write scope will do as well.
20362 pub fn add_scope<St>(mut self, scope: St) -> ProductGetAppRestrictionsSchemaCall<'a, C>
20363 where
20364 St: AsRef<str>,
20365 {
20366 self._scopes.insert(String::from(scope.as_ref()));
20367 self
20368 }
20369 /// Identifies the authorization scope(s) for the method you are building.
20370 ///
20371 /// See [`Self::add_scope()`] for details.
20372 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProductGetAppRestrictionsSchemaCall<'a, C>
20373 where
20374 I: IntoIterator<Item = St>,
20375 St: AsRef<str>,
20376 {
20377 self._scopes
20378 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20379 self
20380 }
20381
20382 /// Removes all scopes, and no default scope will be used either.
20383 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20384 /// for details).
20385 pub fn clear_scopes(mut self) -> ProductGetAppRestrictionsSchemaCall<'a, C> {
20386 self._scopes.clear();
20387 self
20388 }
20389}
20390
20391/// Retrieves the Android app permissions required by this app.
20392///
20393/// A builder for the *getPermissions* method supported by a *product* resource.
20394/// It is not used directly, but through a [`ProductMethods`] instance.
20395///
20396/// # Example
20397///
20398/// Instantiate a resource method builder
20399///
20400/// ```test_harness,no_run
20401/// # extern crate hyper;
20402/// # extern crate hyper_rustls;
20403/// # extern crate google_androidenterprise1 as androidenterprise1;
20404/// # async fn dox() {
20405/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20406///
20407/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20408/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20409/// # .with_native_roots()
20410/// # .unwrap()
20411/// # .https_only()
20412/// # .enable_http2()
20413/// # .build();
20414///
20415/// # let executor = hyper_util::rt::TokioExecutor::new();
20416/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20417/// # secret,
20418/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20419/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20420/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20421/// # ),
20422/// # ).build().await.unwrap();
20423///
20424/// # let client = hyper_util::client::legacy::Client::builder(
20425/// # hyper_util::rt::TokioExecutor::new()
20426/// # )
20427/// # .build(
20428/// # hyper_rustls::HttpsConnectorBuilder::new()
20429/// # .with_native_roots()
20430/// # .unwrap()
20431/// # .https_or_http()
20432/// # .enable_http2()
20433/// # .build()
20434/// # );
20435/// # let mut hub = AndroidEnterprise::new(client, auth);
20436/// // You can configure optional parameters by calling the respective setters at will, and
20437/// // execute the final call using `doit()`.
20438/// // Values shown here are possibly random and not representative !
20439/// let result = hub.products().get_permissions("enterpriseId", "productId")
20440/// .doit().await;
20441/// # }
20442/// ```
20443pub struct ProductGetPermissionCall<'a, C>
20444where
20445 C: 'a,
20446{
20447 hub: &'a AndroidEnterprise<C>,
20448 _enterprise_id: String,
20449 _product_id: String,
20450 _delegate: Option<&'a mut dyn common::Delegate>,
20451 _additional_params: HashMap<String, String>,
20452 _scopes: BTreeSet<String>,
20453}
20454
20455impl<'a, C> common::CallBuilder for ProductGetPermissionCall<'a, C> {}
20456
20457impl<'a, C> ProductGetPermissionCall<'a, C>
20458where
20459 C: common::Connector,
20460{
20461 /// Perform the operation you have build so far.
20462 pub async fn doit(mut self) -> common::Result<(common::Response, ProductPermissions)> {
20463 use std::borrow::Cow;
20464 use std::io::{Read, Seek};
20465
20466 use common::{url::Params, ToParts};
20467 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20468
20469 let mut dd = common::DefaultDelegate;
20470 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20471 dlg.begin(common::MethodInfo {
20472 id: "androidenterprise.products.getPermissions",
20473 http_method: hyper::Method::GET,
20474 });
20475
20476 for &field in ["alt", "enterpriseId", "productId"].iter() {
20477 if self._additional_params.contains_key(field) {
20478 dlg.finished(false);
20479 return Err(common::Error::FieldClash(field));
20480 }
20481 }
20482
20483 let mut params = Params::with_capacity(4 + self._additional_params.len());
20484 params.push("enterpriseId", self._enterprise_id);
20485 params.push("productId", self._product_id);
20486
20487 params.extend(self._additional_params.iter());
20488
20489 params.push("alt", "json");
20490 let mut url = self.hub._base_url.clone()
20491 + "androidenterprise/v1/enterprises/{enterpriseId}/products/{productId}/permissions";
20492 if self._scopes.is_empty() {
20493 self._scopes.insert(Scope::Full.as_ref().to_string());
20494 }
20495
20496 #[allow(clippy::single_element_loop)]
20497 for &(find_this, param_name) in [
20498 ("{enterpriseId}", "enterpriseId"),
20499 ("{productId}", "productId"),
20500 ]
20501 .iter()
20502 {
20503 url = params.uri_replacement(url, param_name, find_this, false);
20504 }
20505 {
20506 let to_remove = ["productId", "enterpriseId"];
20507 params.remove_params(&to_remove);
20508 }
20509
20510 let url = params.parse_with_url(&url);
20511
20512 loop {
20513 let token = match self
20514 .hub
20515 .auth
20516 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20517 .await
20518 {
20519 Ok(token) => token,
20520 Err(e) => match dlg.token(e) {
20521 Ok(token) => token,
20522 Err(e) => {
20523 dlg.finished(false);
20524 return Err(common::Error::MissingToken(e));
20525 }
20526 },
20527 };
20528 let mut req_result = {
20529 let client = &self.hub.client;
20530 dlg.pre_request();
20531 let mut req_builder = hyper::Request::builder()
20532 .method(hyper::Method::GET)
20533 .uri(url.as_str())
20534 .header(USER_AGENT, self.hub._user_agent.clone());
20535
20536 if let Some(token) = token.as_ref() {
20537 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20538 }
20539
20540 let request = req_builder
20541 .header(CONTENT_LENGTH, 0_u64)
20542 .body(common::to_body::<String>(None));
20543
20544 client.request(request.unwrap()).await
20545 };
20546
20547 match req_result {
20548 Err(err) => {
20549 if let common::Retry::After(d) = dlg.http_error(&err) {
20550 sleep(d).await;
20551 continue;
20552 }
20553 dlg.finished(false);
20554 return Err(common::Error::HttpError(err));
20555 }
20556 Ok(res) => {
20557 let (mut parts, body) = res.into_parts();
20558 let mut body = common::Body::new(body);
20559 if !parts.status.is_success() {
20560 let bytes = common::to_bytes(body).await.unwrap_or_default();
20561 let error = serde_json::from_str(&common::to_string(&bytes));
20562 let response = common::to_response(parts, bytes.into());
20563
20564 if let common::Retry::After(d) =
20565 dlg.http_failure(&response, error.as_ref().ok())
20566 {
20567 sleep(d).await;
20568 continue;
20569 }
20570
20571 dlg.finished(false);
20572
20573 return Err(match error {
20574 Ok(value) => common::Error::BadRequest(value),
20575 _ => common::Error::Failure(response),
20576 });
20577 }
20578 let response = {
20579 let bytes = common::to_bytes(body).await.unwrap_or_default();
20580 let encoded = common::to_string(&bytes);
20581 match serde_json::from_str(&encoded) {
20582 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20583 Err(error) => {
20584 dlg.response_json_decode_error(&encoded, &error);
20585 return Err(common::Error::JsonDecodeError(
20586 encoded.to_string(),
20587 error,
20588 ));
20589 }
20590 }
20591 };
20592
20593 dlg.finished(true);
20594 return Ok(response);
20595 }
20596 }
20597 }
20598 }
20599
20600 /// The ID of the enterprise.
20601 ///
20602 /// Sets the *enterprise id* path property to the given value.
20603 ///
20604 /// Even though the property as already been set when instantiating this call,
20605 /// we provide this method for API completeness.
20606 pub fn enterprise_id(mut self, new_value: &str) -> ProductGetPermissionCall<'a, C> {
20607 self._enterprise_id = new_value.to_string();
20608 self
20609 }
20610 /// The ID of the product.
20611 ///
20612 /// Sets the *product id* path property to the given value.
20613 ///
20614 /// Even though the property as already been set when instantiating this call,
20615 /// we provide this method for API completeness.
20616 pub fn product_id(mut self, new_value: &str) -> ProductGetPermissionCall<'a, C> {
20617 self._product_id = new_value.to_string();
20618 self
20619 }
20620 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20621 /// while executing the actual API request.
20622 ///
20623 /// ````text
20624 /// It should be used to handle progress information, and to implement a certain level of resilience.
20625 /// ````
20626 ///
20627 /// Sets the *delegate* property to the given value.
20628 pub fn delegate(
20629 mut self,
20630 new_value: &'a mut dyn common::Delegate,
20631 ) -> ProductGetPermissionCall<'a, C> {
20632 self._delegate = Some(new_value);
20633 self
20634 }
20635
20636 /// Set any additional parameter of the query string used in the request.
20637 /// It should be used to set parameters which are not yet available through their own
20638 /// setters.
20639 ///
20640 /// Please note that this method must not be used to set any of the known parameters
20641 /// which have their own setter method. If done anyway, the request will fail.
20642 ///
20643 /// # Additional Parameters
20644 ///
20645 /// * *$.xgafv* (query-string) - V1 error format.
20646 /// * *access_token* (query-string) - OAuth access token.
20647 /// * *alt* (query-string) - Data format for response.
20648 /// * *callback* (query-string) - JSONP
20649 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20650 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20651 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20652 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20653 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20654 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20655 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20656 pub fn param<T>(mut self, name: T, value: T) -> ProductGetPermissionCall<'a, C>
20657 where
20658 T: AsRef<str>,
20659 {
20660 self._additional_params
20661 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20662 self
20663 }
20664
20665 /// Identifies the authorization scope for the method you are building.
20666 ///
20667 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20668 /// [`Scope::Full`].
20669 ///
20670 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20671 /// tokens for more than one scope.
20672 ///
20673 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20674 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20675 /// sufficient, a read-write scope will do as well.
20676 pub fn add_scope<St>(mut self, scope: St) -> ProductGetPermissionCall<'a, C>
20677 where
20678 St: AsRef<str>,
20679 {
20680 self._scopes.insert(String::from(scope.as_ref()));
20681 self
20682 }
20683 /// Identifies the authorization scope(s) for the method you are building.
20684 ///
20685 /// See [`Self::add_scope()`] for details.
20686 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProductGetPermissionCall<'a, C>
20687 where
20688 I: IntoIterator<Item = St>,
20689 St: AsRef<str>,
20690 {
20691 self._scopes
20692 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20693 self
20694 }
20695
20696 /// Removes all scopes, and no default scope will be used either.
20697 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20698 /// for details).
20699 pub fn clear_scopes(mut self) -> ProductGetPermissionCall<'a, C> {
20700 self._scopes.clear();
20701 self
20702 }
20703}
20704
20705/// Finds approved products that match a query, or all approved products if there is no query. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
20706///
20707/// A builder for the *list* method supported by a *product* resource.
20708/// It is not used directly, but through a [`ProductMethods`] instance.
20709///
20710/// # Example
20711///
20712/// Instantiate a resource method builder
20713///
20714/// ```test_harness,no_run
20715/// # extern crate hyper;
20716/// # extern crate hyper_rustls;
20717/// # extern crate google_androidenterprise1 as androidenterprise1;
20718/// # async fn dox() {
20719/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20720///
20721/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20722/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20723/// # .with_native_roots()
20724/// # .unwrap()
20725/// # .https_only()
20726/// # .enable_http2()
20727/// # .build();
20728///
20729/// # let executor = hyper_util::rt::TokioExecutor::new();
20730/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20731/// # secret,
20732/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20733/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20734/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20735/// # ),
20736/// # ).build().await.unwrap();
20737///
20738/// # let client = hyper_util::client::legacy::Client::builder(
20739/// # hyper_util::rt::TokioExecutor::new()
20740/// # )
20741/// # .build(
20742/// # hyper_rustls::HttpsConnectorBuilder::new()
20743/// # .with_native_roots()
20744/// # .unwrap()
20745/// # .https_or_http()
20746/// # .enable_http2()
20747/// # .build()
20748/// # );
20749/// # let mut hub = AndroidEnterprise::new(client, auth);
20750/// // You can configure optional parameters by calling the respective setters at will, and
20751/// // execute the final call using `doit()`.
20752/// // Values shown here are possibly random and not representative !
20753/// let result = hub.products().list("enterpriseId")
20754/// .token("aliquyam")
20755/// .query("dolores")
20756/// .max_results(6)
20757/// .language("erat")
20758/// .approved(false)
20759/// .doit().await;
20760/// # }
20761/// ```
20762pub struct ProductListCall<'a, C>
20763where
20764 C: 'a,
20765{
20766 hub: &'a AndroidEnterprise<C>,
20767 _enterprise_id: String,
20768 _token: Option<String>,
20769 _query: Option<String>,
20770 _max_results: Option<u32>,
20771 _language: Option<String>,
20772 _approved: Option<bool>,
20773 _delegate: Option<&'a mut dyn common::Delegate>,
20774 _additional_params: HashMap<String, String>,
20775 _scopes: BTreeSet<String>,
20776}
20777
20778impl<'a, C> common::CallBuilder for ProductListCall<'a, C> {}
20779
20780impl<'a, C> ProductListCall<'a, C>
20781where
20782 C: common::Connector,
20783{
20784 /// Perform the operation you have build so far.
20785 pub async fn doit(mut self) -> common::Result<(common::Response, ProductsListResponse)> {
20786 use std::borrow::Cow;
20787 use std::io::{Read, Seek};
20788
20789 use common::{url::Params, ToParts};
20790 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20791
20792 let mut dd = common::DefaultDelegate;
20793 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20794 dlg.begin(common::MethodInfo {
20795 id: "androidenterprise.products.list",
20796 http_method: hyper::Method::GET,
20797 });
20798
20799 for &field in [
20800 "alt",
20801 "enterpriseId",
20802 "token",
20803 "query",
20804 "maxResults",
20805 "language",
20806 "approved",
20807 ]
20808 .iter()
20809 {
20810 if self._additional_params.contains_key(field) {
20811 dlg.finished(false);
20812 return Err(common::Error::FieldClash(field));
20813 }
20814 }
20815
20816 let mut params = Params::with_capacity(8 + self._additional_params.len());
20817 params.push("enterpriseId", self._enterprise_id);
20818 if let Some(value) = self._token.as_ref() {
20819 params.push("token", value);
20820 }
20821 if let Some(value) = self._query.as_ref() {
20822 params.push("query", value);
20823 }
20824 if let Some(value) = self._max_results.as_ref() {
20825 params.push("maxResults", value.to_string());
20826 }
20827 if let Some(value) = self._language.as_ref() {
20828 params.push("language", value);
20829 }
20830 if let Some(value) = self._approved.as_ref() {
20831 params.push("approved", value.to_string());
20832 }
20833
20834 params.extend(self._additional_params.iter());
20835
20836 params.push("alt", "json");
20837 let mut url =
20838 self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/products";
20839 if self._scopes.is_empty() {
20840 self._scopes.insert(Scope::Full.as_ref().to_string());
20841 }
20842
20843 #[allow(clippy::single_element_loop)]
20844 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
20845 url = params.uri_replacement(url, param_name, find_this, false);
20846 }
20847 {
20848 let to_remove = ["enterpriseId"];
20849 params.remove_params(&to_remove);
20850 }
20851
20852 let url = params.parse_with_url(&url);
20853
20854 loop {
20855 let token = match self
20856 .hub
20857 .auth
20858 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20859 .await
20860 {
20861 Ok(token) => token,
20862 Err(e) => match dlg.token(e) {
20863 Ok(token) => token,
20864 Err(e) => {
20865 dlg.finished(false);
20866 return Err(common::Error::MissingToken(e));
20867 }
20868 },
20869 };
20870 let mut req_result = {
20871 let client = &self.hub.client;
20872 dlg.pre_request();
20873 let mut req_builder = hyper::Request::builder()
20874 .method(hyper::Method::GET)
20875 .uri(url.as_str())
20876 .header(USER_AGENT, self.hub._user_agent.clone());
20877
20878 if let Some(token) = token.as_ref() {
20879 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20880 }
20881
20882 let request = req_builder
20883 .header(CONTENT_LENGTH, 0_u64)
20884 .body(common::to_body::<String>(None));
20885
20886 client.request(request.unwrap()).await
20887 };
20888
20889 match req_result {
20890 Err(err) => {
20891 if let common::Retry::After(d) = dlg.http_error(&err) {
20892 sleep(d).await;
20893 continue;
20894 }
20895 dlg.finished(false);
20896 return Err(common::Error::HttpError(err));
20897 }
20898 Ok(res) => {
20899 let (mut parts, body) = res.into_parts();
20900 let mut body = common::Body::new(body);
20901 if !parts.status.is_success() {
20902 let bytes = common::to_bytes(body).await.unwrap_or_default();
20903 let error = serde_json::from_str(&common::to_string(&bytes));
20904 let response = common::to_response(parts, bytes.into());
20905
20906 if let common::Retry::After(d) =
20907 dlg.http_failure(&response, error.as_ref().ok())
20908 {
20909 sleep(d).await;
20910 continue;
20911 }
20912
20913 dlg.finished(false);
20914
20915 return Err(match error {
20916 Ok(value) => common::Error::BadRequest(value),
20917 _ => common::Error::Failure(response),
20918 });
20919 }
20920 let response = {
20921 let bytes = common::to_bytes(body).await.unwrap_or_default();
20922 let encoded = common::to_string(&bytes);
20923 match serde_json::from_str(&encoded) {
20924 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20925 Err(error) => {
20926 dlg.response_json_decode_error(&encoded, &error);
20927 return Err(common::Error::JsonDecodeError(
20928 encoded.to_string(),
20929 error,
20930 ));
20931 }
20932 }
20933 };
20934
20935 dlg.finished(true);
20936 return Ok(response);
20937 }
20938 }
20939 }
20940 }
20941
20942 /// The ID of the enterprise.
20943 ///
20944 /// Sets the *enterprise id* path property to the given value.
20945 ///
20946 /// Even though the property as already been set when instantiating this call,
20947 /// we provide this method for API completeness.
20948 pub fn enterprise_id(mut self, new_value: &str) -> ProductListCall<'a, C> {
20949 self._enterprise_id = new_value.to_string();
20950 self
20951 }
20952 /// Defines the token of the page to return, usually taken from TokenPagination. This can only be used if token paging is enabled.
20953 ///
20954 /// Sets the *token* query property to the given value.
20955 pub fn token(mut self, new_value: &str) -> ProductListCall<'a, C> {
20956 self._token = Some(new_value.to_string());
20957 self
20958 }
20959 /// The search query as typed in the Google Play store search box. If omitted, all approved apps will be returned (using the pagination parameters), including apps that are not available in the store (e.g. unpublished apps).
20960 ///
20961 /// Sets the *query* query property to the given value.
20962 pub fn query(mut self, new_value: &str) -> ProductListCall<'a, C> {
20963 self._query = Some(new_value.to_string());
20964 self
20965 }
20966 /// Defines how many results the list operation should return. The default number depends on the resource collection.
20967 ///
20968 /// Sets the *max results* query property to the given value.
20969 pub fn max_results(mut self, new_value: u32) -> ProductListCall<'a, C> {
20970 self._max_results = Some(new_value);
20971 self
20972 }
20973 /// The BCP47 tag for the user's preferred language (e.g. "en-US", "de"). Results are returned in the language best matching the preferred language.
20974 ///
20975 /// Sets the *language* query property to the given value.
20976 pub fn language(mut self, new_value: &str) -> ProductListCall<'a, C> {
20977 self._language = Some(new_value.to_string());
20978 self
20979 }
20980 /// Specifies whether to search among all products (false) or among only products that have been approved (true). Only "true" is supported, and should be specified.
20981 ///
20982 /// Sets the *approved* query property to the given value.
20983 pub fn approved(mut self, new_value: bool) -> ProductListCall<'a, C> {
20984 self._approved = Some(new_value);
20985 self
20986 }
20987 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20988 /// while executing the actual API request.
20989 ///
20990 /// ````text
20991 /// It should be used to handle progress information, and to implement a certain level of resilience.
20992 /// ````
20993 ///
20994 /// Sets the *delegate* property to the given value.
20995 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProductListCall<'a, C> {
20996 self._delegate = Some(new_value);
20997 self
20998 }
20999
21000 /// Set any additional parameter of the query string used in the request.
21001 /// It should be used to set parameters which are not yet available through their own
21002 /// setters.
21003 ///
21004 /// Please note that this method must not be used to set any of the known parameters
21005 /// which have their own setter method. If done anyway, the request will fail.
21006 ///
21007 /// # Additional Parameters
21008 ///
21009 /// * *$.xgafv* (query-string) - V1 error format.
21010 /// * *access_token* (query-string) - OAuth access token.
21011 /// * *alt* (query-string) - Data format for response.
21012 /// * *callback* (query-string) - JSONP
21013 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21014 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21015 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21016 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21017 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21018 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21019 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21020 pub fn param<T>(mut self, name: T, value: T) -> ProductListCall<'a, C>
21021 where
21022 T: AsRef<str>,
21023 {
21024 self._additional_params
21025 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21026 self
21027 }
21028
21029 /// Identifies the authorization scope for the method you are building.
21030 ///
21031 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21032 /// [`Scope::Full`].
21033 ///
21034 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21035 /// tokens for more than one scope.
21036 ///
21037 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21038 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21039 /// sufficient, a read-write scope will do as well.
21040 pub fn add_scope<St>(mut self, scope: St) -> ProductListCall<'a, C>
21041 where
21042 St: AsRef<str>,
21043 {
21044 self._scopes.insert(String::from(scope.as_ref()));
21045 self
21046 }
21047 /// Identifies the authorization scope(s) for the method you are building.
21048 ///
21049 /// See [`Self::add_scope()`] for details.
21050 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProductListCall<'a, C>
21051 where
21052 I: IntoIterator<Item = St>,
21053 St: AsRef<str>,
21054 {
21055 self._scopes
21056 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21057 self
21058 }
21059
21060 /// Removes all scopes, and no default scope will be used either.
21061 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21062 /// for details).
21063 pub fn clear_scopes(mut self) -> ProductListCall<'a, C> {
21064 self._scopes.clear();
21065 self
21066 }
21067}
21068
21069/// Unapproves the specified product (and the relevant app permissions, if any) **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
21070///
21071/// A builder for the *unapprove* method supported by a *product* resource.
21072/// It is not used directly, but through a [`ProductMethods`] instance.
21073///
21074/// # Example
21075///
21076/// Instantiate a resource method builder
21077///
21078/// ```test_harness,no_run
21079/// # extern crate hyper;
21080/// # extern crate hyper_rustls;
21081/// # extern crate google_androidenterprise1 as androidenterprise1;
21082/// # async fn dox() {
21083/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21084///
21085/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21086/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21087/// # .with_native_roots()
21088/// # .unwrap()
21089/// # .https_only()
21090/// # .enable_http2()
21091/// # .build();
21092///
21093/// # let executor = hyper_util::rt::TokioExecutor::new();
21094/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21095/// # secret,
21096/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21097/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21098/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21099/// # ),
21100/// # ).build().await.unwrap();
21101///
21102/// # let client = hyper_util::client::legacy::Client::builder(
21103/// # hyper_util::rt::TokioExecutor::new()
21104/// # )
21105/// # .build(
21106/// # hyper_rustls::HttpsConnectorBuilder::new()
21107/// # .with_native_roots()
21108/// # .unwrap()
21109/// # .https_or_http()
21110/// # .enable_http2()
21111/// # .build()
21112/// # );
21113/// # let mut hub = AndroidEnterprise::new(client, auth);
21114/// // You can configure optional parameters by calling the respective setters at will, and
21115/// // execute the final call using `doit()`.
21116/// // Values shown here are possibly random and not representative !
21117/// let result = hub.products().unapprove("enterpriseId", "productId")
21118/// .doit().await;
21119/// # }
21120/// ```
21121pub struct ProductUnapproveCall<'a, C>
21122where
21123 C: 'a,
21124{
21125 hub: &'a AndroidEnterprise<C>,
21126 _enterprise_id: String,
21127 _product_id: String,
21128 _delegate: Option<&'a mut dyn common::Delegate>,
21129 _additional_params: HashMap<String, String>,
21130 _scopes: BTreeSet<String>,
21131}
21132
21133impl<'a, C> common::CallBuilder for ProductUnapproveCall<'a, C> {}
21134
21135impl<'a, C> ProductUnapproveCall<'a, C>
21136where
21137 C: common::Connector,
21138{
21139 /// Perform the operation you have build so far.
21140 pub async fn doit(mut self) -> common::Result<common::Response> {
21141 use std::borrow::Cow;
21142 use std::io::{Read, Seek};
21143
21144 use common::{url::Params, ToParts};
21145 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21146
21147 let mut dd = common::DefaultDelegate;
21148 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21149 dlg.begin(common::MethodInfo {
21150 id: "androidenterprise.products.unapprove",
21151 http_method: hyper::Method::POST,
21152 });
21153
21154 for &field in ["enterpriseId", "productId"].iter() {
21155 if self._additional_params.contains_key(field) {
21156 dlg.finished(false);
21157 return Err(common::Error::FieldClash(field));
21158 }
21159 }
21160
21161 let mut params = Params::with_capacity(3 + self._additional_params.len());
21162 params.push("enterpriseId", self._enterprise_id);
21163 params.push("productId", self._product_id);
21164
21165 params.extend(self._additional_params.iter());
21166
21167 let mut url = self.hub._base_url.clone()
21168 + "androidenterprise/v1/enterprises/{enterpriseId}/products/{productId}/unapprove";
21169 if self._scopes.is_empty() {
21170 self._scopes.insert(Scope::Full.as_ref().to_string());
21171 }
21172
21173 #[allow(clippy::single_element_loop)]
21174 for &(find_this, param_name) in [
21175 ("{enterpriseId}", "enterpriseId"),
21176 ("{productId}", "productId"),
21177 ]
21178 .iter()
21179 {
21180 url = params.uri_replacement(url, param_name, find_this, false);
21181 }
21182 {
21183 let to_remove = ["productId", "enterpriseId"];
21184 params.remove_params(&to_remove);
21185 }
21186
21187 let url = params.parse_with_url(&url);
21188
21189 loop {
21190 let token = match self
21191 .hub
21192 .auth
21193 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21194 .await
21195 {
21196 Ok(token) => token,
21197 Err(e) => match dlg.token(e) {
21198 Ok(token) => token,
21199 Err(e) => {
21200 dlg.finished(false);
21201 return Err(common::Error::MissingToken(e));
21202 }
21203 },
21204 };
21205 let mut req_result = {
21206 let client = &self.hub.client;
21207 dlg.pre_request();
21208 let mut req_builder = hyper::Request::builder()
21209 .method(hyper::Method::POST)
21210 .uri(url.as_str())
21211 .header(USER_AGENT, self.hub._user_agent.clone());
21212
21213 if let Some(token) = token.as_ref() {
21214 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21215 }
21216
21217 let request = req_builder
21218 .header(CONTENT_LENGTH, 0_u64)
21219 .body(common::to_body::<String>(None));
21220
21221 client.request(request.unwrap()).await
21222 };
21223
21224 match req_result {
21225 Err(err) => {
21226 if let common::Retry::After(d) = dlg.http_error(&err) {
21227 sleep(d).await;
21228 continue;
21229 }
21230 dlg.finished(false);
21231 return Err(common::Error::HttpError(err));
21232 }
21233 Ok(res) => {
21234 let (mut parts, body) = res.into_parts();
21235 let mut body = common::Body::new(body);
21236 if !parts.status.is_success() {
21237 let bytes = common::to_bytes(body).await.unwrap_or_default();
21238 let error = serde_json::from_str(&common::to_string(&bytes));
21239 let response = common::to_response(parts, bytes.into());
21240
21241 if let common::Retry::After(d) =
21242 dlg.http_failure(&response, error.as_ref().ok())
21243 {
21244 sleep(d).await;
21245 continue;
21246 }
21247
21248 dlg.finished(false);
21249
21250 return Err(match error {
21251 Ok(value) => common::Error::BadRequest(value),
21252 _ => common::Error::Failure(response),
21253 });
21254 }
21255 let response = common::Response::from_parts(parts, body);
21256
21257 dlg.finished(true);
21258 return Ok(response);
21259 }
21260 }
21261 }
21262 }
21263
21264 /// The ID of the enterprise.
21265 ///
21266 /// Sets the *enterprise id* path property to the given value.
21267 ///
21268 /// Even though the property as already been set when instantiating this call,
21269 /// we provide this method for API completeness.
21270 pub fn enterprise_id(mut self, new_value: &str) -> ProductUnapproveCall<'a, C> {
21271 self._enterprise_id = new_value.to_string();
21272 self
21273 }
21274 /// The ID of the product.
21275 ///
21276 /// Sets the *product id* path property to the given value.
21277 ///
21278 /// Even though the property as already been set when instantiating this call,
21279 /// we provide this method for API completeness.
21280 pub fn product_id(mut self, new_value: &str) -> ProductUnapproveCall<'a, C> {
21281 self._product_id = new_value.to_string();
21282 self
21283 }
21284 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21285 /// while executing the actual API request.
21286 ///
21287 /// ````text
21288 /// It should be used to handle progress information, and to implement a certain level of resilience.
21289 /// ````
21290 ///
21291 /// Sets the *delegate* property to the given value.
21292 pub fn delegate(
21293 mut self,
21294 new_value: &'a mut dyn common::Delegate,
21295 ) -> ProductUnapproveCall<'a, C> {
21296 self._delegate = Some(new_value);
21297 self
21298 }
21299
21300 /// Set any additional parameter of the query string used in the request.
21301 /// It should be used to set parameters which are not yet available through their own
21302 /// setters.
21303 ///
21304 /// Please note that this method must not be used to set any of the known parameters
21305 /// which have their own setter method. If done anyway, the request will fail.
21306 ///
21307 /// # Additional Parameters
21308 ///
21309 /// * *$.xgafv* (query-string) - V1 error format.
21310 /// * *access_token* (query-string) - OAuth access token.
21311 /// * *alt* (query-string) - Data format for response.
21312 /// * *callback* (query-string) - JSONP
21313 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21314 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21315 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21316 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21317 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21318 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21319 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21320 pub fn param<T>(mut self, name: T, value: T) -> ProductUnapproveCall<'a, C>
21321 where
21322 T: AsRef<str>,
21323 {
21324 self._additional_params
21325 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21326 self
21327 }
21328
21329 /// Identifies the authorization scope for the method you are building.
21330 ///
21331 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21332 /// [`Scope::Full`].
21333 ///
21334 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21335 /// tokens for more than one scope.
21336 ///
21337 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21338 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21339 /// sufficient, a read-write scope will do as well.
21340 pub fn add_scope<St>(mut self, scope: St) -> ProductUnapproveCall<'a, C>
21341 where
21342 St: AsRef<str>,
21343 {
21344 self._scopes.insert(String::from(scope.as_ref()));
21345 self
21346 }
21347 /// Identifies the authorization scope(s) for the method you are building.
21348 ///
21349 /// See [`Self::add_scope()`] for details.
21350 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProductUnapproveCall<'a, C>
21351 where
21352 I: IntoIterator<Item = St>,
21353 St: AsRef<str>,
21354 {
21355 self._scopes
21356 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21357 self
21358 }
21359
21360 /// Removes all scopes, and no default scope will be used either.
21361 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21362 /// for details).
21363 pub fn clear_scopes(mut self) -> ProductUnapproveCall<'a, C> {
21364 self._scopes.clear();
21365 self
21366 }
21367}
21368
21369/// Removes and invalidates the specified credentials for the service account associated with this enterprise. The calling service account must have been retrieved by calling Enterprises.GetServiceAccount and must have been set as the enterprise service account by calling Enterprises.SetAccount.
21370///
21371/// A builder for the *delete* method supported by a *serviceaccountkey* resource.
21372/// It is not used directly, but through a [`ServiceaccountkeyMethods`] instance.
21373///
21374/// # Example
21375///
21376/// Instantiate a resource method builder
21377///
21378/// ```test_harness,no_run
21379/// # extern crate hyper;
21380/// # extern crate hyper_rustls;
21381/// # extern crate google_androidenterprise1 as androidenterprise1;
21382/// # async fn dox() {
21383/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21384///
21385/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21386/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21387/// # .with_native_roots()
21388/// # .unwrap()
21389/// # .https_only()
21390/// # .enable_http2()
21391/// # .build();
21392///
21393/// # let executor = hyper_util::rt::TokioExecutor::new();
21394/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21395/// # secret,
21396/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21397/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21398/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21399/// # ),
21400/// # ).build().await.unwrap();
21401///
21402/// # let client = hyper_util::client::legacy::Client::builder(
21403/// # hyper_util::rt::TokioExecutor::new()
21404/// # )
21405/// # .build(
21406/// # hyper_rustls::HttpsConnectorBuilder::new()
21407/// # .with_native_roots()
21408/// # .unwrap()
21409/// # .https_or_http()
21410/// # .enable_http2()
21411/// # .build()
21412/// # );
21413/// # let mut hub = AndroidEnterprise::new(client, auth);
21414/// // You can configure optional parameters by calling the respective setters at will, and
21415/// // execute the final call using `doit()`.
21416/// // Values shown here are possibly random and not representative !
21417/// let result = hub.serviceaccountkeys().delete("enterpriseId", "keyId")
21418/// .doit().await;
21419/// # }
21420/// ```
21421pub struct ServiceaccountkeyDeleteCall<'a, C>
21422where
21423 C: 'a,
21424{
21425 hub: &'a AndroidEnterprise<C>,
21426 _enterprise_id: String,
21427 _key_id: String,
21428 _delegate: Option<&'a mut dyn common::Delegate>,
21429 _additional_params: HashMap<String, String>,
21430 _scopes: BTreeSet<String>,
21431}
21432
21433impl<'a, C> common::CallBuilder for ServiceaccountkeyDeleteCall<'a, C> {}
21434
21435impl<'a, C> ServiceaccountkeyDeleteCall<'a, C>
21436where
21437 C: common::Connector,
21438{
21439 /// Perform the operation you have build so far.
21440 pub async fn doit(mut self) -> common::Result<common::Response> {
21441 use std::borrow::Cow;
21442 use std::io::{Read, Seek};
21443
21444 use common::{url::Params, ToParts};
21445 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21446
21447 let mut dd = common::DefaultDelegate;
21448 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21449 dlg.begin(common::MethodInfo {
21450 id: "androidenterprise.serviceaccountkeys.delete",
21451 http_method: hyper::Method::DELETE,
21452 });
21453
21454 for &field in ["enterpriseId", "keyId"].iter() {
21455 if self._additional_params.contains_key(field) {
21456 dlg.finished(false);
21457 return Err(common::Error::FieldClash(field));
21458 }
21459 }
21460
21461 let mut params = Params::with_capacity(3 + self._additional_params.len());
21462 params.push("enterpriseId", self._enterprise_id);
21463 params.push("keyId", self._key_id);
21464
21465 params.extend(self._additional_params.iter());
21466
21467 let mut url = self.hub._base_url.clone()
21468 + "androidenterprise/v1/enterprises/{enterpriseId}/serviceAccountKeys/{keyId}";
21469 if self._scopes.is_empty() {
21470 self._scopes.insert(Scope::Full.as_ref().to_string());
21471 }
21472
21473 #[allow(clippy::single_element_loop)]
21474 for &(find_this, param_name) in
21475 [("{enterpriseId}", "enterpriseId"), ("{keyId}", "keyId")].iter()
21476 {
21477 url = params.uri_replacement(url, param_name, find_this, false);
21478 }
21479 {
21480 let to_remove = ["keyId", "enterpriseId"];
21481 params.remove_params(&to_remove);
21482 }
21483
21484 let url = params.parse_with_url(&url);
21485
21486 loop {
21487 let token = match self
21488 .hub
21489 .auth
21490 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21491 .await
21492 {
21493 Ok(token) => token,
21494 Err(e) => match dlg.token(e) {
21495 Ok(token) => token,
21496 Err(e) => {
21497 dlg.finished(false);
21498 return Err(common::Error::MissingToken(e));
21499 }
21500 },
21501 };
21502 let mut req_result = {
21503 let client = &self.hub.client;
21504 dlg.pre_request();
21505 let mut req_builder = hyper::Request::builder()
21506 .method(hyper::Method::DELETE)
21507 .uri(url.as_str())
21508 .header(USER_AGENT, self.hub._user_agent.clone());
21509
21510 if let Some(token) = token.as_ref() {
21511 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21512 }
21513
21514 let request = req_builder
21515 .header(CONTENT_LENGTH, 0_u64)
21516 .body(common::to_body::<String>(None));
21517
21518 client.request(request.unwrap()).await
21519 };
21520
21521 match req_result {
21522 Err(err) => {
21523 if let common::Retry::After(d) = dlg.http_error(&err) {
21524 sleep(d).await;
21525 continue;
21526 }
21527 dlg.finished(false);
21528 return Err(common::Error::HttpError(err));
21529 }
21530 Ok(res) => {
21531 let (mut parts, body) = res.into_parts();
21532 let mut body = common::Body::new(body);
21533 if !parts.status.is_success() {
21534 let bytes = common::to_bytes(body).await.unwrap_or_default();
21535 let error = serde_json::from_str(&common::to_string(&bytes));
21536 let response = common::to_response(parts, bytes.into());
21537
21538 if let common::Retry::After(d) =
21539 dlg.http_failure(&response, error.as_ref().ok())
21540 {
21541 sleep(d).await;
21542 continue;
21543 }
21544
21545 dlg.finished(false);
21546
21547 return Err(match error {
21548 Ok(value) => common::Error::BadRequest(value),
21549 _ => common::Error::Failure(response),
21550 });
21551 }
21552 let response = common::Response::from_parts(parts, body);
21553
21554 dlg.finished(true);
21555 return Ok(response);
21556 }
21557 }
21558 }
21559 }
21560
21561 /// The ID of the enterprise.
21562 ///
21563 /// Sets the *enterprise id* path property to the given value.
21564 ///
21565 /// Even though the property as already been set when instantiating this call,
21566 /// we provide this method for API completeness.
21567 pub fn enterprise_id(mut self, new_value: &str) -> ServiceaccountkeyDeleteCall<'a, C> {
21568 self._enterprise_id = new_value.to_string();
21569 self
21570 }
21571 /// The ID of the key.
21572 ///
21573 /// Sets the *key id* path property to the given value.
21574 ///
21575 /// Even though the property as already been set when instantiating this call,
21576 /// we provide this method for API completeness.
21577 pub fn key_id(mut self, new_value: &str) -> ServiceaccountkeyDeleteCall<'a, C> {
21578 self._key_id = new_value.to_string();
21579 self
21580 }
21581 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21582 /// while executing the actual API request.
21583 ///
21584 /// ````text
21585 /// It should be used to handle progress information, and to implement a certain level of resilience.
21586 /// ````
21587 ///
21588 /// Sets the *delegate* property to the given value.
21589 pub fn delegate(
21590 mut self,
21591 new_value: &'a mut dyn common::Delegate,
21592 ) -> ServiceaccountkeyDeleteCall<'a, C> {
21593 self._delegate = Some(new_value);
21594 self
21595 }
21596
21597 /// Set any additional parameter of the query string used in the request.
21598 /// It should be used to set parameters which are not yet available through their own
21599 /// setters.
21600 ///
21601 /// Please note that this method must not be used to set any of the known parameters
21602 /// which have their own setter method. If done anyway, the request will fail.
21603 ///
21604 /// # Additional Parameters
21605 ///
21606 /// * *$.xgafv* (query-string) - V1 error format.
21607 /// * *access_token* (query-string) - OAuth access token.
21608 /// * *alt* (query-string) - Data format for response.
21609 /// * *callback* (query-string) - JSONP
21610 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21611 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21612 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21613 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21614 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21615 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21616 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21617 pub fn param<T>(mut self, name: T, value: T) -> ServiceaccountkeyDeleteCall<'a, C>
21618 where
21619 T: AsRef<str>,
21620 {
21621 self._additional_params
21622 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21623 self
21624 }
21625
21626 /// Identifies the authorization scope for the method you are building.
21627 ///
21628 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21629 /// [`Scope::Full`].
21630 ///
21631 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21632 /// tokens for more than one scope.
21633 ///
21634 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21635 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21636 /// sufficient, a read-write scope will do as well.
21637 pub fn add_scope<St>(mut self, scope: St) -> ServiceaccountkeyDeleteCall<'a, C>
21638 where
21639 St: AsRef<str>,
21640 {
21641 self._scopes.insert(String::from(scope.as_ref()));
21642 self
21643 }
21644 /// Identifies the authorization scope(s) for the method you are building.
21645 ///
21646 /// See [`Self::add_scope()`] for details.
21647 pub fn add_scopes<I, St>(mut self, scopes: I) -> ServiceaccountkeyDeleteCall<'a, C>
21648 where
21649 I: IntoIterator<Item = St>,
21650 St: AsRef<str>,
21651 {
21652 self._scopes
21653 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21654 self
21655 }
21656
21657 /// Removes all scopes, and no default scope will be used either.
21658 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21659 /// for details).
21660 pub fn clear_scopes(mut self) -> ServiceaccountkeyDeleteCall<'a, C> {
21661 self._scopes.clear();
21662 self
21663 }
21664}
21665
21666/// Generates new credentials for the service account associated with this enterprise. The calling service account must have been retrieved by calling Enterprises.GetServiceAccount and must have been set as the enterprise service account by calling Enterprises.SetAccount. Only the type of the key should be populated in the resource to be inserted.
21667///
21668/// A builder for the *insert* method supported by a *serviceaccountkey* resource.
21669/// It is not used directly, but through a [`ServiceaccountkeyMethods`] instance.
21670///
21671/// # Example
21672///
21673/// Instantiate a resource method builder
21674///
21675/// ```test_harness,no_run
21676/// # extern crate hyper;
21677/// # extern crate hyper_rustls;
21678/// # extern crate google_androidenterprise1 as androidenterprise1;
21679/// use androidenterprise1::api::ServiceAccountKey;
21680/// # async fn dox() {
21681/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21682///
21683/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21684/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21685/// # .with_native_roots()
21686/// # .unwrap()
21687/// # .https_only()
21688/// # .enable_http2()
21689/// # .build();
21690///
21691/// # let executor = hyper_util::rt::TokioExecutor::new();
21692/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21693/// # secret,
21694/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21695/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21696/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21697/// # ),
21698/// # ).build().await.unwrap();
21699///
21700/// # let client = hyper_util::client::legacy::Client::builder(
21701/// # hyper_util::rt::TokioExecutor::new()
21702/// # )
21703/// # .build(
21704/// # hyper_rustls::HttpsConnectorBuilder::new()
21705/// # .with_native_roots()
21706/// # .unwrap()
21707/// # .https_or_http()
21708/// # .enable_http2()
21709/// # .build()
21710/// # );
21711/// # let mut hub = AndroidEnterprise::new(client, auth);
21712/// // As the method needs a request, you would usually fill it with the desired information
21713/// // into the respective structure. Some of the parts shown here might not be applicable !
21714/// // Values shown here are possibly random and not representative !
21715/// let mut req = ServiceAccountKey::default();
21716///
21717/// // You can configure optional parameters by calling the respective setters at will, and
21718/// // execute the final call using `doit()`.
21719/// // Values shown here are possibly random and not representative !
21720/// let result = hub.serviceaccountkeys().insert(req, "enterpriseId")
21721/// .doit().await;
21722/// # }
21723/// ```
21724pub struct ServiceaccountkeyInsertCall<'a, C>
21725where
21726 C: 'a,
21727{
21728 hub: &'a AndroidEnterprise<C>,
21729 _request: ServiceAccountKey,
21730 _enterprise_id: String,
21731 _delegate: Option<&'a mut dyn common::Delegate>,
21732 _additional_params: HashMap<String, String>,
21733 _scopes: BTreeSet<String>,
21734}
21735
21736impl<'a, C> common::CallBuilder for ServiceaccountkeyInsertCall<'a, C> {}
21737
21738impl<'a, C> ServiceaccountkeyInsertCall<'a, C>
21739where
21740 C: common::Connector,
21741{
21742 /// Perform the operation you have build so far.
21743 pub async fn doit(mut self) -> common::Result<(common::Response, ServiceAccountKey)> {
21744 use std::borrow::Cow;
21745 use std::io::{Read, Seek};
21746
21747 use common::{url::Params, ToParts};
21748 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21749
21750 let mut dd = common::DefaultDelegate;
21751 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21752 dlg.begin(common::MethodInfo {
21753 id: "androidenterprise.serviceaccountkeys.insert",
21754 http_method: hyper::Method::POST,
21755 });
21756
21757 for &field in ["alt", "enterpriseId"].iter() {
21758 if self._additional_params.contains_key(field) {
21759 dlg.finished(false);
21760 return Err(common::Error::FieldClash(field));
21761 }
21762 }
21763
21764 let mut params = Params::with_capacity(4 + self._additional_params.len());
21765 params.push("enterpriseId", self._enterprise_id);
21766
21767 params.extend(self._additional_params.iter());
21768
21769 params.push("alt", "json");
21770 let mut url = self.hub._base_url.clone()
21771 + "androidenterprise/v1/enterprises/{enterpriseId}/serviceAccountKeys";
21772 if self._scopes.is_empty() {
21773 self._scopes.insert(Scope::Full.as_ref().to_string());
21774 }
21775
21776 #[allow(clippy::single_element_loop)]
21777 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
21778 url = params.uri_replacement(url, param_name, find_this, false);
21779 }
21780 {
21781 let to_remove = ["enterpriseId"];
21782 params.remove_params(&to_remove);
21783 }
21784
21785 let url = params.parse_with_url(&url);
21786
21787 let mut json_mime_type = mime::APPLICATION_JSON;
21788 let mut request_value_reader = {
21789 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21790 common::remove_json_null_values(&mut value);
21791 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21792 serde_json::to_writer(&mut dst, &value).unwrap();
21793 dst
21794 };
21795 let request_size = request_value_reader
21796 .seek(std::io::SeekFrom::End(0))
21797 .unwrap();
21798 request_value_reader
21799 .seek(std::io::SeekFrom::Start(0))
21800 .unwrap();
21801
21802 loop {
21803 let token = match self
21804 .hub
21805 .auth
21806 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21807 .await
21808 {
21809 Ok(token) => token,
21810 Err(e) => match dlg.token(e) {
21811 Ok(token) => token,
21812 Err(e) => {
21813 dlg.finished(false);
21814 return Err(common::Error::MissingToken(e));
21815 }
21816 },
21817 };
21818 request_value_reader
21819 .seek(std::io::SeekFrom::Start(0))
21820 .unwrap();
21821 let mut req_result = {
21822 let client = &self.hub.client;
21823 dlg.pre_request();
21824 let mut req_builder = hyper::Request::builder()
21825 .method(hyper::Method::POST)
21826 .uri(url.as_str())
21827 .header(USER_AGENT, self.hub._user_agent.clone());
21828
21829 if let Some(token) = token.as_ref() {
21830 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21831 }
21832
21833 let request = req_builder
21834 .header(CONTENT_TYPE, json_mime_type.to_string())
21835 .header(CONTENT_LENGTH, request_size as u64)
21836 .body(common::to_body(
21837 request_value_reader.get_ref().clone().into(),
21838 ));
21839
21840 client.request(request.unwrap()).await
21841 };
21842
21843 match req_result {
21844 Err(err) => {
21845 if let common::Retry::After(d) = dlg.http_error(&err) {
21846 sleep(d).await;
21847 continue;
21848 }
21849 dlg.finished(false);
21850 return Err(common::Error::HttpError(err));
21851 }
21852 Ok(res) => {
21853 let (mut parts, body) = res.into_parts();
21854 let mut body = common::Body::new(body);
21855 if !parts.status.is_success() {
21856 let bytes = common::to_bytes(body).await.unwrap_or_default();
21857 let error = serde_json::from_str(&common::to_string(&bytes));
21858 let response = common::to_response(parts, bytes.into());
21859
21860 if let common::Retry::After(d) =
21861 dlg.http_failure(&response, error.as_ref().ok())
21862 {
21863 sleep(d).await;
21864 continue;
21865 }
21866
21867 dlg.finished(false);
21868
21869 return Err(match error {
21870 Ok(value) => common::Error::BadRequest(value),
21871 _ => common::Error::Failure(response),
21872 });
21873 }
21874 let response = {
21875 let bytes = common::to_bytes(body).await.unwrap_or_default();
21876 let encoded = common::to_string(&bytes);
21877 match serde_json::from_str(&encoded) {
21878 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21879 Err(error) => {
21880 dlg.response_json_decode_error(&encoded, &error);
21881 return Err(common::Error::JsonDecodeError(
21882 encoded.to_string(),
21883 error,
21884 ));
21885 }
21886 }
21887 };
21888
21889 dlg.finished(true);
21890 return Ok(response);
21891 }
21892 }
21893 }
21894 }
21895
21896 ///
21897 /// Sets the *request* property to the given value.
21898 ///
21899 /// Even though the property as already been set when instantiating this call,
21900 /// we provide this method for API completeness.
21901 pub fn request(mut self, new_value: ServiceAccountKey) -> ServiceaccountkeyInsertCall<'a, C> {
21902 self._request = new_value;
21903 self
21904 }
21905 /// The ID of the enterprise.
21906 ///
21907 /// Sets the *enterprise id* path property to the given value.
21908 ///
21909 /// Even though the property as already been set when instantiating this call,
21910 /// we provide this method for API completeness.
21911 pub fn enterprise_id(mut self, new_value: &str) -> ServiceaccountkeyInsertCall<'a, C> {
21912 self._enterprise_id = new_value.to_string();
21913 self
21914 }
21915 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21916 /// while executing the actual API request.
21917 ///
21918 /// ````text
21919 /// It should be used to handle progress information, and to implement a certain level of resilience.
21920 /// ````
21921 ///
21922 /// Sets the *delegate* property to the given value.
21923 pub fn delegate(
21924 mut self,
21925 new_value: &'a mut dyn common::Delegate,
21926 ) -> ServiceaccountkeyInsertCall<'a, C> {
21927 self._delegate = Some(new_value);
21928 self
21929 }
21930
21931 /// Set any additional parameter of the query string used in the request.
21932 /// It should be used to set parameters which are not yet available through their own
21933 /// setters.
21934 ///
21935 /// Please note that this method must not be used to set any of the known parameters
21936 /// which have their own setter method. If done anyway, the request will fail.
21937 ///
21938 /// # Additional Parameters
21939 ///
21940 /// * *$.xgafv* (query-string) - V1 error format.
21941 /// * *access_token* (query-string) - OAuth access token.
21942 /// * *alt* (query-string) - Data format for response.
21943 /// * *callback* (query-string) - JSONP
21944 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21945 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21946 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21947 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21948 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21949 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21950 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21951 pub fn param<T>(mut self, name: T, value: T) -> ServiceaccountkeyInsertCall<'a, C>
21952 where
21953 T: AsRef<str>,
21954 {
21955 self._additional_params
21956 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21957 self
21958 }
21959
21960 /// Identifies the authorization scope for the method you are building.
21961 ///
21962 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21963 /// [`Scope::Full`].
21964 ///
21965 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21966 /// tokens for more than one scope.
21967 ///
21968 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21969 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21970 /// sufficient, a read-write scope will do as well.
21971 pub fn add_scope<St>(mut self, scope: St) -> ServiceaccountkeyInsertCall<'a, C>
21972 where
21973 St: AsRef<str>,
21974 {
21975 self._scopes.insert(String::from(scope.as_ref()));
21976 self
21977 }
21978 /// Identifies the authorization scope(s) for the method you are building.
21979 ///
21980 /// See [`Self::add_scope()`] for details.
21981 pub fn add_scopes<I, St>(mut self, scopes: I) -> ServiceaccountkeyInsertCall<'a, C>
21982 where
21983 I: IntoIterator<Item = St>,
21984 St: AsRef<str>,
21985 {
21986 self._scopes
21987 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21988 self
21989 }
21990
21991 /// Removes all scopes, and no default scope will be used either.
21992 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21993 /// for details).
21994 pub fn clear_scopes(mut self) -> ServiceaccountkeyInsertCall<'a, C> {
21995 self._scopes.clear();
21996 self
21997 }
21998}
21999
22000/// Lists all active credentials for the service account associated with this enterprise. Only the ID and key type are returned. The calling service account must have been retrieved by calling Enterprises.GetServiceAccount and must have been set as the enterprise service account by calling Enterprises.SetAccount.
22001///
22002/// A builder for the *list* method supported by a *serviceaccountkey* resource.
22003/// It is not used directly, but through a [`ServiceaccountkeyMethods`] instance.
22004///
22005/// # Example
22006///
22007/// Instantiate a resource method builder
22008///
22009/// ```test_harness,no_run
22010/// # extern crate hyper;
22011/// # extern crate hyper_rustls;
22012/// # extern crate google_androidenterprise1 as androidenterprise1;
22013/// # async fn dox() {
22014/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22015///
22016/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22017/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22018/// # .with_native_roots()
22019/// # .unwrap()
22020/// # .https_only()
22021/// # .enable_http2()
22022/// # .build();
22023///
22024/// # let executor = hyper_util::rt::TokioExecutor::new();
22025/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22026/// # secret,
22027/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22028/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22029/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22030/// # ),
22031/// # ).build().await.unwrap();
22032///
22033/// # let client = hyper_util::client::legacy::Client::builder(
22034/// # hyper_util::rt::TokioExecutor::new()
22035/// # )
22036/// # .build(
22037/// # hyper_rustls::HttpsConnectorBuilder::new()
22038/// # .with_native_roots()
22039/// # .unwrap()
22040/// # .https_or_http()
22041/// # .enable_http2()
22042/// # .build()
22043/// # );
22044/// # let mut hub = AndroidEnterprise::new(client, auth);
22045/// // You can configure optional parameters by calling the respective setters at will, and
22046/// // execute the final call using `doit()`.
22047/// // Values shown here are possibly random and not representative !
22048/// let result = hub.serviceaccountkeys().list("enterpriseId")
22049/// .doit().await;
22050/// # }
22051/// ```
22052pub struct ServiceaccountkeyListCall<'a, C>
22053where
22054 C: 'a,
22055{
22056 hub: &'a AndroidEnterprise<C>,
22057 _enterprise_id: String,
22058 _delegate: Option<&'a mut dyn common::Delegate>,
22059 _additional_params: HashMap<String, String>,
22060 _scopes: BTreeSet<String>,
22061}
22062
22063impl<'a, C> common::CallBuilder for ServiceaccountkeyListCall<'a, C> {}
22064
22065impl<'a, C> ServiceaccountkeyListCall<'a, C>
22066where
22067 C: common::Connector,
22068{
22069 /// Perform the operation you have build so far.
22070 pub async fn doit(
22071 mut self,
22072 ) -> common::Result<(common::Response, ServiceAccountKeysListResponse)> {
22073 use std::borrow::Cow;
22074 use std::io::{Read, Seek};
22075
22076 use common::{url::Params, ToParts};
22077 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22078
22079 let mut dd = common::DefaultDelegate;
22080 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22081 dlg.begin(common::MethodInfo {
22082 id: "androidenterprise.serviceaccountkeys.list",
22083 http_method: hyper::Method::GET,
22084 });
22085
22086 for &field in ["alt", "enterpriseId"].iter() {
22087 if self._additional_params.contains_key(field) {
22088 dlg.finished(false);
22089 return Err(common::Error::FieldClash(field));
22090 }
22091 }
22092
22093 let mut params = Params::with_capacity(3 + self._additional_params.len());
22094 params.push("enterpriseId", self._enterprise_id);
22095
22096 params.extend(self._additional_params.iter());
22097
22098 params.push("alt", "json");
22099 let mut url = self.hub._base_url.clone()
22100 + "androidenterprise/v1/enterprises/{enterpriseId}/serviceAccountKeys";
22101 if self._scopes.is_empty() {
22102 self._scopes.insert(Scope::Full.as_ref().to_string());
22103 }
22104
22105 #[allow(clippy::single_element_loop)]
22106 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
22107 url = params.uri_replacement(url, param_name, find_this, false);
22108 }
22109 {
22110 let to_remove = ["enterpriseId"];
22111 params.remove_params(&to_remove);
22112 }
22113
22114 let url = params.parse_with_url(&url);
22115
22116 loop {
22117 let token = match self
22118 .hub
22119 .auth
22120 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22121 .await
22122 {
22123 Ok(token) => token,
22124 Err(e) => match dlg.token(e) {
22125 Ok(token) => token,
22126 Err(e) => {
22127 dlg.finished(false);
22128 return Err(common::Error::MissingToken(e));
22129 }
22130 },
22131 };
22132 let mut req_result = {
22133 let client = &self.hub.client;
22134 dlg.pre_request();
22135 let mut req_builder = hyper::Request::builder()
22136 .method(hyper::Method::GET)
22137 .uri(url.as_str())
22138 .header(USER_AGENT, self.hub._user_agent.clone());
22139
22140 if let Some(token) = token.as_ref() {
22141 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22142 }
22143
22144 let request = req_builder
22145 .header(CONTENT_LENGTH, 0_u64)
22146 .body(common::to_body::<String>(None));
22147
22148 client.request(request.unwrap()).await
22149 };
22150
22151 match req_result {
22152 Err(err) => {
22153 if let common::Retry::After(d) = dlg.http_error(&err) {
22154 sleep(d).await;
22155 continue;
22156 }
22157 dlg.finished(false);
22158 return Err(common::Error::HttpError(err));
22159 }
22160 Ok(res) => {
22161 let (mut parts, body) = res.into_parts();
22162 let mut body = common::Body::new(body);
22163 if !parts.status.is_success() {
22164 let bytes = common::to_bytes(body).await.unwrap_or_default();
22165 let error = serde_json::from_str(&common::to_string(&bytes));
22166 let response = common::to_response(parts, bytes.into());
22167
22168 if let common::Retry::After(d) =
22169 dlg.http_failure(&response, error.as_ref().ok())
22170 {
22171 sleep(d).await;
22172 continue;
22173 }
22174
22175 dlg.finished(false);
22176
22177 return Err(match error {
22178 Ok(value) => common::Error::BadRequest(value),
22179 _ => common::Error::Failure(response),
22180 });
22181 }
22182 let response = {
22183 let bytes = common::to_bytes(body).await.unwrap_or_default();
22184 let encoded = common::to_string(&bytes);
22185 match serde_json::from_str(&encoded) {
22186 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22187 Err(error) => {
22188 dlg.response_json_decode_error(&encoded, &error);
22189 return Err(common::Error::JsonDecodeError(
22190 encoded.to_string(),
22191 error,
22192 ));
22193 }
22194 }
22195 };
22196
22197 dlg.finished(true);
22198 return Ok(response);
22199 }
22200 }
22201 }
22202 }
22203
22204 /// The ID of the enterprise.
22205 ///
22206 /// Sets the *enterprise id* path property to the given value.
22207 ///
22208 /// Even though the property as already been set when instantiating this call,
22209 /// we provide this method for API completeness.
22210 pub fn enterprise_id(mut self, new_value: &str) -> ServiceaccountkeyListCall<'a, C> {
22211 self._enterprise_id = new_value.to_string();
22212 self
22213 }
22214 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22215 /// while executing the actual API request.
22216 ///
22217 /// ````text
22218 /// It should be used to handle progress information, and to implement a certain level of resilience.
22219 /// ````
22220 ///
22221 /// Sets the *delegate* property to the given value.
22222 pub fn delegate(
22223 mut self,
22224 new_value: &'a mut dyn common::Delegate,
22225 ) -> ServiceaccountkeyListCall<'a, C> {
22226 self._delegate = Some(new_value);
22227 self
22228 }
22229
22230 /// Set any additional parameter of the query string used in the request.
22231 /// It should be used to set parameters which are not yet available through their own
22232 /// setters.
22233 ///
22234 /// Please note that this method must not be used to set any of the known parameters
22235 /// which have their own setter method. If done anyway, the request will fail.
22236 ///
22237 /// # Additional Parameters
22238 ///
22239 /// * *$.xgafv* (query-string) - V1 error format.
22240 /// * *access_token* (query-string) - OAuth access token.
22241 /// * *alt* (query-string) - Data format for response.
22242 /// * *callback* (query-string) - JSONP
22243 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22244 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22245 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22246 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22247 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22248 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22249 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22250 pub fn param<T>(mut self, name: T, value: T) -> ServiceaccountkeyListCall<'a, C>
22251 where
22252 T: AsRef<str>,
22253 {
22254 self._additional_params
22255 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22256 self
22257 }
22258
22259 /// Identifies the authorization scope for the method you are building.
22260 ///
22261 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22262 /// [`Scope::Full`].
22263 ///
22264 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22265 /// tokens for more than one scope.
22266 ///
22267 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22268 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22269 /// sufficient, a read-write scope will do as well.
22270 pub fn add_scope<St>(mut self, scope: St) -> ServiceaccountkeyListCall<'a, C>
22271 where
22272 St: AsRef<str>,
22273 {
22274 self._scopes.insert(String::from(scope.as_ref()));
22275 self
22276 }
22277 /// Identifies the authorization scope(s) for the method you are building.
22278 ///
22279 /// See [`Self::add_scope()`] for details.
22280 pub fn add_scopes<I, St>(mut self, scopes: I) -> ServiceaccountkeyListCall<'a, C>
22281 where
22282 I: IntoIterator<Item = St>,
22283 St: AsRef<str>,
22284 {
22285 self._scopes
22286 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22287 self
22288 }
22289
22290 /// Removes all scopes, and no default scope will be used either.
22291 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22292 /// for details).
22293 pub fn clear_scopes(mut self) -> ServiceaccountkeyListCall<'a, C> {
22294 self._scopes.clear();
22295 self
22296 }
22297}
22298
22299/// Deletes a cluster.
22300///
22301/// A builder for the *delete* method supported by a *storelayoutcluster* resource.
22302/// It is not used directly, but through a [`StorelayoutclusterMethods`] instance.
22303///
22304/// # Example
22305///
22306/// Instantiate a resource method builder
22307///
22308/// ```test_harness,no_run
22309/// # extern crate hyper;
22310/// # extern crate hyper_rustls;
22311/// # extern crate google_androidenterprise1 as androidenterprise1;
22312/// # async fn dox() {
22313/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22314///
22315/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22316/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22317/// # .with_native_roots()
22318/// # .unwrap()
22319/// # .https_only()
22320/// # .enable_http2()
22321/// # .build();
22322///
22323/// # let executor = hyper_util::rt::TokioExecutor::new();
22324/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22325/// # secret,
22326/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22327/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22328/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22329/// # ),
22330/// # ).build().await.unwrap();
22331///
22332/// # let client = hyper_util::client::legacy::Client::builder(
22333/// # hyper_util::rt::TokioExecutor::new()
22334/// # )
22335/// # .build(
22336/// # hyper_rustls::HttpsConnectorBuilder::new()
22337/// # .with_native_roots()
22338/// # .unwrap()
22339/// # .https_or_http()
22340/// # .enable_http2()
22341/// # .build()
22342/// # );
22343/// # let mut hub = AndroidEnterprise::new(client, auth);
22344/// // You can configure optional parameters by calling the respective setters at will, and
22345/// // execute the final call using `doit()`.
22346/// // Values shown here are possibly random and not representative !
22347/// let result = hub.storelayoutclusters().delete("enterpriseId", "pageId", "clusterId")
22348/// .doit().await;
22349/// # }
22350/// ```
22351pub struct StorelayoutclusterDeleteCall<'a, C>
22352where
22353 C: 'a,
22354{
22355 hub: &'a AndroidEnterprise<C>,
22356 _enterprise_id: String,
22357 _page_id: String,
22358 _cluster_id: String,
22359 _delegate: Option<&'a mut dyn common::Delegate>,
22360 _additional_params: HashMap<String, String>,
22361 _scopes: BTreeSet<String>,
22362}
22363
22364impl<'a, C> common::CallBuilder for StorelayoutclusterDeleteCall<'a, C> {}
22365
22366impl<'a, C> StorelayoutclusterDeleteCall<'a, C>
22367where
22368 C: common::Connector,
22369{
22370 /// Perform the operation you have build so far.
22371 pub async fn doit(mut self) -> common::Result<common::Response> {
22372 use std::borrow::Cow;
22373 use std::io::{Read, Seek};
22374
22375 use common::{url::Params, ToParts};
22376 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22377
22378 let mut dd = common::DefaultDelegate;
22379 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22380 dlg.begin(common::MethodInfo {
22381 id: "androidenterprise.storelayoutclusters.delete",
22382 http_method: hyper::Method::DELETE,
22383 });
22384
22385 for &field in ["enterpriseId", "pageId", "clusterId"].iter() {
22386 if self._additional_params.contains_key(field) {
22387 dlg.finished(false);
22388 return Err(common::Error::FieldClash(field));
22389 }
22390 }
22391
22392 let mut params = Params::with_capacity(4 + self._additional_params.len());
22393 params.push("enterpriseId", self._enterprise_id);
22394 params.push("pageId", self._page_id);
22395 params.push("clusterId", self._cluster_id);
22396
22397 params.extend(self._additional_params.iter());
22398
22399 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters/{clusterId}";
22400 if self._scopes.is_empty() {
22401 self._scopes.insert(Scope::Full.as_ref().to_string());
22402 }
22403
22404 #[allow(clippy::single_element_loop)]
22405 for &(find_this, param_name) in [
22406 ("{enterpriseId}", "enterpriseId"),
22407 ("{pageId}", "pageId"),
22408 ("{clusterId}", "clusterId"),
22409 ]
22410 .iter()
22411 {
22412 url = params.uri_replacement(url, param_name, find_this, false);
22413 }
22414 {
22415 let to_remove = ["clusterId", "pageId", "enterpriseId"];
22416 params.remove_params(&to_remove);
22417 }
22418
22419 let url = params.parse_with_url(&url);
22420
22421 loop {
22422 let token = match self
22423 .hub
22424 .auth
22425 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22426 .await
22427 {
22428 Ok(token) => token,
22429 Err(e) => match dlg.token(e) {
22430 Ok(token) => token,
22431 Err(e) => {
22432 dlg.finished(false);
22433 return Err(common::Error::MissingToken(e));
22434 }
22435 },
22436 };
22437 let mut req_result = {
22438 let client = &self.hub.client;
22439 dlg.pre_request();
22440 let mut req_builder = hyper::Request::builder()
22441 .method(hyper::Method::DELETE)
22442 .uri(url.as_str())
22443 .header(USER_AGENT, self.hub._user_agent.clone());
22444
22445 if let Some(token) = token.as_ref() {
22446 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22447 }
22448
22449 let request = req_builder
22450 .header(CONTENT_LENGTH, 0_u64)
22451 .body(common::to_body::<String>(None));
22452
22453 client.request(request.unwrap()).await
22454 };
22455
22456 match req_result {
22457 Err(err) => {
22458 if let common::Retry::After(d) = dlg.http_error(&err) {
22459 sleep(d).await;
22460 continue;
22461 }
22462 dlg.finished(false);
22463 return Err(common::Error::HttpError(err));
22464 }
22465 Ok(res) => {
22466 let (mut parts, body) = res.into_parts();
22467 let mut body = common::Body::new(body);
22468 if !parts.status.is_success() {
22469 let bytes = common::to_bytes(body).await.unwrap_or_default();
22470 let error = serde_json::from_str(&common::to_string(&bytes));
22471 let response = common::to_response(parts, bytes.into());
22472
22473 if let common::Retry::After(d) =
22474 dlg.http_failure(&response, error.as_ref().ok())
22475 {
22476 sleep(d).await;
22477 continue;
22478 }
22479
22480 dlg.finished(false);
22481
22482 return Err(match error {
22483 Ok(value) => common::Error::BadRequest(value),
22484 _ => common::Error::Failure(response),
22485 });
22486 }
22487 let response = common::Response::from_parts(parts, body);
22488
22489 dlg.finished(true);
22490 return Ok(response);
22491 }
22492 }
22493 }
22494 }
22495
22496 /// The ID of the enterprise.
22497 ///
22498 /// Sets the *enterprise id* path property to the given value.
22499 ///
22500 /// Even though the property as already been set when instantiating this call,
22501 /// we provide this method for API completeness.
22502 pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutclusterDeleteCall<'a, C> {
22503 self._enterprise_id = new_value.to_string();
22504 self
22505 }
22506 /// The ID of the page.
22507 ///
22508 /// Sets the *page id* path property to the given value.
22509 ///
22510 /// Even though the property as already been set when instantiating this call,
22511 /// we provide this method for API completeness.
22512 pub fn page_id(mut self, new_value: &str) -> StorelayoutclusterDeleteCall<'a, C> {
22513 self._page_id = new_value.to_string();
22514 self
22515 }
22516 /// The ID of the cluster.
22517 ///
22518 /// Sets the *cluster id* path property to the given value.
22519 ///
22520 /// Even though the property as already been set when instantiating this call,
22521 /// we provide this method for API completeness.
22522 pub fn cluster_id(mut self, new_value: &str) -> StorelayoutclusterDeleteCall<'a, C> {
22523 self._cluster_id = new_value.to_string();
22524 self
22525 }
22526 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22527 /// while executing the actual API request.
22528 ///
22529 /// ````text
22530 /// It should be used to handle progress information, and to implement a certain level of resilience.
22531 /// ````
22532 ///
22533 /// Sets the *delegate* property to the given value.
22534 pub fn delegate(
22535 mut self,
22536 new_value: &'a mut dyn common::Delegate,
22537 ) -> StorelayoutclusterDeleteCall<'a, C> {
22538 self._delegate = Some(new_value);
22539 self
22540 }
22541
22542 /// Set any additional parameter of the query string used in the request.
22543 /// It should be used to set parameters which are not yet available through their own
22544 /// setters.
22545 ///
22546 /// Please note that this method must not be used to set any of the known parameters
22547 /// which have their own setter method. If done anyway, the request will fail.
22548 ///
22549 /// # Additional Parameters
22550 ///
22551 /// * *$.xgafv* (query-string) - V1 error format.
22552 /// * *access_token* (query-string) - OAuth access token.
22553 /// * *alt* (query-string) - Data format for response.
22554 /// * *callback* (query-string) - JSONP
22555 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22556 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22557 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22558 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22559 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22560 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22561 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22562 pub fn param<T>(mut self, name: T, value: T) -> StorelayoutclusterDeleteCall<'a, C>
22563 where
22564 T: AsRef<str>,
22565 {
22566 self._additional_params
22567 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22568 self
22569 }
22570
22571 /// Identifies the authorization scope for the method you are building.
22572 ///
22573 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22574 /// [`Scope::Full`].
22575 ///
22576 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22577 /// tokens for more than one scope.
22578 ///
22579 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22580 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22581 /// sufficient, a read-write scope will do as well.
22582 pub fn add_scope<St>(mut self, scope: St) -> StorelayoutclusterDeleteCall<'a, C>
22583 where
22584 St: AsRef<str>,
22585 {
22586 self._scopes.insert(String::from(scope.as_ref()));
22587 self
22588 }
22589 /// Identifies the authorization scope(s) for the method you are building.
22590 ///
22591 /// See [`Self::add_scope()`] for details.
22592 pub fn add_scopes<I, St>(mut self, scopes: I) -> StorelayoutclusterDeleteCall<'a, C>
22593 where
22594 I: IntoIterator<Item = St>,
22595 St: AsRef<str>,
22596 {
22597 self._scopes
22598 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22599 self
22600 }
22601
22602 /// Removes all scopes, and no default scope will be used either.
22603 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22604 /// for details).
22605 pub fn clear_scopes(mut self) -> StorelayoutclusterDeleteCall<'a, C> {
22606 self._scopes.clear();
22607 self
22608 }
22609}
22610
22611/// Retrieves details of a cluster.
22612///
22613/// A builder for the *get* method supported by a *storelayoutcluster* resource.
22614/// It is not used directly, but through a [`StorelayoutclusterMethods`] instance.
22615///
22616/// # Example
22617///
22618/// Instantiate a resource method builder
22619///
22620/// ```test_harness,no_run
22621/// # extern crate hyper;
22622/// # extern crate hyper_rustls;
22623/// # extern crate google_androidenterprise1 as androidenterprise1;
22624/// # async fn dox() {
22625/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22626///
22627/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22628/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22629/// # .with_native_roots()
22630/// # .unwrap()
22631/// # .https_only()
22632/// # .enable_http2()
22633/// # .build();
22634///
22635/// # let executor = hyper_util::rt::TokioExecutor::new();
22636/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22637/// # secret,
22638/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22639/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22640/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22641/// # ),
22642/// # ).build().await.unwrap();
22643///
22644/// # let client = hyper_util::client::legacy::Client::builder(
22645/// # hyper_util::rt::TokioExecutor::new()
22646/// # )
22647/// # .build(
22648/// # hyper_rustls::HttpsConnectorBuilder::new()
22649/// # .with_native_roots()
22650/// # .unwrap()
22651/// # .https_or_http()
22652/// # .enable_http2()
22653/// # .build()
22654/// # );
22655/// # let mut hub = AndroidEnterprise::new(client, auth);
22656/// // You can configure optional parameters by calling the respective setters at will, and
22657/// // execute the final call using `doit()`.
22658/// // Values shown here are possibly random and not representative !
22659/// let result = hub.storelayoutclusters().get("enterpriseId", "pageId", "clusterId")
22660/// .doit().await;
22661/// # }
22662/// ```
22663pub struct StorelayoutclusterGetCall<'a, C>
22664where
22665 C: 'a,
22666{
22667 hub: &'a AndroidEnterprise<C>,
22668 _enterprise_id: String,
22669 _page_id: String,
22670 _cluster_id: String,
22671 _delegate: Option<&'a mut dyn common::Delegate>,
22672 _additional_params: HashMap<String, String>,
22673 _scopes: BTreeSet<String>,
22674}
22675
22676impl<'a, C> common::CallBuilder for StorelayoutclusterGetCall<'a, C> {}
22677
22678impl<'a, C> StorelayoutclusterGetCall<'a, C>
22679where
22680 C: common::Connector,
22681{
22682 /// Perform the operation you have build so far.
22683 pub async fn doit(mut self) -> common::Result<(common::Response, StoreCluster)> {
22684 use std::borrow::Cow;
22685 use std::io::{Read, Seek};
22686
22687 use common::{url::Params, ToParts};
22688 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22689
22690 let mut dd = common::DefaultDelegate;
22691 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22692 dlg.begin(common::MethodInfo {
22693 id: "androidenterprise.storelayoutclusters.get",
22694 http_method: hyper::Method::GET,
22695 });
22696
22697 for &field in ["alt", "enterpriseId", "pageId", "clusterId"].iter() {
22698 if self._additional_params.contains_key(field) {
22699 dlg.finished(false);
22700 return Err(common::Error::FieldClash(field));
22701 }
22702 }
22703
22704 let mut params = Params::with_capacity(5 + self._additional_params.len());
22705 params.push("enterpriseId", self._enterprise_id);
22706 params.push("pageId", self._page_id);
22707 params.push("clusterId", self._cluster_id);
22708
22709 params.extend(self._additional_params.iter());
22710
22711 params.push("alt", "json");
22712 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters/{clusterId}";
22713 if self._scopes.is_empty() {
22714 self._scopes.insert(Scope::Full.as_ref().to_string());
22715 }
22716
22717 #[allow(clippy::single_element_loop)]
22718 for &(find_this, param_name) in [
22719 ("{enterpriseId}", "enterpriseId"),
22720 ("{pageId}", "pageId"),
22721 ("{clusterId}", "clusterId"),
22722 ]
22723 .iter()
22724 {
22725 url = params.uri_replacement(url, param_name, find_this, false);
22726 }
22727 {
22728 let to_remove = ["clusterId", "pageId", "enterpriseId"];
22729 params.remove_params(&to_remove);
22730 }
22731
22732 let url = params.parse_with_url(&url);
22733
22734 loop {
22735 let token = match self
22736 .hub
22737 .auth
22738 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22739 .await
22740 {
22741 Ok(token) => token,
22742 Err(e) => match dlg.token(e) {
22743 Ok(token) => token,
22744 Err(e) => {
22745 dlg.finished(false);
22746 return Err(common::Error::MissingToken(e));
22747 }
22748 },
22749 };
22750 let mut req_result = {
22751 let client = &self.hub.client;
22752 dlg.pre_request();
22753 let mut req_builder = hyper::Request::builder()
22754 .method(hyper::Method::GET)
22755 .uri(url.as_str())
22756 .header(USER_AGENT, self.hub._user_agent.clone());
22757
22758 if let Some(token) = token.as_ref() {
22759 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22760 }
22761
22762 let request = req_builder
22763 .header(CONTENT_LENGTH, 0_u64)
22764 .body(common::to_body::<String>(None));
22765
22766 client.request(request.unwrap()).await
22767 };
22768
22769 match req_result {
22770 Err(err) => {
22771 if let common::Retry::After(d) = dlg.http_error(&err) {
22772 sleep(d).await;
22773 continue;
22774 }
22775 dlg.finished(false);
22776 return Err(common::Error::HttpError(err));
22777 }
22778 Ok(res) => {
22779 let (mut parts, body) = res.into_parts();
22780 let mut body = common::Body::new(body);
22781 if !parts.status.is_success() {
22782 let bytes = common::to_bytes(body).await.unwrap_or_default();
22783 let error = serde_json::from_str(&common::to_string(&bytes));
22784 let response = common::to_response(parts, bytes.into());
22785
22786 if let common::Retry::After(d) =
22787 dlg.http_failure(&response, error.as_ref().ok())
22788 {
22789 sleep(d).await;
22790 continue;
22791 }
22792
22793 dlg.finished(false);
22794
22795 return Err(match error {
22796 Ok(value) => common::Error::BadRequest(value),
22797 _ => common::Error::Failure(response),
22798 });
22799 }
22800 let response = {
22801 let bytes = common::to_bytes(body).await.unwrap_or_default();
22802 let encoded = common::to_string(&bytes);
22803 match serde_json::from_str(&encoded) {
22804 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22805 Err(error) => {
22806 dlg.response_json_decode_error(&encoded, &error);
22807 return Err(common::Error::JsonDecodeError(
22808 encoded.to_string(),
22809 error,
22810 ));
22811 }
22812 }
22813 };
22814
22815 dlg.finished(true);
22816 return Ok(response);
22817 }
22818 }
22819 }
22820 }
22821
22822 /// The ID of the enterprise.
22823 ///
22824 /// Sets the *enterprise id* path property to the given value.
22825 ///
22826 /// Even though the property as already been set when instantiating this call,
22827 /// we provide this method for API completeness.
22828 pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutclusterGetCall<'a, C> {
22829 self._enterprise_id = new_value.to_string();
22830 self
22831 }
22832 /// The ID of the page.
22833 ///
22834 /// Sets the *page id* path property to the given value.
22835 ///
22836 /// Even though the property as already been set when instantiating this call,
22837 /// we provide this method for API completeness.
22838 pub fn page_id(mut self, new_value: &str) -> StorelayoutclusterGetCall<'a, C> {
22839 self._page_id = new_value.to_string();
22840 self
22841 }
22842 /// The ID of the cluster.
22843 ///
22844 /// Sets the *cluster id* path property to the given value.
22845 ///
22846 /// Even though the property as already been set when instantiating this call,
22847 /// we provide this method for API completeness.
22848 pub fn cluster_id(mut self, new_value: &str) -> StorelayoutclusterGetCall<'a, C> {
22849 self._cluster_id = new_value.to_string();
22850 self
22851 }
22852 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22853 /// while executing the actual API request.
22854 ///
22855 /// ````text
22856 /// It should be used to handle progress information, and to implement a certain level of resilience.
22857 /// ````
22858 ///
22859 /// Sets the *delegate* property to the given value.
22860 pub fn delegate(
22861 mut self,
22862 new_value: &'a mut dyn common::Delegate,
22863 ) -> StorelayoutclusterGetCall<'a, C> {
22864 self._delegate = Some(new_value);
22865 self
22866 }
22867
22868 /// Set any additional parameter of the query string used in the request.
22869 /// It should be used to set parameters which are not yet available through their own
22870 /// setters.
22871 ///
22872 /// Please note that this method must not be used to set any of the known parameters
22873 /// which have their own setter method. If done anyway, the request will fail.
22874 ///
22875 /// # Additional Parameters
22876 ///
22877 /// * *$.xgafv* (query-string) - V1 error format.
22878 /// * *access_token* (query-string) - OAuth access token.
22879 /// * *alt* (query-string) - Data format for response.
22880 /// * *callback* (query-string) - JSONP
22881 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22882 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22883 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22884 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22885 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22886 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22887 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22888 pub fn param<T>(mut self, name: T, value: T) -> StorelayoutclusterGetCall<'a, C>
22889 where
22890 T: AsRef<str>,
22891 {
22892 self._additional_params
22893 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22894 self
22895 }
22896
22897 /// Identifies the authorization scope for the method you are building.
22898 ///
22899 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22900 /// [`Scope::Full`].
22901 ///
22902 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22903 /// tokens for more than one scope.
22904 ///
22905 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22906 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22907 /// sufficient, a read-write scope will do as well.
22908 pub fn add_scope<St>(mut self, scope: St) -> StorelayoutclusterGetCall<'a, C>
22909 where
22910 St: AsRef<str>,
22911 {
22912 self._scopes.insert(String::from(scope.as_ref()));
22913 self
22914 }
22915 /// Identifies the authorization scope(s) for the method you are building.
22916 ///
22917 /// See [`Self::add_scope()`] for details.
22918 pub fn add_scopes<I, St>(mut self, scopes: I) -> StorelayoutclusterGetCall<'a, C>
22919 where
22920 I: IntoIterator<Item = St>,
22921 St: AsRef<str>,
22922 {
22923 self._scopes
22924 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22925 self
22926 }
22927
22928 /// Removes all scopes, and no default scope will be used either.
22929 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22930 /// for details).
22931 pub fn clear_scopes(mut self) -> StorelayoutclusterGetCall<'a, C> {
22932 self._scopes.clear();
22933 self
22934 }
22935}
22936
22937/// Inserts a new cluster in a page.
22938///
22939/// A builder for the *insert* method supported by a *storelayoutcluster* resource.
22940/// It is not used directly, but through a [`StorelayoutclusterMethods`] instance.
22941///
22942/// # Example
22943///
22944/// Instantiate a resource method builder
22945///
22946/// ```test_harness,no_run
22947/// # extern crate hyper;
22948/// # extern crate hyper_rustls;
22949/// # extern crate google_androidenterprise1 as androidenterprise1;
22950/// use androidenterprise1::api::StoreCluster;
22951/// # async fn dox() {
22952/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22953///
22954/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22955/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22956/// # .with_native_roots()
22957/// # .unwrap()
22958/// # .https_only()
22959/// # .enable_http2()
22960/// # .build();
22961///
22962/// # let executor = hyper_util::rt::TokioExecutor::new();
22963/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22964/// # secret,
22965/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22966/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22967/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22968/// # ),
22969/// # ).build().await.unwrap();
22970///
22971/// # let client = hyper_util::client::legacy::Client::builder(
22972/// # hyper_util::rt::TokioExecutor::new()
22973/// # )
22974/// # .build(
22975/// # hyper_rustls::HttpsConnectorBuilder::new()
22976/// # .with_native_roots()
22977/// # .unwrap()
22978/// # .https_or_http()
22979/// # .enable_http2()
22980/// # .build()
22981/// # );
22982/// # let mut hub = AndroidEnterprise::new(client, auth);
22983/// // As the method needs a request, you would usually fill it with the desired information
22984/// // into the respective structure. Some of the parts shown here might not be applicable !
22985/// // Values shown here are possibly random and not representative !
22986/// let mut req = StoreCluster::default();
22987///
22988/// // You can configure optional parameters by calling the respective setters at will, and
22989/// // execute the final call using `doit()`.
22990/// // Values shown here are possibly random and not representative !
22991/// let result = hub.storelayoutclusters().insert(req, "enterpriseId", "pageId")
22992/// .doit().await;
22993/// # }
22994/// ```
22995pub struct StorelayoutclusterInsertCall<'a, C>
22996where
22997 C: 'a,
22998{
22999 hub: &'a AndroidEnterprise<C>,
23000 _request: StoreCluster,
23001 _enterprise_id: String,
23002 _page_id: String,
23003 _delegate: Option<&'a mut dyn common::Delegate>,
23004 _additional_params: HashMap<String, String>,
23005 _scopes: BTreeSet<String>,
23006}
23007
23008impl<'a, C> common::CallBuilder for StorelayoutclusterInsertCall<'a, C> {}
23009
23010impl<'a, C> StorelayoutclusterInsertCall<'a, C>
23011where
23012 C: common::Connector,
23013{
23014 /// Perform the operation you have build so far.
23015 pub async fn doit(mut self) -> common::Result<(common::Response, StoreCluster)> {
23016 use std::borrow::Cow;
23017 use std::io::{Read, Seek};
23018
23019 use common::{url::Params, ToParts};
23020 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23021
23022 let mut dd = common::DefaultDelegate;
23023 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23024 dlg.begin(common::MethodInfo {
23025 id: "androidenterprise.storelayoutclusters.insert",
23026 http_method: hyper::Method::POST,
23027 });
23028
23029 for &field in ["alt", "enterpriseId", "pageId"].iter() {
23030 if self._additional_params.contains_key(field) {
23031 dlg.finished(false);
23032 return Err(common::Error::FieldClash(field));
23033 }
23034 }
23035
23036 let mut params = Params::with_capacity(5 + self._additional_params.len());
23037 params.push("enterpriseId", self._enterprise_id);
23038 params.push("pageId", self._page_id);
23039
23040 params.extend(self._additional_params.iter());
23041
23042 params.push("alt", "json");
23043 let mut url = self.hub._base_url.clone()
23044 + "androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters";
23045 if self._scopes.is_empty() {
23046 self._scopes.insert(Scope::Full.as_ref().to_string());
23047 }
23048
23049 #[allow(clippy::single_element_loop)]
23050 for &(find_this, param_name) in
23051 [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId")].iter()
23052 {
23053 url = params.uri_replacement(url, param_name, find_this, false);
23054 }
23055 {
23056 let to_remove = ["pageId", "enterpriseId"];
23057 params.remove_params(&to_remove);
23058 }
23059
23060 let url = params.parse_with_url(&url);
23061
23062 let mut json_mime_type = mime::APPLICATION_JSON;
23063 let mut request_value_reader = {
23064 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23065 common::remove_json_null_values(&mut value);
23066 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23067 serde_json::to_writer(&mut dst, &value).unwrap();
23068 dst
23069 };
23070 let request_size = request_value_reader
23071 .seek(std::io::SeekFrom::End(0))
23072 .unwrap();
23073 request_value_reader
23074 .seek(std::io::SeekFrom::Start(0))
23075 .unwrap();
23076
23077 loop {
23078 let token = match self
23079 .hub
23080 .auth
23081 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23082 .await
23083 {
23084 Ok(token) => token,
23085 Err(e) => match dlg.token(e) {
23086 Ok(token) => token,
23087 Err(e) => {
23088 dlg.finished(false);
23089 return Err(common::Error::MissingToken(e));
23090 }
23091 },
23092 };
23093 request_value_reader
23094 .seek(std::io::SeekFrom::Start(0))
23095 .unwrap();
23096 let mut req_result = {
23097 let client = &self.hub.client;
23098 dlg.pre_request();
23099 let mut req_builder = hyper::Request::builder()
23100 .method(hyper::Method::POST)
23101 .uri(url.as_str())
23102 .header(USER_AGENT, self.hub._user_agent.clone());
23103
23104 if let Some(token) = token.as_ref() {
23105 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23106 }
23107
23108 let request = req_builder
23109 .header(CONTENT_TYPE, json_mime_type.to_string())
23110 .header(CONTENT_LENGTH, request_size as u64)
23111 .body(common::to_body(
23112 request_value_reader.get_ref().clone().into(),
23113 ));
23114
23115 client.request(request.unwrap()).await
23116 };
23117
23118 match req_result {
23119 Err(err) => {
23120 if let common::Retry::After(d) = dlg.http_error(&err) {
23121 sleep(d).await;
23122 continue;
23123 }
23124 dlg.finished(false);
23125 return Err(common::Error::HttpError(err));
23126 }
23127 Ok(res) => {
23128 let (mut parts, body) = res.into_parts();
23129 let mut body = common::Body::new(body);
23130 if !parts.status.is_success() {
23131 let bytes = common::to_bytes(body).await.unwrap_or_default();
23132 let error = serde_json::from_str(&common::to_string(&bytes));
23133 let response = common::to_response(parts, bytes.into());
23134
23135 if let common::Retry::After(d) =
23136 dlg.http_failure(&response, error.as_ref().ok())
23137 {
23138 sleep(d).await;
23139 continue;
23140 }
23141
23142 dlg.finished(false);
23143
23144 return Err(match error {
23145 Ok(value) => common::Error::BadRequest(value),
23146 _ => common::Error::Failure(response),
23147 });
23148 }
23149 let response = {
23150 let bytes = common::to_bytes(body).await.unwrap_or_default();
23151 let encoded = common::to_string(&bytes);
23152 match serde_json::from_str(&encoded) {
23153 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23154 Err(error) => {
23155 dlg.response_json_decode_error(&encoded, &error);
23156 return Err(common::Error::JsonDecodeError(
23157 encoded.to_string(),
23158 error,
23159 ));
23160 }
23161 }
23162 };
23163
23164 dlg.finished(true);
23165 return Ok(response);
23166 }
23167 }
23168 }
23169 }
23170
23171 ///
23172 /// Sets the *request* property to the given value.
23173 ///
23174 /// Even though the property as already been set when instantiating this call,
23175 /// we provide this method for API completeness.
23176 pub fn request(mut self, new_value: StoreCluster) -> StorelayoutclusterInsertCall<'a, C> {
23177 self._request = new_value;
23178 self
23179 }
23180 /// The ID of the enterprise.
23181 ///
23182 /// Sets the *enterprise id* path property to the given value.
23183 ///
23184 /// Even though the property as already been set when instantiating this call,
23185 /// we provide this method for API completeness.
23186 pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutclusterInsertCall<'a, C> {
23187 self._enterprise_id = new_value.to_string();
23188 self
23189 }
23190 /// The ID of the page.
23191 ///
23192 /// Sets the *page id* path property to the given value.
23193 ///
23194 /// Even though the property as already been set when instantiating this call,
23195 /// we provide this method for API completeness.
23196 pub fn page_id(mut self, new_value: &str) -> StorelayoutclusterInsertCall<'a, C> {
23197 self._page_id = new_value.to_string();
23198 self
23199 }
23200 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23201 /// while executing the actual API request.
23202 ///
23203 /// ````text
23204 /// It should be used to handle progress information, and to implement a certain level of resilience.
23205 /// ````
23206 ///
23207 /// Sets the *delegate* property to the given value.
23208 pub fn delegate(
23209 mut self,
23210 new_value: &'a mut dyn common::Delegate,
23211 ) -> StorelayoutclusterInsertCall<'a, C> {
23212 self._delegate = Some(new_value);
23213 self
23214 }
23215
23216 /// Set any additional parameter of the query string used in the request.
23217 /// It should be used to set parameters which are not yet available through their own
23218 /// setters.
23219 ///
23220 /// Please note that this method must not be used to set any of the known parameters
23221 /// which have their own setter method. If done anyway, the request will fail.
23222 ///
23223 /// # Additional Parameters
23224 ///
23225 /// * *$.xgafv* (query-string) - V1 error format.
23226 /// * *access_token* (query-string) - OAuth access token.
23227 /// * *alt* (query-string) - Data format for response.
23228 /// * *callback* (query-string) - JSONP
23229 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23230 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23231 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23232 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23233 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23234 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23235 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23236 pub fn param<T>(mut self, name: T, value: T) -> StorelayoutclusterInsertCall<'a, C>
23237 where
23238 T: AsRef<str>,
23239 {
23240 self._additional_params
23241 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23242 self
23243 }
23244
23245 /// Identifies the authorization scope for the method you are building.
23246 ///
23247 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23248 /// [`Scope::Full`].
23249 ///
23250 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23251 /// tokens for more than one scope.
23252 ///
23253 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23254 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23255 /// sufficient, a read-write scope will do as well.
23256 pub fn add_scope<St>(mut self, scope: St) -> StorelayoutclusterInsertCall<'a, C>
23257 where
23258 St: AsRef<str>,
23259 {
23260 self._scopes.insert(String::from(scope.as_ref()));
23261 self
23262 }
23263 /// Identifies the authorization scope(s) for the method you are building.
23264 ///
23265 /// See [`Self::add_scope()`] for details.
23266 pub fn add_scopes<I, St>(mut self, scopes: I) -> StorelayoutclusterInsertCall<'a, C>
23267 where
23268 I: IntoIterator<Item = St>,
23269 St: AsRef<str>,
23270 {
23271 self._scopes
23272 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23273 self
23274 }
23275
23276 /// Removes all scopes, and no default scope will be used either.
23277 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23278 /// for details).
23279 pub fn clear_scopes(mut self) -> StorelayoutclusterInsertCall<'a, C> {
23280 self._scopes.clear();
23281 self
23282 }
23283}
23284
23285/// Retrieves the details of all clusters on the specified page.
23286///
23287/// A builder for the *list* method supported by a *storelayoutcluster* resource.
23288/// It is not used directly, but through a [`StorelayoutclusterMethods`] instance.
23289///
23290/// # Example
23291///
23292/// Instantiate a resource method builder
23293///
23294/// ```test_harness,no_run
23295/// # extern crate hyper;
23296/// # extern crate hyper_rustls;
23297/// # extern crate google_androidenterprise1 as androidenterprise1;
23298/// # async fn dox() {
23299/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23300///
23301/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23302/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23303/// # .with_native_roots()
23304/// # .unwrap()
23305/// # .https_only()
23306/// # .enable_http2()
23307/// # .build();
23308///
23309/// # let executor = hyper_util::rt::TokioExecutor::new();
23310/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23311/// # secret,
23312/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23313/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23314/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23315/// # ),
23316/// # ).build().await.unwrap();
23317///
23318/// # let client = hyper_util::client::legacy::Client::builder(
23319/// # hyper_util::rt::TokioExecutor::new()
23320/// # )
23321/// # .build(
23322/// # hyper_rustls::HttpsConnectorBuilder::new()
23323/// # .with_native_roots()
23324/// # .unwrap()
23325/// # .https_or_http()
23326/// # .enable_http2()
23327/// # .build()
23328/// # );
23329/// # let mut hub = AndroidEnterprise::new(client, auth);
23330/// // You can configure optional parameters by calling the respective setters at will, and
23331/// // execute the final call using `doit()`.
23332/// // Values shown here are possibly random and not representative !
23333/// let result = hub.storelayoutclusters().list("enterpriseId", "pageId")
23334/// .doit().await;
23335/// # }
23336/// ```
23337pub struct StorelayoutclusterListCall<'a, C>
23338where
23339 C: 'a,
23340{
23341 hub: &'a AndroidEnterprise<C>,
23342 _enterprise_id: String,
23343 _page_id: String,
23344 _delegate: Option<&'a mut dyn common::Delegate>,
23345 _additional_params: HashMap<String, String>,
23346 _scopes: BTreeSet<String>,
23347}
23348
23349impl<'a, C> common::CallBuilder for StorelayoutclusterListCall<'a, C> {}
23350
23351impl<'a, C> StorelayoutclusterListCall<'a, C>
23352where
23353 C: common::Connector,
23354{
23355 /// Perform the operation you have build so far.
23356 pub async fn doit(
23357 mut self,
23358 ) -> common::Result<(common::Response, StoreLayoutClustersListResponse)> {
23359 use std::borrow::Cow;
23360 use std::io::{Read, Seek};
23361
23362 use common::{url::Params, ToParts};
23363 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23364
23365 let mut dd = common::DefaultDelegate;
23366 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23367 dlg.begin(common::MethodInfo {
23368 id: "androidenterprise.storelayoutclusters.list",
23369 http_method: hyper::Method::GET,
23370 });
23371
23372 for &field in ["alt", "enterpriseId", "pageId"].iter() {
23373 if self._additional_params.contains_key(field) {
23374 dlg.finished(false);
23375 return Err(common::Error::FieldClash(field));
23376 }
23377 }
23378
23379 let mut params = Params::with_capacity(4 + self._additional_params.len());
23380 params.push("enterpriseId", self._enterprise_id);
23381 params.push("pageId", self._page_id);
23382
23383 params.extend(self._additional_params.iter());
23384
23385 params.push("alt", "json");
23386 let mut url = self.hub._base_url.clone()
23387 + "androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters";
23388 if self._scopes.is_empty() {
23389 self._scopes.insert(Scope::Full.as_ref().to_string());
23390 }
23391
23392 #[allow(clippy::single_element_loop)]
23393 for &(find_this, param_name) in
23394 [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId")].iter()
23395 {
23396 url = params.uri_replacement(url, param_name, find_this, false);
23397 }
23398 {
23399 let to_remove = ["pageId", "enterpriseId"];
23400 params.remove_params(&to_remove);
23401 }
23402
23403 let url = params.parse_with_url(&url);
23404
23405 loop {
23406 let token = match self
23407 .hub
23408 .auth
23409 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23410 .await
23411 {
23412 Ok(token) => token,
23413 Err(e) => match dlg.token(e) {
23414 Ok(token) => token,
23415 Err(e) => {
23416 dlg.finished(false);
23417 return Err(common::Error::MissingToken(e));
23418 }
23419 },
23420 };
23421 let mut req_result = {
23422 let client = &self.hub.client;
23423 dlg.pre_request();
23424 let mut req_builder = hyper::Request::builder()
23425 .method(hyper::Method::GET)
23426 .uri(url.as_str())
23427 .header(USER_AGENT, self.hub._user_agent.clone());
23428
23429 if let Some(token) = token.as_ref() {
23430 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23431 }
23432
23433 let request = req_builder
23434 .header(CONTENT_LENGTH, 0_u64)
23435 .body(common::to_body::<String>(None));
23436
23437 client.request(request.unwrap()).await
23438 };
23439
23440 match req_result {
23441 Err(err) => {
23442 if let common::Retry::After(d) = dlg.http_error(&err) {
23443 sleep(d).await;
23444 continue;
23445 }
23446 dlg.finished(false);
23447 return Err(common::Error::HttpError(err));
23448 }
23449 Ok(res) => {
23450 let (mut parts, body) = res.into_parts();
23451 let mut body = common::Body::new(body);
23452 if !parts.status.is_success() {
23453 let bytes = common::to_bytes(body).await.unwrap_or_default();
23454 let error = serde_json::from_str(&common::to_string(&bytes));
23455 let response = common::to_response(parts, bytes.into());
23456
23457 if let common::Retry::After(d) =
23458 dlg.http_failure(&response, error.as_ref().ok())
23459 {
23460 sleep(d).await;
23461 continue;
23462 }
23463
23464 dlg.finished(false);
23465
23466 return Err(match error {
23467 Ok(value) => common::Error::BadRequest(value),
23468 _ => common::Error::Failure(response),
23469 });
23470 }
23471 let response = {
23472 let bytes = common::to_bytes(body).await.unwrap_or_default();
23473 let encoded = common::to_string(&bytes);
23474 match serde_json::from_str(&encoded) {
23475 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23476 Err(error) => {
23477 dlg.response_json_decode_error(&encoded, &error);
23478 return Err(common::Error::JsonDecodeError(
23479 encoded.to_string(),
23480 error,
23481 ));
23482 }
23483 }
23484 };
23485
23486 dlg.finished(true);
23487 return Ok(response);
23488 }
23489 }
23490 }
23491 }
23492
23493 /// The ID of the enterprise.
23494 ///
23495 /// Sets the *enterprise id* path property to the given value.
23496 ///
23497 /// Even though the property as already been set when instantiating this call,
23498 /// we provide this method for API completeness.
23499 pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutclusterListCall<'a, C> {
23500 self._enterprise_id = new_value.to_string();
23501 self
23502 }
23503 /// The ID of the page.
23504 ///
23505 /// Sets the *page id* path property to the given value.
23506 ///
23507 /// Even though the property as already been set when instantiating this call,
23508 /// we provide this method for API completeness.
23509 pub fn page_id(mut self, new_value: &str) -> StorelayoutclusterListCall<'a, C> {
23510 self._page_id = new_value.to_string();
23511 self
23512 }
23513 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23514 /// while executing the actual API request.
23515 ///
23516 /// ````text
23517 /// It should be used to handle progress information, and to implement a certain level of resilience.
23518 /// ````
23519 ///
23520 /// Sets the *delegate* property to the given value.
23521 pub fn delegate(
23522 mut self,
23523 new_value: &'a mut dyn common::Delegate,
23524 ) -> StorelayoutclusterListCall<'a, C> {
23525 self._delegate = Some(new_value);
23526 self
23527 }
23528
23529 /// Set any additional parameter of the query string used in the request.
23530 /// It should be used to set parameters which are not yet available through their own
23531 /// setters.
23532 ///
23533 /// Please note that this method must not be used to set any of the known parameters
23534 /// which have their own setter method. If done anyway, the request will fail.
23535 ///
23536 /// # Additional Parameters
23537 ///
23538 /// * *$.xgafv* (query-string) - V1 error format.
23539 /// * *access_token* (query-string) - OAuth access token.
23540 /// * *alt* (query-string) - Data format for response.
23541 /// * *callback* (query-string) - JSONP
23542 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23543 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23544 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23545 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23546 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23547 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23548 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23549 pub fn param<T>(mut self, name: T, value: T) -> StorelayoutclusterListCall<'a, C>
23550 where
23551 T: AsRef<str>,
23552 {
23553 self._additional_params
23554 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23555 self
23556 }
23557
23558 /// Identifies the authorization scope for the method you are building.
23559 ///
23560 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23561 /// [`Scope::Full`].
23562 ///
23563 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23564 /// tokens for more than one scope.
23565 ///
23566 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23567 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23568 /// sufficient, a read-write scope will do as well.
23569 pub fn add_scope<St>(mut self, scope: St) -> StorelayoutclusterListCall<'a, C>
23570 where
23571 St: AsRef<str>,
23572 {
23573 self._scopes.insert(String::from(scope.as_ref()));
23574 self
23575 }
23576 /// Identifies the authorization scope(s) for the method you are building.
23577 ///
23578 /// See [`Self::add_scope()`] for details.
23579 pub fn add_scopes<I, St>(mut self, scopes: I) -> StorelayoutclusterListCall<'a, C>
23580 where
23581 I: IntoIterator<Item = St>,
23582 St: AsRef<str>,
23583 {
23584 self._scopes
23585 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23586 self
23587 }
23588
23589 /// Removes all scopes, and no default scope will be used either.
23590 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23591 /// for details).
23592 pub fn clear_scopes(mut self) -> StorelayoutclusterListCall<'a, C> {
23593 self._scopes.clear();
23594 self
23595 }
23596}
23597
23598/// Updates a cluster.
23599///
23600/// A builder for the *update* method supported by a *storelayoutcluster* resource.
23601/// It is not used directly, but through a [`StorelayoutclusterMethods`] instance.
23602///
23603/// # Example
23604///
23605/// Instantiate a resource method builder
23606///
23607/// ```test_harness,no_run
23608/// # extern crate hyper;
23609/// # extern crate hyper_rustls;
23610/// # extern crate google_androidenterprise1 as androidenterprise1;
23611/// use androidenterprise1::api::StoreCluster;
23612/// # async fn dox() {
23613/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23614///
23615/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23616/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23617/// # .with_native_roots()
23618/// # .unwrap()
23619/// # .https_only()
23620/// # .enable_http2()
23621/// # .build();
23622///
23623/// # let executor = hyper_util::rt::TokioExecutor::new();
23624/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23625/// # secret,
23626/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23627/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23628/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23629/// # ),
23630/// # ).build().await.unwrap();
23631///
23632/// # let client = hyper_util::client::legacy::Client::builder(
23633/// # hyper_util::rt::TokioExecutor::new()
23634/// # )
23635/// # .build(
23636/// # hyper_rustls::HttpsConnectorBuilder::new()
23637/// # .with_native_roots()
23638/// # .unwrap()
23639/// # .https_or_http()
23640/// # .enable_http2()
23641/// # .build()
23642/// # );
23643/// # let mut hub = AndroidEnterprise::new(client, auth);
23644/// // As the method needs a request, you would usually fill it with the desired information
23645/// // into the respective structure. Some of the parts shown here might not be applicable !
23646/// // Values shown here are possibly random and not representative !
23647/// let mut req = StoreCluster::default();
23648///
23649/// // You can configure optional parameters by calling the respective setters at will, and
23650/// // execute the final call using `doit()`.
23651/// // Values shown here are possibly random and not representative !
23652/// let result = hub.storelayoutclusters().update(req, "enterpriseId", "pageId", "clusterId")
23653/// .doit().await;
23654/// # }
23655/// ```
23656pub struct StorelayoutclusterUpdateCall<'a, C>
23657where
23658 C: 'a,
23659{
23660 hub: &'a AndroidEnterprise<C>,
23661 _request: StoreCluster,
23662 _enterprise_id: String,
23663 _page_id: String,
23664 _cluster_id: String,
23665 _delegate: Option<&'a mut dyn common::Delegate>,
23666 _additional_params: HashMap<String, String>,
23667 _scopes: BTreeSet<String>,
23668}
23669
23670impl<'a, C> common::CallBuilder for StorelayoutclusterUpdateCall<'a, C> {}
23671
23672impl<'a, C> StorelayoutclusterUpdateCall<'a, C>
23673where
23674 C: common::Connector,
23675{
23676 /// Perform the operation you have build so far.
23677 pub async fn doit(mut self) -> common::Result<(common::Response, StoreCluster)> {
23678 use std::borrow::Cow;
23679 use std::io::{Read, Seek};
23680
23681 use common::{url::Params, ToParts};
23682 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23683
23684 let mut dd = common::DefaultDelegate;
23685 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23686 dlg.begin(common::MethodInfo {
23687 id: "androidenterprise.storelayoutclusters.update",
23688 http_method: hyper::Method::PUT,
23689 });
23690
23691 for &field in ["alt", "enterpriseId", "pageId", "clusterId"].iter() {
23692 if self._additional_params.contains_key(field) {
23693 dlg.finished(false);
23694 return Err(common::Error::FieldClash(field));
23695 }
23696 }
23697
23698 let mut params = Params::with_capacity(6 + self._additional_params.len());
23699 params.push("enterpriseId", self._enterprise_id);
23700 params.push("pageId", self._page_id);
23701 params.push("clusterId", self._cluster_id);
23702
23703 params.extend(self._additional_params.iter());
23704
23705 params.push("alt", "json");
23706 let mut url = self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters/{clusterId}";
23707 if self._scopes.is_empty() {
23708 self._scopes.insert(Scope::Full.as_ref().to_string());
23709 }
23710
23711 #[allow(clippy::single_element_loop)]
23712 for &(find_this, param_name) in [
23713 ("{enterpriseId}", "enterpriseId"),
23714 ("{pageId}", "pageId"),
23715 ("{clusterId}", "clusterId"),
23716 ]
23717 .iter()
23718 {
23719 url = params.uri_replacement(url, param_name, find_this, false);
23720 }
23721 {
23722 let to_remove = ["clusterId", "pageId", "enterpriseId"];
23723 params.remove_params(&to_remove);
23724 }
23725
23726 let url = params.parse_with_url(&url);
23727
23728 let mut json_mime_type = mime::APPLICATION_JSON;
23729 let mut request_value_reader = {
23730 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23731 common::remove_json_null_values(&mut value);
23732 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23733 serde_json::to_writer(&mut dst, &value).unwrap();
23734 dst
23735 };
23736 let request_size = request_value_reader
23737 .seek(std::io::SeekFrom::End(0))
23738 .unwrap();
23739 request_value_reader
23740 .seek(std::io::SeekFrom::Start(0))
23741 .unwrap();
23742
23743 loop {
23744 let token = match self
23745 .hub
23746 .auth
23747 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23748 .await
23749 {
23750 Ok(token) => token,
23751 Err(e) => match dlg.token(e) {
23752 Ok(token) => token,
23753 Err(e) => {
23754 dlg.finished(false);
23755 return Err(common::Error::MissingToken(e));
23756 }
23757 },
23758 };
23759 request_value_reader
23760 .seek(std::io::SeekFrom::Start(0))
23761 .unwrap();
23762 let mut req_result = {
23763 let client = &self.hub.client;
23764 dlg.pre_request();
23765 let mut req_builder = hyper::Request::builder()
23766 .method(hyper::Method::PUT)
23767 .uri(url.as_str())
23768 .header(USER_AGENT, self.hub._user_agent.clone());
23769
23770 if let Some(token) = token.as_ref() {
23771 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23772 }
23773
23774 let request = req_builder
23775 .header(CONTENT_TYPE, json_mime_type.to_string())
23776 .header(CONTENT_LENGTH, request_size as u64)
23777 .body(common::to_body(
23778 request_value_reader.get_ref().clone().into(),
23779 ));
23780
23781 client.request(request.unwrap()).await
23782 };
23783
23784 match req_result {
23785 Err(err) => {
23786 if let common::Retry::After(d) = dlg.http_error(&err) {
23787 sleep(d).await;
23788 continue;
23789 }
23790 dlg.finished(false);
23791 return Err(common::Error::HttpError(err));
23792 }
23793 Ok(res) => {
23794 let (mut parts, body) = res.into_parts();
23795 let mut body = common::Body::new(body);
23796 if !parts.status.is_success() {
23797 let bytes = common::to_bytes(body).await.unwrap_or_default();
23798 let error = serde_json::from_str(&common::to_string(&bytes));
23799 let response = common::to_response(parts, bytes.into());
23800
23801 if let common::Retry::After(d) =
23802 dlg.http_failure(&response, error.as_ref().ok())
23803 {
23804 sleep(d).await;
23805 continue;
23806 }
23807
23808 dlg.finished(false);
23809
23810 return Err(match error {
23811 Ok(value) => common::Error::BadRequest(value),
23812 _ => common::Error::Failure(response),
23813 });
23814 }
23815 let response = {
23816 let bytes = common::to_bytes(body).await.unwrap_or_default();
23817 let encoded = common::to_string(&bytes);
23818 match serde_json::from_str(&encoded) {
23819 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23820 Err(error) => {
23821 dlg.response_json_decode_error(&encoded, &error);
23822 return Err(common::Error::JsonDecodeError(
23823 encoded.to_string(),
23824 error,
23825 ));
23826 }
23827 }
23828 };
23829
23830 dlg.finished(true);
23831 return Ok(response);
23832 }
23833 }
23834 }
23835 }
23836
23837 ///
23838 /// Sets the *request* property to the given value.
23839 ///
23840 /// Even though the property as already been set when instantiating this call,
23841 /// we provide this method for API completeness.
23842 pub fn request(mut self, new_value: StoreCluster) -> StorelayoutclusterUpdateCall<'a, C> {
23843 self._request = new_value;
23844 self
23845 }
23846 /// The ID of the enterprise.
23847 ///
23848 /// Sets the *enterprise id* path property to the given value.
23849 ///
23850 /// Even though the property as already been set when instantiating this call,
23851 /// we provide this method for API completeness.
23852 pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutclusterUpdateCall<'a, C> {
23853 self._enterprise_id = new_value.to_string();
23854 self
23855 }
23856 /// The ID of the page.
23857 ///
23858 /// Sets the *page id* path property to the given value.
23859 ///
23860 /// Even though the property as already been set when instantiating this call,
23861 /// we provide this method for API completeness.
23862 pub fn page_id(mut self, new_value: &str) -> StorelayoutclusterUpdateCall<'a, C> {
23863 self._page_id = new_value.to_string();
23864 self
23865 }
23866 /// The ID of the cluster.
23867 ///
23868 /// Sets the *cluster id* path property to the given value.
23869 ///
23870 /// Even though the property as already been set when instantiating this call,
23871 /// we provide this method for API completeness.
23872 pub fn cluster_id(mut self, new_value: &str) -> StorelayoutclusterUpdateCall<'a, C> {
23873 self._cluster_id = new_value.to_string();
23874 self
23875 }
23876 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23877 /// while executing the actual API request.
23878 ///
23879 /// ````text
23880 /// It should be used to handle progress information, and to implement a certain level of resilience.
23881 /// ````
23882 ///
23883 /// Sets the *delegate* property to the given value.
23884 pub fn delegate(
23885 mut self,
23886 new_value: &'a mut dyn common::Delegate,
23887 ) -> StorelayoutclusterUpdateCall<'a, C> {
23888 self._delegate = Some(new_value);
23889 self
23890 }
23891
23892 /// Set any additional parameter of the query string used in the request.
23893 /// It should be used to set parameters which are not yet available through their own
23894 /// setters.
23895 ///
23896 /// Please note that this method must not be used to set any of the known parameters
23897 /// which have their own setter method. If done anyway, the request will fail.
23898 ///
23899 /// # Additional Parameters
23900 ///
23901 /// * *$.xgafv* (query-string) - V1 error format.
23902 /// * *access_token* (query-string) - OAuth access token.
23903 /// * *alt* (query-string) - Data format for response.
23904 /// * *callback* (query-string) - JSONP
23905 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23906 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23907 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23908 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23909 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23910 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23911 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23912 pub fn param<T>(mut self, name: T, value: T) -> StorelayoutclusterUpdateCall<'a, C>
23913 where
23914 T: AsRef<str>,
23915 {
23916 self._additional_params
23917 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23918 self
23919 }
23920
23921 /// Identifies the authorization scope for the method you are building.
23922 ///
23923 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23924 /// [`Scope::Full`].
23925 ///
23926 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23927 /// tokens for more than one scope.
23928 ///
23929 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23930 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23931 /// sufficient, a read-write scope will do as well.
23932 pub fn add_scope<St>(mut self, scope: St) -> StorelayoutclusterUpdateCall<'a, C>
23933 where
23934 St: AsRef<str>,
23935 {
23936 self._scopes.insert(String::from(scope.as_ref()));
23937 self
23938 }
23939 /// Identifies the authorization scope(s) for the method you are building.
23940 ///
23941 /// See [`Self::add_scope()`] for details.
23942 pub fn add_scopes<I, St>(mut self, scopes: I) -> StorelayoutclusterUpdateCall<'a, C>
23943 where
23944 I: IntoIterator<Item = St>,
23945 St: AsRef<str>,
23946 {
23947 self._scopes
23948 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23949 self
23950 }
23951
23952 /// Removes all scopes, and no default scope will be used either.
23953 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23954 /// for details).
23955 pub fn clear_scopes(mut self) -> StorelayoutclusterUpdateCall<'a, C> {
23956 self._scopes.clear();
23957 self
23958 }
23959}
23960
23961/// Deletes a store page.
23962///
23963/// A builder for the *delete* method supported by a *storelayoutpage* resource.
23964/// It is not used directly, but through a [`StorelayoutpageMethods`] instance.
23965///
23966/// # Example
23967///
23968/// Instantiate a resource method builder
23969///
23970/// ```test_harness,no_run
23971/// # extern crate hyper;
23972/// # extern crate hyper_rustls;
23973/// # extern crate google_androidenterprise1 as androidenterprise1;
23974/// # async fn dox() {
23975/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23976///
23977/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23978/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23979/// # .with_native_roots()
23980/// # .unwrap()
23981/// # .https_only()
23982/// # .enable_http2()
23983/// # .build();
23984///
23985/// # let executor = hyper_util::rt::TokioExecutor::new();
23986/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23987/// # secret,
23988/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23989/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23990/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23991/// # ),
23992/// # ).build().await.unwrap();
23993///
23994/// # let client = hyper_util::client::legacy::Client::builder(
23995/// # hyper_util::rt::TokioExecutor::new()
23996/// # )
23997/// # .build(
23998/// # hyper_rustls::HttpsConnectorBuilder::new()
23999/// # .with_native_roots()
24000/// # .unwrap()
24001/// # .https_or_http()
24002/// # .enable_http2()
24003/// # .build()
24004/// # );
24005/// # let mut hub = AndroidEnterprise::new(client, auth);
24006/// // You can configure optional parameters by calling the respective setters at will, and
24007/// // execute the final call using `doit()`.
24008/// // Values shown here are possibly random and not representative !
24009/// let result = hub.storelayoutpages().delete("enterpriseId", "pageId")
24010/// .doit().await;
24011/// # }
24012/// ```
24013pub struct StorelayoutpageDeleteCall<'a, C>
24014where
24015 C: 'a,
24016{
24017 hub: &'a AndroidEnterprise<C>,
24018 _enterprise_id: String,
24019 _page_id: String,
24020 _delegate: Option<&'a mut dyn common::Delegate>,
24021 _additional_params: HashMap<String, String>,
24022 _scopes: BTreeSet<String>,
24023}
24024
24025impl<'a, C> common::CallBuilder for StorelayoutpageDeleteCall<'a, C> {}
24026
24027impl<'a, C> StorelayoutpageDeleteCall<'a, C>
24028where
24029 C: common::Connector,
24030{
24031 /// Perform the operation you have build so far.
24032 pub async fn doit(mut self) -> common::Result<common::Response> {
24033 use std::borrow::Cow;
24034 use std::io::{Read, Seek};
24035
24036 use common::{url::Params, ToParts};
24037 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24038
24039 let mut dd = common::DefaultDelegate;
24040 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24041 dlg.begin(common::MethodInfo {
24042 id: "androidenterprise.storelayoutpages.delete",
24043 http_method: hyper::Method::DELETE,
24044 });
24045
24046 for &field in ["enterpriseId", "pageId"].iter() {
24047 if self._additional_params.contains_key(field) {
24048 dlg.finished(false);
24049 return Err(common::Error::FieldClash(field));
24050 }
24051 }
24052
24053 let mut params = Params::with_capacity(3 + self._additional_params.len());
24054 params.push("enterpriseId", self._enterprise_id);
24055 params.push("pageId", self._page_id);
24056
24057 params.extend(self._additional_params.iter());
24058
24059 let mut url = self.hub._base_url.clone()
24060 + "androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}";
24061 if self._scopes.is_empty() {
24062 self._scopes.insert(Scope::Full.as_ref().to_string());
24063 }
24064
24065 #[allow(clippy::single_element_loop)]
24066 for &(find_this, param_name) in
24067 [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId")].iter()
24068 {
24069 url = params.uri_replacement(url, param_name, find_this, false);
24070 }
24071 {
24072 let to_remove = ["pageId", "enterpriseId"];
24073 params.remove_params(&to_remove);
24074 }
24075
24076 let url = params.parse_with_url(&url);
24077
24078 loop {
24079 let token = match self
24080 .hub
24081 .auth
24082 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24083 .await
24084 {
24085 Ok(token) => token,
24086 Err(e) => match dlg.token(e) {
24087 Ok(token) => token,
24088 Err(e) => {
24089 dlg.finished(false);
24090 return Err(common::Error::MissingToken(e));
24091 }
24092 },
24093 };
24094 let mut req_result = {
24095 let client = &self.hub.client;
24096 dlg.pre_request();
24097 let mut req_builder = hyper::Request::builder()
24098 .method(hyper::Method::DELETE)
24099 .uri(url.as_str())
24100 .header(USER_AGENT, self.hub._user_agent.clone());
24101
24102 if let Some(token) = token.as_ref() {
24103 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24104 }
24105
24106 let request = req_builder
24107 .header(CONTENT_LENGTH, 0_u64)
24108 .body(common::to_body::<String>(None));
24109
24110 client.request(request.unwrap()).await
24111 };
24112
24113 match req_result {
24114 Err(err) => {
24115 if let common::Retry::After(d) = dlg.http_error(&err) {
24116 sleep(d).await;
24117 continue;
24118 }
24119 dlg.finished(false);
24120 return Err(common::Error::HttpError(err));
24121 }
24122 Ok(res) => {
24123 let (mut parts, body) = res.into_parts();
24124 let mut body = common::Body::new(body);
24125 if !parts.status.is_success() {
24126 let bytes = common::to_bytes(body).await.unwrap_or_default();
24127 let error = serde_json::from_str(&common::to_string(&bytes));
24128 let response = common::to_response(parts, bytes.into());
24129
24130 if let common::Retry::After(d) =
24131 dlg.http_failure(&response, error.as_ref().ok())
24132 {
24133 sleep(d).await;
24134 continue;
24135 }
24136
24137 dlg.finished(false);
24138
24139 return Err(match error {
24140 Ok(value) => common::Error::BadRequest(value),
24141 _ => common::Error::Failure(response),
24142 });
24143 }
24144 let response = common::Response::from_parts(parts, body);
24145
24146 dlg.finished(true);
24147 return Ok(response);
24148 }
24149 }
24150 }
24151 }
24152
24153 /// The ID of the enterprise.
24154 ///
24155 /// Sets the *enterprise id* path property to the given value.
24156 ///
24157 /// Even though the property as already been set when instantiating this call,
24158 /// we provide this method for API completeness.
24159 pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutpageDeleteCall<'a, C> {
24160 self._enterprise_id = new_value.to_string();
24161 self
24162 }
24163 /// The ID of the page.
24164 ///
24165 /// Sets the *page id* path property to the given value.
24166 ///
24167 /// Even though the property as already been set when instantiating this call,
24168 /// we provide this method for API completeness.
24169 pub fn page_id(mut self, new_value: &str) -> StorelayoutpageDeleteCall<'a, C> {
24170 self._page_id = new_value.to_string();
24171 self
24172 }
24173 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24174 /// while executing the actual API request.
24175 ///
24176 /// ````text
24177 /// It should be used to handle progress information, and to implement a certain level of resilience.
24178 /// ````
24179 ///
24180 /// Sets the *delegate* property to the given value.
24181 pub fn delegate(
24182 mut self,
24183 new_value: &'a mut dyn common::Delegate,
24184 ) -> StorelayoutpageDeleteCall<'a, C> {
24185 self._delegate = Some(new_value);
24186 self
24187 }
24188
24189 /// Set any additional parameter of the query string used in the request.
24190 /// It should be used to set parameters which are not yet available through their own
24191 /// setters.
24192 ///
24193 /// Please note that this method must not be used to set any of the known parameters
24194 /// which have their own setter method. If done anyway, the request will fail.
24195 ///
24196 /// # Additional Parameters
24197 ///
24198 /// * *$.xgafv* (query-string) - V1 error format.
24199 /// * *access_token* (query-string) - OAuth access token.
24200 /// * *alt* (query-string) - Data format for response.
24201 /// * *callback* (query-string) - JSONP
24202 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24203 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24204 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24205 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24206 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24207 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24208 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24209 pub fn param<T>(mut self, name: T, value: T) -> StorelayoutpageDeleteCall<'a, C>
24210 where
24211 T: AsRef<str>,
24212 {
24213 self._additional_params
24214 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24215 self
24216 }
24217
24218 /// Identifies the authorization scope for the method you are building.
24219 ///
24220 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24221 /// [`Scope::Full`].
24222 ///
24223 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24224 /// tokens for more than one scope.
24225 ///
24226 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24227 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24228 /// sufficient, a read-write scope will do as well.
24229 pub fn add_scope<St>(mut self, scope: St) -> StorelayoutpageDeleteCall<'a, C>
24230 where
24231 St: AsRef<str>,
24232 {
24233 self._scopes.insert(String::from(scope.as_ref()));
24234 self
24235 }
24236 /// Identifies the authorization scope(s) for the method you are building.
24237 ///
24238 /// See [`Self::add_scope()`] for details.
24239 pub fn add_scopes<I, St>(mut self, scopes: I) -> StorelayoutpageDeleteCall<'a, C>
24240 where
24241 I: IntoIterator<Item = St>,
24242 St: AsRef<str>,
24243 {
24244 self._scopes
24245 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24246 self
24247 }
24248
24249 /// Removes all scopes, and no default scope will be used either.
24250 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24251 /// for details).
24252 pub fn clear_scopes(mut self) -> StorelayoutpageDeleteCall<'a, C> {
24253 self._scopes.clear();
24254 self
24255 }
24256}
24257
24258/// Retrieves details of a store page.
24259///
24260/// A builder for the *get* method supported by a *storelayoutpage* resource.
24261/// It is not used directly, but through a [`StorelayoutpageMethods`] instance.
24262///
24263/// # Example
24264///
24265/// Instantiate a resource method builder
24266///
24267/// ```test_harness,no_run
24268/// # extern crate hyper;
24269/// # extern crate hyper_rustls;
24270/// # extern crate google_androidenterprise1 as androidenterprise1;
24271/// # async fn dox() {
24272/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24273///
24274/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24275/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24276/// # .with_native_roots()
24277/// # .unwrap()
24278/// # .https_only()
24279/// # .enable_http2()
24280/// # .build();
24281///
24282/// # let executor = hyper_util::rt::TokioExecutor::new();
24283/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24284/// # secret,
24285/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24286/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24287/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24288/// # ),
24289/// # ).build().await.unwrap();
24290///
24291/// # let client = hyper_util::client::legacy::Client::builder(
24292/// # hyper_util::rt::TokioExecutor::new()
24293/// # )
24294/// # .build(
24295/// # hyper_rustls::HttpsConnectorBuilder::new()
24296/// # .with_native_roots()
24297/// # .unwrap()
24298/// # .https_or_http()
24299/// # .enable_http2()
24300/// # .build()
24301/// # );
24302/// # let mut hub = AndroidEnterprise::new(client, auth);
24303/// // You can configure optional parameters by calling the respective setters at will, and
24304/// // execute the final call using `doit()`.
24305/// // Values shown here are possibly random and not representative !
24306/// let result = hub.storelayoutpages().get("enterpriseId", "pageId")
24307/// .doit().await;
24308/// # }
24309/// ```
24310pub struct StorelayoutpageGetCall<'a, C>
24311where
24312 C: 'a,
24313{
24314 hub: &'a AndroidEnterprise<C>,
24315 _enterprise_id: String,
24316 _page_id: String,
24317 _delegate: Option<&'a mut dyn common::Delegate>,
24318 _additional_params: HashMap<String, String>,
24319 _scopes: BTreeSet<String>,
24320}
24321
24322impl<'a, C> common::CallBuilder for StorelayoutpageGetCall<'a, C> {}
24323
24324impl<'a, C> StorelayoutpageGetCall<'a, C>
24325where
24326 C: common::Connector,
24327{
24328 /// Perform the operation you have build so far.
24329 pub async fn doit(mut self) -> common::Result<(common::Response, StorePage)> {
24330 use std::borrow::Cow;
24331 use std::io::{Read, Seek};
24332
24333 use common::{url::Params, ToParts};
24334 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24335
24336 let mut dd = common::DefaultDelegate;
24337 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24338 dlg.begin(common::MethodInfo {
24339 id: "androidenterprise.storelayoutpages.get",
24340 http_method: hyper::Method::GET,
24341 });
24342
24343 for &field in ["alt", "enterpriseId", "pageId"].iter() {
24344 if self._additional_params.contains_key(field) {
24345 dlg.finished(false);
24346 return Err(common::Error::FieldClash(field));
24347 }
24348 }
24349
24350 let mut params = Params::with_capacity(4 + self._additional_params.len());
24351 params.push("enterpriseId", self._enterprise_id);
24352 params.push("pageId", self._page_id);
24353
24354 params.extend(self._additional_params.iter());
24355
24356 params.push("alt", "json");
24357 let mut url = self.hub._base_url.clone()
24358 + "androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}";
24359 if self._scopes.is_empty() {
24360 self._scopes.insert(Scope::Full.as_ref().to_string());
24361 }
24362
24363 #[allow(clippy::single_element_loop)]
24364 for &(find_this, param_name) in
24365 [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId")].iter()
24366 {
24367 url = params.uri_replacement(url, param_name, find_this, false);
24368 }
24369 {
24370 let to_remove = ["pageId", "enterpriseId"];
24371 params.remove_params(&to_remove);
24372 }
24373
24374 let url = params.parse_with_url(&url);
24375
24376 loop {
24377 let token = match self
24378 .hub
24379 .auth
24380 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24381 .await
24382 {
24383 Ok(token) => token,
24384 Err(e) => match dlg.token(e) {
24385 Ok(token) => token,
24386 Err(e) => {
24387 dlg.finished(false);
24388 return Err(common::Error::MissingToken(e));
24389 }
24390 },
24391 };
24392 let mut req_result = {
24393 let client = &self.hub.client;
24394 dlg.pre_request();
24395 let mut req_builder = hyper::Request::builder()
24396 .method(hyper::Method::GET)
24397 .uri(url.as_str())
24398 .header(USER_AGENT, self.hub._user_agent.clone());
24399
24400 if let Some(token) = token.as_ref() {
24401 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24402 }
24403
24404 let request = req_builder
24405 .header(CONTENT_LENGTH, 0_u64)
24406 .body(common::to_body::<String>(None));
24407
24408 client.request(request.unwrap()).await
24409 };
24410
24411 match req_result {
24412 Err(err) => {
24413 if let common::Retry::After(d) = dlg.http_error(&err) {
24414 sleep(d).await;
24415 continue;
24416 }
24417 dlg.finished(false);
24418 return Err(common::Error::HttpError(err));
24419 }
24420 Ok(res) => {
24421 let (mut parts, body) = res.into_parts();
24422 let mut body = common::Body::new(body);
24423 if !parts.status.is_success() {
24424 let bytes = common::to_bytes(body).await.unwrap_or_default();
24425 let error = serde_json::from_str(&common::to_string(&bytes));
24426 let response = common::to_response(parts, bytes.into());
24427
24428 if let common::Retry::After(d) =
24429 dlg.http_failure(&response, error.as_ref().ok())
24430 {
24431 sleep(d).await;
24432 continue;
24433 }
24434
24435 dlg.finished(false);
24436
24437 return Err(match error {
24438 Ok(value) => common::Error::BadRequest(value),
24439 _ => common::Error::Failure(response),
24440 });
24441 }
24442 let response = {
24443 let bytes = common::to_bytes(body).await.unwrap_or_default();
24444 let encoded = common::to_string(&bytes);
24445 match serde_json::from_str(&encoded) {
24446 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24447 Err(error) => {
24448 dlg.response_json_decode_error(&encoded, &error);
24449 return Err(common::Error::JsonDecodeError(
24450 encoded.to_string(),
24451 error,
24452 ));
24453 }
24454 }
24455 };
24456
24457 dlg.finished(true);
24458 return Ok(response);
24459 }
24460 }
24461 }
24462 }
24463
24464 /// The ID of the enterprise.
24465 ///
24466 /// Sets the *enterprise id* path property to the given value.
24467 ///
24468 /// Even though the property as already been set when instantiating this call,
24469 /// we provide this method for API completeness.
24470 pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutpageGetCall<'a, C> {
24471 self._enterprise_id = new_value.to_string();
24472 self
24473 }
24474 /// The ID of the page.
24475 ///
24476 /// Sets the *page id* path property to the given value.
24477 ///
24478 /// Even though the property as already been set when instantiating this call,
24479 /// we provide this method for API completeness.
24480 pub fn page_id(mut self, new_value: &str) -> StorelayoutpageGetCall<'a, C> {
24481 self._page_id = new_value.to_string();
24482 self
24483 }
24484 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24485 /// while executing the actual API request.
24486 ///
24487 /// ````text
24488 /// It should be used to handle progress information, and to implement a certain level of resilience.
24489 /// ````
24490 ///
24491 /// Sets the *delegate* property to the given value.
24492 pub fn delegate(
24493 mut self,
24494 new_value: &'a mut dyn common::Delegate,
24495 ) -> StorelayoutpageGetCall<'a, C> {
24496 self._delegate = Some(new_value);
24497 self
24498 }
24499
24500 /// Set any additional parameter of the query string used in the request.
24501 /// It should be used to set parameters which are not yet available through their own
24502 /// setters.
24503 ///
24504 /// Please note that this method must not be used to set any of the known parameters
24505 /// which have their own setter method. If done anyway, the request will fail.
24506 ///
24507 /// # Additional Parameters
24508 ///
24509 /// * *$.xgafv* (query-string) - V1 error format.
24510 /// * *access_token* (query-string) - OAuth access token.
24511 /// * *alt* (query-string) - Data format for response.
24512 /// * *callback* (query-string) - JSONP
24513 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24514 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24515 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24516 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24517 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24518 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24519 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24520 pub fn param<T>(mut self, name: T, value: T) -> StorelayoutpageGetCall<'a, C>
24521 where
24522 T: AsRef<str>,
24523 {
24524 self._additional_params
24525 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24526 self
24527 }
24528
24529 /// Identifies the authorization scope for the method you are building.
24530 ///
24531 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24532 /// [`Scope::Full`].
24533 ///
24534 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24535 /// tokens for more than one scope.
24536 ///
24537 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24538 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24539 /// sufficient, a read-write scope will do as well.
24540 pub fn add_scope<St>(mut self, scope: St) -> StorelayoutpageGetCall<'a, C>
24541 where
24542 St: AsRef<str>,
24543 {
24544 self._scopes.insert(String::from(scope.as_ref()));
24545 self
24546 }
24547 /// Identifies the authorization scope(s) for the method you are building.
24548 ///
24549 /// See [`Self::add_scope()`] for details.
24550 pub fn add_scopes<I, St>(mut self, scopes: I) -> StorelayoutpageGetCall<'a, C>
24551 where
24552 I: IntoIterator<Item = St>,
24553 St: AsRef<str>,
24554 {
24555 self._scopes
24556 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24557 self
24558 }
24559
24560 /// Removes all scopes, and no default scope will be used either.
24561 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24562 /// for details).
24563 pub fn clear_scopes(mut self) -> StorelayoutpageGetCall<'a, C> {
24564 self._scopes.clear();
24565 self
24566 }
24567}
24568
24569/// Inserts a new store page.
24570///
24571/// A builder for the *insert* method supported by a *storelayoutpage* resource.
24572/// It is not used directly, but through a [`StorelayoutpageMethods`] instance.
24573///
24574/// # Example
24575///
24576/// Instantiate a resource method builder
24577///
24578/// ```test_harness,no_run
24579/// # extern crate hyper;
24580/// # extern crate hyper_rustls;
24581/// # extern crate google_androidenterprise1 as androidenterprise1;
24582/// use androidenterprise1::api::StorePage;
24583/// # async fn dox() {
24584/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24585///
24586/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24587/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24588/// # .with_native_roots()
24589/// # .unwrap()
24590/// # .https_only()
24591/// # .enable_http2()
24592/// # .build();
24593///
24594/// # let executor = hyper_util::rt::TokioExecutor::new();
24595/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24596/// # secret,
24597/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24598/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24599/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24600/// # ),
24601/// # ).build().await.unwrap();
24602///
24603/// # let client = hyper_util::client::legacy::Client::builder(
24604/// # hyper_util::rt::TokioExecutor::new()
24605/// # )
24606/// # .build(
24607/// # hyper_rustls::HttpsConnectorBuilder::new()
24608/// # .with_native_roots()
24609/// # .unwrap()
24610/// # .https_or_http()
24611/// # .enable_http2()
24612/// # .build()
24613/// # );
24614/// # let mut hub = AndroidEnterprise::new(client, auth);
24615/// // As the method needs a request, you would usually fill it with the desired information
24616/// // into the respective structure. Some of the parts shown here might not be applicable !
24617/// // Values shown here are possibly random and not representative !
24618/// let mut req = StorePage::default();
24619///
24620/// // You can configure optional parameters by calling the respective setters at will, and
24621/// // execute the final call using `doit()`.
24622/// // Values shown here are possibly random and not representative !
24623/// let result = hub.storelayoutpages().insert(req, "enterpriseId")
24624/// .doit().await;
24625/// # }
24626/// ```
24627pub struct StorelayoutpageInsertCall<'a, C>
24628where
24629 C: 'a,
24630{
24631 hub: &'a AndroidEnterprise<C>,
24632 _request: StorePage,
24633 _enterprise_id: String,
24634 _delegate: Option<&'a mut dyn common::Delegate>,
24635 _additional_params: HashMap<String, String>,
24636 _scopes: BTreeSet<String>,
24637}
24638
24639impl<'a, C> common::CallBuilder for StorelayoutpageInsertCall<'a, C> {}
24640
24641impl<'a, C> StorelayoutpageInsertCall<'a, C>
24642where
24643 C: common::Connector,
24644{
24645 /// Perform the operation you have build so far.
24646 pub async fn doit(mut self) -> common::Result<(common::Response, StorePage)> {
24647 use std::borrow::Cow;
24648 use std::io::{Read, Seek};
24649
24650 use common::{url::Params, ToParts};
24651 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24652
24653 let mut dd = common::DefaultDelegate;
24654 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24655 dlg.begin(common::MethodInfo {
24656 id: "androidenterprise.storelayoutpages.insert",
24657 http_method: hyper::Method::POST,
24658 });
24659
24660 for &field in ["alt", "enterpriseId"].iter() {
24661 if self._additional_params.contains_key(field) {
24662 dlg.finished(false);
24663 return Err(common::Error::FieldClash(field));
24664 }
24665 }
24666
24667 let mut params = Params::with_capacity(4 + self._additional_params.len());
24668 params.push("enterpriseId", self._enterprise_id);
24669
24670 params.extend(self._additional_params.iter());
24671
24672 params.push("alt", "json");
24673 let mut url = self.hub._base_url.clone()
24674 + "androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages";
24675 if self._scopes.is_empty() {
24676 self._scopes.insert(Scope::Full.as_ref().to_string());
24677 }
24678
24679 #[allow(clippy::single_element_loop)]
24680 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
24681 url = params.uri_replacement(url, param_name, find_this, false);
24682 }
24683 {
24684 let to_remove = ["enterpriseId"];
24685 params.remove_params(&to_remove);
24686 }
24687
24688 let url = params.parse_with_url(&url);
24689
24690 let mut json_mime_type = mime::APPLICATION_JSON;
24691 let mut request_value_reader = {
24692 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24693 common::remove_json_null_values(&mut value);
24694 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24695 serde_json::to_writer(&mut dst, &value).unwrap();
24696 dst
24697 };
24698 let request_size = request_value_reader
24699 .seek(std::io::SeekFrom::End(0))
24700 .unwrap();
24701 request_value_reader
24702 .seek(std::io::SeekFrom::Start(0))
24703 .unwrap();
24704
24705 loop {
24706 let token = match self
24707 .hub
24708 .auth
24709 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24710 .await
24711 {
24712 Ok(token) => token,
24713 Err(e) => match dlg.token(e) {
24714 Ok(token) => token,
24715 Err(e) => {
24716 dlg.finished(false);
24717 return Err(common::Error::MissingToken(e));
24718 }
24719 },
24720 };
24721 request_value_reader
24722 .seek(std::io::SeekFrom::Start(0))
24723 .unwrap();
24724 let mut req_result = {
24725 let client = &self.hub.client;
24726 dlg.pre_request();
24727 let mut req_builder = hyper::Request::builder()
24728 .method(hyper::Method::POST)
24729 .uri(url.as_str())
24730 .header(USER_AGENT, self.hub._user_agent.clone());
24731
24732 if let Some(token) = token.as_ref() {
24733 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24734 }
24735
24736 let request = req_builder
24737 .header(CONTENT_TYPE, json_mime_type.to_string())
24738 .header(CONTENT_LENGTH, request_size as u64)
24739 .body(common::to_body(
24740 request_value_reader.get_ref().clone().into(),
24741 ));
24742
24743 client.request(request.unwrap()).await
24744 };
24745
24746 match req_result {
24747 Err(err) => {
24748 if let common::Retry::After(d) = dlg.http_error(&err) {
24749 sleep(d).await;
24750 continue;
24751 }
24752 dlg.finished(false);
24753 return Err(common::Error::HttpError(err));
24754 }
24755 Ok(res) => {
24756 let (mut parts, body) = res.into_parts();
24757 let mut body = common::Body::new(body);
24758 if !parts.status.is_success() {
24759 let bytes = common::to_bytes(body).await.unwrap_or_default();
24760 let error = serde_json::from_str(&common::to_string(&bytes));
24761 let response = common::to_response(parts, bytes.into());
24762
24763 if let common::Retry::After(d) =
24764 dlg.http_failure(&response, error.as_ref().ok())
24765 {
24766 sleep(d).await;
24767 continue;
24768 }
24769
24770 dlg.finished(false);
24771
24772 return Err(match error {
24773 Ok(value) => common::Error::BadRequest(value),
24774 _ => common::Error::Failure(response),
24775 });
24776 }
24777 let response = {
24778 let bytes = common::to_bytes(body).await.unwrap_or_default();
24779 let encoded = common::to_string(&bytes);
24780 match serde_json::from_str(&encoded) {
24781 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24782 Err(error) => {
24783 dlg.response_json_decode_error(&encoded, &error);
24784 return Err(common::Error::JsonDecodeError(
24785 encoded.to_string(),
24786 error,
24787 ));
24788 }
24789 }
24790 };
24791
24792 dlg.finished(true);
24793 return Ok(response);
24794 }
24795 }
24796 }
24797 }
24798
24799 ///
24800 /// Sets the *request* property to the given value.
24801 ///
24802 /// Even though the property as already been set when instantiating this call,
24803 /// we provide this method for API completeness.
24804 pub fn request(mut self, new_value: StorePage) -> StorelayoutpageInsertCall<'a, C> {
24805 self._request = new_value;
24806 self
24807 }
24808 /// The ID of the enterprise.
24809 ///
24810 /// Sets the *enterprise id* path property to the given value.
24811 ///
24812 /// Even though the property as already been set when instantiating this call,
24813 /// we provide this method for API completeness.
24814 pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutpageInsertCall<'a, C> {
24815 self._enterprise_id = new_value.to_string();
24816 self
24817 }
24818 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24819 /// while executing the actual API request.
24820 ///
24821 /// ````text
24822 /// It should be used to handle progress information, and to implement a certain level of resilience.
24823 /// ````
24824 ///
24825 /// Sets the *delegate* property to the given value.
24826 pub fn delegate(
24827 mut self,
24828 new_value: &'a mut dyn common::Delegate,
24829 ) -> StorelayoutpageInsertCall<'a, C> {
24830 self._delegate = Some(new_value);
24831 self
24832 }
24833
24834 /// Set any additional parameter of the query string used in the request.
24835 /// It should be used to set parameters which are not yet available through their own
24836 /// setters.
24837 ///
24838 /// Please note that this method must not be used to set any of the known parameters
24839 /// which have their own setter method. If done anyway, the request will fail.
24840 ///
24841 /// # Additional Parameters
24842 ///
24843 /// * *$.xgafv* (query-string) - V1 error format.
24844 /// * *access_token* (query-string) - OAuth access token.
24845 /// * *alt* (query-string) - Data format for response.
24846 /// * *callback* (query-string) - JSONP
24847 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24848 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24849 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24850 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24851 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24852 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24853 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24854 pub fn param<T>(mut self, name: T, value: T) -> StorelayoutpageInsertCall<'a, C>
24855 where
24856 T: AsRef<str>,
24857 {
24858 self._additional_params
24859 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24860 self
24861 }
24862
24863 /// Identifies the authorization scope for the method you are building.
24864 ///
24865 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24866 /// [`Scope::Full`].
24867 ///
24868 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24869 /// tokens for more than one scope.
24870 ///
24871 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24872 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24873 /// sufficient, a read-write scope will do as well.
24874 pub fn add_scope<St>(mut self, scope: St) -> StorelayoutpageInsertCall<'a, C>
24875 where
24876 St: AsRef<str>,
24877 {
24878 self._scopes.insert(String::from(scope.as_ref()));
24879 self
24880 }
24881 /// Identifies the authorization scope(s) for the method you are building.
24882 ///
24883 /// See [`Self::add_scope()`] for details.
24884 pub fn add_scopes<I, St>(mut self, scopes: I) -> StorelayoutpageInsertCall<'a, C>
24885 where
24886 I: IntoIterator<Item = St>,
24887 St: AsRef<str>,
24888 {
24889 self._scopes
24890 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24891 self
24892 }
24893
24894 /// Removes all scopes, and no default scope will be used either.
24895 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24896 /// for details).
24897 pub fn clear_scopes(mut self) -> StorelayoutpageInsertCall<'a, C> {
24898 self._scopes.clear();
24899 self
24900 }
24901}
24902
24903/// Retrieves the details of all pages in the store.
24904///
24905/// A builder for the *list* method supported by a *storelayoutpage* resource.
24906/// It is not used directly, but through a [`StorelayoutpageMethods`] instance.
24907///
24908/// # Example
24909///
24910/// Instantiate a resource method builder
24911///
24912/// ```test_harness,no_run
24913/// # extern crate hyper;
24914/// # extern crate hyper_rustls;
24915/// # extern crate google_androidenterprise1 as androidenterprise1;
24916/// # async fn dox() {
24917/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24918///
24919/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24920/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24921/// # .with_native_roots()
24922/// # .unwrap()
24923/// # .https_only()
24924/// # .enable_http2()
24925/// # .build();
24926///
24927/// # let executor = hyper_util::rt::TokioExecutor::new();
24928/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24929/// # secret,
24930/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24931/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24932/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24933/// # ),
24934/// # ).build().await.unwrap();
24935///
24936/// # let client = hyper_util::client::legacy::Client::builder(
24937/// # hyper_util::rt::TokioExecutor::new()
24938/// # )
24939/// # .build(
24940/// # hyper_rustls::HttpsConnectorBuilder::new()
24941/// # .with_native_roots()
24942/// # .unwrap()
24943/// # .https_or_http()
24944/// # .enable_http2()
24945/// # .build()
24946/// # );
24947/// # let mut hub = AndroidEnterprise::new(client, auth);
24948/// // You can configure optional parameters by calling the respective setters at will, and
24949/// // execute the final call using `doit()`.
24950/// // Values shown here are possibly random and not representative !
24951/// let result = hub.storelayoutpages().list("enterpriseId")
24952/// .doit().await;
24953/// # }
24954/// ```
24955pub struct StorelayoutpageListCall<'a, C>
24956where
24957 C: 'a,
24958{
24959 hub: &'a AndroidEnterprise<C>,
24960 _enterprise_id: String,
24961 _delegate: Option<&'a mut dyn common::Delegate>,
24962 _additional_params: HashMap<String, String>,
24963 _scopes: BTreeSet<String>,
24964}
24965
24966impl<'a, C> common::CallBuilder for StorelayoutpageListCall<'a, C> {}
24967
24968impl<'a, C> StorelayoutpageListCall<'a, C>
24969where
24970 C: common::Connector,
24971{
24972 /// Perform the operation you have build so far.
24973 pub async fn doit(
24974 mut self,
24975 ) -> common::Result<(common::Response, StoreLayoutPagesListResponse)> {
24976 use std::borrow::Cow;
24977 use std::io::{Read, Seek};
24978
24979 use common::{url::Params, ToParts};
24980 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24981
24982 let mut dd = common::DefaultDelegate;
24983 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24984 dlg.begin(common::MethodInfo {
24985 id: "androidenterprise.storelayoutpages.list",
24986 http_method: hyper::Method::GET,
24987 });
24988
24989 for &field in ["alt", "enterpriseId"].iter() {
24990 if self._additional_params.contains_key(field) {
24991 dlg.finished(false);
24992 return Err(common::Error::FieldClash(field));
24993 }
24994 }
24995
24996 let mut params = Params::with_capacity(3 + self._additional_params.len());
24997 params.push("enterpriseId", self._enterprise_id);
24998
24999 params.extend(self._additional_params.iter());
25000
25001 params.push("alt", "json");
25002 let mut url = self.hub._base_url.clone()
25003 + "androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages";
25004 if self._scopes.is_empty() {
25005 self._scopes.insert(Scope::Full.as_ref().to_string());
25006 }
25007
25008 #[allow(clippy::single_element_loop)]
25009 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
25010 url = params.uri_replacement(url, param_name, find_this, false);
25011 }
25012 {
25013 let to_remove = ["enterpriseId"];
25014 params.remove_params(&to_remove);
25015 }
25016
25017 let url = params.parse_with_url(&url);
25018
25019 loop {
25020 let token = match self
25021 .hub
25022 .auth
25023 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25024 .await
25025 {
25026 Ok(token) => token,
25027 Err(e) => match dlg.token(e) {
25028 Ok(token) => token,
25029 Err(e) => {
25030 dlg.finished(false);
25031 return Err(common::Error::MissingToken(e));
25032 }
25033 },
25034 };
25035 let mut req_result = {
25036 let client = &self.hub.client;
25037 dlg.pre_request();
25038 let mut req_builder = hyper::Request::builder()
25039 .method(hyper::Method::GET)
25040 .uri(url.as_str())
25041 .header(USER_AGENT, self.hub._user_agent.clone());
25042
25043 if let Some(token) = token.as_ref() {
25044 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25045 }
25046
25047 let request = req_builder
25048 .header(CONTENT_LENGTH, 0_u64)
25049 .body(common::to_body::<String>(None));
25050
25051 client.request(request.unwrap()).await
25052 };
25053
25054 match req_result {
25055 Err(err) => {
25056 if let common::Retry::After(d) = dlg.http_error(&err) {
25057 sleep(d).await;
25058 continue;
25059 }
25060 dlg.finished(false);
25061 return Err(common::Error::HttpError(err));
25062 }
25063 Ok(res) => {
25064 let (mut parts, body) = res.into_parts();
25065 let mut body = common::Body::new(body);
25066 if !parts.status.is_success() {
25067 let bytes = common::to_bytes(body).await.unwrap_or_default();
25068 let error = serde_json::from_str(&common::to_string(&bytes));
25069 let response = common::to_response(parts, bytes.into());
25070
25071 if let common::Retry::After(d) =
25072 dlg.http_failure(&response, error.as_ref().ok())
25073 {
25074 sleep(d).await;
25075 continue;
25076 }
25077
25078 dlg.finished(false);
25079
25080 return Err(match error {
25081 Ok(value) => common::Error::BadRequest(value),
25082 _ => common::Error::Failure(response),
25083 });
25084 }
25085 let response = {
25086 let bytes = common::to_bytes(body).await.unwrap_or_default();
25087 let encoded = common::to_string(&bytes);
25088 match serde_json::from_str(&encoded) {
25089 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25090 Err(error) => {
25091 dlg.response_json_decode_error(&encoded, &error);
25092 return Err(common::Error::JsonDecodeError(
25093 encoded.to_string(),
25094 error,
25095 ));
25096 }
25097 }
25098 };
25099
25100 dlg.finished(true);
25101 return Ok(response);
25102 }
25103 }
25104 }
25105 }
25106
25107 /// The ID of the enterprise.
25108 ///
25109 /// Sets the *enterprise id* path property to the given value.
25110 ///
25111 /// Even though the property as already been set when instantiating this call,
25112 /// we provide this method for API completeness.
25113 pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutpageListCall<'a, C> {
25114 self._enterprise_id = new_value.to_string();
25115 self
25116 }
25117 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25118 /// while executing the actual API request.
25119 ///
25120 /// ````text
25121 /// It should be used to handle progress information, and to implement a certain level of resilience.
25122 /// ````
25123 ///
25124 /// Sets the *delegate* property to the given value.
25125 pub fn delegate(
25126 mut self,
25127 new_value: &'a mut dyn common::Delegate,
25128 ) -> StorelayoutpageListCall<'a, C> {
25129 self._delegate = Some(new_value);
25130 self
25131 }
25132
25133 /// Set any additional parameter of the query string used in the request.
25134 /// It should be used to set parameters which are not yet available through their own
25135 /// setters.
25136 ///
25137 /// Please note that this method must not be used to set any of the known parameters
25138 /// which have their own setter method. If done anyway, the request will fail.
25139 ///
25140 /// # Additional Parameters
25141 ///
25142 /// * *$.xgafv* (query-string) - V1 error format.
25143 /// * *access_token* (query-string) - OAuth access token.
25144 /// * *alt* (query-string) - Data format for response.
25145 /// * *callback* (query-string) - JSONP
25146 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25147 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25148 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25149 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25150 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25151 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25152 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25153 pub fn param<T>(mut self, name: T, value: T) -> StorelayoutpageListCall<'a, C>
25154 where
25155 T: AsRef<str>,
25156 {
25157 self._additional_params
25158 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25159 self
25160 }
25161
25162 /// Identifies the authorization scope for the method you are building.
25163 ///
25164 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25165 /// [`Scope::Full`].
25166 ///
25167 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25168 /// tokens for more than one scope.
25169 ///
25170 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25171 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25172 /// sufficient, a read-write scope will do as well.
25173 pub fn add_scope<St>(mut self, scope: St) -> StorelayoutpageListCall<'a, C>
25174 where
25175 St: AsRef<str>,
25176 {
25177 self._scopes.insert(String::from(scope.as_ref()));
25178 self
25179 }
25180 /// Identifies the authorization scope(s) for the method you are building.
25181 ///
25182 /// See [`Self::add_scope()`] for details.
25183 pub fn add_scopes<I, St>(mut self, scopes: I) -> StorelayoutpageListCall<'a, C>
25184 where
25185 I: IntoIterator<Item = St>,
25186 St: AsRef<str>,
25187 {
25188 self._scopes
25189 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25190 self
25191 }
25192
25193 /// Removes all scopes, and no default scope will be used either.
25194 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25195 /// for details).
25196 pub fn clear_scopes(mut self) -> StorelayoutpageListCall<'a, C> {
25197 self._scopes.clear();
25198 self
25199 }
25200}
25201
25202/// Updates the content of a store page.
25203///
25204/// A builder for the *update* method supported by a *storelayoutpage* resource.
25205/// It is not used directly, but through a [`StorelayoutpageMethods`] instance.
25206///
25207/// # Example
25208///
25209/// Instantiate a resource method builder
25210///
25211/// ```test_harness,no_run
25212/// # extern crate hyper;
25213/// # extern crate hyper_rustls;
25214/// # extern crate google_androidenterprise1 as androidenterprise1;
25215/// use androidenterprise1::api::StorePage;
25216/// # async fn dox() {
25217/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25218///
25219/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25220/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25221/// # .with_native_roots()
25222/// # .unwrap()
25223/// # .https_only()
25224/// # .enable_http2()
25225/// # .build();
25226///
25227/// # let executor = hyper_util::rt::TokioExecutor::new();
25228/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25229/// # secret,
25230/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25231/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25232/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25233/// # ),
25234/// # ).build().await.unwrap();
25235///
25236/// # let client = hyper_util::client::legacy::Client::builder(
25237/// # hyper_util::rt::TokioExecutor::new()
25238/// # )
25239/// # .build(
25240/// # hyper_rustls::HttpsConnectorBuilder::new()
25241/// # .with_native_roots()
25242/// # .unwrap()
25243/// # .https_or_http()
25244/// # .enable_http2()
25245/// # .build()
25246/// # );
25247/// # let mut hub = AndroidEnterprise::new(client, auth);
25248/// // As the method needs a request, you would usually fill it with the desired information
25249/// // into the respective structure. Some of the parts shown here might not be applicable !
25250/// // Values shown here are possibly random and not representative !
25251/// let mut req = StorePage::default();
25252///
25253/// // You can configure optional parameters by calling the respective setters at will, and
25254/// // execute the final call using `doit()`.
25255/// // Values shown here are possibly random and not representative !
25256/// let result = hub.storelayoutpages().update(req, "enterpriseId", "pageId")
25257/// .doit().await;
25258/// # }
25259/// ```
25260pub struct StorelayoutpageUpdateCall<'a, C>
25261where
25262 C: 'a,
25263{
25264 hub: &'a AndroidEnterprise<C>,
25265 _request: StorePage,
25266 _enterprise_id: String,
25267 _page_id: String,
25268 _delegate: Option<&'a mut dyn common::Delegate>,
25269 _additional_params: HashMap<String, String>,
25270 _scopes: BTreeSet<String>,
25271}
25272
25273impl<'a, C> common::CallBuilder for StorelayoutpageUpdateCall<'a, C> {}
25274
25275impl<'a, C> StorelayoutpageUpdateCall<'a, C>
25276where
25277 C: common::Connector,
25278{
25279 /// Perform the operation you have build so far.
25280 pub async fn doit(mut self) -> common::Result<(common::Response, StorePage)> {
25281 use std::borrow::Cow;
25282 use std::io::{Read, Seek};
25283
25284 use common::{url::Params, ToParts};
25285 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25286
25287 let mut dd = common::DefaultDelegate;
25288 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25289 dlg.begin(common::MethodInfo {
25290 id: "androidenterprise.storelayoutpages.update",
25291 http_method: hyper::Method::PUT,
25292 });
25293
25294 for &field in ["alt", "enterpriseId", "pageId"].iter() {
25295 if self._additional_params.contains_key(field) {
25296 dlg.finished(false);
25297 return Err(common::Error::FieldClash(field));
25298 }
25299 }
25300
25301 let mut params = Params::with_capacity(5 + self._additional_params.len());
25302 params.push("enterpriseId", self._enterprise_id);
25303 params.push("pageId", self._page_id);
25304
25305 params.extend(self._additional_params.iter());
25306
25307 params.push("alt", "json");
25308 let mut url = self.hub._base_url.clone()
25309 + "androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}";
25310 if self._scopes.is_empty() {
25311 self._scopes.insert(Scope::Full.as_ref().to_string());
25312 }
25313
25314 #[allow(clippy::single_element_loop)]
25315 for &(find_this, param_name) in
25316 [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId")].iter()
25317 {
25318 url = params.uri_replacement(url, param_name, find_this, false);
25319 }
25320 {
25321 let to_remove = ["pageId", "enterpriseId"];
25322 params.remove_params(&to_remove);
25323 }
25324
25325 let url = params.parse_with_url(&url);
25326
25327 let mut json_mime_type = mime::APPLICATION_JSON;
25328 let mut request_value_reader = {
25329 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25330 common::remove_json_null_values(&mut value);
25331 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25332 serde_json::to_writer(&mut dst, &value).unwrap();
25333 dst
25334 };
25335 let request_size = request_value_reader
25336 .seek(std::io::SeekFrom::End(0))
25337 .unwrap();
25338 request_value_reader
25339 .seek(std::io::SeekFrom::Start(0))
25340 .unwrap();
25341
25342 loop {
25343 let token = match self
25344 .hub
25345 .auth
25346 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25347 .await
25348 {
25349 Ok(token) => token,
25350 Err(e) => match dlg.token(e) {
25351 Ok(token) => token,
25352 Err(e) => {
25353 dlg.finished(false);
25354 return Err(common::Error::MissingToken(e));
25355 }
25356 },
25357 };
25358 request_value_reader
25359 .seek(std::io::SeekFrom::Start(0))
25360 .unwrap();
25361 let mut req_result = {
25362 let client = &self.hub.client;
25363 dlg.pre_request();
25364 let mut req_builder = hyper::Request::builder()
25365 .method(hyper::Method::PUT)
25366 .uri(url.as_str())
25367 .header(USER_AGENT, self.hub._user_agent.clone());
25368
25369 if let Some(token) = token.as_ref() {
25370 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25371 }
25372
25373 let request = req_builder
25374 .header(CONTENT_TYPE, json_mime_type.to_string())
25375 .header(CONTENT_LENGTH, request_size as u64)
25376 .body(common::to_body(
25377 request_value_reader.get_ref().clone().into(),
25378 ));
25379
25380 client.request(request.unwrap()).await
25381 };
25382
25383 match req_result {
25384 Err(err) => {
25385 if let common::Retry::After(d) = dlg.http_error(&err) {
25386 sleep(d).await;
25387 continue;
25388 }
25389 dlg.finished(false);
25390 return Err(common::Error::HttpError(err));
25391 }
25392 Ok(res) => {
25393 let (mut parts, body) = res.into_parts();
25394 let mut body = common::Body::new(body);
25395 if !parts.status.is_success() {
25396 let bytes = common::to_bytes(body).await.unwrap_or_default();
25397 let error = serde_json::from_str(&common::to_string(&bytes));
25398 let response = common::to_response(parts, bytes.into());
25399
25400 if let common::Retry::After(d) =
25401 dlg.http_failure(&response, error.as_ref().ok())
25402 {
25403 sleep(d).await;
25404 continue;
25405 }
25406
25407 dlg.finished(false);
25408
25409 return Err(match error {
25410 Ok(value) => common::Error::BadRequest(value),
25411 _ => common::Error::Failure(response),
25412 });
25413 }
25414 let response = {
25415 let bytes = common::to_bytes(body).await.unwrap_or_default();
25416 let encoded = common::to_string(&bytes);
25417 match serde_json::from_str(&encoded) {
25418 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25419 Err(error) => {
25420 dlg.response_json_decode_error(&encoded, &error);
25421 return Err(common::Error::JsonDecodeError(
25422 encoded.to_string(),
25423 error,
25424 ));
25425 }
25426 }
25427 };
25428
25429 dlg.finished(true);
25430 return Ok(response);
25431 }
25432 }
25433 }
25434 }
25435
25436 ///
25437 /// Sets the *request* property to the given value.
25438 ///
25439 /// Even though the property as already been set when instantiating this call,
25440 /// we provide this method for API completeness.
25441 pub fn request(mut self, new_value: StorePage) -> StorelayoutpageUpdateCall<'a, C> {
25442 self._request = new_value;
25443 self
25444 }
25445 /// The ID of the enterprise.
25446 ///
25447 /// Sets the *enterprise id* path property to the given value.
25448 ///
25449 /// Even though the property as already been set when instantiating this call,
25450 /// we provide this method for API completeness.
25451 pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutpageUpdateCall<'a, C> {
25452 self._enterprise_id = new_value.to_string();
25453 self
25454 }
25455 /// The ID of the page.
25456 ///
25457 /// Sets the *page id* path property to the given value.
25458 ///
25459 /// Even though the property as already been set when instantiating this call,
25460 /// we provide this method for API completeness.
25461 pub fn page_id(mut self, new_value: &str) -> StorelayoutpageUpdateCall<'a, C> {
25462 self._page_id = new_value.to_string();
25463 self
25464 }
25465 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25466 /// while executing the actual API request.
25467 ///
25468 /// ````text
25469 /// It should be used to handle progress information, and to implement a certain level of resilience.
25470 /// ````
25471 ///
25472 /// Sets the *delegate* property to the given value.
25473 pub fn delegate(
25474 mut self,
25475 new_value: &'a mut dyn common::Delegate,
25476 ) -> StorelayoutpageUpdateCall<'a, C> {
25477 self._delegate = Some(new_value);
25478 self
25479 }
25480
25481 /// Set any additional parameter of the query string used in the request.
25482 /// It should be used to set parameters which are not yet available through their own
25483 /// setters.
25484 ///
25485 /// Please note that this method must not be used to set any of the known parameters
25486 /// which have their own setter method. If done anyway, the request will fail.
25487 ///
25488 /// # Additional Parameters
25489 ///
25490 /// * *$.xgafv* (query-string) - V1 error format.
25491 /// * *access_token* (query-string) - OAuth access token.
25492 /// * *alt* (query-string) - Data format for response.
25493 /// * *callback* (query-string) - JSONP
25494 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25495 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25496 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25497 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25498 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25499 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25500 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25501 pub fn param<T>(mut self, name: T, value: T) -> StorelayoutpageUpdateCall<'a, C>
25502 where
25503 T: AsRef<str>,
25504 {
25505 self._additional_params
25506 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25507 self
25508 }
25509
25510 /// Identifies the authorization scope for the method you are building.
25511 ///
25512 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25513 /// [`Scope::Full`].
25514 ///
25515 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25516 /// tokens for more than one scope.
25517 ///
25518 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25519 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25520 /// sufficient, a read-write scope will do as well.
25521 pub fn add_scope<St>(mut self, scope: St) -> StorelayoutpageUpdateCall<'a, C>
25522 where
25523 St: AsRef<str>,
25524 {
25525 self._scopes.insert(String::from(scope.as_ref()));
25526 self
25527 }
25528 /// Identifies the authorization scope(s) for the method you are building.
25529 ///
25530 /// See [`Self::add_scope()`] for details.
25531 pub fn add_scopes<I, St>(mut self, scopes: I) -> StorelayoutpageUpdateCall<'a, C>
25532 where
25533 I: IntoIterator<Item = St>,
25534 St: AsRef<str>,
25535 {
25536 self._scopes
25537 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25538 self
25539 }
25540
25541 /// Removes all scopes, and no default scope will be used either.
25542 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25543 /// for details).
25544 pub fn clear_scopes(mut self) -> StorelayoutpageUpdateCall<'a, C> {
25545 self._scopes.clear();
25546 self
25547 }
25548}
25549
25550/// Deleted an EMM-managed user.
25551///
25552/// A builder for the *delete* method supported by a *user* resource.
25553/// It is not used directly, but through a [`UserMethods`] instance.
25554///
25555/// # Example
25556///
25557/// Instantiate a resource method builder
25558///
25559/// ```test_harness,no_run
25560/// # extern crate hyper;
25561/// # extern crate hyper_rustls;
25562/// # extern crate google_androidenterprise1 as androidenterprise1;
25563/// # async fn dox() {
25564/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25565///
25566/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25567/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25568/// # .with_native_roots()
25569/// # .unwrap()
25570/// # .https_only()
25571/// # .enable_http2()
25572/// # .build();
25573///
25574/// # let executor = hyper_util::rt::TokioExecutor::new();
25575/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25576/// # secret,
25577/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25578/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25579/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25580/// # ),
25581/// # ).build().await.unwrap();
25582///
25583/// # let client = hyper_util::client::legacy::Client::builder(
25584/// # hyper_util::rt::TokioExecutor::new()
25585/// # )
25586/// # .build(
25587/// # hyper_rustls::HttpsConnectorBuilder::new()
25588/// # .with_native_roots()
25589/// # .unwrap()
25590/// # .https_or_http()
25591/// # .enable_http2()
25592/// # .build()
25593/// # );
25594/// # let mut hub = AndroidEnterprise::new(client, auth);
25595/// // You can configure optional parameters by calling the respective setters at will, and
25596/// // execute the final call using `doit()`.
25597/// // Values shown here are possibly random and not representative !
25598/// let result = hub.users().delete("enterpriseId", "userId")
25599/// .doit().await;
25600/// # }
25601/// ```
25602pub struct UserDeleteCall<'a, C>
25603where
25604 C: 'a,
25605{
25606 hub: &'a AndroidEnterprise<C>,
25607 _enterprise_id: String,
25608 _user_id: String,
25609 _delegate: Option<&'a mut dyn common::Delegate>,
25610 _additional_params: HashMap<String, String>,
25611 _scopes: BTreeSet<String>,
25612}
25613
25614impl<'a, C> common::CallBuilder for UserDeleteCall<'a, C> {}
25615
25616impl<'a, C> UserDeleteCall<'a, C>
25617where
25618 C: common::Connector,
25619{
25620 /// Perform the operation you have build so far.
25621 pub async fn doit(mut self) -> common::Result<common::Response> {
25622 use std::borrow::Cow;
25623 use std::io::{Read, Seek};
25624
25625 use common::{url::Params, ToParts};
25626 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25627
25628 let mut dd = common::DefaultDelegate;
25629 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25630 dlg.begin(common::MethodInfo {
25631 id: "androidenterprise.users.delete",
25632 http_method: hyper::Method::DELETE,
25633 });
25634
25635 for &field in ["enterpriseId", "userId"].iter() {
25636 if self._additional_params.contains_key(field) {
25637 dlg.finished(false);
25638 return Err(common::Error::FieldClash(field));
25639 }
25640 }
25641
25642 let mut params = Params::with_capacity(3 + self._additional_params.len());
25643 params.push("enterpriseId", self._enterprise_id);
25644 params.push("userId", self._user_id);
25645
25646 params.extend(self._additional_params.iter());
25647
25648 let mut url = self.hub._base_url.clone()
25649 + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}";
25650 if self._scopes.is_empty() {
25651 self._scopes.insert(Scope::Full.as_ref().to_string());
25652 }
25653
25654 #[allow(clippy::single_element_loop)]
25655 for &(find_this, param_name) in
25656 [("{enterpriseId}", "enterpriseId"), ("{userId}", "userId")].iter()
25657 {
25658 url = params.uri_replacement(url, param_name, find_this, false);
25659 }
25660 {
25661 let to_remove = ["userId", "enterpriseId"];
25662 params.remove_params(&to_remove);
25663 }
25664
25665 let url = params.parse_with_url(&url);
25666
25667 loop {
25668 let token = match self
25669 .hub
25670 .auth
25671 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25672 .await
25673 {
25674 Ok(token) => token,
25675 Err(e) => match dlg.token(e) {
25676 Ok(token) => token,
25677 Err(e) => {
25678 dlg.finished(false);
25679 return Err(common::Error::MissingToken(e));
25680 }
25681 },
25682 };
25683 let mut req_result = {
25684 let client = &self.hub.client;
25685 dlg.pre_request();
25686 let mut req_builder = hyper::Request::builder()
25687 .method(hyper::Method::DELETE)
25688 .uri(url.as_str())
25689 .header(USER_AGENT, self.hub._user_agent.clone());
25690
25691 if let Some(token) = token.as_ref() {
25692 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25693 }
25694
25695 let request = req_builder
25696 .header(CONTENT_LENGTH, 0_u64)
25697 .body(common::to_body::<String>(None));
25698
25699 client.request(request.unwrap()).await
25700 };
25701
25702 match req_result {
25703 Err(err) => {
25704 if let common::Retry::After(d) = dlg.http_error(&err) {
25705 sleep(d).await;
25706 continue;
25707 }
25708 dlg.finished(false);
25709 return Err(common::Error::HttpError(err));
25710 }
25711 Ok(res) => {
25712 let (mut parts, body) = res.into_parts();
25713 let mut body = common::Body::new(body);
25714 if !parts.status.is_success() {
25715 let bytes = common::to_bytes(body).await.unwrap_or_default();
25716 let error = serde_json::from_str(&common::to_string(&bytes));
25717 let response = common::to_response(parts, bytes.into());
25718
25719 if let common::Retry::After(d) =
25720 dlg.http_failure(&response, error.as_ref().ok())
25721 {
25722 sleep(d).await;
25723 continue;
25724 }
25725
25726 dlg.finished(false);
25727
25728 return Err(match error {
25729 Ok(value) => common::Error::BadRequest(value),
25730 _ => common::Error::Failure(response),
25731 });
25732 }
25733 let response = common::Response::from_parts(parts, body);
25734
25735 dlg.finished(true);
25736 return Ok(response);
25737 }
25738 }
25739 }
25740 }
25741
25742 /// The ID of the enterprise.
25743 ///
25744 /// Sets the *enterprise id* path property to the given value.
25745 ///
25746 /// Even though the property as already been set when instantiating this call,
25747 /// we provide this method for API completeness.
25748 pub fn enterprise_id(mut self, new_value: &str) -> UserDeleteCall<'a, C> {
25749 self._enterprise_id = new_value.to_string();
25750 self
25751 }
25752 /// The ID of the user.
25753 ///
25754 /// Sets the *user id* path property to the given value.
25755 ///
25756 /// Even though the property as already been set when instantiating this call,
25757 /// we provide this method for API completeness.
25758 pub fn user_id(mut self, new_value: &str) -> UserDeleteCall<'a, C> {
25759 self._user_id = new_value.to_string();
25760 self
25761 }
25762 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25763 /// while executing the actual API request.
25764 ///
25765 /// ````text
25766 /// It should be used to handle progress information, and to implement a certain level of resilience.
25767 /// ````
25768 ///
25769 /// Sets the *delegate* property to the given value.
25770 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserDeleteCall<'a, C> {
25771 self._delegate = Some(new_value);
25772 self
25773 }
25774
25775 /// Set any additional parameter of the query string used in the request.
25776 /// It should be used to set parameters which are not yet available through their own
25777 /// setters.
25778 ///
25779 /// Please note that this method must not be used to set any of the known parameters
25780 /// which have their own setter method. If done anyway, the request will fail.
25781 ///
25782 /// # Additional Parameters
25783 ///
25784 /// * *$.xgafv* (query-string) - V1 error format.
25785 /// * *access_token* (query-string) - OAuth access token.
25786 /// * *alt* (query-string) - Data format for response.
25787 /// * *callback* (query-string) - JSONP
25788 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25789 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25790 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25791 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25792 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25793 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25794 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25795 pub fn param<T>(mut self, name: T, value: T) -> UserDeleteCall<'a, C>
25796 where
25797 T: AsRef<str>,
25798 {
25799 self._additional_params
25800 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25801 self
25802 }
25803
25804 /// Identifies the authorization scope for the method you are building.
25805 ///
25806 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25807 /// [`Scope::Full`].
25808 ///
25809 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25810 /// tokens for more than one scope.
25811 ///
25812 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25813 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25814 /// sufficient, a read-write scope will do as well.
25815 pub fn add_scope<St>(mut self, scope: St) -> UserDeleteCall<'a, C>
25816 where
25817 St: AsRef<str>,
25818 {
25819 self._scopes.insert(String::from(scope.as_ref()));
25820 self
25821 }
25822 /// Identifies the authorization scope(s) for the method you are building.
25823 ///
25824 /// See [`Self::add_scope()`] for details.
25825 pub fn add_scopes<I, St>(mut self, scopes: I) -> UserDeleteCall<'a, C>
25826 where
25827 I: IntoIterator<Item = St>,
25828 St: AsRef<str>,
25829 {
25830 self._scopes
25831 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25832 self
25833 }
25834
25835 /// Removes all scopes, and no default scope will be used either.
25836 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25837 /// for details).
25838 pub fn clear_scopes(mut self) -> UserDeleteCall<'a, C> {
25839 self._scopes.clear();
25840 self
25841 }
25842}
25843
25844/// Generates an authentication token which the device policy client can use to provision the given EMM-managed user account on a device. The generated token is single-use and expires after a few minutes. You can provision a maximum of 10 devices per user. This call only works with EMM-managed accounts.
25845///
25846/// A builder for the *generateAuthenticationToken* method supported by a *user* resource.
25847/// It is not used directly, but through a [`UserMethods`] instance.
25848///
25849/// # Example
25850///
25851/// Instantiate a resource method builder
25852///
25853/// ```test_harness,no_run
25854/// # extern crate hyper;
25855/// # extern crate hyper_rustls;
25856/// # extern crate google_androidenterprise1 as androidenterprise1;
25857/// # async fn dox() {
25858/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25859///
25860/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25861/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25862/// # .with_native_roots()
25863/// # .unwrap()
25864/// # .https_only()
25865/// # .enable_http2()
25866/// # .build();
25867///
25868/// # let executor = hyper_util::rt::TokioExecutor::new();
25869/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25870/// # secret,
25871/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25872/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25873/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25874/// # ),
25875/// # ).build().await.unwrap();
25876///
25877/// # let client = hyper_util::client::legacy::Client::builder(
25878/// # hyper_util::rt::TokioExecutor::new()
25879/// # )
25880/// # .build(
25881/// # hyper_rustls::HttpsConnectorBuilder::new()
25882/// # .with_native_roots()
25883/// # .unwrap()
25884/// # .https_or_http()
25885/// # .enable_http2()
25886/// # .build()
25887/// # );
25888/// # let mut hub = AndroidEnterprise::new(client, auth);
25889/// // You can configure optional parameters by calling the respective setters at will, and
25890/// // execute the final call using `doit()`.
25891/// // Values shown here are possibly random and not representative !
25892/// let result = hub.users().generate_authentication_token("enterpriseId", "userId")
25893/// .doit().await;
25894/// # }
25895/// ```
25896pub struct UserGenerateAuthenticationTokenCall<'a, C>
25897where
25898 C: 'a,
25899{
25900 hub: &'a AndroidEnterprise<C>,
25901 _enterprise_id: String,
25902 _user_id: String,
25903 _delegate: Option<&'a mut dyn common::Delegate>,
25904 _additional_params: HashMap<String, String>,
25905 _scopes: BTreeSet<String>,
25906}
25907
25908impl<'a, C> common::CallBuilder for UserGenerateAuthenticationTokenCall<'a, C> {}
25909
25910impl<'a, C> UserGenerateAuthenticationTokenCall<'a, C>
25911where
25912 C: common::Connector,
25913{
25914 /// Perform the operation you have build so far.
25915 pub async fn doit(mut self) -> common::Result<(common::Response, AuthenticationToken)> {
25916 use std::borrow::Cow;
25917 use std::io::{Read, Seek};
25918
25919 use common::{url::Params, ToParts};
25920 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25921
25922 let mut dd = common::DefaultDelegate;
25923 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25924 dlg.begin(common::MethodInfo {
25925 id: "androidenterprise.users.generateAuthenticationToken",
25926 http_method: hyper::Method::POST,
25927 });
25928
25929 for &field in ["alt", "enterpriseId", "userId"].iter() {
25930 if self._additional_params.contains_key(field) {
25931 dlg.finished(false);
25932 return Err(common::Error::FieldClash(field));
25933 }
25934 }
25935
25936 let mut params = Params::with_capacity(4 + self._additional_params.len());
25937 params.push("enterpriseId", self._enterprise_id);
25938 params.push("userId", self._user_id);
25939
25940 params.extend(self._additional_params.iter());
25941
25942 params.push("alt", "json");
25943 let mut url = self.hub._base_url.clone()
25944 + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/authenticationToken";
25945 if self._scopes.is_empty() {
25946 self._scopes.insert(Scope::Full.as_ref().to_string());
25947 }
25948
25949 #[allow(clippy::single_element_loop)]
25950 for &(find_this, param_name) in
25951 [("{enterpriseId}", "enterpriseId"), ("{userId}", "userId")].iter()
25952 {
25953 url = params.uri_replacement(url, param_name, find_this, false);
25954 }
25955 {
25956 let to_remove = ["userId", "enterpriseId"];
25957 params.remove_params(&to_remove);
25958 }
25959
25960 let url = params.parse_with_url(&url);
25961
25962 loop {
25963 let token = match self
25964 .hub
25965 .auth
25966 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25967 .await
25968 {
25969 Ok(token) => token,
25970 Err(e) => match dlg.token(e) {
25971 Ok(token) => token,
25972 Err(e) => {
25973 dlg.finished(false);
25974 return Err(common::Error::MissingToken(e));
25975 }
25976 },
25977 };
25978 let mut req_result = {
25979 let client = &self.hub.client;
25980 dlg.pre_request();
25981 let mut req_builder = hyper::Request::builder()
25982 .method(hyper::Method::POST)
25983 .uri(url.as_str())
25984 .header(USER_AGENT, self.hub._user_agent.clone());
25985
25986 if let Some(token) = token.as_ref() {
25987 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25988 }
25989
25990 let request = req_builder
25991 .header(CONTENT_LENGTH, 0_u64)
25992 .body(common::to_body::<String>(None));
25993
25994 client.request(request.unwrap()).await
25995 };
25996
25997 match req_result {
25998 Err(err) => {
25999 if let common::Retry::After(d) = dlg.http_error(&err) {
26000 sleep(d).await;
26001 continue;
26002 }
26003 dlg.finished(false);
26004 return Err(common::Error::HttpError(err));
26005 }
26006 Ok(res) => {
26007 let (mut parts, body) = res.into_parts();
26008 let mut body = common::Body::new(body);
26009 if !parts.status.is_success() {
26010 let bytes = common::to_bytes(body).await.unwrap_or_default();
26011 let error = serde_json::from_str(&common::to_string(&bytes));
26012 let response = common::to_response(parts, bytes.into());
26013
26014 if let common::Retry::After(d) =
26015 dlg.http_failure(&response, error.as_ref().ok())
26016 {
26017 sleep(d).await;
26018 continue;
26019 }
26020
26021 dlg.finished(false);
26022
26023 return Err(match error {
26024 Ok(value) => common::Error::BadRequest(value),
26025 _ => common::Error::Failure(response),
26026 });
26027 }
26028 let response = {
26029 let bytes = common::to_bytes(body).await.unwrap_or_default();
26030 let encoded = common::to_string(&bytes);
26031 match serde_json::from_str(&encoded) {
26032 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26033 Err(error) => {
26034 dlg.response_json_decode_error(&encoded, &error);
26035 return Err(common::Error::JsonDecodeError(
26036 encoded.to_string(),
26037 error,
26038 ));
26039 }
26040 }
26041 };
26042
26043 dlg.finished(true);
26044 return Ok(response);
26045 }
26046 }
26047 }
26048 }
26049
26050 /// The ID of the enterprise.
26051 ///
26052 /// Sets the *enterprise id* path property to the given value.
26053 ///
26054 /// Even though the property as already been set when instantiating this call,
26055 /// we provide this method for API completeness.
26056 pub fn enterprise_id(mut self, new_value: &str) -> UserGenerateAuthenticationTokenCall<'a, C> {
26057 self._enterprise_id = new_value.to_string();
26058 self
26059 }
26060 /// The ID of the user.
26061 ///
26062 /// Sets the *user id* path property to the given value.
26063 ///
26064 /// Even though the property as already been set when instantiating this call,
26065 /// we provide this method for API completeness.
26066 pub fn user_id(mut self, new_value: &str) -> UserGenerateAuthenticationTokenCall<'a, C> {
26067 self._user_id = new_value.to_string();
26068 self
26069 }
26070 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26071 /// while executing the actual API request.
26072 ///
26073 /// ````text
26074 /// It should be used to handle progress information, and to implement a certain level of resilience.
26075 /// ````
26076 ///
26077 /// Sets the *delegate* property to the given value.
26078 pub fn delegate(
26079 mut self,
26080 new_value: &'a mut dyn common::Delegate,
26081 ) -> UserGenerateAuthenticationTokenCall<'a, C> {
26082 self._delegate = Some(new_value);
26083 self
26084 }
26085
26086 /// Set any additional parameter of the query string used in the request.
26087 /// It should be used to set parameters which are not yet available through their own
26088 /// setters.
26089 ///
26090 /// Please note that this method must not be used to set any of the known parameters
26091 /// which have their own setter method. If done anyway, the request will fail.
26092 ///
26093 /// # Additional Parameters
26094 ///
26095 /// * *$.xgafv* (query-string) - V1 error format.
26096 /// * *access_token* (query-string) - OAuth access token.
26097 /// * *alt* (query-string) - Data format for response.
26098 /// * *callback* (query-string) - JSONP
26099 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26100 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26101 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26102 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26103 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26104 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26105 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26106 pub fn param<T>(mut self, name: T, value: T) -> UserGenerateAuthenticationTokenCall<'a, C>
26107 where
26108 T: AsRef<str>,
26109 {
26110 self._additional_params
26111 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26112 self
26113 }
26114
26115 /// Identifies the authorization scope for the method you are building.
26116 ///
26117 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26118 /// [`Scope::Full`].
26119 ///
26120 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26121 /// tokens for more than one scope.
26122 ///
26123 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26124 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26125 /// sufficient, a read-write scope will do as well.
26126 pub fn add_scope<St>(mut self, scope: St) -> UserGenerateAuthenticationTokenCall<'a, C>
26127 where
26128 St: AsRef<str>,
26129 {
26130 self._scopes.insert(String::from(scope.as_ref()));
26131 self
26132 }
26133 /// Identifies the authorization scope(s) for the method you are building.
26134 ///
26135 /// See [`Self::add_scope()`] for details.
26136 pub fn add_scopes<I, St>(mut self, scopes: I) -> UserGenerateAuthenticationTokenCall<'a, C>
26137 where
26138 I: IntoIterator<Item = St>,
26139 St: AsRef<str>,
26140 {
26141 self._scopes
26142 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26143 self
26144 }
26145
26146 /// Removes all scopes, and no default scope will be used either.
26147 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26148 /// for details).
26149 pub fn clear_scopes(mut self) -> UserGenerateAuthenticationTokenCall<'a, C> {
26150 self._scopes.clear();
26151 self
26152 }
26153}
26154
26155/// Retrieves a user's details.
26156///
26157/// A builder for the *get* method supported by a *user* resource.
26158/// It is not used directly, but through a [`UserMethods`] instance.
26159///
26160/// # Example
26161///
26162/// Instantiate a resource method builder
26163///
26164/// ```test_harness,no_run
26165/// # extern crate hyper;
26166/// # extern crate hyper_rustls;
26167/// # extern crate google_androidenterprise1 as androidenterprise1;
26168/// # async fn dox() {
26169/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26170///
26171/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26172/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26173/// # .with_native_roots()
26174/// # .unwrap()
26175/// # .https_only()
26176/// # .enable_http2()
26177/// # .build();
26178///
26179/// # let executor = hyper_util::rt::TokioExecutor::new();
26180/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26181/// # secret,
26182/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26183/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26184/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26185/// # ),
26186/// # ).build().await.unwrap();
26187///
26188/// # let client = hyper_util::client::legacy::Client::builder(
26189/// # hyper_util::rt::TokioExecutor::new()
26190/// # )
26191/// # .build(
26192/// # hyper_rustls::HttpsConnectorBuilder::new()
26193/// # .with_native_roots()
26194/// # .unwrap()
26195/// # .https_or_http()
26196/// # .enable_http2()
26197/// # .build()
26198/// # );
26199/// # let mut hub = AndroidEnterprise::new(client, auth);
26200/// // You can configure optional parameters by calling the respective setters at will, and
26201/// // execute the final call using `doit()`.
26202/// // Values shown here are possibly random and not representative !
26203/// let result = hub.users().get("enterpriseId", "userId")
26204/// .doit().await;
26205/// # }
26206/// ```
26207pub struct UserGetCall<'a, C>
26208where
26209 C: 'a,
26210{
26211 hub: &'a AndroidEnterprise<C>,
26212 _enterprise_id: String,
26213 _user_id: String,
26214 _delegate: Option<&'a mut dyn common::Delegate>,
26215 _additional_params: HashMap<String, String>,
26216 _scopes: BTreeSet<String>,
26217}
26218
26219impl<'a, C> common::CallBuilder for UserGetCall<'a, C> {}
26220
26221impl<'a, C> UserGetCall<'a, C>
26222where
26223 C: common::Connector,
26224{
26225 /// Perform the operation you have build so far.
26226 pub async fn doit(mut self) -> common::Result<(common::Response, User)> {
26227 use std::borrow::Cow;
26228 use std::io::{Read, Seek};
26229
26230 use common::{url::Params, ToParts};
26231 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26232
26233 let mut dd = common::DefaultDelegate;
26234 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26235 dlg.begin(common::MethodInfo {
26236 id: "androidenterprise.users.get",
26237 http_method: hyper::Method::GET,
26238 });
26239
26240 for &field in ["alt", "enterpriseId", "userId"].iter() {
26241 if self._additional_params.contains_key(field) {
26242 dlg.finished(false);
26243 return Err(common::Error::FieldClash(field));
26244 }
26245 }
26246
26247 let mut params = Params::with_capacity(4 + self._additional_params.len());
26248 params.push("enterpriseId", self._enterprise_id);
26249 params.push("userId", self._user_id);
26250
26251 params.extend(self._additional_params.iter());
26252
26253 params.push("alt", "json");
26254 let mut url = self.hub._base_url.clone()
26255 + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}";
26256 if self._scopes.is_empty() {
26257 self._scopes.insert(Scope::Full.as_ref().to_string());
26258 }
26259
26260 #[allow(clippy::single_element_loop)]
26261 for &(find_this, param_name) in
26262 [("{enterpriseId}", "enterpriseId"), ("{userId}", "userId")].iter()
26263 {
26264 url = params.uri_replacement(url, param_name, find_this, false);
26265 }
26266 {
26267 let to_remove = ["userId", "enterpriseId"];
26268 params.remove_params(&to_remove);
26269 }
26270
26271 let url = params.parse_with_url(&url);
26272
26273 loop {
26274 let token = match self
26275 .hub
26276 .auth
26277 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26278 .await
26279 {
26280 Ok(token) => token,
26281 Err(e) => match dlg.token(e) {
26282 Ok(token) => token,
26283 Err(e) => {
26284 dlg.finished(false);
26285 return Err(common::Error::MissingToken(e));
26286 }
26287 },
26288 };
26289 let mut req_result = {
26290 let client = &self.hub.client;
26291 dlg.pre_request();
26292 let mut req_builder = hyper::Request::builder()
26293 .method(hyper::Method::GET)
26294 .uri(url.as_str())
26295 .header(USER_AGENT, self.hub._user_agent.clone());
26296
26297 if let Some(token) = token.as_ref() {
26298 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26299 }
26300
26301 let request = req_builder
26302 .header(CONTENT_LENGTH, 0_u64)
26303 .body(common::to_body::<String>(None));
26304
26305 client.request(request.unwrap()).await
26306 };
26307
26308 match req_result {
26309 Err(err) => {
26310 if let common::Retry::After(d) = dlg.http_error(&err) {
26311 sleep(d).await;
26312 continue;
26313 }
26314 dlg.finished(false);
26315 return Err(common::Error::HttpError(err));
26316 }
26317 Ok(res) => {
26318 let (mut parts, body) = res.into_parts();
26319 let mut body = common::Body::new(body);
26320 if !parts.status.is_success() {
26321 let bytes = common::to_bytes(body).await.unwrap_or_default();
26322 let error = serde_json::from_str(&common::to_string(&bytes));
26323 let response = common::to_response(parts, bytes.into());
26324
26325 if let common::Retry::After(d) =
26326 dlg.http_failure(&response, error.as_ref().ok())
26327 {
26328 sleep(d).await;
26329 continue;
26330 }
26331
26332 dlg.finished(false);
26333
26334 return Err(match error {
26335 Ok(value) => common::Error::BadRequest(value),
26336 _ => common::Error::Failure(response),
26337 });
26338 }
26339 let response = {
26340 let bytes = common::to_bytes(body).await.unwrap_or_default();
26341 let encoded = common::to_string(&bytes);
26342 match serde_json::from_str(&encoded) {
26343 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26344 Err(error) => {
26345 dlg.response_json_decode_error(&encoded, &error);
26346 return Err(common::Error::JsonDecodeError(
26347 encoded.to_string(),
26348 error,
26349 ));
26350 }
26351 }
26352 };
26353
26354 dlg.finished(true);
26355 return Ok(response);
26356 }
26357 }
26358 }
26359 }
26360
26361 /// The ID of the enterprise.
26362 ///
26363 /// Sets the *enterprise id* path property to the given value.
26364 ///
26365 /// Even though the property as already been set when instantiating this call,
26366 /// we provide this method for API completeness.
26367 pub fn enterprise_id(mut self, new_value: &str) -> UserGetCall<'a, C> {
26368 self._enterprise_id = new_value.to_string();
26369 self
26370 }
26371 /// The ID of the user.
26372 ///
26373 /// Sets the *user id* path property to the given value.
26374 ///
26375 /// Even though the property as already been set when instantiating this call,
26376 /// we provide this method for API completeness.
26377 pub fn user_id(mut self, new_value: &str) -> UserGetCall<'a, C> {
26378 self._user_id = new_value.to_string();
26379 self
26380 }
26381 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26382 /// while executing the actual API request.
26383 ///
26384 /// ````text
26385 /// It should be used to handle progress information, and to implement a certain level of resilience.
26386 /// ````
26387 ///
26388 /// Sets the *delegate* property to the given value.
26389 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserGetCall<'a, C> {
26390 self._delegate = Some(new_value);
26391 self
26392 }
26393
26394 /// Set any additional parameter of the query string used in the request.
26395 /// It should be used to set parameters which are not yet available through their own
26396 /// setters.
26397 ///
26398 /// Please note that this method must not be used to set any of the known parameters
26399 /// which have their own setter method. If done anyway, the request will fail.
26400 ///
26401 /// # Additional Parameters
26402 ///
26403 /// * *$.xgafv* (query-string) - V1 error format.
26404 /// * *access_token* (query-string) - OAuth access token.
26405 /// * *alt* (query-string) - Data format for response.
26406 /// * *callback* (query-string) - JSONP
26407 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26408 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26409 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26410 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26411 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26412 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26413 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26414 pub fn param<T>(mut self, name: T, value: T) -> UserGetCall<'a, C>
26415 where
26416 T: AsRef<str>,
26417 {
26418 self._additional_params
26419 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26420 self
26421 }
26422
26423 /// Identifies the authorization scope for the method you are building.
26424 ///
26425 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26426 /// [`Scope::Full`].
26427 ///
26428 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26429 /// tokens for more than one scope.
26430 ///
26431 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26432 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26433 /// sufficient, a read-write scope will do as well.
26434 pub fn add_scope<St>(mut self, scope: St) -> UserGetCall<'a, C>
26435 where
26436 St: AsRef<str>,
26437 {
26438 self._scopes.insert(String::from(scope.as_ref()));
26439 self
26440 }
26441 /// Identifies the authorization scope(s) for the method you are building.
26442 ///
26443 /// See [`Self::add_scope()`] for details.
26444 pub fn add_scopes<I, St>(mut self, scopes: I) -> UserGetCall<'a, C>
26445 where
26446 I: IntoIterator<Item = St>,
26447 St: AsRef<str>,
26448 {
26449 self._scopes
26450 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26451 self
26452 }
26453
26454 /// Removes all scopes, and no default scope will be used either.
26455 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26456 /// for details).
26457 pub fn clear_scopes(mut self) -> UserGetCall<'a, C> {
26458 self._scopes.clear();
26459 self
26460 }
26461}
26462
26463/// Retrieves the set of products a user is entitled to access. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
26464///
26465/// A builder for the *getAvailableProductSet* method supported by a *user* resource.
26466/// It is not used directly, but through a [`UserMethods`] instance.
26467///
26468/// # Example
26469///
26470/// Instantiate a resource method builder
26471///
26472/// ```test_harness,no_run
26473/// # extern crate hyper;
26474/// # extern crate hyper_rustls;
26475/// # extern crate google_androidenterprise1 as androidenterprise1;
26476/// # async fn dox() {
26477/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26478///
26479/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26480/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26481/// # .with_native_roots()
26482/// # .unwrap()
26483/// # .https_only()
26484/// # .enable_http2()
26485/// # .build();
26486///
26487/// # let executor = hyper_util::rt::TokioExecutor::new();
26488/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26489/// # secret,
26490/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26491/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26492/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26493/// # ),
26494/// # ).build().await.unwrap();
26495///
26496/// # let client = hyper_util::client::legacy::Client::builder(
26497/// # hyper_util::rt::TokioExecutor::new()
26498/// # )
26499/// # .build(
26500/// # hyper_rustls::HttpsConnectorBuilder::new()
26501/// # .with_native_roots()
26502/// # .unwrap()
26503/// # .https_or_http()
26504/// # .enable_http2()
26505/// # .build()
26506/// # );
26507/// # let mut hub = AndroidEnterprise::new(client, auth);
26508/// // You can configure optional parameters by calling the respective setters at will, and
26509/// // execute the final call using `doit()`.
26510/// // Values shown here are possibly random and not representative !
26511/// let result = hub.users().get_available_product_set("enterpriseId", "userId")
26512/// .doit().await;
26513/// # }
26514/// ```
26515pub struct UserGetAvailableProductSetCall<'a, C>
26516where
26517 C: 'a,
26518{
26519 hub: &'a AndroidEnterprise<C>,
26520 _enterprise_id: String,
26521 _user_id: String,
26522 _delegate: Option<&'a mut dyn common::Delegate>,
26523 _additional_params: HashMap<String, String>,
26524 _scopes: BTreeSet<String>,
26525}
26526
26527impl<'a, C> common::CallBuilder for UserGetAvailableProductSetCall<'a, C> {}
26528
26529impl<'a, C> UserGetAvailableProductSetCall<'a, C>
26530where
26531 C: common::Connector,
26532{
26533 /// Perform the operation you have build so far.
26534 pub async fn doit(mut self) -> common::Result<(common::Response, ProductSet)> {
26535 use std::borrow::Cow;
26536 use std::io::{Read, Seek};
26537
26538 use common::{url::Params, ToParts};
26539 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26540
26541 let mut dd = common::DefaultDelegate;
26542 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26543 dlg.begin(common::MethodInfo {
26544 id: "androidenterprise.users.getAvailableProductSet",
26545 http_method: hyper::Method::GET,
26546 });
26547
26548 for &field in ["alt", "enterpriseId", "userId"].iter() {
26549 if self._additional_params.contains_key(field) {
26550 dlg.finished(false);
26551 return Err(common::Error::FieldClash(field));
26552 }
26553 }
26554
26555 let mut params = Params::with_capacity(4 + self._additional_params.len());
26556 params.push("enterpriseId", self._enterprise_id);
26557 params.push("userId", self._user_id);
26558
26559 params.extend(self._additional_params.iter());
26560
26561 params.push("alt", "json");
26562 let mut url = self.hub._base_url.clone()
26563 + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/availableProductSet";
26564 if self._scopes.is_empty() {
26565 self._scopes.insert(Scope::Full.as_ref().to_string());
26566 }
26567
26568 #[allow(clippy::single_element_loop)]
26569 for &(find_this, param_name) in
26570 [("{enterpriseId}", "enterpriseId"), ("{userId}", "userId")].iter()
26571 {
26572 url = params.uri_replacement(url, param_name, find_this, false);
26573 }
26574 {
26575 let to_remove = ["userId", "enterpriseId"];
26576 params.remove_params(&to_remove);
26577 }
26578
26579 let url = params.parse_with_url(&url);
26580
26581 loop {
26582 let token = match self
26583 .hub
26584 .auth
26585 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26586 .await
26587 {
26588 Ok(token) => token,
26589 Err(e) => match dlg.token(e) {
26590 Ok(token) => token,
26591 Err(e) => {
26592 dlg.finished(false);
26593 return Err(common::Error::MissingToken(e));
26594 }
26595 },
26596 };
26597 let mut req_result = {
26598 let client = &self.hub.client;
26599 dlg.pre_request();
26600 let mut req_builder = hyper::Request::builder()
26601 .method(hyper::Method::GET)
26602 .uri(url.as_str())
26603 .header(USER_AGENT, self.hub._user_agent.clone());
26604
26605 if let Some(token) = token.as_ref() {
26606 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26607 }
26608
26609 let request = req_builder
26610 .header(CONTENT_LENGTH, 0_u64)
26611 .body(common::to_body::<String>(None));
26612
26613 client.request(request.unwrap()).await
26614 };
26615
26616 match req_result {
26617 Err(err) => {
26618 if let common::Retry::After(d) = dlg.http_error(&err) {
26619 sleep(d).await;
26620 continue;
26621 }
26622 dlg.finished(false);
26623 return Err(common::Error::HttpError(err));
26624 }
26625 Ok(res) => {
26626 let (mut parts, body) = res.into_parts();
26627 let mut body = common::Body::new(body);
26628 if !parts.status.is_success() {
26629 let bytes = common::to_bytes(body).await.unwrap_or_default();
26630 let error = serde_json::from_str(&common::to_string(&bytes));
26631 let response = common::to_response(parts, bytes.into());
26632
26633 if let common::Retry::After(d) =
26634 dlg.http_failure(&response, error.as_ref().ok())
26635 {
26636 sleep(d).await;
26637 continue;
26638 }
26639
26640 dlg.finished(false);
26641
26642 return Err(match error {
26643 Ok(value) => common::Error::BadRequest(value),
26644 _ => common::Error::Failure(response),
26645 });
26646 }
26647 let response = {
26648 let bytes = common::to_bytes(body).await.unwrap_or_default();
26649 let encoded = common::to_string(&bytes);
26650 match serde_json::from_str(&encoded) {
26651 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26652 Err(error) => {
26653 dlg.response_json_decode_error(&encoded, &error);
26654 return Err(common::Error::JsonDecodeError(
26655 encoded.to_string(),
26656 error,
26657 ));
26658 }
26659 }
26660 };
26661
26662 dlg.finished(true);
26663 return Ok(response);
26664 }
26665 }
26666 }
26667 }
26668
26669 /// The ID of the enterprise.
26670 ///
26671 /// Sets the *enterprise id* path property to the given value.
26672 ///
26673 /// Even though the property as already been set when instantiating this call,
26674 /// we provide this method for API completeness.
26675 pub fn enterprise_id(mut self, new_value: &str) -> UserGetAvailableProductSetCall<'a, C> {
26676 self._enterprise_id = new_value.to_string();
26677 self
26678 }
26679 /// The ID of the user.
26680 ///
26681 /// Sets the *user id* path property to the given value.
26682 ///
26683 /// Even though the property as already been set when instantiating this call,
26684 /// we provide this method for API completeness.
26685 pub fn user_id(mut self, new_value: &str) -> UserGetAvailableProductSetCall<'a, C> {
26686 self._user_id = new_value.to_string();
26687 self
26688 }
26689 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26690 /// while executing the actual API request.
26691 ///
26692 /// ````text
26693 /// It should be used to handle progress information, and to implement a certain level of resilience.
26694 /// ````
26695 ///
26696 /// Sets the *delegate* property to the given value.
26697 pub fn delegate(
26698 mut self,
26699 new_value: &'a mut dyn common::Delegate,
26700 ) -> UserGetAvailableProductSetCall<'a, C> {
26701 self._delegate = Some(new_value);
26702 self
26703 }
26704
26705 /// Set any additional parameter of the query string used in the request.
26706 /// It should be used to set parameters which are not yet available through their own
26707 /// setters.
26708 ///
26709 /// Please note that this method must not be used to set any of the known parameters
26710 /// which have their own setter method. If done anyway, the request will fail.
26711 ///
26712 /// # Additional Parameters
26713 ///
26714 /// * *$.xgafv* (query-string) - V1 error format.
26715 /// * *access_token* (query-string) - OAuth access token.
26716 /// * *alt* (query-string) - Data format for response.
26717 /// * *callback* (query-string) - JSONP
26718 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26719 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26720 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26721 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26722 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26723 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26724 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26725 pub fn param<T>(mut self, name: T, value: T) -> UserGetAvailableProductSetCall<'a, C>
26726 where
26727 T: AsRef<str>,
26728 {
26729 self._additional_params
26730 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26731 self
26732 }
26733
26734 /// Identifies the authorization scope for the method you are building.
26735 ///
26736 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26737 /// [`Scope::Full`].
26738 ///
26739 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26740 /// tokens for more than one scope.
26741 ///
26742 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26743 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26744 /// sufficient, a read-write scope will do as well.
26745 pub fn add_scope<St>(mut self, scope: St) -> UserGetAvailableProductSetCall<'a, C>
26746 where
26747 St: AsRef<str>,
26748 {
26749 self._scopes.insert(String::from(scope.as_ref()));
26750 self
26751 }
26752 /// Identifies the authorization scope(s) for the method you are building.
26753 ///
26754 /// See [`Self::add_scope()`] for details.
26755 pub fn add_scopes<I, St>(mut self, scopes: I) -> UserGetAvailableProductSetCall<'a, C>
26756 where
26757 I: IntoIterator<Item = St>,
26758 St: AsRef<str>,
26759 {
26760 self._scopes
26761 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26762 self
26763 }
26764
26765 /// Removes all scopes, and no default scope will be used either.
26766 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26767 /// for details).
26768 pub fn clear_scopes(mut self) -> UserGetAvailableProductSetCall<'a, C> {
26769 self._scopes.clear();
26770 self
26771 }
26772}
26773
26774/// Creates a new EMM-managed user. The Users resource passed in the body of the request should include an accountIdentifier and an accountType. If a corresponding user already exists with the same account identifier, the user will be updated with the resource. In this case only the displayName field can be changed.
26775///
26776/// A builder for the *insert* method supported by a *user* resource.
26777/// It is not used directly, but through a [`UserMethods`] instance.
26778///
26779/// # Example
26780///
26781/// Instantiate a resource method builder
26782///
26783/// ```test_harness,no_run
26784/// # extern crate hyper;
26785/// # extern crate hyper_rustls;
26786/// # extern crate google_androidenterprise1 as androidenterprise1;
26787/// use androidenterprise1::api::User;
26788/// # async fn dox() {
26789/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26790///
26791/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26792/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26793/// # .with_native_roots()
26794/// # .unwrap()
26795/// # .https_only()
26796/// # .enable_http2()
26797/// # .build();
26798///
26799/// # let executor = hyper_util::rt::TokioExecutor::new();
26800/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26801/// # secret,
26802/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26803/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26804/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26805/// # ),
26806/// # ).build().await.unwrap();
26807///
26808/// # let client = hyper_util::client::legacy::Client::builder(
26809/// # hyper_util::rt::TokioExecutor::new()
26810/// # )
26811/// # .build(
26812/// # hyper_rustls::HttpsConnectorBuilder::new()
26813/// # .with_native_roots()
26814/// # .unwrap()
26815/// # .https_or_http()
26816/// # .enable_http2()
26817/// # .build()
26818/// # );
26819/// # let mut hub = AndroidEnterprise::new(client, auth);
26820/// // As the method needs a request, you would usually fill it with the desired information
26821/// // into the respective structure. Some of the parts shown here might not be applicable !
26822/// // Values shown here are possibly random and not representative !
26823/// let mut req = User::default();
26824///
26825/// // You can configure optional parameters by calling the respective setters at will, and
26826/// // execute the final call using `doit()`.
26827/// // Values shown here are possibly random and not representative !
26828/// let result = hub.users().insert(req, "enterpriseId")
26829/// .doit().await;
26830/// # }
26831/// ```
26832pub struct UserInsertCall<'a, C>
26833where
26834 C: 'a,
26835{
26836 hub: &'a AndroidEnterprise<C>,
26837 _request: User,
26838 _enterprise_id: String,
26839 _delegate: Option<&'a mut dyn common::Delegate>,
26840 _additional_params: HashMap<String, String>,
26841 _scopes: BTreeSet<String>,
26842}
26843
26844impl<'a, C> common::CallBuilder for UserInsertCall<'a, C> {}
26845
26846impl<'a, C> UserInsertCall<'a, C>
26847where
26848 C: common::Connector,
26849{
26850 /// Perform the operation you have build so far.
26851 pub async fn doit(mut self) -> common::Result<(common::Response, User)> {
26852 use std::borrow::Cow;
26853 use std::io::{Read, Seek};
26854
26855 use common::{url::Params, ToParts};
26856 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26857
26858 let mut dd = common::DefaultDelegate;
26859 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26860 dlg.begin(common::MethodInfo {
26861 id: "androidenterprise.users.insert",
26862 http_method: hyper::Method::POST,
26863 });
26864
26865 for &field in ["alt", "enterpriseId"].iter() {
26866 if self._additional_params.contains_key(field) {
26867 dlg.finished(false);
26868 return Err(common::Error::FieldClash(field));
26869 }
26870 }
26871
26872 let mut params = Params::with_capacity(4 + self._additional_params.len());
26873 params.push("enterpriseId", self._enterprise_id);
26874
26875 params.extend(self._additional_params.iter());
26876
26877 params.push("alt", "json");
26878 let mut url =
26879 self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users";
26880 if self._scopes.is_empty() {
26881 self._scopes.insert(Scope::Full.as_ref().to_string());
26882 }
26883
26884 #[allow(clippy::single_element_loop)]
26885 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
26886 url = params.uri_replacement(url, param_name, find_this, false);
26887 }
26888 {
26889 let to_remove = ["enterpriseId"];
26890 params.remove_params(&to_remove);
26891 }
26892
26893 let url = params.parse_with_url(&url);
26894
26895 let mut json_mime_type = mime::APPLICATION_JSON;
26896 let mut request_value_reader = {
26897 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26898 common::remove_json_null_values(&mut value);
26899 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26900 serde_json::to_writer(&mut dst, &value).unwrap();
26901 dst
26902 };
26903 let request_size = request_value_reader
26904 .seek(std::io::SeekFrom::End(0))
26905 .unwrap();
26906 request_value_reader
26907 .seek(std::io::SeekFrom::Start(0))
26908 .unwrap();
26909
26910 loop {
26911 let token = match self
26912 .hub
26913 .auth
26914 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26915 .await
26916 {
26917 Ok(token) => token,
26918 Err(e) => match dlg.token(e) {
26919 Ok(token) => token,
26920 Err(e) => {
26921 dlg.finished(false);
26922 return Err(common::Error::MissingToken(e));
26923 }
26924 },
26925 };
26926 request_value_reader
26927 .seek(std::io::SeekFrom::Start(0))
26928 .unwrap();
26929 let mut req_result = {
26930 let client = &self.hub.client;
26931 dlg.pre_request();
26932 let mut req_builder = hyper::Request::builder()
26933 .method(hyper::Method::POST)
26934 .uri(url.as_str())
26935 .header(USER_AGENT, self.hub._user_agent.clone());
26936
26937 if let Some(token) = token.as_ref() {
26938 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26939 }
26940
26941 let request = req_builder
26942 .header(CONTENT_TYPE, json_mime_type.to_string())
26943 .header(CONTENT_LENGTH, request_size as u64)
26944 .body(common::to_body(
26945 request_value_reader.get_ref().clone().into(),
26946 ));
26947
26948 client.request(request.unwrap()).await
26949 };
26950
26951 match req_result {
26952 Err(err) => {
26953 if let common::Retry::After(d) = dlg.http_error(&err) {
26954 sleep(d).await;
26955 continue;
26956 }
26957 dlg.finished(false);
26958 return Err(common::Error::HttpError(err));
26959 }
26960 Ok(res) => {
26961 let (mut parts, body) = res.into_parts();
26962 let mut body = common::Body::new(body);
26963 if !parts.status.is_success() {
26964 let bytes = common::to_bytes(body).await.unwrap_or_default();
26965 let error = serde_json::from_str(&common::to_string(&bytes));
26966 let response = common::to_response(parts, bytes.into());
26967
26968 if let common::Retry::After(d) =
26969 dlg.http_failure(&response, error.as_ref().ok())
26970 {
26971 sleep(d).await;
26972 continue;
26973 }
26974
26975 dlg.finished(false);
26976
26977 return Err(match error {
26978 Ok(value) => common::Error::BadRequest(value),
26979 _ => common::Error::Failure(response),
26980 });
26981 }
26982 let response = {
26983 let bytes = common::to_bytes(body).await.unwrap_or_default();
26984 let encoded = common::to_string(&bytes);
26985 match serde_json::from_str(&encoded) {
26986 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26987 Err(error) => {
26988 dlg.response_json_decode_error(&encoded, &error);
26989 return Err(common::Error::JsonDecodeError(
26990 encoded.to_string(),
26991 error,
26992 ));
26993 }
26994 }
26995 };
26996
26997 dlg.finished(true);
26998 return Ok(response);
26999 }
27000 }
27001 }
27002 }
27003
27004 ///
27005 /// Sets the *request* property to the given value.
27006 ///
27007 /// Even though the property as already been set when instantiating this call,
27008 /// we provide this method for API completeness.
27009 pub fn request(mut self, new_value: User) -> UserInsertCall<'a, C> {
27010 self._request = new_value;
27011 self
27012 }
27013 /// The ID of the enterprise.
27014 ///
27015 /// Sets the *enterprise id* path property to the given value.
27016 ///
27017 /// Even though the property as already been set when instantiating this call,
27018 /// we provide this method for API completeness.
27019 pub fn enterprise_id(mut self, new_value: &str) -> UserInsertCall<'a, C> {
27020 self._enterprise_id = new_value.to_string();
27021 self
27022 }
27023 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27024 /// while executing the actual API request.
27025 ///
27026 /// ````text
27027 /// It should be used to handle progress information, and to implement a certain level of resilience.
27028 /// ````
27029 ///
27030 /// Sets the *delegate* property to the given value.
27031 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserInsertCall<'a, C> {
27032 self._delegate = Some(new_value);
27033 self
27034 }
27035
27036 /// Set any additional parameter of the query string used in the request.
27037 /// It should be used to set parameters which are not yet available through their own
27038 /// setters.
27039 ///
27040 /// Please note that this method must not be used to set any of the known parameters
27041 /// which have their own setter method. If done anyway, the request will fail.
27042 ///
27043 /// # Additional Parameters
27044 ///
27045 /// * *$.xgafv* (query-string) - V1 error format.
27046 /// * *access_token* (query-string) - OAuth access token.
27047 /// * *alt* (query-string) - Data format for response.
27048 /// * *callback* (query-string) - JSONP
27049 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27050 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
27051 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27052 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27053 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
27054 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27055 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27056 pub fn param<T>(mut self, name: T, value: T) -> UserInsertCall<'a, C>
27057 where
27058 T: AsRef<str>,
27059 {
27060 self._additional_params
27061 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27062 self
27063 }
27064
27065 /// Identifies the authorization scope for the method you are building.
27066 ///
27067 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27068 /// [`Scope::Full`].
27069 ///
27070 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27071 /// tokens for more than one scope.
27072 ///
27073 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27074 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27075 /// sufficient, a read-write scope will do as well.
27076 pub fn add_scope<St>(mut self, scope: St) -> UserInsertCall<'a, C>
27077 where
27078 St: AsRef<str>,
27079 {
27080 self._scopes.insert(String::from(scope.as_ref()));
27081 self
27082 }
27083 /// Identifies the authorization scope(s) for the method you are building.
27084 ///
27085 /// See [`Self::add_scope()`] for details.
27086 pub fn add_scopes<I, St>(mut self, scopes: I) -> UserInsertCall<'a, C>
27087 where
27088 I: IntoIterator<Item = St>,
27089 St: AsRef<str>,
27090 {
27091 self._scopes
27092 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27093 self
27094 }
27095
27096 /// Removes all scopes, and no default scope will be used either.
27097 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27098 /// for details).
27099 pub fn clear_scopes(mut self) -> UserInsertCall<'a, C> {
27100 self._scopes.clear();
27101 self
27102 }
27103}
27104
27105/// Looks up a user by primary email address. This is only supported for Google-managed users. Lookup of the id is not needed for EMM-managed users because the id is already returned in the result of the Users.insert call.
27106///
27107/// A builder for the *list* method supported by a *user* resource.
27108/// It is not used directly, but through a [`UserMethods`] instance.
27109///
27110/// # Example
27111///
27112/// Instantiate a resource method builder
27113///
27114/// ```test_harness,no_run
27115/// # extern crate hyper;
27116/// # extern crate hyper_rustls;
27117/// # extern crate google_androidenterprise1 as androidenterprise1;
27118/// # async fn dox() {
27119/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27120///
27121/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27122/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27123/// # .with_native_roots()
27124/// # .unwrap()
27125/// # .https_only()
27126/// # .enable_http2()
27127/// # .build();
27128///
27129/// # let executor = hyper_util::rt::TokioExecutor::new();
27130/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27131/// # secret,
27132/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27133/// # yup_oauth2::client::CustomHyperClientBuilder::from(
27134/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
27135/// # ),
27136/// # ).build().await.unwrap();
27137///
27138/// # let client = hyper_util::client::legacy::Client::builder(
27139/// # hyper_util::rt::TokioExecutor::new()
27140/// # )
27141/// # .build(
27142/// # hyper_rustls::HttpsConnectorBuilder::new()
27143/// # .with_native_roots()
27144/// # .unwrap()
27145/// # .https_or_http()
27146/// # .enable_http2()
27147/// # .build()
27148/// # );
27149/// # let mut hub = AndroidEnterprise::new(client, auth);
27150/// // You can configure optional parameters by calling the respective setters at will, and
27151/// // execute the final call using `doit()`.
27152/// // Values shown here are possibly random and not representative !
27153/// let result = hub.users().list("enterpriseId", "email")
27154/// .doit().await;
27155/// # }
27156/// ```
27157pub struct UserListCall<'a, C>
27158where
27159 C: 'a,
27160{
27161 hub: &'a AndroidEnterprise<C>,
27162 _enterprise_id: String,
27163 _email: String,
27164 _delegate: Option<&'a mut dyn common::Delegate>,
27165 _additional_params: HashMap<String, String>,
27166 _scopes: BTreeSet<String>,
27167}
27168
27169impl<'a, C> common::CallBuilder for UserListCall<'a, C> {}
27170
27171impl<'a, C> UserListCall<'a, C>
27172where
27173 C: common::Connector,
27174{
27175 /// Perform the operation you have build so far.
27176 pub async fn doit(mut self) -> common::Result<(common::Response, UsersListResponse)> {
27177 use std::borrow::Cow;
27178 use std::io::{Read, Seek};
27179
27180 use common::{url::Params, ToParts};
27181 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27182
27183 let mut dd = common::DefaultDelegate;
27184 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27185 dlg.begin(common::MethodInfo {
27186 id: "androidenterprise.users.list",
27187 http_method: hyper::Method::GET,
27188 });
27189
27190 for &field in ["alt", "enterpriseId", "email"].iter() {
27191 if self._additional_params.contains_key(field) {
27192 dlg.finished(false);
27193 return Err(common::Error::FieldClash(field));
27194 }
27195 }
27196
27197 let mut params = Params::with_capacity(4 + self._additional_params.len());
27198 params.push("enterpriseId", self._enterprise_id);
27199 params.push("email", self._email);
27200
27201 params.extend(self._additional_params.iter());
27202
27203 params.push("alt", "json");
27204 let mut url =
27205 self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/users";
27206 if self._scopes.is_empty() {
27207 self._scopes.insert(Scope::Full.as_ref().to_string());
27208 }
27209
27210 #[allow(clippy::single_element_loop)]
27211 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
27212 url = params.uri_replacement(url, param_name, find_this, false);
27213 }
27214 {
27215 let to_remove = ["enterpriseId"];
27216 params.remove_params(&to_remove);
27217 }
27218
27219 let url = params.parse_with_url(&url);
27220
27221 loop {
27222 let token = match self
27223 .hub
27224 .auth
27225 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27226 .await
27227 {
27228 Ok(token) => token,
27229 Err(e) => match dlg.token(e) {
27230 Ok(token) => token,
27231 Err(e) => {
27232 dlg.finished(false);
27233 return Err(common::Error::MissingToken(e));
27234 }
27235 },
27236 };
27237 let mut req_result = {
27238 let client = &self.hub.client;
27239 dlg.pre_request();
27240 let mut req_builder = hyper::Request::builder()
27241 .method(hyper::Method::GET)
27242 .uri(url.as_str())
27243 .header(USER_AGENT, self.hub._user_agent.clone());
27244
27245 if let Some(token) = token.as_ref() {
27246 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27247 }
27248
27249 let request = req_builder
27250 .header(CONTENT_LENGTH, 0_u64)
27251 .body(common::to_body::<String>(None));
27252
27253 client.request(request.unwrap()).await
27254 };
27255
27256 match req_result {
27257 Err(err) => {
27258 if let common::Retry::After(d) = dlg.http_error(&err) {
27259 sleep(d).await;
27260 continue;
27261 }
27262 dlg.finished(false);
27263 return Err(common::Error::HttpError(err));
27264 }
27265 Ok(res) => {
27266 let (mut parts, body) = res.into_parts();
27267 let mut body = common::Body::new(body);
27268 if !parts.status.is_success() {
27269 let bytes = common::to_bytes(body).await.unwrap_or_default();
27270 let error = serde_json::from_str(&common::to_string(&bytes));
27271 let response = common::to_response(parts, bytes.into());
27272
27273 if let common::Retry::After(d) =
27274 dlg.http_failure(&response, error.as_ref().ok())
27275 {
27276 sleep(d).await;
27277 continue;
27278 }
27279
27280 dlg.finished(false);
27281
27282 return Err(match error {
27283 Ok(value) => common::Error::BadRequest(value),
27284 _ => common::Error::Failure(response),
27285 });
27286 }
27287 let response = {
27288 let bytes = common::to_bytes(body).await.unwrap_or_default();
27289 let encoded = common::to_string(&bytes);
27290 match serde_json::from_str(&encoded) {
27291 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27292 Err(error) => {
27293 dlg.response_json_decode_error(&encoded, &error);
27294 return Err(common::Error::JsonDecodeError(
27295 encoded.to_string(),
27296 error,
27297 ));
27298 }
27299 }
27300 };
27301
27302 dlg.finished(true);
27303 return Ok(response);
27304 }
27305 }
27306 }
27307 }
27308
27309 /// The ID of the enterprise.
27310 ///
27311 /// Sets the *enterprise id* path property to the given value.
27312 ///
27313 /// Even though the property as already been set when instantiating this call,
27314 /// we provide this method for API completeness.
27315 pub fn enterprise_id(mut self, new_value: &str) -> UserListCall<'a, C> {
27316 self._enterprise_id = new_value.to_string();
27317 self
27318 }
27319 /// Required. The exact primary email address of the user to look up.
27320 ///
27321 /// Sets the *email* query property to the given value.
27322 ///
27323 /// Even though the property as already been set when instantiating this call,
27324 /// we provide this method for API completeness.
27325 pub fn email(mut self, new_value: &str) -> UserListCall<'a, C> {
27326 self._email = new_value.to_string();
27327 self
27328 }
27329 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27330 /// while executing the actual API request.
27331 ///
27332 /// ````text
27333 /// It should be used to handle progress information, and to implement a certain level of resilience.
27334 /// ````
27335 ///
27336 /// Sets the *delegate* property to the given value.
27337 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserListCall<'a, C> {
27338 self._delegate = Some(new_value);
27339 self
27340 }
27341
27342 /// Set any additional parameter of the query string used in the request.
27343 /// It should be used to set parameters which are not yet available through their own
27344 /// setters.
27345 ///
27346 /// Please note that this method must not be used to set any of the known parameters
27347 /// which have their own setter method. If done anyway, the request will fail.
27348 ///
27349 /// # Additional Parameters
27350 ///
27351 /// * *$.xgafv* (query-string) - V1 error format.
27352 /// * *access_token* (query-string) - OAuth access token.
27353 /// * *alt* (query-string) - Data format for response.
27354 /// * *callback* (query-string) - JSONP
27355 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27356 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
27357 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27358 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27359 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
27360 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27361 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27362 pub fn param<T>(mut self, name: T, value: T) -> UserListCall<'a, C>
27363 where
27364 T: AsRef<str>,
27365 {
27366 self._additional_params
27367 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27368 self
27369 }
27370
27371 /// Identifies the authorization scope for the method you are building.
27372 ///
27373 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27374 /// [`Scope::Full`].
27375 ///
27376 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27377 /// tokens for more than one scope.
27378 ///
27379 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27380 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27381 /// sufficient, a read-write scope will do as well.
27382 pub fn add_scope<St>(mut self, scope: St) -> UserListCall<'a, C>
27383 where
27384 St: AsRef<str>,
27385 {
27386 self._scopes.insert(String::from(scope.as_ref()));
27387 self
27388 }
27389 /// Identifies the authorization scope(s) for the method you are building.
27390 ///
27391 /// See [`Self::add_scope()`] for details.
27392 pub fn add_scopes<I, St>(mut self, scopes: I) -> UserListCall<'a, C>
27393 where
27394 I: IntoIterator<Item = St>,
27395 St: AsRef<str>,
27396 {
27397 self._scopes
27398 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27399 self
27400 }
27401
27402 /// Removes all scopes, and no default scope will be used either.
27403 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27404 /// for details).
27405 pub fn clear_scopes(mut self) -> UserListCall<'a, C> {
27406 self._scopes.clear();
27407 self
27408 }
27409}
27410
27411/// Revokes access to all devices currently provisioned to the user. The user will no longer be able to use the managed Play store on any of their managed devices. This call only works with EMM-managed accounts.
27412///
27413/// A builder for the *revokeDeviceAccess* method supported by a *user* resource.
27414/// It is not used directly, but through a [`UserMethods`] instance.
27415///
27416/// # Example
27417///
27418/// Instantiate a resource method builder
27419///
27420/// ```test_harness,no_run
27421/// # extern crate hyper;
27422/// # extern crate hyper_rustls;
27423/// # extern crate google_androidenterprise1 as androidenterprise1;
27424/// # async fn dox() {
27425/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27426///
27427/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27428/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27429/// # .with_native_roots()
27430/// # .unwrap()
27431/// # .https_only()
27432/// # .enable_http2()
27433/// # .build();
27434///
27435/// # let executor = hyper_util::rt::TokioExecutor::new();
27436/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27437/// # secret,
27438/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27439/// # yup_oauth2::client::CustomHyperClientBuilder::from(
27440/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
27441/// # ),
27442/// # ).build().await.unwrap();
27443///
27444/// # let client = hyper_util::client::legacy::Client::builder(
27445/// # hyper_util::rt::TokioExecutor::new()
27446/// # )
27447/// # .build(
27448/// # hyper_rustls::HttpsConnectorBuilder::new()
27449/// # .with_native_roots()
27450/// # .unwrap()
27451/// # .https_or_http()
27452/// # .enable_http2()
27453/// # .build()
27454/// # );
27455/// # let mut hub = AndroidEnterprise::new(client, auth);
27456/// // You can configure optional parameters by calling the respective setters at will, and
27457/// // execute the final call using `doit()`.
27458/// // Values shown here are possibly random and not representative !
27459/// let result = hub.users().revoke_device_access("enterpriseId", "userId")
27460/// .doit().await;
27461/// # }
27462/// ```
27463pub struct UserRevokeDeviceAccesCall<'a, C>
27464where
27465 C: 'a,
27466{
27467 hub: &'a AndroidEnterprise<C>,
27468 _enterprise_id: String,
27469 _user_id: String,
27470 _delegate: Option<&'a mut dyn common::Delegate>,
27471 _additional_params: HashMap<String, String>,
27472 _scopes: BTreeSet<String>,
27473}
27474
27475impl<'a, C> common::CallBuilder for UserRevokeDeviceAccesCall<'a, C> {}
27476
27477impl<'a, C> UserRevokeDeviceAccesCall<'a, C>
27478where
27479 C: common::Connector,
27480{
27481 /// Perform the operation you have build so far.
27482 pub async fn doit(mut self) -> common::Result<common::Response> {
27483 use std::borrow::Cow;
27484 use std::io::{Read, Seek};
27485
27486 use common::{url::Params, ToParts};
27487 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27488
27489 let mut dd = common::DefaultDelegate;
27490 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27491 dlg.begin(common::MethodInfo {
27492 id: "androidenterprise.users.revokeDeviceAccess",
27493 http_method: hyper::Method::DELETE,
27494 });
27495
27496 for &field in ["enterpriseId", "userId"].iter() {
27497 if self._additional_params.contains_key(field) {
27498 dlg.finished(false);
27499 return Err(common::Error::FieldClash(field));
27500 }
27501 }
27502
27503 let mut params = Params::with_capacity(3 + self._additional_params.len());
27504 params.push("enterpriseId", self._enterprise_id);
27505 params.push("userId", self._user_id);
27506
27507 params.extend(self._additional_params.iter());
27508
27509 let mut url = self.hub._base_url.clone()
27510 + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/deviceAccess";
27511 if self._scopes.is_empty() {
27512 self._scopes.insert(Scope::Full.as_ref().to_string());
27513 }
27514
27515 #[allow(clippy::single_element_loop)]
27516 for &(find_this, param_name) in
27517 [("{enterpriseId}", "enterpriseId"), ("{userId}", "userId")].iter()
27518 {
27519 url = params.uri_replacement(url, param_name, find_this, false);
27520 }
27521 {
27522 let to_remove = ["userId", "enterpriseId"];
27523 params.remove_params(&to_remove);
27524 }
27525
27526 let url = params.parse_with_url(&url);
27527
27528 loop {
27529 let token = match self
27530 .hub
27531 .auth
27532 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27533 .await
27534 {
27535 Ok(token) => token,
27536 Err(e) => match dlg.token(e) {
27537 Ok(token) => token,
27538 Err(e) => {
27539 dlg.finished(false);
27540 return Err(common::Error::MissingToken(e));
27541 }
27542 },
27543 };
27544 let mut req_result = {
27545 let client = &self.hub.client;
27546 dlg.pre_request();
27547 let mut req_builder = hyper::Request::builder()
27548 .method(hyper::Method::DELETE)
27549 .uri(url.as_str())
27550 .header(USER_AGENT, self.hub._user_agent.clone());
27551
27552 if let Some(token) = token.as_ref() {
27553 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27554 }
27555
27556 let request = req_builder
27557 .header(CONTENT_LENGTH, 0_u64)
27558 .body(common::to_body::<String>(None));
27559
27560 client.request(request.unwrap()).await
27561 };
27562
27563 match req_result {
27564 Err(err) => {
27565 if let common::Retry::After(d) = dlg.http_error(&err) {
27566 sleep(d).await;
27567 continue;
27568 }
27569 dlg.finished(false);
27570 return Err(common::Error::HttpError(err));
27571 }
27572 Ok(res) => {
27573 let (mut parts, body) = res.into_parts();
27574 let mut body = common::Body::new(body);
27575 if !parts.status.is_success() {
27576 let bytes = common::to_bytes(body).await.unwrap_or_default();
27577 let error = serde_json::from_str(&common::to_string(&bytes));
27578 let response = common::to_response(parts, bytes.into());
27579
27580 if let common::Retry::After(d) =
27581 dlg.http_failure(&response, error.as_ref().ok())
27582 {
27583 sleep(d).await;
27584 continue;
27585 }
27586
27587 dlg.finished(false);
27588
27589 return Err(match error {
27590 Ok(value) => common::Error::BadRequest(value),
27591 _ => common::Error::Failure(response),
27592 });
27593 }
27594 let response = common::Response::from_parts(parts, body);
27595
27596 dlg.finished(true);
27597 return Ok(response);
27598 }
27599 }
27600 }
27601 }
27602
27603 /// The ID of the enterprise.
27604 ///
27605 /// Sets the *enterprise id* path property to the given value.
27606 ///
27607 /// Even though the property as already been set when instantiating this call,
27608 /// we provide this method for API completeness.
27609 pub fn enterprise_id(mut self, new_value: &str) -> UserRevokeDeviceAccesCall<'a, C> {
27610 self._enterprise_id = new_value.to_string();
27611 self
27612 }
27613 /// The ID of the user.
27614 ///
27615 /// Sets the *user id* path property to the given value.
27616 ///
27617 /// Even though the property as already been set when instantiating this call,
27618 /// we provide this method for API completeness.
27619 pub fn user_id(mut self, new_value: &str) -> UserRevokeDeviceAccesCall<'a, C> {
27620 self._user_id = new_value.to_string();
27621 self
27622 }
27623 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27624 /// while executing the actual API request.
27625 ///
27626 /// ````text
27627 /// It should be used to handle progress information, and to implement a certain level of resilience.
27628 /// ````
27629 ///
27630 /// Sets the *delegate* property to the given value.
27631 pub fn delegate(
27632 mut self,
27633 new_value: &'a mut dyn common::Delegate,
27634 ) -> UserRevokeDeviceAccesCall<'a, C> {
27635 self._delegate = Some(new_value);
27636 self
27637 }
27638
27639 /// Set any additional parameter of the query string used in the request.
27640 /// It should be used to set parameters which are not yet available through their own
27641 /// setters.
27642 ///
27643 /// Please note that this method must not be used to set any of the known parameters
27644 /// which have their own setter method. If done anyway, the request will fail.
27645 ///
27646 /// # Additional Parameters
27647 ///
27648 /// * *$.xgafv* (query-string) - V1 error format.
27649 /// * *access_token* (query-string) - OAuth access token.
27650 /// * *alt* (query-string) - Data format for response.
27651 /// * *callback* (query-string) - JSONP
27652 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27653 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
27654 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27655 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27656 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
27657 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27658 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27659 pub fn param<T>(mut self, name: T, value: T) -> UserRevokeDeviceAccesCall<'a, C>
27660 where
27661 T: AsRef<str>,
27662 {
27663 self._additional_params
27664 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27665 self
27666 }
27667
27668 /// Identifies the authorization scope for the method you are building.
27669 ///
27670 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27671 /// [`Scope::Full`].
27672 ///
27673 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27674 /// tokens for more than one scope.
27675 ///
27676 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27677 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27678 /// sufficient, a read-write scope will do as well.
27679 pub fn add_scope<St>(mut self, scope: St) -> UserRevokeDeviceAccesCall<'a, C>
27680 where
27681 St: AsRef<str>,
27682 {
27683 self._scopes.insert(String::from(scope.as_ref()));
27684 self
27685 }
27686 /// Identifies the authorization scope(s) for the method you are building.
27687 ///
27688 /// See [`Self::add_scope()`] for details.
27689 pub fn add_scopes<I, St>(mut self, scopes: I) -> UserRevokeDeviceAccesCall<'a, C>
27690 where
27691 I: IntoIterator<Item = St>,
27692 St: AsRef<str>,
27693 {
27694 self._scopes
27695 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27696 self
27697 }
27698
27699 /// Removes all scopes, and no default scope will be used either.
27700 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27701 /// for details).
27702 pub fn clear_scopes(mut self) -> UserRevokeDeviceAccesCall<'a, C> {
27703 self._scopes.clear();
27704 self
27705 }
27706}
27707
27708/// Modifies the set of products that a user is entitled to access (referred to as *whitelisted* products). Only products that are approved or products that were previously approved (products with revoked approval) can be whitelisted. **Note:** This item has been deprecated. New integrations cannot use this method and can refer to our new recommendations.
27709///
27710/// A builder for the *setAvailableProductSet* method supported by a *user* resource.
27711/// It is not used directly, but through a [`UserMethods`] instance.
27712///
27713/// # Example
27714///
27715/// Instantiate a resource method builder
27716///
27717/// ```test_harness,no_run
27718/// # extern crate hyper;
27719/// # extern crate hyper_rustls;
27720/// # extern crate google_androidenterprise1 as androidenterprise1;
27721/// use androidenterprise1::api::ProductSet;
27722/// # async fn dox() {
27723/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27724///
27725/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27726/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27727/// # .with_native_roots()
27728/// # .unwrap()
27729/// # .https_only()
27730/// # .enable_http2()
27731/// # .build();
27732///
27733/// # let executor = hyper_util::rt::TokioExecutor::new();
27734/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27735/// # secret,
27736/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27737/// # yup_oauth2::client::CustomHyperClientBuilder::from(
27738/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
27739/// # ),
27740/// # ).build().await.unwrap();
27741///
27742/// # let client = hyper_util::client::legacy::Client::builder(
27743/// # hyper_util::rt::TokioExecutor::new()
27744/// # )
27745/// # .build(
27746/// # hyper_rustls::HttpsConnectorBuilder::new()
27747/// # .with_native_roots()
27748/// # .unwrap()
27749/// # .https_or_http()
27750/// # .enable_http2()
27751/// # .build()
27752/// # );
27753/// # let mut hub = AndroidEnterprise::new(client, auth);
27754/// // As the method needs a request, you would usually fill it with the desired information
27755/// // into the respective structure. Some of the parts shown here might not be applicable !
27756/// // Values shown here are possibly random and not representative !
27757/// let mut req = ProductSet::default();
27758///
27759/// // You can configure optional parameters by calling the respective setters at will, and
27760/// // execute the final call using `doit()`.
27761/// // Values shown here are possibly random and not representative !
27762/// let result = hub.users().set_available_product_set(req, "enterpriseId", "userId")
27763/// .doit().await;
27764/// # }
27765/// ```
27766pub struct UserSetAvailableProductSetCall<'a, C>
27767where
27768 C: 'a,
27769{
27770 hub: &'a AndroidEnterprise<C>,
27771 _request: ProductSet,
27772 _enterprise_id: String,
27773 _user_id: String,
27774 _delegate: Option<&'a mut dyn common::Delegate>,
27775 _additional_params: HashMap<String, String>,
27776 _scopes: BTreeSet<String>,
27777}
27778
27779impl<'a, C> common::CallBuilder for UserSetAvailableProductSetCall<'a, C> {}
27780
27781impl<'a, C> UserSetAvailableProductSetCall<'a, C>
27782where
27783 C: common::Connector,
27784{
27785 /// Perform the operation you have build so far.
27786 pub async fn doit(mut self) -> common::Result<(common::Response, ProductSet)> {
27787 use std::borrow::Cow;
27788 use std::io::{Read, Seek};
27789
27790 use common::{url::Params, ToParts};
27791 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27792
27793 let mut dd = common::DefaultDelegate;
27794 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27795 dlg.begin(common::MethodInfo {
27796 id: "androidenterprise.users.setAvailableProductSet",
27797 http_method: hyper::Method::PUT,
27798 });
27799
27800 for &field in ["alt", "enterpriseId", "userId"].iter() {
27801 if self._additional_params.contains_key(field) {
27802 dlg.finished(false);
27803 return Err(common::Error::FieldClash(field));
27804 }
27805 }
27806
27807 let mut params = Params::with_capacity(5 + self._additional_params.len());
27808 params.push("enterpriseId", self._enterprise_id);
27809 params.push("userId", self._user_id);
27810
27811 params.extend(self._additional_params.iter());
27812
27813 params.push("alt", "json");
27814 let mut url = self.hub._base_url.clone()
27815 + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}/availableProductSet";
27816 if self._scopes.is_empty() {
27817 self._scopes.insert(Scope::Full.as_ref().to_string());
27818 }
27819
27820 #[allow(clippy::single_element_loop)]
27821 for &(find_this, param_name) in
27822 [("{enterpriseId}", "enterpriseId"), ("{userId}", "userId")].iter()
27823 {
27824 url = params.uri_replacement(url, param_name, find_this, false);
27825 }
27826 {
27827 let to_remove = ["userId", "enterpriseId"];
27828 params.remove_params(&to_remove);
27829 }
27830
27831 let url = params.parse_with_url(&url);
27832
27833 let mut json_mime_type = mime::APPLICATION_JSON;
27834 let mut request_value_reader = {
27835 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27836 common::remove_json_null_values(&mut value);
27837 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27838 serde_json::to_writer(&mut dst, &value).unwrap();
27839 dst
27840 };
27841 let request_size = request_value_reader
27842 .seek(std::io::SeekFrom::End(0))
27843 .unwrap();
27844 request_value_reader
27845 .seek(std::io::SeekFrom::Start(0))
27846 .unwrap();
27847
27848 loop {
27849 let token = match self
27850 .hub
27851 .auth
27852 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27853 .await
27854 {
27855 Ok(token) => token,
27856 Err(e) => match dlg.token(e) {
27857 Ok(token) => token,
27858 Err(e) => {
27859 dlg.finished(false);
27860 return Err(common::Error::MissingToken(e));
27861 }
27862 },
27863 };
27864 request_value_reader
27865 .seek(std::io::SeekFrom::Start(0))
27866 .unwrap();
27867 let mut req_result = {
27868 let client = &self.hub.client;
27869 dlg.pre_request();
27870 let mut req_builder = hyper::Request::builder()
27871 .method(hyper::Method::PUT)
27872 .uri(url.as_str())
27873 .header(USER_AGENT, self.hub._user_agent.clone());
27874
27875 if let Some(token) = token.as_ref() {
27876 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27877 }
27878
27879 let request = req_builder
27880 .header(CONTENT_TYPE, json_mime_type.to_string())
27881 .header(CONTENT_LENGTH, request_size as u64)
27882 .body(common::to_body(
27883 request_value_reader.get_ref().clone().into(),
27884 ));
27885
27886 client.request(request.unwrap()).await
27887 };
27888
27889 match req_result {
27890 Err(err) => {
27891 if let common::Retry::After(d) = dlg.http_error(&err) {
27892 sleep(d).await;
27893 continue;
27894 }
27895 dlg.finished(false);
27896 return Err(common::Error::HttpError(err));
27897 }
27898 Ok(res) => {
27899 let (mut parts, body) = res.into_parts();
27900 let mut body = common::Body::new(body);
27901 if !parts.status.is_success() {
27902 let bytes = common::to_bytes(body).await.unwrap_or_default();
27903 let error = serde_json::from_str(&common::to_string(&bytes));
27904 let response = common::to_response(parts, bytes.into());
27905
27906 if let common::Retry::After(d) =
27907 dlg.http_failure(&response, error.as_ref().ok())
27908 {
27909 sleep(d).await;
27910 continue;
27911 }
27912
27913 dlg.finished(false);
27914
27915 return Err(match error {
27916 Ok(value) => common::Error::BadRequest(value),
27917 _ => common::Error::Failure(response),
27918 });
27919 }
27920 let response = {
27921 let bytes = common::to_bytes(body).await.unwrap_or_default();
27922 let encoded = common::to_string(&bytes);
27923 match serde_json::from_str(&encoded) {
27924 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27925 Err(error) => {
27926 dlg.response_json_decode_error(&encoded, &error);
27927 return Err(common::Error::JsonDecodeError(
27928 encoded.to_string(),
27929 error,
27930 ));
27931 }
27932 }
27933 };
27934
27935 dlg.finished(true);
27936 return Ok(response);
27937 }
27938 }
27939 }
27940 }
27941
27942 ///
27943 /// Sets the *request* property to the given value.
27944 ///
27945 /// Even though the property as already been set when instantiating this call,
27946 /// we provide this method for API completeness.
27947 pub fn request(mut self, new_value: ProductSet) -> UserSetAvailableProductSetCall<'a, C> {
27948 self._request = new_value;
27949 self
27950 }
27951 /// The ID of the enterprise.
27952 ///
27953 /// Sets the *enterprise id* path property to the given value.
27954 ///
27955 /// Even though the property as already been set when instantiating this call,
27956 /// we provide this method for API completeness.
27957 pub fn enterprise_id(mut self, new_value: &str) -> UserSetAvailableProductSetCall<'a, C> {
27958 self._enterprise_id = new_value.to_string();
27959 self
27960 }
27961 /// The ID of the user.
27962 ///
27963 /// Sets the *user id* path property to the given value.
27964 ///
27965 /// Even though the property as already been set when instantiating this call,
27966 /// we provide this method for API completeness.
27967 pub fn user_id(mut self, new_value: &str) -> UserSetAvailableProductSetCall<'a, C> {
27968 self._user_id = new_value.to_string();
27969 self
27970 }
27971 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27972 /// while executing the actual API request.
27973 ///
27974 /// ````text
27975 /// It should be used to handle progress information, and to implement a certain level of resilience.
27976 /// ````
27977 ///
27978 /// Sets the *delegate* property to the given value.
27979 pub fn delegate(
27980 mut self,
27981 new_value: &'a mut dyn common::Delegate,
27982 ) -> UserSetAvailableProductSetCall<'a, C> {
27983 self._delegate = Some(new_value);
27984 self
27985 }
27986
27987 /// Set any additional parameter of the query string used in the request.
27988 /// It should be used to set parameters which are not yet available through their own
27989 /// setters.
27990 ///
27991 /// Please note that this method must not be used to set any of the known parameters
27992 /// which have their own setter method. If done anyway, the request will fail.
27993 ///
27994 /// # Additional Parameters
27995 ///
27996 /// * *$.xgafv* (query-string) - V1 error format.
27997 /// * *access_token* (query-string) - OAuth access token.
27998 /// * *alt* (query-string) - Data format for response.
27999 /// * *callback* (query-string) - JSONP
28000 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28001 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
28002 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28003 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28004 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
28005 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28006 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28007 pub fn param<T>(mut self, name: T, value: T) -> UserSetAvailableProductSetCall<'a, C>
28008 where
28009 T: AsRef<str>,
28010 {
28011 self._additional_params
28012 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28013 self
28014 }
28015
28016 /// Identifies the authorization scope for the method you are building.
28017 ///
28018 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28019 /// [`Scope::Full`].
28020 ///
28021 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28022 /// tokens for more than one scope.
28023 ///
28024 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28025 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28026 /// sufficient, a read-write scope will do as well.
28027 pub fn add_scope<St>(mut self, scope: St) -> UserSetAvailableProductSetCall<'a, C>
28028 where
28029 St: AsRef<str>,
28030 {
28031 self._scopes.insert(String::from(scope.as_ref()));
28032 self
28033 }
28034 /// Identifies the authorization scope(s) for the method you are building.
28035 ///
28036 /// See [`Self::add_scope()`] for details.
28037 pub fn add_scopes<I, St>(mut self, scopes: I) -> UserSetAvailableProductSetCall<'a, C>
28038 where
28039 I: IntoIterator<Item = St>,
28040 St: AsRef<str>,
28041 {
28042 self._scopes
28043 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28044 self
28045 }
28046
28047 /// Removes all scopes, and no default scope will be used either.
28048 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28049 /// for details).
28050 pub fn clear_scopes(mut self) -> UserSetAvailableProductSetCall<'a, C> {
28051 self._scopes.clear();
28052 self
28053 }
28054}
28055
28056/// Updates the details of an EMM-managed user. Can be used with EMM-managed users only (not Google managed users). Pass the new details in the Users resource in the request body. Only the displayName field can be changed. Other fields must either be unset or have the currently active value.
28057///
28058/// A builder for the *update* method supported by a *user* resource.
28059/// It is not used directly, but through a [`UserMethods`] instance.
28060///
28061/// # Example
28062///
28063/// Instantiate a resource method builder
28064///
28065/// ```test_harness,no_run
28066/// # extern crate hyper;
28067/// # extern crate hyper_rustls;
28068/// # extern crate google_androidenterprise1 as androidenterprise1;
28069/// use androidenterprise1::api::User;
28070/// # async fn dox() {
28071/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28072///
28073/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28074/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28075/// # .with_native_roots()
28076/// # .unwrap()
28077/// # .https_only()
28078/// # .enable_http2()
28079/// # .build();
28080///
28081/// # let executor = hyper_util::rt::TokioExecutor::new();
28082/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28083/// # secret,
28084/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28085/// # yup_oauth2::client::CustomHyperClientBuilder::from(
28086/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
28087/// # ),
28088/// # ).build().await.unwrap();
28089///
28090/// # let client = hyper_util::client::legacy::Client::builder(
28091/// # hyper_util::rt::TokioExecutor::new()
28092/// # )
28093/// # .build(
28094/// # hyper_rustls::HttpsConnectorBuilder::new()
28095/// # .with_native_roots()
28096/// # .unwrap()
28097/// # .https_or_http()
28098/// # .enable_http2()
28099/// # .build()
28100/// # );
28101/// # let mut hub = AndroidEnterprise::new(client, auth);
28102/// // As the method needs a request, you would usually fill it with the desired information
28103/// // into the respective structure. Some of the parts shown here might not be applicable !
28104/// // Values shown here are possibly random and not representative !
28105/// let mut req = User::default();
28106///
28107/// // You can configure optional parameters by calling the respective setters at will, and
28108/// // execute the final call using `doit()`.
28109/// // Values shown here are possibly random and not representative !
28110/// let result = hub.users().update(req, "enterpriseId", "userId")
28111/// .doit().await;
28112/// # }
28113/// ```
28114pub struct UserUpdateCall<'a, C>
28115where
28116 C: 'a,
28117{
28118 hub: &'a AndroidEnterprise<C>,
28119 _request: User,
28120 _enterprise_id: String,
28121 _user_id: String,
28122 _delegate: Option<&'a mut dyn common::Delegate>,
28123 _additional_params: HashMap<String, String>,
28124 _scopes: BTreeSet<String>,
28125}
28126
28127impl<'a, C> common::CallBuilder for UserUpdateCall<'a, C> {}
28128
28129impl<'a, C> UserUpdateCall<'a, C>
28130where
28131 C: common::Connector,
28132{
28133 /// Perform the operation you have build so far.
28134 pub async fn doit(mut self) -> common::Result<(common::Response, User)> {
28135 use std::borrow::Cow;
28136 use std::io::{Read, Seek};
28137
28138 use common::{url::Params, ToParts};
28139 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28140
28141 let mut dd = common::DefaultDelegate;
28142 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28143 dlg.begin(common::MethodInfo {
28144 id: "androidenterprise.users.update",
28145 http_method: hyper::Method::PUT,
28146 });
28147
28148 for &field in ["alt", "enterpriseId", "userId"].iter() {
28149 if self._additional_params.contains_key(field) {
28150 dlg.finished(false);
28151 return Err(common::Error::FieldClash(field));
28152 }
28153 }
28154
28155 let mut params = Params::with_capacity(5 + self._additional_params.len());
28156 params.push("enterpriseId", self._enterprise_id);
28157 params.push("userId", self._user_id);
28158
28159 params.extend(self._additional_params.iter());
28160
28161 params.push("alt", "json");
28162 let mut url = self.hub._base_url.clone()
28163 + "androidenterprise/v1/enterprises/{enterpriseId}/users/{userId}";
28164 if self._scopes.is_empty() {
28165 self._scopes.insert(Scope::Full.as_ref().to_string());
28166 }
28167
28168 #[allow(clippy::single_element_loop)]
28169 for &(find_this, param_name) in
28170 [("{enterpriseId}", "enterpriseId"), ("{userId}", "userId")].iter()
28171 {
28172 url = params.uri_replacement(url, param_name, find_this, false);
28173 }
28174 {
28175 let to_remove = ["userId", "enterpriseId"];
28176 params.remove_params(&to_remove);
28177 }
28178
28179 let url = params.parse_with_url(&url);
28180
28181 let mut json_mime_type = mime::APPLICATION_JSON;
28182 let mut request_value_reader = {
28183 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28184 common::remove_json_null_values(&mut value);
28185 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28186 serde_json::to_writer(&mut dst, &value).unwrap();
28187 dst
28188 };
28189 let request_size = request_value_reader
28190 .seek(std::io::SeekFrom::End(0))
28191 .unwrap();
28192 request_value_reader
28193 .seek(std::io::SeekFrom::Start(0))
28194 .unwrap();
28195
28196 loop {
28197 let token = match self
28198 .hub
28199 .auth
28200 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28201 .await
28202 {
28203 Ok(token) => token,
28204 Err(e) => match dlg.token(e) {
28205 Ok(token) => token,
28206 Err(e) => {
28207 dlg.finished(false);
28208 return Err(common::Error::MissingToken(e));
28209 }
28210 },
28211 };
28212 request_value_reader
28213 .seek(std::io::SeekFrom::Start(0))
28214 .unwrap();
28215 let mut req_result = {
28216 let client = &self.hub.client;
28217 dlg.pre_request();
28218 let mut req_builder = hyper::Request::builder()
28219 .method(hyper::Method::PUT)
28220 .uri(url.as_str())
28221 .header(USER_AGENT, self.hub._user_agent.clone());
28222
28223 if let Some(token) = token.as_ref() {
28224 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28225 }
28226
28227 let request = req_builder
28228 .header(CONTENT_TYPE, json_mime_type.to_string())
28229 .header(CONTENT_LENGTH, request_size as u64)
28230 .body(common::to_body(
28231 request_value_reader.get_ref().clone().into(),
28232 ));
28233
28234 client.request(request.unwrap()).await
28235 };
28236
28237 match req_result {
28238 Err(err) => {
28239 if let common::Retry::After(d) = dlg.http_error(&err) {
28240 sleep(d).await;
28241 continue;
28242 }
28243 dlg.finished(false);
28244 return Err(common::Error::HttpError(err));
28245 }
28246 Ok(res) => {
28247 let (mut parts, body) = res.into_parts();
28248 let mut body = common::Body::new(body);
28249 if !parts.status.is_success() {
28250 let bytes = common::to_bytes(body).await.unwrap_or_default();
28251 let error = serde_json::from_str(&common::to_string(&bytes));
28252 let response = common::to_response(parts, bytes.into());
28253
28254 if let common::Retry::After(d) =
28255 dlg.http_failure(&response, error.as_ref().ok())
28256 {
28257 sleep(d).await;
28258 continue;
28259 }
28260
28261 dlg.finished(false);
28262
28263 return Err(match error {
28264 Ok(value) => common::Error::BadRequest(value),
28265 _ => common::Error::Failure(response),
28266 });
28267 }
28268 let response = {
28269 let bytes = common::to_bytes(body).await.unwrap_or_default();
28270 let encoded = common::to_string(&bytes);
28271 match serde_json::from_str(&encoded) {
28272 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28273 Err(error) => {
28274 dlg.response_json_decode_error(&encoded, &error);
28275 return Err(common::Error::JsonDecodeError(
28276 encoded.to_string(),
28277 error,
28278 ));
28279 }
28280 }
28281 };
28282
28283 dlg.finished(true);
28284 return Ok(response);
28285 }
28286 }
28287 }
28288 }
28289
28290 ///
28291 /// Sets the *request* property to the given value.
28292 ///
28293 /// Even though the property as already been set when instantiating this call,
28294 /// we provide this method for API completeness.
28295 pub fn request(mut self, new_value: User) -> UserUpdateCall<'a, C> {
28296 self._request = new_value;
28297 self
28298 }
28299 /// The ID of the enterprise.
28300 ///
28301 /// Sets the *enterprise id* path property to the given value.
28302 ///
28303 /// Even though the property as already been set when instantiating this call,
28304 /// we provide this method for API completeness.
28305 pub fn enterprise_id(mut self, new_value: &str) -> UserUpdateCall<'a, C> {
28306 self._enterprise_id = new_value.to_string();
28307 self
28308 }
28309 /// The ID of the user.
28310 ///
28311 /// Sets the *user id* path property to the given value.
28312 ///
28313 /// Even though the property as already been set when instantiating this call,
28314 /// we provide this method for API completeness.
28315 pub fn user_id(mut self, new_value: &str) -> UserUpdateCall<'a, C> {
28316 self._user_id = new_value.to_string();
28317 self
28318 }
28319 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28320 /// while executing the actual API request.
28321 ///
28322 /// ````text
28323 /// It should be used to handle progress information, and to implement a certain level of resilience.
28324 /// ````
28325 ///
28326 /// Sets the *delegate* property to the given value.
28327 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserUpdateCall<'a, C> {
28328 self._delegate = Some(new_value);
28329 self
28330 }
28331
28332 /// Set any additional parameter of the query string used in the request.
28333 /// It should be used to set parameters which are not yet available through their own
28334 /// setters.
28335 ///
28336 /// Please note that this method must not be used to set any of the known parameters
28337 /// which have their own setter method. If done anyway, the request will fail.
28338 ///
28339 /// # Additional Parameters
28340 ///
28341 /// * *$.xgafv* (query-string) - V1 error format.
28342 /// * *access_token* (query-string) - OAuth access token.
28343 /// * *alt* (query-string) - Data format for response.
28344 /// * *callback* (query-string) - JSONP
28345 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28346 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
28347 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28348 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28349 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
28350 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28351 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28352 pub fn param<T>(mut self, name: T, value: T) -> UserUpdateCall<'a, C>
28353 where
28354 T: AsRef<str>,
28355 {
28356 self._additional_params
28357 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28358 self
28359 }
28360
28361 /// Identifies the authorization scope for the method you are building.
28362 ///
28363 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28364 /// [`Scope::Full`].
28365 ///
28366 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28367 /// tokens for more than one scope.
28368 ///
28369 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28370 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28371 /// sufficient, a read-write scope will do as well.
28372 pub fn add_scope<St>(mut self, scope: St) -> UserUpdateCall<'a, C>
28373 where
28374 St: AsRef<str>,
28375 {
28376 self._scopes.insert(String::from(scope.as_ref()));
28377 self
28378 }
28379 /// Identifies the authorization scope(s) for the method you are building.
28380 ///
28381 /// See [`Self::add_scope()`] for details.
28382 pub fn add_scopes<I, St>(mut self, scopes: I) -> UserUpdateCall<'a, C>
28383 where
28384 I: IntoIterator<Item = St>,
28385 St: AsRef<str>,
28386 {
28387 self._scopes
28388 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28389 self
28390 }
28391
28392 /// Removes all scopes, and no default scope will be used either.
28393 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28394 /// for details).
28395 pub fn clear_scopes(mut self) -> UserUpdateCall<'a, C> {
28396 self._scopes.clear();
28397 self
28398 }
28399}
28400
28401/// Deletes an existing web app.
28402///
28403/// A builder for the *delete* method supported by a *webapp* resource.
28404/// It is not used directly, but through a [`WebappMethods`] instance.
28405///
28406/// # Example
28407///
28408/// Instantiate a resource method builder
28409///
28410/// ```test_harness,no_run
28411/// # extern crate hyper;
28412/// # extern crate hyper_rustls;
28413/// # extern crate google_androidenterprise1 as androidenterprise1;
28414/// # async fn dox() {
28415/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28416///
28417/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28418/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28419/// # .with_native_roots()
28420/// # .unwrap()
28421/// # .https_only()
28422/// # .enable_http2()
28423/// # .build();
28424///
28425/// # let executor = hyper_util::rt::TokioExecutor::new();
28426/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28427/// # secret,
28428/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28429/// # yup_oauth2::client::CustomHyperClientBuilder::from(
28430/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
28431/// # ),
28432/// # ).build().await.unwrap();
28433///
28434/// # let client = hyper_util::client::legacy::Client::builder(
28435/// # hyper_util::rt::TokioExecutor::new()
28436/// # )
28437/// # .build(
28438/// # hyper_rustls::HttpsConnectorBuilder::new()
28439/// # .with_native_roots()
28440/// # .unwrap()
28441/// # .https_or_http()
28442/// # .enable_http2()
28443/// # .build()
28444/// # );
28445/// # let mut hub = AndroidEnterprise::new(client, auth);
28446/// // You can configure optional parameters by calling the respective setters at will, and
28447/// // execute the final call using `doit()`.
28448/// // Values shown here are possibly random and not representative !
28449/// let result = hub.webapps().delete("enterpriseId", "webAppId")
28450/// .doit().await;
28451/// # }
28452/// ```
28453pub struct WebappDeleteCall<'a, C>
28454where
28455 C: 'a,
28456{
28457 hub: &'a AndroidEnterprise<C>,
28458 _enterprise_id: String,
28459 _web_app_id: String,
28460 _delegate: Option<&'a mut dyn common::Delegate>,
28461 _additional_params: HashMap<String, String>,
28462 _scopes: BTreeSet<String>,
28463}
28464
28465impl<'a, C> common::CallBuilder for WebappDeleteCall<'a, C> {}
28466
28467impl<'a, C> WebappDeleteCall<'a, C>
28468where
28469 C: common::Connector,
28470{
28471 /// Perform the operation you have build so far.
28472 pub async fn doit(mut self) -> common::Result<common::Response> {
28473 use std::borrow::Cow;
28474 use std::io::{Read, Seek};
28475
28476 use common::{url::Params, ToParts};
28477 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28478
28479 let mut dd = common::DefaultDelegate;
28480 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28481 dlg.begin(common::MethodInfo {
28482 id: "androidenterprise.webapps.delete",
28483 http_method: hyper::Method::DELETE,
28484 });
28485
28486 for &field in ["enterpriseId", "webAppId"].iter() {
28487 if self._additional_params.contains_key(field) {
28488 dlg.finished(false);
28489 return Err(common::Error::FieldClash(field));
28490 }
28491 }
28492
28493 let mut params = Params::with_capacity(3 + self._additional_params.len());
28494 params.push("enterpriseId", self._enterprise_id);
28495 params.push("webAppId", self._web_app_id);
28496
28497 params.extend(self._additional_params.iter());
28498
28499 let mut url = self.hub._base_url.clone()
28500 + "androidenterprise/v1/enterprises/{enterpriseId}/webApps/{webAppId}";
28501 if self._scopes.is_empty() {
28502 self._scopes.insert(Scope::Full.as_ref().to_string());
28503 }
28504
28505 #[allow(clippy::single_element_loop)]
28506 for &(find_this, param_name) in [
28507 ("{enterpriseId}", "enterpriseId"),
28508 ("{webAppId}", "webAppId"),
28509 ]
28510 .iter()
28511 {
28512 url = params.uri_replacement(url, param_name, find_this, false);
28513 }
28514 {
28515 let to_remove = ["webAppId", "enterpriseId"];
28516 params.remove_params(&to_remove);
28517 }
28518
28519 let url = params.parse_with_url(&url);
28520
28521 loop {
28522 let token = match self
28523 .hub
28524 .auth
28525 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28526 .await
28527 {
28528 Ok(token) => token,
28529 Err(e) => match dlg.token(e) {
28530 Ok(token) => token,
28531 Err(e) => {
28532 dlg.finished(false);
28533 return Err(common::Error::MissingToken(e));
28534 }
28535 },
28536 };
28537 let mut req_result = {
28538 let client = &self.hub.client;
28539 dlg.pre_request();
28540 let mut req_builder = hyper::Request::builder()
28541 .method(hyper::Method::DELETE)
28542 .uri(url.as_str())
28543 .header(USER_AGENT, self.hub._user_agent.clone());
28544
28545 if let Some(token) = token.as_ref() {
28546 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28547 }
28548
28549 let request = req_builder
28550 .header(CONTENT_LENGTH, 0_u64)
28551 .body(common::to_body::<String>(None));
28552
28553 client.request(request.unwrap()).await
28554 };
28555
28556 match req_result {
28557 Err(err) => {
28558 if let common::Retry::After(d) = dlg.http_error(&err) {
28559 sleep(d).await;
28560 continue;
28561 }
28562 dlg.finished(false);
28563 return Err(common::Error::HttpError(err));
28564 }
28565 Ok(res) => {
28566 let (mut parts, body) = res.into_parts();
28567 let mut body = common::Body::new(body);
28568 if !parts.status.is_success() {
28569 let bytes = common::to_bytes(body).await.unwrap_or_default();
28570 let error = serde_json::from_str(&common::to_string(&bytes));
28571 let response = common::to_response(parts, bytes.into());
28572
28573 if let common::Retry::After(d) =
28574 dlg.http_failure(&response, error.as_ref().ok())
28575 {
28576 sleep(d).await;
28577 continue;
28578 }
28579
28580 dlg.finished(false);
28581
28582 return Err(match error {
28583 Ok(value) => common::Error::BadRequest(value),
28584 _ => common::Error::Failure(response),
28585 });
28586 }
28587 let response = common::Response::from_parts(parts, body);
28588
28589 dlg.finished(true);
28590 return Ok(response);
28591 }
28592 }
28593 }
28594 }
28595
28596 /// The ID of the enterprise.
28597 ///
28598 /// Sets the *enterprise id* path property to the given value.
28599 ///
28600 /// Even though the property as already been set when instantiating this call,
28601 /// we provide this method for API completeness.
28602 pub fn enterprise_id(mut self, new_value: &str) -> WebappDeleteCall<'a, C> {
28603 self._enterprise_id = new_value.to_string();
28604 self
28605 }
28606 /// The ID of the web app.
28607 ///
28608 /// Sets the *web app id* path property to the given value.
28609 ///
28610 /// Even though the property as already been set when instantiating this call,
28611 /// we provide this method for API completeness.
28612 pub fn web_app_id(mut self, new_value: &str) -> WebappDeleteCall<'a, C> {
28613 self._web_app_id = new_value.to_string();
28614 self
28615 }
28616 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28617 /// while executing the actual API request.
28618 ///
28619 /// ````text
28620 /// It should be used to handle progress information, and to implement a certain level of resilience.
28621 /// ````
28622 ///
28623 /// Sets the *delegate* property to the given value.
28624 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> WebappDeleteCall<'a, C> {
28625 self._delegate = Some(new_value);
28626 self
28627 }
28628
28629 /// Set any additional parameter of the query string used in the request.
28630 /// It should be used to set parameters which are not yet available through their own
28631 /// setters.
28632 ///
28633 /// Please note that this method must not be used to set any of the known parameters
28634 /// which have their own setter method. If done anyway, the request will fail.
28635 ///
28636 /// # Additional Parameters
28637 ///
28638 /// * *$.xgafv* (query-string) - V1 error format.
28639 /// * *access_token* (query-string) - OAuth access token.
28640 /// * *alt* (query-string) - Data format for response.
28641 /// * *callback* (query-string) - JSONP
28642 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28643 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
28644 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28645 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28646 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
28647 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28648 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28649 pub fn param<T>(mut self, name: T, value: T) -> WebappDeleteCall<'a, C>
28650 where
28651 T: AsRef<str>,
28652 {
28653 self._additional_params
28654 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28655 self
28656 }
28657
28658 /// Identifies the authorization scope for the method you are building.
28659 ///
28660 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28661 /// [`Scope::Full`].
28662 ///
28663 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28664 /// tokens for more than one scope.
28665 ///
28666 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28667 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28668 /// sufficient, a read-write scope will do as well.
28669 pub fn add_scope<St>(mut self, scope: St) -> WebappDeleteCall<'a, C>
28670 where
28671 St: AsRef<str>,
28672 {
28673 self._scopes.insert(String::from(scope.as_ref()));
28674 self
28675 }
28676 /// Identifies the authorization scope(s) for the method you are building.
28677 ///
28678 /// See [`Self::add_scope()`] for details.
28679 pub fn add_scopes<I, St>(mut self, scopes: I) -> WebappDeleteCall<'a, C>
28680 where
28681 I: IntoIterator<Item = St>,
28682 St: AsRef<str>,
28683 {
28684 self._scopes
28685 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28686 self
28687 }
28688
28689 /// Removes all scopes, and no default scope will be used either.
28690 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28691 /// for details).
28692 pub fn clear_scopes(mut self) -> WebappDeleteCall<'a, C> {
28693 self._scopes.clear();
28694 self
28695 }
28696}
28697
28698/// Gets an existing web app.
28699///
28700/// A builder for the *get* method supported by a *webapp* resource.
28701/// It is not used directly, but through a [`WebappMethods`] instance.
28702///
28703/// # Example
28704///
28705/// Instantiate a resource method builder
28706///
28707/// ```test_harness,no_run
28708/// # extern crate hyper;
28709/// # extern crate hyper_rustls;
28710/// # extern crate google_androidenterprise1 as androidenterprise1;
28711/// # async fn dox() {
28712/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28713///
28714/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28715/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28716/// # .with_native_roots()
28717/// # .unwrap()
28718/// # .https_only()
28719/// # .enable_http2()
28720/// # .build();
28721///
28722/// # let executor = hyper_util::rt::TokioExecutor::new();
28723/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28724/// # secret,
28725/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28726/// # yup_oauth2::client::CustomHyperClientBuilder::from(
28727/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
28728/// # ),
28729/// # ).build().await.unwrap();
28730///
28731/// # let client = hyper_util::client::legacy::Client::builder(
28732/// # hyper_util::rt::TokioExecutor::new()
28733/// # )
28734/// # .build(
28735/// # hyper_rustls::HttpsConnectorBuilder::new()
28736/// # .with_native_roots()
28737/// # .unwrap()
28738/// # .https_or_http()
28739/// # .enable_http2()
28740/// # .build()
28741/// # );
28742/// # let mut hub = AndroidEnterprise::new(client, auth);
28743/// // You can configure optional parameters by calling the respective setters at will, and
28744/// // execute the final call using `doit()`.
28745/// // Values shown here are possibly random and not representative !
28746/// let result = hub.webapps().get("enterpriseId", "webAppId")
28747/// .doit().await;
28748/// # }
28749/// ```
28750pub struct WebappGetCall<'a, C>
28751where
28752 C: 'a,
28753{
28754 hub: &'a AndroidEnterprise<C>,
28755 _enterprise_id: String,
28756 _web_app_id: String,
28757 _delegate: Option<&'a mut dyn common::Delegate>,
28758 _additional_params: HashMap<String, String>,
28759 _scopes: BTreeSet<String>,
28760}
28761
28762impl<'a, C> common::CallBuilder for WebappGetCall<'a, C> {}
28763
28764impl<'a, C> WebappGetCall<'a, C>
28765where
28766 C: common::Connector,
28767{
28768 /// Perform the operation you have build so far.
28769 pub async fn doit(mut self) -> common::Result<(common::Response, WebApp)> {
28770 use std::borrow::Cow;
28771 use std::io::{Read, Seek};
28772
28773 use common::{url::Params, ToParts};
28774 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28775
28776 let mut dd = common::DefaultDelegate;
28777 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28778 dlg.begin(common::MethodInfo {
28779 id: "androidenterprise.webapps.get",
28780 http_method: hyper::Method::GET,
28781 });
28782
28783 for &field in ["alt", "enterpriseId", "webAppId"].iter() {
28784 if self._additional_params.contains_key(field) {
28785 dlg.finished(false);
28786 return Err(common::Error::FieldClash(field));
28787 }
28788 }
28789
28790 let mut params = Params::with_capacity(4 + self._additional_params.len());
28791 params.push("enterpriseId", self._enterprise_id);
28792 params.push("webAppId", self._web_app_id);
28793
28794 params.extend(self._additional_params.iter());
28795
28796 params.push("alt", "json");
28797 let mut url = self.hub._base_url.clone()
28798 + "androidenterprise/v1/enterprises/{enterpriseId}/webApps/{webAppId}";
28799 if self._scopes.is_empty() {
28800 self._scopes.insert(Scope::Full.as_ref().to_string());
28801 }
28802
28803 #[allow(clippy::single_element_loop)]
28804 for &(find_this, param_name) in [
28805 ("{enterpriseId}", "enterpriseId"),
28806 ("{webAppId}", "webAppId"),
28807 ]
28808 .iter()
28809 {
28810 url = params.uri_replacement(url, param_name, find_this, false);
28811 }
28812 {
28813 let to_remove = ["webAppId", "enterpriseId"];
28814 params.remove_params(&to_remove);
28815 }
28816
28817 let url = params.parse_with_url(&url);
28818
28819 loop {
28820 let token = match self
28821 .hub
28822 .auth
28823 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28824 .await
28825 {
28826 Ok(token) => token,
28827 Err(e) => match dlg.token(e) {
28828 Ok(token) => token,
28829 Err(e) => {
28830 dlg.finished(false);
28831 return Err(common::Error::MissingToken(e));
28832 }
28833 },
28834 };
28835 let mut req_result = {
28836 let client = &self.hub.client;
28837 dlg.pre_request();
28838 let mut req_builder = hyper::Request::builder()
28839 .method(hyper::Method::GET)
28840 .uri(url.as_str())
28841 .header(USER_AGENT, self.hub._user_agent.clone());
28842
28843 if let Some(token) = token.as_ref() {
28844 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28845 }
28846
28847 let request = req_builder
28848 .header(CONTENT_LENGTH, 0_u64)
28849 .body(common::to_body::<String>(None));
28850
28851 client.request(request.unwrap()).await
28852 };
28853
28854 match req_result {
28855 Err(err) => {
28856 if let common::Retry::After(d) = dlg.http_error(&err) {
28857 sleep(d).await;
28858 continue;
28859 }
28860 dlg.finished(false);
28861 return Err(common::Error::HttpError(err));
28862 }
28863 Ok(res) => {
28864 let (mut parts, body) = res.into_parts();
28865 let mut body = common::Body::new(body);
28866 if !parts.status.is_success() {
28867 let bytes = common::to_bytes(body).await.unwrap_or_default();
28868 let error = serde_json::from_str(&common::to_string(&bytes));
28869 let response = common::to_response(parts, bytes.into());
28870
28871 if let common::Retry::After(d) =
28872 dlg.http_failure(&response, error.as_ref().ok())
28873 {
28874 sleep(d).await;
28875 continue;
28876 }
28877
28878 dlg.finished(false);
28879
28880 return Err(match error {
28881 Ok(value) => common::Error::BadRequest(value),
28882 _ => common::Error::Failure(response),
28883 });
28884 }
28885 let response = {
28886 let bytes = common::to_bytes(body).await.unwrap_or_default();
28887 let encoded = common::to_string(&bytes);
28888 match serde_json::from_str(&encoded) {
28889 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28890 Err(error) => {
28891 dlg.response_json_decode_error(&encoded, &error);
28892 return Err(common::Error::JsonDecodeError(
28893 encoded.to_string(),
28894 error,
28895 ));
28896 }
28897 }
28898 };
28899
28900 dlg.finished(true);
28901 return Ok(response);
28902 }
28903 }
28904 }
28905 }
28906
28907 /// The ID of the enterprise.
28908 ///
28909 /// Sets the *enterprise id* path property to the given value.
28910 ///
28911 /// Even though the property as already been set when instantiating this call,
28912 /// we provide this method for API completeness.
28913 pub fn enterprise_id(mut self, new_value: &str) -> WebappGetCall<'a, C> {
28914 self._enterprise_id = new_value.to_string();
28915 self
28916 }
28917 /// The ID of the web app.
28918 ///
28919 /// Sets the *web app id* path property to the given value.
28920 ///
28921 /// Even though the property as already been set when instantiating this call,
28922 /// we provide this method for API completeness.
28923 pub fn web_app_id(mut self, new_value: &str) -> WebappGetCall<'a, C> {
28924 self._web_app_id = new_value.to_string();
28925 self
28926 }
28927 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28928 /// while executing the actual API request.
28929 ///
28930 /// ````text
28931 /// It should be used to handle progress information, and to implement a certain level of resilience.
28932 /// ````
28933 ///
28934 /// Sets the *delegate* property to the given value.
28935 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> WebappGetCall<'a, C> {
28936 self._delegate = Some(new_value);
28937 self
28938 }
28939
28940 /// Set any additional parameter of the query string used in the request.
28941 /// It should be used to set parameters which are not yet available through their own
28942 /// setters.
28943 ///
28944 /// Please note that this method must not be used to set any of the known parameters
28945 /// which have their own setter method. If done anyway, the request will fail.
28946 ///
28947 /// # Additional Parameters
28948 ///
28949 /// * *$.xgafv* (query-string) - V1 error format.
28950 /// * *access_token* (query-string) - OAuth access token.
28951 /// * *alt* (query-string) - Data format for response.
28952 /// * *callback* (query-string) - JSONP
28953 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28954 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
28955 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28956 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28957 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
28958 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28959 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28960 pub fn param<T>(mut self, name: T, value: T) -> WebappGetCall<'a, C>
28961 where
28962 T: AsRef<str>,
28963 {
28964 self._additional_params
28965 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28966 self
28967 }
28968
28969 /// Identifies the authorization scope for the method you are building.
28970 ///
28971 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28972 /// [`Scope::Full`].
28973 ///
28974 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28975 /// tokens for more than one scope.
28976 ///
28977 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28978 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28979 /// sufficient, a read-write scope will do as well.
28980 pub fn add_scope<St>(mut self, scope: St) -> WebappGetCall<'a, C>
28981 where
28982 St: AsRef<str>,
28983 {
28984 self._scopes.insert(String::from(scope.as_ref()));
28985 self
28986 }
28987 /// Identifies the authorization scope(s) for the method you are building.
28988 ///
28989 /// See [`Self::add_scope()`] for details.
28990 pub fn add_scopes<I, St>(mut self, scopes: I) -> WebappGetCall<'a, C>
28991 where
28992 I: IntoIterator<Item = St>,
28993 St: AsRef<str>,
28994 {
28995 self._scopes
28996 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28997 self
28998 }
28999
29000 /// Removes all scopes, and no default scope will be used either.
29001 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29002 /// for details).
29003 pub fn clear_scopes(mut self) -> WebappGetCall<'a, C> {
29004 self._scopes.clear();
29005 self
29006 }
29007}
29008
29009/// Creates a new web app for the enterprise.
29010///
29011/// A builder for the *insert* method supported by a *webapp* resource.
29012/// It is not used directly, but through a [`WebappMethods`] instance.
29013///
29014/// # Example
29015///
29016/// Instantiate a resource method builder
29017///
29018/// ```test_harness,no_run
29019/// # extern crate hyper;
29020/// # extern crate hyper_rustls;
29021/// # extern crate google_androidenterprise1 as androidenterprise1;
29022/// use androidenterprise1::api::WebApp;
29023/// # async fn dox() {
29024/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29025///
29026/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29027/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29028/// # .with_native_roots()
29029/// # .unwrap()
29030/// # .https_only()
29031/// # .enable_http2()
29032/// # .build();
29033///
29034/// # let executor = hyper_util::rt::TokioExecutor::new();
29035/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29036/// # secret,
29037/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29038/// # yup_oauth2::client::CustomHyperClientBuilder::from(
29039/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
29040/// # ),
29041/// # ).build().await.unwrap();
29042///
29043/// # let client = hyper_util::client::legacy::Client::builder(
29044/// # hyper_util::rt::TokioExecutor::new()
29045/// # )
29046/// # .build(
29047/// # hyper_rustls::HttpsConnectorBuilder::new()
29048/// # .with_native_roots()
29049/// # .unwrap()
29050/// # .https_or_http()
29051/// # .enable_http2()
29052/// # .build()
29053/// # );
29054/// # let mut hub = AndroidEnterprise::new(client, auth);
29055/// // As the method needs a request, you would usually fill it with the desired information
29056/// // into the respective structure. Some of the parts shown here might not be applicable !
29057/// // Values shown here are possibly random and not representative !
29058/// let mut req = WebApp::default();
29059///
29060/// // You can configure optional parameters by calling the respective setters at will, and
29061/// // execute the final call using `doit()`.
29062/// // Values shown here are possibly random and not representative !
29063/// let result = hub.webapps().insert(req, "enterpriseId")
29064/// .doit().await;
29065/// # }
29066/// ```
29067pub struct WebappInsertCall<'a, C>
29068where
29069 C: 'a,
29070{
29071 hub: &'a AndroidEnterprise<C>,
29072 _request: WebApp,
29073 _enterprise_id: String,
29074 _delegate: Option<&'a mut dyn common::Delegate>,
29075 _additional_params: HashMap<String, String>,
29076 _scopes: BTreeSet<String>,
29077}
29078
29079impl<'a, C> common::CallBuilder for WebappInsertCall<'a, C> {}
29080
29081impl<'a, C> WebappInsertCall<'a, C>
29082where
29083 C: common::Connector,
29084{
29085 /// Perform the operation you have build so far.
29086 pub async fn doit(mut self) -> common::Result<(common::Response, WebApp)> {
29087 use std::borrow::Cow;
29088 use std::io::{Read, Seek};
29089
29090 use common::{url::Params, ToParts};
29091 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29092
29093 let mut dd = common::DefaultDelegate;
29094 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29095 dlg.begin(common::MethodInfo {
29096 id: "androidenterprise.webapps.insert",
29097 http_method: hyper::Method::POST,
29098 });
29099
29100 for &field in ["alt", "enterpriseId"].iter() {
29101 if self._additional_params.contains_key(field) {
29102 dlg.finished(false);
29103 return Err(common::Error::FieldClash(field));
29104 }
29105 }
29106
29107 let mut params = Params::with_capacity(4 + self._additional_params.len());
29108 params.push("enterpriseId", self._enterprise_id);
29109
29110 params.extend(self._additional_params.iter());
29111
29112 params.push("alt", "json");
29113 let mut url =
29114 self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/webApps";
29115 if self._scopes.is_empty() {
29116 self._scopes.insert(Scope::Full.as_ref().to_string());
29117 }
29118
29119 #[allow(clippy::single_element_loop)]
29120 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
29121 url = params.uri_replacement(url, param_name, find_this, false);
29122 }
29123 {
29124 let to_remove = ["enterpriseId"];
29125 params.remove_params(&to_remove);
29126 }
29127
29128 let url = params.parse_with_url(&url);
29129
29130 let mut json_mime_type = mime::APPLICATION_JSON;
29131 let mut request_value_reader = {
29132 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29133 common::remove_json_null_values(&mut value);
29134 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29135 serde_json::to_writer(&mut dst, &value).unwrap();
29136 dst
29137 };
29138 let request_size = request_value_reader
29139 .seek(std::io::SeekFrom::End(0))
29140 .unwrap();
29141 request_value_reader
29142 .seek(std::io::SeekFrom::Start(0))
29143 .unwrap();
29144
29145 loop {
29146 let token = match self
29147 .hub
29148 .auth
29149 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29150 .await
29151 {
29152 Ok(token) => token,
29153 Err(e) => match dlg.token(e) {
29154 Ok(token) => token,
29155 Err(e) => {
29156 dlg.finished(false);
29157 return Err(common::Error::MissingToken(e));
29158 }
29159 },
29160 };
29161 request_value_reader
29162 .seek(std::io::SeekFrom::Start(0))
29163 .unwrap();
29164 let mut req_result = {
29165 let client = &self.hub.client;
29166 dlg.pre_request();
29167 let mut req_builder = hyper::Request::builder()
29168 .method(hyper::Method::POST)
29169 .uri(url.as_str())
29170 .header(USER_AGENT, self.hub._user_agent.clone());
29171
29172 if let Some(token) = token.as_ref() {
29173 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29174 }
29175
29176 let request = req_builder
29177 .header(CONTENT_TYPE, json_mime_type.to_string())
29178 .header(CONTENT_LENGTH, request_size as u64)
29179 .body(common::to_body(
29180 request_value_reader.get_ref().clone().into(),
29181 ));
29182
29183 client.request(request.unwrap()).await
29184 };
29185
29186 match req_result {
29187 Err(err) => {
29188 if let common::Retry::After(d) = dlg.http_error(&err) {
29189 sleep(d).await;
29190 continue;
29191 }
29192 dlg.finished(false);
29193 return Err(common::Error::HttpError(err));
29194 }
29195 Ok(res) => {
29196 let (mut parts, body) = res.into_parts();
29197 let mut body = common::Body::new(body);
29198 if !parts.status.is_success() {
29199 let bytes = common::to_bytes(body).await.unwrap_or_default();
29200 let error = serde_json::from_str(&common::to_string(&bytes));
29201 let response = common::to_response(parts, bytes.into());
29202
29203 if let common::Retry::After(d) =
29204 dlg.http_failure(&response, error.as_ref().ok())
29205 {
29206 sleep(d).await;
29207 continue;
29208 }
29209
29210 dlg.finished(false);
29211
29212 return Err(match error {
29213 Ok(value) => common::Error::BadRequest(value),
29214 _ => common::Error::Failure(response),
29215 });
29216 }
29217 let response = {
29218 let bytes = common::to_bytes(body).await.unwrap_or_default();
29219 let encoded = common::to_string(&bytes);
29220 match serde_json::from_str(&encoded) {
29221 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29222 Err(error) => {
29223 dlg.response_json_decode_error(&encoded, &error);
29224 return Err(common::Error::JsonDecodeError(
29225 encoded.to_string(),
29226 error,
29227 ));
29228 }
29229 }
29230 };
29231
29232 dlg.finished(true);
29233 return Ok(response);
29234 }
29235 }
29236 }
29237 }
29238
29239 ///
29240 /// Sets the *request* property to the given value.
29241 ///
29242 /// Even though the property as already been set when instantiating this call,
29243 /// we provide this method for API completeness.
29244 pub fn request(mut self, new_value: WebApp) -> WebappInsertCall<'a, C> {
29245 self._request = new_value;
29246 self
29247 }
29248 /// The ID of the enterprise.
29249 ///
29250 /// Sets the *enterprise id* path property to the given value.
29251 ///
29252 /// Even though the property as already been set when instantiating this call,
29253 /// we provide this method for API completeness.
29254 pub fn enterprise_id(mut self, new_value: &str) -> WebappInsertCall<'a, C> {
29255 self._enterprise_id = new_value.to_string();
29256 self
29257 }
29258 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29259 /// while executing the actual API request.
29260 ///
29261 /// ````text
29262 /// It should be used to handle progress information, and to implement a certain level of resilience.
29263 /// ````
29264 ///
29265 /// Sets the *delegate* property to the given value.
29266 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> WebappInsertCall<'a, C> {
29267 self._delegate = Some(new_value);
29268 self
29269 }
29270
29271 /// Set any additional parameter of the query string used in the request.
29272 /// It should be used to set parameters which are not yet available through their own
29273 /// setters.
29274 ///
29275 /// Please note that this method must not be used to set any of the known parameters
29276 /// which have their own setter method. If done anyway, the request will fail.
29277 ///
29278 /// # Additional Parameters
29279 ///
29280 /// * *$.xgafv* (query-string) - V1 error format.
29281 /// * *access_token* (query-string) - OAuth access token.
29282 /// * *alt* (query-string) - Data format for response.
29283 /// * *callback* (query-string) - JSONP
29284 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29285 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
29286 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29287 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29288 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
29289 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29290 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29291 pub fn param<T>(mut self, name: T, value: T) -> WebappInsertCall<'a, C>
29292 where
29293 T: AsRef<str>,
29294 {
29295 self._additional_params
29296 .insert(name.as_ref().to_string(), value.as_ref().to_string());
29297 self
29298 }
29299
29300 /// Identifies the authorization scope for the method you are building.
29301 ///
29302 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29303 /// [`Scope::Full`].
29304 ///
29305 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29306 /// tokens for more than one scope.
29307 ///
29308 /// Usually there is more than one suitable scope to authorize an operation, some of which may
29309 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29310 /// sufficient, a read-write scope will do as well.
29311 pub fn add_scope<St>(mut self, scope: St) -> WebappInsertCall<'a, C>
29312 where
29313 St: AsRef<str>,
29314 {
29315 self._scopes.insert(String::from(scope.as_ref()));
29316 self
29317 }
29318 /// Identifies the authorization scope(s) for the method you are building.
29319 ///
29320 /// See [`Self::add_scope()`] for details.
29321 pub fn add_scopes<I, St>(mut self, scopes: I) -> WebappInsertCall<'a, C>
29322 where
29323 I: IntoIterator<Item = St>,
29324 St: AsRef<str>,
29325 {
29326 self._scopes
29327 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29328 self
29329 }
29330
29331 /// Removes all scopes, and no default scope will be used either.
29332 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29333 /// for details).
29334 pub fn clear_scopes(mut self) -> WebappInsertCall<'a, C> {
29335 self._scopes.clear();
29336 self
29337 }
29338}
29339
29340/// Retrieves the details of all web apps for a given enterprise.
29341///
29342/// A builder for the *list* method supported by a *webapp* resource.
29343/// It is not used directly, but through a [`WebappMethods`] instance.
29344///
29345/// # Example
29346///
29347/// Instantiate a resource method builder
29348///
29349/// ```test_harness,no_run
29350/// # extern crate hyper;
29351/// # extern crate hyper_rustls;
29352/// # extern crate google_androidenterprise1 as androidenterprise1;
29353/// # async fn dox() {
29354/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29355///
29356/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29357/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29358/// # .with_native_roots()
29359/// # .unwrap()
29360/// # .https_only()
29361/// # .enable_http2()
29362/// # .build();
29363///
29364/// # let executor = hyper_util::rt::TokioExecutor::new();
29365/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29366/// # secret,
29367/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29368/// # yup_oauth2::client::CustomHyperClientBuilder::from(
29369/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
29370/// # ),
29371/// # ).build().await.unwrap();
29372///
29373/// # let client = hyper_util::client::legacy::Client::builder(
29374/// # hyper_util::rt::TokioExecutor::new()
29375/// # )
29376/// # .build(
29377/// # hyper_rustls::HttpsConnectorBuilder::new()
29378/// # .with_native_roots()
29379/// # .unwrap()
29380/// # .https_or_http()
29381/// # .enable_http2()
29382/// # .build()
29383/// # );
29384/// # let mut hub = AndroidEnterprise::new(client, auth);
29385/// // You can configure optional parameters by calling the respective setters at will, and
29386/// // execute the final call using `doit()`.
29387/// // Values shown here are possibly random and not representative !
29388/// let result = hub.webapps().list("enterpriseId")
29389/// .doit().await;
29390/// # }
29391/// ```
29392pub struct WebappListCall<'a, C>
29393where
29394 C: 'a,
29395{
29396 hub: &'a AndroidEnterprise<C>,
29397 _enterprise_id: String,
29398 _delegate: Option<&'a mut dyn common::Delegate>,
29399 _additional_params: HashMap<String, String>,
29400 _scopes: BTreeSet<String>,
29401}
29402
29403impl<'a, C> common::CallBuilder for WebappListCall<'a, C> {}
29404
29405impl<'a, C> WebappListCall<'a, C>
29406where
29407 C: common::Connector,
29408{
29409 /// Perform the operation you have build so far.
29410 pub async fn doit(mut self) -> common::Result<(common::Response, WebAppsListResponse)> {
29411 use std::borrow::Cow;
29412 use std::io::{Read, Seek};
29413
29414 use common::{url::Params, ToParts};
29415 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29416
29417 let mut dd = common::DefaultDelegate;
29418 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29419 dlg.begin(common::MethodInfo {
29420 id: "androidenterprise.webapps.list",
29421 http_method: hyper::Method::GET,
29422 });
29423
29424 for &field in ["alt", "enterpriseId"].iter() {
29425 if self._additional_params.contains_key(field) {
29426 dlg.finished(false);
29427 return Err(common::Error::FieldClash(field));
29428 }
29429 }
29430
29431 let mut params = Params::with_capacity(3 + self._additional_params.len());
29432 params.push("enterpriseId", self._enterprise_id);
29433
29434 params.extend(self._additional_params.iter());
29435
29436 params.push("alt", "json");
29437 let mut url =
29438 self.hub._base_url.clone() + "androidenterprise/v1/enterprises/{enterpriseId}/webApps";
29439 if self._scopes.is_empty() {
29440 self._scopes.insert(Scope::Full.as_ref().to_string());
29441 }
29442
29443 #[allow(clippy::single_element_loop)]
29444 for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() {
29445 url = params.uri_replacement(url, param_name, find_this, false);
29446 }
29447 {
29448 let to_remove = ["enterpriseId"];
29449 params.remove_params(&to_remove);
29450 }
29451
29452 let url = params.parse_with_url(&url);
29453
29454 loop {
29455 let token = match self
29456 .hub
29457 .auth
29458 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29459 .await
29460 {
29461 Ok(token) => token,
29462 Err(e) => match dlg.token(e) {
29463 Ok(token) => token,
29464 Err(e) => {
29465 dlg.finished(false);
29466 return Err(common::Error::MissingToken(e));
29467 }
29468 },
29469 };
29470 let mut req_result = {
29471 let client = &self.hub.client;
29472 dlg.pre_request();
29473 let mut req_builder = hyper::Request::builder()
29474 .method(hyper::Method::GET)
29475 .uri(url.as_str())
29476 .header(USER_AGENT, self.hub._user_agent.clone());
29477
29478 if let Some(token) = token.as_ref() {
29479 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29480 }
29481
29482 let request = req_builder
29483 .header(CONTENT_LENGTH, 0_u64)
29484 .body(common::to_body::<String>(None));
29485
29486 client.request(request.unwrap()).await
29487 };
29488
29489 match req_result {
29490 Err(err) => {
29491 if let common::Retry::After(d) = dlg.http_error(&err) {
29492 sleep(d).await;
29493 continue;
29494 }
29495 dlg.finished(false);
29496 return Err(common::Error::HttpError(err));
29497 }
29498 Ok(res) => {
29499 let (mut parts, body) = res.into_parts();
29500 let mut body = common::Body::new(body);
29501 if !parts.status.is_success() {
29502 let bytes = common::to_bytes(body).await.unwrap_or_default();
29503 let error = serde_json::from_str(&common::to_string(&bytes));
29504 let response = common::to_response(parts, bytes.into());
29505
29506 if let common::Retry::After(d) =
29507 dlg.http_failure(&response, error.as_ref().ok())
29508 {
29509 sleep(d).await;
29510 continue;
29511 }
29512
29513 dlg.finished(false);
29514
29515 return Err(match error {
29516 Ok(value) => common::Error::BadRequest(value),
29517 _ => common::Error::Failure(response),
29518 });
29519 }
29520 let response = {
29521 let bytes = common::to_bytes(body).await.unwrap_or_default();
29522 let encoded = common::to_string(&bytes);
29523 match serde_json::from_str(&encoded) {
29524 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29525 Err(error) => {
29526 dlg.response_json_decode_error(&encoded, &error);
29527 return Err(common::Error::JsonDecodeError(
29528 encoded.to_string(),
29529 error,
29530 ));
29531 }
29532 }
29533 };
29534
29535 dlg.finished(true);
29536 return Ok(response);
29537 }
29538 }
29539 }
29540 }
29541
29542 /// The ID of the enterprise.
29543 ///
29544 /// Sets the *enterprise id* path property to the given value.
29545 ///
29546 /// Even though the property as already been set when instantiating this call,
29547 /// we provide this method for API completeness.
29548 pub fn enterprise_id(mut self, new_value: &str) -> WebappListCall<'a, C> {
29549 self._enterprise_id = new_value.to_string();
29550 self
29551 }
29552 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29553 /// while executing the actual API request.
29554 ///
29555 /// ````text
29556 /// It should be used to handle progress information, and to implement a certain level of resilience.
29557 /// ````
29558 ///
29559 /// Sets the *delegate* property to the given value.
29560 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> WebappListCall<'a, C> {
29561 self._delegate = Some(new_value);
29562 self
29563 }
29564
29565 /// Set any additional parameter of the query string used in the request.
29566 /// It should be used to set parameters which are not yet available through their own
29567 /// setters.
29568 ///
29569 /// Please note that this method must not be used to set any of the known parameters
29570 /// which have their own setter method. If done anyway, the request will fail.
29571 ///
29572 /// # Additional Parameters
29573 ///
29574 /// * *$.xgafv* (query-string) - V1 error format.
29575 /// * *access_token* (query-string) - OAuth access token.
29576 /// * *alt* (query-string) - Data format for response.
29577 /// * *callback* (query-string) - JSONP
29578 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29579 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
29580 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29581 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29582 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
29583 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29584 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29585 pub fn param<T>(mut self, name: T, value: T) -> WebappListCall<'a, C>
29586 where
29587 T: AsRef<str>,
29588 {
29589 self._additional_params
29590 .insert(name.as_ref().to_string(), value.as_ref().to_string());
29591 self
29592 }
29593
29594 /// Identifies the authorization scope for the method you are building.
29595 ///
29596 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29597 /// [`Scope::Full`].
29598 ///
29599 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29600 /// tokens for more than one scope.
29601 ///
29602 /// Usually there is more than one suitable scope to authorize an operation, some of which may
29603 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29604 /// sufficient, a read-write scope will do as well.
29605 pub fn add_scope<St>(mut self, scope: St) -> WebappListCall<'a, C>
29606 where
29607 St: AsRef<str>,
29608 {
29609 self._scopes.insert(String::from(scope.as_ref()));
29610 self
29611 }
29612 /// Identifies the authorization scope(s) for the method you are building.
29613 ///
29614 /// See [`Self::add_scope()`] for details.
29615 pub fn add_scopes<I, St>(mut self, scopes: I) -> WebappListCall<'a, C>
29616 where
29617 I: IntoIterator<Item = St>,
29618 St: AsRef<str>,
29619 {
29620 self._scopes
29621 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29622 self
29623 }
29624
29625 /// Removes all scopes, and no default scope will be used either.
29626 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29627 /// for details).
29628 pub fn clear_scopes(mut self) -> WebappListCall<'a, C> {
29629 self._scopes.clear();
29630 self
29631 }
29632}
29633
29634/// Updates an existing web app.
29635///
29636/// A builder for the *update* method supported by a *webapp* resource.
29637/// It is not used directly, but through a [`WebappMethods`] instance.
29638///
29639/// # Example
29640///
29641/// Instantiate a resource method builder
29642///
29643/// ```test_harness,no_run
29644/// # extern crate hyper;
29645/// # extern crate hyper_rustls;
29646/// # extern crate google_androidenterprise1 as androidenterprise1;
29647/// use androidenterprise1::api::WebApp;
29648/// # async fn dox() {
29649/// # use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29650///
29651/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29652/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29653/// # .with_native_roots()
29654/// # .unwrap()
29655/// # .https_only()
29656/// # .enable_http2()
29657/// # .build();
29658///
29659/// # let executor = hyper_util::rt::TokioExecutor::new();
29660/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29661/// # secret,
29662/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29663/// # yup_oauth2::client::CustomHyperClientBuilder::from(
29664/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
29665/// # ),
29666/// # ).build().await.unwrap();
29667///
29668/// # let client = hyper_util::client::legacy::Client::builder(
29669/// # hyper_util::rt::TokioExecutor::new()
29670/// # )
29671/// # .build(
29672/// # hyper_rustls::HttpsConnectorBuilder::new()
29673/// # .with_native_roots()
29674/// # .unwrap()
29675/// # .https_or_http()
29676/// # .enable_http2()
29677/// # .build()
29678/// # );
29679/// # let mut hub = AndroidEnterprise::new(client, auth);
29680/// // As the method needs a request, you would usually fill it with the desired information
29681/// // into the respective structure. Some of the parts shown here might not be applicable !
29682/// // Values shown here are possibly random and not representative !
29683/// let mut req = WebApp::default();
29684///
29685/// // You can configure optional parameters by calling the respective setters at will, and
29686/// // execute the final call using `doit()`.
29687/// // Values shown here are possibly random and not representative !
29688/// let result = hub.webapps().update(req, "enterpriseId", "webAppId")
29689/// .doit().await;
29690/// # }
29691/// ```
29692pub struct WebappUpdateCall<'a, C>
29693where
29694 C: 'a,
29695{
29696 hub: &'a AndroidEnterprise<C>,
29697 _request: WebApp,
29698 _enterprise_id: String,
29699 _web_app_id: String,
29700 _delegate: Option<&'a mut dyn common::Delegate>,
29701 _additional_params: HashMap<String, String>,
29702 _scopes: BTreeSet<String>,
29703}
29704
29705impl<'a, C> common::CallBuilder for WebappUpdateCall<'a, C> {}
29706
29707impl<'a, C> WebappUpdateCall<'a, C>
29708where
29709 C: common::Connector,
29710{
29711 /// Perform the operation you have build so far.
29712 pub async fn doit(mut self) -> common::Result<(common::Response, WebApp)> {
29713 use std::borrow::Cow;
29714 use std::io::{Read, Seek};
29715
29716 use common::{url::Params, ToParts};
29717 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29718
29719 let mut dd = common::DefaultDelegate;
29720 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29721 dlg.begin(common::MethodInfo {
29722 id: "androidenterprise.webapps.update",
29723 http_method: hyper::Method::PUT,
29724 });
29725
29726 for &field in ["alt", "enterpriseId", "webAppId"].iter() {
29727 if self._additional_params.contains_key(field) {
29728 dlg.finished(false);
29729 return Err(common::Error::FieldClash(field));
29730 }
29731 }
29732
29733 let mut params = Params::with_capacity(5 + self._additional_params.len());
29734 params.push("enterpriseId", self._enterprise_id);
29735 params.push("webAppId", self._web_app_id);
29736
29737 params.extend(self._additional_params.iter());
29738
29739 params.push("alt", "json");
29740 let mut url = self.hub._base_url.clone()
29741 + "androidenterprise/v1/enterprises/{enterpriseId}/webApps/{webAppId}";
29742 if self._scopes.is_empty() {
29743 self._scopes.insert(Scope::Full.as_ref().to_string());
29744 }
29745
29746 #[allow(clippy::single_element_loop)]
29747 for &(find_this, param_name) in [
29748 ("{enterpriseId}", "enterpriseId"),
29749 ("{webAppId}", "webAppId"),
29750 ]
29751 .iter()
29752 {
29753 url = params.uri_replacement(url, param_name, find_this, false);
29754 }
29755 {
29756 let to_remove = ["webAppId", "enterpriseId"];
29757 params.remove_params(&to_remove);
29758 }
29759
29760 let url = params.parse_with_url(&url);
29761
29762 let mut json_mime_type = mime::APPLICATION_JSON;
29763 let mut request_value_reader = {
29764 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29765 common::remove_json_null_values(&mut value);
29766 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29767 serde_json::to_writer(&mut dst, &value).unwrap();
29768 dst
29769 };
29770 let request_size = request_value_reader
29771 .seek(std::io::SeekFrom::End(0))
29772 .unwrap();
29773 request_value_reader
29774 .seek(std::io::SeekFrom::Start(0))
29775 .unwrap();
29776
29777 loop {
29778 let token = match self
29779 .hub
29780 .auth
29781 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29782 .await
29783 {
29784 Ok(token) => token,
29785 Err(e) => match dlg.token(e) {
29786 Ok(token) => token,
29787 Err(e) => {
29788 dlg.finished(false);
29789 return Err(common::Error::MissingToken(e));
29790 }
29791 },
29792 };
29793 request_value_reader
29794 .seek(std::io::SeekFrom::Start(0))
29795 .unwrap();
29796 let mut req_result = {
29797 let client = &self.hub.client;
29798 dlg.pre_request();
29799 let mut req_builder = hyper::Request::builder()
29800 .method(hyper::Method::PUT)
29801 .uri(url.as_str())
29802 .header(USER_AGENT, self.hub._user_agent.clone());
29803
29804 if let Some(token) = token.as_ref() {
29805 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29806 }
29807
29808 let request = req_builder
29809 .header(CONTENT_TYPE, json_mime_type.to_string())
29810 .header(CONTENT_LENGTH, request_size as u64)
29811 .body(common::to_body(
29812 request_value_reader.get_ref().clone().into(),
29813 ));
29814
29815 client.request(request.unwrap()).await
29816 };
29817
29818 match req_result {
29819 Err(err) => {
29820 if let common::Retry::After(d) = dlg.http_error(&err) {
29821 sleep(d).await;
29822 continue;
29823 }
29824 dlg.finished(false);
29825 return Err(common::Error::HttpError(err));
29826 }
29827 Ok(res) => {
29828 let (mut parts, body) = res.into_parts();
29829 let mut body = common::Body::new(body);
29830 if !parts.status.is_success() {
29831 let bytes = common::to_bytes(body).await.unwrap_or_default();
29832 let error = serde_json::from_str(&common::to_string(&bytes));
29833 let response = common::to_response(parts, bytes.into());
29834
29835 if let common::Retry::After(d) =
29836 dlg.http_failure(&response, error.as_ref().ok())
29837 {
29838 sleep(d).await;
29839 continue;
29840 }
29841
29842 dlg.finished(false);
29843
29844 return Err(match error {
29845 Ok(value) => common::Error::BadRequest(value),
29846 _ => common::Error::Failure(response),
29847 });
29848 }
29849 let response = {
29850 let bytes = common::to_bytes(body).await.unwrap_or_default();
29851 let encoded = common::to_string(&bytes);
29852 match serde_json::from_str(&encoded) {
29853 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29854 Err(error) => {
29855 dlg.response_json_decode_error(&encoded, &error);
29856 return Err(common::Error::JsonDecodeError(
29857 encoded.to_string(),
29858 error,
29859 ));
29860 }
29861 }
29862 };
29863
29864 dlg.finished(true);
29865 return Ok(response);
29866 }
29867 }
29868 }
29869 }
29870
29871 ///
29872 /// Sets the *request* property to the given value.
29873 ///
29874 /// Even though the property as already been set when instantiating this call,
29875 /// we provide this method for API completeness.
29876 pub fn request(mut self, new_value: WebApp) -> WebappUpdateCall<'a, C> {
29877 self._request = new_value;
29878 self
29879 }
29880 /// The ID of the enterprise.
29881 ///
29882 /// Sets the *enterprise id* path property to the given value.
29883 ///
29884 /// Even though the property as already been set when instantiating this call,
29885 /// we provide this method for API completeness.
29886 pub fn enterprise_id(mut self, new_value: &str) -> WebappUpdateCall<'a, C> {
29887 self._enterprise_id = new_value.to_string();
29888 self
29889 }
29890 /// The ID of the web app.
29891 ///
29892 /// Sets the *web app id* path property to the given value.
29893 ///
29894 /// Even though the property as already been set when instantiating this call,
29895 /// we provide this method for API completeness.
29896 pub fn web_app_id(mut self, new_value: &str) -> WebappUpdateCall<'a, C> {
29897 self._web_app_id = new_value.to_string();
29898 self
29899 }
29900 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29901 /// while executing the actual API request.
29902 ///
29903 /// ````text
29904 /// It should be used to handle progress information, and to implement a certain level of resilience.
29905 /// ````
29906 ///
29907 /// Sets the *delegate* property to the given value.
29908 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> WebappUpdateCall<'a, C> {
29909 self._delegate = Some(new_value);
29910 self
29911 }
29912
29913 /// Set any additional parameter of the query string used in the request.
29914 /// It should be used to set parameters which are not yet available through their own
29915 /// setters.
29916 ///
29917 /// Please note that this method must not be used to set any of the known parameters
29918 /// which have their own setter method. If done anyway, the request will fail.
29919 ///
29920 /// # Additional Parameters
29921 ///
29922 /// * *$.xgafv* (query-string) - V1 error format.
29923 /// * *access_token* (query-string) - OAuth access token.
29924 /// * *alt* (query-string) - Data format for response.
29925 /// * *callback* (query-string) - JSONP
29926 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29927 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
29928 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29929 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29930 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
29931 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29932 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29933 pub fn param<T>(mut self, name: T, value: T) -> WebappUpdateCall<'a, C>
29934 where
29935 T: AsRef<str>,
29936 {
29937 self._additional_params
29938 .insert(name.as_ref().to_string(), value.as_ref().to_string());
29939 self
29940 }
29941
29942 /// Identifies the authorization scope for the method you are building.
29943 ///
29944 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29945 /// [`Scope::Full`].
29946 ///
29947 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29948 /// tokens for more than one scope.
29949 ///
29950 /// Usually there is more than one suitable scope to authorize an operation, some of which may
29951 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29952 /// sufficient, a read-write scope will do as well.
29953 pub fn add_scope<St>(mut self, scope: St) -> WebappUpdateCall<'a, C>
29954 where
29955 St: AsRef<str>,
29956 {
29957 self._scopes.insert(String::from(scope.as_ref()));
29958 self
29959 }
29960 /// Identifies the authorization scope(s) for the method you are building.
29961 ///
29962 /// See [`Self::add_scope()`] for details.
29963 pub fn add_scopes<I, St>(mut self, scopes: I) -> WebappUpdateCall<'a, C>
29964 where
29965 I: IntoIterator<Item = St>,
29966 St: AsRef<str>,
29967 {
29968 self._scopes
29969 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29970 self
29971 }
29972
29973 /// Removes all scopes, and no default scope will be used either.
29974 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29975 /// for details).
29976 pub fn clear_scopes(mut self) -> WebappUpdateCall<'a, C> {
29977 self._scopes.clear();
29978 self
29979 }
29980}