mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
fix(version-up): code updated to v0.1.6, latest CLI
* also includes publishing tag files
This commit is contained in:
@@ -60,7 +60,6 @@ pub trait ToParts {
|
||||
fn to_parts(&self) -> String;
|
||||
}
|
||||
|
||||
|
||||
/// A utility type which can decode a server response that indicates error
|
||||
#[derive(Deserialize)]
|
||||
pub struct JsonServerError {
|
||||
@@ -68,6 +67,30 @@ pub struct JsonServerError {
|
||||
pub error_description: Option<String>
|
||||
}
|
||||
|
||||
/// A utility to represent detailed errors we might see in case there are BadRequests.
|
||||
/// The latter happen if the sent parameters or request structures are unsound
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
pub struct ErrorResponse {
|
||||
error: ServerError,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
pub struct ServerError {
|
||||
errors: Vec<ServerMessage>,
|
||||
code: u16,
|
||||
message: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
pub struct ServerMessage {
|
||||
domain: String,
|
||||
reason: String,
|
||||
message: String,
|
||||
#[serde(rename="locationType")]
|
||||
location_type: Option<String>,
|
||||
location: Option<String>
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct DummyNetworkStream;
|
||||
|
||||
@@ -175,7 +198,7 @@ pub trait Delegate {
|
||||
///
|
||||
/// 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 {
|
||||
fn http_failure(&mut self, _: &hyper::client::Response, Option<JsonServerError>, _: Option<ServerError>) -> Retry {
|
||||
Retry::Abort
|
||||
}
|
||||
|
||||
@@ -230,6 +253,10 @@ pub enum Error {
|
||||
/// even though the maximum upload size is what is stored in field `.1`.
|
||||
UploadSizeLimitExceeded(u64, u64),
|
||||
|
||||
/// Represents information about a request that was not understood by the server.
|
||||
/// Details are included.
|
||||
BadRequest(ErrorResponse),
|
||||
|
||||
/// We needed an API key for authentication, but didn't obtain one.
|
||||
/// Neither through the authenticator, nor through the Delegate.
|
||||
MissingAPIKey,
|
||||
@@ -245,7 +272,7 @@ pub enum Error {
|
||||
|
||||
/// Shows that we failed to decode the server response.
|
||||
/// This can happen if the protocol changes in conjunction with strict json decoding.
|
||||
JsonDecodeError(serde::json::Error),
|
||||
JsonDecodeError(String, serde::json::Error),
|
||||
|
||||
/// Indicates an HTTP repsonse with a non-success status code
|
||||
Failure(hyper::client::Response),
|
||||
@@ -263,13 +290,16 @@ impl Display for Error {
|
||||
writeln!(f, "The application's API key was not found in the configuration").ok();
|
||||
writeln!(f, "It is used as there are no Scopes defined for this method.")
|
||||
},
|
||||
Error::BadRequest(ref err)
|
||||
=> writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message),
|
||||
Error::MissingToken(ref err) =>
|
||||
writeln!(f, "Token retrieval failed with error: {}", err),
|
||||
Error::Cancelled =>
|
||||
writeln!(f, "Operation cancelled by delegate"),
|
||||
Error::FieldClash(field) =>
|
||||
writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field),
|
||||
Error::JsonDecodeError(ref err) => err.fmt(f),
|
||||
Error::JsonDecodeError(ref json_str, ref err)
|
||||
=> writeln!(f, "{}: {}", err, json_str),
|
||||
Error::Failure(ref response) =>
|
||||
writeln!(f, "Http status indicates failure: {:?}", response),
|
||||
}
|
||||
@@ -280,7 +310,7 @@ impl error::Error for Error {
|
||||
fn description(&self) -> &str {
|
||||
match *self {
|
||||
Error::HttpError(ref err) => err.description(),
|
||||
Error::JsonDecodeError(ref err) => err.description(),
|
||||
Error::JsonDecodeError(_, ref err) => err.description(),
|
||||
_ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead"
|
||||
}
|
||||
}
|
||||
@@ -288,7 +318,7 @@ impl error::Error for Error {
|
||||
fn cause(&self) -> Option<&error::Error> {
|
||||
match *self {
|
||||
Error::HttpError(ref err) => err.cause(),
|
||||
Error::JsonDecodeError(ref err) => err.cause(),
|
||||
Error::JsonDecodeError(_, ref err) => err.cause(),
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
@@ -401,7 +431,7 @@ impl<'a> Read for MultiPartReader<'a> {
|
||||
// before clearing the last part, we will add the boundary that
|
||||
// will be written last
|
||||
self.last_part_boundary = Some(Cursor::new(
|
||||
format!("{}--{}", LINE_ENDING, BOUNDARY).into_bytes()))
|
||||
format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes()))
|
||||
}
|
||||
// We are depleted - this can trigger the next part to come in
|
||||
self.current_part = None;
|
||||
@@ -489,7 +519,7 @@ impl Header for ContentRange {
|
||||
|
||||
impl HeaderFormat for ContentRange {
|
||||
fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
try!(fmt.write_str("bytes="));
|
||||
try!(fmt.write_str("bytes "));
|
||||
match self.range {
|
||||
Some(ref c) => try!(c.fmt(fmt)),
|
||||
None => try!(fmt.write_str("*"))
|
||||
@@ -510,7 +540,7 @@ impl Header for RangeResponseHeader {
|
||||
fn parse_header(raw: &[Vec<u8>]) -> Option<RangeResponseHeader> {
|
||||
if let [ref v] = raw {
|
||||
if let Ok(s) = std::str::from_utf8(v) {
|
||||
const PREFIX: &'static str = "bytes=";
|
||||
const PREFIX: &'static str = "bytes ";
|
||||
if s.starts_with(PREFIX) {
|
||||
if let Ok(c) = <Chunk as FromStr>::from_str(&s[PREFIX.len()..]) {
|
||||
return Some(RangeResponseHeader(c))
|
||||
@@ -559,7 +589,7 @@ impl<'a, A> ResumableUploadHelper<'a, A>
|
||||
let h: &RangeResponseHeader = match headers.get() {
|
||||
Some(hh) if r.status == StatusCode::PermanentRedirect => hh,
|
||||
None|Some(_) => {
|
||||
if let Retry::After(d) = self.delegate.http_failure(&r, None) {
|
||||
if let Retry::After(d) = self.delegate.http_failure(&r, None, None) {
|
||||
sleep_ms(d.num_milliseconds() as u32);
|
||||
continue;
|
||||
}
|
||||
@@ -626,7 +656,9 @@ impl<'a, A> ResumableUploadHelper<'a, A>
|
||||
if !res.status.is_success() {
|
||||
let mut json_err = String::new();
|
||||
res.read_to_string(&mut json_err).unwrap();
|
||||
if let Retry::After(d) = self.delegate.http_failure(&res, serde::json::from_str(&json_err).ok()) {
|
||||
if let Retry::After(d) = self.delegate.http_failure(&res,
|
||||
serde::json::from_str(&json_err).ok(),
|
||||
serde::json::from_str(&json_err).ok()) {
|
||||
sleep_ms(d.num_milliseconds() as u32);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file was generated automatically from 'src/mako/api/lib.rs.mako'
|
||||
// DO NOT EDIT !
|
||||
|
||||
//! This documentation was generated from *spectrum* crate version *0.1.5+20150112*, where *20150112* is the exact revision of the *spectrum:v1explorer* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.5*.
|
||||
//! This documentation was generated from *spectrum* crate version *0.1.6+20150112*, where *20150112* is the exact revision of the *spectrum:v1explorer* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.6*.
|
||||
//!
|
||||
//! Everything else about the *spectrum* *v1_explorer* API can be found at the
|
||||
//! [official documentation site](http://developers.google.com/spectrum).
|
||||
@@ -99,21 +99,22 @@
|
||||
//! // You can configure optional parameters by calling the respective setters at will, and
|
||||
//! // execute the final call using `doit()`.
|
||||
//! // Values shown here are possibly random and not representative !
|
||||
//! let result = hub.paws().get_spectrum_batch(&req)
|
||||
//! let result = hub.paws().get_spectrum_batch(req)
|
||||
//! .doit();
|
||||
//!
|
||||
//! match result {
|
||||
//! Err(e) => match e {
|
||||
//! // The Error enum provides details about what exactly happened.
|
||||
//! // You can also just use its `Debug`, `Display` or `Error` traits
|
||||
//! Error::HttpError(_)
|
||||
//! Error::HttpError(_)
|
||||
//! |Error::MissingAPIKey
|
||||
//! |Error::MissingToken
|
||||
//! |Error::MissingToken(_)
|
||||
//! |Error::Cancelled
|
||||
//! |Error::UploadSizeLimitExceeded(_, _)
|
||||
//! |Error::Failure(_)
|
||||
//! |Error::BadRequest(_)
|
||||
//! |Error::FieldClash(_)
|
||||
//! |Error::JsonDecodeError(_) => println!("{}", e),
|
||||
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
|
||||
//! },
|
||||
//! Ok(res) => println!("Success: {:?}", res),
|
||||
//! }
|
||||
@@ -201,7 +202,7 @@ use std::io;
|
||||
use std::fs;
|
||||
use std::thread::sleep_ms;
|
||||
|
||||
pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, JsonServerError};
|
||||
pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse};
|
||||
|
||||
|
||||
// ##############
|
||||
@@ -252,21 +253,22 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder,
|
||||
/// // You can configure optional parameters by calling the respective setters at will, and
|
||||
/// // execute the final call using `doit()`.
|
||||
/// // Values shown here are possibly random and not representative !
|
||||
/// let result = hub.paws().get_spectrum_batch(&req)
|
||||
/// let result = hub.paws().get_spectrum_batch(req)
|
||||
/// .doit();
|
||||
///
|
||||
/// match result {
|
||||
/// Err(e) => match e {
|
||||
/// // The Error enum provides details about what exactly happened.
|
||||
/// // You can also just use its `Debug`, `Display` or `Error` traits
|
||||
/// Error::HttpError(_)
|
||||
/// Error::HttpError(_)
|
||||
/// |Error::MissingAPIKey
|
||||
/// |Error::MissingToken
|
||||
/// |Error::MissingToken(_)
|
||||
/// |Error::Cancelled
|
||||
/// |Error::UploadSizeLimitExceeded(_, _)
|
||||
/// |Error::Failure(_)
|
||||
/// |Error::BadRequest(_)
|
||||
/// |Error::FieldClash(_)
|
||||
/// |Error::JsonDecodeError(_) => println!("{}", e),
|
||||
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
|
||||
/// },
|
||||
/// Ok(res) => println!("Success: {:?}", res),
|
||||
/// }
|
||||
@@ -287,7 +289,7 @@ impl<'a, C, A> Spectrum<C, A>
|
||||
Spectrum {
|
||||
client: RefCell::new(client),
|
||||
auth: RefCell::new(authenticator),
|
||||
_user_agent: "google-api-rust-client/0.1.5".to_string(),
|
||||
_user_agent: "google-api-rust-client/0.1.6".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,7 +298,7 @@ impl<'a, C, A> Spectrum<C, A>
|
||||
}
|
||||
|
||||
/// Set the user-agent header field to use in all requests to the server.
|
||||
/// It defaults to `google-api-rust-client/0.1.5`.
|
||||
/// It defaults to `google-api-rust-client/0.1.6`.
|
||||
///
|
||||
/// Returns the previously set user-agent.
|
||||
pub fn user_agent(&mut self, agent_name: String) -> String {
|
||||
@@ -1200,10 +1202,10 @@ impl<'a, C, A> PawMethods<'a, C, A> {
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `request` - No description provided.
|
||||
pub fn notify_spectrum_use(&self, request: &PawsNotifySpectrumUseRequest) -> PawNotifySpectrumUseCall<'a, C, A> {
|
||||
pub fn notify_spectrum_use(&self, request: PawsNotifySpectrumUseRequest) -> PawNotifySpectrumUseCall<'a, C, A> {
|
||||
PawNotifySpectrumUseCall {
|
||||
hub: self.hub,
|
||||
_request: request.clone(),
|
||||
_request: request,
|
||||
_delegate: Default::default(),
|
||||
_additional_params: Default::default(),
|
||||
}
|
||||
@@ -1216,10 +1218,10 @@ impl<'a, C, A> PawMethods<'a, C, A> {
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `request` - No description provided.
|
||||
pub fn register(&self, request: &PawsRegisterRequest) -> PawRegisterCall<'a, C, A> {
|
||||
pub fn register(&self, request: PawsRegisterRequest) -> PawRegisterCall<'a, C, A> {
|
||||
PawRegisterCall {
|
||||
hub: self.hub,
|
||||
_request: request.clone(),
|
||||
_request: request,
|
||||
_delegate: Default::default(),
|
||||
_additional_params: Default::default(),
|
||||
}
|
||||
@@ -1232,10 +1234,10 @@ impl<'a, C, A> PawMethods<'a, C, A> {
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `request` - No description provided.
|
||||
pub fn get_spectrum(&self, request: &PawsGetSpectrumRequest) -> PawGetSpectrumCall<'a, C, A> {
|
||||
pub fn get_spectrum(&self, request: PawsGetSpectrumRequest) -> PawGetSpectrumCall<'a, C, A> {
|
||||
PawGetSpectrumCall {
|
||||
hub: self.hub,
|
||||
_request: request.clone(),
|
||||
_request: request,
|
||||
_delegate: Default::default(),
|
||||
_additional_params: Default::default(),
|
||||
}
|
||||
@@ -1248,10 +1250,10 @@ impl<'a, C, A> PawMethods<'a, C, A> {
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `request` - No description provided.
|
||||
pub fn init(&self, request: &PawsInitRequest) -> PawInitCall<'a, C, A> {
|
||||
pub fn init(&self, request: PawsInitRequest) -> PawInitCall<'a, C, A> {
|
||||
PawInitCall {
|
||||
hub: self.hub,
|
||||
_request: request.clone(),
|
||||
_request: request,
|
||||
_delegate: Default::default(),
|
||||
_additional_params: Default::default(),
|
||||
}
|
||||
@@ -1264,10 +1266,10 @@ impl<'a, C, A> PawMethods<'a, C, A> {
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `request` - No description provided.
|
||||
pub fn get_spectrum_batch(&self, request: &PawsGetSpectrumBatchRequest) -> PawGetSpectrumBatchCall<'a, C, A> {
|
||||
pub fn get_spectrum_batch(&self, request: PawsGetSpectrumBatchRequest) -> PawGetSpectrumBatchCall<'a, C, A> {
|
||||
PawGetSpectrumBatchCall {
|
||||
hub: self.hub,
|
||||
_request: request.clone(),
|
||||
_request: request,
|
||||
_delegate: Default::default(),
|
||||
_additional_params: Default::default(),
|
||||
}
|
||||
@@ -1280,10 +1282,10 @@ impl<'a, C, A> PawMethods<'a, C, A> {
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `request` - No description provided.
|
||||
pub fn verify_device(&self, request: &PawsVerifyDeviceRequest) -> PawVerifyDeviceCall<'a, C, A> {
|
||||
pub fn verify_device(&self, request: PawsVerifyDeviceRequest) -> PawVerifyDeviceCall<'a, C, A> {
|
||||
PawVerifyDeviceCall {
|
||||
hub: self.hub,
|
||||
_request: request.clone(),
|
||||
_request: request,
|
||||
_delegate: Default::default(),
|
||||
_additional_params: Default::default(),
|
||||
}
|
||||
@@ -1330,7 +1332,7 @@ impl<'a, C, A> PawMethods<'a, C, A> {
|
||||
/// // You can configure optional parameters by calling the respective setters at will, and
|
||||
/// // execute the final call using `doit()`.
|
||||
/// // Values shown here are possibly random and not representative !
|
||||
/// let result = hub.paws().notify_spectrum_use(&req)
|
||||
/// let result = hub.paws().notify_spectrum_use(req)
|
||||
/// .doit();
|
||||
/// # }
|
||||
/// ```
|
||||
@@ -1425,12 +1427,17 @@ impl<'a, C, A> PawNotifySpectrumUseCall<'a, C, A> where C: BorrowMut<hyper::Clie
|
||||
if !res.status.is_success() {
|
||||
let mut json_err = String::new();
|
||||
res.read_to_string(&mut json_err).unwrap();
|
||||
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
|
||||
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
||||
json::from_str(&json_err).ok(),
|
||||
json::from_str(&json_err).ok()) {
|
||||
sleep_ms(d.num_milliseconds() as u32);
|
||||
continue;
|
||||
}
|
||||
dlg.finished(false);
|
||||
return Err(Error::Failure(res))
|
||||
return match json::from_str::<ErrorResponse>(&json_err){
|
||||
Err(_) => Err(Error::Failure(res)),
|
||||
Ok(serr) => Err(Error::BadRequest(serr))
|
||||
}
|
||||
}
|
||||
let result_value = {
|
||||
let mut json_response = String::new();
|
||||
@@ -1439,7 +1446,7 @@ impl<'a, C, A> PawNotifySpectrumUseCall<'a, C, A> where C: BorrowMut<hyper::Clie
|
||||
Ok(decoded) => (res, decoded),
|
||||
Err(err) => {
|
||||
dlg.response_json_decode_error(&json_response, &err);
|
||||
return Err(Error::JsonDecodeError(err));
|
||||
return Err(Error::JsonDecodeError(json_response, err));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1457,8 +1464,8 @@ impl<'a, C, A> PawNotifySpectrumUseCall<'a, C, A> where C: BorrowMut<hyper::Clie
|
||||
///
|
||||
/// Even though the property as already been set when instantiating this call,
|
||||
/// we provide this method for API completeness.
|
||||
pub fn request(mut self, new_value: &PawsNotifySpectrumUseRequest) -> PawNotifySpectrumUseCall<'a, C, A> {
|
||||
self._request = new_value.clone();
|
||||
pub fn request(mut self, new_value: PawsNotifySpectrumUseRequest) -> PawNotifySpectrumUseCall<'a, C, A> {
|
||||
self._request = new_value;
|
||||
self
|
||||
}
|
||||
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
|
||||
@@ -1529,7 +1536,7 @@ impl<'a, C, A> PawNotifySpectrumUseCall<'a, C, A> where C: BorrowMut<hyper::Clie
|
||||
/// // You can configure optional parameters by calling the respective setters at will, and
|
||||
/// // execute the final call using `doit()`.
|
||||
/// // Values shown here are possibly random and not representative !
|
||||
/// let result = hub.paws().register(&req)
|
||||
/// let result = hub.paws().register(req)
|
||||
/// .doit();
|
||||
/// # }
|
||||
/// ```
|
||||
@@ -1624,12 +1631,17 @@ impl<'a, C, A> PawRegisterCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
|
||||
if !res.status.is_success() {
|
||||
let mut json_err = String::new();
|
||||
res.read_to_string(&mut json_err).unwrap();
|
||||
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
|
||||
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
||||
json::from_str(&json_err).ok(),
|
||||
json::from_str(&json_err).ok()) {
|
||||
sleep_ms(d.num_milliseconds() as u32);
|
||||
continue;
|
||||
}
|
||||
dlg.finished(false);
|
||||
return Err(Error::Failure(res))
|
||||
return match json::from_str::<ErrorResponse>(&json_err){
|
||||
Err(_) => Err(Error::Failure(res)),
|
||||
Ok(serr) => Err(Error::BadRequest(serr))
|
||||
}
|
||||
}
|
||||
let result_value = {
|
||||
let mut json_response = String::new();
|
||||
@@ -1638,7 +1650,7 @@ impl<'a, C, A> PawRegisterCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
|
||||
Ok(decoded) => (res, decoded),
|
||||
Err(err) => {
|
||||
dlg.response_json_decode_error(&json_response, &err);
|
||||
return Err(Error::JsonDecodeError(err));
|
||||
return Err(Error::JsonDecodeError(json_response, err));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1656,8 +1668,8 @@ impl<'a, C, A> PawRegisterCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
|
||||
///
|
||||
/// Even though the property as already been set when instantiating this call,
|
||||
/// we provide this method for API completeness.
|
||||
pub fn request(mut self, new_value: &PawsRegisterRequest) -> PawRegisterCall<'a, C, A> {
|
||||
self._request = new_value.clone();
|
||||
pub fn request(mut self, new_value: PawsRegisterRequest) -> PawRegisterCall<'a, C, A> {
|
||||
self._request = new_value;
|
||||
self
|
||||
}
|
||||
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
|
||||
@@ -1728,7 +1740,7 @@ impl<'a, C, A> PawRegisterCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
|
||||
/// // You can configure optional parameters by calling the respective setters at will, and
|
||||
/// // execute the final call using `doit()`.
|
||||
/// // Values shown here are possibly random and not representative !
|
||||
/// let result = hub.paws().get_spectrum(&req)
|
||||
/// let result = hub.paws().get_spectrum(req)
|
||||
/// .doit();
|
||||
/// # }
|
||||
/// ```
|
||||
@@ -1823,12 +1835,17 @@ impl<'a, C, A> PawGetSpectrumCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
|
||||
if !res.status.is_success() {
|
||||
let mut json_err = String::new();
|
||||
res.read_to_string(&mut json_err).unwrap();
|
||||
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
|
||||
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
||||
json::from_str(&json_err).ok(),
|
||||
json::from_str(&json_err).ok()) {
|
||||
sleep_ms(d.num_milliseconds() as u32);
|
||||
continue;
|
||||
}
|
||||
dlg.finished(false);
|
||||
return Err(Error::Failure(res))
|
||||
return match json::from_str::<ErrorResponse>(&json_err){
|
||||
Err(_) => Err(Error::Failure(res)),
|
||||
Ok(serr) => Err(Error::BadRequest(serr))
|
||||
}
|
||||
}
|
||||
let result_value = {
|
||||
let mut json_response = String::new();
|
||||
@@ -1837,7 +1854,7 @@ impl<'a, C, A> PawGetSpectrumCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
|
||||
Ok(decoded) => (res, decoded),
|
||||
Err(err) => {
|
||||
dlg.response_json_decode_error(&json_response, &err);
|
||||
return Err(Error::JsonDecodeError(err));
|
||||
return Err(Error::JsonDecodeError(json_response, err));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1855,8 +1872,8 @@ impl<'a, C, A> PawGetSpectrumCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
|
||||
///
|
||||
/// Even though the property as already been set when instantiating this call,
|
||||
/// we provide this method for API completeness.
|
||||
pub fn request(mut self, new_value: &PawsGetSpectrumRequest) -> PawGetSpectrumCall<'a, C, A> {
|
||||
self._request = new_value.clone();
|
||||
pub fn request(mut self, new_value: PawsGetSpectrumRequest) -> PawGetSpectrumCall<'a, C, A> {
|
||||
self._request = new_value;
|
||||
self
|
||||
}
|
||||
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
|
||||
@@ -1927,7 +1944,7 @@ impl<'a, C, A> PawGetSpectrumCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
|
||||
/// // You can configure optional parameters by calling the respective setters at will, and
|
||||
/// // execute the final call using `doit()`.
|
||||
/// // Values shown here are possibly random and not representative !
|
||||
/// let result = hub.paws().init(&req)
|
||||
/// let result = hub.paws().init(req)
|
||||
/// .doit();
|
||||
/// # }
|
||||
/// ```
|
||||
@@ -2022,12 +2039,17 @@ impl<'a, C, A> PawInitCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth
|
||||
if !res.status.is_success() {
|
||||
let mut json_err = String::new();
|
||||
res.read_to_string(&mut json_err).unwrap();
|
||||
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
|
||||
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
||||
json::from_str(&json_err).ok(),
|
||||
json::from_str(&json_err).ok()) {
|
||||
sleep_ms(d.num_milliseconds() as u32);
|
||||
continue;
|
||||
}
|
||||
dlg.finished(false);
|
||||
return Err(Error::Failure(res))
|
||||
return match json::from_str::<ErrorResponse>(&json_err){
|
||||
Err(_) => Err(Error::Failure(res)),
|
||||
Ok(serr) => Err(Error::BadRequest(serr))
|
||||
}
|
||||
}
|
||||
let result_value = {
|
||||
let mut json_response = String::new();
|
||||
@@ -2036,7 +2058,7 @@ impl<'a, C, A> PawInitCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth
|
||||
Ok(decoded) => (res, decoded),
|
||||
Err(err) => {
|
||||
dlg.response_json_decode_error(&json_response, &err);
|
||||
return Err(Error::JsonDecodeError(err));
|
||||
return Err(Error::JsonDecodeError(json_response, err));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -2054,8 +2076,8 @@ impl<'a, C, A> PawInitCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth
|
||||
///
|
||||
/// Even though the property as already been set when instantiating this call,
|
||||
/// we provide this method for API completeness.
|
||||
pub fn request(mut self, new_value: &PawsInitRequest) -> PawInitCall<'a, C, A> {
|
||||
self._request = new_value.clone();
|
||||
pub fn request(mut self, new_value: PawsInitRequest) -> PawInitCall<'a, C, A> {
|
||||
self._request = new_value;
|
||||
self
|
||||
}
|
||||
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
|
||||
@@ -2126,7 +2148,7 @@ impl<'a, C, A> PawInitCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth
|
||||
/// // You can configure optional parameters by calling the respective setters at will, and
|
||||
/// // execute the final call using `doit()`.
|
||||
/// // Values shown here are possibly random and not representative !
|
||||
/// let result = hub.paws().get_spectrum_batch(&req)
|
||||
/// let result = hub.paws().get_spectrum_batch(req)
|
||||
/// .doit();
|
||||
/// # }
|
||||
/// ```
|
||||
@@ -2221,12 +2243,17 @@ impl<'a, C, A> PawGetSpectrumBatchCall<'a, C, A> where C: BorrowMut<hyper::Clien
|
||||
if !res.status.is_success() {
|
||||
let mut json_err = String::new();
|
||||
res.read_to_string(&mut json_err).unwrap();
|
||||
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
|
||||
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
||||
json::from_str(&json_err).ok(),
|
||||
json::from_str(&json_err).ok()) {
|
||||
sleep_ms(d.num_milliseconds() as u32);
|
||||
continue;
|
||||
}
|
||||
dlg.finished(false);
|
||||
return Err(Error::Failure(res))
|
||||
return match json::from_str::<ErrorResponse>(&json_err){
|
||||
Err(_) => Err(Error::Failure(res)),
|
||||
Ok(serr) => Err(Error::BadRequest(serr))
|
||||
}
|
||||
}
|
||||
let result_value = {
|
||||
let mut json_response = String::new();
|
||||
@@ -2235,7 +2262,7 @@ impl<'a, C, A> PawGetSpectrumBatchCall<'a, C, A> where C: BorrowMut<hyper::Clien
|
||||
Ok(decoded) => (res, decoded),
|
||||
Err(err) => {
|
||||
dlg.response_json_decode_error(&json_response, &err);
|
||||
return Err(Error::JsonDecodeError(err));
|
||||
return Err(Error::JsonDecodeError(json_response, err));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -2253,8 +2280,8 @@ impl<'a, C, A> PawGetSpectrumBatchCall<'a, C, A> where C: BorrowMut<hyper::Clien
|
||||
///
|
||||
/// Even though the property as already been set when instantiating this call,
|
||||
/// we provide this method for API completeness.
|
||||
pub fn request(mut self, new_value: &PawsGetSpectrumBatchRequest) -> PawGetSpectrumBatchCall<'a, C, A> {
|
||||
self._request = new_value.clone();
|
||||
pub fn request(mut self, new_value: PawsGetSpectrumBatchRequest) -> PawGetSpectrumBatchCall<'a, C, A> {
|
||||
self._request = new_value;
|
||||
self
|
||||
}
|
||||
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
|
||||
@@ -2325,7 +2352,7 @@ impl<'a, C, A> PawGetSpectrumBatchCall<'a, C, A> where C: BorrowMut<hyper::Clien
|
||||
/// // You can configure optional parameters by calling the respective setters at will, and
|
||||
/// // execute the final call using `doit()`.
|
||||
/// // Values shown here are possibly random and not representative !
|
||||
/// let result = hub.paws().verify_device(&req)
|
||||
/// let result = hub.paws().verify_device(req)
|
||||
/// .doit();
|
||||
/// # }
|
||||
/// ```
|
||||
@@ -2420,12 +2447,17 @@ impl<'a, C, A> PawVerifyDeviceCall<'a, C, A> where C: BorrowMut<hyper::Client>,
|
||||
if !res.status.is_success() {
|
||||
let mut json_err = String::new();
|
||||
res.read_to_string(&mut json_err).unwrap();
|
||||
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
|
||||
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
||||
json::from_str(&json_err).ok(),
|
||||
json::from_str(&json_err).ok()) {
|
||||
sleep_ms(d.num_milliseconds() as u32);
|
||||
continue;
|
||||
}
|
||||
dlg.finished(false);
|
||||
return Err(Error::Failure(res))
|
||||
return match json::from_str::<ErrorResponse>(&json_err){
|
||||
Err(_) => Err(Error::Failure(res)),
|
||||
Ok(serr) => Err(Error::BadRequest(serr))
|
||||
}
|
||||
}
|
||||
let result_value = {
|
||||
let mut json_response = String::new();
|
||||
@@ -2434,7 +2466,7 @@ impl<'a, C, A> PawVerifyDeviceCall<'a, C, A> where C: BorrowMut<hyper::Client>,
|
||||
Ok(decoded) => (res, decoded),
|
||||
Err(err) => {
|
||||
dlg.response_json_decode_error(&json_response, &err);
|
||||
return Err(Error::JsonDecodeError(err));
|
||||
return Err(Error::JsonDecodeError(json_response, err));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -2452,8 +2484,8 @@ impl<'a, C, A> PawVerifyDeviceCall<'a, C, A> where C: BorrowMut<hyper::Client>,
|
||||
///
|
||||
/// Even though the property as already been set when instantiating this call,
|
||||
/// we provide this method for API completeness.
|
||||
pub fn request(mut self, new_value: &PawsVerifyDeviceRequest) -> PawVerifyDeviceCall<'a, C, A> {
|
||||
self._request = new_value.clone();
|
||||
pub fn request(mut self, new_value: PawsVerifyDeviceRequest) -> PawVerifyDeviceCall<'a, C, A> {
|
||||
self._request = new_value;
|
||||
self
|
||||
}
|
||||
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
|
||||
|
||||
Reference in New Issue
Block a user