Documentation
¶
Index ¶
- type AccessTokenS
- type AppInfo
- type AuthMethods
- type BlockS
- type BlocksS
- type ChannelLinksS
- type ChannelS
- type ChannelsMethod
- func (c *ChannelsMethod) AccessToken(name string) (*AccessTokenS, error)
- func (c *ChannelsMethod) Channel(name string) (*ChannelS, error)
- func (c *ChannelsMethod) Follows(name string, opt *ListOptions) (*FollowsS, error)
- func (c *ChannelsMethod) M3U8(name string, opt *M3U8Options) (string, error)
- func (c *ChannelsMethod) Panels(name string, opt *ListOptions) (*[]PanelS, error)
- func (c *ChannelsMethod) Videos(name string, opt *ListOptions) (*VideosS, error)
- type ChatLinks
- type ChatLinksS
- type ChatMethod
- type Client
- type EditorsS
- type EmoticonS
- type EmoticonsS
- type FStreamS
- type FeaturedS
- type FollowS
- type FollowedS
- type FollowsS
- type GameS
- type GamesMethod
- type ImageS
- type ImagesS
- type IngestS
- type IngestsMethod
- type IngestsS
- type LinksS
- type ListOptions
- type M3U8Options
- type OAuthCallback
- type OAuthResponse
- type PanelDataS
- type PanelS
- type PreviewS
- type SChannelS
- type SGameS
- type SGamesS
- type SearchMethod
- type StreamS
- type StreamsMethod
- type StreamsS
- type SubS
- type SubsS
- type SummaryS
- type TeamS
- type TeamsMethod
- type TeamsS
- type TopS
- type TopsS
- type UAuthedS
- type UFollowS
- type UFollowsS
- type UNotificationS
- type UTargetS
- type UserS
- type UsersMethod
- type VideoS
- type VideosMethod
- type VideosS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessTokenS ¶
type AuthMethods ¶
type AuthMethods struct {
AccessToken string
// contains filtered or unexported fields
}
func (*AuthMethods) LoginCallback ¶
func (a *AuthMethods) LoginCallback(w http.ResponseWriter, r *http.Request) (*OAuthResponse, error)
func (*AuthMethods) OAuthRedirect ¶
func (a *AuthMethods) OAuthRedirect(w http.ResponseWriter, r *http.Request)
type ChannelLinksS ¶
type ChannelLinksS struct {
Chat string `json:"chat,omitempty"`
Commercial string `json:"commercial,omitempty"`
Videos string `json:"videos,omitempty"`
Teams string `json:"teams,omitempty"`
Editors string `json:"editors,omitempty"`
Subsciptions string `json:"subscriptions,omitempty"`
Features string `json:"features,omitempty"`
StreamKey string `json:"stream_key,omitempty"`
Follows string `json:"follows,omitempty"`
}
type ChannelS ¶
type ChannelS struct {
Name string `json:"name,omitempty"`
Status string `json:"status,omitempty"`
Game string `json:"game,omitempty"`
Delay int `json:"delay,omitempty"`
Id int `json:"_id,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
PrimaryTeamName string `json:"primary_team_name,omitempty"`
PrimaryTeamDisplayName string `json:"primary_team_display_name,omitempty"`
Teams []TeamS `json:"teams,omitempty"`
Title string `json:"title,omitempty"`
Mature bool `json:"mature,omitempty"`
AbuseReported bool `json:"abuse_reported,omitempty"`
Banner string `json:"banner,omitempty"`
VideoBanner string `json:"video_banner,omitempty"`
Views int `json:"views,omitempty"`
Followers int `json:"followers,omitempty"`
Background string `json:"background,omitempty"`
ProfileBanner string `json:"profile_banner,omitempty"`
ProfileBannerBackgroundColor string `json:"profile_banner_background_color,omitempty"`
Links ChannelLinksS `json:"_links,omitempty"`
Logo string `json:"logo,omitempty"`
Url string `json:"url,omitempty"`
DisplayName string `json:"display_name,omitempty"`
Language string `json:"language,omitempty"`
BroadcasterLanguage string `json:"broadcaster_language,omitempty"`
// authenticated
StreamKey string `json:"stream_key,omitempty"`
Login string `json:"login,omitempty"`
Email string `json:"email,omitempty"`
}
Channel object
type ChannelsMethod ¶
type ChannelsMethod struct {
// contains filtered or unexported fields
}
func (*ChannelsMethod) AccessToken ¶
func (c *ChannelsMethod) AccessToken(name string) (*AccessTokenS, error)
func (*ChannelsMethod) Channel ¶
func (c *ChannelsMethod) Channel(name string) (*ChannelS, error)
Returns a channel object. If `name` is an empty string, returns the channel object of authenticated user.
func (*ChannelsMethod) Follows ¶
func (c *ChannelsMethod) Follows(name string, opt *ListOptions) (*FollowsS, error)
Returns a list of users the channel `name` is following.
func (*ChannelsMethod) M3U8 ¶
func (c *ChannelsMethod) M3U8(name string, opt *M3U8Options) (string, error)
func (*ChannelsMethod) Panels ¶
func (c *ChannelsMethod) Panels(name string, opt *ListOptions) (*[]PanelS, error)
Returns the list of panels the channel `name` has.
func (*ChannelsMethod) Videos ¶
func (c *ChannelsMethod) Videos(name string, opt *ListOptions) (*VideosS, error)
Returns a list of videos ordered by time of creation, starting with the most recent from channel `name`.
type ChatLinks ¶
type ChatLinks struct {
Links ChatLinksS `json:"_links,omitempty"`
}
type ChatLinksS ¶
type ChatMethod ¶
type ChatMethod struct {
// contains filtered or unexported fields
}
func (*ChatMethod) Emoticons ¶
func (c *ChatMethod) Emoticons() (*EmoticonsS, error)
type Client ¶
type Client struct {
BaseURL *url.URL
AppInfo *AppInfo
AccessToken string
// Twitch api methods
Channels *ChannelsMethod
Chat *ChatMethod
Games *GamesMethod
Ingests *IngestsMethod
Search *SearchMethod
Streams *StreamsMethod
Teams *TeamsMethod
Users *UsersMethod
Videos *VideosMethod
// OAuth
Auth *AuthMethods
OAuthResponse *OAuthResponse
// contains filtered or unexported fields
}
func (*Client) Get ¶
Issues an API get request and returns the API response. The response body is decoded and stored in the value pointed by r.
type EditorsS ¶
type EditorsS struct {
Users []UserS `json:"users,omitempty"`
Links LinksS `json:"_links,omitempty"`
}
used with GET /channels/:channel/editors
type EmoticonsS ¶
type EmoticonsS struct {
Emoticons []EmoticonS `json:"emoticons,omitempty"`
}
type FeaturedS ¶
type FeaturedS struct {
Featured []FStreamS `json:"featured,omitempty"`
}
used with GET /streams/featured
type FollowedS ¶
type FollowedS struct {
Streams []StreamS `json:"streams,omitempty"`
}
used with GET /streams/followed
type FollowsS ¶
type FollowsS struct {
Follows []FollowS `json:"follows,omitempty"`
Total int `json:"_total,omitempty"`
Links LinksS `json:"_links,omitempty"`
}
used with GET /channels/:channel/follows
type GamesMethod ¶
type GamesMethod struct {
// contains filtered or unexported fields
}
func (*GamesMethod) Top ¶
func (g *GamesMethod) Top(opt *ListOptions) (*TopsS, error)
Returns a list of games objects sorted by number of current viewers, most popular first.
type IngestsMethod ¶
type IngestsMethod struct {
// contains filtered or unexported fields
}
func (*IngestsMethod) List ¶
func (i *IngestsMethod) List() (*IngestsS, error)
type ListOptions ¶
type ListOptions struct {
Game string `url:"game,omitempty"`
Channel string `url:"channel,omitempty"`
Direction string `url:"direction,omitempty"`
Period string `url:"period,omitempty"`
Limit int `url:"limit,omitempty"`
Offset int `url:"offset,omitempty"`
Embeddable *bool `url:"embeddable,omitempty"`
Hls *bool `url:"hls,omitempty"`
Live *bool `url:"live,omitempty"`
}
type M3U8Options ¶
type OAuthCallback ¶
type OAuthCallback func(http.ResponseWriter, *http.Request) (*OAuthResponse, error)
type OAuthResponse ¶
type PanelDataS ¶
type PanelS ¶
type PanelS struct {
Id int `json:"_id,omitempty"`
DisplayOrder int `json:"display_order,omitempty"`
Kind string `json:"kind,omitempty"`
HtmlDescription string `json:"html_description,omitempty"`
UserId int `json:"user_id,omitempty"`
Data PanelDataS `json:"data,omitempty"`
Channel string `json:"channel,omitempty"`
}
type SChannelS ¶
type SChannelS struct {
Stream StreamS `json:"stream,omitempty"`
}
used with GET /streams/:channel/
type SearchMethod ¶
type SearchMethod struct {
// contains filtered or unexported fields
}
func (*SearchMethod) Games ¶
func (s *SearchMethod) Games(q string, opt *ListOptions) (*SGamesS, error)
func (*SearchMethod) Streams ¶
func (s *SearchMethod) Streams(q string, opt *ListOptions) (*StreamsS, error)
type StreamS ¶
type StreamS struct {
Id int `json:"_id,omitempty"`
Game string `json:"game,omitempty"`
Preview PreviewS `json:"preview,omitempty"`
Viewers int `json:"viewers,omitempty"`
Channel ChannelS `json:"channel,omitempty"`
VideoHeight int `json:"video_height,omitempty"`
AverageFPS float64 `json:"average_fps,omitempty"`
Delay int `json:"delay,omitempty"`
BroadcastPlatform string `json:"broadcast_platform,omitempty"`
CommunityId string `json:"community_id,omitempty"`
CommunityIds []string `json:"community_ids,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
IsPlaylist bool `json:"is_playlist"`
StreamType string `json:"stream_type,omitempty"`
}
Stream oject
type StreamsMethod ¶
type StreamsMethod struct {
// contains filtered or unexported fields
}
func (*StreamsMethod) Channel ¶
func (s *StreamsMethod) Channel(name string) (*SChannelS, error)
Returns a stream object if live.
func (*StreamsMethod) Featured ¶
func (s *StreamsMethod) Featured(opt *ListOptions) (*FeaturedS, error)
Returns a list of featured (promoted) stream objects.
func (*StreamsMethod) List ¶
func (s *StreamsMethod) List(opt *ListOptions) (*StreamsS, error)
Returns a list of stream objects according to optional parameters.
func (*StreamsMethod) Summary ¶
func (s *StreamsMethod) Summary(opt *ListOptions) (*SummaryS, error)
Returns a summary of current streams.
type StreamsS ¶
type StreamsS struct {
Total int `json:"_total,omitempty"`
Streams []StreamS `json:"streams,omitempty"`
}
used with GET /streams
type SummaryS ¶
type SummaryS struct {
Viewers int `json:"viewers,omitempty"`
Channels int `json:"channels,omitempty"`
}
used with GET /streams/summary
type TeamS ¶
type TeamS struct {
Id int `json:"_id,omitempty"`
Name string `json:"name,omitempty"`
Background string `json:"background,omitempty"`
Banner string `json:"banner,omitempty"`
Logo string `json:"logo,omitempty"`
Info string `json:"info,omitempty"`
DisplayName string `json:"display_name,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
}
Team object
type TeamsMethod ¶
type TeamsMethod struct {
// contains filtered or unexported fields
}
func (*TeamsMethod) List ¶
func (t *TeamsMethod) List(opt *ListOptions) (*TeamsS, error)
type UAuthedS ¶
type UAuthedS struct {
UserS
Email string `json:"email,omitempty"`
Partnered bool `json:"partnered,omitempty"`
Notifications UNotificationS `json:"notifications,omitempty"`
}
type UNotificationS ¶
type UserS ¶
type UserS struct {
Name string `json:"name,omitempty"`
Logo string `json:"logo,omitempty"`
ID int `json:"_id,omitempty"`
DisplayName string `json:"display_name,omitempty"`
Type string `json:"type,omitempty"`
Bio string `json:"bio,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
User object
type UsersMethod ¶
type UsersMethod struct {
// contains filtered or unexported fields
}
func (*UsersMethod) Authenticated ¶
func (u *UsersMethod) Authenticated() (*UAuthedS, error)
User returns a user object.
func (*UsersMethod) Follow ¶
func (u *UsersMethod) Follow(user, target string) (*UTargetS, error)
Get status of follow relationship between user and target channel
func (*UsersMethod) Follows ¶
func (u *UsersMethod) Follows(user string, opt *ListOptions) (*UFollowsS, error)
Get a user's list of followed channels
type VideoS ¶
type VideoS struct {
Title string `json:"title,omitempty"`
ID string `json:"_id,omitempty"`
Embed string `json:"embed,omitempty"`
Url string `json:"url,omitempty"`
Views int `json:"views,omitempty"`
Preview string `json:"preview,omitempty"`
Length int `json:"length,omitempty"`
Description string `json:"description,omitempty"`
BroadcastId int `json:"broadcast_id"`
RecordedAt string `json:"recorded_at,omitempty"`
Game string `json:"game,omitempty"`
Channel ChannelS `json:"channel,omitempty"`
}
Video object
type VideosMethod ¶
type VideosMethod struct {
// contains filtered or unexported fields
}
func (*VideosMethod) Top ¶
func (v *VideosMethod) Top(opt *ListOptions) (*VideosS, error)