Documentation ¶
Index ¶
- type Asset
- type Block
- type Blocks
- type Channel
- type ChannelOptions
- type Channels
- func (c *Channels) GetChannel(channel string) (ch *Channel, resp *Response, err error)
- func (c *Channels) GetChannelFollowers(channel string) ([]Follow, error)
- func (c *Channels) GetUserChannel() (ch *Channel, resp *Response, err error)
- func (c *Channels) ListChannelEditors(channel string) (u []User, resp *Response, err error)
- func (c *Channels) ListChannelTeams(channel string) (t []Team, resp *Response, err error)
- func (c *Channels) ResetStreamKey(channel string) (err error)
- func (c *Channels) StartCommercial(channel string) error
- func (c *Channels) UpdateChannel(channel string) error
- type Chats
- type Client
- type CommericalOptions
- type Emoticon
- type EmoticonImage
- type FeaturedStream
- type Follow
- type FollowOptions
- type Game
- type Games
- type Ingest
- type Ingests
- type ListOptions
- type RequestOptions
- type Response
- type Search
- type Stream
- type StreamOptions
- type StreamSummary
- type Streams
- func (s *Streams) GetStream(channel string) (stream *Stream, resp *Response, err error)
- func (s *Streams) GetSummary() (summary *StreamSummary, resp *Response, err error)
- func (s *Streams) ListFeaturedStreams(opts *RequestOptions) (f []FeaturedStream, resp *Response, err error)
- func (s *Streams) ListStreams(opts *StreamOptions) (streams []Stream, resp *Response, err error)
- type Subscription
- type SubscriptionOptions
- type Subscriptions
- func (s *Subscriptions) GetChannelSubscriptions(channel string, opts *SubscriptionOptions) (sub []Subscription, resp *Response, err error)
- func (s *Subscriptions) GetSubscribedChannel(user, channel string) (sub *Subscription, resp *Response, err error)
- func (s *Subscriptions) GetUserSubscribed(channel, user string) (sub *Subscription, resp *Response, err error)
- type Team
- type Teams
- type User
- type Users
- func (u *Users) FollowChannel(user, channel string) (ch *Channel, resp *Response, err error)
- func (u *Users) GetCurrentUser() (user *User, resp *Response, err error)
- func (u *Users) GetUser(username string) (user *User, resp *Response, err error)
- func (u *Users) IsFollowing(user, channel string) (ch *Channel, resp *Response, err error)
- func (u *Users) ListFollowedChannels(user string) (ch []Channel, resp *Response, err error)
- func (u *Users) ListFollowedStreams(opts *RequestOptions) (s []Stream, resp *Response, err error)
- func (u *Users) ListFollowedVideos(opts *ListOptions) (videos []Video, resp *Response, err error)
- func (u *Users) UnfollowChannel(user, channel string) (err error)
- type Video
- type VideoChannelOptions
- type VideoRequestOptions
- type Videos
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Asset ¶
type Asset struct { Large *string `json:"large"` Medium *string `json:"medium"` Small *string `json:"small"` Template *string `json:"template"` }
Asset represents links to images assets that are likely to come along with Game and Channel responses. Fields are pointer types to support empty responses from API results.
type Blocks ¶
type Blocks struct {
// contains filtered or unexported fields
}
func (*Blocks) AddBlock ¶
AddBlock adds a block to the passed authenticated user. `user` is the current user, `target` is the account to block. A successful block returns the new block object. This method requires OAuth authentication with the required `user_blocks_edit` scope
func (*Blocks) ListBlocks ¶
func (*Blocks) RemoveBlock ¶
RemoveBlock deletes a block from the passed authenticated user. `user` is the current user, `target` is the account to block. A 404 error will be returned if the block did not exist for the given user.
type Channel ¶
type Channel struct { ID *int `json:"_id,omitempty"` DisplayName *string `json:"display_name,omitempty"` Name *string `json:"name,omitempty"` Title *string `json:"title,omitempty"` Game *string `json:"game,omitempty"` Delay *int `json:"delay,omitempty"` StreamKey *string `json:"stream_key,omitempty"` Teams []Team `json:"teams,omitempty"` Status *string `json:"status,omitempty"` Banner *string `json:"banner,omitempty"` ProfileBanner *string `json:"profile_banner,omitempty"` ProfileBannerBackgroundColor *string `json:"profile_banner_background_color,omitempty"` VideoBanner *string `json:"video_banner,omitempty"` Background *string `json:"background,omitempty"` Logo *string `json:"logo,omitempty"` URL *string `json:"url,omitempty"` Login *string `json:"login,omitempty"` Email *string `json:"email,omitempty"` Mature *bool `json:"mature,omitempty"` Language *string `json:"language,omitempty"` BroadcasterLanguage *string `json:"broadcaster_language,omitempty"` Partner *bool `json:"partner,omitempty"` Views *int `json:"views,omitempty"` Followers *int `json:"followers,omitempty"` CreatedAt *string `json:"created_at,omitempty"` UpdatedAt *string `json:"updated_at,omitempty"` }
type ChannelOptions ¶
type Channels ¶
type Channels struct {
// contains filtered or unexported fields
}
func (*Channels) GetChannel ¶
GetChannel returns a channel by name
func (*Channels) GetChannelFollowers ¶
func (*Channels) GetUserChannel ¶
GetUserChannel returns the channel for the authenticated user Requires the `channel_read` authentication scope to be approved
func (*Channels) ListChannelEditors ¶
ListChannelEditors returns a list of user objects associated with the channel as "editor" status. This method requires the `channel_read` authentication scope
func (*Channels) ListChannelTeams ¶
ListChannelTeams returns a list of teams for the given channel
func (*Channels) ResetStreamKey ¶
ResetStreamKey reset's an authenticated channel's stream key Requires the `channel_stream` authentication scope
func (*Channels) StartCommercial ¶
func (*Channels) UpdateChannel ¶
type Client ¶
type Client struct { ID string BaseUrl *url.URL Blocks *Blocks Channels *Channels Chat *Chats Games *Games Ingests *Ingests Search *Search Streams *Streams Subscriptions *Subscriptions Teams *Teams Users *Users Videos *Videos // contains filtered or unexported fields }
type CommericalOptions ¶
type CommericalOptions struct {
Length string `url:"length,omitempty"`
}
type Emoticon ¶
type Emoticon struct { Regex *string `json:"regex"` Images []EmoticonImage `json:"images"` }
type EmoticonImage ¶
type FeaturedStream ¶
type FollowOptions ¶
type FollowOptions struct { Direction string `url:"direction,omitempty"` RequestOptions }
type ListOptions ¶
type RequestOptions ¶
type RequestOptions struct { HLS bool `url:"hls,omitempty"` ListOptions }
RequestOptions is the base query parameters used for customizing query output from List queries.
type Response ¶
Response augments http.Response to include extra meta data for List query responses. Fields are pointer types to support response inconsistencies in Twitch's API, since some endpoints allow pagination, but don't include a total count, etc.
func (*Response) SetOffsets ¶
SetOffsets adds the paging metadata to the response
type Search ¶
type Search struct {
// contains filtered or unexported fields
}
type StreamOptions ¶
type StreamOptions struct { Game string `url:"game,omitempty"` Channel string `url:"channel,omitempty"` Embeddable bool `url:"embeddable,omitempty"` ClientID string `url:"client_id,omitempty"` RequestOptions }
type StreamSummary ¶
type Streams ¶
type Streams struct {
// contains filtered or unexported fields
}
func (*Streams) GetStream ¶
GetStream returns a channel's stream, if live.
If the channel is offline, a zeroed Stream is returned without error.
func (*Streams) GetSummary ¶
func (s *Streams) GetSummary() (summary *StreamSummary, resp *Response, err error)
Summary returns viewership and channel count for all streams currently on Twitch
func (*Streams) ListFeaturedStreams ¶
func (s *Streams) ListFeaturedStreams(opts *RequestOptions) (f []FeaturedStream, resp *Response, err error)
ListFeaturedStreams returns the streams featured on the front page of twitch
func (*Streams) ListStreams ¶
func (s *Streams) ListStreams(opts *StreamOptions) (streams []Stream, resp *Response, err error)
ListStreams lists all the current streams on Twitch
type Subscription ¶
type SubscriptionOptions ¶
type SubscriptionOptions struct { Direction string `url:"direction,omitempty"` ListOptions }
type Subscriptions ¶
type Subscriptions struct {
// contains filtered or unexported fields
}
func (*Subscriptions) GetChannelSubscriptions ¶
func (s *Subscriptions) GetChannelSubscriptions(channel string, opts *SubscriptionOptions) (sub []Subscription, resp *Response, err error)
GetChannelSubscriptions returns a list of subscriptions for the given channel, ordered by creation date. Requires the `channel_subscriptions` authentication scope.
func (*Subscriptions) GetSubscribedChannel ¶
func (s *Subscriptions) GetSubscribedChannel(user, channel string) (sub *Subscription, resp *Response, err error)
ChannelSubscribed returns a subscription with a channel that the user subscribes to. Requires the `user_subscriptions` authentication scope for the given user.
func (*Subscriptions) GetUserSubscribed ¶
func (s *Subscriptions) GetUserSubscribed(channel, user string) (sub *Subscription, resp *Response, err error)
UserSubscribed returns a subscription if the user is subscribed to the given channel. Requires the `channel_check_subscription` authentication scope for the given channel.
type Team ¶
type Team struct { ID *int `json:"_id,omitempty"` Name *string `json:"name,omitempty"` Info *string `json:"info,omitempty"` DisplayName *string `json:"display_name,omitempty"` Logo *string `json:"logo,omitempty"` Banner *string `json:"banner,omitempty"` Background *string `json:"background,omitempty"` CreatedAt *string `json:"created_at,omitempty"` UpdatedAt *string `json:"updated_at,omitempty"` }
type Teams ¶
type Teams struct {
// contains filtered or unexported fields
}
type User ¶
type User struct { ID *int `json:"_id,omitempty"` Type *string `json:"type,omitempty"` Name *string `json:"name,omitempty"` DisplayName *string `json:"display_name,omitempty"` Logo *string `json:"logo,omitempty"` Bio *string `json:"bio,omitempty"` CreatedAt *string `json:"created_at,omitempty"` UpdatedAt *string `json:"updated_at,omitempty"` Email *string `json:"email,omitempty"` Partnered *bool `json:"partnered,omitempty"` Staff *bool `json:"staff,omitempty"` }
type Users ¶
type Users struct {
// contains filtered or unexported fields
}
func (*Users) FollowChannel ¶
func (*Users) GetCurrentUser ¶
GetCurrentUser returns the authenticated user with email and partner info. Requires the `user_read` authentication scope.
func (*Users) IsFollowing ¶
func (*Users) ListFollowedChannels ¶
func (*Users) ListFollowedStreams ¶
func (u *Users) ListFollowedStreams(opts *RequestOptions) (s []Stream, resp *Response, err error)
ListFollowedStreams returns a list of the streams the authenticated user follows. Requires the `user_read` authentication scope.
func (*Users) ListFollowedVideos ¶
func (u *Users) ListFollowedVideos(opts *ListOptions) (videos []Video, resp *Response, err error)
ListFollowedVideos returns a list of videos created by channels the authenticated user is following. Requires the `user_read` authentication scope.
func (*Users) UnfollowChannel ¶
type Video ¶
type Video struct { ID *string `json:"_id"` Title *string `json:"title"` URL *string `json:"url"` Views *int `json:"views"` Description *string `json:"description"` Length *int `json:"length"` Game *string `json:"game"` Preview *string `json:"preview"` RecordedAt *string `json:"recorded_at"` Channel *Channel `json:"channel"` }
type VideoChannelOptions ¶
type VideoChannelOptions struct { Broadcasts bool `url:"broadcasts,omitempty"` ListOptions }
type VideoRequestOptions ¶
type VideoRequestOptions struct { Game string `url:"game,omitempty"` Period string `url:"period,omitempty"` ListOptions }
type Videos ¶
type Videos struct {
// contains filtered or unexported fields
}
func (*Videos) ListChannelVideos ¶
func (v *Videos) ListChannelVideos(channel string, opts *VideoChannelOptions) (videos []Video, resp *Response, err error)
ListChannelVideos returns videos belonging to the target channel. Only broadcasts will be returned when the `VideoChannelOptions.Broadcasts` field is true. Otherwise only highlights are returned by default.
func (*Videos) ListTop ¶
func (v *Videos) ListTop(opts *VideoRequestOptions) (videos []Video, resp *Response, err error)
ListTop returns a list of the top videos on twitch for the specified period of time, ordered by most popular first. Defined time periods are "week", "month", or "all". By default, the top videos of the "week" are returned. Videos belonging to a specific game can be returned by passing the name of the game in the `Game` VideoRequestOption value. Otherwise, all games will be included in the result.