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