mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-13 21:19:05 +01:00
chore(code-up): latest version of all code
This commit is contained in:
@@ -138,7 +138,7 @@ pub trait Delegate {
|
||||
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
|
||||
///
|
||||
/// Return retry information.
|
||||
fn http_error(&mut self, &hyper::HttpError) -> Retry {
|
||||
fn http_error(&mut self, &hyper::Error) -> Retry {
|
||||
Retry::Abort
|
||||
}
|
||||
|
||||
@@ -173,7 +173,10 @@ pub trait Delegate {
|
||||
/// Called after we have retrieved a new upload URL for a resumable upload to store it
|
||||
/// in case we fail or cancel. That way, we can attempt to resume the upload later,
|
||||
/// see `upload_url()`.
|
||||
fn store_upload_url(&mut self, url: &str) {
|
||||
/// It will also be called with None after a successful upload, which allows the delegate
|
||||
/// to forget the URL. That way, we will not attempt to resume an upload that has already
|
||||
/// finished.
|
||||
fn store_upload_url(&mut self, url: Option<&str>) {
|
||||
let _ = url;
|
||||
}
|
||||
|
||||
@@ -247,7 +250,7 @@ impl Delegate for DefaultDelegate {}
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
/// The http connection failed
|
||||
HttpError(hyper::HttpError),
|
||||
HttpError(hyper::Error),
|
||||
|
||||
/// An attempt was made to upload a resource with size stored in field `.0`
|
||||
/// even though the maximum upload size is what is stored in field `.1`.
|
||||
@@ -290,8 +293,20 @@ 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::BadRequest(ref err) => {
|
||||
try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message));
|
||||
for err in err.error.errors.iter() {
|
||||
try!(writeln!(f, " {}: {}, {}{}",
|
||||
err.domain,
|
||||
err.message,
|
||||
err.reason,
|
||||
match &err.location {
|
||||
&Some(ref loc) => format!("@{}", loc),
|
||||
&None => String::new(),
|
||||
}));
|
||||
}
|
||||
Ok(())
|
||||
},
|
||||
Error::MissingToken(ref err) =>
|
||||
writeln!(f, "Token retrieval failed with error: {}", err),
|
||||
Error::Cancelled =>
|
||||
@@ -459,6 +474,16 @@ impl<'a> Read for MultiPartReader<'a> {
|
||||
header!{
|
||||
#[doc="The `X-Upload-Content-Type` header."]
|
||||
(XUploadContentType, "X-Upload-Content-Type") => [Mime]
|
||||
|
||||
xupload_content_type {
|
||||
test_header!(
|
||||
test1,
|
||||
vec![b"text/plain"],
|
||||
Some(HeaderField(
|
||||
vec![Mime(TopLevel::Text, SubLevel::Plain, Vec::new())]
|
||||
)));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Debug)]
|
||||
@@ -576,7 +601,7 @@ pub struct ResumableUploadHelper<'a, A: 'a> {
|
||||
impl<'a, A> ResumableUploadHelper<'a, A>
|
||||
where A: oauth2::GetToken {
|
||||
|
||||
fn query_transfer_status(&mut self) -> std::result::Result<u64, hyper::HttpResult<hyper::client::Response>> {
|
||||
fn query_transfer_status(&mut self) -> std::result::Result<u64, hyper::Result<hyper::client::Response>> {
|
||||
loop {
|
||||
match self.client.post(self.url)
|
||||
.header(UserAgent(self.user_agent.to_string()))
|
||||
@@ -612,7 +637,7 @@ impl<'a, A> ResumableUploadHelper<'a, A>
|
||||
/// returns None if operation was cancelled by delegate, or the HttpResult.
|
||||
/// It can be that we return the result just because we didn't understand the status code -
|
||||
/// caller should check for status himself before assuming it's OK to use
|
||||
pub fn upload(&mut self) -> Option<hyper::HttpResult<hyper::client::Response>> {
|
||||
pub fn upload(&mut self) -> Option<hyper::Result<hyper::client::Response>> {
|
||||
let mut start = match self.start_at {
|
||||
Some(s) => s,
|
||||
None => match self.query_transfer_status() {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file was generated automatically from 'src/mako/api/lib.rs.mako'
|
||||
// DO NOT EDIT !
|
||||
|
||||
//! This documentation was generated from *translate* crate version *0.1.6+20141123*, where *20141123* is the exact revision of the *translate:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.6*.
|
||||
//! This documentation was generated from *translate* crate version *0.1.7+20141123*, where *20141123* is the exact revision of the *translate:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.7*.
|
||||
//!
|
||||
//! Everything else about the *translate* *v2* API can be found at the
|
||||
//! [official documentation site](https://developers.google.com/translate/v2/using_rest).
|
||||
@@ -162,7 +162,7 @@
|
||||
//!
|
||||
//! * [PODs][wiki-pod] are handed by copy
|
||||
//! * strings are passed as `&str`
|
||||
//! * [request values](trait.RequestValue.html) are borrowed
|
||||
//! * [request values](trait.RequestValue.html) are moved
|
||||
//!
|
||||
//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
|
||||
//!
|
||||
@@ -171,7 +171,6 @@
|
||||
//! [google-go-api]: https://github.com/google/google-api-go-client
|
||||
//!
|
||||
//!
|
||||
#![feature(std_misc)]
|
||||
// Unused attributes happen thanks to defined, but unused structures
|
||||
// We don't warn about this, as depending on the API, some data structures or facilities are never used.
|
||||
// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any
|
||||
@@ -187,6 +186,7 @@ extern crate serde;
|
||||
extern crate yup_oauth2 as oauth2;
|
||||
extern crate mime;
|
||||
extern crate url;
|
||||
extern crate json_tools;
|
||||
|
||||
mod cmn;
|
||||
|
||||
@@ -281,7 +281,7 @@ impl<'a, C, A> Translate<C, A>
|
||||
Translate {
|
||||
client: RefCell::new(client),
|
||||
auth: RefCell::new(authenticator),
|
||||
_user_agent: "google-api-rust-client/0.1.6".to_string(),
|
||||
_user_agent: "google-api-rust-client/0.1.7".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ impl<'a, C, A> Translate<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.6`.
|
||||
/// It defaults to `google-api-rust-client/0.1.7`.
|
||||
///
|
||||
/// Returns the previously set user-agent.
|
||||
pub fn user_agent(&mut self, agent_name: String) -> String {
|
||||
@@ -707,7 +707,7 @@ impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
||||
|
||||
if params.len() > 0 {
|
||||
url.push('?');
|
||||
url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_ref()))));
|
||||
url.push_str(&url::form_urlencoded::serialize(params));
|
||||
}
|
||||
|
||||
|
||||
@@ -715,7 +715,7 @@ impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
||||
loop {
|
||||
let mut req_result = {
|
||||
let mut client = &mut *self.hub.client.borrow_mut();
|
||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||
.header(UserAgent(self.hub._user_agent.clone()));
|
||||
|
||||
dlg.pre_request();
|
||||
@@ -902,7 +902,7 @@ impl<'a, C, A> DetectionListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
||||
|
||||
if params.len() > 0 {
|
||||
url.push('?');
|
||||
url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_ref()))));
|
||||
url.push_str(&url::form_urlencoded::serialize(params));
|
||||
}
|
||||
|
||||
|
||||
@@ -910,7 +910,7 @@ impl<'a, C, A> DetectionListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
||||
loop {
|
||||
let mut req_result = {
|
||||
let mut client = &mut *self.hub.client.borrow_mut();
|
||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||
.header(UserAgent(self.hub._user_agent.clone()));
|
||||
|
||||
dlg.pre_request();
|
||||
@@ -1122,7 +1122,7 @@ impl<'a, C, A> TranslationListCall<'a, C, A> where C: BorrowMut<hyper::Client>,
|
||||
|
||||
if params.len() > 0 {
|
||||
url.push('?');
|
||||
url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_ref()))));
|
||||
url.push_str(&url::form_urlencoded::serialize(params));
|
||||
}
|
||||
|
||||
|
||||
@@ -1130,7 +1130,7 @@ impl<'a, C, A> TranslationListCall<'a, C, A> where C: BorrowMut<hyper::Client>,
|
||||
loop {
|
||||
let mut req_result = {
|
||||
let mut client = &mut *self.hub.client.borrow_mut();
|
||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||
.header(UserAgent(self.hub._user_agent.clone()));
|
||||
|
||||
dlg.pre_request();
|
||||
|
||||
Reference in New Issue
Block a user