Documentation
¶
Overview ¶
Package twitch fetches live streams, categories, and channels from Twitch via the public GQL API.
Index ¶
Constants ¶
View Source
const (
DefaultUserAgent = "Mozilla/5.0 (compatible; twitch-cli/dev; +https://github.com/tamnd/twitch-cli)"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Category ¶
type Category struct {
Rank int `json:"rank" csv:"rank" tsv:"rank"`
ID string `json:"id" csv:"id" tsv:"id"`
Name string `json:"name" csv:"name" tsv:"name"`
Slug string `json:"slug" csv:"slug" tsv:"slug"`
Viewers int `json:"viewers" csv:"viewers" tsv:"viewers"`
URL string `json:"url" csv:"url" tsv:"url"`
}
Category is a Twitch game/category.
type Channel ¶
type Channel struct {
Rank int `json:"rank" csv:"rank" tsv:"rank"`
ID string `json:"id" csv:"id" tsv:"id"`
Login string `json:"login" csv:"login" tsv:"login"`
DisplayName string `json:"display_name" csv:"display_name" tsv:"display_name"`
URL string `json:"url" csv:"url" tsv:"url"`
}
Channel is a Twitch channel.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the Twitch GQL API.
func (*Client) Categories ¶
Categories returns the top categories/games by viewer count.
func (*Client) SearchChannels ¶
Search searches for channels and games matching the query.
type Config ¶
type Config struct {
BaseURL string
ClientID string
Rate time.Duration
Timeout time.Duration
Retries int
UserAgent string
}
Config holds all tuneable client parameters.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns sensible defaults for the Twitch GQL API.
type Stream ¶
type Stream struct {
Rank int `json:"rank" csv:"rank" tsv:"rank"`
ID string `json:"id" csv:"id" tsv:"id"`
Title string `json:"title" csv:"title" tsv:"title"`
Game string `json:"game" csv:"game" tsv:"game"`
Channel string `json:"channel" csv:"channel" tsv:"channel"`
Viewers int `json:"viewers" csv:"viewers" tsv:"viewers"`
StartedAt string `json:"started_at" csv:"started_at" tsv:"started_at"`
URL string `json:"url" csv:"url" tsv:"url"`
}
Stream is a live Twitch stream.
Click to show internal directories.
Click to hide internal directories.