twitch

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticate

func Authenticate() error

func CheckUserAccessToken added in v1.0.9

func CheckUserAccessToken(accessToken string) error

func SetTwitchCategories added in v1.2.4

func SetTwitchCategories() error

SetTwitchCategories sets the twitch categories in the database

Types

type AuthTokenResponse

type AuthTokenResponse struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
	TokenType   string `json:"token_type"`
}

type Category added in v1.2.4

type Category struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type CategoryResponse added in v1.2.4

type CategoryResponse struct {
	Data       []TwitchCategory `json:"data"`
	Pagination Pagination       `json:"pagination"`
}

type Channel

type Channel 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       int64  `json:"view_count"`
	CreatedAt       string `json:"created_at"`
}

type ChannelResponse

type ChannelResponse struct {
	Data []Channel `json:"data"`
}

type Data added in v1.2.0

type Data struct {
	Video GQLVideo `json:"video"`
}

type Details added in v1.2.4

type Details struct {
	Game     GameClass       `json:"game"`
	Typename DetailsTypename `json:"__typename"`
}

type DetailsTypename added in v1.2.4

type DetailsTypename string
const (
	GameChangeMomentDetails DetailsTypename = "GameChangeMomentDetails"
)

type Edge added in v1.2.4

type Edge struct {
	Node     Node   `json:"node"`
	Typename string `json:"__typename"`
}

type Extensions added in v1.2.0

type Extensions struct {
	DurationMilliseconds int64  `json:"durationMilliseconds"`
	RequestID            string `json:"requestID"`
}

type GQLChapterData added in v1.2.4

type GQLChapterData struct {
	Video GQLChapterDataVideo `json:"video"`
}

type GQLChapterDataVideo added in v1.2.4

type GQLChapterDataVideo struct {
	ID       string  `json:"id"`
	Moments  Moments `json:"moments"`
	Typename string  `json:"__typename"`
}

type GQLChapterResponse added in v1.2.4

type GQLChapterResponse struct {
	Data       GQLChapterData `json:"data"`
	Extensions Extensions     `json:"extensions"`
}

func GQLGetChapters added in v1.2.4

func GQLGetChapters(id string) (GQLChapterResponse, error)

type GQLGame added in v1.2.4

type GQLGame struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type GQLResponse added in v1.2.0

type GQLResponse struct {
	Data       Data       `json:"data"`
	Extensions Extensions `json:"extensions"`
}

func GQLGetVideo added in v1.2.0

func GQLGetVideo(id string) (GQLResponse, error)

type GQLVideo added in v1.2.0

type GQLVideo struct {
	BroadcastType       string              `json:"broadcastType"`
	ResourceRestriction ResourceRestriction `json:"resourceRestriction"`
	Game                GQLGame             `json:"game"`
	Title               string              `json:"title"`
	CreatedAt           string              `json:"createdAt"`
}

type GameClass added in v1.2.4

type GameClass struct {
	ID          string       `json:"id"`
	DisplayName string       `json:"displayName"`
	BoxArtURL   string       `json:"boxArtURL"`
	Typename    GameTypename `json:"__typename"`
}

type GameTypename added in v1.2.4

type GameTypename string
const (
	Game GameTypename = "Game"
)

type Language added in v1.1.0

type Language string

type Live

type Live 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  int64    `json:"viewer_count"`
	StartedAt    string   `json:"started_at"`
	Language     string   `json:"language"`
	ThumbnailURL string   `json:"thumbnail_url"`
	TagIDS       []string `json:"tag_ids"`
	IsMature     bool     `json:"is_mature"`
}

type Moments added in v1.2.4

type Moments struct {
	Edges    []Edge `json:"edges"`
	Typename string `json:"__typename"`
}

type Node added in v1.2.4

type Node struct {
	Moments              Moments   `json:"moments"`
	ID                   string    `json:"id"`
	DurationMilliseconds int64     `json:"durationMilliseconds"`
	PositionMilliseconds int64     `json:"positionMilliseconds"`
	Type                 Type      `json:"type"`
	Description          string    `json:"description"`
	SubDescription       string    `json:"subDescription"`
	ThumbnailURL         string    `json:"thumbnailURL"`
	Details              Details   `json:"details"`
	Video                NodeVideo `json:"video"`
	Typename             string    `json:"__typename"`
}

type NodeVideo added in v1.2.4

type NodeVideo struct {
	ID            string `json:"id"`
	LengthSeconds int64  `json:"lengthSeconds"`
	Typename      string `json:"__typename"`
}

type Pagination

type Pagination struct {
	Cursor string `json:"cursor"`
}

type ResourceRestriction added in v1.2.0

type ResourceRestriction struct {
	ID   string `json:"id"`
	Type string `json:"type"`
}

type Service

type Service struct {
}

func NewService

func NewService() *Service

func (*Service) GetCategories added in v1.2.4

func (s *Service) GetCategories() ([]*ent.TwitchCategory, error)

func (*Service) GetStreams

func (s *Service) GetStreams(queryParams string) (Stream, error)

func (*Service) GetVodByID

func (s *Service) GetVodByID(vID string) (Vod, error)

type Stream

type Stream struct {
	Data       []Live     `json:"data"`
	Pagination Pagination `json:"pagination"`
}

type TwitchAPI added in v1.2.3

type TwitchAPI interface {
	GetUserByLogin(login string) (Channel, error)
}
var (
	API TwitchAPI = &twitchAPI{}
)

type TwitchCategory added in v1.2.4

type TwitchCategory struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	BoxArtURL string `json:"box_art_url"`
	IgdbID    string `json:"igdb_id"`
}

func GetCategories added in v1.2.4

func GetCategories() ([]TwitchCategory, error)

GetCategories gets the top 100 twitch categories It then gets the next 100 categories until there are no more using the cursor Returns a different number of categories each time it is called for some reason

type TwitchVideoResponse added in v1.1.0

type TwitchVideoResponse struct {
	Data       []Video    `json:"data"`
	Pagination Pagination `json:"pagination"`
}

type Type added in v1.1.0

type Type string

type UserLogin added in v1.1.0

type UserLogin string

type UserName added in v1.1.0

type UserName string

type Video added in v1.1.0

type Video struct {
	ID            string      `json:"id"`
	StreamID      string      `json:"stream_id"`
	UserID        string      `json:"user_id"`
	UserLogin     UserLogin   `json:"user_login"`
	UserName      UserName    `json:"user_name"`
	Title         string      `json:"title"`
	Description   string      `json:"description"`
	CreatedAt     string      `json:"created_at"`
	PublishedAt   string      `json:"published_at"`
	URL           string      `json:"url"`
	ThumbnailURL  string      `json:"thumbnail_url"`
	Viewable      Viewable    `json:"viewable"`
	ViewCount     int64       `json:"view_count"`
	Language      Language    `json:"language"`
	Type          Type        `json:"type"`
	Duration      string      `json:"duration"`
	MutedSegments interface{} `json:"muted_segments"`
}

func GetVideosByUser added in v1.1.0

func GetVideosByUser(userID string, videoType string) ([]Video, error)

type Viewable added in v1.1.0

type Viewable string

type Vod

type Vod struct {
	ID            string      `json:"id"`
	StreamID      string      `json:"stream_id"`
	UserID        string      `json:"user_id"`
	UserLogin     string      `json:"user_login"`
	UserName      string      `json:"user_name"`
	Title         string      `json:"title"`
	Description   string      `json:"description"`
	CreatedAt     string      `json:"created_at"`
	PublishedAt   string      `json:"published_at"`
	URL           string      `json:"url"`
	ThumbnailURL  string      `json:"thumbnail_url"`
	Viewable      string      `json:"viewable"`
	ViewCount     int64       `json:"view_count"`
	Language      string      `json:"language"`
	Type          string      `json:"type"`
	Duration      string      `json:"duration"`
	MutedSegments interface{} `json:"muted_segments"`
}

type VodResponse

type VodResponse struct {
	Data       []Vod      `json:"data"`
	Pagination Pagination `json:"pagination"`
}

Jump to

Keyboard shortcuts

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