Documentation ¶
Index ¶
- func HttpClientFactory(authenticator AuthenticatorInterface) *http.Client
- func ToString(value interface{}) string
- type AccessToken
- type Anonymous
- type AnonymousAuthenticator
- type ApiKey
- type ApiKeyAuthenticator
- type AuthenticatorInterface
- type ClientAbstract
- type CredentialsInterface
- type FieldPart
- type FilePart
- type FileTokenStore
- type HttpBasic
- type HttpBasicAuthenticator
- type HttpBearer
- type HttpBearerAuthenticator
- type MemoryTokenStore
- type Multipart
- type OAuth2
- type OAuth2Authenticator
- func (authenticator *OAuth2Authenticator) BuildRedirectUrl(redirectUrl string, scopes []string, state string) (string, error)
- func (authenticator *OAuth2Authenticator) FetchAccessTokenByClientCredentials() (AccessToken, error)
- func (authenticator *OAuth2Authenticator) FetchAccessTokenByCode(code string) (AccessToken, error)
- func (authenticator *OAuth2Authenticator) FetchAccessTokenByRefresh(refreshToken string) (AccessToken, error)
- func (authenticator *OAuth2Authenticator) GetAccessToken(automaticRefresh bool, expireThreshold int64) (string, error)
- func (authenticator *OAuth2Authenticator) ParseTokenResponse(resp *http.Response) (AccessToken, error)
- func (authenticator *OAuth2Authenticator) RoundTrip(req *http.Request) (*http.Response, error)
- type Parser
- func (parser *Parser) Contains(haystack []string, needle string) bool
- func (parser *Parser) Parse(data string, model *interface{}) error
- func (parser *Parser) Query(parameters map[string]interface{}) url.Values
- func (parser *Parser) QueryWithStruct(parameters map[string]interface{}, structNames []string) url.Values
- func (parser *Parser) SubstituteParameters(path string, parameters map[string]interface{}) string
- func (parser *Parser) Url(path string, parameters map[string]interface{}) string
- type TagAbstract
- type TokenStoreInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HttpClientFactory ¶
func HttpClientFactory(authenticator AuthenticatorInterface) *http.Client
Types ¶
type AccessToken ¶
type AccessToken struct { TokenType string `json:"token_type"` AccessToken string `json:"access_token"` ExpiresIn int64 `json:"expires_in"` RefreshToken string `json:"refresh_token"` Scope string `json:"scope"` }
func (*AccessToken) GetExpiresInTimestamp ¶
func (accessToken *AccessToken) GetExpiresInTimestamp() int64
type Anonymous ¶
type Anonymous struct {
CredentialsInterface
}
type AnonymousAuthenticator ¶
type AnonymousAuthenticator struct { }
type ApiKeyAuthenticator ¶
type ApiKeyAuthenticator struct {
Credentials ApiKey
}
type AuthenticatorInterface ¶
type AuthenticatorInterface interface { http.RoundTripper RoundTrip(*http.Request) (*http.Response, error) }
func AuthenticatorFactory ¶
func AuthenticatorFactory(credentials CredentialsInterface) (AuthenticatorInterface, error)
type ClientAbstract ¶
type ClientAbstract struct { Authenticator AuthenticatorInterface HttpClient *http.Client Parser *Parser }
func NewClient ¶
func NewClient(baseUrl string, credentials CredentialsInterface) (*ClientAbstract, error)
type CredentialsInterface ¶
type CredentialsInterface interface { }
type FileTokenStore ¶
type FileTokenStore struct {
// contains filtered or unexported fields
}
func NewFileTokenStore ¶
func NewFileTokenStore(path string) FileTokenStore
func (FileTokenStore) Get ¶
func (store FileTokenStore) Get() (AccessToken, error)
func (FileTokenStore) Persist ¶
func (store FileTokenStore) Persist(token AccessToken) error
func (FileTokenStore) Remove ¶
func (store FileTokenStore) Remove() error
type HttpBasic ¶
type HttpBasic struct { CredentialsInterface UserName string Password string }
type HttpBasicAuthenticator ¶
type HttpBasicAuthenticator struct {
Credentials HttpBasic
}
type HttpBearer ¶
type HttpBearer struct { CredentialsInterface Token string }
type HttpBearerAuthenticator ¶
type HttpBearerAuthenticator struct {
Credentials HttpBearer
}
type MemoryTokenStore ¶
type MemoryTokenStore struct {
Token AccessToken
}
func NewMemoryTokenStore ¶
func NewMemoryTokenStore() MemoryTokenStore
func (MemoryTokenStore) Get ¶
func (store MemoryTokenStore) Get() (AccessToken, error)
func (MemoryTokenStore) Persist ¶
func (store MemoryTokenStore) Persist(token AccessToken) error
func (MemoryTokenStore) Remove ¶
func (store MemoryTokenStore) Remove() error
type Multipart ¶
type Multipart struct {
// contains filtered or unexported fields
}
func (*Multipart) GetContentType ¶
type OAuth2 ¶
type OAuth2 struct { CredentialsInterface ClientId string ClientSecret string TokenUrl string AuthorizationUrl string TokenStore TokenStoreInterface Scopes []string }
type OAuth2Authenticator ¶
type OAuth2Authenticator struct {
Credentials OAuth2
}
func (*OAuth2Authenticator) BuildRedirectUrl ¶
func (*OAuth2Authenticator) FetchAccessTokenByClientCredentials ¶
func (authenticator *OAuth2Authenticator) FetchAccessTokenByClientCredentials() (AccessToken, error)
func (*OAuth2Authenticator) FetchAccessTokenByCode ¶
func (authenticator *OAuth2Authenticator) FetchAccessTokenByCode(code string) (AccessToken, error)
func (*OAuth2Authenticator) FetchAccessTokenByRefresh ¶
func (authenticator *OAuth2Authenticator) FetchAccessTokenByRefresh(refreshToken string) (AccessToken, error)
func (*OAuth2Authenticator) GetAccessToken ¶
func (authenticator *OAuth2Authenticator) GetAccessToken(automaticRefresh bool, expireThreshold int64) (string, error)
func (*OAuth2Authenticator) ParseTokenResponse ¶
func (authenticator *OAuth2Authenticator) ParseTokenResponse(resp *http.Response) (AccessToken, error)
type Parser ¶
type Parser struct {
BaseUrl string
}
func (*Parser) QueryWithStruct ¶
func (*Parser) SubstituteParameters ¶
type TagAbstract ¶
type TokenStoreInterface ¶
type TokenStoreInterface interface { Get() (AccessToken, error) Persist(token AccessToken) error Remove() error }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.