twitch

package
v0.0.0-...-cbb24c1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2018 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ErrorCodeUnknown        = 900
	ErrorCodeInvalidRequest = 901
	ErrorCodeApiFailure     = 910
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiClient

type ApiClient struct {
	RateLimitRetries int
	DefaultAuthToken string
	// contains filtered or unexported fields
}

func NewApiClient

func NewApiClient(client *http.Client, clientID string) *ApiClient

func (*ApiClient) MakeRequest

func (t *ApiClient) MakeRequest(spec IRequest) ([]byte, *RateLimit, *TwitchApiError)

type AuthType

type AuthType int
const (
	AuthTypeOAuth  AuthType = 0
	AuthTypeBearer AuthType = 1
)

type IRequest

type IRequest interface {
	GetBaseURL() string
	GetPath() string
	GetQueryParams() map[string][]string

	GetRemoveClientID() bool
	GetAuthToken() string
	GetAuthType() AuthType
	GetAcceptHeader() string
}

func UnmarshalRequest

func UnmarshalRequest(data []byte) (IRequest, error)

type IRequestBuilder

type IRequestBuilder interface {
	Get() IRequest

	WithAuthToken(string) IRequestBuilder
	WithAcceptHeader(string) IRequestBuilder
	WithoutClientID() IRequestBuilder

	WithParamString(name string, value string) IRequestBuilder
	WithParamStringArray(name string, value []string) IRequestBuilder
	WithParamInt(name string, value int) IRequestBuilder
	WithParamIntArray(name string, value []int) IRequestBuilder
}

func NewRequestBuilder

func NewRequestBuilder(baseURL string, authType AuthType, path string) IRequestBuilder

type RateLimit

type RateLimit struct {
	Limit     int
	Remaining int
	Reset     time.Time
}

type TwitchApiError

type TwitchApiError struct {
	Code       int
	Message    string
	InnerError error
}

func (*TwitchApiError) Error

func (e *TwitchApiError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL