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