twitch

package
v0.0.0-...-a93ac6b Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeRequest

func MakeRequest(m string, e string, d io.Reader) (data []byte, err error)

MakeRequest makes a request using the proper credentials to the Twitch API v5

func UpdateChannel

func UpdateChannel(channelID string, channelUpdate *TwitchChannelEditData) error

UpdateChannel updates the twitch channel

Types

type TwitchChannel

type TwitchChannel struct {
	Status      string `json:"status"`
	Game        string `json:"game"`
	Followers   int    `json:"followers"`
	Views       int    `json:"views"`
	DisplayName string `json:"display_name"`
	ID          string `json:"_id"`
}

TODO: Add more fields to this...

func GetChannel

func GetChannel(channelID string) *TwitchChannel

GetChannel returns a TwitchChannel given a channelID

func GetMyChannel

func GetMyChannel() *TwitchChannel

GetMyChannel gets the channel from OAuth token

type TwitchChannelEdit

type TwitchChannelEdit struct {
	Channel *TwitchChannelEditData `json:"channel"`
}

type TwitchChannelEditData

type TwitchChannelEditData struct {
	Status string `json:"status"`
	Game   string `json:"game"`
}

type TwitchStream

type TwitchStream struct {
	Data *TwitchStreamData `json:"stream,omitempty"`
}

type TwitchStreamData

type TwitchStreamData struct {
	Game      string               `json:"game"`
	Viewers   int                  `json:"viewers"`
	Preview   *TwitchStreamPreview `json:"preview"`
	Channel   *TwitchChannel       `json:"channel"`
	CreatedAt string               `json:"created_at"`
	Delay     int                  `json:"delay"`
}

func GetStream

func GetStream(channelID string) *TwitchStreamData

GetStream gets the stream for a channel if it is online.

type TwitchStreamPreview

type TwitchStreamPreview struct {
	Small  string `json:"small"`
	Medium string `json:"medium"`
}

type TwitchUser

type TwitchUser struct {
	ID   string `json:"_id"`
	Name string `json:"name"`
	Type string `json:"type"`
}

func GetUser

func GetUser(login string) *TwitchUser

GetUser gets a single user based on the login TODO: check if there are users..

func GetUsers

func GetUsers(logins []string) []*TwitchUser

GetUsers gets a list of users

type TwitchUsers

type TwitchUsers struct {
	Total int           `json:"_total"`
	Users []*TwitchUser `json:"users"`
}

Jump to

Keyboard shortcuts

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