Documentation
¶
Index ¶
- type Channel
- type ChannelFollower
- type ChannelFollowers
- type ChannelSubscribersParams
- type ChannelSubscription
- type ChannelSubscriptions
- type ChannelTeams
- type ChannelUpdateParams
- type ChannelsService
- func (s *ChannelsService) CheckChannelSubscriptionByUser(accessToken string, channelID string, userID string) (ChannelSubscription, error)
- func (s *ChannelsService) DeleteChannelFromCommunities(accessToken string, channelID string) error
- func (s *ChannelsService) GetChannel(accessToken string) (Channel, error)
- func (s *ChannelsService) GetChannelByID(channelID string) (Channel, error)
- func (s *ChannelsService) GetChannelCommunities(channelID string) (Communities, error)
- func (s *ChannelsService) GetChannelEditors(accessToken string, channelID string) (Users, error)
- func (s *ChannelsService) GetChannelFollowers(channelID string) (ChannelFollowers, error)
- func (s *ChannelsService) GetChannelSubscribers(accessToken string, channelID string, params *ChannelSubscribersParams) (ChannelSubscriptions, error)
- func (s *ChannelsService) GetChannelTeams(channelID string) (ChannelTeams, error)
- func (s *ChannelsService) GetChannelVideos(channelID string) (Videos, error)
- func (s *ChannelsService) ResetChannelStreamKey(accessToken string, channelID string) (Channel, error)
- func (s *ChannelsService) SetChannelCommunities(accessToken string, channelID string, communities []string) error
- func (s *ChannelsService) StartChannelCommercial(accessToken string, channelID string, length int) (CommercialResponse, error)
- func (s *ChannelsService) UpdateChannel(accessToken string, channelID string, params *ChannelUpdateParams) (Channel, error)
- type CommercialResponse
- type Communities
- type Community
- type Follows
- type Team
- type TokenResponse
- type TwitchClient
- type TwitchError
- type User
- type Users
- type UsersService
- func (u *UsersService) GetAccessToken(code string) (string, error)
- func (u *UsersService) GetFollowedChannelInfo(followerId string, channelId string) (Follows, error)
- func (u *UsersService) GetUser(accessToken string) (User, error)
- func (u *UsersService) GetUserByID(userID string) (User, error)
- func (u *UsersService) GetUsers(usernames []string) (Users, error)
- type Video
- type VideoFPS
- type VideoPreviews
- type VideoResolutions
- type VideoThumbnail
- type VideoThumbnails
- type Videos
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct {
BroadcasterLanguage string `json:"broadcaster_language"`
BroadcasterType string `json:"broadcaster_type"`
CreatedAt time.Time `json:"created_at"`
Description string `json:"description"`
DisplayName string `json:"display_name"`
Email string `json:"email"`
Followers int `json:"followers"`
Game string `json:"game"`
ID json.Number `json:"_id"`
Language string `json:"language"`
Logo string `json:"logo"`
Mature bool `json:"mature"`
Name string `json:"name"`
ProfileBanner string `json:"profile_banner"`
ProfileBannerBackgroundColor string `json:"profile_banner_background_color"`
Partner bool `json:"partner"`
Status string `json:"status"`
StreamKey string `json:"stream_key"`
Url string `json:"url"`
UpdatedAt time.Time `json:"updated_at"`
VideoBanner string `json:"video_banner"`
Views int `json:"views"`
}
type ChannelFollower ¶
type ChannelFollowers ¶
type ChannelFollowers struct {
Cursor string `json:"_cursor"`
Follows []ChannelFollower `json:"follows"`
Total int `json:"_total"`
}
type ChannelSubscription ¶
type ChannelSubscriptions ¶
type ChannelSubscriptions struct {
Subscriptions []ChannelSubscription `json:"subscriptions"`
Total int `json:"_total"`
}
type ChannelTeams ¶
type ChannelTeams struct {
Teams []Team `json:"teams"`
}
type ChannelUpdateParams ¶
type ChannelsService ¶
type ChannelsService struct {
// contains filtered or unexported fields
}
func (*ChannelsService) CheckChannelSubscriptionByUser ¶
func (s *ChannelsService) CheckChannelSubscriptionByUser(accessToken string, channelID string, userID string) (ChannelSubscription, error)
Checks if a specified channel has a specified user subscribed to it. Required scope: channel_check_subscription
func (*ChannelsService) DeleteChannelFromCommunities ¶
func (s *ChannelsService) DeleteChannelFromCommunities(accessToken string, channelID string) error
Deletes a specified channel from its communities. Required scope: channel_editor
func (*ChannelsService) GetChannel ¶
func (s *ChannelsService) GetChannel(accessToken string) (Channel, error)
Gets a channel object based on a specified OAuth token Returns more data than GetChannelByID because this is privileged Required scopes: channel_read
func (*ChannelsService) GetChannelByID ¶
func (s *ChannelsService) GetChannelByID(channelID string) (Channel, error)
Gets a specified channel object Required scopes: none
func (*ChannelsService) GetChannelCommunities ¶
func (s *ChannelsService) GetChannelCommunities(channelID string) (Communities, error)
Gets the communities for a specified channel. Required scope: none
func (*ChannelsService) GetChannelEditors ¶
func (s *ChannelsService) GetChannelEditors(accessToken string, channelID string) (Users, error)
Gets a list of users who are editors for a specified channel Required scopes: channel_read
func (*ChannelsService) GetChannelFollowers ¶
func (s *ChannelsService) GetChannelFollowers(channelID string) (ChannelFollowers, error)
Gets a list of users who follow a specified channel, sorted by the date when they started following the channel, up to 25 at a time Required scopes: none
func (*ChannelsService) GetChannelSubscribers ¶
func (s *ChannelsService) GetChannelSubscribers(accessToken string, channelID string, params *ChannelSubscribersParams) (ChannelSubscriptions, error)
Gets a list of users subscribed to a specific channel, sortedb y the date when the subscribed, up to 25 at a time Required scopes: channel_subscriptions
func (*ChannelsService) GetChannelTeams ¶
func (s *ChannelsService) GetChannelTeams(channelID string) (ChannelTeams, error)
Gets a list of teams to which a specified channel belongs Required scopes: none
func (*ChannelsService) GetChannelVideos ¶
func (s *ChannelsService) GetChannelVideos(channelID string) (Videos, error)
Gets a list of VODs (Video on Demand) from a specified channel. Required scope: none
func (*ChannelsService) ResetChannelStreamKey ¶
func (s *ChannelsService) ResetChannelStreamKey(accessToken string, channelID string) (Channel, error)
Deletes the stream key for a specified channel. Once it is deleted, the stream key is automatically reset. Required scope: channel_stream
func (*ChannelsService) SetChannelCommunities ¶
func (s *ChannelsService) SetChannelCommunities(accessToken string, channelID string, communities []string) error
Sets a specified channel to be in up to three specified communities. The list of community IDs is specified in the body of the request. Required scope: channel_editor
func (*ChannelsService) StartChannelCommercial ¶
func (s *ChannelsService) StartChannelCommercial(accessToken string, channelID string, length int) (CommercialResponse, error)
Starts a commercial (advertisement) on a specified channel. This is valid only for channels that are Twitch partnes. You cannot start a commercial more often than once every 8 minutes. Valid length values: 0, 60, 90, 120, 150, 180 Required scope: channel_commercial
func (*ChannelsService) UpdateChannel ¶
func (s *ChannelsService) UpdateChannel(accessToken string, channelID string, params *ChannelUpdateParams) (Channel, error)
Updates specified properties of a specified channel Required scopes: channel_editor
type CommercialResponse ¶
type Communities ¶
type Communities struct {
Communities []Community `json:"communities"`
}
type Community ¶
type Community struct {
AvatarImageUrl string `json:"avatar_image_url"`
CoverImageUrl string `json:"cover_image_url"`
Description string `json:"description"`
DescriptionHtml string `json:"description_html"`
DisplayName string `json:"display_name"`
ID string `json:"_id"`
Language string `json:"language"`
Name string `json:"name"`
OwnerID string `json:"owner_id"`
Rules string `json:"rules"`
RulesHtml string `json:"rules_html"`
Summary string `json:"summary"`
}
type Team ¶
type Team struct {
Banner string `json:"banner"`
Background string `json:"background"`
CreatedAt time.Time `json:"created_at"`
DisplayName string `json:"display_name"`
ID int `json:"_id"`
Info string `json:"info"`
Logo string `json:"logo"`
Name string `json:"name"`
UpdatedAt time.Time `json:"updated_at"`
}
type TokenResponse ¶
type TwitchClient ¶
type TwitchClient struct {
Channels *ChannelsService
// Chat *ChatService
// Games *GamesService
// Ingests *IngestsService
// Search *SearchService
// Streams *StreamsService
// Teams *TeamsService
Users *UsersService
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(clientId, clientSecret, oauthRedirect string) *TwitchClient
type TwitchError ¶
type User ¶
type User struct {
ID string `json:"_id"`
Name string `json:"name"`
DisplayName string `json:"display_name"`
Email string `json:"email"`
IsEmailVerified bool `json:"email_verified"`
Logo string `json:"logo"`
Bio string `json:"bio"`
IsPartnered bool `json:"partnered"`
IsTwitterConnected bool `json:"twitter_connected"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type UsersService ¶
type UsersService struct {
// contains filtered or unexported fields
}
func (*UsersService) GetAccessToken ¶
func (u *UsersService) GetAccessToken(code string) (string, error)
func (*UsersService) GetFollowedChannelInfo ¶
func (u *UsersService) GetFollowedChannelInfo(followerId string, channelId string) (Follows, error)
func (*UsersService) GetUser ¶
func (u *UsersService) GetUser(accessToken string) (User, error)
Gets a user object based on the OAuth token provided. Required scopes: user_read
func (*UsersService) GetUserByID ¶
func (u *UsersService) GetUserByID(userID string) (User, error)
Gets a specified user object. Required scopes: none
type Video ¶
type Video struct {
AnimatedPreviewUrl string `json:"animated_preview_url"`
BroadcastID int `json:"broadcast_id"`
BroadcastType string `json:"broadcast_type"`
Communities string `json:"communities"`
CreatedAt time.Time `json:"created_at"`
Channel Channel `json:"channel"`
DescriptionHtml string `json:"description_html"`
Description string `json:"description"`
Fps VideoFPS `json:"fps"`
Game string `json:"game"`
ID string `json:"_id"`
Language string `json:"language"`
Length int `json:"length"`
Preview VideoPreviews `json:"preview"`
PublishedAt time.Time `json:"published_at"`
RecordedAt time.Time `json:"recorded_at"`
Resolutions VideoResolutions `json:"resolutions"`
Status string `json:"status"`
TagList string `json:"tag_list"`
Thumbnails VideoThumbnails `json:"thumbnails"`
Title string `json:"title"`
Url string `json:"url"`
Viewable string `json:"viewable"`
Views int `json:"views"`
ViewableAt time.Time `json:"viewable_at"`
}
type VideoPreviews ¶
type VideoResolutions ¶
type VideoThumbnail ¶
type VideoThumbnails ¶
type VideoThumbnails struct {
Large []VideoThumbnail `json:"large"`
Medium []VideoThumbnail `json:"medium"`
Small []VideoThumbnail `json:"small"`
Template []VideoThumbnail `json:"template"`
}