Documentation
¶
Index ¶
- Constants
- func Bool(b bool) *bool
- func BoolValue(b *bool) bool
- func Float64(f float64) *float64
- func Float64Value(f *float64) float64
- func GenerateBearerToken(c IClient, apiKey, apiKeySecret string) (string, error)
- func Int(i int) *int
- func IntValue(i *int) int
- func NewMockHTTPClient(in *MockInput) *http.Client
- func String(s string) *string
- func StringValue(s *string) string
- func Time(t time.Time) *time.Time
- func TimeValue(t *time.Time) time.Time
- type AuthenticationMethod
- type Client
- func (c *Client) APIKey() string
- func (c *Client) APIKeySecret() string
- func (c *Client) AccessToken() string
- func (c *Client) AuthenticationMethod() AuthenticationMethod
- func (c *Client) CallAPI(ctx context.Context, endpoint, method string, p util.Parameters, ...) error
- func (c *Client) Exec(req *http.Request, i util.Response) (*resources.Non2XXError, error)
- func (c *Client) IsReady() bool
- func (c *Client) OAuthConsumerKey() string
- func (c *Client) OAuthToken() string
- func (c *Client) SetAccessToken(v string)
- func (c *Client) SetAuthenticationMethod(v AuthenticationMethod)
- func (c *Client) SetOAuthConsumerKey(v string)
- func (c *Client) SetOAuthToken(v string)
- func (c *Client) SetSigningKey(v string)
- func (c *Client) SigningKey() string
- type ClientResponse
- type CreateOAuthSignatureInput
- type CreateOAuthSignatureOutput
- type Endpoint
- type EndpointInfo
- type GotwiError
- type IClient
- type MockAPIParameter
- type MockAPIResponse
- type MockFuncInput
- type MockGotwiClient
- func (m *MockGotwiClient) AccessToken() string
- func (m *MockGotwiClient) AuthenticationMethod() AuthenticationMethod
- func (m *MockGotwiClient) CallAPI(ctx context.Context, endpoint, method string, p util.Parameters, ...) error
- func (m *MockGotwiClient) Exec(req *http.Request, i util.Response) (*resources.Non2XXError, error)
- func (m *MockGotwiClient) IsReady() bool
- func (m *MockGotwiClient) OAuthConsumerKey() string
- func (m *MockGotwiClient) OAuthToken() string
- func (m *MockGotwiClient) SigningKey() string
- type MockInput
- type NewClientInput
- type NewClientWithAccessTokenInput
- type OAuth2TokenResponse
- type RoundTripFunc
- type StreamClient
- type TypedClient
- func (c *TypedClient[T]) AccessToken() string
- func (c *TypedClient[T]) AuthenticationMethod() AuthenticationMethod
- func (c *TypedClient[T]) CallAPI(ctx context.Context, endpoint, method string, p util.Parameters, ...) error
- func (c *TypedClient[T]) CallStreamAPI(ctx context.Context, endpoint, method string, p util.Parameters) (*StreamClient[T], error)
- func (c *TypedClient[T]) Exec(req *http.Request, i util.Response) (*resources.Non2XXError, error)
- func (c *TypedClient[T]) ExecStream(req *http.Request) (*http.Response, *resources.Non2XXError, error)
- func (c *TypedClient[T]) IsReady() bool
- func (c *TypedClient[T]) OAuthConsumerKey() string
- func (c *TypedClient[T]) OAuthToken() string
- func (c *TypedClient[T]) SigningKey() string
Constants ¶
View Source
const ( APIKeyEnvName = "GOTWI_API_KEY" APIKeySecretEnvName = "GOTWI_API_KEY_SECRET" )
View Source
const ( AuthenMethodOAuth1UserContext = "OAuth 1.0a User context" AuthenMethodOAuth2BearerToken = "OAuth 2.0 Bearer token" )
View Source
const ( OAuthVersion10 = "1.0" OAuthSignatureMethodHMACSHA1 = "HMAC-SHA1" )
View Source
const OAuth2TokenEndpoint = "https://api.twitter.com/oauth2/token"
Variables ¶
This section is empty.
Functions ¶
func Float64Value ¶ added in v0.9.0
func GenerateBearerToken ¶
func NewMockHTTPClient ¶ added in v0.18.1
func StringValue ¶ added in v0.6.0
Types ¶
type AuthenticationMethod ¶ added in v0.5.0
type AuthenticationMethod string
func (AuthenticationMethod) Valid ¶ added in v0.5.0
func (a AuthenticationMethod) Valid() bool
type Client ¶ added in v0.11.0
func NewClient ¶
func NewClient(in *NewClientInput) (*Client, error)
func NewClientWithAccessToken ¶ added in v0.11.0
func NewClientWithAccessToken(in *NewClientWithAccessTokenInput) (*Client, error)
func (*Client) APIKeySecret ¶ added in v0.16.0
func (*Client) AccessToken ¶ added in v0.11.0
func (*Client) AuthenticationMethod ¶ added in v0.11.0
func (c *Client) AuthenticationMethod() AuthenticationMethod
func (*Client) OAuthConsumerKey ¶ added in v0.11.0
func (*Client) OAuthToken ¶ added in v0.11.0
func (*Client) SetAccessToken ¶ added in v0.11.1
func (*Client) SetAuthenticationMethod ¶ added in v0.11.1
func (c *Client) SetAuthenticationMethod(v AuthenticationMethod)
func (*Client) SetOAuthConsumerKey ¶ added in v0.11.1
func (*Client) SetOAuthToken ¶ added in v0.11.1
func (*Client) SetSigningKey ¶ added in v0.11.1
func (*Client) SigningKey ¶ added in v0.11.0
type ClientResponse ¶
type CreateOAuthSignatureInput ¶ added in v0.9.5
type CreateOAuthSignatureOutput ¶ added in v0.9.5
type CreateOAuthSignatureOutput struct { OAuthNonce string OAuthSignatureMethod string OAuthTimestamp string OAuthVersion string OAuthSignature string }
func CreateOAuthSignature ¶ added in v0.5.1
func CreateOAuthSignature(in *CreateOAuthSignatureInput) (*CreateOAuthSignatureOutput, error)
type Endpoint ¶ added in v0.5.0
type Endpoint string
func (Endpoint) Detail ¶ added in v0.5.0
func (e Endpoint) Detail() (*EndpointInfo, error)
type EndpointInfo ¶ added in v0.5.0
type GotwiError ¶ added in v0.10.0
type GotwiError struct { OnAPI bool resources.Non2XXError // contains filtered or unexported fields }
func (*GotwiError) Error ¶ added in v0.10.0
func (e *GotwiError) Error() string
func (*GotwiError) Unwrap ¶ added in v0.10.0
func (e *GotwiError) Unwrap() error
type IClient ¶ added in v0.11.0
type IClient interface { Exec(req *http.Request, i util.Response) (*resources.Non2XXError, error) IsReady() bool AccessToken() string AuthenticationMethod() AuthenticationMethod OAuthToken() string OAuthConsumerKey() string SigningKey() string CallAPI(ctx context.Context, endpoint, method string, p util.Parameters, i util.Response) error }
type MockAPIParameter ¶ added in v0.18.1
type MockAPIParameter struct{}
func (MockAPIParameter) AccessToken ¶ added in v0.18.1
func (mp MockAPIParameter) AccessToken() string
func (MockAPIParameter) Body ¶ added in v0.18.1
func (mp MockAPIParameter) Body() (io.Reader, error)
func (MockAPIParameter) ParameterMap ¶ added in v0.18.1
func (mp MockAPIParameter) ParameterMap() map[string]string
func (MockAPIParameter) ResolveEndpoint ¶ added in v0.18.1
func (mp MockAPIParameter) ResolveEndpoint(endpointBase string) string
func (MockAPIParameter) SetAccessToken ¶ added in v0.18.1
func (mp MockAPIParameter) SetAccessToken(token string)
type MockAPIResponse ¶ added in v0.18.1
type MockAPIResponse struct{}
func (MockAPIResponse) HasPartialError ¶ added in v0.18.1
func (mr MockAPIResponse) HasPartialError() bool
type MockFuncInput ¶ added in v0.18.1
type MockFuncInput struct { MockExec func(req *http.Request, i util.Response) (*resources.Non2XXError, error) MockIsReady func() bool MockAccessToken func() string MockAuthenticationMethod func() AuthenticationMethod MockOAuthToken func() string MockOAuthConsumerKey func() string MockSigningKey func() string MockCallAPI func(ctx context.Context, endpoint, method string, p util.Parameters, i util.Response) error }
type MockGotwiClient ¶ added in v0.18.1
type MockGotwiClient struct { Client *http.Client MockExec func(req *http.Request, i util.Response) (*resources.Non2XXError, error) MockIsReady func() bool MockAccessToken func() string MockAuthenticationMethod func() AuthenticationMethod MockOAuthToken func() string MockOAuthConsumerKey func() string MockSigningKey func() string MockCallAPI func(ctx context.Context, endpoint, method string, p util.Parameters, i util.Response) error }
func NewMockGotwiClient ¶ added in v0.18.1
func NewMockGotwiClient(returnedToken string, execHasError, hasNot200Error bool) *MockGotwiClient
func NewMockGotwiClientWithFunc ¶ added in v0.18.1
func NewMockGotwiClientWithFunc(in MockFuncInput) *MockGotwiClient
func (*MockGotwiClient) AccessToken ¶ added in v0.18.1
func (m *MockGotwiClient) AccessToken() string
func (*MockGotwiClient) AuthenticationMethod ¶ added in v0.18.1
func (m *MockGotwiClient) AuthenticationMethod() AuthenticationMethod
func (*MockGotwiClient) CallAPI ¶ added in v0.18.1
func (m *MockGotwiClient) CallAPI(ctx context.Context, endpoint, method string, p util.Parameters, i util.Response) error
func (*MockGotwiClient) Exec ¶ added in v0.18.1
func (m *MockGotwiClient) Exec(req *http.Request, i util.Response) (*resources.Non2XXError, error)
func (*MockGotwiClient) IsReady ¶ added in v0.18.1
func (m *MockGotwiClient) IsReady() bool
func (*MockGotwiClient) OAuthConsumerKey ¶ added in v0.18.1
func (m *MockGotwiClient) OAuthConsumerKey() string
func (*MockGotwiClient) OAuthToken ¶ added in v0.18.1
func (m *MockGotwiClient) OAuthToken() string
func (*MockGotwiClient) SigningKey ¶ added in v0.18.1
func (m *MockGotwiClient) SigningKey() string
type MockInput ¶ added in v0.18.1
type MockInput struct { ResponseStatusCode int ResponseHeader map[string][]string ResponseBody io.ReadCloser }
type NewClientInput ¶ added in v0.11.0
type NewClientWithAccessTokenInput ¶ added in v0.11.0
type OAuth2TokenResponse ¶
type OAuth2TokenResponse struct { TokenType string `json:"token_type"` AccessToken string `json:"access_token"` }
func (OAuth2TokenResponse) HasPartialError ¶ added in v0.8.0
func (o OAuth2TokenResponse) HasPartialError() bool
type RoundTripFunc ¶ added in v0.18.1
type StreamClient ¶ added in v0.11.1
func (*StreamClient[T]) Read ¶ added in v0.11.1
func (s *StreamClient[T]) Read() (T, error)
func (*StreamClient[T]) Receive ¶ added in v0.11.1
func (s *StreamClient[T]) Receive() bool
func (*StreamClient[T]) Stop ¶ added in v0.11.1
func (s *StreamClient[T]) Stop()
type TypedClient ¶ added in v0.11.1
type TypedClient[T util.Response] struct { Client *http.Client // contains filtered or unexported fields }
func NewTypedClient ¶ added in v0.11.1
func NewTypedClient[T util.Response](c *Client) *TypedClient[T]
func (*TypedClient[T]) AccessToken ¶ added in v0.11.1
func (c *TypedClient[T]) AccessToken() string
func (*TypedClient[T]) AuthenticationMethod ¶ added in v0.11.1
func (c *TypedClient[T]) AuthenticationMethod() AuthenticationMethod
func (*TypedClient[T]) CallAPI ¶ added in v0.18.1
func (c *TypedClient[T]) CallAPI(ctx context.Context, endpoint, method string, p util.Parameters, i util.Response) error
This method exists only to satisfy the IClient interface. It will never be called directly since TypedClient uses its own implementation.
func (*TypedClient[T]) CallStreamAPI ¶ added in v0.11.1
func (c *TypedClient[T]) CallStreamAPI(ctx context.Context, endpoint, method string, p util.Parameters) (*StreamClient[T], error)
func (*TypedClient[T]) Exec ¶ added in v0.11.1
func (c *TypedClient[T]) Exec(req *http.Request, i util.Response) (*resources.Non2XXError, error)
func (*TypedClient[T]) ExecStream ¶ added in v0.11.1
func (c *TypedClient[T]) ExecStream(req *http.Request) (*http.Response, *resources.Non2XXError, error)
func (*TypedClient[T]) IsReady ¶ added in v0.11.1
func (c *TypedClient[T]) IsReady() bool
func (*TypedClient[T]) OAuthConsumerKey ¶ added in v0.11.1
func (c *TypedClient[T]) OAuthConsumerKey() string
func (*TypedClient[T]) OAuthToken ¶ added in v0.11.1
func (c *TypedClient[T]) OAuthToken() string
func (*TypedClient[T]) SigningKey ¶ added in v0.11.1
func (c *TypedClient[T]) SigningKey() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.