gotwitch

package module
v0.0.0-...-5924c42 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2019 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

gotwitch Build Status

This branch is using the new helix api which is under development.

Example for getting a Stream object

package main

import (
    "fmt"

    "github.com/dankeroni/gotwitch"
)

var api = gotwitch.New("<ClientID>")

func main() {
    api.GetStream("pajlada", onSuccess, onHTTPError, onInternalError)
}

func onSuccess(stream gotwitch.Stream) {
    fmt.Printf("%+v\n", stream)
}

func onHTTPError(statusCode int, statusMessage, errorMessage string) {
    fmt.Println("statusCode:", statusCode)
    fmt.Println("statusMessage:", statusMessage)
    fmt.Println("errorMessage:", errorMessage)
}

func onInternalError(err error) {
    fmt.Println("internalError:", err)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetChatters

func GetChatters(channelName string, onSuccess func(Chatters), onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback) (response *http.Response, err error)

Types

type AppAccessTokenResponse

type AppAccessTokenResponse struct {
	AccessToken  string   `json:"access_token"`
	RefreshToken string   `json:"refresh_token"`
	ExpiresIn    int      `json:"expires_in"`
	Scopes       []string `json:"scope"`
	TokenType    string   `json:"token_type"`
}

type Block

type Block struct {
	ID        int       `json:"_id"`
	UpdatedAt time.Time `json:"updated_at"`
	User      User      `json:"user"`
}

Block json to struct

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                           int       `json:"_id"`
	Name                         string    `json:"name"`
	CreatedAt                    time.Time `json:"created_at"`
	UpdatedAt                    time.Time `json:"updated_at"`
	Delay                        int       `json:"delay"`
	Banner                       string    `json:"banner"`
	VideoBanner                  string    `json:"video_banner"`
	Background                   string    `json:"background"`
	ProfileBanner                string    `json:"profile_banner"`
	ProfileBannerBackgroundColor string    `json:"profile_banner_background_color"`
	Partner                      bool      `json:"partner"`
	URL                          string    `json:"url"`
	Views                        int       `json:"views"`
	Followers                    int       `json:"followers"`
	Email                        string    `json:"email"`
	StreamKey                    string    `json:"stream_key"`
}

Channel json to struct

func (*Channel) GetName

func (c *Channel) GetName() string

GetName returns the users display name if it's set, otherwise return the login name

type Chatters

type Chatters struct {
	Moderators []string `json:"moderators"`
	Staff      []string `json:"staff"`
	Admins     []string `json:"admins"`
	GlobalMods []string `json:"global_mods"`
	Viewers    []string `json:"viewers"`
}

Chatters json to struct

func GetChattersSimple

func GetChattersSimple(channelName string) (data *Chatters, response *http.Response, err error)

type ChattersResponse

type ChattersResponse struct {
	Links        struct{} `json:"_links"`
	ChatterCount int      `json:"chatter_count"`
	Chatters     Chatters `json:"chatters"`
}

ChattersResponse json to struct

type Credentials

type Credentials struct {
	ClientID       string
	ClientSecret   string
	AppAccessToken string
}

type Follow

type Follow struct {
	CreatedAt     time.Time `json:"created_at"`
	Notifications bool      `json:"notifications"`
	Channel       Channel   `json:"channel"`
}

Follow json to struct

type FollowedStreams

type FollowedStreams struct {
	Streams []Stream `json:"streams"`
	Total   int      `json:"_total"`
}

FollowedStreams json to struct

type Follows

type Follows struct {
	Follows []Follow `json:"follows"`
	Total   int      `json:"_total"`
}

Follows json to struct

type Pagination

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

type Post

type Post struct {
	ID        string    `json:"id"`
	CreatedAt time.Time `json:"created_at"`
	Deleted   bool      `json:"deleted"`
	Body      string    `json:"body"`
	Emotes    []struct {
		ID    int `json:"id"`
		Start int `json:"start"`
		End   int `json:"end"`
		Set   int `json:"set"`
	} `json:"emotes"`
	Embeds []struct {
		Type         string    `json:"type"`
		TwitchType   string    `json:"twitch_type"`
		Title        string    `json:"title"`
		Description  string    `json:"description"`
		AuthorName   string    `json:"author_name"`
		ThumbnailURL string    `json:"thumbnail_url"`
		Game         string    `json:"game"`
		PlayerHTML   string    `json:"player_html"`
		CreatedAt    time.Time `json:"created_at"`
		RequestURL   string    `json:"request_url"`
		VideoLength  int       `json:"video_length"`
		ProviderName string    `json:"provider_name"`
	} `json:"embeds"`
	Reactions map[string]struct {
		Emote   string `json:"emote"`
		Count   int    `json:"count"`
		UserIDs []int  `json:"user_ids"`
	} `json:"reactions"`
	User     User `json:"user"`
	Comments struct {
		Total    int           `json:"_total"`
		Cursor   string        `json:"_cursor"`
		Comments []interface{} `json:"comments"`
	} `json:"comments"`
	Permissions struct {
		CanReply    bool `json:"can_reply"`
		CanModerate bool `json:"can_moderate"`
		CanDelete   bool `json:"can_delete"`
	} `json:"permissions"`
}

Post json to struct

type Posts

type Posts struct {
	Total  int    `json:"_total"`
	Cursor string `json:"_cursor"`
	Topic  string `json:"_topic"`
	Posts  []Post `json:"posts"`
}

Posts json to struct

type Reaction

type Reaction struct {
	ID        string    `json:"id"`
	CreatedAt time.Time `json:"created_at"`
	EmoteID   string    `json:"emote_id"`
	User      User      `json:"user"`
}

Reaction json to struct

type Self

type Self struct {
	Identified bool `json:"identified"`
	Links      struct {
		User     string `json:"user"`
		Channel  string `json:"channel"`
		Search   string `json:"search"`
		Streams  string `json:"streams"`
		Ingests  string `json:"ingests"`
		Teams    string `json:"teams"`
		Users    string `json:"users"`
		Channels string `json:"channels"`
		Chat     string `json:"chat"`
	} `json:"_links"`
	Token struct {
		Valid         bool `json:"valid"`
		Authorization struct {
			Scopes    []string  `json:"scopes"`
			CreatedAt time.Time `json:"created_at"`
			UpdatedAt time.Time `json:"updated_at"`
		} `json:"authorization"`
		UserName string `json:"user_name"`
		ClientID string `json:"client_id"`
	} `json:"token"`
}

Self json to struct

type SharedPost

type SharedPost struct {
	Tweet string `json:"tweet"`
	Post  Post   `json:"post"`
}

SharedPost json to struct

type Stream

type Stream struct {
	ID           string    `json:"id"`
	UserID       string    `json:"user_id"`
	UserName     string    `json:"user_name"`
	GameID       string    `json:"game_id"`
	CommunityIds []string  `json:"community_ids"`
	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"`
}

Stream json to struct

type TwitchAPI

type TwitchAPI struct {
	Credentials *Credentials
	// contains filtered or unexported fields
}

TwitchAPI struct

func New

func New(clientID string) *TwitchAPI

New instantiates a new TwitchAPI object

func NewV5

func NewV5(clientID string) *TwitchAPI

NewV5 instantiates a new TwitchAPI object

func (*TwitchAPI) AuthenticatedDelete

func (twitchAPI *TwitchAPI) AuthenticatedDelete(url string,
	parameters url.Values,
	oauthToken string,
	responseBody interface{},
	onSuccess jsonapi.SuccessCallback,
	onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback) (response *http.Response, err error)

AuthenticatedDelete request

func (*TwitchAPI) AuthenticatedGet

func (twitchAPI *TwitchAPI) AuthenticatedGet(url string,
	parameters url.Values,
	oauthToken string,
	responseBody interface{},
	onSuccess jsonapi.SuccessCallback,
	onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback) (response *http.Response, err error)

AuthenticatedGet request

func (*TwitchAPI) AuthenticatedGetChannel

func (twitchAPI *TwitchAPI) AuthenticatedGetChannel(oauthToken string,
	onSuccess func(Channel), onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback)

AuthenticatedGetChannel request for GET https://api.twitch.tv/kraken/channel

func (*TwitchAPI) AuthenticatedGetPost

func (twitchAPI *TwitchAPI) AuthenticatedGetPost(oauthToken, postID, channelName string,
	onSuccess func(Post), onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback)

AuthenticatedGetPost request for GET https://api.twitch.tv/kraken/feed/:channel/posts/:id

func (*TwitchAPI) AuthenticatedGetPosts

func (twitchAPI *TwitchAPI) AuthenticatedGetPosts(oauthToken, channelName string,
	parameters url.Values, onSuccess func(Posts), onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback)

AuthenticatedGetPosts request for GET https://api.twitch.tv/kraken/feed/:channel/posts

func (*TwitchAPI) AuthenticatedPost

func (twitchAPI *TwitchAPI) AuthenticatedPost(url string,
	parameters url.Values,
	oauthToken string,
	requestBody interface{},
	responseBody interface{},
	onSuccess jsonapi.SuccessCallback,
	onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback) (response *http.Response, err error)

AuthenticatedPost request

func (*TwitchAPI) AuthenticatedPut

func (twitchAPI *TwitchAPI) AuthenticatedPut(url string,
	parameters url.Values,
	oauthToken string,
	requestBody interface{},
	responseBody interface{},
	onSuccess jsonapi.SuccessCallback,
	onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback) (response *http.Response, err error)

AuthenticatedPut request

func (*TwitchAPI) DeleteBlock

func (twitchAPI *TwitchAPI) DeleteBlock(oauthToken, user, target string, onSuccess func(),
	onHTTPError jsonapi.HTTPErrorCallback, onInternalError jsonapi.InternalErrorCallback)

DeleteBlock request for DELETE https://api.twitch.tv/kraken/users/:user/blocks/:target

func (*TwitchAPI) DeleteFollow

func (twitchAPI *TwitchAPI) DeleteFollow(oauthToken, user, target string, onSuccess func(),
	onHTTPError jsonapi.HTTPErrorCallback, onInternalError jsonapi.InternalErrorCallback)

DeleteFollow request for DELETE https://api.twitch.tv/kraken/users/:user/follows/channels/:target

func (*TwitchAPI) DeletePost

func (twitchAPI *TwitchAPI) DeletePost(oauthToken, postID, channelName string, onSuccess func(),
	onHTTPError jsonapi.HTTPErrorCallback, onInternalError jsonapi.InternalErrorCallback)

DeletePost request for DELETE https://api.twitch.tv/kraken/feed/:channel/posts/:id

func (*TwitchAPI) DeleteReaction

func (twitchAPI *TwitchAPI) DeleteReaction(oauthToken, emoteID, postID, channelName string,
	onSuccess func(), onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback)

DeleteReaction request for DELETE https://api.twitch.tv/kraken/feed/:channel/posts/:id/reactions

func (*TwitchAPI) GetAppAccessToken

func (twitchAPI *TwitchAPI) GetAppAccessToken(onSuccess func(AppAccessTokenResponse), onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback)

GetAppAccessToken will also authenticate this TwitchAPI object, so any further requests that require the "app access token" has them

func (*TwitchAPI) GetAppAccessTokenSimple

func (twitchAPI *TwitchAPI) GetAppAccessTokenSimple() (response *AppAccessTokenResponse, err error)

func (*TwitchAPI) GetBlock

func (twitchAPI *TwitchAPI) GetBlock(oauthToken, user, target string, onSuccess func(Block),
	onHTTPError jsonapi.HTTPErrorCallback, onInternalError jsonapi.InternalErrorCallback)

GetBlock request for GET https://api.twitch.tv/kraken/users/:user/blocks/:target

func (*TwitchAPI) GetBlocks

func (twitchAPI *TwitchAPI) GetBlocks(oauthToken, user string, parameters url.Values,
	onSuccess func([]Block), onHTTPError jsonapi.HTTPErrorCallback, onInternalError jsonapi.InternalErrorCallback)

GetBlocks request for GET https://api.twitch.tv/kraken/users/:user/blocks

func (*TwitchAPI) GetChannel

func (twitchAPI *TwitchAPI) GetChannel(channelName string, onSuccess func(Channel),
	onHTTPError jsonapi.HTTPErrorCallback, onInternalError jsonapi.InternalErrorCallback)

GetChannel request for GET https://api.twitch.tv/kraken/channels/:channel

func (*TwitchAPI) GetClip

func (twitchAPI *TwitchAPI) GetClip(clipSlug string) (data V5GetClipResponse, response *http.Response, err error)

func (*TwitchAPI) GetClipVerbose

func (twitchAPI *TwitchAPI) GetClipVerbose(clipSlug string,
	onSuccess func(V5GetClipResponse),
	onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback) (response *http.Response, err error)

func (*TwitchAPI) GetFollow

func (twitchAPI *TwitchAPI) GetFollow(user, target string, onSuccess func(Follow),
	onHTTPError jsonapi.HTTPErrorCallback, onInternalError jsonapi.InternalErrorCallback)

GetFollow request for GET https://api.twitch.tv/kraken/users/:user/follows/channels/:target

func (*TwitchAPI) GetFollowedStreams

func (twitchAPI *TwitchAPI) GetFollowedStreams(oauthToken string, parameters url.Values,
	onSuccess func(FollowedStreams), onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback)

GetFollowedStreams request for GET https://api.twitch.tv/kraken/streams/followed

func (*TwitchAPI) GetFollows

func (twitchAPI *TwitchAPI) GetFollows(user string, parameters url.Values, onSuccess func(Follows),
	onHTTPError jsonapi.HTTPErrorCallback, onInternalError jsonapi.InternalErrorCallback)

GetFollows request for GET https://api.twitch.tv/kraken/users/:user/follows/channels

func (*TwitchAPI) GetPost

func (twitchAPI *TwitchAPI) GetPost(postID, channelName string, onSuccess func(Post),
	onHTTPError jsonapi.HTTPErrorCallback, onInternalError jsonapi.InternalErrorCallback)

GetPost request for GET https://api.twitch.tv/kraken/feed/:channel/posts/:id

func (*TwitchAPI) GetPosts

func (twitchAPI *TwitchAPI) GetPosts(channelName string, parameters url.Values,
	onSuccess func(Posts), onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback)

GetPosts request for GET https://api.twitch.tv/kraken/feed/:channel/posts

func (*TwitchAPI) GetSelf

func (twitchAPI *TwitchAPI) GetSelf(oauthToken string, onSuccess func(Self),
	onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback) (response *http.Response, err error)

GetSelf request for GET https://api.twitch.tv/kraken/

func (*TwitchAPI) GetSelfSimple

func (twitchAPI *TwitchAPI) GetSelfSimple(oauthToken string) (data *Self, response *http.Response, err error)

func (*TwitchAPI) GetStream

func (twitchAPI *TwitchAPI) GetStream(channelName string, onSuccess func(Stream),
	onHTTPError jsonapi.HTTPErrorCallback, onInternalError jsonapi.InternalErrorCallback)

GetStream request for GET https://api.twitch.tv/kraken/streams/:channel

func (*TwitchAPI) GetStreams

func (twitchAPI *TwitchAPI) GetStreams(userIDs []string,
	userLogins []string,
	onSuccess func([]Stream),
	onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback) (response *http.Response, err error)

GetStreams request for GET https://api.twitch.tv/helix/streams https://dev.twitch.tv/docs/api/reference/#get-streams

func (*TwitchAPI) GetStreamsSimple

func (twitchAPI *TwitchAPI) GetStreamsSimple(userIDs []string, userLogins []string) (data []Stream, response *http.Response, err error)

func (*TwitchAPI) GetUsers

func (twitchAPI *TwitchAPI) GetUsers(userIDs []string,
	onSuccess func([]User),
	onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback) (response *http.Response, err error)

GetUsers request for GET https://api.twitch.tv/helix/users

func (*TwitchAPI) GetUsersByLogin

func (twitchAPI *TwitchAPI) GetUsersByLogin(userLogins []string,
	onSuccess func([]User),
	onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback) (response *http.Response, err error)

GetUsersByLogin request for GET https://api.twitch.tv/helix/users

func (*TwitchAPI) GetUsersByLoginSimple

func (twitchAPI *TwitchAPI) GetUsersByLoginSimple(userLogins []string) (data []User, response *http.Response, err error)

GetUsersByLoginSimple request for GET https://api.twitch.tv/helix/users

func (*TwitchAPI) GetUsersSimple

func (twitchAPI *TwitchAPI) GetUsersSimple(userIDs []string) (data []User, response *http.Response, err error)

GetUsersSimple request for GET https://api.twitch.tv/helix/users

func (*TwitchAPI) GetWebhookSubscriptions

func (twitchAPI *TwitchAPI) GetWebhookSubscriptions(after, first string,
	onSuccess func(WebhookSubscriptionsResponse),
	onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback) (response *http.Response, err error)

https://dev.twitch.tv/docs/api/reference/#get-webhook-subscriptions

func (*TwitchAPI) GetWebhookSubscriptionsSimple

func (twitchAPI *TwitchAPI) GetWebhookSubscriptionsSimple(after, first string) (data *WebhookSubscriptionsResponse, response *http.Response, err error)

GetWebhookSubscriptionsSimple simplifies GetWebhookSubscriptions https://dev.twitch.tv/docs/api/reference/#get-webhook-subscriptions

func (*TwitchAPI) IDAuthenticatedGet

func (twitchAPI *TwitchAPI) IDAuthenticatedGet(url string,
	parameters url.Values,
	oauthToken string,
	responseBody interface{},
	onSuccess jsonapi.SuccessCallback,
	onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback) (response *http.Response, err error)

IDAuthenticatedGet request on the ID endpoint

func (*TwitchAPI) PostPost

func (twitchAPI *TwitchAPI) PostPost(oauthToken, content, channelName string, parameters url.Values,
	onSuccess func(SharedPost), onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback)

PostPost request for POST https://api.twitch.tv/kraken/feed/:channel/posts

func (*TwitchAPI) PostReaction

func (twitchAPI *TwitchAPI) PostReaction(oauthToken, emoteID, postID, channelName string,
	onSuccess func(Reaction), onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback)

PostReaction request for POST https://api.twitch.tv/kraken/feed/:channel/posts/:id/reactions

func (*TwitchAPI) PutBlock

func (twitchAPI *TwitchAPI) PutBlock(oauthToken, user, target string, onSuccess func(Block),
	onHTTPError jsonapi.HTTPErrorCallback, onInternalError jsonapi.InternalErrorCallback)

PutBlock request for PUT https://api.twitch.tv/kraken/users/:user/blocks/:target

func (*TwitchAPI) PutFollow

func (twitchAPI *TwitchAPI) PutFollow(oauthToken, user, target string, onSuccess func(Follow),
	onHTTPError jsonapi.HTTPErrorCallback, onInternalError jsonapi.InternalErrorCallback)

PutFollow request for PUT https://api.twitch.tv/kraken/users/:user/follows/channels/:target

func (*TwitchAPI) SubscribeFollows

func (twitchAPI *TwitchAPI) SubscribeFollows(userID, callbackURL string, onSuccess func(), onError func())

SubscribeFollows subscribes to the follow webhook

func (*TwitchAPI) SubscribeStreams

func (twitchAPI *TwitchAPI) SubscribeStreams(userID, callbackURL string, onSuccess func(), onError func())

SubscribeStreams xd

func (*TwitchAPI) ValidateOAuthToken

func (twitchAPI *TwitchAPI) ValidateOAuthToken(oauthToken string, onSuccess func(ValidateResponse), onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback) (response *http.Response, err error)

ValidateOAuthToken will validate an oauth token with your client id

func (*TwitchAPI) ValidateOAuthTokenSimple

func (twitchAPI *TwitchAPI) ValidateOAuthTokenSimple(oauthToken string) (data *ValidateResponse, response *http.Response, err error)

func (*TwitchAPI) WebhookSubscribe

func (twitchAPI *TwitchAPI) WebhookSubscribe(callbackURL string, topic WebhookTopic, twitchUserID string, lease time.Duration, secret string,
	onSuccess func(WebhookSubscribeResponse), onHTTPError jsonapi.HTTPErrorCallback,
	onInternalError jsonapi.InternalErrorCallback) (response *http.Response, err error)

https://dev.twitch.tv/docs/api/webhooks-reference/#subscribe-tounsubscribe-from-events

func (*TwitchAPI) WebhookSubscribeSimple

func (twitchAPI *TwitchAPI) WebhookSubscribeSimple(callbackURL string, topic WebhookTopic, twitchUserID string, lease time.Duration, secret string) (data *WebhookSubscribeResponse, response *http.Response, 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"`
}

User json to struct

type V5GetClipResponse

type V5GetClipResponse struct {
	Slug        string `json:"slug"`
	TrackingID  string `json:"tracking_id"`
	URL         string `json:"url"`
	EmbedURL    string `json:"embed_url"`
	EmbedHTML   string `json:"embed_html"`
	Broadcaster struct {
		ID          string `json:"id"`
		Name        string `json:"name"`
		DisplayName string `json:"display_name"`
		ChannelURL  string `json:"channel_url"`
		Logo        string `json:"logo"`
	} `json:"broadcaster"`
	Curator struct {
		ID          string `json:"id"`
		Name        string `json:"name"`
		DisplayName string `json:"display_name"`
		ChannelURL  string `json:"channel_url"`
		Logo        string `json:"logo"`
	} `json:"curator"`
	Vod struct {
		ID  string `json:"id"`
		URL string `json:"url"`
	} `json:"vod"`
	Game       string    `json:"game"`
	Language   string    `json:"language"`
	Title      string    `json:"title"`
	Views      int       `json:"views"`
	Duration   float64   `json:"duration"`
	CreatedAt  time.Time `json:"created_at"`
	Thumbnails struct {
		Medium string `json:"medium"`
		Small  string `json:"small"`
		Tiny   string `json:"tiny"`
	} `json:"thumbnails"`
}

type ValidateResponse

type ValidateResponse struct {
	ClientID string   `json:"client_id"`
	Login    string   `json:"login"`
	Scopes   []string `json:"scopes"`
	UserID   string   `json:"user_id"`
}

type Webhook

type Webhook struct {
	// URL where notifications will be delivered
	CallbackURL string `json:"hub.callback"`

	// Type of request. Valid values: subscribe, unsubscribe
	Mode string `json:"hub.mode"`

	// URL for the topic to subscribe to or unsubscribe from
	Topic string `json:"hub.topic"`

	LeaseSeconds int `json:"hub.lease_seconds,omitempty"`

	Secret string `json:"hub.secret,omitempty"`
}

type WebhookSubscribeResponse

type WebhookSubscribeResponse json.RawMessage

type WebhookSubscription

type WebhookSubscription struct {
	Topic     string    `json:"topic"`
	Callback  string    `json:"callback"`
	ExpiresAt time.Time `json:"expires_at"`
}

type WebhookSubscriptionsResponse

type WebhookSubscriptionsResponse struct {
	Total      int                   `json:"total"`
	Data       []WebhookSubscription `json:"data"`
	Pagination Pagination            `json:"pagination"`
}

type WebhookTopic

type WebhookTopic int
const (
	WebhookTopicFollowers WebhookTopic = iota
	WebhookTopicStreams
	WebhookTopicUserChanged
)

func (WebhookTopic) String

func (t WebhookTopic) String() string

func (WebhookTopic) URL

func (t WebhookTopic) URL(twitchUserID string) string

Jump to

Keyboard shortcuts

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