twitch

package
v0.0.0-...-3db6df7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2014 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockS

type BlockS struct {
	User UserS `json:"user,omitempty"`
	Id   int   `json:"_id,omitempty"`
}

type BlocksS

type BlocksS struct {
	Blocks []BlockS `json:"blocks,omitempty"`
	Links  LinksS   `json:"_links,omitempty"`
}

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"`
	Url                          string        `json:"url,omitempty"`
	DisplayName                  string        `json:"display_name,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) 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) 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 struct {
	Links ChatLinksS `json:"_links,omitempty"`
}

type ChatLinksS

type ChatLinksS struct {
	Emoticons string `json:"emoticons,omitempty"`
	Badges    string `json:"badges,omitempty"`
}

type ChatMethod

type ChatMethod struct {
	// contains filtered or unexported fields
}

func (*ChatMethod) Channel

func (c *ChatMethod) Channel(name string) (*ChatLinks, error)

func (*ChatMethod) Emoticons

func (c *ChatMethod) Emoticons() (*EmoticonsS, error)

type Client

type Client struct {
	BaseURL  *url.URL
	ClientId string

	// Twitch api methods
	Channels *ChannelsMethod
	Chat     *ChatMethod
	Games    *GamesMethod
	Ingests  *IngestsMethod
	Search   *SearchMethod
	Streams  *StreamsMethod
	Teams    *TeamsMethod
	Users    *UsersMethod
	Videos   *VideosMethod
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient *http.Client) *Client

Returns a new twitch client used to communicate with the API.

func (*Client) Get

func (c *Client) Get(path string, r interface{}) (*http.Response, error)

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 EmoticonS

type EmoticonS struct {
	Regex  string   `json:"regex,omitempty"`
	Images []ImageS `json:"images,omitempty"`
}

type EmoticonsS

type EmoticonsS struct {
	Emoticons []EmoticonS `json:"emoticons,omitempty"`
}

type FStreamS

type FStreamS struct {
	Stream StreamS `json:"stream,omitempty"`
	Text   string  `json:"text,omitempty"`
	Image  string  `json:"image,omitempty"`
}

type FeaturedS

type FeaturedS struct {
	Featured []FStreamS `json:"featured,omitempty"`
	Links    LinksS     `json:"_links,omitempty"`
}

used with GET /streams/featured

type FollowS

type FollowS struct {
	User UserS `json:"user,omitempty"`
}

type FollowedS

type FollowedS struct {
	Streams []StreamS `json:"streams,omitempty"`
	Links   LinksS    `json:"_links,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 GameS

type GameS struct {
	Name        string   `json:"name,omitempty"`
	Box         PreviewS `json:"box,omitempty"`
	Id          int      `json:"_id,omitempty"`
	GiantbombId int      `json:"giantbomb_id,omitempty"`
}

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 ImageS

type ImageS struct {
	EmoticonSet int    `json:"emoticon_set,omitempty"`
	Height      int    `json:"height,omitempty"`
	Width       int    `json:"width,omitempty"`
	Url         string `json:"url,omitempty"`
}

type ImagesS

type ImagesS struct {
	Thumb  string `json:"thumb,omitempty"`
	Tiny   string `json:"tiny,omitempty"`
	Small  string `json:"small,omitempty"`
	Super  string `json:"super,omitempty"`
	Medium string `json:"medium,omitempty"`
	Icon   string `json:"icon,omitempty"`
	Screen string `json:"screen,omitempty"`
}

type IngestS

type IngestS struct {
	Name         string  `json:"name,omitempty"`
	Default      bool    `json:"default,omitempty"`
	Id           int     `json:"_id,omitempty"`
	UrlTemplate  string  `json:"url_template,omitempty"`
	Availability float64 `json:"availability,omitempty"`
}

type IngestsMethod

type IngestsMethod struct {
	// contains filtered or unexported fields
}

func (*IngestsMethod) List

func (i *IngestsMethod) List() (*IngestsS, error)

type IngestsS

type IngestsS struct {
	Ingests []IngestS `json:"ingests,omitempty"`
}

type LinksS

type LinksS struct {
	Next string `json:"next,omitempty"`
}

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 PreviewS

type PreviewS struct {
	Small    string `json:"small,omitempty"`
	Medium   string `json:"medium,omitempty"`
	Large    string `json:"large,omitempty"`
	Template string `json:"template,omitempty"`
}

type SChannelS

type SChannelS struct {
	Stream StreamS `json:"stream,omitempty"`
	Links  LinksS  `json:"_links,omitempty"`
}

used with GET /streams/:channel/

type SGameS

type SGameS struct {
	Box         PreviewS `json:"box,omitempty"`
	Images      ImagesS  `json:"images,omitempty"`
	Popularity  int      `json:"popularity,omitempty"`
	Name        string   `json:"name,omitempty"`
	Id          int      `json:"_id,omitempty"`
	GiantbombId int      `json:"giantbomb_id,omitempty"`
}

type SGamesS

type SGamesS struct {
	Games []SGameS `json:"games,omitempty"`
}

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"`
	Name        string   `json:"name,omitempty"`
	Preview     string   `json:"preview,omitempty"`
	Viewers     int      `json:"viewers,omitempty"`
	Broadcaster string   `json:"broadcaster,omitempty"`
	Geo         string   `json:"geo,omitempty"`
	Channel     ChannelS `json:"channel,omitempty"`
	Status      string   `json:"status,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"`
	Links   LinksS    `json:"_links,omitempty"`
}

used with GET /streams

type SubS

type SubS struct {
	Id   string `json:"_id,omitempty"`
	User UserS  `json:"user,omitempty"`
}

type SubsS

type SubsS struct {
	Total         int    `json:"_total,omitempty"`
	Links         LinksS `json:"_links,omitempty"`
	Subscriptions []SubS `json:"subscriptions,omitempty"`
}

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"`
	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)

func (*TeamsMethod) Team

func (t *TeamsMethod) Team(name string) (*TeamS, error)

type TeamsS

type TeamsS struct {
	Teams []TeamS `json:"teams,omitempty"`
	Links LinksS  `json:"_links,omitempty"`
}

type TopS

type TopS struct {
	Game     GameS `json:"game,omitempty"`
	Viewers  int   `json:"viewers,omitempty"`
	Channels int   `json:"channels,omitempty"`
}

type TopsS

type TopsS struct {
	Links LinksS `json:"_links,omitempty"`
	Total int    `json:"_total,omitempty"`
	Top   []TopS `json:"top,omitempty"`
}

type UFollowS

type UFollowS struct {
	Channel ChannelS `json:"channel,omitempty"`
}

type UFollowsS

type UFollowsS struct {
	Follows []UFollowS `json:"follows,omitempty"`
	Links   LinksS     `json:"_links,omitempty"`
	Total   int        `json:"_total,omitempty"`
}

type UTargetS

type UTargetS struct {
	Channel   ChannelS `json:"channel,omitempty"`
	CreatedAt string   `json:"created_at,omitempty"`
}

type UserS

type UserS struct {
	Name        string `json:"name,omitempty"`
	ID          int    `json:"_id,omitempty"`
	DisplayName string `json:"display_name,omitempty"`
	Staff       bool   `json:"staff,omitempty"`
	CreatedAt   string `json:"created_at,omitempty"`
	UpdatedAt   string `json:"updated_at,omitempty"`
}

User object

type UsersMethod

type UsersMethod struct {
	// contains filtered or unexported fields
}

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

func (*UsersMethod) User

func (u *UsersMethod) User(user string) (*UserS, error)

User returns a user object.

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) Id

func (v *VideosMethod) Id(id string) (*VideoS, error)

func (*VideosMethod) Top

func (v *VideosMethod) Top(opt *ListOptions) (*VideosS, error)

type VideosS

type VideosS struct {
	Videos []VideoS `json:"videos,omitempty"`
	Links  LinksS   `json:"_links,omitempty"`
}

used with GET /channels/:channel/videos

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL