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