Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2c79f6e

Browse files
committed
feat(doit): authentication with and without scopes
It's quite rough around the edges, but has a slight chance to work. Will still to handle return values accordingly.
1 parent 1349c78 commit 2c79f6e

8 files changed

Lines changed: 2024 additions & 433 deletions

File tree

gen/youtube3/src/cmn.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,19 @@ struct JsonServerError {
5555
/// uploading media
5656
pub trait Delegate {
5757

58-
/// Called whenever there is an HttpError, usually if there are network problems.
58+
/// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems.
5959
///
6060
/// Return retry information.
61-
fn connection_error(&mut self, hyper::HttpError) -> oauth2::Retry {
61+
fn http_error(&mut self, &hyper::HttpError) -> oauth2::Retry {
6262
oauth2::Retry::Abort
6363
}
64+
65+
/// Called whenever there is the need for your applications API key after
66+
/// the official authenticator implementation didn't provide one, for some reason.
67+
/// If this method returns None as well, the underlying operation will fail
68+
fn api_key(&mut self) -> Option<String> {
69+
None
70+
}
6471
}
6572

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

84+
/// We needed an API key for authentication, but didn't obtain one.
85+
/// Neither through the authenticator, nor through the Delegate.
86+
MissingAPIKey,
87+
88+
/// We required a Token, but didn't get one from the Authenticator
89+
MissingToken,
90+
7791
/// An additional, free form field clashed with one of the built-in optional ones
7892
FieldClash(&'static str),
7993

8094
/// It worked !
8195
Success(T),
82-
}
96+
}

0 commit comments

Comments
 (0)