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) 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 ¶
func GenerateBearerToken ¶
func StringValue ¶
Types ¶
type AuthenticationMethod ¶
type AuthenticationMethod string
func (AuthenticationMethod) Valid ¶
func (a AuthenticationMethod) Valid() bool
type Client ¶
func NewClient ¶
func NewClient(in *NewClientInput) (*Client, error)
func NewClientWithAccessToken ¶
func NewClientWithAccessToken(in *NewClientWithAccessTokenInput) (*Client, error)
func (*Client) AccessToken ¶
func (*Client) AuthenticationMethod ¶
func (c *Client) AuthenticationMethod() AuthenticationMethod
func (*Client) OAuthConsumerKey ¶
func (*Client) OAuthToken ¶
func (*Client) SetAccessToken ¶
func (*Client) SetAuthenticationMethod ¶
func (c *Client) SetAuthenticationMethod(v AuthenticationMethod)
func (*Client) SetOAuthConsumerKey ¶
func (*Client) SetOAuthToken ¶
func (*Client) SetSigningKey ¶
func (*Client) SigningKey ¶
type ClientResponse ¶
type CreateOAuthSignatureOutput ¶
type CreateOAuthSignatureOutput struct { OAuthNonce string OAuthSignatureMethod string OAuthTimestamp string OAuthVersion string OAuthSignature string }
func CreateOAuthSignature ¶
func CreateOAuthSignature(in *CreateOAuthSignatureInput) (*CreateOAuthSignatureOutput, error)
type Endpoint ¶
type Endpoint string
func (Endpoint) Detail ¶
func (e Endpoint) Detail() (*EndpointInfo, error)
type EndpointInfo ¶
type GotwiError ¶
type GotwiError struct { OnAPI bool resources.Non2XXError // contains filtered or unexported fields }
func (*GotwiError) Error ¶
func (e *GotwiError) Error() string
func (*GotwiError) Unwrap ¶
func (e *GotwiError) Unwrap() error
type NewClientInput ¶
type OAuth2TokenResponse ¶
type OAuth2TokenResponse struct { TokenType string `json:"token_type"` AccessToken string `json:"access_token"` }
func (OAuth2TokenResponse) HasPartialError ¶
func (o OAuth2TokenResponse) HasPartialError() bool
type StreamClient ¶
func (*StreamClient[T]) Read ¶
func (s *StreamClient[T]) Read() (T, error)
func (*StreamClient[T]) Receive ¶
func (s *StreamClient[T]) Receive() bool
func (*StreamClient[T]) Stop ¶
func (s *StreamClient[T]) Stop()
type TypedClient ¶
type TypedClient[T util.Response] struct { Client *http.Client // contains filtered or unexported fields }
func NewTypedClient ¶
func NewTypedClient[T util.Response](c *Client) *TypedClient[T]
func (*TypedClient[T]) AccessToken ¶
func (c *TypedClient[T]) AccessToken() string
func (*TypedClient[T]) AuthenticationMethod ¶
func (c *TypedClient[T]) AuthenticationMethod() AuthenticationMethod
func (*TypedClient[T]) CallStreamAPI ¶
func (c *TypedClient[T]) CallStreamAPI(ctx context.Context, endpoint, method string, p util.Parameters) (*StreamClient[T], error)
func (*TypedClient[T]) Exec ¶
func (c *TypedClient[T]) Exec(req *http.Request, i util.Response) (*resources.Non2XXError, error)
func (*TypedClient[T]) ExecStream ¶
func (c *TypedClient[T]) ExecStream(req *http.Request) (*http.Response, *resources.Non2XXError, error)
func (*TypedClient[T]) IsReady ¶
func (c *TypedClient[T]) IsReady() bool
func (*TypedClient[T]) OAuthConsumerKey ¶
func (c *TypedClient[T]) OAuthConsumerKey() string
func (*TypedClient[T]) OAuthToken ¶
func (c *TypedClient[T]) OAuthToken() string
func (*TypedClient[T]) SigningKey ¶
func (c *TypedClient[T]) SigningKey() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.