google_androidenterprise1/
lib.rs

1// DO NOT EDIT !
2// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
3// DO NOT EDIT !
4
5//! This documentation was generated from *Android Enterprise* crate version *7.0.0+20251211*, where *20251211* is the exact revision of the *androidenterprise:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v7.0.0*.
6//!
7//! Everything else about the *Android Enterprise* *v1* API can be found at the
8//! [official documentation site](https://developers.google.com/android/work/play/emm-api).
9//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/androidenterprise1).
10//! # Features
11//!
12//! Handle the following *Resources* with ease from the central [hub](AndroidEnterprise) ...
13//!
14//! * [devices](api::Device)
15//!  * [*force report upload*](api::DeviceForceReportUploadCall), [*get*](api::DeviceGetCall), [*get state*](api::DeviceGetStateCall), [*list*](api::DeviceListCall), [*set state*](api::DeviceSetStateCall) and [*update*](api::DeviceUpdateCall)
16//! * [enrollment tokens](api::EnrollmentToken)
17//!  * [*create*](api::EnrollmentTokenCreateCall)
18//! * [enterprises](api::Enterprise)
19//!  * [*acknowledge notification set*](api::EnterpriseAcknowledgeNotificationSetCall), [*complete signup*](api::EnterpriseCompleteSignupCall), [*create web token*](api::EnterpriseCreateWebTokenCall), [*enroll*](api::EnterpriseEnrollCall), [*generate enterprise upgrade url*](api::EnterpriseGenerateEnterpriseUpgradeUrlCall), [*generate signup url*](api::EnterpriseGenerateSignupUrlCall), [*get*](api::EnterpriseGetCall), [*get service account*](api::EnterpriseGetServiceAccountCall), [*get store layout*](api::EnterpriseGetStoreLayoutCall), [*list*](api::EnterpriseListCall), [*pull notification set*](api::EnterprisePullNotificationSetCall), [*send test push notification*](api::EnterpriseSendTestPushNotificationCall), [*set account*](api::EnterpriseSetAccountCall), [*set store layout*](api::EnterpriseSetStoreLayoutCall) and [*unenroll*](api::EnterpriseUnenrollCall)
20//! * [entitlements](api::Entitlement)
21//!  * [*delete*](api::EntitlementDeleteCall), [*get*](api::EntitlementGetCall), [*list*](api::EntitlementListCall) and [*update*](api::EntitlementUpdateCall)
22//! * grouplicenses
23//!  * [*get*](api::GrouplicenseGetCall) and [*list*](api::GrouplicenseListCall)
24//! * grouplicenseusers
25//!  * [*list*](api::GrouplicenseuserListCall)
26//! * [installs](api::Install)
27//!  * [*delete*](api::InstallDeleteCall), [*get*](api::InstallGetCall), [*list*](api::InstallListCall) and [*update*](api::InstallUpdateCall)
28//! * managedconfigurationsfordevice
29//!  * [*delete*](api::ManagedconfigurationsfordeviceDeleteCall), [*get*](api::ManagedconfigurationsfordeviceGetCall), [*list*](api::ManagedconfigurationsfordeviceListCall) and [*update*](api::ManagedconfigurationsfordeviceUpdateCall)
30//! * managedconfigurationsforuser
31//!  * [*delete*](api::ManagedconfigurationsforuserDeleteCall), [*get*](api::ManagedconfigurationsforuserGetCall), [*list*](api::ManagedconfigurationsforuserListCall) and [*update*](api::ManagedconfigurationsforuserUpdateCall)
32//! * managedconfigurationssettings
33//!  * [*list*](api::ManagedconfigurationssettingListCall)
34//! * [permissions](api::Permission)
35//!  * [*get*](api::PermissionGetCall)
36//! * [products](api::Product)
37//!  * [*approve*](api::ProductApproveCall), [*generate approval url*](api::ProductGenerateApprovalUrlCall), [*get*](api::ProductGetCall), [*get app restrictions schema*](api::ProductGetAppRestrictionsSchemaCall), [*get permissions*](api::ProductGetPermissionCall), [*list*](api::ProductListCall) and [*unapprove*](api::ProductUnapproveCall)
38//! * serviceaccountkeys
39//!  * [*delete*](api::ServiceaccountkeyDeleteCall), [*insert*](api::ServiceaccountkeyInsertCall) and [*list*](api::ServiceaccountkeyListCall)
40//! * storelayoutclusters
41//!  * [*delete*](api::StorelayoutclusterDeleteCall), [*get*](api::StorelayoutclusterGetCall), [*insert*](api::StorelayoutclusterInsertCall), [*list*](api::StorelayoutclusterListCall) and [*update*](api::StorelayoutclusterUpdateCall)
42//! * storelayoutpages
43//!  * [*delete*](api::StorelayoutpageDeleteCall), [*get*](api::StorelayoutpageGetCall), [*insert*](api::StorelayoutpageInsertCall), [*list*](api::StorelayoutpageListCall) and [*update*](api::StorelayoutpageUpdateCall)
44//! * [users](api::User)
45//!  * [*delete*](api::UserDeleteCall), [*generate authentication token*](api::UserGenerateAuthenticationTokenCall), [*get*](api::UserGetCall), [*get available product set*](api::UserGetAvailableProductSetCall), [*insert*](api::UserInsertCall), [*list*](api::UserListCall), [*revoke device access*](api::UserRevokeDeviceAccesCall), [*set available product set*](api::UserSetAvailableProductSetCall) and [*update*](api::UserUpdateCall)
46//! * webapps
47//!  * [*delete*](api::WebappDeleteCall), [*get*](api::WebappGetCall), [*insert*](api::WebappInsertCall), [*list*](api::WebappListCall) and [*update*](api::WebappUpdateCall)
48//!
49//!
50//!
51//!
52//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
53//!
54//! # Structure of this Library
55//!
56//! The API is structured into the following primary items:
57//!
58//! * **[Hub](AndroidEnterprise)**
59//!     * a central object to maintain state and allow accessing all *Activities*
60//!     * creates [*Method Builders*](common::MethodsBuilder) which in turn
61//!       allow access to individual [*Call Builders*](common::CallBuilder)
62//! * **[Resources](common::Resource)**
63//!     * primary types that you can apply *Activities* to
64//!     * a collection of properties and *Parts*
65//!     * **[Parts](common::Part)**
66//!         * a collection of properties
67//!         * never directly used in *Activities*
68//! * **[Activities](common::CallBuilder)**
69//!     * operations to apply to *Resources*
70//!
71//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
72//!
73//! Generally speaking, you can invoke *Activities* like this:
74//!
75//! ```Rust,ignore
76//! let r = hub.resource().activity(...).doit().await
77//! ```
78//!
79//! Or specifically ...
80//!
81//! ```ignore
82//! let r = hub.enterprises().acknowledge_notification_set(...).doit().await
83//! let r = hub.enterprises().complete_signup(...).doit().await
84//! let r = hub.enterprises().create_web_token(...).doit().await
85//! let r = hub.enterprises().enroll(...).doit().await
86//! let r = hub.enterprises().generate_enterprise_upgrade_url(...).doit().await
87//! let r = hub.enterprises().generate_signup_url(...).doit().await
88//! let r = hub.enterprises().get(...).doit().await
89//! let r = hub.enterprises().get_service_account(...).doit().await
90//! let r = hub.enterprises().get_store_layout(...).doit().await
91//! let r = hub.enterprises().list(...).doit().await
92//! let r = hub.enterprises().pull_notification_set(...).doit().await
93//! let r = hub.enterprises().send_test_push_notification(...).doit().await
94//! let r = hub.enterprises().set_account(...).doit().await
95//! let r = hub.enterprises().set_store_layout(...).doit().await
96//! let r = hub.enterprises().unenroll(...).doit().await
97//! ```
98//!
99//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
100//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
101//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
102//! The `doit()` method performs the actual communication with the server and returns the respective result.
103//!
104//! # Usage
105//!
106//! ## Setting up your Project
107//!
108//! To use this library, you would put the following lines into your `Cargo.toml` file:
109//!
110//! ```toml
111//! [dependencies]
112//! google-androidenterprise1 = "*"
113//! serde = "1"
114//! serde_json = "1"
115//! ```
116//!
117//! ## A complete example
118//!
119//! ```test_harness,no_run
120//! extern crate hyper;
121//! extern crate hyper_rustls;
122//! extern crate google_androidenterprise1 as androidenterprise1;
123//! use androidenterprise1::{Result, Error};
124//! # async fn dox() {
125//! use androidenterprise1::{AndroidEnterprise, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
126//!
127//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
128//! // `client_secret`, among other things.
129//! let secret: yup_oauth2::ApplicationSecret = Default::default();
130//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
131//! // unless you replace  `None` with the desired Flow.
132//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
133//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
134//! // retrieve them from storage.
135//! let connector = hyper_rustls::HttpsConnectorBuilder::new()
136//!     .with_native_roots()
137//!     .unwrap()
138//!     .https_only()
139//!     .enable_http2()
140//!     .build();
141//!
142//! let executor = hyper_util::rt::TokioExecutor::new();
143//! let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
144//!     secret,
145//!     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
146//!     yup_oauth2::client::CustomHyperClientBuilder::from(
147//!         hyper_util::client::legacy::Client::builder(executor).build(connector),
148//!     ),
149//! ).build().await.unwrap();
150//!
151//! let client = hyper_util::client::legacy::Client::builder(
152//!     hyper_util::rt::TokioExecutor::new()
153//! )
154//! .build(
155//!     hyper_rustls::HttpsConnectorBuilder::new()
156//!         .with_native_roots()
157//!         .unwrap()
158//!         .https_or_http()
159//!         .enable_http2()
160//!         .build()
161//! );
162//! let mut hub = AndroidEnterprise::new(client, auth);
163//! // You can configure optional parameters by calling the respective setters at will, and
164//! // execute the final call using `doit()`.
165//! // Values shown here are possibly random and not representative !
166//! let result = hub.enterprises().generate_enterprise_upgrade_url("enterpriseId")
167//!              .add_allowed_domains("voluptua.")
168//!              .admin_email("At")
169//!              .doit().await;
170//!
171//! match result {
172//!     Err(e) => match e {
173//!         // The Error enum provides details about what exactly happened.
174//!         // You can also just use its `Debug`, `Display` or `Error` traits
175//!          Error::HttpError(_)
176//!         |Error::Io(_)
177//!         |Error::MissingAPIKey
178//!         |Error::MissingToken(_)
179//!         |Error::Cancelled
180//!         |Error::UploadSizeLimitExceeded(_, _)
181//!         |Error::Failure(_)
182//!         |Error::BadRequest(_)
183//!         |Error::FieldClash(_)
184//!         |Error::JsonDecodeError(_, _) => println!("{}", e),
185//!     },
186//!     Ok(res) => println!("Success: {:?}", res),
187//! }
188//! # }
189//! ```
190//! ## Handling Errors
191//!
192//! All errors produced by the system are provided either as [Result](common::Result) enumeration as return value of
193//! the doit() methods, or handed as possibly intermediate results to either the
194//! [Hub Delegate](common::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
195//!
196//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
197//! makes the system potentially resilient to all kinds of errors.
198//!
199//! ## Uploads and Downloads
200//! If a method supports downloads, the response body, which is part of the [Result](common::Result), should be
201//! read by you to obtain the media.
202//! If such a method also supports a [Response Result](common::ResponseResult), it will return that by default.
203//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making
204//! this call: `.param("alt", "media")`.
205//!
206//! Methods supporting uploads can do so using up to 2 different protocols:
207//! *simple* and *resumable*. The distinctiveness of each is represented by customized
208//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
209//!
210//! ## Customization and Callbacks
211//!
212//! You may alter the way an `doit()` method is called by providing a [delegate](common::Delegate) to the
213//! [Method Builder](common::CallBuilder) before making the final `doit()` call.
214//! Respective methods will be called to provide progress information, as well as determine whether the system should
215//! retry on failure.
216//!
217//! The [delegate trait](common::Delegate) is default-implemented, allowing you to customize it with minimal effort.
218//!
219//! ## Optional Parts in Server-Requests
220//!
221//! All structures provided by this library are made to be [encodable](common::RequestValue) and
222//! [decodable](common::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
223//! are valid.
224//! Most optionals are are considered [Parts](common::Part) which are identifiable by name, which will be sent to
225//! the server to indicate either the set parts of the request or the desired parts in the response.
226//!
227//! ## Builder Arguments
228//!
229//! Using [method builders](common::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
230//! These will always take a single argument, for which the following statements are true.
231//!
232//! * [PODs][wiki-pod] are handed by copy
233//! * strings are passed as `&str`
234//! * [request values](common::RequestValue) are moved
235//!
236//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
237//!
238//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
239//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
240//! [google-go-api]: https://github.com/google/google-api-go-client
241//!
242//! ## Cargo Features
243//!
244//! * `utoipa` - Add support for [utoipa](https://crates.io/crates/utoipa) and derive `utoipa::ToSchema` on all
245//! the types. You'll have to import and register the required types in `#[openapi(schemas(...))]`, otherwise the
246//! generated `openapi` spec would be invalid.
247//!
248//!
249//!
250
251// Unused attributes happen thanks to defined, but unused structures We don't
252// warn about this, as depending on the API, some data structures or facilities
253// are never used. Instead of pre-determining this, we just disable the lint.
254// It's manually tuned to not have any unused imports in fully featured APIs.
255// Same with unused_mut.
256#![allow(unused_imports, unused_mut, dead_code)]
257
258// DO NOT EDIT !
259// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
260// DO NOT EDIT !
261
262pub extern crate hyper;
263pub extern crate hyper_rustls;
264pub extern crate hyper_util;
265#[cfg(feature = "yup-oauth2")]
266pub extern crate yup_oauth2;
267
268pub extern crate google_apis_common as common;
269pub use common::{Delegate, Error, FieldMask, Result};
270
271pub mod api;
272pub use api::AndroidEnterprise;