diff options
Diffstat (limited to 'src/datatype/auth.rs')
-rw-r--r-- | src/datatype/auth.rs | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/src/datatype/auth.rs b/src/datatype/auth.rs index cbfd097..83c872a 100644 --- a/src/datatype/auth.rs +++ b/src/datatype/auth.rs @@ -5,7 +5,7 @@ use std::borrow::Cow; #[derive(Clone, Debug)] pub enum Auth { None, - Credentials(ClientId, ClientSecret), + Credentials(ClientCredentials), Token(AccessToken), } @@ -16,8 +16,15 @@ impl<'a> Into<Cow<'a, Auth>> for Auth { } -/// For storage of the returned access token data following a successful -/// authentication. +/// Encapsulates the client id and secret used during authentication. +#[derive(Clone, PartialEq, Eq, Debug, RustcEncodable, RustcDecodable)] +pub struct ClientCredentials { + pub client_id: String, + pub client_secret: String, +} + + +/// Stores the returned access token data following a successful authentication. #[derive(RustcDecodable, Debug, PartialEq, Clone, Default)] pub struct AccessToken { pub access_token: String, @@ -31,19 +38,3 @@ impl<'a> Into<Cow<'a, AccessToken>> for AccessToken { Cow::Owned(self) } } - - -/// Encapsulates a `String` type for use in `Auth::Credentials` -#[derive(Clone, PartialEq, Eq, Debug, RustcEncodable, RustcDecodable)] -pub struct ClientId(pub String); - -/// Encapsulates a `String` type for use in `Auth::Credentials` -#[derive(Clone, PartialEq, Eq, Debug, RustcEncodable, RustcDecodable)] -pub struct ClientSecret(pub String); - -/// Encapsulates the client id and secret used during authentication. -#[derive(Clone, PartialEq, Eq, Debug, RustcEncodable, RustcDecodable)] -pub struct ClientCredentials { - pub client_id: ClientId, - pub client_secret: ClientSecret, -} |