google_adsense1d4/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 *AdSense* crate version *7.0.0+20201002*, where *20201002* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v7.0.0*.
6//!
7//! Everything else about the *AdSense* *v1d4* API can be found at the
8//! [official documentation site](https://developers.google.com/adsense/management/).
9//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/adsense1d4).
10//! # Features
11//!
12//! Handle the following *Resources* with ease from the central [hub](AdSense) ...
13//!
14//! * [accounts](api::Account)
15//! * [*adclients get ad code*](api::AccountAdclientGetAdCodeCall), [*adclients list*](api::AccountAdclientListCall), [*adunits customchannels list*](api::AccountAdunitCustomchannelListCall), [*adunits get*](api::AccountAdunitGetCall), [*adunits get ad code*](api::AccountAdunitGetAdCodeCall), [*adunits list*](api::AccountAdunitListCall), [*alerts delete*](api::AccountAlertDeleteCall), [*alerts list*](api::AccountAlertListCall), [*customchannels adunits list*](api::AccountCustomchannelAdunitListCall), [*customchannels get*](api::AccountCustomchannelGetCall), [*customchannels list*](api::AccountCustomchannelListCall), [*get*](api::AccountGetCall), [*list*](api::AccountListCall), [*payments list*](api::AccountPaymentListCall), [*reports generate*](api::AccountReportGenerateCall), [*reports saved generate*](api::AccountReportSavedGenerateCall), [*reports saved list*](api::AccountReportSavedListCall), [*savedadstyles get*](api::AccountSavedadstyleGetCall), [*savedadstyles list*](api::AccountSavedadstyleListCall) and [*urlchannels list*](api::AccountUrlchannelListCall)
16//! * adclients
17//! * [*list*](api::AdclientListCall)
18//! * adunits
19//! * [*customchannels list*](api::AdunitCustomchannelListCall), [*get*](api::AdunitGetCall), [*get ad code*](api::AdunitGetAdCodeCall) and [*list*](api::AdunitListCall)
20//! * [alerts](api::Alert)
21//! * [*delete*](api::AlertDeleteCall) and [*list*](api::AlertListCall)
22//! * customchannels
23//! * [*adunits list*](api::CustomchannelAdunitListCall), [*get*](api::CustomchannelGetCall) and [*list*](api::CustomchannelListCall)
24//! * [metadata](api::Metadata)
25//! * [*dimensions list*](api::MetadataDimensionListCall) and [*metrics list*](api::MetadataMetricListCall)
26//! * [payments](api::Payment)
27//! * [*list*](api::PaymentListCall)
28//! * reports
29//! * [*generate*](api::ReportGenerateCall), [*saved generate*](api::ReportSavedGenerateCall) and [*saved list*](api::ReportSavedListCall)
30//! * savedadstyles
31//! * [*get*](api::SavedadstyleGetCall) and [*list*](api::SavedadstyleListCall)
32//! * urlchannels
33//! * [*list*](api::UrlchannelListCall)
34//!
35//!
36//! Download supported by ...
37//!
38//! * [*reports generate accounts*](api::AccountReportGenerateCall)
39//! * [*generate reports*](api::ReportGenerateCall)
40//!
41//!
42//!
43//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
44//!
45//! # Structure of this Library
46//!
47//! The API is structured into the following primary items:
48//!
49//! * **[Hub](AdSense)**
50//! * a central object to maintain state and allow accessing all *Activities*
51//! * creates [*Method Builders*](common::MethodsBuilder) which in turn
52//! allow access to individual [*Call Builders*](common::CallBuilder)
53//! * **[Resources](common::Resource)**
54//! * primary types that you can apply *Activities* to
55//! * a collection of properties and *Parts*
56//! * **[Parts](common::Part)**
57//! * a collection of properties
58//! * never directly used in *Activities*
59//! * **[Activities](common::CallBuilder)**
60//! * operations to apply to *Resources*
61//!
62//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
63//!
64//! Generally speaking, you can invoke *Activities* like this:
65//!
66//! ```Rust,ignore
67//! let r = hub.resource().activity(...).doit().await
68//! ```
69//!
70//! Or specifically ...
71//!
72//! ```ignore
73//! let r = hub.accounts().adclients_get_ad_code(...).doit().await
74//! let r = hub.accounts().adclients_list(...).doit().await
75//! let r = hub.accounts().adunits_customchannels_list(...).doit().await
76//! let r = hub.accounts().adunits_get(...).doit().await
77//! let r = hub.accounts().adunits_get_ad_code(...).doit().await
78//! let r = hub.accounts().adunits_list(...).doit().await
79//! let r = hub.accounts().alerts_delete(...).doit().await
80//! let r = hub.accounts().alerts_list(...).doit().await
81//! let r = hub.accounts().customchannels_adunits_list(...).doit().await
82//! let r = hub.accounts().customchannels_get(...).doit().await
83//! let r = hub.accounts().customchannels_list(...).doit().await
84//! let r = hub.accounts().payments_list(...).doit().await
85//! let r = hub.accounts().reports_saved_generate(...).doit().await
86//! let r = hub.accounts().reports_saved_list(...).doit().await
87//! let r = hub.accounts().reports_generate(...).doit().await
88//! let r = hub.accounts().savedadstyles_get(...).doit().await
89//! let r = hub.accounts().savedadstyles_list(...).doit().await
90//! let r = hub.accounts().urlchannels_list(...).doit().await
91//! let r = hub.accounts().get(...).doit().await
92//! let r = hub.accounts().list(...).doit().await
93//! ```
94//!
95//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
96//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
97//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
98//! The `doit()` method performs the actual communication with the server and returns the respective result.
99//!
100//! # Usage
101//!
102//! ## Setting up your Project
103//!
104//! To use this library, you would put the following lines into your `Cargo.toml` file:
105//!
106//! ```toml
107//! [dependencies]
108//! google-adsense1d4 = "*"
109//! serde = "1"
110//! serde_json = "1"
111//! ```
112//!
113//! ## A complete example
114//!
115//! ```test_harness,no_run
116//! extern crate hyper;
117//! extern crate hyper_rustls;
118//! extern crate google_adsense1d4 as adsense1d4;
119//! use adsense1d4::{Result, Error};
120//! # async fn dox() {
121//! use adsense1d4::{AdSense, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
122//!
123//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
124//! // `client_secret`, among other things.
125//! let secret: yup_oauth2::ApplicationSecret = Default::default();
126//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
127//! // unless you replace `None` with the desired Flow.
128//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
129//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
130//! // retrieve them from storage.
131//! let connector = hyper_rustls::HttpsConnectorBuilder::new()
132//! .with_native_roots()
133//! .unwrap()
134//! .https_only()
135//! .enable_http2()
136//! .build();
137//!
138//! let executor = hyper_util::rt::TokioExecutor::new();
139//! let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
140//! secret,
141//! yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
142//! yup_oauth2::client::CustomHyperClientBuilder::from(
143//! hyper_util::client::legacy::Client::builder(executor).build(connector),
144//! ),
145//! ).build().await.unwrap();
146//!
147//! let client = hyper_util::client::legacy::Client::builder(
148//! hyper_util::rt::TokioExecutor::new()
149//! )
150//! .build(
151//! hyper_rustls::HttpsConnectorBuilder::new()
152//! .with_native_roots()
153//! .unwrap()
154//! .https_or_http()
155//! .enable_http2()
156//! .build()
157//! );
158//! let mut hub = AdSense::new(client, auth);
159//! // You can configure optional parameters by calling the respective setters at will, and
160//! // execute the final call using `doit()`.
161//! // Values shown here are possibly random and not representative !
162//! let result = hub.accounts().reports_generate("accountId", "startDate", "endDate")
163//! .use_timezone_reporting(false)
164//! .start_index(-4)
165//! .add_sort("ea")
166//! .add_metric("ipsum")
167//! .max_results(-88)
168//! .locale("amet")
169//! .add_filter("duo")
170//! .add_dimension("ipsum")
171//! .currency("sed")
172//! .doit().await;
173//!
174//! match result {
175//! Err(e) => match e {
176//! // The Error enum provides details about what exactly happened.
177//! // You can also just use its `Debug`, `Display` or `Error` traits
178//! Error::HttpError(_)
179//! |Error::Io(_)
180//! |Error::MissingAPIKey
181//! |Error::MissingToken(_)
182//! |Error::Cancelled
183//! |Error::UploadSizeLimitExceeded(_, _)
184//! |Error::Failure(_)
185//! |Error::BadRequest(_)
186//! |Error::FieldClash(_)
187//! |Error::JsonDecodeError(_, _) => println!("{}", e),
188//! },
189//! Ok(res) => println!("Success: {:?}", res),
190//! }
191//! # }
192//! ```
193//! ## Handling Errors
194//!
195//! All errors produced by the system are provided either as [Result](common::Result) enumeration as return value of
196//! the doit() methods, or handed as possibly intermediate results to either the
197//! [Hub Delegate](common::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
198//!
199//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
200//! makes the system potentially resilient to all kinds of errors.
201//!
202//! ## Uploads and Downloads
203//! If a method supports downloads, the response body, which is part of the [Result](common::Result), should be
204//! read by you to obtain the media.
205//! If such a method also supports a [Response Result](common::ResponseResult), it will return that by default.
206//! 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
207//! this call: `.param("alt", "media")`.
208//!
209//! Methods supporting uploads can do so using up to 2 different protocols:
210//! *simple* and *resumable*. The distinctiveness of each is represented by customized
211//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
212//!
213//! ## Customization and Callbacks
214//!
215//! You may alter the way an `doit()` method is called by providing a [delegate](common::Delegate) to the
216//! [Method Builder](common::CallBuilder) before making the final `doit()` call.
217//! Respective methods will be called to provide progress information, as well as determine whether the system should
218//! retry on failure.
219//!
220//! The [delegate trait](common::Delegate) is default-implemented, allowing you to customize it with minimal effort.
221//!
222//! ## Optional Parts in Server-Requests
223//!
224//! All structures provided by this library are made to be [encodable](common::RequestValue) and
225//! [decodable](common::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
226//! are valid.
227//! Most optionals are are considered [Parts](common::Part) which are identifiable by name, which will be sent to
228//! the server to indicate either the set parts of the request or the desired parts in the response.
229//!
230//! ## Builder Arguments
231//!
232//! Using [method builders](common::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
233//! These will always take a single argument, for which the following statements are true.
234//!
235//! * [PODs][wiki-pod] are handed by copy
236//! * strings are passed as `&str`
237//! * [request values](common::RequestValue) are moved
238//!
239//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
240//!
241//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
242//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
243//! [google-go-api]: https://github.com/google/google-api-go-client
244//!
245//! ## Cargo Features
246//!
247//! * `utoipa` - Add support for [utoipa](https://crates.io/crates/utoipa) and derive `utoipa::ToSchema` on all
248//! the types. You'll have to import and register the required types in `#[openapi(schemas(...))]`, otherwise the
249//! generated `openapi` spec would be invalid.
250//!
251//!
252//!
253
254// Unused attributes happen thanks to defined, but unused structures We don't
255// warn about this, as depending on the API, some data structures or facilities
256// are never used. Instead of pre-determining this, we just disable the lint.
257// It's manually tuned to not have any unused imports in fully featured APIs.
258// Same with unused_mut.
259#![allow(unused_imports, unused_mut, dead_code)]
260
261// DO NOT EDIT !
262// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
263// DO NOT EDIT !
264
265pub extern crate hyper;
266pub extern crate hyper_rustls;
267pub extern crate hyper_util;
268#[cfg(feature = "yup-oauth2")]
269pub extern crate yup_oauth2;
270
271pub extern crate google_apis_common as common;
272pub use common::{Delegate, Error, FieldMask, Result};
273
274pub mod api;
275pub use api::AdSense;