Documentation
¶
Index ¶
Constants ¶
const BaseURL = "https://api.twitch.tv/helix"
BaseURL is the API path that will never change.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { ID string RateLimiter *RateLimiter Self User // contains filtered or unexported fields }
Client stores an API ClientID and OAuth Token
func (*Client) GetOwnUser ¶
GetOwnUser retrieves a Twitch User object based on the clients OAuth Token.
func (*Client) GetStreams ¶
func (client *Client) GetStreams(opts StreamOpts) (*StreamsData, error)
GetStreams retrieves a list of stream objects based on the specified StreamOpts.
type IHelix ¶
type IHelix interface { Request(string, string, interface{}) (request.HTTPResponse, error) GetOwnUser() (*User, error) GetUsers(UserOpts) (*UsersData, error) GetStreams(StreamOpts) (*StreamsData, error) }
IHelix contains all methods available to the Helix API Client.
type IRateLimiter ¶
type IRateLimiter interface { Enqueue(*request.HTTPRequest) (request.HTTPResponse, error) Close() }
IRateLimiter contains all methods available to the RateLimiter.
type Pagination ¶
type Pagination struct {
Cursor string `json:"cursor"`
}
Pagination stores a cursor for the Twitch Helix API.
type RateLimiter ¶
type RateLimiter struct { Bucket int Remaining int Reset time.Time // contains filtered or unexported fields }
RateLimiter stores data used to keep track of the Twitch API Ratelimit.
func (*RateLimiter) Close ¶
func (limiter *RateLimiter) Close()
Close frees resources used by the RateLimiter.
func (*RateLimiter) Enqueue ¶
func (limiter *RateLimiter) Enqueue(req *request.HTTPRequest) (request.HTTPResponse, error)
Enqueue queues a HTTP request for when the Twitch API will allow it to go through.
type Stream ¶
type Stream struct { ID string `json:"id"` UserID string `json:"user_id"` Login string `json:"user_name"` GameID string `json:"game_id"` Title string `json:"title"` ThumbnailURL string `json:"thumbnail_url"` TagIDs []string `json:"tag_ids"` Language string `json:"language"` ViewerCount int `json:"viewer_count"` Type string `json:"type"` StartedAt string `json:"started_at"` }
Stream stores data about a livestream on Twitch.
type StreamOpts ¶
type StreamOpts struct { First int UserIDs []string UserLogins []string GameIDs []string Languages []string After Pagination Before Pagination }
StreamOpts stores options for requests to the Twitch Streams API.
type StreamsData ¶
type StreamsData struct { Data []Stream `json:"data"` Pagination Pagination `json:"pagination"` }
StreamsData stores a list of streams returned by the Twitch Streams API.
type User ¶
type User struct { ID string `json:"id"` Login string `json:"login"` DisplayName string `json:"display_name"` Description string `json:"description"` ProfileImageURL string `json:"profile_image_url"` OfflineImageURL string `json:"offline_image_url"` Email string `json:"email"` ViewCount int `json:"view_count"` BroadcasterType string `json:"broadcaster_type"` Type string `json:"type"` }
User stores data about a user on Twitch.