anni_google_drive3/lib.rs
1// DO NOT EDIT !
2// This file was generated automatically from 'src/mako/api/lib.rs.mako'
3// DO NOT EDIT !
4
5//! This documentation was generated from *drive* crate version *4.0.0+20220225*, where *20220225* is the exact revision of the *drive:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v4.0.0*.
6//!
7//! Everything else about the *drive* *v3* API can be found at the
8//! [official documentation site](https://developers.google.com/drive/).
9//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/drive3).
10//! # Features
11//!
12//! Handle the following *Resources* with ease from the central [hub](DriveHub) ...
13//!
14//! * [about](api::About)
15//! * [*get*](api::AboutGetCall)
16//! * [changes](api::Change)
17//! * [*get start page token*](api::ChangeGetStartPageTokenCall), [*list*](api::ChangeListCall) and [*watch*](api::ChangeWatchCall)
18//! * [channels](api::Channel)
19//! * [*stop*](api::ChannelStopCall)
20//! * [comments](api::Comment)
21//! * [*create*](api::CommentCreateCall), [*delete*](api::CommentDeleteCall), [*get*](api::CommentGetCall), [*list*](api::CommentListCall) and [*update*](api::CommentUpdateCall)
22//! * [drives](api::Drive)
23//! * [*create*](api::DriveCreateCall), [*delete*](api::DriveDeleteCall), [*get*](api::DriveGetCall), [*hide*](api::DriveHideCall), [*list*](api::DriveListCall), [*unhide*](api::DriveUnhideCall) and [*update*](api::DriveUpdateCall)
24//! * [files](api::File)
25//! * [*copy*](api::FileCopyCall), [*create*](api::FileCreateCall), [*delete*](api::FileDeleteCall), [*empty trash*](api::FileEmptyTrashCall), [*export*](api::FileExportCall), [*generate ids*](api::FileGenerateIdCall), [*get*](api::FileGetCall), [*list*](api::FileListCall), [*update*](api::FileUpdateCall) and [*watch*](api::FileWatchCall)
26//! * [permissions](api::Permission)
27//! * [*create*](api::PermissionCreateCall), [*delete*](api::PermissionDeleteCall), [*get*](api::PermissionGetCall), [*list*](api::PermissionListCall) and [*update*](api::PermissionUpdateCall)
28//! * [replies](api::Reply)
29//! * [*create*](api::ReplyCreateCall), [*delete*](api::ReplyDeleteCall), [*get*](api::ReplyGetCall), [*list*](api::ReplyListCall) and [*update*](api::ReplyUpdateCall)
30//! * [revisions](api::Revision)
31//! * [*delete*](api::RevisionDeleteCall), [*get*](api::RevisionGetCall), [*list*](api::RevisionListCall) and [*update*](api::RevisionUpdateCall)
32//! * teamdrives
33//! * [*create*](api::TeamdriveCreateCall), [*delete*](api::TeamdriveDeleteCall), [*get*](api::TeamdriveGetCall), [*list*](api::TeamdriveListCall) and [*update*](api::TeamdriveUpdateCall)
34//!
35//!
36//! Upload supported by ...
37//!
38//! * [*create files*](api::FileCreateCall)
39//! * [*update files*](api::FileUpdateCall)
40//!
41//! Download supported by ...
42//!
43//! * [*export files*](api::FileExportCall)
44//! * [*get files*](api::FileGetCall)
45//! * [*watch files*](api::FileWatchCall)
46//! * [*get revisions*](api::RevisionGetCall)
47//!
48//! Subscription supported by ...
49//!
50//! * [*list changes*](api::ChangeListCall)
51//! * [*watch changes*](api::ChangeWatchCall)
52//! * [*create files*](api::FileCreateCall)
53//! * [*get files*](api::FileGetCall)
54//! * [*watch files*](api::FileWatchCall)
55//!
56//!
57//!
58//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
59//!
60//! # Structure of this Library
61//!
62//! The API is structured into the following primary items:
63//!
64//! * **[Hub](DriveHub)**
65//! * a central object to maintain state and allow accessing all *Activities*
66//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
67//! allow access to individual [*Call Builders*](client::CallBuilder)
68//! * **[Resources](client::Resource)**
69//! * primary types that you can apply *Activities* to
70//! * a collection of properties and *Parts*
71//! * **[Parts](client::Part)**
72//! * a collection of properties
73//! * never directly used in *Activities*
74//! * **[Activities](client::CallBuilder)**
75//! * operations to apply to *Resources*
76//!
77//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
78//!
79//! Generally speaking, you can invoke *Activities* like this:
80//!
81//! ```Rust,ignore
82//! let r = hub.resource().activity(...).doit().await
83//! ```
84//!
85//! Or specifically ...
86//!
87//! ```ignore
88//! let r = hub.files().copy(...).doit().await
89//! let r = hub.files().create(...).doit().await
90//! let r = hub.files().delete(...).doit().await
91//! let r = hub.files().empty_trash(...).doit().await
92//! let r = hub.files().export(...).doit().await
93//! let r = hub.files().generate_ids(...).doit().await
94//! let r = hub.files().get(...).doit().await
95//! let r = hub.files().list(...).doit().await
96//! let r = hub.files().update(...).doit().await
97//! let r = hub.files().watch(...).doit().await
98//! ```
99//!
100//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
101//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
102//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
103//! The `doit()` method performs the actual communication with the server and returns the respective result.
104//!
105//! # Usage
106//!
107//! ## Setting up your Project
108//!
109//! To use this library, you would put the following lines into your `Cargo.toml` file:
110//!
111//! ```toml
112//! [dependencies]
113//! google-drive3 = "*"
114//! serde = "^1.0"
115//! serde_json = "^1.0"
116//! ```
117//!
118//! ## A complete example
119//!
120//! ```test_harness,no_run
121//! extern crate hyper;
122//! extern crate hyper_rustls;
123//! extern crate google_drive3 as drive3;
124//! use drive3::{Result, Error};
125//! # async fn dox() {
126//! use std::default::Default;
127//! use drive3::{DriveHub, oauth2, hyper, hyper_rustls};
128//!
129//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
130//! // `client_secret`, among other things.
131//! let secret: oauth2::ApplicationSecret = Default::default();
132//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
133//! // unless you replace `None` with the desired Flow.
134//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
135//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
136//! // retrieve them from storage.
137//! let auth = oauth2::InstalledFlowAuthenticator::builder(
138//! secret,
139//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
140//! ).build().await.unwrap();
141//! let mut hub = DriveHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
142//! // You can configure optional parameters by calling the respective setters at will, and
143//! // execute the final call using `doit()`.
144//! // Values shown here are possibly random and not representative !
145//! let result = hub.files().list()
146//! .team_drive_id("invidunt")
147//! .supports_team_drives(true)
148//! .supports_all_drives(true)
149//! .spaces("sed")
150//! .q("ut")
151//! .page_token("gubergren")
152//! .page_size(-16)
153//! .order_by("est")
154//! .include_team_drive_items(true)
155//! .include_permissions_for_view("ipsum")
156//! .include_items_from_all_drives(true)
157//! .drive_id("ea")
158//! .corpus("dolor")
159//! .corpora("Lorem")
160//! .doit().await;
161//!
162//! match result {
163//! Err(e) => match e {
164//! // The Error enum provides details about what exactly happened.
165//! // You can also just use its `Debug`, `Display` or `Error` traits
166//! Error::HttpError(_)
167//! |Error::Io(_)
168//! |Error::MissingAPIKey
169//! |Error::MissingToken(_)
170//! |Error::Cancelled
171//! |Error::UploadSizeLimitExceeded(_, _)
172//! |Error::Failure(_)
173//! |Error::BadRequest(_)
174//! |Error::FieldClash(_)
175//! |Error::JsonDecodeError(_, _) => println!("{}", e),
176//! },
177//! Ok(res) => println!("Success: {:?}", res),
178//! }
179//! # }
180//! ```
181//! ## Handling Errors
182//!
183//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
184//! the doit() methods, or handed as possibly intermediate results to either the
185//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
186//!
187//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
188//! makes the system potentially resilient to all kinds of errors.
189//!
190//! ## Uploads and Downloads
191//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
192//! read by you to obtain the media.
193//! If such a method also supports a [Response Result](client::ResponseResult), it will return that by default.
194//! 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
195//! this call: `.param("alt", "media")`.
196//!
197//! Methods supporting uploads can do so using up to 2 different protocols:
198//! *simple* and *resumable*. The distinctiveness of each is represented by customized
199//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
200//!
201//! ## Customization and Callbacks
202//!
203//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
204//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
205//! Respective methods will be called to provide progress information, as well as determine whether the system should
206//! retry on failure.
207//!
208//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
209//!
210//! ## Optional Parts in Server-Requests
211//!
212//! All structures provided by this library are made to be [encodable](client::RequestValue) and
213//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
214//! are valid.
215//! Most optionals are are considered [Parts](client::Part) which are identifiable by name, which will be sent to
216//! the server to indicate either the set parts of the request or the desired parts in the response.
217//!
218//! ## Builder Arguments
219//!
220//! Using [method builders](client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
221//! These will always take a single argument, for which the following statements are true.
222//!
223//! * [PODs][wiki-pod] are handed by copy
224//! * strings are passed as `&str`
225//! * [request values](client::RequestValue) are moved
226//!
227//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
228//!
229//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
230//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
231//! [google-go-api]: https://github.com/google/google-api-go-client
232//!
233//!
234
235// Unused attributes happen thanks to defined, but unused structures
236// We don't warn about this, as depending on the API, some data structures or facilities are never used.
237// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any
238// unused imports in fully featured APIs. Same with unused_mut ... .
239#![allow(unused_imports, unused_mut, dead_code)]
240
241// DO NOT EDIT !
242// This file was generated automatically from 'src/mako/api/lib.rs.mako'
243// DO NOT EDIT !
244
245#[macro_use]
246extern crate serde_derive;
247
248// Re-export the hyper and hyper_rustls crate, they are required to build the hub
249pub extern crate hyper;
250pub extern crate hyper_rustls;
251extern crate serde;
252extern crate serde_json;
253// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
254extern crate mime;
255extern crate url;
256pub extern crate yup_oauth2 as oauth2;
257
258pub mod api;
259pub mod client;
260
261// Re-export the hub type and some basic client structs
262pub use api::DriveHub;
263pub use client::{Delegate, Error, Result};