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 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 NewClientInput
- type NewClientWithAccessTokenInput
- type OAuth2TokenResponse
- type StreamClient
- type TypedClient
- func (c *TypedClient[T]) AccessToken() string
- func (c *TypedClient[T]) AuthenticationMethod() AuthenticationMethod
- 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 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 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 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]) 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.