Documentation ¶
Index ¶
- type Client
- func (c Client) GetClips(i GetClipsInput) ([]ClipData, *Pagination, error)
- func (c Client) GetGameByName(names ...string) ([]GameData, error)
- func (c Client) GetGamesByID(ids ...string) ([]GameData, error)
- func (c Client) GetStreams(i GetStreamsInput) ([]StreamData, error)
- func (c Client) GetUsersByID(ids ...string) ([]UserData, error)
- func (c Client) GetUsersByLogin(names ...string) ([]UserData, error)
- type ClipData
- type GameData
- type GetClipsInput
- type GetStreamsInput
- type Pagination
- type StreamData
- type UserData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { ClientID string // contains filtered or unexported fields }
Client represents a client to interact with the twitch API
func (Client) GetClips ¶
func (c Client) GetClips(i GetClipsInput) ([]ClipData, *Pagination, error)
GetClips will get a list of clips The url query parameters are defined by the GetClipsInput struct
func (Client) GetGameByName ¶
GetGameByName will get info on games by name. Game name. The name must be an exact match. For instance, “Pokemon” will not return a list of Pokemon games; instead, query the specific Pokemon game(s) in which you are interested. This is a limitation by the twitch api At most 100 name values can be specified.
func (Client) GetGamesByID ¶
GetGamesByID will get info on games by id. At most 100 id values can be specified
func (Client) GetStreams ¶
func (c Client) GetStreams(i GetStreamsInput) ([]StreamData, error)
GetStreams will get a list of live streams The url query parameter are defined by the GetStreamsInput struct
func (Client) GetUsersByID ¶
GetUsersByID gets information about one or more specified Twitch users. Users are identified by ID. Limit are 100 users per request
type ClipData ¶
type ClipData struct { // ID of the clip being queried. ID string `json:"id"` // User ID of the stream from which the clip was created. BroadcasterID string `json:"broadcaster_id"` // Display name corresponding to broadcaster_id. BroadcasterName string `json:"broadcaster_name"` // Date when the clip was created. CreatedAt string `json:"created_at"` // ID of the user who created the clip. CreatorID string `json:"creator_id"` // Display name corresponding to creator_id. CreatorName string `json:"creator_name"` // URL to embed the clip. EmbedURL string `json:"embed_url"` // ID of the game assigned to the stream when the clip was created. GameID string `json:"game_id"` // Language of the stream from which the clip was created. Language string `json:"language"` // URL of the clip thumbnail. ThumbnailURL string `json:"thumbnail_url"` // Title of the clip. Title string `json:"title"` // URL where the clip can be viewed. URL string `json:"url"` // ID of the video from which the clip was created. VideoID string `json:"video_id"` // Number of times the clip has been viewed. ViewCount uint `json:"view_count"` }
ClipData represents the data in a single clip
type GameData ¶
type GameData struct { ID string `json:"id"` Name string `json:"name"` BoxArtURL string `json:"box_art_url"` }
GameData represents the data of a single game
type GetClipsInput ¶
type GetClipsInput struct { // Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. This applies only to queries specifying broadcaster_id or game_id. The cursor value specified here is from the pagination response field of a prior query. After string `url:"after"` // Cursor for backward pagination: tells the server where to start fetching the next set of results, in a multi-page response. This applies only to queries specifying broadcaster_id or game_id. The cursor value specified here is from the pagination response field of a prior query. Before string `url:"before"` // ID of the broadcaster for whom clips are returned. The number of clips returned is determined by the first query-string parameter (default: 20). Results are ordered by view count. BroadcasterID string `url:"broadcaster_id"` // Ending date/time for returned clips, in RFC3339 format. (Note that the seconds value is ignored.) If this is specified, started_at also must be specified; otherwise, the time period is ignored. EndedAt string `url:"ended_at"` // Maximum number of objects to return. Maximum: 100. Default: 20. First uint `url:"first"` // ID of the game for which clips are returned. The number of clips returned is determined by the first query-string parameter (default: 20). Results are ordered by view count. GameID string `url:"game_id"` // ID of the clip being queried. Limit: 100. ID string `url:"id"` // Starting date/time for returned clips, in RFC3339 format. (Note that the seconds value is ignored.) If this is specified, ended_at also should be specified; otherwise, the ended_at date/time will be 1 week after the started_at value. StartedAt string `url:"started_id"` }
GetClipsInput represents the query string parameters to get clips https://dev.twitch.tv/docs/api/reference#get-clips
type GetStreamsInput ¶
type GetStreamsInput struct { // Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. After string `url:"after"` // Cursor for backward pagination: tells the server where to start fetching the next set of results, in a multi-page response. Before string `url:"before"` // Returns streams in a specified community ID. You can specify up to 100 IDs. CommunityID []string `url:"community_id"` // Maximum number of objects to return. Maximum: 100. Default: 20. First int `url:"first"` // Returns streams broadcasting a specified game ID. You can specify up to 100 IDs. GameID []string `url:"game_id"` // Stream language. You can specify up to 100 languages. Language []string `url:"language"` // Stream type: "all", "live", "vodcast". Default: "all". Type string `url:"type"` // Returns streams broadcast by one or more specified user IDs. You can specify up to 100 IDs. UserID []string `url:"user_id"` // Returns streams broadcast by one or more specified user login names. You can specify up to 100 names. UserLogin []string `url:"user_login"` }
GetStreamsInput represents the query string parameters to get streams https://dev.twitch.tv/docs/api/reference#get-streams
type Pagination ¶
type Pagination struct {
Cursor string `json:"cursor"`
}
Pagination data returned from helix paged requests
type StreamData ¶
type StreamData struct { ID string `json:"id"` UserID string `json:"user_id"` UserLogin string `json:"user_name"` GameID string `json:"game_id"` CommunityIds []string `json:"community_ids"` Type string `json:"type"` Title string `json:"title"` ViewerCount int `json:"viewer_count"` StartedAt time.Time `json:"started_at"` Language string `json:"language"` ThumbnailURL string `json:"thumbnail_url"` }
StreamData represents the data a single stream
type UserData ¶
type UserData struct { ID string `json:"id"` Login string `json:"login"` DisplayName string `json:"display_name"` Type string `json:"type"` BroadcasterType string `json:"broadcaster_type"` Description string `json:"description"` ProfileImageURL string `json:"profile_image_url"` OfflineImageURL string `json:"offline_image_url"` ViewCount int `json:"view_count"` Email string `json:"email"` }
UserData struct represents a user as defined by the twitch api