Skip to content

Commit

Permalink
feat(doit): authentication with and without scopes
Browse files Browse the repository at this point in the history
It's quite rough around the edges, but has a slight chance to work.
Will still to handle return values accordingly.
  • Loading branch information
Byron committed Mar 16, 2015
1 parent 1349c78 commit 2c79f6e
Show file tree
Hide file tree
Showing 8 changed files with 2,024 additions and 433 deletions.
20 changes: 17 additions & 3 deletions gen/youtube3/src/cmn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,19 @@ struct JsonServerError {
/// uploading media
pub trait Delegate {

/// Called whenever there is an HttpError, usually if there are network problems.
/// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems.
///
/// Return retry information.
fn connection_error(&mut self, hyper::HttpError) -> oauth2::Retry {
fn http_error(&mut self, &hyper::HttpError) -> oauth2::Retry {
oauth2::Retry::Abort
}

/// Called whenever there is the need for your applications API key after
/// the official authenticator implementation didn't provide one, for some reason.
/// If this method returns None as well, the underlying operation will fail
fn api_key(&mut self) -> Option<String> {
None
}
}

#[derive(Default)]
Expand All @@ -74,9 +81,16 @@ pub enum Result<T = ()> {
/// The http connection failed
HttpError(hyper::HttpError),

/// We needed an API key for authentication, but didn't obtain one.
/// Neither through the authenticator, nor through the Delegate.
MissingAPIKey,

/// We required a Token, but didn't get one from the Authenticator
MissingToken,

/// An additional, free form field clashed with one of the built-in optional ones
FieldClash(&'static str),

/// It worked !
Success(T),
}
}
Loading

0 comments on commit 2c79f6e

Please sign in to comment.