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