mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-02 01:20:02 +01:00
fix(version-up): check-in of latest sources
This also includes crate files to remember which crates we have published already. Related to #44
This commit is contained in:
0
etc/api/admin/reports_v1/crates/0.1.2-api+20150115
Normal file
0
etc/api/admin/reports_v1/crates/0.1.2-api+20150115
Normal file
0
etc/api/adsense/v1.4/crates/0.1.2-api+20150303
Normal file
0
etc/api/adsense/v1.4/crates/0.1.2-api+20150303
Normal file
0
etc/api/adsensehost/v4.1/crates/0.1.2-api+20150309
Normal file
0
etc/api/adsensehost/v4.1/crates/0.1.2-api+20150309
Normal file
0
etc/api/analytics/v3/crates/0.1.2-api+20150308
Normal file
0
etc/api/analytics/v3/crates/0.1.2-api+20150308
Normal file
0
etc/api/appsactivity/v1/crates/0.1.2-api+20140828
Normal file
0
etc/api/appsactivity/v1/crates/0.1.2-api+20140828
Normal file
0
etc/api/appstate/v1/crates/0.1.2-api+20150316
Normal file
0
etc/api/appstate/v1/crates/0.1.2-api+20150316
Normal file
0
etc/api/audit/v1/crates/0.1.2-api+20130108
Normal file
0
etc/api/audit/v1/crates/0.1.2-api+20130108
Normal file
0
etc/api/bigquery/v2/crates/0.1.2-api+20150303
Normal file
0
etc/api/bigquery/v2/crates/0.1.2-api+20150303
Normal file
0
etc/api/blogger/v3/crates/0.1.2-api+20150208
Normal file
0
etc/api/blogger/v3/crates/0.1.2-api+20150208
Normal file
0
etc/api/books/v1/crates/0.1.2-api+20150309
Normal file
0
etc/api/books/v1/crates/0.1.2-api+20150309
Normal file
0
etc/api/calendar/v3/crates/0.1.2-api+20150303
Normal file
0
etc/api/calendar/v3/crates/0.1.2-api+20150303
Normal file
0
etc/api/compute/v1/crates/0.1.2-api+20150302
Normal file
0
etc/api/compute/v1/crates/0.1.2-api+20150302
Normal file
0
etc/api/container/v1beta1/crates/0.1.2-api+20150316
Normal file
0
etc/api/container/v1beta1/crates/0.1.2-api+20150316
Normal file
0
etc/api/content/v2/crates/0.1.2-api+20150317
Normal file
0
etc/api/content/v2/crates/0.1.2-api+20150317
Normal file
0
etc/api/coordinate/v1/crates/0.1.2-api+20141215
Normal file
0
etc/api/coordinate/v1/crates/0.1.2-api+20141215
Normal file
0
etc/api/customsearch/v1/crates/0.1.2-api+20131205
Normal file
0
etc/api/customsearch/v1/crates/0.1.2-api+20131205
Normal file
0
etc/api/dataflow/v1b4/crates/0.1.2-api+20150130
Normal file
0
etc/api/dataflow/v1b4/crates/0.1.2-api+20150130
Normal file
0
etc/api/datastore/v1beta2/crates/0.1.2-api+20140916
Normal file
0
etc/api/datastore/v1beta2/crates/0.1.2-api+20140916
Normal file
0
etc/api/dfareporting/v2.0/crates/0.1.2-api+20150223
Normal file
0
etc/api/dfareporting/v2.0/crates/0.1.2-api+20150223
Normal file
0
etc/api/dns/v1beta1/crates/0.1.2-api+20150114
Normal file
0
etc/api/dns/v1beta1/crates/0.1.2-api+20150114
Normal file
0
etc/api/drive/v2/crates/0.1.2-api+20150108
Normal file
0
etc/api/drive/v2/crates/0.1.2-api+20150108
Normal file
0
etc/api/fitness/v1/crates/0.1.2-api+20150222
Normal file
0
etc/api/fitness/v1/crates/0.1.2-api+20150222
Normal file
0
etc/api/freebase/v1/crates/0.1.2-api+20150313
Normal file
0
etc/api/freebase/v1/crates/0.1.2-api+20150313
Normal file
0
etc/api/fusiontables/v2/crates/0.1.2-api+20150226
Normal file
0
etc/api/fusiontables/v2/crates/0.1.2-api+20150226
Normal file
0
etc/api/games/v1/crates/0.1.2-api+20150316
Normal file
0
etc/api/games/v1/crates/0.1.2-api+20150316
Normal file
0
etc/api/genomics/v1beta2/crates/0.1.2-api+20150317
Normal file
0
etc/api/genomics/v1beta2/crates/0.1.2-api+20150317
Normal file
0
etc/api/gmail/v1/crates/0.1.2-api+20150313
Normal file
0
etc/api/gmail/v1/crates/0.1.2-api+20150313
Normal file
0
etc/api/groupssettings/v1/crates/0.1.2-api+20140428
Normal file
0
etc/api/groupssettings/v1/crates/0.1.2-api+20140428
Normal file
0
etc/api/licensing/v1/crates/0.1.2-api+20140122
Normal file
0
etc/api/licensing/v1/crates/0.1.2-api+20140122
Normal file
0
etc/api/manager/v1beta2/crates/0.1.2-api+20140915
Normal file
0
etc/api/manager/v1beta2/crates/0.1.2-api+20140915
Normal file
0
etc/api/mapsengine/v1/crates/0.1.2-api+20150225
Normal file
0
etc/api/mapsengine/v1/crates/0.1.2-api+20150225
Normal file
0
etc/api/mirror/v1/crates/0.1.2-api+20150220
Normal file
0
etc/api/mirror/v1/crates/0.1.2-api+20150220
Normal file
0
etc/api/oauth2/v2/crates/0.1.2-api+20150302
Normal file
0
etc/api/oauth2/v2/crates/0.1.2-api+20150302
Normal file
0
etc/api/plusdomains/v1/crates/0.1.2-api+20150305
Normal file
0
etc/api/plusdomains/v1/crates/0.1.2-api+20150305
Normal file
0
etc/api/prediction/v1.6/crates/0.1.2-api+20140522
Normal file
0
etc/api/prediction/v1.6/crates/0.1.2-api+20140522
Normal file
0
etc/api/pubsub/v1beta2/crates/0.1.2-api+20150213
Normal file
0
etc/api/pubsub/v1beta2/crates/0.1.2-api+20150213
Normal file
0
etc/api/qpxexpress/v1/crates/0.1.2-api+20140321
Normal file
0
etc/api/qpxexpress/v1/crates/0.1.2-api+20140321
Normal file
0
etc/api/sqladmin/v1beta4/crates/0.1.2-api+20150109
Normal file
0
etc/api/sqladmin/v1beta4/crates/0.1.2-api+20150109
Normal file
0
etc/api/storage/v1/crates/0.1.2-api+20150213
Normal file
0
etc/api/storage/v1/crates/0.1.2-api+20150213
Normal file
0
etc/api/tagmanager/v1/crates/0.1.2-api+20150121
Normal file
0
etc/api/tagmanager/v1/crates/0.1.2-api+20150121
Normal file
0
etc/api/taskqueue/v1beta2/crates/0.1.2-api+20141111
Normal file
0
etc/api/taskqueue/v1beta2/crates/0.1.2-api+20141111
Normal file
0
etc/api/tasks/v1/crates/0.1.2-api+20141121
Normal file
0
etc/api/tasks/v1/crates/0.1.2-api+20141121
Normal file
0
etc/api/translate/v2/crates/0.1.2-api+20141123
Normal file
0
etc/api/translate/v2/crates/0.1.2-api+20141123
Normal file
0
etc/api/urlshortener/v1/crates/0.1.2-api+20150219
Normal file
0
etc/api/urlshortener/v1/crates/0.1.2-api+20150219
Normal file
0
etc/api/webfonts/v1/crates/0.1.2-api+20140210
Normal file
0
etc/api/webfonts/v1/crates/0.1.2-api+20140210
Normal file
0
etc/api/webmasters/v3/crates/0.1.2-api+20140908
Normal file
0
etc/api/webmasters/v3/crates/0.1.2-api+20140908
Normal file
0
etc/api/youtube/v3/crates/0.1.2-api+20150309
Normal file
0
etc/api/youtube/v3/crates/0.1.2-api+20150309
Normal file
@@ -4,7 +4,7 @@
|
||||
[package]
|
||||
|
||||
name = "google-adexchangebuyer1d3"
|
||||
version = "0.1.1+20150218"
|
||||
version = "0.1.2+20150218"
|
||||
authors = ["Sebastian Thiel <byronimo@gmail>"]
|
||||
description = "A complete library to interact with Ad Exchange Buyer (protocol v1.3)"
|
||||
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangebuyer1d3"
|
||||
@@ -16,7 +16,7 @@ keywords = ["adexchangebuyer", "google", "protocol", "web", "api"]
|
||||
[dependencies]
|
||||
hyper = "*"
|
||||
mime = "*"
|
||||
yup-oauth2 = "*"
|
||||
url = "*"
|
||||
serde = "*"
|
||||
serde_macros = "*"
|
||||
yup-oauth2 = "*"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!---
|
||||
DO NOT EDIT !
|
||||
This file was generated automatically from 'src/mako/README.md.mako'
|
||||
This file was generated automatically from 'src/mako/api/README.md.mako'
|
||||
DO NOT EDIT !
|
||||
-->
|
||||
The `google-adexchangebuyer1d3` library allows access to all features of the *Google Ad Exchange Buyer* service.
|
||||
|
||||
This documentation was generated from *Ad Exchange Buyer* crate version *0.1.1+20150218*, where *20150218* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.1*.
|
||||
This documentation was generated from *Ad Exchange Buyer* crate version *0.1.2+20150218*, where *20150218* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.2*.
|
||||
|
||||
Everything else about the *Ad Exchange Buyer* *v1d3* API can be found at the
|
||||
[official documentation site](https://developers.google.com/ad-exchange/buyer-rest).
|
||||
@@ -37,6 +37,8 @@ The API is structured into the following primary items:
|
||||
|
||||
* **[Hub](http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3/struct.AdExchangeBuyer.html)**
|
||||
* a central object to maintain state and allow accessing all *Activities*
|
||||
* creates [*Method Builders*](http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3/trait.MethodsBuilder.html) which in turn
|
||||
allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3/trait.CallBuilder.html)
|
||||
* **[Resources](http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3/trait.Resource.html)**
|
||||
* primary types that you can apply *Activities* to
|
||||
* a collection of properties and *Parts*
|
||||
@@ -46,6 +48,8 @@ The API is structured into the following primary items:
|
||||
* **[Activities](http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3/trait.CallBuilder.html)**
|
||||
* operations to apply to *Resources*
|
||||
|
||||
All *structures* are marked with applicable traits to further categorize them and ease browsing.
|
||||
|
||||
Generally speaking, you can invoke *Activities* like this:
|
||||
|
||||
```Rust,ignore
|
||||
@@ -84,7 +88,7 @@ extern crate hyper;
|
||||
extern crate "yup-oauth2" as oauth2;
|
||||
extern crate "google-adexchangebuyer1d3" as adexchangebuyer1d3;
|
||||
use adexchangebuyer1d3::PretargetingConfig;
|
||||
use adexchangebuyer1d3::Result;
|
||||
use adexchangebuyer1d3::{Result, Error};
|
||||
use std::default::Default;
|
||||
use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
||||
use adexchangebuyer1d3::AdExchangeBuyer;
|
||||
@@ -113,15 +117,17 @@ let result = hub.pretargeting_config().patch(&req, "accountId", "configId")
|
||||
.doit();
|
||||
|
||||
match result {
|
||||
Result::HttpError(err) => println!("HTTPERROR: {:?}", err),
|
||||
Result::MissingAPIKey => println!("Auth: Missing API Key - used if there are no scopes"),
|
||||
Result::MissingToken => println!("OAuth2: Missing Token"),
|
||||
Result::Cancelled => println!("Operation cancelled by user"),
|
||||
Result::UploadSizeLimitExceeded(size, max_size) => println!("Upload size too big: {} of {}", size, max_size),
|
||||
Result::Failure(_) => println!("General Failure (hyper::client::Response doesn't print)"),
|
||||
Result::FieldClash(clashed_field) => println!("You added custom parameter which is part of builder: {:?}", clashed_field),
|
||||
Result::JsonDecodeError(err) => println!("Couldn't understand server reply - maybe API needs update: {:?}", err),
|
||||
Result::Success(_) => println!("Success (value doesn't print)"),
|
||||
Err(e) => match e {
|
||||
Error::HttpError(err) => println!("HTTPERROR: {:?}", err),
|
||||
Error::MissingAPIKey => println!("Auth: Missing API Key - used if there are no scopes"),
|
||||
Error::MissingToken => println!("OAuth2: Missing Token"),
|
||||
Error::Cancelled => println!("Operation canceled by user"),
|
||||
Error::UploadSizeLimitExceeded(size, max_size) => println!("Upload size too big: {} of {}", size, max_size),
|
||||
Error::Failure(_) => println!("General Failure (hyper::client::Response doesn't print)"),
|
||||
Error::FieldClash(clashed_field) => println!("You added custom parameter which is part of builder: {:?}", clashed_field),
|
||||
Error::JsonDecodeError(err) => println!("Couldn't understand server reply - maybe API needs update: {:?}", err),
|
||||
},
|
||||
Ok(_) => println!("Success (value doesn't print)"),
|
||||
}
|
||||
|
||||
```
|
||||
@@ -134,7 +140,7 @@ the doit() methods, or handed as possibly intermediate results to either the
|
||||
When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
|
||||
makes the system potentially resilient to all kinds of errors.
|
||||
|
||||
## Uploads and Downlods
|
||||
## Uploads and Downloads
|
||||
If a method supports downloads, the response body, which is part of the [Result](http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3/enum.Result.html), should be
|
||||
read by you to obtain the media.
|
||||
If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3/trait.ResponseResult.html), it will return that by default.
|
||||
@@ -157,8 +163,9 @@ The [delegate trait](http://byron.github.io/google-apis-rs/google-adexchangebuye
|
||||
## Optional Parts in Server-Requests
|
||||
|
||||
All structures provided by this library are made to be [enocodable](http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3/trait.RequestValue.html) and
|
||||
[decodable](http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3/trait.ResponseResult.html) via json. Optionals are used to indicate that partial requests are responses are valid.
|
||||
Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3/trait.Part.html) which are identifyable by name, which will be sent to
|
||||
[decodable](http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses
|
||||
are valid.
|
||||
Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3/trait.Part.html) which are identifiable by name, which will be sent to
|
||||
the server to indicate either the set parts of the request or the desired parts in the response.
|
||||
|
||||
## Builder Arguments
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// COPY OF 'src/rust/cmn.rs'
|
||||
// COPY OF 'src/rust/api/cmn.rs'
|
||||
// DO NOT EDIT
|
||||
use std::marker::MarkerTrait;
|
||||
use std::io::{self, Read, Seek, Cursor, Write, SeekFrom};
|
||||
@@ -24,7 +24,7 @@ use serde;
|
||||
pub trait Hub: MarkerTrait {}
|
||||
|
||||
/// Identifies types for building methods of a particular resource type
|
||||
pub trait ResourceMethodsBuilder: MarkerTrait {}
|
||||
pub trait MethodsBuilder: MarkerTrait {}
|
||||
|
||||
/// Identifies types which represent builders for a particular resource method
|
||||
pub trait CallBuilder: MarkerTrait {}
|
||||
@@ -105,12 +105,15 @@ pub trait Delegate {
|
||||
/// information if he is interesting in knowing more context when further calls to it
|
||||
/// are made.
|
||||
/// The matching `finished()` call will always be made, no matter whether or not the API
|
||||
/// request was sucessfull. That way, the delgate may easily maintain a clean state
|
||||
/// request was successful. That way, the delegate may easily maintain a clean state
|
||||
/// between various API calls.
|
||||
fn begin(&mut self, MethodInfo) {}
|
||||
|
||||
/// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems.
|
||||
///
|
||||
/// If you choose to retry after a duration, the duration should be chosen using the
|
||||
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
|
||||
///
|
||||
/// Return retry information.
|
||||
fn http_error(&mut self, &hyper::HttpError) -> Retry {
|
||||
Retry::Abort
|
||||
@@ -133,7 +136,7 @@ pub trait Delegate {
|
||||
/// Called during resumable uploads to provide a URL for the impending upload.
|
||||
/// It was saved after a previous call to `store_upload_url(...)`, and if not None,
|
||||
/// will be used instead of asking the server for a new upload URL.
|
||||
/// This is useful in case a previous resumable upload was aborted/cancelled, but should now
|
||||
/// This is useful in case a previous resumable upload was aborted/canceled, but should now
|
||||
/// be resumed.
|
||||
/// The returned URL will be used exactly once - if it fails again and the delegate allows
|
||||
/// to retry, we will ask the server for a new upload URL.
|
||||
@@ -154,8 +157,8 @@ pub trait Delegate {
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// `json_encoded_value` - The json-encoded value which failed to decode.
|
||||
/// `json_decode_error` - The decoder error
|
||||
/// * `json_encoded_value` - The json-encoded value which failed to decode.
|
||||
/// * `json_decode_error` - The decoder error
|
||||
fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &serde::json::Error) {
|
||||
let _ = json_encoded_value;
|
||||
let _ = json_decode_error;
|
||||
@@ -166,6 +169,9 @@ pub trait Delegate {
|
||||
/// depends on the used API method.
|
||||
/// The delegate should check the status, header and decoded json error to decide
|
||||
/// whether to retry or not. In the latter case, the underlying call will fail.
|
||||
///
|
||||
/// If you choose to retry after a duration, the duration should be chosen using the
|
||||
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
|
||||
fn http_failure(&mut self, _: &hyper::client::Response, Option<JsonServerError>) -> Retry {
|
||||
Retry::Abort
|
||||
}
|
||||
@@ -197,8 +203,8 @@ pub trait Delegate {
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// `is_success` - a true value indicates the operation was successful. If false, you should
|
||||
/// discard all values stored during `store_upload_url`.
|
||||
/// * `is_success` - a true value indicates the operation was successful. If false, you should
|
||||
/// discard all values stored during `store_upload_url`.
|
||||
fn finished(&mut self, is_success: bool) {
|
||||
let _ = is_success;
|
||||
}
|
||||
@@ -212,8 +218,8 @@ pub struct DefaultDelegate;
|
||||
impl Delegate for DefaultDelegate {}
|
||||
|
||||
|
||||
/// A universal result type used as return for all action method results.
|
||||
pub enum Result<T = ()> {
|
||||
|
||||
pub enum Error {
|
||||
/// The http connection failed
|
||||
HttpError(hyper::HttpError),
|
||||
|
||||
@@ -240,11 +246,11 @@ pub enum Result<T = ()> {
|
||||
|
||||
/// Indicates an HTTP repsonse with a non-success status code
|
||||
Failure(hyper::client::Response),
|
||||
|
||||
/// It worked !
|
||||
Success(T),
|
||||
}
|
||||
|
||||
/// A universal result type used as return for all calls.
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// Contains information about an API request.
|
||||
pub struct MethodInfo {
|
||||
pub id: &'static str,
|
||||
@@ -499,7 +505,7 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
where NC: hyper::net::NetworkConnector,
|
||||
A: oauth2::GetToken {
|
||||
|
||||
fn query_transfer_status(&mut self) -> (Option<u64>, hyper::HttpResult<hyper::client::Response>) {
|
||||
fn query_transfer_status(&mut self) -> std::result::Result<u64, hyper::HttpResult<hyper::client::Response>> {
|
||||
loop {
|
||||
match self.client.post(self.url)
|
||||
.header(UserAgent(self.user_agent.to_string()))
|
||||
@@ -516,17 +522,17 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
return (None, Ok(r))
|
||||
return Err(Ok(r))
|
||||
}
|
||||
};
|
||||
return (Some(h.0.last), Ok(r))
|
||||
return Ok(h.0.last)
|
||||
}
|
||||
Err(err) => {
|
||||
if let Retry::After(d) = self.delegate.http_error(&err) {
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
return (None, Err(err))
|
||||
return Err(Err(err))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -539,8 +545,8 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
let mut start = match self.start_at {
|
||||
Some(s) => s,
|
||||
None => match self.query_transfer_status() {
|
||||
(Some(s), _) => s,
|
||||
(_, result) => return Some(result)
|
||||
Ok(s) => s,
|
||||
Err(result) => return Some(result)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
||||
[package]
|
||||
|
||||
name = "google-adexchangeseller2"
|
||||
version = "0.1.1+20150313"
|
||||
version = "0.1.2+20150309"
|
||||
authors = ["Sebastian Thiel <byronimo@gmail>"]
|
||||
description = "A complete library to interact with Ad Exchange Seller (protocol v2.0)"
|
||||
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangeseller2"
|
||||
@@ -16,7 +16,7 @@ keywords = ["adexchangeseller", "google", "protocol", "web", "api"]
|
||||
[dependencies]
|
||||
hyper = "*"
|
||||
mime = "*"
|
||||
yup-oauth2 = "*"
|
||||
url = "*"
|
||||
serde = "*"
|
||||
serde_macros = "*"
|
||||
yup-oauth2 = "*"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!---
|
||||
DO NOT EDIT !
|
||||
This file was generated automatically from 'src/mako/README.md.mako'
|
||||
This file was generated automatically from 'src/mako/api/README.md.mako'
|
||||
DO NOT EDIT !
|
||||
-->
|
||||
The `google-adexchangeseller2` library allows access to all features of the *Google Ad Exchange Seller* service.
|
||||
|
||||
This documentation was generated from *Ad Exchange Seller* crate version *0.1.1+20150313*, where *20150313* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.1*.
|
||||
This documentation was generated from *Ad Exchange Seller* crate version *0.1.2+20150309*, where *20150309* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.2*.
|
||||
|
||||
Everything else about the *Ad Exchange Seller* *v2* API can be found at the
|
||||
[official documentation site](https://developers.google.com/ad-exchange/seller-rest/).
|
||||
@@ -29,6 +29,8 @@ The API is structured into the following primary items:
|
||||
|
||||
* **[Hub](http://byron.github.io/google-apis-rs/google-adexchangeseller2/struct.AdExchangeSeller.html)**
|
||||
* a central object to maintain state and allow accessing all *Activities*
|
||||
* creates [*Method Builders*](http://byron.github.io/google-apis-rs/google-adexchangeseller2/trait.MethodsBuilder.html) which in turn
|
||||
allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google-adexchangeseller2/trait.CallBuilder.html)
|
||||
* **[Resources](http://byron.github.io/google-apis-rs/google-adexchangeseller2/trait.Resource.html)**
|
||||
* primary types that you can apply *Activities* to
|
||||
* a collection of properties and *Parts*
|
||||
@@ -38,6 +40,8 @@ The API is structured into the following primary items:
|
||||
* **[Activities](http://byron.github.io/google-apis-rs/google-adexchangeseller2/trait.CallBuilder.html)**
|
||||
* operations to apply to *Resources*
|
||||
|
||||
All *structures* are marked with applicable traits to further categorize them and ease browsing.
|
||||
|
||||
Generally speaking, you can invoke *Activities* like this:
|
||||
|
||||
```Rust,ignore
|
||||
@@ -85,7 +89,7 @@ google-adexchangeseller2 = "*"
|
||||
extern crate hyper;
|
||||
extern crate "yup-oauth2" as oauth2;
|
||||
extern crate "google-adexchangeseller2" as adexchangeseller2;
|
||||
use adexchangeseller2::Result;
|
||||
use adexchangeseller2::{Result, Error};
|
||||
use std::default::Default;
|
||||
use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
||||
use adexchangeseller2::AdExchangeSeller;
|
||||
@@ -116,15 +120,17 @@ let result = hub.accounts().reports_generate("accountId", "startDate", "endDate"
|
||||
.doit();
|
||||
|
||||
match result {
|
||||
Result::HttpError(err) => println!("HTTPERROR: {:?}", err),
|
||||
Result::MissingAPIKey => println!("Auth: Missing API Key - used if there are no scopes"),
|
||||
Result::MissingToken => println!("OAuth2: Missing Token"),
|
||||
Result::Cancelled => println!("Operation cancelled by user"),
|
||||
Result::UploadSizeLimitExceeded(size, max_size) => println!("Upload size too big: {} of {}", size, max_size),
|
||||
Result::Failure(_) => println!("General Failure (hyper::client::Response doesn't print)"),
|
||||
Result::FieldClash(clashed_field) => println!("You added custom parameter which is part of builder: {:?}", clashed_field),
|
||||
Result::JsonDecodeError(err) => println!("Couldn't understand server reply - maybe API needs update: {:?}", err),
|
||||
Result::Success(_) => println!("Success (value doesn't print)"),
|
||||
Err(e) => match e {
|
||||
Error::HttpError(err) => println!("HTTPERROR: {:?}", err),
|
||||
Error::MissingAPIKey => println!("Auth: Missing API Key - used if there are no scopes"),
|
||||
Error::MissingToken => println!("OAuth2: Missing Token"),
|
||||
Error::Cancelled => println!("Operation canceled by user"),
|
||||
Error::UploadSizeLimitExceeded(size, max_size) => println!("Upload size too big: {} of {}", size, max_size),
|
||||
Error::Failure(_) => println!("General Failure (hyper::client::Response doesn't print)"),
|
||||
Error::FieldClash(clashed_field) => println!("You added custom parameter which is part of builder: {:?}", clashed_field),
|
||||
Error::JsonDecodeError(err) => println!("Couldn't understand server reply - maybe API needs update: {:?}", err),
|
||||
},
|
||||
Ok(_) => println!("Success (value doesn't print)"),
|
||||
}
|
||||
|
||||
```
|
||||
@@ -137,7 +143,7 @@ the doit() methods, or handed as possibly intermediate results to either the
|
||||
When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
|
||||
makes the system potentially resilient to all kinds of errors.
|
||||
|
||||
## Uploads and Downlods
|
||||
## Uploads and Downloads
|
||||
If a method supports downloads, the response body, which is part of the [Result](http://byron.github.io/google-apis-rs/google-adexchangeseller2/enum.Result.html), should be
|
||||
read by you to obtain the media.
|
||||
If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google-adexchangeseller2/trait.ResponseResult.html), it will return that by default.
|
||||
@@ -160,8 +166,9 @@ The [delegate trait](http://byron.github.io/google-apis-rs/google-adexchangesell
|
||||
## Optional Parts in Server-Requests
|
||||
|
||||
All structures provided by this library are made to be [enocodable](http://byron.github.io/google-apis-rs/google-adexchangeseller2/trait.RequestValue.html) and
|
||||
[decodable](http://byron.github.io/google-apis-rs/google-adexchangeseller2/trait.ResponseResult.html) via json. Optionals are used to indicate that partial requests are responses are valid.
|
||||
Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google-adexchangeseller2/trait.Part.html) which are identifyable by name, which will be sent to
|
||||
[decodable](http://byron.github.io/google-apis-rs/google-adexchangeseller2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses
|
||||
are valid.
|
||||
Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google-adexchangeseller2/trait.Part.html) which are identifiable by name, which will be sent to
|
||||
the server to indicate either the set parts of the request or the desired parts in the response.
|
||||
|
||||
## Builder Arguments
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// COPY OF 'src/rust/cmn.rs'
|
||||
// COPY OF 'src/rust/api/cmn.rs'
|
||||
// DO NOT EDIT
|
||||
use std::marker::MarkerTrait;
|
||||
use std::io::{self, Read, Seek, Cursor, Write, SeekFrom};
|
||||
@@ -24,7 +24,7 @@ use serde;
|
||||
pub trait Hub: MarkerTrait {}
|
||||
|
||||
/// Identifies types for building methods of a particular resource type
|
||||
pub trait ResourceMethodsBuilder: MarkerTrait {}
|
||||
pub trait MethodsBuilder: MarkerTrait {}
|
||||
|
||||
/// Identifies types which represent builders for a particular resource method
|
||||
pub trait CallBuilder: MarkerTrait {}
|
||||
@@ -105,12 +105,15 @@ pub trait Delegate {
|
||||
/// information if he is interesting in knowing more context when further calls to it
|
||||
/// are made.
|
||||
/// The matching `finished()` call will always be made, no matter whether or not the API
|
||||
/// request was sucessfull. That way, the delgate may easily maintain a clean state
|
||||
/// request was successful. That way, the delegate may easily maintain a clean state
|
||||
/// between various API calls.
|
||||
fn begin(&mut self, MethodInfo) {}
|
||||
|
||||
/// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems.
|
||||
///
|
||||
/// If you choose to retry after a duration, the duration should be chosen using the
|
||||
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
|
||||
///
|
||||
/// Return retry information.
|
||||
fn http_error(&mut self, &hyper::HttpError) -> Retry {
|
||||
Retry::Abort
|
||||
@@ -133,7 +136,7 @@ pub trait Delegate {
|
||||
/// Called during resumable uploads to provide a URL for the impending upload.
|
||||
/// It was saved after a previous call to `store_upload_url(...)`, and if not None,
|
||||
/// will be used instead of asking the server for a new upload URL.
|
||||
/// This is useful in case a previous resumable upload was aborted/cancelled, but should now
|
||||
/// This is useful in case a previous resumable upload was aborted/canceled, but should now
|
||||
/// be resumed.
|
||||
/// The returned URL will be used exactly once - if it fails again and the delegate allows
|
||||
/// to retry, we will ask the server for a new upload URL.
|
||||
@@ -154,8 +157,8 @@ pub trait Delegate {
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// `json_encoded_value` - The json-encoded value which failed to decode.
|
||||
/// `json_decode_error` - The decoder error
|
||||
/// * `json_encoded_value` - The json-encoded value which failed to decode.
|
||||
/// * `json_decode_error` - The decoder error
|
||||
fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &serde::json::Error) {
|
||||
let _ = json_encoded_value;
|
||||
let _ = json_decode_error;
|
||||
@@ -166,6 +169,9 @@ pub trait Delegate {
|
||||
/// depends on the used API method.
|
||||
/// The delegate should check the status, header and decoded json error to decide
|
||||
/// whether to retry or not. In the latter case, the underlying call will fail.
|
||||
///
|
||||
/// If you choose to retry after a duration, the duration should be chosen using the
|
||||
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
|
||||
fn http_failure(&mut self, _: &hyper::client::Response, Option<JsonServerError>) -> Retry {
|
||||
Retry::Abort
|
||||
}
|
||||
@@ -197,8 +203,8 @@ pub trait Delegate {
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// `is_success` - a true value indicates the operation was successful. If false, you should
|
||||
/// discard all values stored during `store_upload_url`.
|
||||
/// * `is_success` - a true value indicates the operation was successful. If false, you should
|
||||
/// discard all values stored during `store_upload_url`.
|
||||
fn finished(&mut self, is_success: bool) {
|
||||
let _ = is_success;
|
||||
}
|
||||
@@ -212,8 +218,8 @@ pub struct DefaultDelegate;
|
||||
impl Delegate for DefaultDelegate {}
|
||||
|
||||
|
||||
/// A universal result type used as return for all action method results.
|
||||
pub enum Result<T = ()> {
|
||||
|
||||
pub enum Error {
|
||||
/// The http connection failed
|
||||
HttpError(hyper::HttpError),
|
||||
|
||||
@@ -240,11 +246,11 @@ pub enum Result<T = ()> {
|
||||
|
||||
/// Indicates an HTTP repsonse with a non-success status code
|
||||
Failure(hyper::client::Response),
|
||||
|
||||
/// It worked !
|
||||
Success(T),
|
||||
}
|
||||
|
||||
/// A universal result type used as return for all calls.
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// Contains information about an API request.
|
||||
pub struct MethodInfo {
|
||||
pub id: &'static str,
|
||||
@@ -499,7 +505,7 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
where NC: hyper::net::NetworkConnector,
|
||||
A: oauth2::GetToken {
|
||||
|
||||
fn query_transfer_status(&mut self) -> (Option<u64>, hyper::HttpResult<hyper::client::Response>) {
|
||||
fn query_transfer_status(&mut self) -> std::result::Result<u64, hyper::HttpResult<hyper::client::Response>> {
|
||||
loop {
|
||||
match self.client.post(self.url)
|
||||
.header(UserAgent(self.user_agent.to_string()))
|
||||
@@ -516,17 +522,17 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
return (None, Ok(r))
|
||||
return Err(Ok(r))
|
||||
}
|
||||
};
|
||||
return (Some(h.0.last), Ok(r))
|
||||
return Ok(h.0.last)
|
||||
}
|
||||
Err(err) => {
|
||||
if let Retry::After(d) = self.delegate.http_error(&err) {
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
return (None, Err(err))
|
||||
return Err(Err(err))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -539,8 +545,8 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
let mut start = match self.start_at {
|
||||
Some(s) => s,
|
||||
None => match self.query_transfer_status() {
|
||||
(Some(s), _) => s,
|
||||
(_, result) => return Some(result)
|
||||
Ok(s) => s,
|
||||
Err(result) => return Some(result)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
||||
[package]
|
||||
|
||||
name = "google-admin1_directory"
|
||||
version = "0.1.1+20150123"
|
||||
version = "0.1.2+20150123"
|
||||
authors = ["Sebastian Thiel <byronimo@gmail>"]
|
||||
description = "A complete library to interact with directory (protocol directory_v1)"
|
||||
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_directory"
|
||||
@@ -16,7 +16,7 @@ keywords = ["admin", "google", "protocol", "web", "api"]
|
||||
[dependencies]
|
||||
hyper = "*"
|
||||
mime = "*"
|
||||
yup-oauth2 = "*"
|
||||
url = "*"
|
||||
serde = "*"
|
||||
serde_macros = "*"
|
||||
yup-oauth2 = "*"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!---
|
||||
DO NOT EDIT !
|
||||
This file was generated automatically from 'src/mako/README.md.mako'
|
||||
This file was generated automatically from 'src/mako/api/README.md.mako'
|
||||
DO NOT EDIT !
|
||||
-->
|
||||
The `google-admin1_directory` library allows access to all features of the *Google directory* service.
|
||||
|
||||
This documentation was generated from *directory* crate version *0.1.1+20150123*, where *20150123* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.1*.
|
||||
This documentation was generated from *directory* crate version *0.1.2+20150123*, where *20150123* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.2*.
|
||||
|
||||
Everything else about the *directory* *v1_directory* API can be found at the
|
||||
[official documentation site](https://developers.google.com/admin-sdk/directory/).
|
||||
@@ -55,6 +55,8 @@ The API is structured into the following primary items:
|
||||
|
||||
* **[Hub](http://byron.github.io/google-apis-rs/google-admin1_directory/struct.Directory.html)**
|
||||
* a central object to maintain state and allow accessing all *Activities*
|
||||
* creates [*Method Builders*](http://byron.github.io/google-apis-rs/google-admin1_directory/trait.MethodsBuilder.html) which in turn
|
||||
allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google-admin1_directory/trait.CallBuilder.html)
|
||||
* **[Resources](http://byron.github.io/google-apis-rs/google-admin1_directory/trait.Resource.html)**
|
||||
* primary types that you can apply *Activities* to
|
||||
* a collection of properties and *Parts*
|
||||
@@ -64,6 +66,8 @@ The API is structured into the following primary items:
|
||||
* **[Activities](http://byron.github.io/google-apis-rs/google-admin1_directory/trait.CallBuilder.html)**
|
||||
* operations to apply to *Resources*
|
||||
|
||||
All *structures* are marked with applicable traits to further categorize them and ease browsing.
|
||||
|
||||
Generally speaking, you can invoke *Activities* like this:
|
||||
|
||||
```Rust,ignore
|
||||
@@ -115,7 +119,7 @@ extern crate hyper;
|
||||
extern crate "yup-oauth2" as oauth2;
|
||||
extern crate "google-admin1_directory" as admin1_directory;
|
||||
use admin1_directory::Channel;
|
||||
use admin1_directory::Result;
|
||||
use admin1_directory::{Result, Error};
|
||||
use std::default::Default;
|
||||
use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
||||
use admin1_directory::Directory;
|
||||
@@ -156,15 +160,17 @@ let result = hub.users().watch(&req)
|
||||
.doit();
|
||||
|
||||
match result {
|
||||
Result::HttpError(err) => println!("HTTPERROR: {:?}", err),
|
||||
Result::MissingAPIKey => println!("Auth: Missing API Key - used if there are no scopes"),
|
||||
Result::MissingToken => println!("OAuth2: Missing Token"),
|
||||
Result::Cancelled => println!("Operation cancelled by user"),
|
||||
Result::UploadSizeLimitExceeded(size, max_size) => println!("Upload size too big: {} of {}", size, max_size),
|
||||
Result::Failure(_) => println!("General Failure (hyper::client::Response doesn't print)"),
|
||||
Result::FieldClash(clashed_field) => println!("You added custom parameter which is part of builder: {:?}", clashed_field),
|
||||
Result::JsonDecodeError(err) => println!("Couldn't understand server reply - maybe API needs update: {:?}", err),
|
||||
Result::Success(_) => println!("Success (value doesn't print)"),
|
||||
Err(e) => match e {
|
||||
Error::HttpError(err) => println!("HTTPERROR: {:?}", err),
|
||||
Error::MissingAPIKey => println!("Auth: Missing API Key - used if there are no scopes"),
|
||||
Error::MissingToken => println!("OAuth2: Missing Token"),
|
||||
Error::Cancelled => println!("Operation canceled by user"),
|
||||
Error::UploadSizeLimitExceeded(size, max_size) => println!("Upload size too big: {} of {}", size, max_size),
|
||||
Error::Failure(_) => println!("General Failure (hyper::client::Response doesn't print)"),
|
||||
Error::FieldClash(clashed_field) => println!("You added custom parameter which is part of builder: {:?}", clashed_field),
|
||||
Error::JsonDecodeError(err) => println!("Couldn't understand server reply - maybe API needs update: {:?}", err),
|
||||
},
|
||||
Ok(_) => println!("Success (value doesn't print)"),
|
||||
}
|
||||
|
||||
```
|
||||
@@ -177,7 +183,7 @@ the doit() methods, or handed as possibly intermediate results to either the
|
||||
When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
|
||||
makes the system potentially resilient to all kinds of errors.
|
||||
|
||||
## Uploads and Downlods
|
||||
## Uploads and Downloads
|
||||
If a method supports downloads, the response body, which is part of the [Result](http://byron.github.io/google-apis-rs/google-admin1_directory/enum.Result.html), should be
|
||||
read by you to obtain the media.
|
||||
If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google-admin1_directory/trait.ResponseResult.html), it will return that by default.
|
||||
@@ -200,8 +206,9 @@ The [delegate trait](http://byron.github.io/google-apis-rs/google-admin1_directo
|
||||
## Optional Parts in Server-Requests
|
||||
|
||||
All structures provided by this library are made to be [enocodable](http://byron.github.io/google-apis-rs/google-admin1_directory/trait.RequestValue.html) and
|
||||
[decodable](http://byron.github.io/google-apis-rs/google-admin1_directory/trait.ResponseResult.html) via json. Optionals are used to indicate that partial requests are responses are valid.
|
||||
Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google-admin1_directory/trait.Part.html) which are identifyable by name, which will be sent to
|
||||
[decodable](http://byron.github.io/google-apis-rs/google-admin1_directory/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses
|
||||
are valid.
|
||||
Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google-admin1_directory/trait.Part.html) which are identifiable by name, which will be sent to
|
||||
the server to indicate either the set parts of the request or the desired parts in the response.
|
||||
|
||||
## Builder Arguments
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// COPY OF 'src/rust/cmn.rs'
|
||||
// COPY OF 'src/rust/api/cmn.rs'
|
||||
// DO NOT EDIT
|
||||
use std::marker::MarkerTrait;
|
||||
use std::io::{self, Read, Seek, Cursor, Write, SeekFrom};
|
||||
@@ -24,7 +24,7 @@ use serde;
|
||||
pub trait Hub: MarkerTrait {}
|
||||
|
||||
/// Identifies types for building methods of a particular resource type
|
||||
pub trait ResourceMethodsBuilder: MarkerTrait {}
|
||||
pub trait MethodsBuilder: MarkerTrait {}
|
||||
|
||||
/// Identifies types which represent builders for a particular resource method
|
||||
pub trait CallBuilder: MarkerTrait {}
|
||||
@@ -105,12 +105,15 @@ pub trait Delegate {
|
||||
/// information if he is interesting in knowing more context when further calls to it
|
||||
/// are made.
|
||||
/// The matching `finished()` call will always be made, no matter whether or not the API
|
||||
/// request was sucessfull. That way, the delgate may easily maintain a clean state
|
||||
/// request was successful. That way, the delegate may easily maintain a clean state
|
||||
/// between various API calls.
|
||||
fn begin(&mut self, MethodInfo) {}
|
||||
|
||||
/// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems.
|
||||
///
|
||||
/// If you choose to retry after a duration, the duration should be chosen using the
|
||||
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
|
||||
///
|
||||
/// Return retry information.
|
||||
fn http_error(&mut self, &hyper::HttpError) -> Retry {
|
||||
Retry::Abort
|
||||
@@ -133,7 +136,7 @@ pub trait Delegate {
|
||||
/// Called during resumable uploads to provide a URL for the impending upload.
|
||||
/// It was saved after a previous call to `store_upload_url(...)`, and if not None,
|
||||
/// will be used instead of asking the server for a new upload URL.
|
||||
/// This is useful in case a previous resumable upload was aborted/cancelled, but should now
|
||||
/// This is useful in case a previous resumable upload was aborted/canceled, but should now
|
||||
/// be resumed.
|
||||
/// The returned URL will be used exactly once - if it fails again and the delegate allows
|
||||
/// to retry, we will ask the server for a new upload URL.
|
||||
@@ -154,8 +157,8 @@ pub trait Delegate {
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// `json_encoded_value` - The json-encoded value which failed to decode.
|
||||
/// `json_decode_error` - The decoder error
|
||||
/// * `json_encoded_value` - The json-encoded value which failed to decode.
|
||||
/// * `json_decode_error` - The decoder error
|
||||
fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &serde::json::Error) {
|
||||
let _ = json_encoded_value;
|
||||
let _ = json_decode_error;
|
||||
@@ -166,6 +169,9 @@ pub trait Delegate {
|
||||
/// depends on the used API method.
|
||||
/// The delegate should check the status, header and decoded json error to decide
|
||||
/// whether to retry or not. In the latter case, the underlying call will fail.
|
||||
///
|
||||
/// If you choose to retry after a duration, the duration should be chosen using the
|
||||
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
|
||||
fn http_failure(&mut self, _: &hyper::client::Response, Option<JsonServerError>) -> Retry {
|
||||
Retry::Abort
|
||||
}
|
||||
@@ -197,8 +203,8 @@ pub trait Delegate {
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// `is_success` - a true value indicates the operation was successful. If false, you should
|
||||
/// discard all values stored during `store_upload_url`.
|
||||
/// * `is_success` - a true value indicates the operation was successful. If false, you should
|
||||
/// discard all values stored during `store_upload_url`.
|
||||
fn finished(&mut self, is_success: bool) {
|
||||
let _ = is_success;
|
||||
}
|
||||
@@ -212,8 +218,8 @@ pub struct DefaultDelegate;
|
||||
impl Delegate for DefaultDelegate {}
|
||||
|
||||
|
||||
/// A universal result type used as return for all action method results.
|
||||
pub enum Result<T = ()> {
|
||||
|
||||
pub enum Error {
|
||||
/// The http connection failed
|
||||
HttpError(hyper::HttpError),
|
||||
|
||||
@@ -240,11 +246,11 @@ pub enum Result<T = ()> {
|
||||
|
||||
/// Indicates an HTTP repsonse with a non-success status code
|
||||
Failure(hyper::client::Response),
|
||||
|
||||
/// It worked !
|
||||
Success(T),
|
||||
}
|
||||
|
||||
/// A universal result type used as return for all calls.
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// Contains information about an API request.
|
||||
pub struct MethodInfo {
|
||||
pub id: &'static str,
|
||||
@@ -499,7 +505,7 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
where NC: hyper::net::NetworkConnector,
|
||||
A: oauth2::GetToken {
|
||||
|
||||
fn query_transfer_status(&mut self) -> (Option<u64>, hyper::HttpResult<hyper::client::Response>) {
|
||||
fn query_transfer_status(&mut self) -> std::result::Result<u64, hyper::HttpResult<hyper::client::Response>> {
|
||||
loop {
|
||||
match self.client.post(self.url)
|
||||
.header(UserAgent(self.user_agent.to_string()))
|
||||
@@ -516,17 +522,17 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
return (None, Ok(r))
|
||||
return Err(Ok(r))
|
||||
}
|
||||
};
|
||||
return (Some(h.0.last), Ok(r))
|
||||
return Ok(h.0.last)
|
||||
}
|
||||
Err(err) => {
|
||||
if let Retry::After(d) = self.delegate.http_error(&err) {
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
return (None, Err(err))
|
||||
return Err(Err(err))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -539,8 +545,8 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
let mut start = match self.start_at {
|
||||
Some(s) => s,
|
||||
None => match self.query_transfer_status() {
|
||||
(Some(s), _) => s,
|
||||
(_, result) => return Some(result)
|
||||
Ok(s) => s,
|
||||
Err(result) => return Some(result)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
||||
[package]
|
||||
|
||||
name = "google-admin1_reports"
|
||||
version = "0.1.1+20150115"
|
||||
version = "0.1.2+20150115"
|
||||
authors = ["Sebastian Thiel <byronimo@gmail>"]
|
||||
description = "A complete library to interact with reports (protocol reports_v1)"
|
||||
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_reports"
|
||||
@@ -16,7 +16,7 @@ keywords = ["admin", "google", "protocol", "web", "api"]
|
||||
[dependencies]
|
||||
hyper = "*"
|
||||
mime = "*"
|
||||
yup-oauth2 = "*"
|
||||
url = "*"
|
||||
serde = "*"
|
||||
serde_macros = "*"
|
||||
yup-oauth2 = "*"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!---
|
||||
DO NOT EDIT !
|
||||
This file was generated automatically from 'src/mako/README.md.mako'
|
||||
This file was generated automatically from 'src/mako/api/README.md.mako'
|
||||
DO NOT EDIT !
|
||||
-->
|
||||
The `google-admin1_reports` library allows access to all features of the *Google reports* service.
|
||||
|
||||
This documentation was generated from *reports* crate version *0.1.1+20150115*, where *20150115* is the exact revision of the *admin:reports_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.1*.
|
||||
This documentation was generated from *reports* crate version *0.1.2+20150115*, where *20150115* is the exact revision of the *admin:reports_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.2*.
|
||||
|
||||
Everything else about the *reports* *v1_reports* API can be found at the
|
||||
[official documentation site](https://developers.google.com/admin-sdk/reports/).
|
||||
@@ -36,6 +36,8 @@ The API is structured into the following primary items:
|
||||
|
||||
* **[Hub](http://byron.github.io/google-apis-rs/google-admin1_reports/struct.Reports.html)**
|
||||
* a central object to maintain state and allow accessing all *Activities*
|
||||
* creates [*Method Builders*](http://byron.github.io/google-apis-rs/google-admin1_reports/trait.MethodsBuilder.html) which in turn
|
||||
allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google-admin1_reports/trait.CallBuilder.html)
|
||||
* **[Resources](http://byron.github.io/google-apis-rs/google-admin1_reports/trait.Resource.html)**
|
||||
* primary types that you can apply *Activities* to
|
||||
* a collection of properties and *Parts*
|
||||
@@ -45,6 +47,8 @@ The API is structured into the following primary items:
|
||||
* **[Activities](http://byron.github.io/google-apis-rs/google-admin1_reports/trait.CallBuilder.html)**
|
||||
* operations to apply to *Resources*
|
||||
|
||||
All *structures* are marked with applicable traits to further categorize them and ease browsing.
|
||||
|
||||
Generally speaking, you can invoke *Activities* like this:
|
||||
|
||||
```Rust,ignore
|
||||
@@ -81,7 +85,7 @@ extern crate hyper;
|
||||
extern crate "yup-oauth2" as oauth2;
|
||||
extern crate "google-admin1_reports" as admin1_reports;
|
||||
use admin1_reports::Channel;
|
||||
use admin1_reports::Result;
|
||||
use admin1_reports::{Result, Error};
|
||||
use std::default::Default;
|
||||
use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
||||
use admin1_reports::Reports;
|
||||
@@ -118,15 +122,17 @@ let result = hub.activities().watch(&req, "userKey", "applicationName")
|
||||
.doit();
|
||||
|
||||
match result {
|
||||
Result::HttpError(err) => println!("HTTPERROR: {:?}", err),
|
||||
Result::MissingAPIKey => println!("Auth: Missing API Key - used if there are no scopes"),
|
||||
Result::MissingToken => println!("OAuth2: Missing Token"),
|
||||
Result::Cancelled => println!("Operation cancelled by user"),
|
||||
Result::UploadSizeLimitExceeded(size, max_size) => println!("Upload size too big: {} of {}", size, max_size),
|
||||
Result::Failure(_) => println!("General Failure (hyper::client::Response doesn't print)"),
|
||||
Result::FieldClash(clashed_field) => println!("You added custom parameter which is part of builder: {:?}", clashed_field),
|
||||
Result::JsonDecodeError(err) => println!("Couldn't understand server reply - maybe API needs update: {:?}", err),
|
||||
Result::Success(_) => println!("Success (value doesn't print)"),
|
||||
Err(e) => match e {
|
||||
Error::HttpError(err) => println!("HTTPERROR: {:?}", err),
|
||||
Error::MissingAPIKey => println!("Auth: Missing API Key - used if there are no scopes"),
|
||||
Error::MissingToken => println!("OAuth2: Missing Token"),
|
||||
Error::Cancelled => println!("Operation canceled by user"),
|
||||
Error::UploadSizeLimitExceeded(size, max_size) => println!("Upload size too big: {} of {}", size, max_size),
|
||||
Error::Failure(_) => println!("General Failure (hyper::client::Response doesn't print)"),
|
||||
Error::FieldClash(clashed_field) => println!("You added custom parameter which is part of builder: {:?}", clashed_field),
|
||||
Error::JsonDecodeError(err) => println!("Couldn't understand server reply - maybe API needs update: {:?}", err),
|
||||
},
|
||||
Ok(_) => println!("Success (value doesn't print)"),
|
||||
}
|
||||
|
||||
```
|
||||
@@ -139,7 +145,7 @@ the doit() methods, or handed as possibly intermediate results to either the
|
||||
When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
|
||||
makes the system potentially resilient to all kinds of errors.
|
||||
|
||||
## Uploads and Downlods
|
||||
## Uploads and Downloads
|
||||
If a method supports downloads, the response body, which is part of the [Result](http://byron.github.io/google-apis-rs/google-admin1_reports/enum.Result.html), should be
|
||||
read by you to obtain the media.
|
||||
If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google-admin1_reports/trait.ResponseResult.html), it will return that by default.
|
||||
@@ -162,8 +168,9 @@ The [delegate trait](http://byron.github.io/google-apis-rs/google-admin1_reports
|
||||
## Optional Parts in Server-Requests
|
||||
|
||||
All structures provided by this library are made to be [enocodable](http://byron.github.io/google-apis-rs/google-admin1_reports/trait.RequestValue.html) and
|
||||
[decodable](http://byron.github.io/google-apis-rs/google-admin1_reports/trait.ResponseResult.html) via json. Optionals are used to indicate that partial requests are responses are valid.
|
||||
Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google-admin1_reports/trait.Part.html) which are identifyable by name, which will be sent to
|
||||
[decodable](http://byron.github.io/google-apis-rs/google-admin1_reports/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses
|
||||
are valid.
|
||||
Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google-admin1_reports/trait.Part.html) which are identifiable by name, which will be sent to
|
||||
the server to indicate either the set parts of the request or the desired parts in the response.
|
||||
|
||||
## Builder Arguments
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// COPY OF 'src/rust/cmn.rs'
|
||||
// COPY OF 'src/rust/api/cmn.rs'
|
||||
// DO NOT EDIT
|
||||
use std::marker::MarkerTrait;
|
||||
use std::io::{self, Read, Seek, Cursor, Write, SeekFrom};
|
||||
@@ -24,7 +24,7 @@ use serde;
|
||||
pub trait Hub: MarkerTrait {}
|
||||
|
||||
/// Identifies types for building methods of a particular resource type
|
||||
pub trait ResourceMethodsBuilder: MarkerTrait {}
|
||||
pub trait MethodsBuilder: MarkerTrait {}
|
||||
|
||||
/// Identifies types which represent builders for a particular resource method
|
||||
pub trait CallBuilder: MarkerTrait {}
|
||||
@@ -105,12 +105,15 @@ pub trait Delegate {
|
||||
/// information if he is interesting in knowing more context when further calls to it
|
||||
/// are made.
|
||||
/// The matching `finished()` call will always be made, no matter whether or not the API
|
||||
/// request was sucessfull. That way, the delgate may easily maintain a clean state
|
||||
/// request was successful. That way, the delegate may easily maintain a clean state
|
||||
/// between various API calls.
|
||||
fn begin(&mut self, MethodInfo) {}
|
||||
|
||||
/// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems.
|
||||
///
|
||||
/// If you choose to retry after a duration, the duration should be chosen using the
|
||||
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
|
||||
///
|
||||
/// Return retry information.
|
||||
fn http_error(&mut self, &hyper::HttpError) -> Retry {
|
||||
Retry::Abort
|
||||
@@ -133,7 +136,7 @@ pub trait Delegate {
|
||||
/// Called during resumable uploads to provide a URL for the impending upload.
|
||||
/// It was saved after a previous call to `store_upload_url(...)`, and if not None,
|
||||
/// will be used instead of asking the server for a new upload URL.
|
||||
/// This is useful in case a previous resumable upload was aborted/cancelled, but should now
|
||||
/// This is useful in case a previous resumable upload was aborted/canceled, but should now
|
||||
/// be resumed.
|
||||
/// The returned URL will be used exactly once - if it fails again and the delegate allows
|
||||
/// to retry, we will ask the server for a new upload URL.
|
||||
@@ -154,8 +157,8 @@ pub trait Delegate {
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// `json_encoded_value` - The json-encoded value which failed to decode.
|
||||
/// `json_decode_error` - The decoder error
|
||||
/// * `json_encoded_value` - The json-encoded value which failed to decode.
|
||||
/// * `json_decode_error` - The decoder error
|
||||
fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &serde::json::Error) {
|
||||
let _ = json_encoded_value;
|
||||
let _ = json_decode_error;
|
||||
@@ -166,6 +169,9 @@ pub trait Delegate {
|
||||
/// depends on the used API method.
|
||||
/// The delegate should check the status, header and decoded json error to decide
|
||||
/// whether to retry or not. In the latter case, the underlying call will fail.
|
||||
///
|
||||
/// If you choose to retry after a duration, the duration should be chosen using the
|
||||
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
|
||||
fn http_failure(&mut self, _: &hyper::client::Response, Option<JsonServerError>) -> Retry {
|
||||
Retry::Abort
|
||||
}
|
||||
@@ -197,8 +203,8 @@ pub trait Delegate {
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// `is_success` - a true value indicates the operation was successful. If false, you should
|
||||
/// discard all values stored during `store_upload_url`.
|
||||
/// * `is_success` - a true value indicates the operation was successful. If false, you should
|
||||
/// discard all values stored during `store_upload_url`.
|
||||
fn finished(&mut self, is_success: bool) {
|
||||
let _ = is_success;
|
||||
}
|
||||
@@ -212,8 +218,8 @@ pub struct DefaultDelegate;
|
||||
impl Delegate for DefaultDelegate {}
|
||||
|
||||
|
||||
/// A universal result type used as return for all action method results.
|
||||
pub enum Result<T = ()> {
|
||||
|
||||
pub enum Error {
|
||||
/// The http connection failed
|
||||
HttpError(hyper::HttpError),
|
||||
|
||||
@@ -240,11 +246,11 @@ pub enum Result<T = ()> {
|
||||
|
||||
/// Indicates an HTTP repsonse with a non-success status code
|
||||
Failure(hyper::client::Response),
|
||||
|
||||
/// It worked !
|
||||
Success(T),
|
||||
}
|
||||
|
||||
/// A universal result type used as return for all calls.
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// Contains information about an API request.
|
||||
pub struct MethodInfo {
|
||||
pub id: &'static str,
|
||||
@@ -499,7 +505,7 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
where NC: hyper::net::NetworkConnector,
|
||||
A: oauth2::GetToken {
|
||||
|
||||
fn query_transfer_status(&mut self) -> (Option<u64>, hyper::HttpResult<hyper::client::Response>) {
|
||||
fn query_transfer_status(&mut self) -> std::result::Result<u64, hyper::HttpResult<hyper::client::Response>> {
|
||||
loop {
|
||||
match self.client.post(self.url)
|
||||
.header(UserAgent(self.user_agent.to_string()))
|
||||
@@ -516,17 +522,17 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
return (None, Ok(r))
|
||||
return Err(Ok(r))
|
||||
}
|
||||
};
|
||||
return (Some(h.0.last), Ok(r))
|
||||
return Ok(h.0.last)
|
||||
}
|
||||
Err(err) => {
|
||||
if let Retry::After(d) = self.delegate.http_error(&err) {
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
return (None, Err(err))
|
||||
return Err(Err(err))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -539,8 +545,8 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
let mut start = match self.start_at {
|
||||
Some(s) => s,
|
||||
None => match self.query_transfer_status() {
|
||||
(Some(s), _) => s,
|
||||
(_, result) => return Some(result)
|
||||
Ok(s) => s,
|
||||
Err(result) => return Some(result)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
||||
[package]
|
||||
|
||||
name = "google-admin2_email_migration"
|
||||
version = "0.1.1+20150303"
|
||||
version = "0.1.2+20150303"
|
||||
authors = ["Sebastian Thiel <byronimo@gmail>"]
|
||||
description = "A complete library to interact with admin (protocol email_migration_v2)"
|
||||
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin2_email_migration"
|
||||
@@ -16,7 +16,7 @@ keywords = ["admin", "google", "protocol", "web", "api"]
|
||||
[dependencies]
|
||||
hyper = "*"
|
||||
mime = "*"
|
||||
yup-oauth2 = "*"
|
||||
url = "*"
|
||||
serde = "*"
|
||||
serde_macros = "*"
|
||||
yup-oauth2 = "*"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!---
|
||||
DO NOT EDIT !
|
||||
This file was generated automatically from 'src/mako/README.md.mako'
|
||||
This file was generated automatically from 'src/mako/api/README.md.mako'
|
||||
DO NOT EDIT !
|
||||
-->
|
||||
The `google-admin2_email_migration` library allows access to all features of the *Google admin* service.
|
||||
|
||||
This documentation was generated from *admin* crate version *0.1.1+20150303*, where *20150303* is the exact revision of the *admin:email_migration_v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.1*.
|
||||
This documentation was generated from *admin* crate version *0.1.2+20150303*, where *20150303* is the exact revision of the *admin:email_migration_v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.2*.
|
||||
|
||||
Everything else about the *admin* *v2_email_migration* API can be found at the
|
||||
[official documentation site](https://developers.google.com/admin-sdk/email-migration/v2/).
|
||||
@@ -29,6 +29,8 @@ The API is structured into the following primary items:
|
||||
|
||||
* **[Hub](http://byron.github.io/google-apis-rs/google-admin2_email_migration/struct.Admin.html)**
|
||||
* a central object to maintain state and allow accessing all *Activities*
|
||||
* creates [*Method Builders*](http://byron.github.io/google-apis-rs/google-admin2_email_migration/trait.MethodsBuilder.html) which in turn
|
||||
allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google-admin2_email_migration/trait.CallBuilder.html)
|
||||
* **[Resources](http://byron.github.io/google-apis-rs/google-admin2_email_migration/trait.Resource.html)**
|
||||
* primary types that you can apply *Activities* to
|
||||
* a collection of properties and *Parts*
|
||||
@@ -38,6 +40,8 @@ The API is structured into the following primary items:
|
||||
* **[Activities](http://byron.github.io/google-apis-rs/google-admin2_email_migration/trait.CallBuilder.html)**
|
||||
* operations to apply to *Resources*
|
||||
|
||||
All *structures* are marked with applicable traits to further categorize them and ease browsing.
|
||||
|
||||
Generally speaking, you can invoke *Activities* like this:
|
||||
|
||||
```Rust,ignore
|
||||
@@ -73,7 +77,7 @@ extern crate hyper;
|
||||
extern crate "yup-oauth2" as oauth2;
|
||||
extern crate "google-admin2_email_migration" as admin2_email_migration;
|
||||
use admin2_email_migration::MailItem;
|
||||
use admin2_email_migration::Result;
|
||||
use admin2_email_migration::{Result, Error};
|
||||
use std::fs;
|
||||
use std::default::Default;
|
||||
use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
||||
@@ -103,15 +107,17 @@ let result = hub.mail().insert(&req, "userKey")
|
||||
.upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap());
|
||||
|
||||
match result {
|
||||
Result::HttpError(err) => println!("HTTPERROR: {:?}", err),
|
||||
Result::MissingAPIKey => println!("Auth: Missing API Key - used if there are no scopes"),
|
||||
Result::MissingToken => println!("OAuth2: Missing Token"),
|
||||
Result::Cancelled => println!("Operation cancelled by user"),
|
||||
Result::UploadSizeLimitExceeded(size, max_size) => println!("Upload size too big: {} of {}", size, max_size),
|
||||
Result::Failure(_) => println!("General Failure (hyper::client::Response doesn't print)"),
|
||||
Result::FieldClash(clashed_field) => println!("You added custom parameter which is part of builder: {:?}", clashed_field),
|
||||
Result::JsonDecodeError(err) => println!("Couldn't understand server reply - maybe API needs update: {:?}", err),
|
||||
Result::Success(_) => println!("Success (value doesn't print)"),
|
||||
Err(e) => match e {
|
||||
Error::HttpError(err) => println!("HTTPERROR: {:?}", err),
|
||||
Error::MissingAPIKey => println!("Auth: Missing API Key - used if there are no scopes"),
|
||||
Error::MissingToken => println!("OAuth2: Missing Token"),
|
||||
Error::Cancelled => println!("Operation canceled by user"),
|
||||
Error::UploadSizeLimitExceeded(size, max_size) => println!("Upload size too big: {} of {}", size, max_size),
|
||||
Error::Failure(_) => println!("General Failure (hyper::client::Response doesn't print)"),
|
||||
Error::FieldClash(clashed_field) => println!("You added custom parameter which is part of builder: {:?}", clashed_field),
|
||||
Error::JsonDecodeError(err) => println!("Couldn't understand server reply - maybe API needs update: {:?}", err),
|
||||
},
|
||||
Ok(_) => println!("Success (value doesn't print)"),
|
||||
}
|
||||
|
||||
```
|
||||
@@ -124,7 +130,7 @@ the doit() methods, or handed as possibly intermediate results to either the
|
||||
When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
|
||||
makes the system potentially resilient to all kinds of errors.
|
||||
|
||||
## Uploads and Downlods
|
||||
## Uploads and Downloads
|
||||
If a method supports downloads, the response body, which is part of the [Result](http://byron.github.io/google-apis-rs/google-admin2_email_migration/enum.Result.html), should be
|
||||
read by you to obtain the media.
|
||||
If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google-admin2_email_migration/trait.ResponseResult.html), it will return that by default.
|
||||
@@ -147,8 +153,9 @@ The [delegate trait](http://byron.github.io/google-apis-rs/google-admin2_email_m
|
||||
## Optional Parts in Server-Requests
|
||||
|
||||
All structures provided by this library are made to be [enocodable](http://byron.github.io/google-apis-rs/google-admin2_email_migration/trait.RequestValue.html) and
|
||||
[decodable](http://byron.github.io/google-apis-rs/google-admin2_email_migration/trait.ResponseResult.html) via json. Optionals are used to indicate that partial requests are responses are valid.
|
||||
Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google-admin2_email_migration/trait.Part.html) which are identifyable by name, which will be sent to
|
||||
[decodable](http://byron.github.io/google-apis-rs/google-admin2_email_migration/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses
|
||||
are valid.
|
||||
Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google-admin2_email_migration/trait.Part.html) which are identifiable by name, which will be sent to
|
||||
the server to indicate either the set parts of the request or the desired parts in the response.
|
||||
|
||||
## Builder Arguments
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// COPY OF 'src/rust/cmn.rs'
|
||||
// COPY OF 'src/rust/api/cmn.rs'
|
||||
// DO NOT EDIT
|
||||
use std::marker::MarkerTrait;
|
||||
use std::io::{self, Read, Seek, Cursor, Write, SeekFrom};
|
||||
@@ -24,7 +24,7 @@ use serde;
|
||||
pub trait Hub: MarkerTrait {}
|
||||
|
||||
/// Identifies types for building methods of a particular resource type
|
||||
pub trait ResourceMethodsBuilder: MarkerTrait {}
|
||||
pub trait MethodsBuilder: MarkerTrait {}
|
||||
|
||||
/// Identifies types which represent builders for a particular resource method
|
||||
pub trait CallBuilder: MarkerTrait {}
|
||||
@@ -105,12 +105,15 @@ pub trait Delegate {
|
||||
/// information if he is interesting in knowing more context when further calls to it
|
||||
/// are made.
|
||||
/// The matching `finished()` call will always be made, no matter whether or not the API
|
||||
/// request was sucessfull. That way, the delgate may easily maintain a clean state
|
||||
/// request was successful. That way, the delegate may easily maintain a clean state
|
||||
/// between various API calls.
|
||||
fn begin(&mut self, MethodInfo) {}
|
||||
|
||||
/// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems.
|
||||
///
|
||||
/// If you choose to retry after a duration, the duration should be chosen using the
|
||||
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
|
||||
///
|
||||
/// Return retry information.
|
||||
fn http_error(&mut self, &hyper::HttpError) -> Retry {
|
||||
Retry::Abort
|
||||
@@ -133,7 +136,7 @@ pub trait Delegate {
|
||||
/// Called during resumable uploads to provide a URL for the impending upload.
|
||||
/// It was saved after a previous call to `store_upload_url(...)`, and if not None,
|
||||
/// will be used instead of asking the server for a new upload URL.
|
||||
/// This is useful in case a previous resumable upload was aborted/cancelled, but should now
|
||||
/// This is useful in case a previous resumable upload was aborted/canceled, but should now
|
||||
/// be resumed.
|
||||
/// The returned URL will be used exactly once - if it fails again and the delegate allows
|
||||
/// to retry, we will ask the server for a new upload URL.
|
||||
@@ -154,8 +157,8 @@ pub trait Delegate {
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// `json_encoded_value` - The json-encoded value which failed to decode.
|
||||
/// `json_decode_error` - The decoder error
|
||||
/// * `json_encoded_value` - The json-encoded value which failed to decode.
|
||||
/// * `json_decode_error` - The decoder error
|
||||
fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &serde::json::Error) {
|
||||
let _ = json_encoded_value;
|
||||
let _ = json_decode_error;
|
||||
@@ -166,6 +169,9 @@ pub trait Delegate {
|
||||
/// depends on the used API method.
|
||||
/// The delegate should check the status, header and decoded json error to decide
|
||||
/// whether to retry or not. In the latter case, the underlying call will fail.
|
||||
///
|
||||
/// If you choose to retry after a duration, the duration should be chosen using the
|
||||
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
|
||||
fn http_failure(&mut self, _: &hyper::client::Response, Option<JsonServerError>) -> Retry {
|
||||
Retry::Abort
|
||||
}
|
||||
@@ -197,8 +203,8 @@ pub trait Delegate {
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// `is_success` - a true value indicates the operation was successful. If false, you should
|
||||
/// discard all values stored during `store_upload_url`.
|
||||
/// * `is_success` - a true value indicates the operation was successful. If false, you should
|
||||
/// discard all values stored during `store_upload_url`.
|
||||
fn finished(&mut self, is_success: bool) {
|
||||
let _ = is_success;
|
||||
}
|
||||
@@ -212,8 +218,8 @@ pub struct DefaultDelegate;
|
||||
impl Delegate for DefaultDelegate {}
|
||||
|
||||
|
||||
/// A universal result type used as return for all action method results.
|
||||
pub enum Result<T = ()> {
|
||||
|
||||
pub enum Error {
|
||||
/// The http connection failed
|
||||
HttpError(hyper::HttpError),
|
||||
|
||||
@@ -240,11 +246,11 @@ pub enum Result<T = ()> {
|
||||
|
||||
/// Indicates an HTTP repsonse with a non-success status code
|
||||
Failure(hyper::client::Response),
|
||||
|
||||
/// It worked !
|
||||
Success(T),
|
||||
}
|
||||
|
||||
/// A universal result type used as return for all calls.
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// Contains information about an API request.
|
||||
pub struct MethodInfo {
|
||||
pub id: &'static str,
|
||||
@@ -499,7 +505,7 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
where NC: hyper::net::NetworkConnector,
|
||||
A: oauth2::GetToken {
|
||||
|
||||
fn query_transfer_status(&mut self) -> (Option<u64>, hyper::HttpResult<hyper::client::Response>) {
|
||||
fn query_transfer_status(&mut self) -> std::result::Result<u64, hyper::HttpResult<hyper::client::Response>> {
|
||||
loop {
|
||||
match self.client.post(self.url)
|
||||
.header(UserAgent(self.user_agent.to_string()))
|
||||
@@ -516,17 +522,17 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
return (None, Ok(r))
|
||||
return Err(Ok(r))
|
||||
}
|
||||
};
|
||||
return (Some(h.0.last), Ok(r))
|
||||
return Ok(h.0.last)
|
||||
}
|
||||
Err(err) => {
|
||||
if let Retry::After(d) = self.delegate.http_error(&err) {
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
return (None, Err(err))
|
||||
return Err(Err(err))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -539,8 +545,8 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
let mut start = match self.start_at {
|
||||
Some(s) => s,
|
||||
None => match self.query_transfer_status() {
|
||||
(Some(s), _) => s,
|
||||
(_, result) => return Some(result)
|
||||
Ok(s) => s,
|
||||
Err(result) => return Some(result)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// DO NOT EDIT !
|
||||
// This file was generated automatically from 'src/mako/lib.rs.mako'
|
||||
// This file was generated automatically from 'src/mako/api/lib.rs.mako'
|
||||
// DO NOT EDIT !
|
||||
|
||||
//! This documentation was generated from *admin* crate version *0.1.1+20150303*, where *20150303* is the exact revision of the *admin:email_migration_v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.1*.
|
||||
//! This documentation was generated from *admin* crate version *0.1.2+20150303*, where *20150303* is the exact revision of the *admin:email_migration_v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.2*.
|
||||
//!
|
||||
//! Everything else about the *admin* *v2_email_migration* API can be found at the
|
||||
//! [official documentation site](https://developers.google.com/admin-sdk/email-migration/v2/).
|
||||
@@ -29,6 +29,8 @@
|
||||
//!
|
||||
//! * **[Hub](struct.Admin.html)**
|
||||
//! * a central object to maintain state and allow accessing all *Activities*
|
||||
//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn
|
||||
//! allow access to individual [*Call Builders*](trait.CallBuilder.html)
|
||||
//! * **[Resources](trait.Resource.html)**
|
||||
//! * primary types that you can apply *Activities* to
|
||||
//! * a collection of properties and *Parts*
|
||||
@@ -38,6 +40,8 @@
|
||||
//! * **[Activities](trait.CallBuilder.html)**
|
||||
//! * operations to apply to *Resources*
|
||||
//!
|
||||
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
|
||||
//!
|
||||
//! Generally speaking, you can invoke *Activities* like this:
|
||||
//!
|
||||
//! ```Rust,ignore
|
||||
@@ -73,7 +77,7 @@
|
||||
//! extern crate "yup-oauth2" as oauth2;
|
||||
//! extern crate "google-admin2_email_migration" as admin2_email_migration;
|
||||
//! use admin2_email_migration::MailItem;
|
||||
//! use admin2_email_migration::Result;
|
||||
//! use admin2_email_migration::{Result, Error};
|
||||
//! use std::fs;
|
||||
//! # #[test] fn egal() {
|
||||
//! use std::default::Default;
|
||||
@@ -104,15 +108,17 @@
|
||||
//! .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap());
|
||||
//!
|
||||
//! match result {
|
||||
//! Result::HttpError(err) => println!("HTTPERROR: {:?}", err),
|
||||
//! Result::MissingAPIKey => println!("Auth: Missing API Key - used if there are no scopes"),
|
||||
//! Result::MissingToken => println!("OAuth2: Missing Token"),
|
||||
//! Result::Cancelled => println!("Operation cancelled by user"),
|
||||
//! Result::UploadSizeLimitExceeded(size, max_size) => println!("Upload size too big: {} of {}", size, max_size),
|
||||
//! Result::Failure(_) => println!("General Failure (hyper::client::Response doesn't print)"),
|
||||
//! Result::FieldClash(clashed_field) => println!("You added custom parameter which is part of builder: {:?}", clashed_field),
|
||||
//! Result::JsonDecodeError(err) => println!("Couldn't understand server reply - maybe API needs update: {:?}", err),
|
||||
//! Result::Success(_) => println!("Success (value doesn't print)"),
|
||||
//! Err(e) => match e {
|
||||
//! Error::HttpError(err) => println!("HTTPERROR: {:?}", err),
|
||||
//! Error::MissingAPIKey => println!("Auth: Missing API Key - used if there are no scopes"),
|
||||
//! Error::MissingToken => println!("OAuth2: Missing Token"),
|
||||
//! Error::Cancelled => println!("Operation canceled by user"),
|
||||
//! Error::UploadSizeLimitExceeded(size, max_size) => println!("Upload size too big: {} of {}", size, max_size),
|
||||
//! Error::Failure(_) => println!("General Failure (hyper::client::Response doesn't print)"),
|
||||
//! Error::FieldClash(clashed_field) => println!("You added custom parameter which is part of builder: {:?}", clashed_field),
|
||||
//! Error::JsonDecodeError(err) => println!("Couldn't understand server reply - maybe API needs update: {:?}", err),
|
||||
//! },
|
||||
//! Ok(_) => println!("Success (value doesn't print)"),
|
||||
//! }
|
||||
//! # }
|
||||
//! ```
|
||||
@@ -125,7 +131,7 @@
|
||||
//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
|
||||
//! makes the system potentially resilient to all kinds of errors.
|
||||
//!
|
||||
//! ## Uploads and Downlods
|
||||
//! ## Uploads and Downloads
|
||||
//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be
|
||||
//! read by you to obtain the media.
|
||||
//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default.
|
||||
@@ -148,8 +154,9 @@
|
||||
//! ## Optional Parts in Server-Requests
|
||||
//!
|
||||
//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and
|
||||
//! [decodable](trait.ResponseResult.html) via json. Optionals are used to indicate that partial requests are responses are valid.
|
||||
//! Most optionals are are considered [Parts](trait.Part.html) which are identifyable by name, which will be sent to
|
||||
//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses
|
||||
//! are valid.
|
||||
//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to
|
||||
//! the server to indicate either the set parts of the request or the desired parts in the response.
|
||||
//!
|
||||
//! ## Builder Arguments
|
||||
@@ -198,7 +205,7 @@ use std::io;
|
||||
use std::fs;
|
||||
use std::thread::sleep;
|
||||
|
||||
pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, CallBuilder, Hub, ReadSeek, Part, ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, ResourceMethodsBuilder, Resource, JsonServerError};
|
||||
pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, JsonServerError};
|
||||
|
||||
|
||||
// ##############
|
||||
@@ -245,7 +252,7 @@ impl Default for Scope {
|
||||
/// extern crate "yup-oauth2" as oauth2;
|
||||
/// extern crate "google-admin2_email_migration" as admin2_email_migration;
|
||||
/// use admin2_email_migration::MailItem;
|
||||
/// use admin2_email_migration::Result;
|
||||
/// use admin2_email_migration::{Result, Error};
|
||||
/// use std::fs;
|
||||
/// # #[test] fn egal() {
|
||||
/// use std::default::Default;
|
||||
@@ -276,15 +283,17 @@ impl Default for Scope {
|
||||
/// .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap());
|
||||
///
|
||||
/// match result {
|
||||
/// Result::HttpError(err) => println!("HTTPERROR: {:?}", err),
|
||||
/// Result::MissingAPIKey => println!("Auth: Missing API Key - used if there are no scopes"),
|
||||
/// Result::MissingToken => println!("OAuth2: Missing Token"),
|
||||
/// Result::Cancelled => println!("Operation cancelled by user"),
|
||||
/// Result::UploadSizeLimitExceeded(size, max_size) => println!("Upload size too big: {} of {}", size, max_size),
|
||||
/// Result::Failure(_) => println!("General Failure (hyper::client::Response doesn't print)"),
|
||||
/// Result::FieldClash(clashed_field) => println!("You added custom parameter which is part of builder: {:?}", clashed_field),
|
||||
/// Result::JsonDecodeError(err) => println!("Couldn't understand server reply - maybe API needs update: {:?}", err),
|
||||
/// Result::Success(_) => println!("Success (value doesn't print)"),
|
||||
/// Err(e) => match e {
|
||||
/// Error::HttpError(err) => println!("HTTPERROR: {:?}", err),
|
||||
/// Error::MissingAPIKey => println!("Auth: Missing API Key - used if there are no scopes"),
|
||||
/// Error::MissingToken => println!("OAuth2: Missing Token"),
|
||||
/// Error::Cancelled => println!("Operation canceled by user"),
|
||||
/// Error::UploadSizeLimitExceeded(size, max_size) => println!("Upload size too big: {} of {}", size, max_size),
|
||||
/// Error::Failure(_) => println!("General Failure (hyper::client::Response doesn't print)"),
|
||||
/// Error::FieldClash(clashed_field) => println!("You added custom parameter which is part of builder: {:?}", clashed_field),
|
||||
/// Error::JsonDecodeError(err) => println!("Couldn't understand server reply - maybe API needs update: {:?}", err),
|
||||
/// },
|
||||
/// Ok(_) => println!("Success (value doesn't print)"),
|
||||
/// }
|
||||
/// # }
|
||||
/// ```
|
||||
@@ -305,7 +314,7 @@ impl<'a, C, NC, A> Admin<C, NC, A>
|
||||
Admin {
|
||||
client: RefCell::new(client),
|
||||
auth: RefCell::new(authenticator),
|
||||
_user_agent: "google-api-rust-client/0.1.1".to_string(),
|
||||
_user_agent: "google-api-rust-client/0.1.2".to_string(),
|
||||
_m: PhantomData
|
||||
}
|
||||
}
|
||||
@@ -315,7 +324,7 @@ impl<'a, C, NC, A> Admin<C, NC, A>
|
||||
}
|
||||
|
||||
/// Set the user-agent header field to use in all requests to the server.
|
||||
/// It defaults to `google-api-rust-client/0.1.1`.
|
||||
/// It defaults to `google-api-rust-client/0.1.2`.
|
||||
///
|
||||
/// Returns the previously set user-agent.
|
||||
pub fn user_agent(&mut self, agent_name: String) -> String {
|
||||
@@ -340,29 +349,29 @@ impl<'a, C, NC, A> Admin<C, NC, A>
|
||||
///
|
||||
#[derive(Default, Clone, Debug, Serialize)]
|
||||
pub struct MailItem {
|
||||
/// Boolean indicating if the mail is in trash
|
||||
/// Boolean indicating if the mail is in trash
|
||||
#[serde(alias="isTrash")]
|
||||
pub is_trash: Option<bool>,
|
||||
/// Kind of resource this is.
|
||||
/// Kind of resource this is.
|
||||
pub kind: Option<String>,
|
||||
/// List of labels (strings)
|
||||
/// List of labels (strings)
|
||||
pub labels: Option<Vec<String>>,
|
||||
/// Boolean indicating if the mail is draft
|
||||
/// Boolean indicating if the mail is draft
|
||||
#[serde(alias="isDraft")]
|
||||
pub is_draft: Option<bool>,
|
||||
/// Boolean indicating if the mail is in inbox
|
||||
/// Boolean indicating if the mail is in inbox
|
||||
#[serde(alias="isInbox")]
|
||||
pub is_inbox: Option<bool>,
|
||||
/// Boolean indicating if the mail is in 'sent mails'
|
||||
/// Boolean indicating if the mail is in 'sent mails'
|
||||
#[serde(alias="isSent")]
|
||||
pub is_sent: Option<bool>,
|
||||
/// Boolean indicating if the mail is starred
|
||||
/// Boolean indicating if the mail is starred
|
||||
#[serde(alias="isStarred")]
|
||||
pub is_starred: Option<bool>,
|
||||
/// Boolean indicating if the mail is unread
|
||||
/// Boolean indicating if the mail is unread
|
||||
#[serde(alias="isUnread")]
|
||||
pub is_unread: Option<bool>,
|
||||
/// Boolean indicating if the mail is deleted (used in Vault)
|
||||
/// Boolean indicating if the mail is deleted (used in Vault)
|
||||
#[serde(alias="isDeleted")]
|
||||
pub is_deleted: Option<bool>,
|
||||
}
|
||||
@@ -409,13 +418,18 @@ pub struct MailMethods<'a, C, NC, A>
|
||||
hub: &'a Admin<C, NC, A>,
|
||||
}
|
||||
|
||||
impl<'a, C, NC, A> ResourceMethodsBuilder for MailMethods<'a, C, NC, A> {}
|
||||
impl<'a, C, NC, A> MethodsBuilder for MailMethods<'a, C, NC, A> {}
|
||||
|
||||
impl<'a, C, NC, A> MailMethods<'a, C, NC, A> {
|
||||
|
||||
/// Create a builder to help you perform the following task:
|
||||
///
|
||||
/// Insert Mail into Google's Gmail backends
|
||||
/// Insert Mail into Google's Gmail backends
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `request` - No description provided.
|
||||
/// * `userKey` - The email or immutable id of the user
|
||||
pub fn insert(&self, request: &MailItem, user_key: &str) -> MailInsertCall<'a, C, NC, A> {
|
||||
MailInsertCall {
|
||||
hub: self.hub,
|
||||
@@ -439,7 +453,7 @@ impl<'a, C, NC, A> MailMethods<'a, C, NC, A> {
|
||||
/// Insert Mail into Google's Gmail backends
|
||||
///
|
||||
/// A builder for the *insert* method supported by a *mail* resource.
|
||||
/// It is not used directly, but through a `MailMethods`.
|
||||
/// It is not used directly, but through a `MailMethods` instance.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
@@ -506,7 +520,7 @@ impl<'a, C, NC, A> MailInsertCall<'a, C, NC, A> where NC: hyper::net::NetworkCon
|
||||
for &field in ["userKey"].iter() {
|
||||
if self._additional_params.contains_key(field) {
|
||||
dlg.finished(false);
|
||||
return Result::FieldClash(field);
|
||||
return Err(Error::FieldClash(field));
|
||||
}
|
||||
}
|
||||
for (name, value) in self._additional_params.iter() {
|
||||
@@ -572,7 +586,7 @@ impl<'a, C, NC, A> MailInsertCall<'a, C, NC, A> where NC: hyper::net::NetworkCon
|
||||
}
|
||||
if token.is_none() {
|
||||
dlg.finished(false);
|
||||
return Result::MissingToken
|
||||
return Err(Error::MissingToken)
|
||||
}
|
||||
let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer,
|
||||
access_token: token.unwrap().access_token });
|
||||
@@ -598,7 +612,7 @@ impl<'a, C, NC, A> MailInsertCall<'a, C, NC, A> where NC: hyper::net::NetworkCon
|
||||
let size = reader.seek(io::SeekFrom::End(0)).unwrap();
|
||||
reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||
if size > 36700160 {
|
||||
return Result::UploadSizeLimitExceeded(size, 36700160)
|
||||
return Err(Error::UploadSizeLimitExceeded(size, 36700160))
|
||||
}
|
||||
mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone())
|
||||
.add_part(&mut reader, size, reader_mime_type.clone());
|
||||
@@ -620,7 +634,6 @@ impl<'a, C, NC, A> MailInsertCall<'a, C, NC, A> where NC: hyper::net::NetworkCon
|
||||
|
||||
dlg.pre_request();
|
||||
req.send()
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -631,7 +644,7 @@ impl<'a, C, NC, A> MailInsertCall<'a, C, NC, A> where NC: hyper::net::NetworkCon
|
||||
continue;
|
||||
}
|
||||
dlg.finished(false);
|
||||
return Result::HttpError(err)
|
||||
return Err(Error::HttpError(err))
|
||||
}
|
||||
Ok(mut res) => {
|
||||
if !res.status.is_success() {
|
||||
@@ -642,13 +655,13 @@ impl<'a, C, NC, A> MailInsertCall<'a, C, NC, A> where NC: hyper::net::NetworkCon
|
||||
continue;
|
||||
}
|
||||
dlg.finished(false);
|
||||
return Result::Failure(res)
|
||||
return Err(Error::Failure(res))
|
||||
}
|
||||
if protocol == "resumable" {
|
||||
let size = reader.seek(io::SeekFrom::End(0)).unwrap();
|
||||
reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||
if size > 36700160 {
|
||||
return Result::UploadSizeLimitExceeded(size, 36700160)
|
||||
return Err(Error::UploadSizeLimitExceeded(size, 36700160))
|
||||
}
|
||||
let mut client = &mut *self.hub.client.borrow_mut();
|
||||
let upload_result = {
|
||||
@@ -673,17 +686,17 @@ impl<'a, C, NC, A> MailInsertCall<'a, C, NC, A> where NC: hyper::net::NetworkCon
|
||||
match upload_result {
|
||||
None => {
|
||||
dlg.finished(false);
|
||||
return Result::Cancelled
|
||||
return Err(Error::Cancelled)
|
||||
}
|
||||
Some(Err(err)) => {
|
||||
dlg.finished(false);
|
||||
return Result::HttpError(err)
|
||||
return Err(Error::HttpError(err))
|
||||
}
|
||||
Some(Ok(upload_result)) => {
|
||||
res = upload_result;
|
||||
if !res.status.is_success() {
|
||||
dlg.finished(false);
|
||||
return Result::Failure(res)
|
||||
return Err(Error::Failure(res))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -691,7 +704,7 @@ impl<'a, C, NC, A> MailInsertCall<'a, C, NC, A> where NC: hyper::net::NetworkCon
|
||||
let result_value = res;
|
||||
|
||||
dlg.finished(true);
|
||||
return Result::Success(result_value)
|
||||
return Ok(result_value)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -707,11 +720,14 @@ impl<'a, C, NC, A> MailInsertCall<'a, C, NC, A> where NC: hyper::net::NetworkCon
|
||||
where RS: ReadSeek {
|
||||
self.doit(stream, mime_type, "simple")
|
||||
}
|
||||
/// Upload media in a resumeable fashion.
|
||||
/// Upload media in a resumable fashion.
|
||||
/// Even if the upload fails or is interrupted, it can be resumed for a
|
||||
/// certain amount of time as the server maintains state temporarily.
|
||||
///
|
||||
/// TODO: Write more about how delegation works in this particular case.
|
||||
/// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL
|
||||
/// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate
|
||||
/// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using
|
||||
/// `cancel_chunk_upload(...)`.
|
||||
///
|
||||
/// * *max size*: 35MB
|
||||
/// * *multipart*: yes
|
||||
@@ -735,7 +751,7 @@ impl<'a, C, NC, A> MailInsertCall<'a, C, NC, A> where NC: hyper::net::NetworkCon
|
||||
/// Even though the property as already been set when instantiating this call,
|
||||
/// we provide this method for API completeness.
|
||||
///
|
||||
/// The email or immutable id of the user
|
||||
/// The email or immutable id of the user
|
||||
pub fn user_key(mut self, new_value: &str) -> MailInsertCall<'a, C, NC, A> {
|
||||
self._user_key = new_value.to_string();
|
||||
self
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
[package]
|
||||
|
||||
name = "google-adsense1d4"
|
||||
version = "0.1.1+20150312"
|
||||
version = "0.1.2+20150303"
|
||||
authors = ["Sebastian Thiel <byronimo@gmail>"]
|
||||
description = "A complete library to interact with AdSense (protocol v1.4)"
|
||||
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adsense1d4"
|
||||
@@ -16,7 +16,7 @@ keywords = ["adsense", "google", "protocol", "web", "api"]
|
||||
[dependencies]
|
||||
hyper = "*"
|
||||
mime = "*"
|
||||
yup-oauth2 = "*"
|
||||
url = "*"
|
||||
serde = "*"
|
||||
serde_macros = "*"
|
||||
yup-oauth2 = "*"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!---
|
||||
DO NOT EDIT !
|
||||
This file was generated automatically from 'src/mako/README.md.mako'
|
||||
This file was generated automatically from 'src/mako/api/README.md.mako'
|
||||
DO NOT EDIT !
|
||||
-->
|
||||
The `google-adsense1d4` library allows access to all features of the *Google AdSense* service.
|
||||
|
||||
This documentation was generated from *AdSense* crate version *0.1.1+20150312*, where *20150312* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.1*.
|
||||
This documentation was generated from *AdSense* crate version *0.1.2+20150303*, where *20150303* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.2*.
|
||||
|
||||
Everything else about the *AdSense* *v1d4* API can be found at the
|
||||
[official documentation site](https://developers.google.com/adsense/management/).
|
||||
@@ -48,6 +48,8 @@ The API is structured into the following primary items:
|
||||
|
||||
* **[Hub](http://byron.github.io/google-apis-rs/google-adsense1d4/struct.AdSense.html)**
|
||||
* a central object to maintain state and allow accessing all *Activities*
|
||||
* creates [*Method Builders*](http://byron.github.io/google-apis-rs/google-adsense1d4/trait.MethodsBuilder.html) which in turn
|
||||
allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google-adsense1d4/trait.CallBuilder.html)
|
||||
* **[Resources](http://byron.github.io/google-apis-rs/google-adsense1d4/trait.Resource.html)**
|
||||
* primary types that you can apply *Activities* to
|
||||
* a collection of properties and *Parts*
|
||||
@@ -57,6 +59,8 @@ The API is structured into the following primary items:
|
||||
* **[Activities](http://byron.github.io/google-apis-rs/google-adsense1d4/trait.CallBuilder.html)**
|
||||
* operations to apply to *Resources*
|
||||
|
||||
All *structures* are marked with applicable traits to further categorize them and ease browsing.
|
||||
|
||||
Generally speaking, you can invoke *Activities* like this:
|
||||
|
||||
```Rust,ignore
|
||||
@@ -109,7 +113,7 @@ google-adsense1d4 = "*"
|
||||
extern crate hyper;
|
||||
extern crate "yup-oauth2" as oauth2;
|
||||
extern crate "google-adsense1d4" as adsense1d4;
|
||||
use adsense1d4::Result;
|
||||
use adsense1d4::{Result, Error};
|
||||
use std::default::Default;
|
||||
use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
||||
use adsense1d4::AdSense;
|
||||
@@ -142,15 +146,17 @@ let result = hub.accounts().reports_generate("accountId", "startDate", "endDate"
|
||||
.doit();
|
||||
|
||||
match result {
|
||||
Result::HttpError(err) => println!("HTTPERROR: {:?}", err),
|
||||
Result::MissingAPIKey => println!("Auth: Missing API Key - used if there are no scopes"),
|
||||
Result::MissingToken => println!("OAuth2: Missing Token"),
|
||||
Result::Cancelled => println!("Operation cancelled by user"),
|
||||
Result::UploadSizeLimitExceeded(size, max_size) => println!("Upload size too big: {} of {}", size, max_size),
|
||||
Result::Failure(_) => println!("General Failure (hyper::client::Response doesn't print)"),
|
||||
Result::FieldClash(clashed_field) => println!("You added custom parameter which is part of builder: {:?}", clashed_field),
|
||||
Result::JsonDecodeError(err) => println!("Couldn't understand server reply - maybe API needs update: {:?}", err),
|
||||
Result::Success(_) => println!("Success (value doesn't print)"),
|
||||
Err(e) => match e {
|
||||
Error::HttpError(err) => println!("HTTPERROR: {:?}", err),
|
||||
Error::MissingAPIKey => println!("Auth: Missing API Key - used if there are no scopes"),
|
||||
Error::MissingToken => println!("OAuth2: Missing Token"),
|
||||
Error::Cancelled => println!("Operation canceled by user"),
|
||||
Error::UploadSizeLimitExceeded(size, max_size) => println!("Upload size too big: {} of {}", size, max_size),
|
||||
Error::Failure(_) => println!("General Failure (hyper::client::Response doesn't print)"),
|
||||
Error::FieldClash(clashed_field) => println!("You added custom parameter which is part of builder: {:?}", clashed_field),
|
||||
Error::JsonDecodeError(err) => println!("Couldn't understand server reply - maybe API needs update: {:?}", err),
|
||||
},
|
||||
Ok(_) => println!("Success (value doesn't print)"),
|
||||
}
|
||||
|
||||
```
|
||||
@@ -163,7 +169,7 @@ the doit() methods, or handed as possibly intermediate results to either the
|
||||
When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
|
||||
makes the system potentially resilient to all kinds of errors.
|
||||
|
||||
## Uploads and Downlods
|
||||
## Uploads and Downloads
|
||||
If a method supports downloads, the response body, which is part of the [Result](http://byron.github.io/google-apis-rs/google-adsense1d4/enum.Result.html), should be
|
||||
read by you to obtain the media.
|
||||
If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google-adsense1d4/trait.ResponseResult.html), it will return that by default.
|
||||
@@ -186,8 +192,9 @@ The [delegate trait](http://byron.github.io/google-apis-rs/google-adsense1d4/tra
|
||||
## Optional Parts in Server-Requests
|
||||
|
||||
All structures provided by this library are made to be [enocodable](http://byron.github.io/google-apis-rs/google-adsense1d4/trait.RequestValue.html) and
|
||||
[decodable](http://byron.github.io/google-apis-rs/google-adsense1d4/trait.ResponseResult.html) via json. Optionals are used to indicate that partial requests are responses are valid.
|
||||
Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google-adsense1d4/trait.Part.html) which are identifyable by name, which will be sent to
|
||||
[decodable](http://byron.github.io/google-apis-rs/google-adsense1d4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses
|
||||
are valid.
|
||||
Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google-adsense1d4/trait.Part.html) which are identifiable by name, which will be sent to
|
||||
the server to indicate either the set parts of the request or the desired parts in the response.
|
||||
|
||||
## Builder Arguments
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// COPY OF 'src/rust/cmn.rs'
|
||||
// COPY OF 'src/rust/api/cmn.rs'
|
||||
// DO NOT EDIT
|
||||
use std::marker::MarkerTrait;
|
||||
use std::io::{self, Read, Seek, Cursor, Write, SeekFrom};
|
||||
@@ -24,7 +24,7 @@ use serde;
|
||||
pub trait Hub: MarkerTrait {}
|
||||
|
||||
/// Identifies types for building methods of a particular resource type
|
||||
pub trait ResourceMethodsBuilder: MarkerTrait {}
|
||||
pub trait MethodsBuilder: MarkerTrait {}
|
||||
|
||||
/// Identifies types which represent builders for a particular resource method
|
||||
pub trait CallBuilder: MarkerTrait {}
|
||||
@@ -105,12 +105,15 @@ pub trait Delegate {
|
||||
/// information if he is interesting in knowing more context when further calls to it
|
||||
/// are made.
|
||||
/// The matching `finished()` call will always be made, no matter whether or not the API
|
||||
/// request was sucessfull. That way, the delgate may easily maintain a clean state
|
||||
/// request was successful. That way, the delegate may easily maintain a clean state
|
||||
/// between various API calls.
|
||||
fn begin(&mut self, MethodInfo) {}
|
||||
|
||||
/// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems.
|
||||
///
|
||||
/// If you choose to retry after a duration, the duration should be chosen using the
|
||||
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
|
||||
///
|
||||
/// Return retry information.
|
||||
fn http_error(&mut self, &hyper::HttpError) -> Retry {
|
||||
Retry::Abort
|
||||
@@ -133,7 +136,7 @@ pub trait Delegate {
|
||||
/// Called during resumable uploads to provide a URL for the impending upload.
|
||||
/// It was saved after a previous call to `store_upload_url(...)`, and if not None,
|
||||
/// will be used instead of asking the server for a new upload URL.
|
||||
/// This is useful in case a previous resumable upload was aborted/cancelled, but should now
|
||||
/// This is useful in case a previous resumable upload was aborted/canceled, but should now
|
||||
/// be resumed.
|
||||
/// The returned URL will be used exactly once - if it fails again and the delegate allows
|
||||
/// to retry, we will ask the server for a new upload URL.
|
||||
@@ -154,8 +157,8 @@ pub trait Delegate {
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// `json_encoded_value` - The json-encoded value which failed to decode.
|
||||
/// `json_decode_error` - The decoder error
|
||||
/// * `json_encoded_value` - The json-encoded value which failed to decode.
|
||||
/// * `json_decode_error` - The decoder error
|
||||
fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &serde::json::Error) {
|
||||
let _ = json_encoded_value;
|
||||
let _ = json_decode_error;
|
||||
@@ -166,6 +169,9 @@ pub trait Delegate {
|
||||
/// depends on the used API method.
|
||||
/// The delegate should check the status, header and decoded json error to decide
|
||||
/// whether to retry or not. In the latter case, the underlying call will fail.
|
||||
///
|
||||
/// If you choose to retry after a duration, the duration should be chosen using the
|
||||
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
|
||||
fn http_failure(&mut self, _: &hyper::client::Response, Option<JsonServerError>) -> Retry {
|
||||
Retry::Abort
|
||||
}
|
||||
@@ -197,8 +203,8 @@ pub trait Delegate {
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// `is_success` - a true value indicates the operation was successful. If false, you should
|
||||
/// discard all values stored during `store_upload_url`.
|
||||
/// * `is_success` - a true value indicates the operation was successful. If false, you should
|
||||
/// discard all values stored during `store_upload_url`.
|
||||
fn finished(&mut self, is_success: bool) {
|
||||
let _ = is_success;
|
||||
}
|
||||
@@ -212,8 +218,8 @@ pub struct DefaultDelegate;
|
||||
impl Delegate for DefaultDelegate {}
|
||||
|
||||
|
||||
/// A universal result type used as return for all action method results.
|
||||
pub enum Result<T = ()> {
|
||||
|
||||
pub enum Error {
|
||||
/// The http connection failed
|
||||
HttpError(hyper::HttpError),
|
||||
|
||||
@@ -240,11 +246,11 @@ pub enum Result<T = ()> {
|
||||
|
||||
/// Indicates an HTTP repsonse with a non-success status code
|
||||
Failure(hyper::client::Response),
|
||||
|
||||
/// It worked !
|
||||
Success(T),
|
||||
}
|
||||
|
||||
/// A universal result type used as return for all calls.
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// Contains information about an API request.
|
||||
pub struct MethodInfo {
|
||||
pub id: &'static str,
|
||||
@@ -499,7 +505,7 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
where NC: hyper::net::NetworkConnector,
|
||||
A: oauth2::GetToken {
|
||||
|
||||
fn query_transfer_status(&mut self) -> (Option<u64>, hyper::HttpResult<hyper::client::Response>) {
|
||||
fn query_transfer_status(&mut self) -> std::result::Result<u64, hyper::HttpResult<hyper::client::Response>> {
|
||||
loop {
|
||||
match self.client.post(self.url)
|
||||
.header(UserAgent(self.user_agent.to_string()))
|
||||
@@ -516,17 +522,17 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
return (None, Ok(r))
|
||||
return Err(Ok(r))
|
||||
}
|
||||
};
|
||||
return (Some(h.0.last), Ok(r))
|
||||
return Ok(h.0.last)
|
||||
}
|
||||
Err(err) => {
|
||||
if let Retry::After(d) = self.delegate.http_error(&err) {
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
return (None, Err(err))
|
||||
return Err(Err(err))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -539,8 +545,8 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
let mut start = match self.start_at {
|
||||
Some(s) => s,
|
||||
None => match self.query_transfer_status() {
|
||||
(Some(s), _) => s,
|
||||
(_, result) => return Some(result)
|
||||
Ok(s) => s,
|
||||
Err(result) => return Some(result)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
||||
[package]
|
||||
|
||||
name = "google-adsensehost4d1"
|
||||
version = "0.1.1+20150302"
|
||||
version = "0.1.2+20150309"
|
||||
authors = ["Sebastian Thiel <byronimo@gmail>"]
|
||||
description = "A complete library to interact with AdSense Host (protocol v4.1)"
|
||||
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adsensehost4d1"
|
||||
@@ -16,7 +16,7 @@ keywords = ["adsensehost", "google", "protocol", "web", "api"]
|
||||
[dependencies]
|
||||
hyper = "*"
|
||||
mime = "*"
|
||||
yup-oauth2 = "*"
|
||||
url = "*"
|
||||
serde = "*"
|
||||
serde_macros = "*"
|
||||
yup-oauth2 = "*"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!---
|
||||
DO NOT EDIT !
|
||||
This file was generated automatically from 'src/mako/README.md.mako'
|
||||
This file was generated automatically from 'src/mako/api/README.md.mako'
|
||||
DO NOT EDIT !
|
||||
-->
|
||||
The `google-adsensehost4d1` library allows access to all features of the *Google AdSense Host* service.
|
||||
|
||||
This documentation was generated from *AdSense Host* crate version *0.1.1+20150302*, where *20150302* is the exact revision of the *adsensehost:v4.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.1*.
|
||||
This documentation was generated from *AdSense Host* crate version *0.1.2+20150309*, where *20150309* is the exact revision of the *adsensehost:v4.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.2*.
|
||||
|
||||
Everything else about the *AdSense Host* *v4d1* API can be found at the
|
||||
[official documentation site](https://developers.google.com/adsense/host/).
|
||||
@@ -35,6 +35,8 @@ The API is structured into the following primary items:
|
||||
|
||||
* **[Hub](http://byron.github.io/google-apis-rs/google-adsensehost4d1/struct.AdSenseHost.html)**
|
||||
* a central object to maintain state and allow accessing all *Activities*
|
||||
* creates [*Method Builders*](http://byron.github.io/google-apis-rs/google-adsensehost4d1/trait.MethodsBuilder.html) which in turn
|
||||
allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google-adsensehost4d1/trait.CallBuilder.html)
|
||||
* **[Resources](http://byron.github.io/google-apis-rs/google-adsensehost4d1/trait.Resource.html)**
|
||||
* primary types that you can apply *Activities* to
|
||||
* a collection of properties and *Parts*
|
||||
@@ -44,6 +46,8 @@ The API is structured into the following primary items:
|
||||
* **[Activities](http://byron.github.io/google-apis-rs/google-adsensehost4d1/trait.CallBuilder.html)**
|
||||
* operations to apply to *Resources*
|
||||
|
||||
All *structures* are marked with applicable traits to further categorize them and ease browsing.
|
||||
|
||||
Generally speaking, you can invoke *Activities* like this:
|
||||
|
||||
```Rust,ignore
|
||||
@@ -89,7 +93,7 @@ google-adsensehost4d1 = "*"
|
||||
extern crate hyper;
|
||||
extern crate "yup-oauth2" as oauth2;
|
||||
extern crate "google-adsensehost4d1" as adsensehost4d1;
|
||||
use adsensehost4d1::Result;
|
||||
use adsensehost4d1::{Result, Error};
|
||||
use std::default::Default;
|
||||
use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
||||
use adsensehost4d1::AdSenseHost;
|
||||
@@ -120,15 +124,17 @@ let result = hub.accounts().reports_generate("accountId", "startDate", "endDate"
|
||||
.doit();
|
||||
|
||||
match result {
|
||||
Result::HttpError(err) => println!("HTTPERROR: {:?}", err),
|
||||
Result::MissingAPIKey => println!("Auth: Missing API Key - used if there are no scopes"),
|
||||
Result::MissingToken => println!("OAuth2: Missing Token"),
|
||||
Result::Cancelled => println!("Operation cancelled by user"),
|
||||
Result::UploadSizeLimitExceeded(size, max_size) => println!("Upload size too big: {} of {}", size, max_size),
|
||||
Result::Failure(_) => println!("General Failure (hyper::client::Response doesn't print)"),
|
||||
Result::FieldClash(clashed_field) => println!("You added custom parameter which is part of builder: {:?}", clashed_field),
|
||||
Result::JsonDecodeError(err) => println!("Couldn't understand server reply - maybe API needs update: {:?}", err),
|
||||
Result::Success(_) => println!("Success (value doesn't print)"),
|
||||
Err(e) => match e {
|
||||
Error::HttpError(err) => println!("HTTPERROR: {:?}", err),
|
||||
Error::MissingAPIKey => println!("Auth: Missing API Key - used if there are no scopes"),
|
||||
Error::MissingToken => println!("OAuth2: Missing Token"),
|
||||
Error::Cancelled => println!("Operation canceled by user"),
|
||||
Error::UploadSizeLimitExceeded(size, max_size) => println!("Upload size too big: {} of {}", size, max_size),
|
||||
Error::Failure(_) => println!("General Failure (hyper::client::Response doesn't print)"),
|
||||
Error::FieldClash(clashed_field) => println!("You added custom parameter which is part of builder: {:?}", clashed_field),
|
||||
Error::JsonDecodeError(err) => println!("Couldn't understand server reply - maybe API needs update: {:?}", err),
|
||||
},
|
||||
Ok(_) => println!("Success (value doesn't print)"),
|
||||
}
|
||||
|
||||
```
|
||||
@@ -141,7 +147,7 @@ the doit() methods, or handed as possibly intermediate results to either the
|
||||
When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
|
||||
makes the system potentially resilient to all kinds of errors.
|
||||
|
||||
## Uploads and Downlods
|
||||
## Uploads and Downloads
|
||||
If a method supports downloads, the response body, which is part of the [Result](http://byron.github.io/google-apis-rs/google-adsensehost4d1/enum.Result.html), should be
|
||||
read by you to obtain the media.
|
||||
If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google-adsensehost4d1/trait.ResponseResult.html), it will return that by default.
|
||||
@@ -164,8 +170,9 @@ The [delegate trait](http://byron.github.io/google-apis-rs/google-adsensehost4d1
|
||||
## Optional Parts in Server-Requests
|
||||
|
||||
All structures provided by this library are made to be [enocodable](http://byron.github.io/google-apis-rs/google-adsensehost4d1/trait.RequestValue.html) and
|
||||
[decodable](http://byron.github.io/google-apis-rs/google-adsensehost4d1/trait.ResponseResult.html) via json. Optionals are used to indicate that partial requests are responses are valid.
|
||||
Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google-adsensehost4d1/trait.Part.html) which are identifyable by name, which will be sent to
|
||||
[decodable](http://byron.github.io/google-apis-rs/google-adsensehost4d1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses
|
||||
are valid.
|
||||
Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google-adsensehost4d1/trait.Part.html) which are identifiable by name, which will be sent to
|
||||
the server to indicate either the set parts of the request or the desired parts in the response.
|
||||
|
||||
## Builder Arguments
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// COPY OF 'src/rust/cmn.rs'
|
||||
// COPY OF 'src/rust/api/cmn.rs'
|
||||
// DO NOT EDIT
|
||||
use std::marker::MarkerTrait;
|
||||
use std::io::{self, Read, Seek, Cursor, Write, SeekFrom};
|
||||
@@ -24,7 +24,7 @@ use serde;
|
||||
pub trait Hub: MarkerTrait {}
|
||||
|
||||
/// Identifies types for building methods of a particular resource type
|
||||
pub trait ResourceMethodsBuilder: MarkerTrait {}
|
||||
pub trait MethodsBuilder: MarkerTrait {}
|
||||
|
||||
/// Identifies types which represent builders for a particular resource method
|
||||
pub trait CallBuilder: MarkerTrait {}
|
||||
@@ -105,12 +105,15 @@ pub trait Delegate {
|
||||
/// information if he is interesting in knowing more context when further calls to it
|
||||
/// are made.
|
||||
/// The matching `finished()` call will always be made, no matter whether or not the API
|
||||
/// request was sucessfull. That way, the delgate may easily maintain a clean state
|
||||
/// request was successful. That way, the delegate may easily maintain a clean state
|
||||
/// between various API calls.
|
||||
fn begin(&mut self, MethodInfo) {}
|
||||
|
||||
/// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems.
|
||||
///
|
||||
/// If you choose to retry after a duration, the duration should be chosen using the
|
||||
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
|
||||
///
|
||||
/// Return retry information.
|
||||
fn http_error(&mut self, &hyper::HttpError) -> Retry {
|
||||
Retry::Abort
|
||||
@@ -133,7 +136,7 @@ pub trait Delegate {
|
||||
/// Called during resumable uploads to provide a URL for the impending upload.
|
||||
/// It was saved after a previous call to `store_upload_url(...)`, and if not None,
|
||||
/// will be used instead of asking the server for a new upload URL.
|
||||
/// This is useful in case a previous resumable upload was aborted/cancelled, but should now
|
||||
/// This is useful in case a previous resumable upload was aborted/canceled, but should now
|
||||
/// be resumed.
|
||||
/// The returned URL will be used exactly once - if it fails again and the delegate allows
|
||||
/// to retry, we will ask the server for a new upload URL.
|
||||
@@ -154,8 +157,8 @@ pub trait Delegate {
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// `json_encoded_value` - The json-encoded value which failed to decode.
|
||||
/// `json_decode_error` - The decoder error
|
||||
/// * `json_encoded_value` - The json-encoded value which failed to decode.
|
||||
/// * `json_decode_error` - The decoder error
|
||||
fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &serde::json::Error) {
|
||||
let _ = json_encoded_value;
|
||||
let _ = json_decode_error;
|
||||
@@ -166,6 +169,9 @@ pub trait Delegate {
|
||||
/// depends on the used API method.
|
||||
/// The delegate should check the status, header and decoded json error to decide
|
||||
/// whether to retry or not. In the latter case, the underlying call will fail.
|
||||
///
|
||||
/// If you choose to retry after a duration, the duration should be chosen using the
|
||||
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
|
||||
fn http_failure(&mut self, _: &hyper::client::Response, Option<JsonServerError>) -> Retry {
|
||||
Retry::Abort
|
||||
}
|
||||
@@ -197,8 +203,8 @@ pub trait Delegate {
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// `is_success` - a true value indicates the operation was successful. If false, you should
|
||||
/// discard all values stored during `store_upload_url`.
|
||||
/// * `is_success` - a true value indicates the operation was successful. If false, you should
|
||||
/// discard all values stored during `store_upload_url`.
|
||||
fn finished(&mut self, is_success: bool) {
|
||||
let _ = is_success;
|
||||
}
|
||||
@@ -212,8 +218,8 @@ pub struct DefaultDelegate;
|
||||
impl Delegate for DefaultDelegate {}
|
||||
|
||||
|
||||
/// A universal result type used as return for all action method results.
|
||||
pub enum Result<T = ()> {
|
||||
|
||||
pub enum Error {
|
||||
/// The http connection failed
|
||||
HttpError(hyper::HttpError),
|
||||
|
||||
@@ -240,11 +246,11 @@ pub enum Result<T = ()> {
|
||||
|
||||
/// Indicates an HTTP repsonse with a non-success status code
|
||||
Failure(hyper::client::Response),
|
||||
|
||||
/// It worked !
|
||||
Success(T),
|
||||
}
|
||||
|
||||
/// A universal result type used as return for all calls.
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// Contains information about an API request.
|
||||
pub struct MethodInfo {
|
||||
pub id: &'static str,
|
||||
@@ -499,7 +505,7 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
where NC: hyper::net::NetworkConnector,
|
||||
A: oauth2::GetToken {
|
||||
|
||||
fn query_transfer_status(&mut self) -> (Option<u64>, hyper::HttpResult<hyper::client::Response>) {
|
||||
fn query_transfer_status(&mut self) -> std::result::Result<u64, hyper::HttpResult<hyper::client::Response>> {
|
||||
loop {
|
||||
match self.client.post(self.url)
|
||||
.header(UserAgent(self.user_agent.to_string()))
|
||||
@@ -516,17 +522,17 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
return (None, Ok(r))
|
||||
return Err(Ok(r))
|
||||
}
|
||||
};
|
||||
return (Some(h.0.last), Ok(r))
|
||||
return Ok(h.0.last)
|
||||
}
|
||||
Err(err) => {
|
||||
if let Retry::After(d) = self.delegate.http_error(&err) {
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
return (None, Err(err))
|
||||
return Err(Err(err))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -539,8 +545,8 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
|
||||
let mut start = match self.start_at {
|
||||
Some(s) => s,
|
||||
None => match self.query_transfer_status() {
|
||||
(Some(s), _) => s,
|
||||
(_, result) => return Some(result)
|
||||
Ok(s) => s,
|
||||
Err(result) => return Some(result)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
||||
[package]
|
||||
|
||||
name = "google-analytics3"
|
||||
version = "0.1.1+20150308"
|
||||
version = "0.1.2+20150308"
|
||||
authors = ["Sebastian Thiel <byronimo@gmail>"]
|
||||
description = "A complete library to interact with analytics (protocol v3)"
|
||||
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/analytics3"
|
||||
@@ -16,7 +16,7 @@ keywords = ["analytics", "google", "protocol", "web", "api"]
|
||||
[dependencies]
|
||||
hyper = "*"
|
||||
mime = "*"
|
||||
yup-oauth2 = "*"
|
||||
url = "*"
|
||||
serde = "*"
|
||||
serde_macros = "*"
|
||||
yup-oauth2 = "*"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user