diff --git a/client_oauth_authentication.go b/client_oauth_authentication.go index 1bb2eec..d3fa377 100644 --- a/client_oauth_authentication.go +++ b/client_oauth_authentication.go @@ -12,13 +12,13 @@ import ( // and takes care of authenticating OAuth RPC requests on behalf of a client // (i.e GetBalance()) type clientOAuthAuthentication struct { - Tokens *oauthTokens + Tokens *OauthTokens BaseUrl string Client http.Client } // ClientOAuth instantiates ClientOAuthAuthentication with the client OAuth tokens -func clientOAuth(tokens *oauthTokens) *clientOAuthAuthentication { +func clientOAuth(tokens *OauthTokens) *clientOAuthAuthentication { a := clientOAuthAuthentication{ Tokens: tokens, BaseUrl: config.BaseUrl, diff --git a/coinbase.go b/coinbase.go index df71a11..ab23b1d 100644 --- a/coinbase.go +++ b/coinbase.go @@ -24,7 +24,7 @@ func ApiKeyClient(key string, secret string) Client { } // OAuthClient instantiates the client with OAuth Authentication -func OAuthClient(tokens *oauthTokens) Client { +func OAuthClient(tokens *OauthTokens) Client { c := Client{ rpc: rpc{ auth: clientOAuth(tokens), diff --git a/oauth.go b/oauth.go index 92bda03..c56d990 100644 --- a/oauth.go +++ b/oauth.go @@ -52,26 +52,26 @@ func (o OAuth) CreateAuthorizeUrl(scope []string) string { } // RefreshTokens refreshes a users existing OAuth tokens -func (o OAuth) RefreshTokens(oldTokens map[string]interface{}) (*oauthTokens, error) { +func (o OAuth) RefreshTokens(oldTokens map[string]interface{}) (*OauthTokens, error) { refresh_token := oldTokens["refresh_token"].(string) return o.GetTokens(refresh_token, "refresh_token") } // NewTokens generates new tokens for an OAuth user -func (o OAuth) NewTokens(code string) (*oauthTokens, error) { +func (o OAuth) NewTokens(code string) (*OauthTokens, error) { return o.GetTokens(code, "authorization_code") } // NewTokensRequest generates new tokens for OAuth user given an http request // containing the query parameter 'code' -func (o OAuth) NewTokensFromRequest(req *http.Request) (*oauthTokens, error) { +func (o OAuth) NewTokensFromRequest(req *http.Request) (*OauthTokens, error) { query := req.URL.Query() code := query.Get("code") return o.GetTokens(code, "authorization_code") } // GetTokens gets tokens for an OAuth user specifying a grantType (i.e authorization_code) -func (o OAuth) GetTokens(code string, grantType string) (*oauthTokens, error) { +func (o OAuth) GetTokens(code string, grantType string) (*OauthTokens, error) { postVars := map[string]string{ "grant_type": grantType, @@ -91,7 +91,7 @@ func (o OAuth) GetTokens(code string, grantType string) (*oauthTokens, error) { return nil, err } - tokens := oauthTokens{ + tokens := OauthTokens{ AccessToken: holder.AccessToken, RefreshToken: holder.RefreshToken, ExpireTime: time.Now().UTC().Unix() + holder.ExpiresIn, diff --git a/params.go b/params.go index 3d2db60..cf2ee1b 100644 --- a/params.go +++ b/params.go @@ -41,8 +41,8 @@ type ContactsParams struct { Query string `json:"query,omitempty"` } -// The OAuth Tokens Struct returned from OAuth Authentication -type oauthTokens struct { +// OauthTokens the OAuth Tokens Struct returned from OAuth Authentication +type OauthTokens struct { AccessToken string RefreshToken string ExpireTime int64