google_tenor2/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 *Tenor* crate version *5.0.5+20240805*, where *20240805* is the exact revision of the *tenor:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.5*.
6//!
7//! Everything else about the *Tenor* *v2* API can be found at the
8//! [official documentation site](https://developers.google.com/tenor/guides/quickstart).
9//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/tenor2).
10//! # Features
11//!
12//! Handle the following *Resources* with ease from the central [hub](Tenor) ...
13//!
14//! * content
15//! * [*block add*](api::ContentBlockAddCall), [*block list*](api::ContentBlockListCall) and [*block remove*](api::ContentBlockRemoveCall)
16//! * posts
17//! * [*list*](api::PostListCall)
18//!
19//! Other activities are ...
20//!
21//! * [anonid](api::MethodAnonidCall)
22//! * [autocomplete](api::MethodAutocompleteCall)
23//! * [categories](api::MethodCategoryCall)
24//! * [featured](api::MethodFeaturedCall)
25//! * [registershare](api::MethodRegistershareCall)
26//! * [render_caption](api::MethodRenderCaptionCall)
27//! * [search](api::MethodSearchCall)
28//! * [search_suggestions](api::MethodSearchSuggestionCall)
29//! * [trending_terms](api::MethodTrendingTermCall)
30//!
31//!
32//!
33//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
34//!
35//! # Structure of this Library
36//!
37//! The API is structured into the following primary items:
38//!
39//! * **[Hub](Tenor)**
40//! * a central object to maintain state and allow accessing all *Activities*
41//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
42//! allow access to individual [*Call Builders*](client::CallBuilder)
43//! * **[Resources](client::Resource)**
44//! * primary types that you can apply *Activities* to
45//! * a collection of properties and *Parts*
46//! * **[Parts](client::Part)**
47//! * a collection of properties
48//! * never directly used in *Activities*
49//! * **[Activities](client::CallBuilder)**
50//! * operations to apply to *Resources*
51//!
52//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
53//!
54//! Generally speaking, you can invoke *Activities* like this:
55//!
56//! ```Rust,ignore
57//! let r = hub.resource().activity(...).doit().await
58//! ```
59//!
60//! Or specifically ...
61//!
62//! ```ignore
63//! let r = hub.methods().registershare(...).doit().await
64//! ```
65//!
66//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
67//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
68//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
69//! The `doit()` method performs the actual communication with the server and returns the respective result.
70//!
71//! # Usage
72//!
73//! ## Setting up your Project
74//!
75//! To use this library, you would put the following lines into your `Cargo.toml` file:
76//!
77//! ```toml
78//! [dependencies]
79//! google-tenor2 = "*"
80//! serde = "^1.0"
81//! serde_json = "^1.0"
82//! ```
83//!
84//! ## A complete example
85//!
86//! ```test_harness,no_run
87//! extern crate hyper;
88//! extern crate hyper_rustls;
89//! extern crate google_tenor2 as tenor2;
90//! use tenor2::api::GoogleSearchTenorV2RegisterShareRequest;
91//! use tenor2::{Result, Error};
92//! # async fn dox() {
93//! use std::default::Default;
94//! use tenor2::{Tenor, oauth2, hyper, hyper_rustls, chrono, FieldMask};
95//!
96//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
97//! // `client_secret`, among other things.
98//! let secret: oauth2::ApplicationSecret = Default::default();
99//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
100//! // unless you replace `None` with the desired Flow.
101//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
102//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
103//! // retrieve them from storage.
104//! let auth = oauth2::InstalledFlowAuthenticator::builder(
105//! secret,
106//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
107//! ).build().await.unwrap();
108//! let mut hub = Tenor::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().unwrap().https_or_http().enable_http1().build()), 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 = GoogleSearchTenorV2RegisterShareRequest::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.methods().registershare(req)
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](client::Result) enumeration as return value of
142//! the doit() methods, or handed as possibly intermediate results to either the
143//! [Hub Delegate](client::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](client::Result), should be
150//! read by you to obtain the media.
151//! If such a method also supports a [Response Result](client::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](client::Delegate) to the
162//! [Method Builder](client::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](client::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](client::RequestValue) and
171//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
172//! are valid.
173//! Most optionals are are considered [Parts](client::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](client::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](client::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
201// We don't warn about this, as depending on the API, some data structures or facilities are never used.
202// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any
203// unused imports in fully featured APIs. Same with unused_mut ... .
204#![allow(unused_imports, unused_mut, dead_code)]
205
206// DO NOT EDIT !
207// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
208// DO NOT EDIT !
209
210// Re-export the hyper and hyper_rustls crate, they are required to build the hub
211pub use hyper;
212pub use hyper_rustls;
213pub extern crate google_apis_common as client;
214pub use client::chrono;
215pub mod api;
216
217// Re-export the hub type and some basic client structs
218pub use api::Tenor;
219pub use client::{Result, Error, Delegate, FieldMask};
220
221// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
222#[cfg(feature = "yup-oauth2")]
223pub use client::oauth2;