twitch

package
v0.0.0-...-a7699f7 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientID        string = "1jcuu1fyzg8nabsmoplijb826zoyte0"
	RedirectURI     string = "http://localhost:8000/twitch/token/"
	RequestTokenURL string = "" +
		"https://id.twitch.tv/oauth2/authorize" +
		"?response_type=token" +
		"&client_id=" + ClientID +
		"&redirect_uri=" + RedirectURI +
		"&force_verify=true" +
		"&scope=channel_editor+channel_read"

	TwitchAPIURL string = "https://api.twitch.tv/kraken"
)

Variables

View Source
var (
	Token       = ""
	GameList    TopGamesResponse
	GameDB      []DBGame
	UserChannel Channel
)

Functions

func GetTopGamesNames

func GetTopGamesNames()

func Request

func Request(method string, url string, body io.Reader, auth bool, context bool) (string, error)

Request - request for twitch api

func SetTwitchChannel

func SetTwitchChannel()

func UpdateChannelGame

func UpdateChannelGame(game string)

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                           string `json:"_id"`
	Name                         string `json:"name"`
	CreatedAt                    string `json:"created_at"`
	UpdatedAt                    string `json:"updated_at"`
	Partner                      bool   `json:"partner"`
	VideoBanner                  string `json:"video_banner"`
	ProfileBanner                string `json:"profile_banner"`
	ProfileBannerBackgroundColor string `json:"profile_banner_background_color"`
	URL                          string `json:"url"`
	Views                        int64  `json:"views"`
	Followers                    int64  `json:"followers"`
	BroadcasterType              string `json:"broadcaster_type"`
	StreamKey                    string `json:"stream_key"`
	Email                        string `json:"email"`
}

func GetChannelInfo

func GetChannelInfo() Channel

type ChannelG

type ChannelG struct {
	ChannelA GameC `json:"channel"`
}

type DBGame

type DBGame struct {
	TwitchName       string   `json:"twitchName"`
	FilePath         string   `json:"filePath"`
	AlternativeNames []string `json:"alternativeName"`
}

func SearchGames

func SearchGames(query string) (DBGame, error)

SearchGames sends a request to twitch and checks if there is a game based on query

type Game

type Game struct {
	ID          int64      `json:"_id"`
	Box         GameImages `json:"box"`
	GiantbombID int64      `json:"giantbomb_id"`
	Name        string     `json:"name"`
	Popularity  int64      `json:"popularity"`
}

type GameC

type GameC struct {
	GameA string `json:"game"`
}

type GameImages

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

type SGame

type SGame struct {
	Name          string     `json:"name"`
	Popularity    int64      `json:"popularity"`
	ID            int64      `json:"_id"`
	GiantbombID   int64      `json:"giantbomb_id"`
	Box           GameImages `json:"box"`
	LocalizedName string     `json:"localized_name"`
	Locale        string     `json:"locale"`
}

SGame - Search Game

type SearchRespose

type SearchRespose struct {
	Games []SGame `json:"games"`
}

SearchRespose - Search Response

type TopGamesResponse

type TopGamesResponse struct {
	Total int64        `json:"_total"`
	Top   []TwitchGame `json:"top"`
}

func GetTopGames

func GetTopGames(limit int, offset int) TopGamesResponse

type TwitchGame

type TwitchGame struct {
	Channels int64 `json:"channels"`
	Viewers  int64 `json:"viewers"`
	Game     Game  `json:"game"`
}

Jump to

Keyboard shortcuts

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