Documentation ¶
Index ¶
- Constants
- type Channel
- type ChatterResponse
- type Chatters
- type Client
- func (c *Client) CheckUserFollowsChannel(userID string, channelID string) (*User, error)
- func (c *Client) CheckUserSubscriptionByChannel(userID string, channelID string, oauth string) (*User, error)
- func (c *Client) GetChannelByID(channelID string) (*Channel, error)
- func (c *Client) GetChannelByOAuth(oauth string) (*Channel, error)
- func (c *Client) GetChannelEditors(channelID string, oauth string) (*[]User, error)
- func (c *Client) GetChannelFollows(channelID string, cursor string, limit int, direction Direction) (*Followers, error)
- func (c *Client) GetChannelSubscriberByUser(channelID string, userID string, oauth string) (*Subscription, error)
- func (c *Client) GetChannelSubscribers(channelID string, oauth string, limit int, offset int, direction Direction) (*Subscribers, error)
- func (c *Client) GetChannelVideos(channelID string, limit int, offset int, broadcastType string, language string, ...) (*Videos, error)
- func (c *Client) GetChatters(channel string) (*ChatterResponse, error)
- func (c *Client) GetFollowedStreams(oauth string) (*FollowedStream, error)
- func (c *Client) GetStreamByChannel(channelID string) (*Stream, error)
- func (c *Client) GetUserByID(userID string) (*User, error)
- func (c *Client) GetUserByOAuth(oauth string) (*User, error)
- func (c *Client) GetUserFollows(userID string, limit int, offset int, direction Direction, sortBy SortBy) (*Followers, error)
- func (c *Client) SearchChannels(channel string) (*[]Channel, error)
- func (c *Client) SearchExactChannel(channel string) (*Channel, error)
- func (c *Client) SearchExactUser(user string) (*User, error)
- func (c *Client) SearchUsers(user string) (*[]User, error)
- type Direction
- type Editors
- type Error
- type Follow
- type FollowedStream
- type Followers
- type Fps
- type Notifications
- type Post
- type Preview
- type Resolutions
- type ResponseError
- type Result
- type SortBy
- type Stream
- type StreamResponse
- type Subscribers
- type Subscription
- type Thumbnail
- type Thumbnails
- type User
- type UserSearchResult
- type Video
- type VideoSort
- type Videos
Constants ¶
const ( ASC Direction = "asc" DESC Direction = "desc" CreatedAt SortBy = "created_at" LastBroadcast SortBy = "last_broadcast" Login SortBy = "login" Views VideoSort = "views" Time VideoSort = "time" )
const (
ChatterEndpoint = "https://tmi.twitch.tv/group/user/%s/chatters"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct { Mature bool `json:"mature"` Status string `json:"status"` BroadcasterLanguage string `json:"broadcaster_language"` DisplayName string `json:"display_name"` Game string `json:"game"` Language string `json:"language"` ID json.Number `json:"_id,number"` Name string `json:"name"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Logo string `json:"logo"` VideoBanner string `json:"video_banner"` ProfileBanner string `json:"profile_banner"` ProfileBannerBackgroundColor string `json:"profile_banner_background_color"` Partner bool `json:"partner"` URL string `json:"url"` Views uint `json:"views"` Followers uint `json:"followers"` }
Channel Twitch Channel Data
type ChatterResponse ¶
type Client ¶
type Client struct { ClientID string HTTPClient *http.Client // contains filtered or unexported fields }
func (*Client) CheckUserFollowsChannel ¶
CheckUserFollowsChannel will return the user object if the user is following the given channel. If no users and an error is returned, then the user is not following the channel.
func (*Client) CheckUserSubscriptionByChannel ¶
func (c *Client) CheckUserSubscriptionByChannel(userID string, channelID string, oauth string) (*User, error)
CheckUserSubscriptionByChannel will return a user object if the given user is subscribed to the given channel. If no user and an error is returned, then either the user is not subscribed to the channel, or the channel does not have a subscription program.
func (*Client) GetChannelByID ¶
GetChannelByID will return a Channel object for the given channelID. Will return annotated errors.
func (*Client) GetChannelByOAuth ¶
GetChannelByOAuth will return a Channel object for the given oauth. Will return annotated errors.
func (*Client) GetChannelEditors ¶
GetChannelEditors returns a list of Users that are editors for the given channel. Requires users oauth token.
func (*Client) GetChannelFollows ¶
func (c *Client) GetChannelFollows(channelID string, cursor string, limit int, direction Direction) (*Followers, error)
GetChannelFollows returns a list of followers for the given channel. Since a channel can have thousands of followers, you must make multiple requests of smaller sizes.
The function takes four parameters:
channelID: The channel ID cursor: Tells the server where to start fetching the next set of results, in a multi-page response. limit: Number of records to return. Maximum is 100, default is 25. direction: Direction of sorting. Valid values are `ASC`, and `DESC` (newest first). Default is `DESC`.
func (*Client) GetChannelSubscriberByUser ¶
func (c *Client) GetChannelSubscriberByUser(channelID string, userID string, oauth string) (*Subscription, error)
GetChannelSubscriberByUser will return the subscriber information if the user is subscribed to the channel.
func (*Client) GetChannelSubscribers ¶
func (c *Client) GetChannelSubscribers(channelID string, oauth string, limit int, offset int, direction Direction) (*Subscribers, error)
GetChannelSubscribers returns a list of users that are subscribe to the channel.
Function takes five parameters:
channelID: ID of the Channel oauth: User oauth token limit: Maximum number of objects top return. Default 25, Maximum 100. direction: Sorting direction. Valid values are `ASC` and `DESC`. Default `ASC` (oldest first)
func (*Client) GetChannelVideos ¶
func (c *Client) GetChannelVideos(channelID string, limit int, offset int, broadcastType string, language string, sort VideoSort) (*Videos, error)
GetChannelVideos returns a list of all videos on the given channel.
Function takes size parameters:
channelID: Channel ID limit: Maximum number of objects to return. Default 10, Maximum 100. offset: The offset in the list to return. If a list has more entries then the limit, the returned list will be a subset of the whole. The offset lets you continue where you left off. broadcastType: Comma separated list with any combination of `archive`, `highlight`, and `upload`. Default is `highlight`. language: Constrains the language of the videos returned. For example `en,es`. Default is all languages. sort: Sorting order of returned videos. Valid values `views` and `time`. Default is `time` (most recent first).
func (*Client) GetChatters ¶
func (c *Client) GetChatters(channel string) (*ChatterResponse, error)
GetChatters returns the chatters for the given channel
func (*Client) GetFollowedStreams ¶
func (c *Client) GetFollowedStreams(oauth string) (*FollowedStream, error)
GetFollowedStreams returns a list of streams the user follows, based on user auth token.
func (*Client) GetStreamByChannel ¶
GetStreamByChannel returns a StreamResponse for the given channel
func (*Client) GetUserByID ¶
GetUserByID will return ther user for the given ID.
func (*Client) GetUserByOAuth ¶
GetUserByOauth returns a user from the given oauth token.
func (*Client) GetUserFollows ¶
func (c *Client) GetUserFollows(userID string, limit int, offset int, direction Direction, sortBy SortBy) (*Followers, error)
GetUserFollows returns a list of channles the given user follows.
The function takes in five parameters:
userID: The User ID limit: The number of channels to return. Max is 100, default is 25. offset: The offset in the list to return. If a list has more entries then the limit, the returned list will be a subset of the whole. The offset lets you continue where you left off. direction: The direction of the returned list. Values are `ASC` and `DESC` (newest first). Default is `DESC`. sortBy: The sort of the returned list. Values are `CreatedAt`, `LastBroadcast`, and `Login` Default is `CreatedAt`.
func (*Client) SearchChannels ¶
SearchChannels Searches for the given channel and returns the results
func (*Client) SearchExactChannel ¶
SearchExactChannel Searches for the given channel and returns the channel if the channel name is an exact match
type Follow ¶
type Follow struct { CreatedAt time.Time `json:"created_at"` Links map[string]string `json:"_links"` Notifications bool `json:"notifications"` User User `json:"user"` Channel Channel `json:"channel"` }
Follower data for twitch channel
type FollowedStream ¶
type Notifications ¶
type Resolutions ¶
type ResponseError ¶
type Stream ¶
type Stream struct { ID json.Number `json:"_id,number"` Game string `json:"game"` CommunityID string `json:"community_id"` Viewers uint `json:"viewers"` VideoHeight uint `json:"video_height"` AverageFps float64 `json:"average_fps"` Delay uint `json:"delay"` CreatedAt time.Time `json:"created_at"` IsPlaylist bool `json:"is_playlist"` Preview Preview `json:"preview"` Channel Channel `json:"channel"` }
type StreamResponse ¶
type StreamResponse struct {
Stream Stream `json:"stream"`
}
type Subscribers ¶
type Subscribers struct { Total uint `json:"_total"` Cursor string `json:"_cursor"` Subscriptions []Subscription `json:"subscriptions"` }
type Subscription ¶
type Thumbnails ¶
type User ¶
type User struct { Type string `json:"type"` Name string `json:"name"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Logo string `json:"logo"` ID json.Number `json:"_id,number"` DisplayName string `json:"display_name"` Bio string `json:"bio"` Email string `json:"email"` EmailVerified bool `json:"email_verified"` Partnered bool `json:"partnered"` TwitterConnected bool `json:"twitter_connected"` Notifications Notifications `json:"notifications"` }
User Twitch User Data
type UserSearchResult ¶
type Video ¶
type Video struct { ID string `json:"_id"` BroadcastID json.Number `json:"broadcast_id,number"` BroadcastType string `json:"broadcast_type"` Channel Channel `json:"channel"` CreatedAt time.Time `json:"created_at"` Description string `json:"description"` DescriptionHTML string `json:"description_html"` Fps Fps `json:"fps"` Game string `json:"game"` Language string `json:"language"` Length uint `json:"length"` Preview Preview `json:"preview"` PublishedAt time.Time `json:"published_at"` Resolutions Resolutions `json:"resolutions"` Status string `json:"status"` TagList string `json:"tag_list"` Thumbnails Thumbnails `json:"thumbnails"` Title string `json:"title"` URL string `json:"url"` Viewable string `json:"viewable"` ViewableAt interface{} `json:"viewable_at"` Views uint `json:"views"` }