Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthorizationCode ¶
type AuthorizationCode string
type OAuthClient ¶
type OAuthClient struct {
// contains filtered or unexported fields
}
func NewOAuthClient ¶
func NewOAuthClient(restClient rest.Requester) *OAuthClient
func (*OAuthClient) Authenticate ¶
func (o *OAuthClient) Authenticate(p OAuthParams) (OAuthToken, error)
NOTE Rather than returning a pointer set to nil, Use comma ok idiom return a boolean and a value type
func (*OAuthClient) RefreshToken ¶
func (o *OAuthClient) RefreshToken(p OAuthParams, refreshToken string) (OAuthToken, error)
type OAuthParams ¶
type OAuthToken ¶
type OAuthToken struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
Scope string `json:"scope"`
ExpiresIn int `json:"expires_in"`
//will be used when saving the token on local storage
ExpiresAt time.Time `json:"expires_at"`
}
func (*OAuthToken) IsExpired ¶
func (t *OAuthToken) IsExpired() bool
NOTE Go uses parameters of pointer type to indicate that a parameter might be modified by the function. The same rules apply for method receivers, too.
--> If your method modifies the receiver, you must use a pointer receiver --> If your method needs to handle nil instances, then it must use a pointer receiver --> If your method doesn't modify the receiver you can use a value receiver.
notice that if we had used a value receiver, there wouldn't be a way to mutate the receiver... however, we don't need to modify the receiver within this method.