helixapi

package
v0.0.0-...-d0bd67e Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package helixapi is used for twitch's helix API

Index

Constants

View Source
const AppName string = "goPurple/helix"

AppName is the name of the application

View Source
const BaseURL = "https://api.twitch.tv/helix"

BaseURL of the twitch helix API

View Source
const FullVersion string = AppName + VersionMajor + "." + VersionMinor + "." + VersionPatch + VersionBuild

FullVersion contains the full name and version of this package in a printable string

View Source
const VersionBuild string = "b"

VersionBuild is the type of this release. s(table), b(eta), d(evelopment), n(ightly)

View Source
const VersionMajor string = "0"

VersionMajor 0 means in development, >1 ensures compatibility with each minor version, but breakes with new major version

View Source
const VersionMinor string = "1"

VersionMinor introduces changes that require a new version number. If the major version is 0, they are likely to break compatibility

View Source
const VersionPatch string = "0"

VersionMinor introduces changes that do not break compatibility, but require a new version number.

Variables

This section is empty.

Functions

func GenerateAuthorizeRequest

func GenerateAuthorizeRequest(clientID, redirectURI, scopes string) string

func GetRefreshTokenClientCredentials

func GetRefreshTokenClientCredentials(clientID, clientSecret, scope string) (resp *tokenReponse, jsoerr *network.JSONError, err error)

func GetRefreshTokenFromAuthCode

func GetRefreshTokenFromAuthCode(clientID, clientSecret, authCode, redirectURI string) (resp *tokenReponse, jsoerr *network.JSONError, err error)

func RefreshToken

func RefreshToken(clientID, clientSecret, refreshToken string) (resp *tokenReponse, jsoerr *network.JSONError, err error)

Types

type Following

type Following struct {
	FromID     string    `json:"from_id"`
	FromLogin  string    `json:"from_login"`
	FromName   string    `json:"from_name"`
	ToID       string    `json:"to_id"`
	ToName     string    `json:"to_name"`
	FollowedAt time.Time `json:"followed_at"`
}

Following contains information about a follow relation of a user

type Followings

type Followings struct {
	Total      int         `json:"total"`
	Followings []Following `json:"data"`
	Pagination struct {
		Cursor string `json:"cursor"`
	} `json:"pagination"`
}

type Stream

type Stream struct {
	ID           string    `json:"id"`
	UserID       string    `json:"user_id"`
	UserLogin    string    `json:"user_login"`
	UserName     string    `json:"user_name"`
	GameID       string    `json:"game_id"`
	GameName     string    `json:"game_name"`
	Type         string    `json:"type"`
	Title        string    `json:"title"`
	ViewerCount  int       `json:"viewer_count"`
	StartedAt    time.Time `json:"started_at"`
	Language     string    `json:"language"`
	ThumbnailURL string    `json:"thumbnail_url"`
	TagIds       []string  `json:"tag_ids"`
	IsMature     bool      `json:"is_mature"`
}

type Streams

type Streams struct {
	Streams []Stream `json:"data"`
}

type TwitchHelix

type TwitchHelix struct {
	ClientID     string
	BearerToken  string
	ClientSecret string
	Scope        string
}

TwitchKraken exposes the twitch kraken API (v5)

func (*TwitchHelix) GetFollowers

func (th *TwitchHelix) GetFollowers(channelID string, count int, cursor string) (resp *Followings, jsoerr *network.JSONError, err error)

func (*TwitchHelix) GetStream

func (th *TwitchHelix) GetStream(channelID string) (resp *Stream, jsoerr *network.JSONError, err error)

GetStream gets information about a stream

func (*TwitchHelix) GetStreamByLogin

func (th *TwitchHelix) GetStreamByLogin(login string) (resp *Stream, jsoerr *network.JSONError, err error)

GetStreamByLogin gets information about a stream

func (*TwitchHelix) GetUserByName

func (th *TwitchHelix) GetUserByName(name string) (resp *Users, jsoerr *network.JSONError, err error)

GetUserByName returns a single user searched by name

func (*TwitchHelix) GetUsersByNames

func (th *TwitchHelix) GetUsersByNames(names []string) (resp *Users, jsoerr *network.JSONError, err error)

GetUsersByNames returns a list of users searched by their names

func (*TwitchHelix) IsUserFollowingChannel

func (th *TwitchHelix) IsUserFollowingChannel(userID, channelID string) (resp *Followings, jsoerr *network.JSONError, err error)

IsUserFollowingChannel returns a relation if a specific user is following a channel

func (*TwitchHelix) ValidateAndRefreshClientCredentials

func (th *TwitchHelix) ValidateAndRefreshClientCredentials() (resp *verificationResponse, jsoerr *network.JSONError, err error)

func (*TwitchHelix) ValidateToken

func (th *TwitchHelix) ValidateToken() (resp *verificationResponse, jsoerr *network.JSONError, err error)

type User

type User struct {
	ID              string    `json:"id"`
	Login           string    `json:"login"`
	DisplayName     string    `json:"display_name"`
	Type            string    `json:"type"`
	BroadcasterType string    `json:"broadcaster_type"`
	Description     string    `json:"description"`
	ProfileImageURL string    `json:"profile_image_url"`
	OfflineImageURL string    `json:"offline_image_url"`
	ViewCount       int       `json:"view_count"`
	Email           string    `json:"email"`
	CreatedAt       time.Time `json:"created_at"`
}

User contains information about a user

type Users

type Users struct {
	Users []User `json:"data"`
}

Users is a list of users

Jump to

Keyboard shortcuts

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