twitchgql

package module
v0.0.0-...-f94d6fd Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: GPL-3.0 Imports: 11 Imported by: 1

README

TwitchGQL

Go module for Twitch's GraphQL API

Due to the scale of Twitch's GraphQL API, this does not support every single type since it would be a quasi-impossible task.

If you want to query a particular type which is not supported, feel free to create an issue or a pull request and I will implement it.

Documentation

Index

Constants

View Source
const (
	GqlHost     = "gql.twitch.tv"
	GqlPath     = "gql"
	GqlClientId = "kimne78kx3ncx6brgo4mv6wki5h1ko"
)

Variables

View Source
var (
	GqlUrl = url.URL{
		Scheme: "https",
		Host:   GqlHost,
		Path:   GqlPath,
	}
)

Functions

func Request

func Request(client http.Client, req *http.Request, cont []byte) ([]byte, error)

Types

type Client

type Client struct {
	ClientId string
	Client   http.Client
}

type ImageParams

type ImageParams struct {
	Height int
	Width  int
}

type PageInfo

type PageInfo struct {
	Request  PageInfoRequest
	Response PageInfoResponse
}

func (*PageInfo) RequestParser

func (pi *PageInfo) RequestParser() (string, error)

func (*PageInfo) ResponseParser

func (pi *PageInfo) ResponseParser(res []byte)

type PageInfoRequest

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

type PageInfoResponse

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

type PlaybackAccessToken

type PlaybackAccessToken struct {
	Request  PlaybackAccessTokenRequest
	Response PlaybackAccessTokenResponse
}

func (*PlaybackAccessToken) RequestParser

func (pat *PlaybackAccessToken) RequestParser() (string, error)

func (*PlaybackAccessToken) ResponseParser

func (pat *PlaybackAccessToken) ResponseParser(res []byte)

type PlaybackAccessTokenRequest

type PlaybackAccessTokenRequest struct {
	Params    PlaybackAccessTokenRequestParams
	Signature bool
	Value     bool
}

type PlaybackAccessTokenRequestParams

type PlaybackAccessTokenRequestParams struct {
	Platform      string
	PlayerType    string
	PlayerBackend string
	HasAdblock    bool
	DisableHTTPs  bool
}

type PlaybackAccessTokenResponse

type PlaybackAccessTokenResponse struct {
	Signature string
	Value     string
}

type Type

type Type interface {
	RequestParser() (string, error)
	ResponseParser([]byte)
}

func Query

func Query(client Client, t Type) (Type, error)

type Video

type Video struct {
	Request  VideoRequest
	Response VideoResponse
}

func (*Video) RequestParser

func (v *Video) RequestParser() (string, error)

func (*Video) ResponseParser

func (v *Video) ResponseParser(res []byte)

type VideoDownload

type VideoDownload struct {
	Request  VideoDownloadRequest
	Response VideoDownloadResponse
}

func (*VideoDownload) RequestParser

func (vd *VideoDownload) RequestParser() (string, error)

func (*VideoDownload) ResponseParser

func (vd *VideoDownload) ResponseParser(res []byte)

type VideoDownloadRequest

type VideoDownloadRequest struct {
	Status bool
	Url    bool
}

type VideoDownloadResponse

type VideoDownloadResponse struct {
	Status string
	Url    string
}

type VideoEdge

type VideoEdge struct {
	Request  VideoEdgeRequest
	Response VideoEdgeResponse
}

func (*VideoEdge) RequestParser

func (ve *VideoEdge) RequestParser() (string, error)

func (*VideoEdge) ResponseParser

func (ve *VideoEdge) ResponseParser(res []byte)

type VideoEdgeRequest

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

type VideoEdgeResponse

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

type VideoRequest

type VideoRequest struct {
	Params              VideoRequestParams
	AnimatedPreviewUrl  bool
	BroadcastType       bool
	CreatedAt           bool
	Creator             bool
	DeletedAt           bool
	Description         bool
	Download            *VideoDownload
	Duration            bool
	Game                bool
	Id                  bool
	SoftDeleted         bool
	Language            bool
	OffsetSeconds       bool
	PlaybackAccessToken *PlaybackAccessToken
	PublishedAt         bool
	RecordedAt          bool
	Scope               bool
	PreviewsUrl         bool
	Status              bool
	Tags                bool
	PreviewThumbnailUrl ImageParams
	ThumbnailUrls       ImageParams
	Title               bool
	UpdatedAt           bool
	ViewCount           bool
	ViewableAt          bool
}

type VideoRequestParams

type VideoRequestParams struct {
	Id             int
	IncludePrivate bool // Include private videos. Will return an error if unauthenticated.
}

type VideoResponse

type VideoResponse struct {
	AnimatedPreviewUrl  string
	BroadcastType       string
	CreatedAt           time.Time
	DeletedAt           time.Time
	Description         string
	Download            *VideoDownload
	Duration            time.Duration
	Id                  int
	SoftDeleted         bool
	Language            string
	OffsetSeconds       int
	PlaybackAccessToken *PlaybackAccessToken
	PublishedAt         time.Time
	RecordedAt          time.Time
	Scope               string
	PreviewsUrl         string
	Status              string
	Tags                []string
	PreviewThumbnailURL string
	ThumbnailUrls       []string
	Title               string
	UpdatedAt           time.Time
	ViewCount           int
	ViewableAt          time.Time
}

Jump to

Keyboard shortcuts

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