twitch

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BadgeBroadcaster = "broadcaster"
	BadgeFounder     = "founder"
	BadgeModerator   = "moderator"
	BadgeSubscriber  = "subscriber"
	BadgeVIP         = "vip"
)
View Source
const (
	EventSubEventTypeChannelUpdate = "channel.update"
	EventSubEventTypeStreamOffline = "stream.offline"
	EventSubEventTypeStreamOnline  = "stream.online"
)

Variables

Functions

This section is empty.

Types

type APICache

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

func (*APICache) Get

func (t *APICache) Get(key []string) interface{}

func (*APICache) Set

func (t *APICache) Set(key []string, valid time.Duration, data interface{})

type BadgeCollection

type BadgeCollection map[string]*int

func ParseBadgeLevels

func ParseBadgeLevels(m *irc.Message) BadgeCollection

func (BadgeCollection) Add

func (b BadgeCollection) Add(badge string, level int)

func (BadgeCollection) Get

func (b BadgeCollection) Get(badge string) int

func (BadgeCollection) Has

func (b BadgeCollection) Has(badge string) bool

type Category added in v0.18.0

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

type Client

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

func New

func New(clientID, token string) *Client

func (Client) APICache

func (c Client) APICache() *APICache

func (Client) GetAuthorizedUsername

func (c Client) GetAuthorizedUsername() (string, error)

func (Client) GetCurrentStreamInfo added in v1.3.0

func (c Client) GetCurrentStreamInfo(username string) (*StreamInfo, error)

func (Client) GetDisplayNameForUser

func (c Client) GetDisplayNameForUser(username string) (string, error)

func (Client) GetFollowDate

func (c Client) GetFollowDate(from, to string) (time.Time, error)

func (Client) GetIDForUsername added in v0.18.0

func (c Client) GetIDForUsername(username string) (string, error)

func (Client) GetRecentStreamInfo

func (c Client) GetRecentStreamInfo(username string) (string, string, error)

func (Client) GetUserInformation added in v1.0.0

func (c Client) GetUserInformation(user string) (*User, error)

func (Client) HasLiveStream

func (c Client) HasLiveStream(username string) (bool, error)

func (Client) ModifyChannelInformation added in v0.18.0

func (c Client) ModifyChannelInformation(ctx context.Context, broadcasterName string, game, title *string) error

func (Client) SearchCategories added in v0.18.0

func (c Client) SearchCategories(ctx context.Context, name string) ([]Category, error)

type EventSubClient added in v1.6.0

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

func NewEventSubClient added in v1.6.0

func NewEventSubClient(apiURL, secret, secretHandle string) *EventSubClient

func (*EventSubClient) Authorize added in v1.6.0

func (e *EventSubClient) Authorize(clientID, clientSecret string) error

func (*EventSubClient) HandleEventsubPush added in v1.6.0

func (e *EventSubClient) HandleEventsubPush(w http.ResponseWriter, r *http.Request)

func (*EventSubClient) RegisterEventSubHooks added in v1.6.0

func (e *EventSubClient) RegisterEventSubHooks(event string, condition EventSubCondition, callback func(json.RawMessage) error) (func(), error)

type EventSubCondition added in v1.6.0

type EventSubCondition struct {
	BroadcasterUserID     string `json:"broadcaster_user_id,omitempty"`
	CampaignID            string `json:"campaign_id,omitempty"`
	CategoryID            string `json:"category_id,omitempty"`
	ClientID              string `json:"client_id,omitempty"`
	ExtensionClientID     string `json:"extension_client_id,omitempty"`
	FromBroadcasterUserID string `json:"from_broadcaster_user_id,omitempty"`
	OrganizationID        string `json:"organization_id,omitempty"`
	RewardID              string `json:"reward_id,omitempty"`
	ToBroadcasterUserID   string `json:"to_broadcaster_user_id,omitempty"`
	UserID                string `json:"user_id,omitempty"`
}

func (EventSubCondition) Hash added in v1.6.0

func (e EventSubCondition) Hash() (string, error)

type EventSubEventChannelUpdate added in v1.6.0

type EventSubEventChannelUpdate struct {
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	Title                string `json:"title"`
	Language             string `json:"language"`
	CategoryID           string `json:"category_id"`
	CategoryName         string `json:"category_name"`
	IsMature             bool   `json:"is_mature"`
}

type EventSubEventFollow added in v1.6.0

type EventSubEventFollow struct {
	UserID               string    `json:"user_id"`
	UserLogin            string    `json:"user_login"`
	UserName             string    `json:"user_name"`
	BroadcasterUserID    string    `json:"broadcaster_user_id"`
	BroadcasterUserLogin string    `json:"broadcaster_user_login"`
	BroadcasterUserName  string    `json:"broadcaster_user_name"`
	FollowedAt           time.Time `json:"followed_at"`
}

type EventSubEventStreamOffline added in v1.6.0

type EventSubEventStreamOffline struct {
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
}

type EventSubEventStreamOnline added in v1.6.0

type EventSubEventStreamOnline struct {
	ID                   string    `json:"id"`
	BroadcasterUserID    string    `json:"broadcaster_user_id"`
	BroadcasterUserLogin string    `json:"broadcaster_user_login"`
	BroadcasterUserName  string    `json:"broadcaster_user_name"`
	Type                 string    `json:"type"`
	StartedAt            time.Time `json:"started_at"`
}

type StreamInfo added in v1.3.0

type StreamInfo 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    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 User added in v1.0.0

type User struct {
	DisplayName     string `json:"display_name"`
	ID              string `json:"id"`
	Login           string `json:"login"`
	ProfileImageURL string `json:"profile_image_url"`
}

Jump to

Keyboard shortcuts

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