Skip to content

Commit

Permalink
chore(youtube): add latest version
Browse files Browse the repository at this point in the history
* json takes delegate errors
  • Loading branch information
Byron committed Mar 20, 2015
1 parent 8d9f175 commit 9abf0eb
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 36 deletions.
1 change: 1 addition & 0 deletions gen/youtube3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ match result {
Result::MissingToken => println!("Missing Token"),
Result::Failure(_) => println!("General Failure (Response doesn't print)"),
Result::FieldClash(clashed_field) => println!("FIELD CLASH: {:?}", clashed_field),
Result::JsonDecodeError(err) => println!("Json failed to decode: {:?}", err),
Result::Success(_) => println!("Success (value doesn't print)"),
}

Expand Down
16 changes: 16 additions & 0 deletions gen/youtube3/src/cmn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// DO NOT EDIT
use std::marker::MarkerTrait;
use std::io::{self, Read, Seek, Cursor, Write, SeekFrom};
use std;

use mime::{Mime, TopLevel, SubLevel, Attr, Value};
use oauth2;
Expand All @@ -10,6 +11,8 @@ use hyper::header::{ContentType, ContentLength, Headers};
use hyper::http::LINE_ENDING;
use hyper::method::Method;

use serde;

/// Identifies the Hub. There is only one per library, this trait is supposed
/// to make intended use more explicit.
/// The hub allows to access all resource methods more easily.
Expand All @@ -31,6 +34,10 @@ pub trait ResponseResult: MarkerTrait {}
/// Identifies types which are used in API requests.
pub trait RequestValue: MarkerTrait {}

/// Identifies types which are not actually used by the API
/// This might be a bug within the google API schema.
pub trait UnusedType: MarkerTrait {}

/// Identifies types which are only used as part of other types, which
/// usually are carrying the `Resource` trait.
pub trait Part: MarkerTrait {}
Expand Down Expand Up @@ -88,6 +95,11 @@ pub trait Delegate {
None
}

/// Called whenever a server response could not be decoded from json.
/// It's for informational purposes only, the caller will return with an error
/// accordingly.
fn response_json_decode_error(&mut self, json_encoded_value: &str) {}

/// Called whenever the http request returns with a non-success status code.
/// This can involve authentication issues, or anything else that very much
/// depends on the used API method.
Expand Down Expand Up @@ -132,6 +144,10 @@ pub enum Result<T = ()> {
/// An additional, free form field clashed with one of the built-in optional ones
FieldClash(&'static str),

/// 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),

/// Indicates an HTTP repsonse with a non-success status code
Failure(hyper::client::Response),

Expand Down
Loading

0 comments on commit 9abf0eb

Please sign in to comment.