From 85b12dd3e87ac1afe7ad9bff3d10d8a61a9b9c28 Mon Sep 17 00:00:00 2001 From: Lewin Bormann Date: Wed, 31 Aug 2016 20:01:24 +0200 Subject: [PATCH] refactor(common): Rename common -> types --- src/authenticator.rs | 6 +++--- src/authenticator_delegate.rs | 2 +- src/device.rs | 2 +- src/installed.rs | 2 +- src/lib.rs.in | 10 ++++++---- src/refresh.rs | 2 +- src/storage.rs | 2 +- src/{common.rs => types.rs} | 1 - 8 files changed, 14 insertions(+), 13 deletions(-) rename src/{common.rs => types.rs} (99%) diff --git a/src/authenticator.rs b/src/authenticator.rs index 510a8f49b..8a58e7de1 100644 --- a/src/authenticator.rs +++ b/src/authenticator.rs @@ -8,7 +8,7 @@ use std::fmt; use std::convert::From; use authenticator_delegate::{AuthenticatorDelegate, PollError, PollInformation}; -use common::{RequestError, Token, FlowType, ApplicationSecret}; +use types::{RequestError, Token, FlowType, ApplicationSecret}; use device::DeviceFlow; use installed::{InstalledFlow, InstalledFlowReturnMethod}; use refresh::{RefreshResult, RefreshFlow}; @@ -368,8 +368,8 @@ pub enum Retry { mod tests { use super::*; use super::super::device::tests::MockGoogleAuth; - use super::super::common::tests::SECRET; - use super::super::common::ConsoleApplicationSecret; + use super::super::types::tests::SECRET; + use super::super::types::ConsoleApplicationSecret; use storage::MemoryStorage; use std::default::Default; use hyper; diff --git a/src/authenticator_delegate.rs b/src/authenticator_delegate.rs index 7be4e3461..381ec153c 100644 --- a/src/authenticator_delegate.rs +++ b/src/authenticator_delegate.rs @@ -5,7 +5,7 @@ use std::io; use std::error::Error; use authenticator::Retry; -use common::RequestError; +use types::RequestError; use chrono::{DateTime, Local, UTC}; use std::time::Duration; diff --git a/src/device.rs b/src/device.rs index b05f790e8..de86258b0 100644 --- a/src/device.rs +++ b/src/device.rs @@ -12,7 +12,7 @@ use std::borrow::BorrowMut; use std::io::Read; use std::i64; -use common::{Token, FlowType, Flow, RequestError, JsonError}; +use types::{Token, FlowType, Flow, RequestError, JsonError}; use authenticator_delegate::{PollError, PollInformation}; pub const GOOGLE_TOKEN_URL: &'static str = "https://accounts.google.com/o/oauth2/token"; diff --git a/src/installed.rs b/src/installed.rs index c6f202260..300f84ea3 100644 --- a/src/installed.rs +++ b/src/installed.rs @@ -19,7 +19,7 @@ use serde_json::error; use url::form_urlencoded; use url::percent_encoding::{percent_encode, QUERY_ENCODE_SET}; -use common::{ApplicationSecret, Token}; +use types::{ApplicationSecret, Token}; use authenticator_delegate::AuthenticatorDelegate; const OOB_REDIRECT_URI: &'static str = "urn:ietf:wg:oauth:2.0:oob"; diff --git a/src/lib.rs.in b/src/lib.rs.in index 4dcadd200..20f57c213 100644 --- a/src/lib.rs.in +++ b/src/lib.rs.in @@ -12,19 +12,21 @@ extern crate mime; extern crate url; extern crate itertools; -mod authenticator_delegate; mod authenticator; +mod authenticator_delegate; mod device; -mod storage; +mod helper; mod installed; mod refresh; -mod common; +mod storage; +mod types; pub use device::DeviceFlow; pub use refresh::{RefreshFlow, RefreshResult}; -pub use common::{Token, FlowType, ApplicationSecret, ConsoleApplicationSecret, Scheme, TokenType}; +pub use types::{Token, FlowType, ApplicationSecret, ConsoleApplicationSecret, Scheme, TokenType}; pub use installed::{InstalledFlow, InstalledFlowReturnMethod}; pub use storage::{TokenStorage, NullStorage, MemoryStorage, DiskTokenStorage}; pub use authenticator::{Authenticator, Retry, GetToken}; pub use authenticator_delegate::{AuthenticatorDelegate, DefaultAuthenticatorDelegate, PollError, PollInformation}; +pub use helper::*; diff --git a/src/refresh.rs b/src/refresh.rs index 30edf8531..2460b0275 100644 --- a/src/refresh.rs +++ b/src/refresh.rs @@ -1,4 +1,4 @@ -use common::{FlowType, JsonError}; +use types::{FlowType, JsonError}; use device::GOOGLE_TOKEN_URL; use chrono::UTC; diff --git a/src/storage.rs b/src/storage.rs index 2794cab98..41ddf4acd 100644 --- a/src/storage.rs +++ b/src/storage.rs @@ -12,7 +12,7 @@ use std::fs; use std::io; use std::io::{Read, Write}; -use common::Token; +use types::Token; /// Implements a specialized storage to set and retrieve `Token` instances. /// The `scope_hash` represents the signature of the scopes for which the given token diff --git a/src/common.rs b/src/types.rs similarity index 99% rename from src/common.rs rename to src/types.rs index d73d100cc..02d59cdfc 100644 --- a/src/common.rs +++ b/src/types.rs @@ -244,7 +244,6 @@ pub struct ConsoleApplicationSecret { pub installed: Option, } - #[cfg(test)] pub mod tests { use super::*;